Skip to contentSkip to conversation

drivers/net: fix too big NAPI weights

PATCH Superseded Michal Schmidt 5 participants 21 messages Aug 21, 2013 – Sep 5, 2013

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

cover drivers/net: fix too big NAPI weights

Some drivers request too big NAPI weights and would trigger the error message in netif_napi_add() added in commit 82dc3c63. Let's fix them.

Michal Schmidt (4):
jme: lower NAPI weight
netxen: lower NAPI weight
ps3_gelic: lower NAPI weight
qlcnic: use standard NAPI weights

 drivers/net/ethernet/jme.c                         |  2 +-
 drivers/net/ethernet/qlogic/netxen/netxen_nic.h    |  1 -
 .../net/ethernet/qlogic/netxen/netxen_nic_main.c   |  2 +-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h        |  1 -
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c     | 25 +++++++++-------------
 drivers/net/ethernet/toshiba/ps3_gelic_net.c       |  3 +--
 drivers/net/ethernet/toshiba/ps3_gelic_net.h       |  1 -
 7 files changed, 13 insertions(+), 22 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/4 jme: lower NAPI weight

Since commit 82dc3c63 netif_napi_add() produces an error message if a NAPI poll weight greater than 64 is requested.

jme requests a quarter of the rx ring size as the NAPI weight. jme's rx ring size is 1 << 9 = 512.

Use the standard NAPI weight.

---
 drivers/net/ethernet/jme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/jme.c +1 -1
index 7fbe6ab..23de82a 100644
@@ -3069,7 +3069,7 @@ jme_init_one(struct pci_dev *pdev,
 		jwrite32(jme, JME_APMC, apmc);
 	}
 
-	NETIF_NAPI_SET(netdev, &jme->napi, jme_poll, jme->rx_ring_size >> 2)
+	NETIF_NAPI_SET(netdev, &jme->napi, jme_poll, NAPI_POLL_WEIGHT)
 
 	spin_lock_init(&jme->phy_lock);
 	spin_lock_init(&jme->macaddr_lock);
Signature · 1 line
1.8.3.1
#2 lore raw

Re: [PATCH 1/4] jme: lower NAPI weight

Hello.

Quoted 1 line · Michal Schmidt

Since commit 82dc3c63 netif_napi_add() produces an error message if

Please also specify that commit's summary line in parens.

Quoted 9 lines

a NAPI poll weight greater than 64 is requested.

jme requests a quarter of the rx ring size as the NAPI weight. jme's rx ring size is 1 << 9 = 512.

Use the standard NAPI weight.

WBR, Sergei

#3 lore raw

PATCH v2 1/4 jme: lower NAPI weight

Since commit 82dc3c63 ("net: introduce NAPI_POLL_WEIGHT") netif_napi_add() produces an error message if a NAPI poll weight greater than 64 is requested.

jme requests a quarter of the rx ring size as the NAPI weight. jme's rx ring size is 1 << 9 = 512.

Use the standard NAPI weight.

v2: proper reference to the related commit

---
 drivers/net/ethernet/jme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/jme.c +1 -1
index 7fbe6ab..23de82a 100644
@@ -3069,7 +3069,7 @@ jme_init_one(struct pci_dev *pdev,
 		jwrite32(jme, JME_APMC, apmc);
 	}
 
-	NETIF_NAPI_SET(netdev, &jme->napi, jme_poll, jme->rx_ring_size >> 2)
+	NETIF_NAPI_SET(netdev, &jme->napi, jme_poll, NAPI_POLL_WEIGHT)
 
 	spin_lock_init(&jme->phy_lock);
 	spin_lock_init(&jme->macaddr_lock);
Signature · 1 line
1.8.3.1
maintainer Applied
#4 lore raw

Re: [PATCH v2 1/4] jme: lower NAPI weight

From: Michal Schmidt <[email protected]>
Date: Fri, 23 Aug 2013 15:40:53 +0200

Quoted 4 lines

Since commit 82dc3c63 ("net: introduce NAPI_POLL_WEIGHT") netif_napi_add() produces an error message if a NAPI poll weight greater than 64 is requested.

Quoted 8 lines

jme requests a quarter of the rx ring size as the NAPI weight. jme's rx ring size is 1 << 9 = 512.

Use the standard NAPI weight.

