net: sxgbe: add TSO support for Samsung sxgbe
Subsystems (3)
PATCH v2 2/7 net: sxgbe: add TSO support for Samsung sxgbe
From: Vipul Pandya <[email protected]>
Enable TSO during initialization for each DMA channels
Signed-off-by Vipul Pandya <[email protected]>
Neatening-by Joe Perches <[email protected]>
Signed-off-by Byungho An <[email protected]>
--- drivers/net/ethernet/samsung/sxgbe_desc.c | 47 +++++++++++++++--- drivers/net/ethernet/samsung/sxgbe_desc.h | 17 +++++-- drivers/net/ethernet/samsung/sxgbe_dma.c | 10 ++++ drivers/net/ethernet/samsung/sxgbe_dma.h | 2 + drivers/net/ethernet/samsung/sxgbe_main.c | 75 ++++++++++++++++++++++++++--- 5 files changed, 130 insertions(+), 21 deletions(-)
drivers/net/ethernet/samsung/sxgbe_desc.c +39 -8
@@ -28,6 +28,16 @@ static void sxgbe_init_tx_desc(struct sxgbe_tx_norm_desc *p) p->tdes23.tx_rd_des23.own_bit =0 ; } +static void sxgbe_tx_desc_enable_tse (struct sxgbe_tx_norm_desc *p,u8 is_tse, +u32 total_hdr_len,u32 tcp_hdr_len, +u32 tcp_payload_len) +{ + p->tdes23.tx_rd_des23.tse_bit = is_tse; + p->tdes23.tx_rd_des23.buf1_size = total_hdr_len; + p->tdes23.tx_rd_des23.tcp_hdr_len = tcp_hdr_len /4 ; + p->tdes23.tx_rd_des23.tx_pkt_len.tcp_payload_len = tcp_payload_len; +} +/* Assign buffer lengths for descriptor */ static void sxgbe_prepare_tx_desc (struct sxgbe_tx_norm_desc *p,u8 is_fd,int buf1_len,int pkt_len,int cksum)
@@ -102,36 +112,47 @@ static int sxgbe_get_tx_timestamp_status(struct sxgbe_tx_norm_desc *p) }/* TX Context Descripto Specific */ -static void sxgbe_init_tx_ctxtdesc (struct sxgbe_tx_ctxt_desc *p) +static void sxgbe_tx_ctxt_desc_set_ctxt (struct sxgbe_tx_ctxt_desc *p) { p->ctxt_bit =1 ; - p->own_bit =0 ; }/* Set the owner of TX context descriptor */ -static void sxgbe_set_tx_ctxt_owner (struct sxgbe_tx_ctxt_desc *p) +static void sxgbe_tx_ctxt_desc_set_owner (struct sxgbe_tx_ctxt_desc *p) { p->own_bit =1 ; }/* Get the owner of TX context descriptor */ -static int sxgbe_get_tx_ctxt_owner (struct sxgbe_tx_ctxt_desc *p) +static int sxgbe_tx_ctxt_desc_get_owner (struct sxgbe_tx_ctxt_desc *p) {return p->own_bit; }/* Set TX mss in TX context Descriptor */ -static void sxgbe_tx_ctxt_desc_setmss (struct sxgbe_tx_ctxt_desc *p,int mss) +static void sxgbe_tx_ctxt_desc_set_mss (struct sxgbe_tx_ctxt_desc *p,u16 mss) { p->maxseg_size = mss; }/* Get TX mss from TX context Descriptor */ -static int sxgbe_tx_ctxt_desc_getmss (struct sxgbe_tx_ctxt_desc *p) +static int sxgbe_tx_ctxt_desc_get_mss (struct sxgbe_tx_ctxt_desc *p) {return p->maxseg_size; } +/* Set TX tcmssv in TX context Descriptor */ +static void sxgbe_tx_ctxt_desc_set_tcmssv (struct sxgbe_tx_ctxt_desc *p) +{ + p->tcmssv =1 ; +} + +/* Reset TX ostc in TX context Descriptor */ +static void sxgbe_tx_ctxt_desc_reset_ostc (struct sxgbe_tx_ctxt_desc *p) +{ + p->ostc =0 ; +} +/* Set IVLAN information */ static void sxgbe_tx_ctxt_desc_set_ivlantag(struct sxgbe_tx_ctxt_desc *p, int is_ivlanvalid, int ivlan_tag,
@@ -177,13 +198,13 @@ static void sxgbe_tx_ctxt_desc_set_tstamp(struct sxgbe_tx_ctxt_desc *p, } }/* Close TX context descriptor */ -static void sxgbe_close_tx_ctxt_desc (struct sxgbe_tx_ctxt_desc *p) +static void sxgbe_tx_ctxt_desc_close (struct sxgbe_tx_ctxt_desc *p) { p->own_bit =1 ; }/* WB status of context descriptor */ -static int sxgbe_get_tx_ctxt_cde (struct sxgbe_tx_ctxt_desc *p) +static int sxgbe_tx_ctxt_desc_get_cde (struct sxgbe_tx_ctxt_desc *p) {return p->ctxt_desc_err; }
@@ -432,6 +453,7 @@ static u64 sxgbe_get_rx_timestamp(struct sxgbe_rx_ctxt_desc *p)static const struct sxgbe_desc_ops desc_ops = { .init_tx_desc = sxgbe_init_tx_desc, + .tx_desc_enable_tse = sxgbe_tx_desc_enable_tse, .prepare_tx_desc = sxgbe_prepare_tx_desc, .tx_vlanctl_desc = sxgbe_tx_vlanctl_desc, .set_tx_owner = sxgbe_set_tx_owner,
@@ -443,11 +465,20 @@ static const struct sxgbe_desc_ops desc_ops = { .get_tx_len = sxgbe_get_tx_len, .tx_enable_tstamp = sxgbe_tx_enable_tstamp, .get_tx_timestamp_status = sxgbe_get_tx_timestamp_status, + .tx_ctxt_desc_set_ctxt = sxgbe_tx_ctxt_desc_set_ctxt, + .tx_ctxt_desc_set_owner = sxgbe_tx_ctxt_desc_set_owner, + .get_tx_ctxt_owner = sxgbe_tx_ctxt_desc_get_owner, + .tx_ctxt_desc_set_mss = sxgbe_tx_ctxt_desc_set_mss, + .tx_ctxt_desc_get_mss = sxgbe_tx_ctxt_desc_get_mss, + .tx_ctxt_desc_set_tcmssv = sxgbe_tx_ctxt_desc_set_tcmssv, + .tx_ctxt_desc_reset_ostc = sxgbe_tx_ctxt_desc_reset_ostc, .tx_ctxt_desc_set_ivlantag = sxgbe_tx_ctxt_desc_set_ivlantag, .tx_ctxt_desc_get_ivlantag = sxgbe_tx_ctxt_desc_get_ivlantag, .tx_ctxt_desc_set_vlantag = sxgbe_tx_ctxt_desc_set_vlantag, .tx_ctxt_desc_get_vlantag = sxgbe_tx_ctxt_desc_get_vlantag, .tx_ctxt_set_tstamp = sxgbe_tx_ctxt_desc_set_tstamp, + .close_tx_ctxt_desc = sxgbe_tx_ctxt_desc_close, + .get_tx_ctxt_cde = sxgbe_tx_ctxt_desc_get_cde, .init_rx_desc = sxgbe_init_rx_desc, .get_rx_owner = sxgbe_get_rx_owner, .set_rx_owner = sxgbe_set_rx_owner,
drivers/net/ethernet/samsung/sxgbe_desc.h +12 -5
@@ -167,8 +167,9 @@ struct sxgbe_desc_ops {void (*init_tx_desc)(struct sxgbe_tx_norm_desc *p);/* Invoked by the xmit function to prepare the tx descriptor */ -void (*tx_enable_tse)(struct sxgbe_tx_norm_desc *p,u8 is_tse, -u32 hdr_len,u32 payload_len); +void (*tx_desc_enable_tse)(struct sxgbe_tx_norm_desc *p,u8 is_tse, +u32 total_hdr_len,u32 tcp_hdr_len, +u32 tcp_payload_len);/* Assign buffer lengths for descriptor */ void (*prepare_tx_desc)(struct sxgbe_tx_norm_desc *p, u8 is_fd,
@@ -207,20 +208,26 @@ struct sxgbe_desc_ops {int (*get_tx_timestamp_status)(struct sxgbe_tx_norm_desc *p);/* TX Context Descripto Specific */ -void (*init_tx_ctxt_desc)(struct sxgbe_tx_ctxt_desc *p); +void (*tx_ctxt_desc_set_ctxt)(struct sxgbe_tx_ctxt_desc *p);/* Set the owner of the TX context descriptor */ -void (*set_tx_ctxt_owner)(struct sxgbe_tx_ctxt_desc *p); +void (*tx_ctxt_desc_set_owner)(struct sxgbe_tx_ctxt_desc *p);/* Get the owner of the TX context descriptor */ int (*get_tx_ctxt_owner)(struct sxgbe_tx_ctxt_desc *p);/* Set TX mss */ -void (*tx_ctxt_desc_setmss)(struct sxgbe_tx_ctxt_desc *p,int mss); +void (*tx_ctxt_desc_set_mss)(struct sxgbe_tx_ctxt_desc *p,u16 mss);/* Set TX mss */ int (*tx_ctxt_desc_get_mss)(struct sxgbe_tx_ctxt_desc *p); +/* Set TX tcmssv */ +void (*tx_ctxt_desc_set_tcmssv)(struct sxgbe_tx_ctxt_desc *p); + +/* Reset TX ostc */ +void (*tx_ctxt_desc_reset_ostc)(struct sxgbe_tx_ctxt_desc *p); +/* Set IVLAN information */ void (*tx_ctxt_desc_set_ivlantag)(struct sxgbe_tx_ctxt_desc *p, int is_ivlanvalid, int ivlan_tag,
drivers/net/ethernet/samsung/sxgbe_dma.c +10 -0
@@ -353,6 +353,15 @@ static void sxgbe_dma_rx_watchdog(void __iomem *ioaddr, u32 riwt) } } +static void sxgbe_enable_tso (void __iomem *ioaddr,u8 chan_num) +{ +u32 ctrl; + + ctrl =readl (ioaddr +SXGBE_DMA_CHA_TXCTL_REG (chan_num)); + ctrl |=SXGBE_DMA_CHA_TXCTL_TSE_ENABLE ; +writel (ctrl, ioaddr +SXGBE_DMA_CHA_TXCTL_REG (chan_num)); +} +static const struct sxgbe_dma_ops sxgbe_dma_ops = { .init = sxgbe_dma_init, .cha_init = sxgbe_dma_channel_init,
@@ -368,6 +377,7 @@ static const struct sxgbe_dma_ops sxgbe_dma_ops = { .tx_dma_int_status = sxgbe_tx_dma_int_status, .rx_dma_int_status = sxgbe_rx_dma_int_status, .rx_watchdog = sxgbe_dma_rx_watchdog, + .enable_tso = sxgbe_enable_tso, };const struct sxgbe_dma_ops *sxgbe_get_dma_ops (void )
drivers/net/ethernet/samsung/sxgbe_dma.h +2 -0
@@ -42,6 +42,8 @@ struct sxgbe_dma_ops { struct sxgbe_extra_stats *x);/* Program the HW RX Watchdog */ void (*rx_watchdog)(void __iomem *ioaddr,u32 riwt); +/* Enable TSO for each DMA channel */ +void (*enable_tso)(void __iomem *ioaddr,u8 chan_num); };const struct sxgbe_dma_ops *sxgbe_get_dma_ops (void );
drivers/net/ethernet/samsung/sxgbe_main.c +67 -8
123 lines not on this page · raw message
Signature · 1 line
1.7.10.4