netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/9] net: get rid of most __napi_complete() usages
@ 2017-02-04 18:20 Eric Dumazet
  2017-02-04 18:20 ` [PATCH net-next 1/9] 8139too: use napi_complete_done() Eric Dumazet
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Eric Dumazet @ 2017-02-04 18:20 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

This patch series removes nine __napi_complete() calls, in an effort
to harmonize NAPI API and generalize GRO and napi_complete_done()

Two are left, I was not feeling lucky enough to patch them :/
 ( aeroflex/greth.c & ibm/emac/mal.c )

Eric Dumazet (9):
  8139too: use napi_complete_done()
  8139cp: use napi_complete_done()
  epic100: use napi_complete_done()
  amd8111e: add GRO support
  pcnet32: use napi_complete_done()
  ep93xx_eth: add GRO support
  skge: use napi_complete_done()
  ks8695net: add GRO support
  qla3xxx: add GRO support

 drivers/net/ethernet/amd/amd8111e.c      | 165 ++++++++++++++-----------------
 drivers/net/ethernet/amd/pcnet32.c       |  11 +--
 drivers/net/ethernet/cirrus/ep93xx_eth.c |  24 +----
 drivers/net/ethernet/marvell/skge.c      |   8 +-
 drivers/net/ethernet/micrel/ks8695net.c  |  11 +--
 drivers/net/ethernet/qlogic/qla3xxx.c    |  31 +++---
 drivers/net/ethernet/realtek/8139cp.c    |  19 ++--
 drivers/net/ethernet/realtek/8139too.c   |  16 ++-
 drivers/net/ethernet/smsc/epic100.c      |  33 ++-----
 9 files changed, 124 insertions(+), 194 deletions(-)

-- 
2.11.0.483.g087da7b7c-goog

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH net-next 1/9] 8139too: use napi_complete_done()
  2017-02-04 18:20 [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet
@ 2017-02-04 18:20 ` Eric Dumazet
  2017-02-04 18:20 ` [PATCH net-next 2/9] 8139cp: " Eric Dumazet
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Eric Dumazet @ 2017-02-04 18:20 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

Use napi_complete_done() instead of __napi_complete() to :

1) Get support of gro_flush_timeout if opt-in
2) Not rearm interrupts for busy-polling users.
3) use standard NAPI API.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/ethernet/realtek/8139too.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c
index 5ad59c6d29a46a036a6b1d70e77ae288d9fe..60e8e86d5f1317029c372b137bf96f6680b3 100644
--- a/drivers/net/ethernet/realtek/8139too.c
+++ b/drivers/net/ethernet/realtek/8139too.c
@@ -2136,15 +2136,13 @@ static int rtl8139_poll(struct napi_struct *napi, int budget)
 		work_done += rtl8139_rx(dev, tp, budget);
 
 	if (work_done < budget) {
-		unsigned long flags;
-		/*
-		 * Order is important since data can get interrupted
-		 * again when we think we are done.
-		 */
-		spin_lock_irqsave(&tp->lock, flags);
-		__napi_complete(napi);
-		RTL_W16_F(IntrMask, rtl8139_intr_mask);
-		spin_unlock_irqrestore(&tp->lock, flags);
+		if (napi_complete_done(napi, work_done)) {
+			unsigned long flags;
+
+			spin_lock_irqsave(&tp->lock, flags);
+			RTL_W16_F(IntrMask, rtl8139_intr_mask);
+			spin_unlock_irqrestore(&tp->lock, flags);
+		}
 	}
 	spin_unlock(&tp->rx_lock);
 
-- 
2.11.0.483.g087da7b7c-goog

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 2/9] 8139cp: use napi_complete_done()
  2017-02-04 18:20 [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet
  2017-02-04 18:20 ` [PATCH net-next 1/9] 8139too: use napi_complete_done() Eric Dumazet
@ 2017-02-04 18:20 ` Eric Dumazet
  2017-02-04 18:20 ` [PATCH net-next 3/9] epic100: " Eric Dumazet
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Eric Dumazet @ 2017-02-04 18:20 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

Use napi_complete_done() instead of __napi_complete() to :

1) Get support of gro_flush_timeout if opt-in
2) Not rearm interrupts for busy-polling users.
3) use standard NAPI API.
4) Eventually get rid of napi_gro_flush() in the future.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/ethernet/realtek/8139cp.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
index 0b3cd58093d5ecf00abef6eda1386f13ac5e..1ca3ff1d36923c09ddcbdc2ba1a36ae67f46 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
@@ -465,10 +465,8 @@ static int cp_rx_poll(struct napi_struct *napi, int budget)
 	struct cp_private *cp = container_of(napi, struct cp_private, napi);
 	struct net_device *dev = cp->dev;
 	unsigned int rx_tail = cp->rx_tail;
-	int rx;
+	int rx = 0;
 
