Skip to contentSkip to conversation

ucc_geth: Move freeing of TX packets to NAPI context.

PATCH In review Joakim Tjernlund 5 participants 20 messages Mar 26, 2009 – Mar 30, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ucc_geth: Move freeing of TX packets to NAPI context.

Also set NAPI weight to 64 as this is a common value. This will make the system alot more responsive while ping flooding the ucc_geth ethernet interaface.

---
 drivers/net/ucc_geth.c |   32 ++++++++++++--------------------
 drivers/net/ucc_geth.h |    1 -
 2 files changed, 12 insertions(+), 21 deletions(-)
drivers/net/ucc_geth.c +12 -20
index 097aed8..7fc91aa 100644
@@ -3214,7 +3214,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
 		dev->stats.tx_packets++;
 
 		/* Free the sk buffer associated with this TxBD */
-		dev_kfree_skb_irq(ugeth->
+		dev_kfree_skb(ugeth->
 				  tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]]);
 		ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]] = NULL;
 		ugeth->skb_dirtytx[txQ] =
@@ -3248,9 +3248,16 @@ static int ucc_geth_poll(struct napi_struct *napi, int budget)
 	for (i = 0; i < ug_info->numQueuesRx; i++)
 		howmany += ucc_geth_rx(ugeth, i, budget - howmany);
 
+	/* Tx event processing */
+	spin_lock(&ugeth->lock);
+	for (i = 0; i < ug_info->numQueuesTx; i++) {
+		ucc_geth_tx(ugeth->dev, i);
+	}
+	spin_unlock(&ugeth->lock);
+
 	if (howmany < budget) {
 		netif_rx_complete(napi);
-		setbits32(ugeth->uccf->p_uccm, UCCE_RX_EVENTS);
+		setbits32(ugeth->uccf->p_uccm, UCCE_RX_EVENTS | UCCE_TX_EVENTS);
 	}
 
 	return howmany;
@@ -3264,8 +3271,6 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info)
 	struct ucc_geth_info *ug_info;
 	register u32 ucce;
 	register u32 uccm;
-	register u32 tx_mask;
-	u8 i;
 
 	ugeth_vdbg("%s: IN", __func__);
 
@@ -3279,27 +3284,14 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info)
 	out_be32(uccf->p_ucce, ucce);
 
 	/* check for receive events that require processing */
-	if (ucce & UCCE_RX_EVENTS) {
+	if (ucce & (UCCE_RX_EVENTS | UCCE_TX_EVENTS)) {
 		if (netif_rx_schedule_prep(&ugeth->napi)) {
-			uccm &= ~UCCE_RX_EVENTS;
+			uccm &= ~(UCCE_RX_EVENTS | UCCE_TX_EVENTS);
 			out_be32(uccf->p_uccm, uccm);
 			__netif_rx_schedule(&ugeth->napi);
 		}
 	}
 
-	/* Tx event processing */
-	if (ucce & UCCE_TX_EVENTS) {
-		spin_lock(&ugeth->lock);
-		tx_mask = UCC_GETH_UCCE_TXB0;
-		for (i = 0; i < ug_info->numQueuesTx; i++) {
-			if (ucce & tx_mask)
-				ucc_geth_tx(dev, i);
-			ucce &= ~tx_mask;
-			tx_mask <<= 1;
-		}
-		spin_unlock(&ugeth->lock);
-	}
-
 	/* Errors and other events */
 	if (ucce & UCCE_OTHER) {
 		if (ucce & UCC_GETH_UCCE_BSY)
@@ -3733,7 +3725,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
 	dev->netdev_ops = &ucc_geth_netdev_ops;
 	dev->watchdog_timeo = TX_TIMEOUT;
 	INIT_WORK(&ugeth->timeout_work, ucc_geth_timeout_work);
-	netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT);
+	netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, 64);
 	dev->mtu = 1500;
 
 	ugeth->msg_enable = netif_msg_init(debug.msg_enable, UGETH_MSG_DEFAULT);
drivers/net/ucc_geth.h +0 -1
index 44218b8..50bad53 100644
@@ -843,7 +843,6 @@ struct ucc_geth_hardware_statistics {
 /* Driver definitions */
 #define TX_BD_RING_LEN                          0x10
 #define RX_BD_RING_LEN                          0x10
-#define UCC_GETH_DEV_WEIGHT                     TX_BD_RING_LEN
 
 #define TX_RING_MOD_MASK(size)                  (size-1)
 #define RX_RING_MOD_MASK(size)                  (size-1)
Signature · 1 line
1.6.1.3
#1 lore raw

PATCH 2/2 ucc_geth: Rework the TX logic.

The line:
if ((bd == ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0))

       break;

in ucc_geth_tx() didn not make sense to me. Rework & cleanup this logic to something understandable.

---
 drivers/net/ucc_geth.c |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)
drivers/net/ucc_geth.c +20 -20
index 7fc91aa..b6ebefd 100644
@@ -3048,6 +3048,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	u8 __iomem *bd;			/* BD pointer */
 	u32 bd_status;
 	u8 txQ = 0;
+	int txInd;
 
 	ugeth_vdbg("%s: IN", __func__);
 
@@ -3059,12 +3060,12 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	bd = ugeth->txBd[txQ];
 	bd_status = in_be32((u32 __iomem *)bd);
 	/* Save the skb pointer so we can free it later */
-	ugeth->tx_skbuff[txQ][ugeth->skb_curtx[txQ]] = skb;
+	txInd = ugeth->skb_curtx[txQ];
+	ugeth->tx_skbuff[txQ][txInd] = skb;
 
 	/* Update the current skb pointer (wrapping if this was the last) */