v2: proper reference to the related commit

Applied.

#5 lore raw

PATCH 2/4 netxen: lower NAPI weight

In reply to Michal Schmidt

Since commit 82dc3c63 netif_napi_add() produces an error message if a NAPI poll weight greater than 64 is requested.

Use the standard NAPI weight.

CC Manish Chopra <[email protected]>
CC Sony Chacko <[email protected]>
CC Rajesh Borundia <[email protected]>
---
 drivers/net/ethernet/qlogic/netxen/netxen_nic.h      | 1 -
 drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/qlogic/netxen/netxen_nic.h +0 -1
index 3fe09ab..32675e1 100644
@@ -1171,7 +1171,6 @@ typedef struct {
 
 #define NETXEN_DB_MAPSIZE_BYTES    	0x1000
 
-#define NETXEN_NETDEV_WEIGHT 128
 #define NETXEN_ADAPTER_UP_MAGIC 777
 #define NETXEN_NIC_PEG_TUNE 0
 
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +1 -1
index 1046e94..cbd75f9 100644
@@ -197,7 +197,7 @@ netxen_napi_add(struct netxen_adapter *adapter, struct net_device *netdev)
 	for (ring = 0; ring < adapter->max_sds_rings; ring++) {
 		sds_ring = &recv_ctx->sds_rings[ring];
 		netif_napi_add(netdev, &sds_ring->napi,
-				netxen_nic_poll, NETXEN_NETDEV_WEIGHT);
+				netxen_nic_poll, NAPI_POLL_WEIGHT);
 	}
 
 	return 0;
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH v2 2/4 netxen: lower NAPI weight

Since commit 82dc3c63 ("net: introduce NAPI_POLL_WEIGHT") netif_napi_add() produces an error message if a NAPI poll weight greater than 64 is requested.

Use the standard NAPI weight.

v2: proper reference to the related commit

---
 drivers/net/ethernet/qlogic/netxen/netxen_nic.h      | 1 -
 drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/qlogic/netxen/netxen_nic.h +0 -1
index 3fe09ab..32675e1 100644
@@ -1171,7 +1171,6 @@ typedef struct {
 
 #define NETXEN_DB_MAPSIZE_BYTES    	0x1000
 
-#define NETXEN_NETDEV_WEIGHT 128
 #define NETXEN_ADAPTER_UP_MAGIC 777
 #define NETXEN_NIC_PEG_TUNE 0
 
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +1 -1
index 1046e94..cbd75f9 100644
@@ -197,7 +197,7 @@ netxen_napi_add(struct netxen_adapter *adapter, struct net_device *netdev)
 	for (ring = 0; ring < adapter->max_sds_rings; ring++) {
 		sds_ring = &recv_ctx->sds_rings[ring];
 		netif_napi_add(netdev, &sds_ring->napi,
-				netxen_nic_poll, NETXEN_NETDEV_WEIGHT);
+				netxen_nic_poll, NAPI_POLL_WEIGHT);
 	}
 
 	return 0;
Signature · 1 line
1.8.3.1
maintainer Applied
#8 lore raw

Re: [PATCH v2 2/4] netxen: lower NAPI weight

From: Michal Schmidt <[email protected]>
Date: Fri, 23 Aug 2013 15:41:09 +0200

Quoted 9 lines

Since commit 82dc3c63 ("net: introduce NAPI_POLL_WEIGHT") netif_napi_add() produces an error message if a NAPI poll weight greater than 64 is requested.

Use the standard NAPI weight.

v2: proper reference to the related commit

Applied.

#9 lore raw

PATCH 3/4 ps3_gelic: lower NAPI weight

In reply to Michal Schmidt

Since commit 82dc3c63 netif_napi_add() produces an error message if a NAPI poll weight greater than 64 is requested.

GELIC_NET_NAPI_WEIGHT is defined to GELIC_NET_RX_DESCRIPTORS, which is 128.

Use the standard NAPI weight.

---
 drivers/net/ethernet/toshiba/ps3_gelic_net.c | 3 +--
 drivers/net/ethernet/toshiba/ps3_gelic_net.h | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/toshiba/ps3_gelic_net.c +1 -2