-	rx = 0;
-rx_status_loop:
 	cpw16(IntrStatus, cp_rx_intr_mask);
 
 	while (rx < budget) {
@@ -557,16 +555,13 @@ static int cp_rx_poll(struct napi_struct *napi, int budget)
 	 * this round of polling
 	 */
 	if (rx < budget) {
-		unsigned long flags;
+		if (napi_complete_done(napi, rx)) {
+			unsigned long flags;
 
-		if (cpr16(IntrStatus) & cp_rx_intr_mask)
-			goto rx_status_loop;
-
-		napi_gro_flush(napi, false);
-		spin_lock_irqsave(&cp->lock, flags);
-		__napi_complete(napi);
-		cpw16_f(IntrMask, cp_intr_mask);
-		spin_unlock_irqrestore(&cp->lock, flags);
+			spin_lock_irqsave(&cp->lock, flags);
+			cpw16_f(IntrMask, cp_intr_mask);
+			spin_unlock_irqrestore(&cp->lock, flags);
+		}
 	}
 
 	return rx;
-- 
2.11.0.483.g087da7b7c-goog

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 3/9] epic100: use napi_complete_done()
  2017-02-04 18:20 [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet
  2017-02-04 18:20 ` [PATCH net-next 1/9] 8139too: use napi_complete_done() Eric Dumazet
  2017-02-04 18:20 ` [PATCH net-next 2/9] 8139cp: " Eric Dumazet
@ 2017-02-04 18:20 ` Eric Dumazet
  2017-02-04 18:20 ` [PATCH net-next 4/9] amd8111e: add GRO support Eric Dumazet
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Eric Dumazet @ 2017-02-04 18:20 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

Use napi_complete_done() instead of __napi_complete() to :

1) Get support of gro_flush_timeout if opt-in
2) Not rearm interrupts for busy-polling users.
3) use standard NAPI API.
4) get rid of baroque code and ease maintenance.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/ethernet/smsc/epic100.c | 33 +++++++++------------------------
 1 file changed, 9 insertions(+), 24 deletions(-)

diff --git a/drivers/net/ethernet/smsc/epic100.c b/drivers/net/ethernet/smsc/epic100.c
index 55a95e1d69d68b45ec85a8648e85d24e3673..2c67b7d71b3c2e3d10be019f1d95c9b191a0 100644
--- a/drivers/net/ethernet/smsc/epic100.c
+++ b/drivers/net/ethernet/smsc/epic100.c
@@ -264,7 +264,6 @@ struct epic_private {
 	spinlock_t lock;				/* Group with Tx control cache line. */
 	spinlock_t napi_lock;
 	struct napi_struct napi;
-	unsigned int reschedule_in_poll;
 	unsigned int cur_tx, dirty_tx;
 
 	unsigned int cur_rx, dirty_rx;
@@ -400,7 +399,6 @@ static int epic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	spin_lock_init(&ep->lock);
 	spin_lock_init(&ep->napi_lock);
-	ep->reschedule_in_poll = 0;
 
 	/* Bring the chip out of low-power mode. */
 	ew32(GENCTL, 0x4200);
@@ -1086,13 +1084,12 @@ static irqreturn_t epic_interrupt(int irq, void *dev_instance)
 
 	handled = 1;
 
-	if ((status & EpicNapiEvent) && !ep->reschedule_in_poll) {
+	if (status & EpicNapiEvent) {
 		spin_lock(&ep->napi_lock);
 		if (napi_schedule_prep(&ep->napi)) {
 			epic_napi_irq_off(dev, ep);
 			__napi_schedule(&ep->napi);
-		} else
-			ep->reschedule_in_poll++;
+		}
 		spin_unlock(&ep->napi_lock);
 	}
 	status &= ~EpicNapiEvent;
@@ -1248,37 +1245,25 @@ static int epic_poll(struct napi_struct *napi, int budget)
 {
 	struct epic_private *ep = container_of(napi, struct epic_private, napi);
 	struct net_device *dev = ep->mii.dev;
-	int work_done = 0;
 	void __iomem *ioaddr = ep->ioaddr;
-
-rx_action:
+	int work_done;
 
 	epic_tx(dev, ep);
 
-	work_done += epic_rx(dev, budget);
+	work_done = epic_rx(dev, budget);
 
 	epic_rx_err(dev, ep);
 
 	if (work_done < budget) {
-		unsigned long flags;
-		int more;
-
-		/* A bit baroque but it avoids a (space hungry) spin_unlock */
+		if (napi_complete_done(napi, work_done)) {
+			unsigned long flags;
 
-		spin_lock_irqsave(&ep->napi_lock, flags);
+			spin_lock_irqsave(&ep->napi_lock, flags);
 
-		more = ep->reschedule_in_poll;
-		if (!more) {
-			__napi_complete(napi);
 			ew32(INTSTAT, EpicNapiEvent);
 			epic_napi_irq_on(dev, ep);
-		} else
-			ep->reschedule_in_poll--;
-
-		spin_unlock_irqrestore(&ep->napi_lock, flags);
-
-		if (more)
-			goto rx_action;
+			spin_unlock_irqrestore(&ep->napi_lock, flags);
+		}
 	}
 
 	return work_done;
-- 
2.11.0.483.g087da7b7c-goog

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 4/9] amd8111e: add GRO support
  2017-02-04 18:20 [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet
                   ` (2 preceding siblings ...)
  2017-02-04 18:20 ` [PATCH net-next 3/9] epic100: " Eric Dumazet
@ 2017-02-04 18:20 ` Eric Dumazet
  2017-02-04 18:20 ` [PATCH net-next 5/9] pcnet32: use napi_complete_done() Eric Dumazet
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Eric Dumazet @ 2017-02-04 18:20 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

Use napi_complete_done() instead of __napi_complete() to :

1) Get support of gro_flush_timeout if opt-in
2) Not rearm interrupts for busy-polling users.
3) use standard NAPI API.
4) get rid of baroque code and ease maintenance.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/ethernet/amd/amd8111e.c | 165 ++++++++++++++++--------------------
 1 file changed, 73 insertions(+), 92 deletions(-)