-	ugeth->skb_curtx[txQ] =
-	    (ugeth->skb_curtx[txQ] +
-	     1) & TX_RING_MOD_MASK(ugeth->ug_info->bdRingLenTx[txQ]);
+	txInd = (txInd + 1) & TX_RING_MOD_MASK(ugeth->ug_info->bdRingLenTx[txQ]);
+	ugeth->skb_curtx[txQ] = txInd;
 
 	/* set up the buffer descriptor */
 	out_be32(&((struct qe_bd __iomem *)bd)->buf,
@@ -3088,9 +3089,8 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	/* If the next BD still needs to be cleaned up, then the bds
 	   are full.  We need to tell the kernel to stop sending us stuff. */
-	if (bd == ugeth->confBd[txQ]) {
-		if (!netif_queue_stopped(dev))
-			netif_stop_queue(dev);
+	if (!in_be32((u32 __iomem *)(bd+4))) {
+		netif_stop_queue(dev);
 	}
 
 	ugeth->txBd[txQ] = bd;
@@ -3198,32 +3198,29 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
 	struct ucc_geth_private *ugeth = netdev_priv(dev);
 	u8 __iomem *bd;		/* BD pointer */
 	u32 bd_status;
+	int txInd, num_freed;
 
 	bd = ugeth->confBd[txQ];
 	bd_status = in_be32((u32 __iomem *)bd);
-
+	txInd = ugeth->skb_dirtytx[txQ];
+	num_freed = 0;
 	/* Normal processing. */
 	while ((bd_status & T_R) == 0) {
 		/* BD contains already transmitted buffer.   */
 		/* Handle the transmitted buffer and release */
 		/* the BD to be used with the current frame  */
 
-		if ((bd == ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0))
-			break;
+		if (!in_be32((u32 __iomem *)(bd+4)))
+			break; /* Queue is empty */
 
 		dev->stats.tx_packets++;
 
 		/* Free the sk buffer associated with this TxBD */
-		dev_kfree_skb(ugeth->
-				  tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]]);
-		ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]] = NULL;
-		ugeth->skb_dirtytx[txQ] =
-		    (ugeth->skb_dirtytx[txQ] +
-		     1) & TX_RING_MOD_MASK(ugeth->ug_info->bdRingLenTx[txQ]);
-
-		/* We freed a buffer, so now we can restart transmission */
-		if (netif_queue_stopped(dev))
-			netif_wake_queue(dev);
+		dev_kfree_skb(ugeth->tx_skbuff[txQ][txInd]);
+		ugeth->tx_skbuff[txQ][txInd] = NULL;
+		out_be32((u32 __iomem *)(bd+4), (int)NULL); /* Mark it free */
+		num_freed++;
+		txInd = (txInd + 1) & TX_RING_MOD_MASK(ugeth->ug_info->bdRingLenTx[txQ]);
 
 		/* Advance the confirmation BD pointer */
 		if (!(bd_status & T_W))
@@ -3233,6 +3230,9 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
 		bd_status = in_be32((u32 __iomem *)bd);
 	}
 	ugeth->confBd[txQ] = bd;
+	ugeth->skb_dirtytx[txQ] = txInd;
+	if (num_freed)
+		netif_wake_queue(dev); /* We freed some buffers, so restart transmission */
 	return 0;
 }
 
Signature · 1 line
1.6.1.3
#2 lore raw

Re: [PATCH 2/2] ucc_geth: Rework the TX logic.

Hi Joakim,

Quoted 16 lines · Joakim Tjernlund

The line:
if ((bd == ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0))

       break;

in ucc_geth_tx() didn not make sense to me. Rework & cleanup this logic to something understandable.

---
 drivers/net/ucc_geth.c |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)
drivers/net/ucc_geth.c +0 -0
index 7fc91aa..b6ebefd 100644

drivers/net/ucc_geth.c static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 3051

Quoted 4 lines
drivers/net/ucc_geth.c +1 -0
@@ -3048,6 +3048,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	u8 __iomem *bd;			/* BD pointer */
 	u32 bd_status;
 	u8 txQ = 0;
+	int txInd;

camelCase should not be used in Linux.

Surely, the driver is full of camelCases... though, it should be fixed, not encouraged further.