index ad32af6..9c805e0 100644
@@ -1466,8 +1466,7 @@ static void gelic_ether_setup_netdev_ops(struct net_device *netdev,
 {
 	netdev->watchdog_timeo = GELIC_NET_WATCHDOG_TIMEOUT;
 	/* NAPI */
-	netif_napi_add(netdev, napi,
-		       gelic_net_poll, GELIC_NET_NAPI_WEIGHT);
+	netif_napi_add(netdev, napi, gelic_net_poll, NAPI_POLL_WEIGHT);
 	netdev->ethtool_ops = &gelic_ether_ethtool_ops;
 	netdev->netdev_ops = &gelic_netdevice_ops;
 }
drivers/net/ethernet/toshiba/ps3_gelic_net.h +0 -1
index a93df6a..309abb4 100644
@@ -37,7 +37,6 @@
 #define GELIC_NET_RXBUF_ALIGN           128
 #define GELIC_CARD_RX_CSUM_DEFAULT      1 /* hw chksum */
 #define GELIC_NET_WATCHDOG_TIMEOUT      5*HZ
-#define GELIC_NET_NAPI_WEIGHT           (GELIC_NET_RX_DESCRIPTORS)
 #define GELIC_NET_BROADCAST_ADDR        0xffffffffffffL
 
 #define GELIC_NET_MC_COUNT_MAX          32 /* multicast address list */
Signature · 1 line
1.8.3.1
#10 lore raw

Re: [PATCH 3/4] ps3_gelic: lower NAPI weight

Quoted 1 line · Michal Schmidt

Since commit 82dc3c63 netif_napi_add() produces an error message if

Likewise, need a summary line.

Quoted 9 lines

a NAPI poll weight greater than 64 is requested.

GELIC_NET_NAPI_WEIGHT is defined to GELIC_NET_RX_DESCRIPTORS, which is 128.

Use the standard NAPI weight.

WBR, Sergei

maintainer Acked-by on v1 3/4
#11 lore raw

Re: [PATCH 3/4] ps3_gelic: lower NAPI weight

In reply to Michal Schmidt
Quoted 6 lines · Michal Schmidt

Since commit 82dc3c63 netif_napi_add() produces an error message if a NAPI poll weight greater than 64 is requested.

GELIC_NET_NAPI_WEIGHT is defined to GELIC_NET_RX_DESCRIPTORS, which is 128.

Quoted 8 lines

Use the standard NAPI weight.

---
 drivers/net/ethernet/toshiba/ps3_gelic_net.c | 3 +--
 drivers/net/ethernet/toshiba/ps3_gelic_net.h | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

Change looks fine. Please correct comment as Sergei suggested.

#12 lore raw

PATCH v2 3/4 ps3_gelic: lower NAPI weight

Since commit 82dc3c63 ("net: introduce NAPI_POLL_WEIGHT") netif_napi_add() produces an error message if a NAPI poll weight greater than 64 is requested.

GELIC_NET_NAPI_WEIGHT is defined to GELIC_NET_RX_DESCRIPTORS, which is 128.

Use the standard NAPI weight.

v2: proper reference to the related commit

---
 drivers/net/ethernet/toshiba/ps3_gelic_net.c | 3 +--
 drivers/net/ethernet/toshiba/ps3_gelic_net.h | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/toshiba/ps3_gelic_net.c +1 -2
index ad32af6..9c805e0 100644
@@ -1466,8 +1466,7 @@ static void gelic_ether_setup_netdev_ops(struct net_device *netdev,
 {
 	netdev->watchdog_timeo = GELIC_NET_WATCHDOG_TIMEOUT;
 	/* NAPI */
-	netif_napi_add(netdev, napi,
-		       gelic_net_poll, GELIC_NET_NAPI_WEIGHT);
+	netif_napi_add(netdev, napi, gelic_net_poll, NAPI_POLL_WEIGHT);
 	netdev->ethtool_ops = &gelic_ether_ethtool_ops;
 	netdev->netdev_ops = &gelic_netdevice_ops;
 }
drivers/net/ethernet/toshiba/ps3_gelic_net.h +0 -1
index a93df6a..309abb4 100644
@@ -37,7 +37,6 @@
 #define GELIC_NET_RXBUF_ALIGN           128
 #define GELIC_CARD_RX_CSUM_DEFAULT      1 /* hw chksum */
 #define GELIC_NET_WATCHDOG_TIMEOUT      5*HZ
-#define GELIC_NET_NAPI_WEIGHT           (GELIC_NET_RX_DESCRIPTORS)
 #define GELIC_NET_BROADCAST_ADDR        0xffffffffffffL
 
 #define GELIC_NET_MC_COUNT_MAX          32 /* multicast address list */
Signature · 1 line
1.8.3.1
maintainer Applied
#13 lore raw

Re: [PATCH v2 3/4] ps3_gelic: lower NAPI weight

From: Michal Schmidt <[email protected]>
Date: Fri, 23 Aug 2013 15:41:19 +0200

Quoted 7 lines

Since commit 82dc3c63 ("net: introduce NAPI_POLL_WEIGHT") netif_napi_add() produces an error message if a NAPI poll weight greater than 64 is requested.

GELIC_NET_NAPI_WEIGHT is defined to GELIC_NET_RX_DESCRIPTORS, which is 128.

Quoted 6 lines

Use the standard NAPI weight.

v2: proper reference to the related commit

Applied.

#14 lore raw

PATCH 4/4 qlcnic: use standard NAPI weights

In reply to Michal Schmidt

Since commit 82dc3c63 netif_napi_add() produces an error message if a NAPI poll weight greater than 64 is requested.

qlcnic requests the weight as large as 256 for some of its rings, and smaller values for other rings. For instance in qlcnic_82xx_napi_add() I think the intention was to give the tx+rx ring a bigger weight than to rx-only rings, but it's actually doing the opposite. So I'm assuming the weights do not really matter much.

Just use the standard NAPI weights for all rings.

CC Himanshu Madhani <[email protected]>
CC Rajesh Borundia <[email protected]>
CC Shahed Shaikh <[email protected]>
CC Jitendra Kalsaria <[email protected]>
CC Sony Chacko <[email protected]>
CC Sucheta Chakraborty <[email protected]>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h    |  1 -
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 25 ++++++++++---------------
 2 files changed, 10 insertions(+), 16 deletions(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +0 -1
index 3dcc666..47876a5 100644
@@ -926,7 +926,6 @@ struct qlcnic_ipaddr {
 #define QLCNIC_PCI_REG_MSIX_TBL 	0x44
 #define QLCNIC_MSIX_TBL_PGSIZE		4096
 
-#define QLCNIC_NETDEV_WEIGHT	128
 #define QLCNIC_ADAPTER_UP_MAGIC 777
 
 #define __QLCNIC_FW_ATTACHED		0
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +10 -15
index cec0908..1a5915d 100644
@@ -1408,23 +1408,21 @@ void qlcnic_82xx_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring)
 int qlcnic_82xx_napi_add(struct qlcnic_adapter *adapter,
 			 struct net_device *netdev)
 {
-	int ring, max_sds_rings;
+	int ring;
 	struct qlcnic_host_sds_ring *sds_ring;
 	struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
 
 	if (qlcnic_alloc_sds_rings(recv_ctx, adapter->max_sds_rings))
 		return -ENOMEM;
 
-	max_sds_rings = adapter->max_sds_rings;
-
 	for (ring = 0; ring < adapter->max_sds_rings; ring++) {
 		sds_ring = &recv_ctx->sds_rings[ring];
 		if (ring == adapter->max_sds_rings - 1)
 			netif_napi_add(netdev, &sds_ring->napi, qlcnic_poll,
-				       QLCNIC_NETDEV_WEIGHT / max_sds_rings);
+				       NAPI_POLL_WEIGHT);
 		else
 			netif_napi_add(netdev, &sds_ring->napi, qlcnic_rx_poll,
-				       QLCNIC_NETDEV_WEIGHT*2);
+				       NAPI_POLL_WEIGHT);
 	}
 
 	if (qlcnic_alloc_tx_rings(adapter, netdev)) {
@@ -1861,7 +1859,7 @@ void qlcnic_83xx_napi_disable(struct qlcnic_adapter *adapter)
 int qlcnic_83xx_napi_add(struct qlcnic_adapter *adapter,
 			 struct net_device *netdev)
 {
-	int ring, max_sds_rings, temp;
+	int ring;
 	struct qlcnic_host_sds_ring *sds_ring;
 	struct qlcnic_host_tx_ring *tx_ring;
 	struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
@@ -1869,25 +1867,22 @@ int qlcnic_83xx_napi_add(struct qlcnic_adapter *adapter,
 	if (qlcnic_alloc_sds_rings(recv_ctx, adapter->max_sds_rings))
 		return -ENOMEM;
 
-	max_sds_rings = adapter->max_sds_rings;
 	for (ring = 0; ring < adapter->max_sds_rings; ring++) {
 		sds_ring = &recv_ctx->sds_rings[ring];
 		if (adapter->flags & QLCNIC_MSIX_ENABLED) {
-			if (!(adapter->flags & QLCNIC_TX_INTR_SHARED)) {
+			if (!(adapter->flags & QLCNIC_TX_INTR_SHARED))
 				netif_napi_add(netdev, &sds_ring->napi,
 					       qlcnic_83xx_rx_poll,
-					       QLCNIC_NETDEV_WEIGHT * 2);
-			} else {
-				temp = QLCNIC_NETDEV_WEIGHT / max_sds_rings;
+					       NAPI_POLL_WEIGHT);
+			else
 				netif_napi_add(netdev, &sds_ring->napi,
 					       qlcnic_83xx_msix_sriov_vf_poll,
-					       temp);
-			}
+					       NAPI_POLL_WEIGHT);
 
 		} else {
 			netif_napi_add(netdev, &sds_ring->napi,
 				       qlcnic_83xx_poll,
-				       QLCNIC_NETDEV_WEIGHT / max_sds_rings);
+				       NAPI_POLL_WEIGHT);
 		}
 	}
 
@@ -1902,7 +1897,7 @@ int qlcnic_83xx_napi_add(struct qlcnic_adapter *adapter,
 			tx_ring = &adapter->tx_ring[ring];
 			netif_napi_add(netdev, &tx_ring->napi,
 				       qlcnic_83xx_msix_tx_poll,
-				       QLCNIC_NETDEV_WEIGHT);
+				       NAPI_POLL_WEIGHT);
 		}
 	}
 