diff --git a/drivers/net/ethernet/amd/amd8111e.c b/drivers/net/ethernet/amd/amd8111e.c
index 9595f1bc535b73306720e4d0005fe58d2025..27b18af29863c38c5308c58701bd46c305b2 100644
--- a/drivers/net/ethernet/amd/amd8111e.c
+++ b/drivers/net/ethernet/amd/amd8111e.c
@@ -695,125 +695,106 @@ static int amd8111e_rx_poll(struct napi_struct *napi, int budget)
 	void __iomem *mmio = lp->mmio;
 	struct sk_buff *skb,*new_skb;
 	int min_pkt_len, status;
-	unsigned int intr0;
 	int num_rx_pkt = 0;
 	short pkt_len;
 #if AMD8111E_VLAN_TAG_USED
 	short vtag;
 #endif
-	int rx_pkt_limit = budget;
-	unsigned long flags;
 
-	if (rx_pkt_limit <= 0)
-		goto rx_not_empty;
+	while (num_rx_pkt < budget) {
+		status = le16_to_cpu(lp->rx_ring[rx_index].rx_flags);
+		if (status & OWN_BIT)
+			break;
 
-	do{
-		/* process receive packets until we use the quota.
-		 * If we own the next entry, it's a new packet. Send it up.
+		/* There is a tricky error noted by John Murphy,
+		 * <murf@perftech.com> to Russ Nelson: Even with
+		 * full-sized * buffers it's possible for a
+		 * jabber packet to use two buffers, with only
+		 * the last correctly noting the error.
 		 */
-		while(1) {
-			status = le16_to_cpu(lp->rx_ring[rx_index].rx_flags);
-			if (status & OWN_BIT)
-				break;
-
-			/* There is a tricky error noted by John Murphy,
-			 * <murf@perftech.com> to Russ Nelson: Even with
-			 * full-sized * buffers it's possible for a
-			 * jabber packet to use two buffers, with only
-			 * the last correctly noting the error.
-			 */
-			if(status & ERR_BIT) {
-				/* resetting flags */
-				lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS;
-				goto err_next_pkt;
-			}
-			/* check for STP and ENP */
-			if(!((status & STP_BIT) && (status & ENP_BIT))){
-				/* resetting flags */
-				lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS;
-				goto err_next_pkt;
-			}
-			pkt_len = le16_to_cpu(lp->rx_ring[rx_index].msg_count) - 4;
+		if (status & ERR_BIT) {
+			/* resetting flags */
+			lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS;
+			goto err_next_pkt;
+		}
+		/* check for STP and ENP */
+		if (!((status & STP_BIT) && (status & ENP_BIT))){
+			/* resetting flags */
+			lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS;
+			goto err_next_pkt;
+		}
+		pkt_len = le16_to_cpu(lp->rx_ring[rx_index].msg_count) - 4;
 
 #if AMD8111E_VLAN_TAG_USED
-			vtag = status & TT_MASK;
-			/*MAC will strip vlan tag*/
-			if (vtag != 0)
-				min_pkt_len =MIN_PKT_LEN - 4;
+		vtag = status & TT_MASK;
+		/* MAC will strip vlan tag */
+		if (vtag != 0)
+			min_pkt_len = MIN_PKT_LEN - 4;
 			else
 #endif
-				min_pkt_len =MIN_PKT_LEN;
+			min_pkt_len = MIN_PKT_LEN;
 
-			if (pkt_len < min_pkt_len) {
-				lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS;
-				lp->drv_rx_errors++;
-				goto err_next_pkt;
-			}
-			if(--rx_pkt_limit < 0)
-				goto rx_not_empty;
-			new_skb = netdev_alloc_skb(dev, lp->rx_buff_len);
-			if (!new_skb) {
-				/* if allocation fail,
-				 * ignore that pkt and go to next one
-				 */
-				lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS;
-				lp->drv_rx_errors++;
-				goto err_next_pkt;
-			}
+		if (pkt_len < min_pkt_len) {
+			lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS;
+			lp->drv_rx_errors++;
+			goto err_next_pkt;
+		}
+		new_skb = netdev_alloc_skb(dev, lp->rx_buff_len);
+		if (!new_skb) {
+			/* if allocation fail,
+			 * ignore that pkt and go to next one
+			 */
+			lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS;
+			lp->drv_rx_errors++;
+			goto err_next_pkt;
+		}
 
-			skb_reserve(new_skb, 2);
-			skb = lp->rx_skbuff[rx_index];
-			pci_unmap_single(lp->pci_dev,lp->rx_dma_addr[rx_index],
-					 lp->rx_buff_len-2, PCI_DMA_FROMDEVICE);
-			skb_put(skb, pkt_len);
-			lp->rx_skbuff[rx_index] = new_skb;
-			lp->rx_dma_addr[rx_index] = pci_map_single(lp->pci_dev,
-								   new_skb->data,
-								   lp->rx_buff_len-2,
-								   PCI_DMA_FROMDEVICE);
+		skb_reserve(new_skb, 2);
+		skb = lp->rx_skbuff[rx_index];
+		pci_unmap_single(lp->pci_dev,lp->rx_dma_addr[rx_index],
+				 lp->rx_buff_len-2, PCI_DMA_FROMDEVICE);
+		skb_put(skb, pkt_len);
+		lp->rx_skbuff[rx_index] = new_skb;
+		lp->rx_dma_addr[rx_index] = pci_map_single(lp->pci_dev,
+							   new_skb->data,
+							   lp->rx_buff_len-2,
+							   PCI_DMA_FROMDEVICE);
 
-			skb->protocol = eth_type_trans(skb, dev);
+		skb->protocol = eth_type_trans(skb, dev);
 
 #if AMD8111E_VLAN_TAG_USED
-			if (vtag == TT_VLAN_TAGGED){
-				u16 vlan_tag = le16_to_cpu(lp->rx_ring[rx_index].tag_ctrl_info);
-				__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
-			}
-#endif
-			netif_receive_skb(skb);
-			/*COAL update rx coalescing parameters*/
-			lp->coal_conf.rx_packets++;
-			lp->coal_conf.rx_bytes += pkt_len;
-			num_rx_pkt++;
-
-		err_next_pkt:
-			lp->rx_ring[rx_index].buff_phy_addr
-				= cpu_to_le32(lp->rx_dma_addr[rx_index]);
-			lp->rx_ring[rx_index].buff_count =
-				cpu_to_le16(lp->rx_buff_len-2);
-			wmb();
-			lp->rx_ring[rx_index].rx_flags |= cpu_to_le16(OWN_BIT);
-			rx_index = (++lp->rx_idx) & RX_RING_DR_MOD_MASK;
+		if (vtag == TT_VLAN_TAGGED){
+			u16 vlan_tag = le16_to_cpu(lp->rx_ring[rx_index].tag_ctrl_info);
+			__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
 		}
-		/* Check the interrupt status register for more packets in the
-		 * mean time. Process them since we have not used up our quota.
-		 */
-		intr0 = readl(mmio + INT0);
-		/*Ack receive packets */
-		writel(intr0 & RINT0,mmio + INT0);
+#endif
+		napi_gro_receive(napi, skb);
+		/* COAL update rx coalescing parameters */
+		lp->coal_conf.rx_packets++;
+		lp->coal_conf.rx_bytes += pkt_len;
+		num_rx_pkt++;
+
+err_next_pkt:
+		lp->rx_ring[rx_index].buff_phy_addr
+			= cpu_to_le32(lp->rx_dma_addr[rx_index]);
+		lp->rx_ring[rx_index].buff_count =
+			cpu_to_le16(lp->rx_buff_len-2);
+		wmb();
+		lp->rx_ring[rx_index].rx_flags |= cpu_to_le16(OWN_BIT);
+		rx_index = (++lp->rx_idx) & RX_RING_DR_MOD_MASK;
+	}
 
-	} while(intr0 & RINT0);
+	if ((num_rx_pkt < budget) &&
+	    napi_complete_done(napi, num_rx_pkt)) {
+		unsigned long flags;
 
-	if (rx_pkt_limit > 0) {
 		/* Receive descriptor is empty now */
 		spin_lock_irqsave(&lp->lock, flags);
-		__napi_complete(napi);
 		writel(VAL0|RINTEN0, mmio + INTEN0);
 		writel(VAL2 | RDMD0, mmio + CMD0);
 		spin_unlock_irqrestore(&lp->lock, flags);
 	}
 
-rx_not_empty:
 	return num_rx_pkt;
 }
 
-- 
2.11.0.483.g087da7b7c-goog

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 5/9] pcnet32: use napi_complete_done()
  2017-02-04 18:20 [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet
                   ` (3 preceding siblings ...)
  2017-02-04 18:20 ` [PATCH net-next 4/9] amd8111e: add GRO support Eric Dumazet
@ 2017-02-04 18:20 ` Eric Dumazet
  2017-02-04 18:20 ` [PATCH net-next 6/9] ep93xx_eth: add GRO support Eric Dumazet
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Eric Dumazet @ 2017-02-04 18:20 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

Use napi_complete_done() instead of __napi_complete() to :

1) Get support of gro_flush_timeout if opt-in
2) Not rearm interrupts for busy-polling users.
3) use standard NAPI API.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/ethernet/amd/pcnet32.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c
index 41e58cca8feed284391d91f7469eaf4b79e5..770c0f3db9e3d217812abbec579e3f46b8e9 100644
--- a/drivers/net/ethernet/amd/pcnet32.c
+++ b/drivers/net/ethernet/amd/pcnet32.c
@@ -1350,13 +1350,8 @@ static int pcnet32_poll(struct napi_struct *napi, int budget)
 		pcnet32_restart(dev, CSR0_START);
 		netif_wake_queue(dev);
 	}
