net: fec: Enable Software TSO to improve the tx performance
Subsystems (3)
v2 cover net: fec: Enable Software TSO to improve the tx performance
$ ethtool -K eth0 sg on $ ethtool -K eth0 tso on [ 3] local 10.192.242.108 port 35388 connected with 10.192.242.167 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0- 3.0 sec 181 MBytes 506 Mbits/sec * cpu loading is 30%
$ ethtool -K eth0 sg off $ ethtool -K eth0 tso off [ 3] local 10.192.242.108 port 52618 connected with 10.192.242.167 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0- 3.0 sec 99.5 MBytes 278 Mbits/sec
FEC HW support IP header and TCP/UDP hw checksum, support multi buffer descriptor transfer one frame, but don't support HW TSO. And imx6q/dl SOC FEC Gbps speed has HW bus Bandwidth limitation (400Mbps ~ 700Mbps), imx6sx SOC FEC Gbps speed has no HW bandwidth limitation.
The patch set just enable TSO feature, which is done following the mv643xx_eth driver.
Test result analyze:
imx6dl sabresd board: there have 82% improvement, since imx6dl FEC HW has bandwidth limitation,
the performance with SW TSO is a milestone.
Addition test:
imx6sx sdb board:
upstream still don't support imx6sx due to some patches being upstream... they use same FEC IP. Use the SW TSO patches test imx6sx sdb board in internal kernel tree:
No SW TSO patch: tx bandwidth 840Mbps, cpu loading is 100%. SW TSO patch: tx bandwidth 942Mbps, cpu loading is 65%.
It means the patch set have great improvement for imx6sx FEC performance.
V2:
* From Frank Li's suggestion:
Change the API "fec_enet_txdesc_entry_free" name to "fec_enet_get_free_txdesc_num".
* Summary David Laight and Eric Dumazet's thoughts:
RX BD entry number change to 256.
* From ezequiel's suggestion:
Follow the latest TSO fixes from his solution to rework the queue stop/wake-up. Avoid unmapping the TSO header buffers.
* From Eric Dumazet's suggestion:
Avoid more bytes copy, just copying the unaligned part of the payload into first descriptor. The suggestion will bring more complex for the driver, and imx6dl FEC DMA need 16 bytes alignment, but cpu loading is not problem that cpu loading is 30%, the current performance is so better. Later chip like imx6sx Gigbit FEC DMA support byte alignment, so there don't exist memory copy. So, the V2 version drop the suggestion.
Anyway, thanks for Eric's response and suggestion.
Fugang Duan (6):
net: fec: Factorize the .xmit transmit function
net: fec: Enable IP header hardware checksum
net: fec: Factorize feature setting
net: fec: Increase buffer descriptor entry number
net: fec: Add Scatter/gather support
net: fec: Add software TSO support
drivers/net/ethernet/freescale/fec.h | 14 +- drivers/net/ethernet/freescale/fec_main.c | 548 ++++++++++++++++++++++++----- 2 files changed, 461 insertions(+), 101 deletions(-)
Signature · 1 line
1.7.8
PATCH v2 1/6 net: fec: Factorize the .xmit transmit function
Make the code more readable and easy to support other features like SG, TSO, moving the common transmit function to one api.
And the patch also factorize the getting BD index to it own function.
--- drivers/net/ethernet/freescale/fec_main.c | 87 ++++++++++++++++++----------- 1 files changed, 54 insertions(+), 33 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +54 -33
@@ -287,6 +287,25 @@ struct bufdesc *fec_enet_get_prevdesc(struct bufdesc *bdp, struct fec_enet_privareturn (new_bd < base) ? (new_bd + ring_size) : new_bd; } +static inline +int fec_enet_get_bd_index (struct bufdesc *bdp,struct fec_enet_private *fep) +{ +struct bufdesc *base; +int index; + +if (bdp >= fep->tx_bd_base) + base = fep->tx_bd_base; +else + base = fep->rx_bd_base; + +if (fep->bufdesc_ex) + index = (struct bufdesc_ex *)bdp - (struct bufdesc_ex *)base; +else + index = bdp - base; + +return index; +} +static void *swap_buffer (void *bufaddr,int len) {int i;
@@ -313,8 +332,7 @@ fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev)return 0 ; } -static netdev_tx_t -fec_enet_start_xmit (struct sk_buff *skb,struct net_device *ndev) +static int txq_submit_skb (struct sk_buff *skb,struct net_device *ndev) {struct fec_enet_private *fep =netdev_priv (ndev); const struct platform_device_id *id_entry =
@@ -329,14 +347,6 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) status = bdp->cbd_sc; -if (status &BD_ENET_TX_READY ) { -/* Ooops. All transmit buffers are full. Bail out. -* This should not happen, since ndev->tbusy should be set. -*/ -netdev_err (ndev,"tx queue full!\n" ); -return NETDEV_TX_BUSY ; - } -/* Protocol checksum off-load for TCP and UDP. */ if (fec_enet_clear_csum (skb, ndev)) {dev_kfree_skb_any (skb);
@@ -350,16 +360,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) bufaddr = skb->data; bdp->cbd_datlen = skb->len; -/* -* On some FEC implementations data must be aligned on -* 4-byte boundaries. Use bounce buffers to copy data -* and get it aligned. Ugh. -*/ -if (fep->bufdesc_ex) - index = (struct bufdesc_ex *)bdp - - (struct bufdesc_ex *)fep->tx_bd_base; -else - index = bdp - fep->tx_bd_base; + index =fec_enet_get_bd_index (bdp, fep);if (((unsigned long ) bufaddr) &FEC_ALIGNMENT ) {memcpy (fep->tx_bounce[index], skb->data, skb->len);
@@ -433,15 +434,43 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) fep->cur_tx = bdp; -if (fep->cur_tx == fep->dirty_tx) -netif_stop_queue (ndev); -/* Trigger transmission start */ writel (0 , fep->hwp +FEC_X_DES_ACTIVE );return NETDEV_TX_OK ; } +static netdev_tx_t +fec_enet_start_xmit (struct sk_buff *skb,struct net_device *ndev) +{ +struct fec_enet_private *fep =netdev_priv (ndev); +struct bufdesc *bdp; +unsigned short status; +int ret; + +/* Fill in a Tx ring entry */ + bdp = fep->cur_tx; + + status = bdp->cbd_sc; + +if (status &BD_ENET_TX_READY ) { +/* Ooops. All transmit buffers are full. Bail out. +* This should not happen, since ndev->tbusy should be set. +*/ +netdev_err (ndev,"tx queue full!\n" ); +return NETDEV_TX_BUSY ; + } + + ret =txq_submit_skb (skb, ndev); +if (ret == -EBUSY ) +return NETDEV_TX_BUSY ; + +if (fep->cur_tx == fep->dirty_tx) +netif_stop_queue (ndev); + +return NETDEV_TX_OK ; +} +/* Init RX & TX buffer descriptors */ static void fec_enet_bd_init (struct net_device *dev)
@@ -770,11 +799,7 @@ fec_enet_tx(struct net_device *ndev)if (bdp == fep->cur_tx)break ; -if (fep->bufdesc_ex) - index = (struct bufdesc_ex *)bdp - - (struct bufdesc_ex *)fep->tx_bd_base; -else - index = bdp - fep->tx_bd_base; + index =fec_enet_get_bd_index (bdp, fep); skb = fep->tx_skbuff[index]; dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, skb->len,
@@ -921,11 +946,7 @@ fec_enet_rx(struct net_device *ndev, int budget) pkt_len = bdp->cbd_datlen; ndev->stats.rx_bytes += pkt_len; -if (fep->bufdesc_ex) - index = (struct bufdesc_ex *)bdp - - (struct bufdesc_ex *)fep->rx_bd_base; -else - index = bdp - fep->rx_bd_base; + index =fec_enet_get_bd_index (bdp, fep); data = fep->rx_skbuff[index]->data;dma_sync_single_for_cpu (&fep->pdev->dev, bdp->cbd_bufaddr,FEC_ENET_RX_FRSIZE ,DMA_FROM_DEVICE );
Signature · 1 line
1.7.8
RE: [PATCH v2 1/6] net: fec: Factorize the .xmit transmit function
From: Fugang Duan
Quoted 4 lines
Make the code more readable and easy to support other features like SG, TSO, moving the common transmit function to one api.
And the patch also factorize the getting BD index to it own function.
Except that you seem to have added additional conditional clauses into the common code paths.
David
Quoted 153 lines
Signed-off-by Fugang Duan <[email protected]>--- drivers/net/ethernet/freescale/fec_main.c | 87 ++++++++++++++++++----------- 1 files changed, 54 insertions(+), 33 deletions(-)drivers/net/ethernet/freescale/fec_main.c +54
-34@@ -287,6 +287,25 @@ struct bufdesc *fec_enet_get_prevdesc(struct bufdesc *bdp, struct fec_enet_privareturn (new_bd < base) ? (new_bd + ring_size) : new_bd; } +static inline +int fec_enet_get_bd_index (struct bufdesc *bdp,struct fec_enet_private *fep) +{ +struct bufdesc *base; +int index; + +if (bdp >= fep->tx_bd_base) + base = fep->tx_bd_base; +else + base = fep->rx_bd_base; + +if (fep->bufdesc_ex) + index = (struct bufdesc_ex *)bdp - (struct bufdesc_ex *)base; +else + index = bdp - base; + +return index; +} +static void *swap_buffer (void *bufaddr,int len) {int i;@@ -313,8 +332,7 @@ fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev)return 0 ; } -static netdev_tx_t -fec_enet_start_xmit (struct sk_buff *skb,struct net_device *ndev) +static int txq_submit_skb (struct sk_buff *skb,struct net_device *ndev) {struct fec_enet_private *fep =netdev_priv (ndev); const struct platform_device_id *id_entry =@@ -329,14 +347,6 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) status = bdp->cbd_sc; -if (status &BD_ENET_TX_READY ) { -/* Ooops. All transmit buffers are full. Bail out. -* This should not happen, since ndev->tbusy should be set. -*/ -netdev_err (ndev,"tx queue full!\n" ); -return NETDEV_TX_BUSY ; - } -/* Protocol checksum off-load for TCP and UDP. */ if (fec_enet_clear_csum (skb, ndev)) {dev_kfree_skb_any (skb);@@ -350,16 +360,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) bufaddr = skb->data; bdp->cbd_datlen = skb->len; -/* -* On some FEC implementations data must be aligned on -* 4-byte boundaries. Use bounce buffers to copy data -* and get it aligned. Ugh. -*/ -if (fep->bufdesc_ex) - index = (struct bufdesc_ex *)bdp - - (struct bufdesc_ex *)fep->tx_bd_base; -else - index = bdp - fep->tx_bd_base; + index =fec_enet_get_bd_index (bdp, fep);if (((unsigned long ) bufaddr) &FEC_ALIGNMENT ) {memcpy (fep->tx_bounce[index], skb->data, skb->len);@@ -433,15 +434,43 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) fep->cur_tx = bdp; -if (fep->cur_tx == fep->dirty_tx) -netif_stop_queue (ndev); -/* Trigger transmission start */ writel (0 , fep->hwp +FEC_X_DES_ACTIVE );return NETDEV_TX_OK ; } +static netdev_tx_t +fec_enet_start_xmit (struct sk_buff *skb,struct net_device *ndev) +{ +struct fec_enet_private *fep =netdev_priv (ndev); +struct bufdesc *bdp; +unsigned short status; +int ret; + +/* Fill in a Tx ring entry */ + bdp = fep->cur_tx; + + status = bdp->cbd_sc; + +if (status &BD_ENET_TX_READY ) { +/* Ooops. All transmit buffers are full. Bail out. +* This should not happen, since ndev->tbusy should be set. +*/ +netdev_err (ndev,"tx queue full!\n" ); +return NETDEV_TX_BUSY ; + } + + ret =txq_submit_skb (skb, ndev); +if (ret == -EBUSY ) +return NETDEV_TX_BUSY ; + +if (fep->cur_tx == fep->dirty_tx) +netif_stop_queue (ndev); + +return NETDEV_TX_OK ; +} +/* Init RX & TX buffer descriptors */ static void fec_enet_bd_init (struct net_device *dev)@@ -770,11 +799,7 @@ fec_enet_tx(struct net_device *ndev)if (bdp == fep->cur_tx)break ; -if (fep->bufdesc_ex) - index = (struct bufdesc_ex *)bdp - - (struct bufdesc_ex *)fep->tx_bd_base; -else - index = bdp - fep->tx_bd_base; + index =fec_enet_get_bd_index (bdp, fep); skb = fep->tx_skbuff[index]; dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, skb->len,@@ -921,11 +946,7 @@ fec_enet_rx(struct net_device *ndev, int budget) pkt_len = bdp->cbd_datlen; ndev->stats.rx_bytes += pkt_len; -if (fep->bufdesc_ex) - index = (struct bufdesc_ex *)bdp - - (struct bufdesc_ex *)fep->rx_bd_base; -else - index = bdp - fep->rx_bd_base; + index =fec_enet_get_bd_index (bdp, fep); data = fep->rx_skbuff[index]->data;dma_sync_single_for_cpu (&fep->pdev->dev, bdp->cbd_bufaddr,FEC_ENET_RX_FRSIZE ,DMA_FROM_DEVICE ); --1.7.8
PATCH v2 2/6 net: fec: Enable IP header hardware checksum
In reply to Fugang DuanIP header checksum is calcalated by network layer in default. To support software TSO, it is better to use HW calculate the IP header checksum.
FEC hw checksum feature request the checksum field in frame is zero, otherwise the calculative CRC is not correct.
For segmentated TCP packet, HW calculate the IP header checksum again, it doesn't bring any impact. For SW TSO, HW calculated checksum bring better performance.
--- drivers/net/ethernet/freescale/fec_main.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +2 -1
@@ -327,6 +327,7 @@ fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev)if (unlikely (skb_cow_head (skb,0 )))return -1 ; +ip_hdr (skb)->check =0 ; *(__sum16 *)(skb->head + skb->csum_start + skb->csum_offset) =0 ;return 0 ;
@@ -408,7 +409,7 @@ static int txq_submit_skb(struct sk_buff *skb, struct net_device *ndev)* are done by the kernel */ if (skb->ip_summed ==CHECKSUM_PARTIAL ) - ebdp->cbd_esc |=BD_ENET_TX_PINS ; + ebdp->cbd_esc |=BD_ENET_TX_PINS |BD_ENET_TX_IINS ; } }
Signature · 1 line
1.7.8
PATCH v2 3/6 net: fec: Factorize feature setting
In reply to Fugang DuanIn order to enhance the code readable, let's factorize the feature list.
--- drivers/net/ethernet/freescale/fec_main.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +3 -5
@@ -2097,21 +2097,19 @@ static int fec_enet_init(struct net_device *ndev)writel (FEC_RX_DISABLED_IMASK , fep->hwp +FEC_IMASK );netif_napi_add (ndev, &fep->napi, fec_enet_rx_napi,NAPI_POLL_WEIGHT ); -if (id_entry->driver_data &FEC_QUIRK_HAS_VLAN ) { +if (id_entry->driver_data &FEC_QUIRK_HAS_VLAN )/* enable hw VLAN support */ ndev->features |=NETIF_F_HW_VLAN_CTAG_RX ; - ndev->hw_features |=NETIF_F_HW_VLAN_CTAG_RX ; - }if (id_entry->driver_data &FEC_QUIRK_HAS_CSUM ) {/* enable hw accelerator */ ndev->features |= (NETIF_F_IP_CSUM |NETIF_F_IPV6_CSUM |NETIF_F_RXCSUM ); - ndev->hw_features |= (NETIF_F_IP_CSUM |NETIF_F_IPV6_CSUM - |NETIF_F_RXCSUM ); fep->csum_flags |=FLAG_RX_CSUM_ENABLED ; } + ndev->hw_features = ndev->features; +fec_restart (ndev,0 );return 0 ;
Signature · 1 line
1.7.8
PATCH v2 4/6 net: fec: Increase buffer descriptor entry number
In reply to Fugang DuanIn order to support SG, software TSO, let's increase BD entry number.
--- drivers/net/ethernet/freescale/fec.h | 6 +++--- drivers/net/ethernet/freescale/fec_main.c | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-)
drivers/net/ethernet/freescale/fec.h +3 -3
@@ -240,14 +240,14 @@ struct bufdesc_ex {* the skbuffer directly. */ -#define FEC_ENET_RX_PAGES 8 +#define FEC_ENET_RX_PAGES 128#define FEC_ENET_RX_FRSIZE 2048#define FEC_ENET_RX_FRPPG (PAGE_SIZE / FEC_ENET_RX_FRSIZE)#define RX_RING_SIZE (FEC_ENET_RX_FRPPG * FEC_ENET_RX_PAGES)#define FEC_ENET_TX_FRSIZE 2048#define FEC_ENET_TX_FRPPG (PAGE_SIZE / FEC_ENET_TX_FRSIZE) -#define TX_RING_SIZE 16/* Must be power of two */ -#define TX_RING_MOD_MASK 15/* for this to work */ +#define TX_RING_SIZE 512/* Must be power of two */ +#define TX_RING_MOD_MASK 511/* for this to work */ #define BD_ENET_RX_INT 0x00800000#define BD_ENET_RX_PTP ((ushort)0x0400)
drivers/net/ethernet/freescale/fec_main.c +12 -9
@@ -173,10 +173,6 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");#endif #endif /* CONFIG_M5272 */ -#if (((RX_RING_SIZE +TX_RING_SIZE ) *32 ) >PAGE_SIZE ) -#error "FEC: descriptor ring size constants too large" -#endif -/* Interrupt events/masks. */ #define FEC_ENET_HBERR ((uint)0x80000000)/* Heartbeat error */ #define FEC_ENET_BABR ((uint)0x40000000)/* Babbling receiver */
@@ -2061,9 +2057,20 @@ static int fec_enet_init(struct net_device *ndev)const struct platform_device_id *id_entry =platform_get_device_id (fep->pdev);struct bufdesc *cbd_base; +int bd_size; + +/* init the tx & rx ring size */ + fep->tx_ring_size =TX_RING_SIZE ; + fep->rx_ring_size =RX_RING_SIZE ; + +if (fep->bufdesc_ex) + bd_size =sizeof (struct bufdesc_ex ); +else + bd_size =sizeof (struct bufdesc ); + bd_size *= (fep->tx_ring_size + fep->rx_ring_size);/* Allocate memory for buffer descriptors. */ - cbd_base =dma_alloc_coherent (NULL ,PAGE_SIZE , &fep->bd_dma, + cbd_base =dma_alloc_coherent (NULL , bd_size, &fep->bd_dma,GFP_KERNEL );if (!cbd_base)return -ENOMEM ;
@@ -2077,10 +2084,6 @@ static int fec_enet_init(struct net_device *ndev)/* make sure MAC we just acquired is programmed into the hw */ fec_set_mac_address (ndev,NULL ); -/* init the tx & rx ring size */ - fep->tx_ring_size =TX_RING_SIZE ; - fep->rx_ring_size =RX_RING_SIZE ; -/* Set receive and transmit descriptor base. */ fep->rx_bd_base = cbd_base;if (fep->bufdesc_ex)
Signature · 1 line
1.7.8
RE: [PATCH v2 4/6] net: fec: Increase buffer descriptor entry number
From: Fugang Duan
Quoted 16 lines
In order to support SG, software TSO, let's increase BD entry number.
CC Ezequiel Garcia <[email protected]>CC Eric Dumazet <[email protected]>CC David Laight <[email protected]>Signed-off-by Fugang Duan <[email protected]>--- drivers/net/ethernet/freescale/fec.h | 6 +++--- drivers/net/ethernet/freescale/fec_main.c | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-)drivers/net/ethernet/freescale/fec.h +0
-0
drivers/net/ethernet/freescale/fec.h struct bufdesc_ex { · line 246
Quoted 9 lines
drivers/net/ethernet/freescale/fec.h +1
-1@@ -240,14 +240,14 @@ struct bufdesc_ex {* the skbuffer directly. */ -#define FEC_ENET_RX_PAGES 8 +#define FEC_ENET_RX_PAGES 128#define FEC_ENET_RX_FRSIZE 2048#define FEC_ENET_RX_FRPPG (PAGE_SIZE / FEC_ENET_RX_FRSIZE)#define RX_RING_SIZE (FEC_ENET_RX_FRPPG * FEC_ENET_RX_PAGES)
You are changing the number of rx descriptors as well. This isn't mentioned in the description.
And, as I said before, basing this on PAGE_SIZE cannot be right.
David
RE: [PATCH v2 4/6] net: fec: Increase buffer descriptor entry number
From: David Laight <[email protected]> Data: Wednesday, June 04, 2014 5:27 PM
Quoted 39 lines
To: Duan Fugang-B38611; [email protected]
Cc: [email protected]; [email protected]; Estevam Fabio-R49496; [email protected]; [email protected]; [email protected]; Li Frank-B20596; [email protected]
Subject: RE: [PATCH v2 4/6] net: fec: Increase buffer descriptor entry numberFrom: Fugang Duan
Quoted 9 lines
In order to support SG, software TSO, let's increase BD entry number.
CC Ezequiel Garcia <[email protected]>CC Eric Dumazet <[email protected]>CC David Laight <[email protected]>Signed-off-by Fugang Duan <[email protected]>--- drivers/net/ethernet/freescale/fec.h | 6 +++--- drivers/net/ethernet/freescale/fec_main.c | 21 ++++++++++++---------
Review
Quoted 3 lines
2 files changed, 15 insertions(+), 12 deletions(-)(quoted diff) +0
-0
b/drivers/net/ethernet/freescale/fec.hdrivers/net/ethernet/freescale/fec.h struct bufdesc_ex { · line 246
Quoted 13 lines
index 3b8d6d1..798ad88 100644
drivers/net/ethernet/freescale/fec.h +1
-1@@ -240,14 +240,14 @@ struct bufdesc_ex {* the skbuffer directly. */ -#define FEC_ENET_RX_PAGES 8 +#define FEC_ENET_RX_PAGES 128#define FEC_ENET_RX_FRSIZE 2048#define FEC_ENET_RX_FRPPG (PAGE_SIZE / FEC_ENET_RX_FRSIZE)#define RX_RING_SIZE (FEC_ENET_RX_FRPPG * FEC_ENET_RX_PAGES)You are changing the number of rx descriptors as well. This isn't mentioned in the description.
Quoted 4 lines
And, as I said before, basing this on
PAGE_SIZEcannot be right.David
The patch just increase tx and rx BD entry number, and from previous discuss, we set tx number to 512, rx number to 256.
Thanks,
Andy
RE: [PATCH v2 4/6] net: fec: Increase buffer descriptor entry number
In reply to David LaightHi, David,
From: David Laight <[email protected]> Data: Wednesday, June 04, 2014 5:27 PM
Quoted 38 lines
To: Duan Fugang-B38611; [email protected]
Cc: [email protected]; [email protected]; Estevam Fabio-R49496; [email protected]; [email protected]; [email protected]; Li Frank-B20596; [email protected]
Subject: RE: [PATCH v2 4/6] net: fec: Increase buffer descriptor entry numberFrom: Fugang Duan
Quoted 6 lines
In order to support SG, software TSO, let's increase BD entry number.
CC Ezequiel Garcia <[email protected]>CC Eric Dumazet <[email protected]>CC David Laight <[email protected]>Signed-off-by Fugang Duan <[email protected]>Review
Quoted 6 lines
--- drivers/net/ethernet/freescale/fec.h | 6 +++--- drivers/net/ethernet/freescale/fec_main.c | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-)(quoted diff) +0
-0
b/drivers/net/ethernet/freescale/fec.hdrivers/net/ethernet/freescale/fec.h struct bufdesc_ex { · line 246
Quoted 13 lines
index 3b8d6d1..798ad88 100644
drivers/net/ethernet/freescale/fec.h +1
-1@@ -240,14 +240,14 @@ struct bufdesc_ex {* the skbuffer directly. */ -#define FEC_ENET_RX_PAGES 8 +#define FEC_ENET_RX_PAGES 128#define FEC_ENET_RX_FRSIZE 2048#define FEC_ENET_RX_FRPPG (PAGE_SIZE / FEC_ENET_RX_FRSIZE)#define RX_RING_SIZE (FEC_ENET_RX_FRPPG * FEC_ENET_RX_PAGES)You are changing the number of rx descriptors as well. This isn't mentioned in the description.
Quoted 3 lines
And, as I said before, basing this on
PAGE_SIZEcannot be right.David
Ok, I agree your advice.
I will remove the change for RX BD entry. After test, the performance has no impact.
My initial purpose of increasing it is for interrupt coalescing patch.
Thanks,
Andy
PATCH v2 5/6 net: fec: Add Scatter/gather support
In reply to Fugang DuanAdd Scatter/gather support for FEC.
This feature allows to improve outbound throughput performance.
Tested on imx6dl sabresd board:
Running iperf tests shows a 55.4% improvement.
$ ethtool -K eth0 sg off $ iperf -c 10.192.242.167 -t 3 & [ 3] local 10.192.242.108 port 52618 connected with 10.192.242.167 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0- 3.0 sec 99.5 MBytes 278 Mbits/sec
$ ethtool -K eth0 sg on $ iperf -c 10.192.242.167 -t 3 & [ 3] local 10.192.242.108 port 52617 connected with 10.192.242.167 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0- 3.0 sec 154 MBytes 432 Mbits/sec
--- drivers/net/ethernet/freescale/fec.h | 2 +- drivers/net/ethernet/freescale/fec_main.c | 245 ++++++++++++++++++++++------- 2 files changed, 185 insertions(+), 62 deletions(-)
drivers/net/ethernet/freescale/fec.h +1 -1
@@ -221,7 +221,7 @@ struct bufdesc_ex {#define BD_ENET_TX_RCMASK ((ushort)0x003c)#define BD_ENET_TX_UN ((ushort)0x0002)#define BD_ENET_TX_CSL ((ushort)0x0001) -#define BD_ENET_TX_STATS ((ushort)0x03ff)/* All status bits */ +#define BD_ENET_TX_STATS ((ushort)0x0fff)/* All status bits */ /*enhanced buffer descriptor control/status used by Ethernet transmit*/ #define BD_ENET_TX_INT 0x40000000
drivers/net/ethernet/freescale/fec_main.c +184 -61
364 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH v2 6/6 net: fec: Add software TSO support
In reply to Fugang DuanAdd software TSO support for FEC.
This feature allows to improve outbound throughput performance.
Tested on imx6dl sabresd board, running iperf tcp tests shows:
- 16.2% improvement comparing with FEC SG patch
- 82% improvement comparing with NO SG & TSO patch
$ ethtool -K eth0 tso on $ iperf -c 10.192.242.167 -t 3 & [ 3] local 10.192.242.108 port 35388 connected with 10.192.242.167 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0- 3.0 sec 181 MBytes 506 Mbits/sec
During the testing, CPU loading is 30%.
Since imx6dl FEC Bandwidth is limited to SOC system bus bandwidth, the performance with SW TSO is a milestone.
--- drivers/net/ethernet/freescale/fec.h | 6 + drivers/net/ethernet/freescale/fec_main.c | 254 ++++++++++++++++++++++++++--- 2 files changed, 237 insertions(+), 23 deletions(-)
drivers/net/ethernet/freescale/fec.h +6 -0
@@ -298,6 +298,12 @@ struct fec_enet_private {unsigned short tx_ring_size;unsigned short rx_ring_size; +unsigned short tx_stop_threshold; +unsigned short tx_wake_threshold; + +/* Software TSO */ +char *tso_hdrs; +dma_addr_t tso_hdrs_dma;struct platform_device *pdev;
drivers/net/ethernet/freescale/fec_main.c +231 -23
331 lines not on this page · raw message
Signature · 1 line
1.7.8
David Miller
maintainerI think you need to start taking David Laight's feedback more seriously.
He's right, it makes no sense at all the increase the number of RX descriptors for the sake of a send side feature like TSO.
If you have a another reason to increase the RX descriptor count, do it as a separate change and with an appropriate commit log message explaining WHY you are doing this.
I'm not applying this patch series until you start taking the feedback you are receiving to heart.
Hi, David,
From: David Miller <[email protected]> Data: Thursday, June 05, 2014 6:29 AM
Quoted 14 lines
To: Duan Fugang-B38611
Cc: [email protected]; [email protected]; Estevam Fabio-R49496; [email protected]; [email protected]; [email protected]; Li Frank-B20596; [email protected]; [email protected]
Subject: Re: [PATCH v2 0/6] net: fec: Enable Software TSO to improve the tx performanceI think you need to start taking David Laight's feedback more seriously.
He's right, it makes no sense at all the increase the number of RX descriptors for the sake of a send side feature like TSO.
Quoted 6 lines
If you have a another reason to increase the RX descriptor count, do it as a separate change and with an appropriate commit log message explaining WHY you are doing this.
I'm not applying this patch series until you start taking the feedback you are receiving to heart.
Considering with David Laight's suggestion by previous mail, I decide to remove the RX descriptors number change for the patch set. After the patch set, I have another patch serial for new feature support like interrupt coalescing that request RX descriptors number is enough big. I will generate one separate patch to increase RX BDs entry.
I will send the V3 for the change.
Thanks,
Andy