And btw, there is even Hungarian notation in the driver. :-(

[...]

drivers/net/ucc_geth.c static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 3092

Quoted 6 lines
drivers/net/ucc_geth.c +1 -3
 	/* If the next BD still needs to be cleaned up, then the bds
 	   are full.  We need to tell the kernel to stop sending us stuff. */
-	if (bd == ugeth->confBd[txQ]) {
-		if (!netif_queue_stopped(dev))
-			netif_stop_queue(dev);
+	if (!in_be32((u32 __iomem *)(bd+4))) {

bd == ugeth->confBd[txQ]
and
!in_be32((u32 __iomem *)(bd+4))

Are not equivalent wrt. speed. MMIO accessors should be rather slow comparing to normal memory.

We should really do some performance tests (using gbit links). I'll try to help you with the tests, but it might take some time.

[...]

Quoted 1 line
drivers/net/ucc_geth.c +1 -0
+		if (!in_be32((u32 __iomem *)(bd+4)))

[...]

drivers/net/ucc_geth.c static int ucc_geth_tx(struct net_device *dev, u8 txQ) · line 3221

Quoted 1 line
drivers/net/ucc_geth.c +1 -0
+		out_be32((u32 __iomem *)(bd+4), (int)NULL); /* Mark it free */

How about some inline function that will self-document the bd + 4 stuff? Plus that way we'll get rid of the casts.

Note that "bd+4" should be "bd + 4". And (int)NULL makes little sense, just 0 will work.

Thanks,

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#3 lore raw

Re: [PATCH 2/2] ucc_geth: Rework the TX logic.

Anton Vorontsov <[email protected]> wrote on 26/03/2009 14:39:18:

Quoted 2 lines

Hi Joakim,

Hi Anton

Quoted 11 lines · Joakim Tjernlund
Quoted 9 lines

The line:
if ((bd == ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0))

       break;

in ucc_geth_tx() didn not make sense to me. Rework & cleanup this logic to something understandable.

---
 drivers/net/ucc_geth.c |   40 

++++++++++++++++++++--------------------

Quoted 7 lines

drivers/net/ucc_geth.c static int ucc_geth_start_xmit(struct sk_buff

Quoted 7 lines
 1 files changed, 20 insertions(+), 20 deletions(-)
drivers/net/ucc_geth.c +0 -0
index 7fc91aa..b6ebefd 100644
@@ -3048,6 +3048,7 @@ static int ucc_geth_start_xmit(struct sk_buff 

*skb, struct net_device *dev)

Quoted 9 lines

drivers/net/ucc_geth.c static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 3051

Quoted 4 lines
drivers/net/ucc_geth.c +1 -0
    u8 __iomem *bd;         /* BD pointer */
    u32 bd_status;
    u8 txQ = 0;
+   int txInd;

camelCase should not be used in Linux.

Surely, the driver is full of camelCases... though, it should be fixed, not encouraged further.

OK, I will rename to tx_ind instead.

Quoted 2 lines

And btw, there is even Hungarian notation in the driver. :-(

Hopefully that will go away in time.

Quoted 4 lines

[...]

Quoted 2 lines

/* If the next BD still needs to be cleaned up, then the bds
are full. We need to tell the kernel to stop sending us stuff.

*/

Quoted 11 lines

drivers/net/ucc_geth.c static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 3092

Quoted 4 lines
drivers/net/ucc_geth.c +1 -3
-   if (bd == ugeth->confBd[txQ]) {
-      if (!netif_queue_stopped(dev))
-         netif_stop_queue(dev);
+   if (!in_be32((u32 __iomem *)(bd+4))) {

bd == ugeth->confBd[txQ]
and
!in_be32((u32 __iomem *)(bd+4))

Are not equivalent wrt. speed. MMIO accessors should be rather slow comparing to normal memory.

Yes, I know. I did it this way because I something broke under stress when ugeth->confBd[txQ] instead. The ucc_geth_tx() and ucc_geth_start_xmit()
gets out of sync somehow.

Quoted 3 lines

We should really do some performance tests (using gbit links). I'll try to help you with the tests, but it might take some time.

Good, because I don't have GBE links :(

Quoted 8 lines

[...]

Quoted 1 line

+ if (!in_be32((u32 __iomem *)(bd+4)))

[...]

Quoted 1 line

+ out_be32((u32 __iomem *)(bd+4), (int)NULL); /* Mark it free */

How about some inline function that will self-document the bd + 4 stuff? Plus that way we'll get rid of the casts.

Good idea, will look at that.

Quoted 3 lines

Note that "bd+4" should be "bd + 4". And (int)NULL makes little sense, just 0 will work.

Sure, done.

#4 lore raw

Re: [PATCH 2/2] ucc_geth: Rework the TX logic.

On Thu, Mar 26, 2009 at 05:43:25PM +0100, Joakim Tjernlund wrote:
[...]

Quoted 11 lines
Quoted 6 lines

bd == ugeth->confBd[txQ]
and
!in_be32((u32 __iomem *)(bd+4))

Are not equivalent wrt. speed. MMIO accessors should be rather slow comparing to normal memory.

Yes, I know. I did it this way because I something broke under stress when ugeth->confBd[txQ] instead. The ucc_geth_tx() and ucc_geth_start_xmit()
gets out of sync somehow.

Would be great if you could investigate it more. Maybe there is a serious bug somewhere, or maybe you're introducing another (yet hidden) bug...

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#5 lore raw

Re: [PATCH 2/2] ucc_geth: Rework the TX logic.

Anton Vorontsov <[email protected]> wrote on 26/03/2009 19:05:43:

Quoted 9 lines · Joakim Tjernlund

[...]

Quoted 7 lines
Quoted 6 lines

bd == ugeth->confBd[txQ]
and
!in_be32((u32 __iomem *)(bd+4))

Are not equivalent wrt. speed. MMIO accessors should be rather slow comparing to normal memory.

Quoted 8 lines
Quoted 4 lines

Yes, I know. I did it this way because I something broke under stress when ugeth->confBd[txQ] instead. The ucc_geth_tx() and ucc_geth_start_xmit()
gets out of sync somehow.

Would be great if you could investigate it more. Maybe there is a serious bug somewhere, or maybe you're introducing another (yet hidden) bug...

I have spent some time on it and didn't see how to do it. I don't think the current method hides any bugs. I have used this method on 8xx for many years and it works well.

Actually the current method might work without the spin_lock_irq(&ugeth->lock)/spin_unlock_irq(&ugeth->lock) in ucc_geth_start_xmit(). I can't break it, can you?

Jocke

maintainer
#6 lore raw

Re: [PATCH 2/2] ucc_geth: Rework the TX logic.

These patches don't apply to the current tree, could you please respin your final version against at the very least Linus's tree?

Thanks.

#7 lore raw

Re: [PATCH 2/2] ucc_geth: Rework the TX logic.

David Miller <[email protected]> wrote on 27/03/2009 08:42:37:

Quoted 4 lines

These patches don't apply to the current tree, could you please respin your final version against at the very least Linus's tree?

That is strange, had a look at linus tree and I don't see any changes in his tree that touches the same area/functions.

If I get the time I will look at it a bit more but for now I am stuck on 2.6.29

Jocke

#8 lore raw
In reply to Joakim Tjernlund
Quoted 24 lines · Joakim Tjernlund

Also set NAPI weight to 64 as this is a common value. This will make the system alot more responsive while ping flooding the ucc_geth ethernet interaface.

---
 drivers/net/ucc_geth.c |   32 ++++++++++++--------------------
 drivers/net/ucc_geth.h |    1 -
 2 files changed, 12 insertions(+), 21 deletions(-)
drivers/net/ucc_geth.c +1 -1
index 097aed8..7fc91aa 100644
@@ -3214,7 +3214,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
 		dev->stats.tx_packets++;
 
 		/* Free the sk buffer associated with this TxBD */
-		dev_kfree_skb_irq(ugeth->
+		dev_kfree_skb(ugeth->
 				  tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]]);
 		ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]] = NULL;
 		ugeth->skb_dirtytx[txQ] =

drivers/net/ucc_geth.c static int ucc_geth_poll(struct napi_struct *napi, int budget) · line 3250

Quoted 3 lines
drivers/net/ucc_geth.c +0 -0
@@ -3248,9 +3248,16 @@ static int ucc_geth_poll(struct napi_struct *napi, int budget)
 
 	for (i = 0; i < ug_info->numQueuesRx; i++)
 		howmany += ucc_geth_rx(ugeth, i, budget - howmany);

Not related to your patch, but seeing above code, I can understand you might have a problem in flood situation : Only first queue(s) are depleted, and last one cannot be because howmany >= budget.

This driver might have to remember last queue it handled at previous call ucc_geth_poll(), so that all rxqueues have same probability to be scanned.

j = ug->lastslot;

for (i = 0; ug_info->numQueuesRx; i++) {
	if (++j >= ug_info->numQueuesRx)
		j = 0;
	howmany += ucc_geth_rx(ugeth, j, budget - howmany);
	if (howmany >= budget)
		break;
}

ug->lastslot = j;

Quoted 75 lines
drivers/net/ucc_geth.c +11 -19
+	/* Tx event processing */
+	spin_lock(&ugeth->lock);
+	for (i = 0; i < ug_info->numQueuesTx; i++) {
+		ucc_geth_tx(ugeth->dev, i);
+	}
+	spin_unlock(&ugeth->lock);
+
 	if (howmany < budget) {
 		netif_rx_complete(napi);
-		setbits32(ugeth->uccf->p_uccm, UCCE_RX_EVENTS);
+		setbits32(ugeth->uccf->p_uccm, UCCE_RX_EVENTS | UCCE_TX_EVENTS);
 	}
 
 	return howmany;
@@ -3264,8 +3271,6 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info)
 	struct ucc_geth_info *ug_info;
 	register u32 ucce;
 	register u32 uccm;
-	register u32 tx_mask;
-	u8 i;
 
 	ugeth_vdbg("%s: IN", __func__);
 
@@ -3279,27 +3284,14 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info)
 	out_be32(uccf->p_ucce, ucce);
 
 	/* check for receive events that require processing */
-	if (ucce & UCCE_RX_EVENTS) {
+	if (ucce & (UCCE_RX_EVENTS | UCCE_TX_EVENTS)) {
 		if (netif_rx_schedule_prep(&ugeth->napi)) {
-			uccm &= ~UCCE_RX_EVENTS;
+			uccm &= ~(UCCE_RX_EVENTS | UCCE_TX_EVENTS);
 			out_be32(uccf->p_uccm, uccm);
 			__netif_rx_schedule(&ugeth->napi);
 		}
 	}
 
-	/* Tx event processing */
-	if (ucce & UCCE_TX_EVENTS) {
-		spin_lock(&ugeth->lock);
-		tx_mask = UCC_GETH_UCCE_TXB0;
-		for (i = 0; i < ug_info->numQueuesTx; i++) {
-			if (ucce & tx_mask)
-				ucc_geth_tx(dev, i);
-			ucce &= ~tx_mask;
-			tx_mask <<= 1;
-		}
-		spin_unlock(&ugeth->lock);
-	}
-
 	/* Errors and other events */
 	if (ucce & UCCE_OTHER) {
 		if (ucce & UCC_GETH_UCCE_BSY)
@@ -3733,7 +3725,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
 	dev->netdev_ops = &ucc_geth_netdev_ops;
 	dev->watchdog_timeo = TX_TIMEOUT;
 	INIT_WORK(&ugeth->timeout_work, ucc_geth_timeout_work);
-	netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT);
+	netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, 64);
 	dev->mtu = 1500;
 
 	ugeth->msg_enable = netif_msg_init(debug.msg_enable, UGETH_MSG_DEFAULT);
drivers/net/ucc_geth.h +0 -1
index 44218b8..50bad53 100644
@@ -843,7 +843,6 @@ struct ucc_geth_hardware_statistics {
 /* Driver definitions */
 #define TX_BD_RING_LEN                          0x10
 #define RX_BD_RING_LEN                          0x10
-#define UCC_GETH_DEV_WEIGHT                     TX_BD_RING_LEN
 
 #define TX_RING_MOD_MASK(size)                  (size-1)
 #define RX_RING_MOD_MASK(size)                  (size-1)
#9 lore raw

Eric Dumazet <[email protected]> wrote on 26/03/2009 15:15:25:

Quoted 12 lines
Quoted 10 lines · Joakim Tjernlund

Also set NAPI weight to 64 as this is a common value. This will make the system alot more responsive while ping flooding the ucc_geth ethernet interaface.

---
 drivers/net/ucc_geth.c |   32 ++++++++++++--------------------
 drivers/net/ucc_geth.h |    1 -
 2 files changed, 12 insertions(+), 21 deletions(-)
Quoted 5 lines

drivers/net/ucc_geth.c static int ucc_geth_tx(struct net_device *dev,

Quoted 5 lines
drivers/net/ucc_geth.c +0 -0
index 097aed8..7fc91aa 100644
@@ -3214,7 +3214,7 @@ static int ucc_geth_tx(struct net_device *dev, 

u8 txQ)

Quoted 9 lines

drivers/net/ucc_geth.c static int ucc_geth_poll(struct napi_struct

Quoted 9 lines
drivers/net/ucc_geth.c +1 -1
       dev->stats.tx_packets++;
 
       /* Free the sk buffer associated with this TxBD */
-      dev_kfree_skb_irq(ugeth->
+      dev_kfree_skb(ugeth->
               tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]]);
       ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]] = NULL;
       ugeth->skb_dirtytx[txQ] =
@@ -3248,9 +3248,16 @@ static int ucc_geth_poll(struct napi_struct 

*napi, int budget)

Quoted 10 lines

drivers/net/ucc_geth.c static int ucc_geth_poll(struct napi_struct *napi, int budget) · line 3249

Quoted 3 lines
drivers/net/ucc_geth.c +0 -0
    for (i = 0; i < ug_info->numQueuesRx; i++)
       howmany += ucc_geth_rx(ugeth, i, budget - howmany);

Not related to your patch, but seeing above code, I can understand you might have a problem in flood situation : Only first queue(s) are depleted, and last one cannot be because howmany >= budget.

This driver might have to remember last queue it handled at previous call ucc_geth_poll(), so that all rxqueues have same probability to be

scanned.

Quoted 10 lines

j = ug->lastslot;

for (i = 0; ug_info->numQueuesRx; i++) {
   if (++j >= ug_info->numQueuesRx)
      j = 0;
   howmany += ucc_geth_rx(ugeth, j, budget - howmany);
   if (howmany >= budget)
      break;
}

ug->lastslot = j;

yes, or scan the RX queues in prio order. However ATM there is only one queue so it won't be a problem until one extends the driver with several queues.

Thanks,
Jocke

#10 lore raw

RFC 1/1 niu: RX queues should rotate if budget exhausted

In reply to Eric Dumazet

I dont have NIU hardware but it seems this driver could suffer from starvation of high numbered RX queues under flood. I suspect other multiqueue drivers might have same problem.

With a standard budget of 64, we can consume all credit when handling first queue(s), and last queues might discard packets.

Solve this by rotating the starting point, so that we garantee to scan at least one new queue at each niu_poll_core() invocation, even under stress.

Also, change logic calling niu_sync_rx_discard_stats() to take into account the device qlen, not bounded by budget (which could be 0)

drivers/net/niu.c +15 -6
index 50c1112..d62d186 100644
@@ -3726,8 +3726,8 @@ static int niu_rx_work(struct niu *np, struct rx_ring_info *rp, int budget)
 	       np->dev->name, rp->rx_channel, (unsigned long long) stat, qlen);
 
 	rcr_done = work_done = 0;
-	qlen = min(qlen, budget);
-	while (work_done < qlen) {
+	budget = min(qlen, budget);
+	while (work_done < budget) {
 		rcr_done += niu_process_rx_pkt(np, rp);
 		work_done++;
 	}
@@ -3759,6 +3759,7 @@ static int niu_poll_core(struct niu *np, struct niu_ldg *lp, int budget)
 	u32 tx_vec = (v0 >> 32);
 	u32 rx_vec = (v0 & 0xffffffff);
 	int i, work_done = 0;
+	unsigned int cur_rx_ring;
 
 	niudbg(INTR, "%s: niu_poll_core() v0[%016llx]\n",
 	       np->dev->name, (unsigned long long) v0);
@@ -3770,17 +3771,24 @@ static int niu_poll_core(struct niu *np, struct niu_ldg *lp, int budget)
 		nw64(LD_IM0(LDN_TXDMA(rp->tx_channel)), 0);
 	}
 
+	cur_rx_ring = np->last_rx_ring;
 	for (i = 0; i < np->num_rx_rings; i++) {
-		struct rx_ring_info *rp = &np->rx_rings[i];
+		struct rx_ring_info *rp;
 
+		if (++cur_rx_ring >= np->num_rx_rings)
+			cur_rx_ring = 0;
+		rp = &np->rx_rings[cur_rx_ring];
 		if (rx_vec & (1 << rp->rx_channel)) {
 			int this_work_done;
 
 			this_work_done = niu_rx_work(np, rp,
 						     budget);
-
-			budget -= this_work_done;
-			work_done += this_work_done;
+			if (this_work_done) {
+				budget -= this_work_done;
+				work_done += this_work_done;
+				if (budget <= 0)
+					np->last_rx_ring = cur_rx_ring;
+			}
 		}
 		nw64(LD_IM0(LDN_RXDMA(rp->rx_channel)), 0);
 	}
@@ -4497,6 +4505,7 @@ static int niu_alloc_channels(struct niu *np)
 	}
 
 	np->num_rx_rings = parent->rxchan_per_port[port];