-	spin_unlock_irqrestore(&lp->lock, flags);
-
-	if (work_done < budget) {
-		spin_lock_irqsave(&lp->lock, flags);
-
-		__napi_complete(napi);
 
+	if ((work_done < budget) && napi_complete_done(napi, work_done)) {
 		/* clear interrupt masks */
 		val = lp->a->read_csr(ioaddr, CSR3);
 		val &= 0x00ff;
@@ -1364,9 +1359,9 @@ static int pcnet32_poll(struct napi_struct *napi, int budget)
 
 		/* Set interrupt enable. */
 		lp->a->write_csr(ioaddr, CSR0, CSR0_INTEN);
-
-		spin_unlock_irqrestore(&lp->lock, flags);
 	}
+
+	spin_unlock_irqrestore(&lp->lock, flags);
 	return work_done;
 }
 
-- 
2.11.0.483.g087da7b7c-goog

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 6/9] ep93xx_eth: add GRO support
  2017-02-04 18:20 [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet
                   ` (4 preceding siblings ...)
  2017-02-04 18:20 ` [PATCH net-next 5/9] pcnet32: use napi_complete_done() Eric Dumazet
@ 2017-02-04 18:20 ` Eric Dumazet
  2017-02-04 20:47   ` kbuild test robot
  2017-02-04 18:20 ` [PATCH net-next 7/9] skge: use napi_complete_done() Eric Dumazet
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Eric Dumazet @ 2017-02-04 18:20 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

Use napi_complete_done() instead of __napi_complete() to :

1) Get support of gro_flush_timeout if opt-in
2) Not rearm interrupts for busy-polling users.
3) use standard NAPI API.
4) get rid of baroque code and ease maintenance.

In particular, this driver used napi_reschedule() in
a way that would defeat NAPI poll budget control and
would lead to potential infinite loop.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/ethernet/cirrus/ep93xx_eth.c | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/cirrus/ep93xx_eth.c b/drivers/net/ethernet/cirrus/ep93xx_eth.c
index 396c88678eabfec556536ca4a81f86224563..bb34a3d0ea446256bd025b006b201581c257 100644
--- a/drivers/net/ethernet/cirrus/ep93xx_eth.c
+++ b/drivers/net/ethernet/cirrus/ep93xx_eth.c
@@ -294,7 +294,7 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget)
 			skb_put(skb, length);
 			skb->protocol = eth_type_trans(skb, dev);
 
-			netif_receive_skb(skb);
+			napi_gro_receive(&ep->napi, skb);
 
 			dev->stats.rx_packets++;
 			dev->stats.rx_bytes += length;
@@ -310,35 +310,17 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget)
 	return processed;
 }
 
-static int ep93xx_have_more_rx(struct ep93xx_priv *ep)
-{
-	struct ep93xx_rstat *rstat = ep->descs->rstat + ep->rx_pointer;
-	return !!((rstat->rstat0 & RSTAT0_RFP) && (rstat->rstat1 & RSTAT1_RFP));
-}
-
 static int ep93xx_poll(struct napi_struct *napi, int budget)
 {
 	struct ep93xx_priv *ep = container_of(napi, struct ep93xx_priv, napi);
 	struct net_device *dev = ep->dev;
-	int rx = 0;
+	int rx;
 
-poll_some_more:
 	rx = ep93xx_rx(dev, rx, budget);
-	if (rx < budget) {
-		int more = 0;
-
+	if ((rx < budget) && napi_complete_done(napi, rx)) {
 		spin_lock_irq(&ep->rx_lock);
-		__napi_complete(napi);
 		wrl(ep, REG_INTEN, REG_INTEN_TX | REG_INTEN_RX);
-		if (ep93xx_have_more_rx(ep)) {
-			wrl(ep, REG_INTEN, REG_INTEN_TX);
-			wrl(ep, REG_INTSTSP, REG_INTSTS_RX);
-			more = 1;
-		}
 		spin_unlock_irq(&ep->rx_lock);
-
-		if (more && napi_reschedule(napi))
-			goto poll_some_more;
 	}
 
 	if (rx) {
-- 
2.11.0.483.g087da7b7c-goog

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 7/9] skge: use napi_complete_done()
  2017-02-04 18:20 [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet
                   ` (5 preceding siblings ...)
  2017-02-04 18:20 ` [PATCH net-next 6/9] ep93xx_eth: add GRO support Eric Dumazet
@ 2017-02-04 18:20 ` Eric Dumazet
  2017-02-04 21:44   ` Stephen Hemminger
  2017-02-04 18:20 ` [PATCH net-next 8/9] ks8695net: add GRO support Eric Dumazet
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Eric Dumazet @ 2017-02-04 18:20 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

Use napi_complete_done() instead of __napi_complete() to :

1) Get support of gro_flush_timeout if opt-in
2) Not rearm interrupts for busy-polling users.
3) use standard NAPI API and get rid of napi_gro_flush()

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/ethernet/marvell/skge.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c
index 81106b73e468b3d542fbbef94503278103c7..d2cec5593655a6e442c19e1a32ae86768412 100644
--- a/drivers/net/ethernet/marvell/skge.c
+++ b/drivers/net/ethernet/marvell/skge.c
@@ -3201,7 +3201,7 @@ static void skge_tx_done(struct net_device *dev)
 	}
 }
 