Signature · 1 line
1.8.3.1
#15 lore raw

Re: [PATCH 4/4] qlcnic: use standard NAPI weights

Quoted 1 line · Michal Schmidt

Since commit 82dc3c63 netif_napi_add() produces an error message if

Likewise, summary line is needed.

Quoted 10 lines

a NAPI poll weight greater than 64 is requested.

qlcnic requests the weight as large as 256 for some of its rings, and smaller values for other rings. For instance in qlcnic_82xx_napi_add() I think the intention was to give the tx+rx ring a bigger weight than to rx-only rings, but it's actually doing the opposite. So I'm assuming the weights do not really matter much.

Just use the standard NAPI weights for all rings.

Quoted 8 lines
CC Himanshu Madhani <[email protected]>
CC Rajesh Borundia <[email protected]>
CC Shahed Shaikh <[email protected]>
CC Jitendra Kalsaria <[email protected]>
CC Sony Chacko <[email protected]>
CC Sucheta Chakraborty <[email protected]>

WBR, Sergei

#16 lore raw

RE: [PATCH 4/4] qlcnic: use standard NAPI weights

In reply to Michal Schmidt

________________________________________
From: Michal Schmidt [[email protected]]
Sent: Wednesday, August 21, 2013 9:49 AM
To: David Miller
Cc: netdev; Eric Dumazet; Himanshu Madhani; Rajesh Borundia; Shahed Shaikh; Jitendra Kalsaria; Sony Chacko; Sucheta Chakraborty; Dept-Eng Linux Driver
Subject: [PATCH 4/4] qlcnic: use standard NAPI weights