+	np->last_rx_ring = 0;
 	np->num_tx_rings = parent->txchan_per_port[port];
 
 	np->dev->real_num_tx_queues = np->num_tx_rings;
drivers/net/niu.h +1 -0
index 8754e44..113fe1d 100644
@@ -3266,6 +3266,7 @@ struct niu {
 	struct tx_ring_info		*tx_rings;
 	int				num_rx_rings;
 	int				num_tx_rings;
+	int				last_rx_ring;
 
 	struct niu_ldg			ldg[NIU_NUM_LDG];
 	int				num_ldg;
maintainer
#11 lore raw

Re: [RFC] niu: RX queues should rotate if budget exhausted

From: Eric Dumazet <[email protected]>
Date: Thu, 26 Mar 2009 19:26:20 +0100

Quoted 7 lines

I dont have NIU hardware but it seems this driver could suffer from starvation of high numbered RX queues under flood. I suspect other multiqueue drivers might have same problem.

With a standard budget of 64, we can consume all credit when handling first queue(s), and last queues might discard packets.

Quoted 7 lines

Solve this by rotating the starting point, so that we garantee to scan at least one new queue at each niu_poll_core() invocation, even under stress.

Also, change logic calling niu_sync_rx_discard_stats() to take into account the device qlen, not bounded by budget (which could be 0)

This change looks good to me, thanks for spotting this and suggesting the fix.

It only hits people who don't have usable MSI-X interrupts, and hey if you have one of these cards what are you doing sticking it into such a machine :-)

Anyways, I'll apply this directly, thanks a lot!

maintainer
#12 lore raw

Re: [RFC] niu: RX queues should rotate if budget exhausted

From: David Miller <[email protected]>
Date: Fri, 27 Mar 2009 00:55:46 -0700 (PDT)

Quoted 18 lines

From: Eric Dumazet <[email protected]>
Date: Thu, 26 Mar 2009 19:26:20 +0100

Quoted 7 lines

I dont have NIU hardware but it seems this driver could suffer from starvation of high numbered RX queues under flood. I suspect other multiqueue drivers might have same problem.

With a standard budget of 64, we can consume all credit when handling first queue(s), and last queues might discard packets.

Quoted 7 lines

Solve this by rotating the starting point, so that we garantee to scan at least one new queue at each niu_poll_core() invocation, even under stress.

Also, change logic calling niu_sync_rx_discard_stats() to take into account the device qlen, not bounded by budget (which could be 0)

Quoted 8 lines

This change looks good to me, thanks for spotting this and suggesting the fix.

It only hits people who don't have usable MSI-X interrupts, and hey if you have one of these cards what are you doing sticking it into such a machine :-)

Anyways, I'll apply this directly, thanks a lot!

Actually, I take that back... I want to do this slightly differently.

That niu_poll_core() is used in both the MSI-X and non-MSI case.

I always meant to fix this driver to not scan over all the RX rings when we use MSI-X and the event can only be for one specific queue.

Then we can add your rotating logic to the non-MSI-X interrupt paths.

#13 lore raw

Re: [RFC] niu: RX queues should rotate if budget exhausted

Quoted 8 lines · David Miller
Quoted 1 line

Anyways, I'll apply this directly, thanks a lot!

Actually, I take that back... I want to do this slightly differently.

That niu_poll_core() is used in both the MSI-X and non-MSI case.

Quoted 6 lines

I always meant to fix this driver to not scan over all the RX rings when we use MSI-X and the event can only be for one specific queue.

Then we can add your rotating logic to the non-MSI-X interrupt paths.

Great, I'll take care of this.

Thanks

#14 lore raw
In reply to Joakim Tjernlund
Quoted 81 lines · Joakim Tjernlund

Also set NAPI weight to 64 as this is a common value. This will make the system alot more responsive while ping flooding the ucc_geth ethernet interaface.

---
 drivers/net/ucc_geth.c |   32 ++++++++++++-------------------- drivers/net/ucc_geth.h |    1 -

 2 files changed, 12 insertions(+), 21 deletions(-)
drivers/net/ucc_geth.c +1 -1
index 097aed8..7fc91aa 100644
@@ -3214,7 +3214,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
                dev->stats.tx_packets++;
 
                /* Free the sk buffer associated with this TxBD */
-               dev_kfree_skb_irq(ugeth->
+               dev_kfree_skb(ugeth->
                                  tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]]);
                ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]] = NULL;

               ugeth->skb_dirtytx[txQ] =