-static int skge_poll(struct napi_struct *napi, int to_do)
+static int skge_poll(struct napi_struct *napi, int budget)
 {
 	struct skge_port *skge = container_of(napi, struct skge_port, napi);
 	struct net_device *dev = skge->netdev;
@@ -3214,7 +3214,7 @@ static int skge_poll(struct napi_struct *napi, int to_do)
 
 	skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_IRQ_CL_F);
 
-	for (e = ring->to_clean; prefetch(e->next), work_done < to_do; e = e->next) {
+	for (e = ring->to_clean; prefetch(e->next), work_done < budget; e = e->next) {
 		struct skge_rx_desc *rd = e->desc;
 		struct sk_buff *skb;
 		u32 control;
@@ -3236,12 +3236,10 @@ static int skge_poll(struct napi_struct *napi, int to_do)
 	wmb();
 	skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_START);
 
-	if (work_done < to_do) {
+	if ((work_done < budget) && napi_complete_done(napi, work_done)) {
 		unsigned long flags;
 
-		napi_gro_flush(napi, false);
 		spin_lock_irqsave(&hw->hw_lock, flags);
-		__napi_complete(napi);
 		hw->intr_mask |= napimask[skge->port];
 		skge_write32(hw, B0_IMSK, hw->intr_mask);
 		skge_read32(hw, B0_IMSK);
-- 
2.11.0.483.g087da7b7c-goog

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 8/9] ks8695net: add GRO support
  2017-02-04 18:20 [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet
                   ` (6 preceding siblings ...)
  2017-02-04 18:20 ` [PATCH net-next 7/9] skge: use napi_complete_done() Eric Dumazet
@ 2017-02-04 18:20 ` Eric Dumazet
  2017-02-04 18:20 ` [PATCH net-next 9/9] qla3xxx: " Eric Dumazet
  2017-02-04 22:17 ` [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet
  9 siblings, 0 replies; 14+ messages in thread
From: Eric Dumazet @ 2017-02-04 18:20 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

Use napi_complete_done() instead of __napi_complete() to :

1) Get support of gro_flush_timeout if opt-in
2) Not rearm interrupts for busy-polling users.
3) use standard NAPI API.

Note that rx_lock seems to be useless, NAPI logic should
not need this extra care.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/ethernet/micrel/ks8695net.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/micrel/ks8695net.c b/drivers/net/ethernet/micrel/ks8695net.c
index 20cb85bc0c5f8660a259dfb8dfd7213df713..f155e21240120061831fecb3537059cf4641 100644
--- a/drivers/net/ethernet/micrel/ks8695net.c
+++ b/drivers/net/ethernet/micrel/ks8695net.c
@@ -519,7 +519,7 @@ static int ks8695_rx(struct ks8695_priv *ksp, int budget)
 			/* Relinquish the SKB to the network layer */
 			skb_put(skb, pktlen);
 			skb->protocol = eth_type_trans(skb, ndev);
-			netif_receive_skb(skb);
+			napi_gro_receive(&ksp->napi, skb);
 
 			/* Record stats */
 			ndev->stats.rx_packets++;
@@ -561,18 +561,17 @@ static int ks8695_rx(struct ks8695_priv *ksp, int budget)
 static int ks8695_poll(struct napi_struct *napi, int budget)
 {
 	struct ks8695_priv *ksp = container_of(napi, struct ks8695_priv, napi);
-	unsigned long  work_done;
-
 	unsigned long isr = readl(KS8695_IRQ_VA + KS8695_INTEN);
 	unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
+	int work_done;
 
 	work_done = ks8695_rx(ksp, budget);
 
-	if (work_done < budget) {
+	if ((work_done < budget) && napi_complete_done(napi, work_done)) {
 		unsigned long flags;
+
 		spin_lock_irqsave(&ksp->rx_lock, flags);
-		__napi_complete(napi);
-		/*enable rx interrupt*/
+		/* enable rx interrupt */
 		writel(isr | mask_bit, KS8695_IRQ_VA + KS8695_INTEN);
 		spin_unlock_irqrestore(&ksp->rx_lock, flags);
 	}
-- 
2.11.0.483.g087da7b7c-goog

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH net-next 9/9] qla3xxx: add GRO support
  2017-02-04 18:20 [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet
                   ` (7 preceding siblings ...)
  2017-02-04 18:20 ` [PATCH net-next 8/9] ks8695net: add GRO support Eric Dumazet
@ 2017-02-04 18:20 ` Eric Dumazet
  2017-02-04 22:17 ` [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet
  9 siblings, 0 replies; 14+ messages in thread
From: Eric Dumazet @ 2017-02-04 18:20 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet

Use napi_complete_done() instead of __napi_complete() to :

1) Get support of gro_flush_timeout if opt-in
2) Not rearm interrupts for busy-polling users.
3) use standard NAPI API.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/ethernet/qlogic/qla3xxx.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index 5c100ab86c0046ec72a011e5f806d6557ac7..6e28a0d1b6cee46f13573b97bf3818fac76a 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -2025,7 +2025,7 @@ static void ql_process_mac_rx_intr(struct ql3_adapter *qdev,
 	skb_checksum_none_assert(skb);
 	skb->protocol = eth_type_trans(skb, qdev->ndev);
 
-	netif_receive_skb(skb);
+	napi_gro_receive(&qdev->napi, skb);
 	lrg_buf_cb2->skb = NULL;
 
 	if (qdev->device_id == QL3022_DEVICE_ID)
@@ -2095,7 +2095,7 @@ static void ql_process_macip_rx_intr(struct ql3_adapter *qdev,
 	}
 	skb2->protocol = eth_type_trans(skb2, qdev->ndev);
 
-	netif_receive_skb(skb2);
+	napi_gro_receive(&qdev->napi, skb2);
 	ndev->stats.rx_packets++;
 	ndev->stats.rx_bytes += length;
 	lrg_buf_cb2->skb = NULL;
@@ -2105,8 +2105,7 @@ static void ql_process_macip_rx_intr(struct ql3_adapter *qdev,
 	ql_release_to_lrg_buf_free_list(qdev, lrg_buf_cb2);
 }
 
-static int ql_tx_rx_clean(struct ql3_adapter *qdev,
-			  int *tx_cleaned, int *rx_cleaned, int work_to_do)
+static int ql_tx_rx_clean(struct ql3_adapter *qdev, int budget)
 {
 	struct net_rsp_iocb *net_rsp;
 	struct net_device *ndev = qdev->ndev;
@@ -2114,7 +2113,7 @@ static int ql_tx_rx_clean(struct ql3_adapter *qdev,
 
 	/* While there are entries in the completion queue. */
 	while ((le32_to_cpu(*(qdev->prsp_producer_index)) !=
-		qdev->rsp_consumer_index) && (work_done < work_to_do)) {
+		qdev->rsp_consumer_index) && (work_done < budget)) {
 
 		net_rsp = qdev->rsp_current;
 		rmb();
@@ -2130,21 +2129,20 @@ static int ql_tx_rx_clean(struct ql3_adapter *qdev,
 		case OPCODE_OB_MAC_IOCB_FN2:
 			ql_process_mac_tx_intr(qdev, (struct ob_mac_iocb_rsp *)
 					       net_rsp);
-			(*tx_cleaned)++;
 			break;
 
 		case OPCODE_IB_MAC_IOCB:
 		case OPCODE_IB_3032_MAC_IOCB:
 			ql_process_mac_rx_intr(qdev, (struct ib_mac_iocb_rsp *)
 					       net_rsp);
-			(*rx_cleaned)++;
+			work_done++;
 			break;
 
 		case OPCODE_IB_IP_IOCB:
 		case OPCODE_IB_3032_IP_IOCB:
 			ql_process_macip_rx_intr(qdev, (struct ib_ip_iocb_rsp *)
 						 net_rsp);
-			(*rx_cleaned)++;
+			work_done++;
 			break;
 		default: {
 			u32 *tmp = (u32 *)net_rsp;
@@ -2169,7 +2167,6 @@ static int ql_tx_rx_clean(struct ql3_adapter *qdev,
 			qdev->rsp_current++;
 		}
 
-		work_done = *tx_cleaned + *rx_cleaned;
 	}
 
 	return work_done;
@@ -2178,25 +2175,25 @@ static int ql_tx_rx_clean(struct ql3_adapter *qdev,
 static int ql_poll(struct napi_struct *napi, int budget)
 {
 	struct ql3_adapter *qdev = container_of(napi, struct ql3_adapter, napi);
-	int rx_cleaned = 0, tx_cleaned = 0;
-	unsigned long hw_flags;
 	struct ql3xxx_port_registers __iomem *port_regs =
 		qdev->mem_map_registers;
+	int work_done;
 
-	ql_tx_rx_clean(qdev, &tx_cleaned, &rx_cleaned, budget);
+	work_done = ql_tx_rx_clean(qdev, budget);
 
-	if (tx_cleaned + rx_cleaned != budget) {
-		spin_lock_irqsave(&qdev->hw_lock, hw_flags);
-		__napi_complete(napi);
+	if ((work_done < budget) && napi_complete_done(napi, work_done)) {
+		unsigned long flags;
+
+		spin_lock_irqsave(&qdev->hw_lock, flags);
 		ql_update_small_bufq_prod_index(qdev);
 		ql_update_lrg_bufq_prod_index(qdev);
 		writel(qdev->rsp_consumer_index,
 			    &port_regs->CommonRegs.rspQConsumerIndex);
-		spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
+		spin_unlock_irqrestore(&qdev->hw_lock, flags);
 
 		ql_enable_interrupts(qdev);
 	}
-	return tx_cleaned + rx_cleaned;
+	return work_done;
 }
 
 static irqreturn_t ql3xxx_isr(int irq, void *dev_id)
-- 
2.11.0.483.g087da7b7c-goog

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH net-next 6/9] ep93xx_eth: add GRO support
  2017-02-04 18:20 ` [PATCH net-next 6/9] ep93xx_eth: add GRO support Eric Dumazet
@ 2017-02-04 20:47   ` kbuild test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kbuild test robot @ 2017-02-04 20:47 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: kbuild-all, David S . Miller, netdev, Eric Dumazet, Eric Dumazet

[-- Attachment #1: Type: text/plain, Size: 4022 bytes --]

Hi Eric,

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Eric-Dumazet/net-get-rid-of-most-__napi_complete-usages/20170205-022748
config: arm-ep93xx_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/cirrus/ep93xx_eth.c: In function 'ep93xx_poll':
>> drivers/net/ethernet/cirrus/ep93xx_eth.c:319:5: warning: 'rx' is used uninitialized in this function [-Wuninitialized]
     rx = ep93xx_rx(dev, rx, budget);
     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/rx +319 drivers/net/ethernet/cirrus/ep93xx_eth.c

1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  303  		}
1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  304  
1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  305  err:
1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  306  		ep->rx_pointer = (entry + 1) & (RX_QUEUE_ENTRIES - 1);
1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  307  		processed++;
1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  308  	}
1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  309  
bea3348e drivers/net/arm/ep93xx_eth.c             Stephen Hemminger 2007-10-03  310  	return processed;
1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  311  }
1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  312  
bea3348e drivers/net/arm/ep93xx_eth.c             Stephen Hemminger 2007-10-03  313  static int ep93xx_poll(struct napi_struct *napi, int budget)
1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  314  {
bea3348e drivers/net/arm/ep93xx_eth.c             Stephen Hemminger 2007-10-03  315  	struct ep93xx_priv *ep = container_of(napi, struct ep93xx_priv, napi);
bea3348e drivers/net/arm/ep93xx_eth.c             Stephen Hemminger 2007-10-03  316  	struct net_device *dev = ep->dev;
7b8cc50a drivers/net/ethernet/cirrus/ep93xx_eth.c Eric Dumazet      2017-02-04  317  	int rx;
1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  318  
bea3348e drivers/net/arm/ep93xx_eth.c             Stephen Hemminger 2007-10-03 @319  	rx = ep93xx_rx(dev, rx, budget);
7b8cc50a drivers/net/ethernet/cirrus/ep93xx_eth.c Eric Dumazet      2017-02-04  320  	if ((rx < budget) && napi_complete_done(napi, rx)) {
1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  321  		spin_lock_irq(&ep->rx_lock);
1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  322  		wrl(ep, REG_INTEN, REG_INTEN_TX | REG_INTEN_RX);
1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  323  		spin_unlock_irq(&ep->rx_lock);
1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  324  	}
1d22e05d drivers/net/arm/ep93xx_eth.c             Lennert Buytenhek 2006-09-22  325  
1827d2e9 drivers/net/arm/ep93xx_eth.c             David S. Miller   2010-05-03  326  	if (rx) {
1827d2e9 drivers/net/arm/ep93xx_eth.c             David S. Miller   2010-05-03  327  		wrw(ep, REG_RXDENQ, rx);

:::::: The code at line 319 was first introduced by commit
:::::: bea3348eef27e6044b6161fd04c3152215f96411 [NET]: Make NAPI polling independent of struct net_device objects.

:::::: TO: Stephen Hemminger <shemminger@linux-foundation.org>
:::::: CC: David S. Miller <davem@sunset.davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 15664 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH net-next 7/9] skge: use napi_complete_done()
  2017-02-04 18:20 ` [PATCH net-next 7/9] skge: use napi_complete_done() Eric Dumazet
@ 2017-02-04 21:44   ` Stephen Hemminger
  2017-02-04 22:16     ` Eric Dumazet
  0 siblings, 1 reply; 14+ messages in thread
From: Stephen Hemminger @ 2017-02-04 21:44 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David S . Miller, netdev, Eric Dumazet

On Sat,  4 Feb 2017 10:20:36 -0800
Eric Dumazet <edumazet@google.com> wrote:

>  
> -static int skge_poll(struct napi_struct *napi, int to_do)
> +static int skge_poll(struct napi_struct *napi, int budget)

Ok, but renaming parameter is not really necessary.

> -	if (work_done < to_do) {
> +	if ((work_done < budget) && napi_complete_done(napi, work_done)) {
>  		unsigned long flags;

Parenthesis around work_done < budget are unnecessary.

Other than that it looks fine.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH net-next 7/9] skge: use napi_complete_done()
  2017-02-04 21:44   ` Stephen Hemminger
@ 2017-02-04 22:16     ` Eric Dumazet
  0 siblings, 0 replies; 14+ messages in thread
From: Eric Dumazet @ 2017-02-04 22:16 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Eric Dumazet, David S . Miller, netdev

On Sat, 2017-02-04 at 13:44 -0800, Stephen Hemminger wrote:
> On Sat,  4 Feb 2017 10:20:36 -0800
> Eric Dumazet <edumazet@google.com> wrote:
> 
> >  
> > -static int skge_poll(struct napi_struct *napi, int to_do)
> > +static int skge_poll(struct napi_struct *napi, int budget)
> 
> Ok, but renaming parameter is not really necessary.

About all drivers use @budget for this parameter.

By having the same variable names, it is easier to compare various
implementations and spot common errors.

> 
> > -	if (work_done < to_do) {
> > +	if ((work_done < budget) && napi_complete_done(napi, work_done)) {
> >  		unsigned long flags;
> 
> Parenthesis around work_done < budget are unnecessary.

Yes, thanks you, I will do this in all the patches for V2.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH net-next 0/9] net: get rid of most __napi_complete() usages
  2017-02-04 18:20 [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet
                   ` (8 preceding siblings ...)
  2017-02-04 18:20 ` [PATCH net-next 9/9] qla3xxx: " Eric Dumazet
@ 2017-02-04 22:17 ` Eric Dumazet
  9 siblings, 0 replies; 14+ messages in thread
From: Eric Dumazet @ 2017-02-04 22:17 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David S . Miller, netdev

On Sat, 2017-02-04 at 10:20 -0800, Eric Dumazet wrote:
> This patch series removes nine __napi_complete() calls, in an effort
> to harmonize NAPI API and generalize GRO and napi_complete_done()
> 
> Two are left, I was not feeling lucky enough to patch them :/
>  ( aeroflex/greth.c & ibm/emac/mal.c )

I will send a v2, fixing the kbuild detected issue.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-02-04 22:17 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-04 18:20 [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet
2017-02-04 18:20 ` [PATCH net-next 1/9] 8139too: use napi_complete_done() Eric Dumazet
2017-02-04 18:20 ` [PATCH net-next 2/9] 8139cp: " Eric Dumazet
2017-02-04 18:20 ` [PATCH net-next 3/9] epic100: " Eric Dumazet
2017-02-04 18:20 ` [PATCH net-next 4/9] amd8111e: add GRO support Eric Dumazet
2017-02-04 18:20 ` [PATCH net-next 5/9] pcnet32: use napi_complete_done() Eric Dumazet
2017-02-04 18:20 ` [PATCH net-next 6/9] ep93xx_eth: add GRO support Eric Dumazet
2017-02-04 20:47   ` kbuild test robot
2017-02-04 18:20 ` [PATCH net-next 7/9] skge: use napi_complete_done() Eric Dumazet
2017-02-04 21:44   ` Stephen Hemminger
2017-02-04 22:16     ` Eric Dumazet
2017-02-04 18:20 ` [PATCH net-next 8/9] ks8695net: add GRO support Eric Dumazet
2017-02-04 18:20 ` [PATCH net-next 9/9] qla3xxx: " Eric Dumazet
2017-02-04 22:17 ` [PATCH net-next 0/9] net: get rid of most __napi_complete() usages Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).