Since commit 82dc3c63 netif_napi_add() produces an error message if a NAPI poll weight greater than 64 is requested.

qlcnic requests the weight as large as 256 for some of its rings, and smaller values for other rings. For instance in qlcnic_82xx_napi_add() I think the intention was to give the tx+rx ring a bigger weight than to rx-only rings, but it's actually doing the opposite. So I'm assuming the weights do not really matter much.

Just use the standard NAPI weights for all rings.

CC Himanshu Madhani <[email protected]>
CC Rajesh Borundia <[email protected]>
CC Shahed Shaikh <[email protected]>
CC Jitendra Kalsaria <[email protected]>
CC Sony Chacko <[email protected]>
CC Sucheta Chakraborty <[email protected]>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h    |  1 -
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 25 ++++++++++---------------
 2 files changed, 10 insertions(+), 16 deletions(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +0 -1
index 3dcc666..47876a5 100644
@@ -926,7 +926,6 @@ struct qlcnic_ipaddr {
 #define QLCNIC_PCI_REG_MSIX_TBL        0x44
 #define QLCNIC_MSIX_TBL_PGSIZE         4096
 
-#define QLCNIC_NETDEV_WEIGHT   128
 #define QLCNIC_ADAPTER_UP_MAGIC 777
 
 #define __QLCNIC_FW_ATTACHED           0
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +10 -15
index cec0908..1a5915d 100644
@@ -1408,23 +1408,21 @@ void qlcnic_82xx_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring)
 int qlcnic_82xx_napi_add(struct qlcnic_adapter *adapter,
                         struct net_device *netdev)
 {
-       int ring, max_sds_rings;
+       int ring;
        struct qlcnic_host_sds_ring *sds_ring;
        struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
 
        if (qlcnic_alloc_sds_rings(recv_ctx, adapter->max_sds_rings))
                return -ENOMEM;
 
-       max_sds_rings = adapter->max_sds_rings;
-
        for (ring = 0; ring < adapter->max_sds_rings; ring++) {
                sds_ring = &recv_ctx->sds_rings[ring];
                if (ring == adapter->max_sds_rings - 1)
                        netif_napi_add(netdev, &sds_ring->napi, qlcnic_poll,
-                                      QLCNIC_NETDEV_WEIGHT / max_sds_rings);
+                                      NAPI_POLL_WEIGHT);
                else
                        netif_napi_add(netdev, &sds_ring->napi, qlcnic_rx_poll,
-                                      QLCNIC_NETDEV_WEIGHT*2);
+                                      NAPI_POLL_WEIGHT);
        }
 
        if (qlcnic_alloc_tx_rings(adapter, netdev)) {
@@ -1861,7 +1859,7 @@ void qlcnic_83xx_napi_disable(struct qlcnic_adapter *adapter)
 int qlcnic_83xx_napi_add(struct qlcnic_adapter *adapter,
                         struct net_device *netdev)
 {
-       int ring, max_sds_rings, temp;
+       int ring;
        struct qlcnic_host_sds_ring *sds_ring;
        struct qlcnic_host_tx_ring *tx_ring;
        struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
@@ -1869,25 +1867,22 @@ int qlcnic_83xx_napi_add(struct qlcnic_adapter *adapter,
        if (qlcnic_alloc_sds_rings(recv_ctx, adapter->max_sds_rings))
                return -ENOMEM;
 
-       max_sds_rings = adapter->max_sds_rings;
        for (ring = 0; ring < adapter->max_sds_rings; ring++) {
                sds_ring = &recv_ctx->sds_rings[ring];
                if (adapter->flags & QLCNIC_MSIX_ENABLED) {
-                       if (!(adapter->flags & QLCNIC_TX_INTR_SHARED)) {
+                       if (!(adapter->flags & QLCNIC_TX_INTR_SHARED))
                                netif_napi_add(netdev, &sds_ring->napi,
                                               qlcnic_83xx_rx_poll,
-                                              QLCNIC_NETDEV_WEIGHT * 2);
-                       } else {
-                               temp = QLCNIC_NETDEV_WEIGHT / max_sds_rings;
+                                              NAPI_POLL_WEIGHT);
+                       else
                                netif_napi_add(netdev, &sds_ring->napi,
                                               qlcnic_83xx_msix_sriov_vf_poll,
-                                              temp);
-                       }
+                                              NAPI_POLL_WEIGHT);
 
                } else {
                        netif_napi_add(netdev, &sds_ring->napi,
                                       qlcnic_83xx_poll,
-                                      QLCNIC_NETDEV_WEIGHT / max_sds_rings);
+                                      NAPI_POLL_WEIGHT);
                }
        }
 