drivers/net/ucc_geth.c +10 -18
@@ -3248,9 +3248,16 @@ static int ucc_geth_poll(struct napi_struct *napi, int budget)
        for (i = 0; i < ug_info->numQueuesRx; i++)
                howmany += ucc_geth_rx(ugeth, i, budget - howmany);
 
+       /* Tx event processing */
+       spin_lock(&ugeth->lock);
+       for (i = 0; i < ug_info->numQueuesTx; i++) {
+               ucc_geth_tx(ugeth->dev, i);
+       }
+       spin_unlock(&ugeth->lock);
+
        if (howmany < budget) {
                netif_rx_complete(napi);
-               setbits32(ugeth->uccf->p_uccm, UCCE_RX_EVENTS);
+               setbits32(ugeth->uccf->p_uccm, UCCE_RX_EVENTS | UCCE_TX_EVENTS);
        }
 
        return howmany;
@@ -3264,8 +3271,6 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info)
        struct ucc_geth_info *ug_info;
        register u32 ucce;
        register u32 uccm;
-       register u32 tx_mask;
-       u8 i;
 
        ugeth_vdbg("%s: IN", __func__);
 
@@ -3279,27 +3284,14 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info)
        out_be32(uccf->p_ucce, ucce);
 
        /* check for receive events that require processing */