@@ -1902,7 +1897,7 @@ int qlcnic_83xx_napi_add(struct qlcnic_adapter *adapter,
                        tx_ring = &adapter->tx_ring[ring];
                        netif_napi_add(netdev, &tx_ring->napi,
                                       qlcnic_83xx_msix_tx_poll,
-                                      QLCNIC_NETDEV_WEIGHT);
+                                      NAPI_POLL_WEIGHT);
                }
        }
 

We are in process of running performance numbers with these changes.  I will respond once I have the performance data with the proposed changes.

Thanks,
Himanshu
--
1.8.3.1

#17 lore raw

Re: [PATCH 4/4] qlcnic: use standard NAPI weights

Quoted 3 lines · Himanshu Madhani

We are in process of running performance numbers with these changes. I will respond once I have the performance data with the proposed changes.

OK. I will post a rebased patch 4/4 later if you find no performance loss.

Thanks,
Michal

#18 lore raw

RE: [PATCH 4/4] qlcnic: use standard NAPI weights

Quoted 9 lines

-----Original Message-----
From: Michal Schmidt [mailto:[email protected]]
Sent: Friday, August 23, 2013 6:45 AM
To: Himanshu Madhani
Cc: David Miller; netdev; Eric Dumazet; Rajesh Borundia; Shahed Shaikh; Jitendra Kalsaria; Sony Chacko; Sucheta Chakraborty; Dept-Eng Linux Driver
Subject: Re: [PATCH 4/4] qlcnic: use standard NAPI weights