-       if (ucce & UCCE_RX_EVENTS) {
+       if (ucce & (UCCE_RX_EVENTS | UCCE_TX_EVENTS)) {
                if (netif_rx_schedule_prep(&ugeth->napi)) {
-                       uccm &= ~UCCE_RX_EVENTS;
+                       uccm &= ~(UCCE_RX_EVENTS | UCCE_TX_EVENTS);
                        out_be32(uccf->p_uccm, uccm);
                        __netif_rx_schedule(&ugeth->napi);
                }
        }
 
-       /* Tx event processing */
-       if (ucce & UCCE_TX_EVENTS) {
-               spin_lock(&ugeth->lock);
-               tx_mask = UCC_GETH_UCCE_TXB0;
-               for (i = 0; i < ug_info->numQueuesTx; i++) {
-                       if (ucce & tx_mask)
-                               ucc_geth_tx(dev, i);
-                       ucce &= ~tx_mask;
-                       tx_mask <<= 1;
-               }
-               spin_unlock(&ugeth->lock);
-       }
-
        /* Errors and other events */
        if (ucce & UCCE_OTHER) {
                if (ucce & UCC_GETH_UCCE_BSY)

drivers/net/ucc_geth.c static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma · line 3728

Quoted 5 lines
drivers/net/ucc_geth.c +1 -1
@@ -3733,7 +3725,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
        dev->netdev_ops = &ucc_geth_netdev_ops;
        dev->watchdog_timeo = TX_TIMEOUT;
        INIT_WORK(&ugeth->timeout_work, ucc_geth_timeout_work);
-       netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT);
+       netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, 64);

It doesn't make sense to have larger napi budget than the size of RX BD ring. You can't have more BDs than RX_BD_RING_LEN in backlog for napi_poll to process. Increase the RX_BD_RING_LEN if you want to increase UCC_GETH_DEV_WEIGHT. However please also provide the performance comparison for this kind of change. Thanks

- Leo
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#15 lore raw

[email protected] wrote on 27/03/2009 11:50:09:

Quoted 7 lines
Quoted 4 lines · Joakim Tjernlund

Also set NAPI weight to 64 as this is a common value. This will make the system alot more responsive while ping flooding the ucc_geth ethernet interaface.

Quoted 6 lines

Review static int ucc_geth_probe(struct of_device*

Quoted 6 lines

---

       /* Errors and other events */
       if (ucce & UCCE_OTHER) {
               if (ucce & UCC_GETH_UCCE_BSY)
(quoted diff) +0 -0
@@ -3733,7 +3725,7 @@ static int ucc_geth_probe(struct of_device* 

ofdev, const struct of_device_id *ma

Quoted 4 lines

drivers/net/ucc_geth.c static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma

Quoted 4 lines
drivers/net/ucc_geth.c +0 -1
       dev->netdev_ops = &ucc_geth_netdev_ops;
       dev->watchdog_timeo = TX_TIMEOUT;
       INIT_WORK(&ugeth->timeout_work, ucc_geth_timeout_work);
-       netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, 

UCC_GETH_DEV_WEIGHT);

Quoted 7 lines

drivers/net/ucc_geth.c static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma · line 3728

Quoted 1 line
drivers/net/ucc_geth.c +1 -0
+       netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, 64);

It doesn't make sense to have larger napi budget than the size of RX BD ring. You can't have more BDs than RX_BD_RING_LEN in backlog for napi_poll to process. Increase the RX_BD_RING_LEN if you want to increase UCC_GETH_DEV_WEIGHT. However please also provide the performance comparison for this kind of change. Thanks

Bring it up with David Miller. After my initial attempt to just increase weight somewhat, he requested that I hardcoded it to 64. Just read the whole thread.
If I don't increase weight somewhat, ping -f -l 3 almost halts the board. Logging
in takes forever. These are my "performance numbers".

weight theory:
Before the drivers gets to the end of a full BD ring, new pkgs arrives so that
even if the DB ring is only 16, the driver wants to process 17 or more pkgs.

maintainer
#16 lore raw

From: Joakim Tjernlund <[email protected]>
Date: Fri, 27 Mar 2009 12:52:41 +0100

Quoted 8 lines

[email protected] wrote on 27/03/2009 11:50:09:

Quoted 5 lines

It doesn't make sense to have larger napi budget than the size of RX BD ring. You can't have more BDs than RX_BD_RING_LEN in backlog for napi_poll to process. Increase the RX_BD_RING_LEN if you want to increase UCC_GETH_DEV_WEIGHT. However please also provide the performance comparison for this kind of change. Thanks

Bring it up with David Miller.

Right I told him to make this very change.

Pretty soon the driver's won't be able to select this value and it will default to 64 everwhere anyways.

"performance comparison"? He can't do that unless he tests performance with two active NAPI devices on the same exact cpu as the weight value is for fairness between devices.

So you don't tweak "weight" to make one device perform better, you tweak it to eliminate unfairness between multiple devices. And the only way to achieve that is to use similar values across all devices, perhaps link-speed rated which we can't do just yet, and that's why I told him to use 64 just like every other driver basically does.

#17 lore raw
In reply to Joakim Tjernlund
Quoted 13 lines · Joakim Tjernlund

[email protected] wrote on 27/03/2009 11:50:09:

Quoted 12 lines
Quoted 9 lines · Joakim Tjernlund

Also set NAPI weight to 64 as this is a common value. This will make the system alot more responsive while ping flooding the ucc_geth ethernet interaface.

---
=C2=A0 =C2=A0 =C2=A0 =C2=A0/* Errors and other events */ =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ucce & UCCE_OTHER) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ucce & UCC_=

GETH_UCCE_BSY)

Quoted 5 lines
Quoted 1 line