On 08/22/2013 08:51 AM, Himanshu Madhani wrote:

Quoted 8 lines
Quoted 3 lines

We are in process of running performance numbers with these changes. I will respond once I have the performance data with the proposed changes.

OK. I will post a rebased patch 4/4 later if you find no performance loss.

Thanks,
Michal

The changes are okay. Please resubmit your rebased patch

Thanks,
Himanshu

#19 lore raw

PATCH v2 1/1 qlcnic: use standard NAPI weights

Since commit 82dc3c63 ("net: introduce NAPI_POLL_WEIGHT") netif_napi_add() produces an error message if a NAPI poll weight greater than 64 is requested.

qlcnic requests the weight as large as 256 for some of its rings, and smaller values for other rings. For instance in qlcnic_82xx_napi_add() I think the intention was to give the tx+rx ring a bigger weight than to rx-only rings, but it's actually doing the opposite. So I'm assuming the weights do not really matter much.

Just use the standard NAPI weights for all rings.

---

v2: Rebased on top of the current qlcnic in net-next.

 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h    |  1 -
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 30 +++++++++++---------------
 2 files changed, 12 insertions(+), 19 deletions(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +0 -1
index 4615960..88349b8 100644
@@ -946,7 +946,6 @@ struct qlcnic_ipaddr {
 #define QLCNIC_PCI_REG_MSIX_TBL 	0x44
 #define QLCNIC_MSIX_TBL_PGSIZE		4096
 
-#define QLCNIC_NETDEV_WEIGHT	128
 #define QLCNIC_ADAPTER_UP_MAGIC 777
 
 #define __QLCNIC_FW_ATTACHED		0
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +12 -18
index 8d06f88..b7b245b 100644
@@ -1458,7 +1458,7 @@ void qlcnic_82xx_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring)
 int qlcnic_82xx_napi_add(struct qlcnic_adapter *adapter,
 			 struct net_device *netdev)
 {
-	int ring, max_sds_rings;
+	int ring;
 	struct qlcnic_host_sds_ring *sds_ring;
 	struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
 	struct qlcnic_host_tx_ring *tx_ring;
@@ -1466,25 +1466,22 @@ int qlcnic_82xx_napi_add(struct qlcnic_adapter *adapter,
 	if (qlcnic_alloc_sds_rings(recv_ctx, adapter->max_sds_rings))
 		return -ENOMEM;
 
-	max_sds_rings = adapter->max_sds_rings;
-
 	for (ring = 0; ring < adapter->max_sds_rings; ring++) {
 		sds_ring = &recv_ctx->sds_rings[ring];
 		if (qlcnic_check_multi_tx(adapter) &&
 		    !adapter->ahw->diag_test &&
 		    (adapter->max_drv_tx_rings > 1)) {
 			netif_napi_add(netdev, &sds_ring->napi, qlcnic_rx_poll,
-					QLCNIC_NETDEV_WEIGHT * 2);
+				       NAPI_POLL_WEIGHT);
 		} else {
 			if (ring == (adapter->max_sds_rings - 1))
 				netif_napi_add(netdev, &sds_ring->napi,
 					       qlcnic_poll,
-					       QLCNIC_NETDEV_WEIGHT /
-					       max_sds_rings);
+					       NAPI_POLL_WEIGHT);
 			else
 				netif_napi_add(netdev, &sds_ring->napi,
 					       qlcnic_rx_poll,
-					       QLCNIC_NETDEV_WEIGHT * 2);
+					       NAPI_POLL_WEIGHT);
 		}
 	}
 
@@ -1497,7 +1494,7 @@ int qlcnic_82xx_napi_add(struct qlcnic_adapter *adapter,
 		for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) {
 			tx_ring = &adapter->tx_ring[ring];
 			netif_napi_add(netdev, &tx_ring->napi, qlcnic_tx_poll,
-				       QLCNIC_NETDEV_WEIGHT);
+				       NAPI_POLL_WEIGHT);
 		}
 	}
 
@@ -1963,7 +1960,7 @@ void qlcnic_83xx_napi_disable(struct qlcnic_adapter *adapter)
 int qlcnic_83xx_napi_add(struct qlcnic_adapter *adapter,
 			 struct net_device *netdev)
 {
-	int ring, max_sds_rings, temp;
+	int ring;
 	struct qlcnic_host_sds_ring *sds_ring;
 	struct qlcnic_host_tx_ring *tx_ring;
 	struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
@@ -1971,25 +1968,22 @@ int qlcnic_83xx_napi_add(struct qlcnic_adapter *adapter,
 	if (qlcnic_alloc_sds_rings(recv_ctx, adapter->max_sds_rings))
 		return -ENOMEM;
 
-	max_sds_rings = adapter->max_sds_rings;
 	for (ring = 0; ring < adapter->max_sds_rings; ring++) {
 		sds_ring = &recv_ctx->sds_rings[ring];
 		if (adapter->flags & QLCNIC_MSIX_ENABLED) {
-			if (!(adapter->flags & QLCNIC_TX_INTR_SHARED)) {
+			if (!(adapter->flags & QLCNIC_TX_INTR_SHARED))
 				netif_napi_add(netdev, &sds_ring->napi,
 					       qlcnic_83xx_rx_poll,
-					       QLCNIC_NETDEV_WEIGHT * 2);
-			} else {
-				temp = QLCNIC_NETDEV_WEIGHT / max_sds_rings;
+					       NAPI_POLL_WEIGHT);
+			else
 				netif_napi_add(netdev, &sds_ring->napi,
 					       qlcnic_83xx_msix_sriov_vf_poll,
-					       temp);
-			}
+					       NAPI_POLL_WEIGHT);
 
 		} else {
 			netif_napi_add(netdev, &sds_ring->napi,
 				       qlcnic_83xx_poll,
-				       QLCNIC_NETDEV_WEIGHT / max_sds_rings);
+				       NAPI_POLL_WEIGHT);
 		}
 	}
 
@@ -2004,7 +1998,7 @@ int qlcnic_83xx_napi_add(struct qlcnic_adapter *adapter,
 			tx_ring = &adapter->tx_ring[ring];
 			netif_napi_add(netdev, &tx_ring->napi,
 				       qlcnic_83xx_msix_tx_poll,
-				       QLCNIC_NETDEV_WEIGHT);
+				       NAPI_POLL_WEIGHT);
 		}
 	}
 
Signature · 1 line
1.8.3.1
maintainer Applied
#20 lore raw

Re: [PATCH net-next v2] qlcnic: use standard NAPI weights

From: Michal Schmidt <[email protected]>
Date: Wed, 04 Sep 2013 15:03:05 +0200

Quoted 10 lines

Since commit 82dc3c63 ("net: introduce NAPI_POLL_WEIGHT") netif_napi_add() produces an error message if a NAPI poll weight greater than 64 is requested.

qlcnic requests the weight as large as 256 for some of its rings, and smaller values for other rings. For instance in qlcnic_82xx_napi_add() I think the intention was to give the tx+rx ring a bigger weight than to rx-only rings, but it's actually doing the opposite. So I'm assuming the weights do not really matter much.

Quoted 4 lines

Just use the standard NAPI weights for all rings.

Applied.