Review static int ucc_geth_probe(struct of_device*

Quoted 1 line
(quoted diff) +0 -0
@@ -3733,7 +3725,7 @@ static int ucc_geth_probe(struct of_device*

ofdev, const struct of_device_id *ma

Quoted 3 lines
Quoted 3 lines
(quoted diff) +0 -0
 =C2=A0 =C2=A0 =C2=A0 =C2=A0dev->netdev_ops =3D &ucc_geth_netdev_ops;
 =C2=A0 =C2=A0 =C2=A0 =C2=A0dev->watchdog_timeo =3D TX_TIMEOUT;

=C2=A0 =C2=A0 =C2=A0 =C2=A0INIT_WORK(&ugeth->timeout_work, ucc_geth_ti=

meout_work);

Quoted 1 line
Quoted 1 line
Quoted 1 line

- =C2=A0 =C2=A0 =C2=A0 netif_napi_add(dev, &ugeth->napi, ucc_geth_poll=

,

Quoted 2 lines

UCC_GETH_DEV_WEIGHT);

Quoted 1 line
Quoted 1 line

+ =C2=A0 =C2=A0 =C2=A0 netif_napi_add(dev, &ugeth->napi, ucc_geth_poll=

, 64);

Quoted 3 lines
Quoted 3 lines

It doesn't make sense to have larger napi budget than the size of RX BD ring. =C2=A0You can't have more BDs than RX_BD_RING_LEN in backlog fo=

r

Quoted 10 lines
Quoted 3 lines

napi_poll to process. =C2=A0Increase the RX_BD_RING_LEN if you want to increase UCC_GETH_DEV_WEIGHT. =C2=A0However please also provide the performance comparison for this kind of change. =C2=A0Thanks

Bring it up with David Miller. After my initial attempt to just increase weight somewhat, he requested that I hardcoded it to 64. Just read the whole thread.
If I don't increase weight somewhat, ping -f -l 3 almost halts the board. Logging
in takes forever. These are my "performance numbers".

Faster response time is surely good. But it might also mean CPU is not fully loaded. IMHO, throughput is a more important factor for network devices. When you try to optimize the driver, please also consider the throughput change. Thanks.

- Leo

#18 lore raw

[email protected] wrote on 30/03/2009 09:36:21:

Quoted 25 lines
Quoted 22 lines · Joakim Tjernlund

[email protected] wrote on 27/03/2009 11:50:09:

Quoted 7 lines
Quoted 4 lines · Joakim Tjernlund

Also set NAPI weight to 64 as this is a common value. This will make the system alot more responsive while ping flooding the ucc_geth ethernet interaface.

Quoted 6 lines

Review static int ucc_geth_probe(struct of_device*

Quoted 6 lines

---

       /* Errors and other events */
       if (ucce & UCCE_OTHER) {
               if (ucce & UCC_GETH_UCCE_BSY)
(quoted diff) +0 -0
@@ -3733,7 +3725,7 @@ static int ucc_geth_probe(struct of_device*

ofdev, const struct of_device_id *ma

Quoted 4 lines

drivers/net/ucc_geth.c static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma

Quoted 4 lines
drivers/net/ucc_geth.c +0 -1
       dev->netdev_ops = &ucc_geth_netdev_ops;
       dev->watchdog_timeo = TX_TIMEOUT;
       INIT_WORK(&ugeth->timeout_work, ucc_geth_timeout_work);
-       netif_napi_add(dev, &ugeth->napi, ucc_geth_poll,

UCC_GETH_DEV_WEIGHT);

Quoted 2 lines
Quoted 1 line
drivers/net/ucc_geth.c +1 -0
+       netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, 64);
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

It doesn't make sense to have larger napi budget than the size of RX BD ring. You can't have more BDs than RX_BD_RING_LEN in backlog for napi_poll to process. Increase the RX_BD_RING_LEN if you want to increase UCC_GETH_DEV_WEIGHT. However please also provide the performance comparison for this kind of change. Thanks

Bring it up with David Miller. After my initial attempt to just

increase

Quoted 3 lines
Quoted 3 lines

weight somewhat, he requested that I hardcoded it to 64. Just read the whole thread.
If I don't increase weight somewhat, ping -f -l 3 almost halts the

board.

Quoted 7 lines
Quoted 2 lines

Logging
in takes forever. These are my "performance numbers".

Faster response time is surely good. But it might also mean CPU is not fully loaded. IMHO, throughput is a more important factor for network devices. When you try to optimize the driver, please also consider the throughput change. Thanks.

This particular change isn't about performance, it is about not "bricking" the board during heavy traffic. Next step is to optimize the driver.

Jocke

#19 lore raw
Quoted 17 lines · Joakim Tjernlund

[email protected] wrote on 30/03/2009 09:36:21:

Quoted 16 lines
Quoted 13 lines · Joakim Tjernlund

[email protected] wrote on 27/03/2009 11:50:09:

Quoted 12 lines
Quoted 9 lines · Joakim Tjernlund

Also set NAPI weight to 64 as this is a common value. This will make the system alot more responsive while ping flooding the ucc_geth ethernet interaface.

---
=C2=A0 =C2=A0 =C2=A0 =C2=A0/* Errors and other events */ =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ucce & UCCE_OTHER) { =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ucce & U=

CC_GETH_UCCE_BSY)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Review static int ucc_geth_probe(struct of_device*

Quoted 1 line
(quoted diff) +0 -0
@@ -3733,7 +3725,7 @@ static int ucc_geth_probe(struct of_device*

ofdev, const struct of_device_id *ma

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0dev->netdev_ops =3D &ucc_geth_netdev_ops=

;

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

=C2=A0 =C2=A0 =C2=A0 =C2=A0dev->watchdog_timeo =3D TX_TIMEOUT; =C2=A0 =C2=A0 =C2=A0 =C2=A0INIT_WORK(&ugeth->timeout_work, ucc_geth=

_timeout_work);

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

- =C2=A0 =C2=A0 =C2=A0 netif_napi_add(dev, &ugeth->napi, ucc_geth_p=

oll,

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

UCC_GETH_DEV_WEIGHT);

Quoted 1 line
Quoted 1 line

+ =C2=A0 =C2=A0 =C2=A0 netif_napi_add(dev, &ugeth->napi, ucc_geth_p=

oll, 64);

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

It doesn't make sense to have larger napi budget than the size of RX BD ring. =C2=A0You can't have more BDs than RX_BD_RING_LEN in backlog=

for

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

napi_poll to process. =C2=A0Increase the RX_BD_RING_LEN if you want t=

o

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

increase UCC_GETH_DEV_WEIGHT. =C2=A0However please also provide the performance comparison for this kind of change. =C2=A0Thanks

Bring it up with David Miller. After my initial attempt to just

increase

Quoted 3 lines
Quoted 3 lines

weight somewhat, he requested that I hardcoded it to 64. Just read the whole thread.
If I don't increase weight somewhat, ping -f -l 3 almost halts the

board.

Quoted 3 lines
Quoted 2 lines

Logging
in takes forever. These are my "performance numbers".

Quoted 8 lines
Quoted 4 lines

Faster response time is surely good. =C2=A0But it might also mean CPU is not fully loaded. =C2=A0IMHO, throughput is a more important factor for network devices. =C2=A0When you try to optimize the driver, please also consider the throughput change. =C2=A0Thanks.

This particular change isn't about performance, it is about not "bricking" the board during heavy traffic. Next step is to optimize the driver.

Sure. I mean for other changes like tx NAPI, ring size tweak and tx logic.

- Leo