Skip to contentSkip to conversation

bnx2x: patch series

PATCH In review Yuval Mintz 4 participants 25 messages Jan 14, 2013 – Jan 17, 2013

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

cover bnx2x: patch series

Hi Dave,

This patch series contains several patches, some of which
are cosmetic (e.g., introduce 2013),
some fix small issues or rare corner cases (e.g., link failure in self test), and some add new functionality - better support for dumping our registers (supporting `ethtool -w/-d') and support for FW GRO in bridging scenarios.

Please consider applying this patch-series to 'net-next'.

Thanks,
Yuval Mintz

#1 lore raw

PATCH 1/10 bnx2x: Clear dirty status when booting after UNDI

Self-tests following boot from SAN have failed as the UNDI driver might leave some NIG interrupt indications.

This patch does the clean-up, clearing those indications and allowing the test to pass.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 ++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h  | 2 ++
 2 files changed, 4 insertions(+)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +2 -0
index a296758..13e5db6 100644
@@ -9821,6 +9821,8 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp)
 				prev_undi = true;
 				/* clear the UNDI indication */
 				REG_WR(bp, DORQ_REG_NORM_CID_OFST, 0);
+				/* clear possible idle check errors */
+				REG_RD(bp, NIG_REG_NIG_INT_STS_CLR_0);
 			}
 		}
 		/* wait until BRB is empty */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +2 -0
index a015965..765e2dc 100644
@@ -2154,6 +2154,8 @@
 /* [R 32] Interrupt register #0 read */
 #define NIG_REG_NIG_INT_STS_0					 0x103b0
 #define NIG_REG_NIG_INT_STS_1					 0x103c0
+/* [RC 32] Interrupt register #0 read clear */
+#define NIG_REG_NIG_INT_STS_CLR_0				 0x103b4
 /* [R 32] Legacy E1 and E1H location for parity error mask register. */
 #define NIG_REG_NIG_PRTY_MASK					 0x103dc
 /* [RW 32] Parity mask register #0 read/write */
Signature · 1 line
1.8.1.227.g44fe835
#2 lore raw

PATCH 2/10 bnx2x: Add an additional fatal hw assertion - BRB_HW_INTERRUPT

In reply to Yuval Mintz

From: Dmitry Kravkov <[email protected]>

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h     | 1 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h | 1 +
 2 files changed, 2 insertions(+)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +1 -0
index 02c93e3..cab91da 100644
@@ -2154,6 +2154,7 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id,
 				(AEU_INPUTS_ATTN_BITS_TSDM_HW_INTERRUPT | \
 				 AEU_INPUTS_ATTN_BITS_TCM_HW_INTERRUPT | \
 				 AEU_INPUTS_ATTN_BITS_TSEMI_HW_INTERRUPT | \
+				 AEU_INPUTS_ATTN_BITS_BRB_HW_INTERRUPT | \
 				 AEU_INPUTS_ATTN_BITS_PBCLIENT_HW_INTERRUPT)
 #define HW_PRTY_ASSERT_SET_0	(AEU_INPUTS_ATTN_BITS_BRB_PARITY_ERROR | \
 				 AEU_INPUTS_ATTN_BITS_PARSER_PARITY_ERROR | \
drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +1 -0
index 765e2dc..dec014e 100644
@@ -5991,6 +5991,7 @@
 #define HW_LOCK_RESOURCE_SPIO					 2
 #define AEU_INPUTS_ATTN_BITS_ATC_HW_INTERRUPT			 (0x1<<4)
 #define AEU_INPUTS_ATTN_BITS_ATC_PARITY_ERROR			 (0x1<<5)
+#define AEU_INPUTS_ATTN_BITS_BRB_HW_INTERRUPT			 (0x1<<19)
 #define AEU_INPUTS_ATTN_BITS_BRB_PARITY_ERROR			 (0x1<<18)
 #define AEU_INPUTS_ATTN_BITS_CCM_HW_INTERRUPT			 (0x1<<31)
 #define AEU_INPUTS_ATTN_BITS_CCM_PARITY_ERROR			 (0x1<<30)
Signature · 1 line
1.8.1.227.g44fe835
#3 lore raw

PATCH 3/10 bnx2x: use SAN Mac for FCoE.

In reply to Yuval Mintz

From: Dmitry Kravkov <[email protected]>

Current logic causes chips running in switch dependent multi-function FCoE mode not to configure their MAC, leading to an all 0s MAC.

This patch configures the interface with the SAN Mac instead.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +1 -1
index 13e5db6..7233946 100644
@@ -10745,7 +10745,7 @@ static void bnx2x_get_cnic_mac_hwinfo(struct bnx2x *bp)
 			/* Zero primary MAC configuration */
 			memset(bp->dev->dev_addr, 0, ETH_ALEN);
 
-		if (IS_MF_FCOE_AFEX(bp))
+		if (IS_MF_FCOE_AFEX(bp) || IS_MF_FCOE_SD(bp))
 			/* use FIP MAC as primary MAC */
 			memcpy(bp->dev->dev_addr, fip_mac, ETH_ALEN);
 
Signature · 1 line
1.8.1.227.g44fe835
#4 lore raw

PATCH 4/10 bnx2x: Fix rare self-test failures

In reply to Yuval Mintz

From: Yaniv Rosner <[email protected]>

On rare occasions, self test link may fail since the link is being sampled while it's still being stabilized.
To correct this behaviour, try to sample the link for 2 seconds prior to declaring a failure.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +10 -7
index 292634f..23480da 100644
@@ -2379,8 +2379,8 @@ static void bnx2x_self_test(struct net_device *dev,
 			    struct ethtool_test *etest, u64 *buf)
 {
 	struct bnx2x *bp = netdev_priv(dev);
-	u8 is_serdes;
-	int rc;
+	u8 is_serdes, link_up;
+	int rc, cnt = 0;
 
 	if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
 		netdev_err(bp->dev,
@@ -2402,20 +2402,17 @@ static void bnx2x_self_test(struct net_device *dev,
 	}
 
 	is_serdes = (bp->link_vars.link_status & LINK_STATUS_SERDES_LINK) > 0;
-
+	link_up = bp->link_vars.link_up;
 	/* offline tests are not supported in MF mode */
 	if ((etest->flags & ETH_TEST_FL_OFFLINE) && !IS_MF(bp)) {
 		int port = BP_PORT(bp);
 		u32 val;
-		u8 link_up;
 
 		/* save current value of input enable for TX port IF */
 		val = REG_RD(bp, NIG_REG_EGRESS_UMP0_IN_EN + port*4);
 		/* disable input for TX port IF */
 		REG_WR(bp, NIG_REG_EGRESS_UMP0_IN_EN + port*4, 0);
 
-		link_up = bp->link_vars.link_up;
-
 		bnx2x_nic_unload(bp, UNLOAD_NORMAL, false);
 		rc = bnx2x_nic_load(bp, LOAD_DIAG);
 		if (rc) {
@@ -2477,7 +2474,13 @@ static void bnx2x_self_test(struct net_device *dev,
 		etest->flags |= ETH_TEST_FL_FAILED;
 	}
 
-	if (bnx2x_link_test(bp, is_serdes) != 0) {
+	if (link_up) {
+		cnt = 100;
+		while (bnx2x_link_test(bp, is_serdes) && --cnt)
+			msleep(20);
+	}
+
+	if (!cnt) {
 		if (!IS_MF(bp))
 			buf[6] = 1;
 		else
Signature · 1 line
1.8.1.227.g44fe835
#5 lore raw

PATCH 5/10 bnx2x: Added nvram personalities support

In reply to Yuval Mintz

When a device is configured to act as either iscsi or fcoe device in its nvram, prevent the other from being misused by preventing its activation in the driver.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h  | 4 ++++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 7 +++++++
 2 files changed, 11 insertions(+)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +4 -0
index 3369a50..d2e79be 100644
@@ -899,6 +899,10 @@ struct port_feat_cfg {		    /* port 0: 0x454  port 1: 0x4c8 */
 		#define PORT_FEAT_CFG_DCBX_DISABLED                  0x00000000
 		#define PORT_FEAT_CFG_DCBX_ENABLED                   0x00000100
 
+		#define PORT_FEAT_CFG_STORAGE_PERSONALITY_MASK        0x00000C00
+		#define PORT_FEAT_CFG_STORAGE_PERSONALITY_FCOE        0x00000400
+		#define PORT_FEAT_CFG_STORAGE_PERSONALITY_ISCSI       0x00000800
+
 	#define PORT_FEATURE_EN_SIZE_MASK                   0x0f000000
 	#define PORT_FEATURE_EN_SIZE_SHIFT                           24
 	#define PORT_FEATURE_WOL_ENABLED                             0x01000000
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +7 -0
index 7233946..3b05184 100644
@@ -10526,6 +10526,13 @@ static void bnx2x_get_port_hwinfo(struct bnx2x *bp)
 	bp->wol = (!(bp->flags & NO_WOL_FLAG) &&
 		   (config & PORT_FEATURE_WOL_ENABLED));
 
+	if ((config & PORT_FEAT_CFG_STORAGE_PERSONALITY_MASK) ==
+	    PORT_FEAT_CFG_STORAGE_PERSONALITY_FCOE && !IS_MF(bp))
+		bp->flags |= NO_ISCSI_FLAG;
+	if ((config & PORT_FEAT_CFG_STORAGE_PERSONALITY_MASK) ==
+	    PORT_FEAT_CFG_STORAGE_PERSONALITY_ISCSI && !(IS_MF(bp)))
+		bp->flags |= NO_FCOE_FLAG;
+
 	BNX2X_DEV_INFO("lane_config 0x%08x  speed_cap_mask0 0x%08x  link_config0 0x%08x\n",
 		       bp->link_params.lane_config,
 		       bp->link_params.speed_cap_mask[0],
Signature · 1 line
1.8.1.227.g44fe835
#6 lore raw

PATCH 6/10 bnx2x: add `ethtool -w' support.

In reply to Yuval Mintz

From: Miriam Shitrit <[email protected]>

This revises and enhances the bnx2x register dump facilities, adding support for ethtool -w' on top of ethtool -d'.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h        |    1 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h    |    1 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_dump.h   | 3274 +++++++++++++-------
 .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c    |  394 ++-
 4 files changed, 2494 insertions(+), 1176 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +1 -0
index cab91da..309bbb7 100644
@@ -1704,6 +1704,7 @@ struct bnx2x {
 
 	/* priority to cos mapping */
 	u8					prio_to_cos[8];
+	u32 dump_preset_idx;
 };
 
 /* Tx queues may be less or equal to Rx queues */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +1 -0
index 6667ec5..a2583f2 100644
@@ -197,6 +197,7 @@ void bnx2x_igu_ack_sb(struct bnx2x *bp, u8 igu_sb_id, u8 segment,
 
 /* Disable transactions from chip to host */
 void bnx2x_pf_disable(struct bnx2x *bp);
+int bnx2x_pretend_func(struct bnx2x *bp, u16 pretend_func_val);
 
 /**
  * bnx2x__link_status_update - handles link status change.
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dump.h +2177 -1097

2,986 lines not on this page · raw message

drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +315 -79

394 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.8.1.227.g44fe835

Part of the diff is not shown here. View the raw message.

#8 lore raw

PATCH 8/10 bnx2x: Clean previous IGU status before ack

In reply to Yuval Mintz

When enabling interrupts, acknowledge the interrupt only after configuring the IGU to the correct interrupt mode (otherwise it would dirty selftests)

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c  |  1 -
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 17 +++++++++++------
 2 files changed, 11 insertions(+), 7 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +0 -1
index 53a2c0e..a6f4140 100644
@@ -1656,7 +1656,6 @@ static int bnx2x_setup_irqs(struct bnx2x *bp)
 		if (rc)
 			return rc;
 	} else {
-		bnx2x_ack_int(bp);
 		rc = bnx2x_req_irq(bp);
 		if (rc) {
 			BNX2X_ERR("IRQ request failed  rc %d, aborting\n", rc);
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +11 -6
index b75049e..ac09abd 100644
@@ -1528,26 +1528,31 @@ static void bnx2x_igu_int_enable(struct bnx2x *bp)
 	if (msix) {
 		val &= ~(IGU_PF_CONF_INT_LINE_EN |
 			 IGU_PF_CONF_SINGLE_ISR_EN);
-		val |= (IGU_PF_CONF_FUNC_EN |
-			IGU_PF_CONF_MSI_MSIX_EN |
+		val |= (IGU_PF_CONF_MSI_MSIX_EN |
 			IGU_PF_CONF_ATTN_BIT_EN);
 
 		if (single_msix)
 			val |= IGU_PF_CONF_SINGLE_ISR_EN;
 	} else if (msi) {
 		val &= ~IGU_PF_CONF_INT_LINE_EN;
-		val |= (IGU_PF_CONF_FUNC_EN |
-			IGU_PF_CONF_MSI_MSIX_EN |
+		val |= (IGU_PF_CONF_MSI_MSIX_EN |
 			IGU_PF_CONF_ATTN_BIT_EN |
 			IGU_PF_CONF_SINGLE_ISR_EN);
 	} else {
 		val &= ~IGU_PF_CONF_MSI_MSIX_EN;
-		val |= (IGU_PF_CONF_FUNC_EN |
-			IGU_PF_CONF_INT_LINE_EN |
+		val |= (IGU_PF_CONF_INT_LINE_EN |
 			IGU_PF_CONF_ATTN_BIT_EN |
 			IGU_PF_CONF_SINGLE_ISR_EN);
 	}
 
+	/* Clean previous status - need to configure igu prior to ack*/
+	if ((!msix) || single_msix) {
+		REG_WR(bp, IGU_REG_PF_CONFIGURATION, val);
+		bnx2x_ack_int(bp);
+	}
+
+	val |= IGU_PF_CONF_FUNC_EN;
+
 	DP(NETIF_MSG_IFUP, "write 0x%x to IGU  mode %s\n",
 	   val, (msix ? "MSI-X" : (msi ? "MSI" : "INTx")));
 
Signature · 1 line
1.8.1.227.g44fe835
#7 lore raw

PATCH 7/10 bnx2x: improve stop-on-error

In reply to Yuval Mintz

Get better control over interrupts during panic, and allow FW to test outgoing Tx packets when stop-on-error is allowed.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h        |   6 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c    |   4 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h    |   2 +-
 .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c    |   4 -
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c   | 139 +++++++++++----------
 5 files changed, 79 insertions(+), 76 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +2 -4
index 309bbb7..757fe2c 100644
@@ -123,20 +123,18 @@ do {								 \
 } while (0)
 
 #ifdef BNX2X_STOP_ON_ERROR
-void bnx2x_int_disable(struct bnx2x *bp);
 #define bnx2x_panic()				\
 do {						\
 	bp->panic = 1;				\
 	BNX2X_ERR("driver assert\n");		\
-	bnx2x_int_disable(bp);			\
-	bnx2x_panic_dump(bp);			\
+	bnx2x_panic_dump(bp, true);		\
 } while (0)
 #else
 #define bnx2x_panic()				\
 do {						\
 	bp->panic = 1;				\
 	BNX2X_ERR("driver assert\n");		\
-	bnx2x_panic_dump(bp);			\
+	bnx2x_panic_dump(bp, false);		\
 } while (0)
 #endif
 
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +4 -0
index 00706c4..53a2c0e 100644
@@ -3510,13 +3510,17 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		/* when transmitting in a vf, start bd must hold the ethertype
 		 * for fw to enforce it
 		 */
+#ifndef BNX2X_STOP_ON_ERROR
 		if (IS_VF(bp)) {
+#endif
 			tx_start_bd->vlan_or_ethertype =
 				cpu_to_le16(ntohs(eth->h_proto));
+#ifndef BNX2X_STOP_ON_ERROR
 		} else {
 			/* used by FW for packet accounting */
 			tx_start_bd->vlan_or_ethertype = cpu_to_le16(pkt_prod);
 		}
+#endif
 	}
 
 	/* turn on parsing and get a BD */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +1 -1
index a2583f2..8104b98 100644
@@ -479,7 +479,7 @@ int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state);
  */
 void bnx2x_update_max_mf_config(struct bnx2x *bp, u32 value);
 /* Error handling */
-void bnx2x_panic_dump(struct bnx2x *bp);
+void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int);
 
 void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl);
 
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +0 -4
index db9ff98..53374de 100644
@@ -2720,10 +2720,6 @@ static void bnx2x_self_test(struct net_device *dev,
 			buf[2] = 1;
 		etest->flags |= ETH_TEST_FL_FAILED;
 	}
-
-#ifdef BNX2X_EXTRA_DEBUG
-	bnx2x_panic_dump(bp);
-#endif
 }
 
 #define IS_PORT_STAT(i) \
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +72 -67

169 lines not on this page · raw message

Signature · 1 line
1.8.1.227.g44fe835
#9 lore raw

PATCH 9/10 bnx2x: Added FW GRO bridging support

In reply to Yuval Mintz

Since submit 621b4d6 the bnx2x driver support FW GRO. However, when using the device with GRO enabled in bridging scenarios throughput is very low, as the bridge expects all incoming packets to be passed with CHECKSUM_PARTIAL -
a demand which is satisfied by the SW GRO implementation, but was missed in the bnx2x driver implementation (which returned CHECKSUM_UNNECESSARY).

Now, given that the traffic is supported by FW GRO (TCP/IP), the bnx2x driver calculates the pseudo checksum by itself, passing skbs with CHECKSUM_PARTIAL and giving a much better throughput when receiving GRO traffic.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 54 ++++++++++++++++++++++++-
 1 file changed, 52 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +52 -2
index a6f4140..963eb2d 100644
@@ -21,6 +21,7 @@
 #include <linux/if_vlan.h>
 #include <linux/interrupt.h>
 #include <linux/ip.h>
+#include <net/tcp.h>
 #include <net/ipv6.h>
 #include <net/ip6_checksum.h>
 #include <linux/prefetch.h>
@@ -506,7 +507,7 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 					tpa_info->parsing_flags, len_on_bd);
 
 		/* set for GRO */
-		if (fp->mode == TPA_MODE_GRO)
+		if (fp->mode == TPA_MODE_GRO && skb_shinfo(skb)->gso_size)
 			skb_shinfo(skb)->gso_type =
 			    (GET_FLAG(tpa_info->parsing_flags,
 				      PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) ==
@@ -595,6 +596,55 @@ static void *bnx2x_frag_alloc(const struct bnx2x_fastpath *fp)
 }
 
 
+#ifdef CONFIG_INET
+static void bnx2x_gro_ip_csum(struct bnx2x *bp, struct sk_buff *skb)
+{
+	const struct iphdr *iph = ip_hdr(skb);
+	struct tcphdr *th;
+
+	skb_set_transport_header(skb, sizeof(struct iphdr));
+	th = tcp_hdr(skb);
+
+	th->check = ~tcp_v4_check(skb->len - skb_transport_offset(skb),
+				  iph->saddr, iph->daddr, 0);
+}
+
+static void bnx2x_gro_ipv6_csum(struct bnx2x *bp, struct sk_buff *skb)
+{
+	struct ipv6hdr *iph = ipv6_hdr(skb);
+	struct tcphdr *th;
+
+	skb_set_transport_header(skb, sizeof(struct ipv6hdr));
+	th = tcp_hdr(skb);
+
+	th->check = ~tcp_v6_check(skb->len - skb_transport_offset(skb),
+				  &iph->saddr, &iph->daddr, 0);
+}
+#endif
+
+static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp,
+			       struct sk_buff *skb)
+{
+#ifdef CONFIG_INET
+	if (fp->mode == TPA_MODE_GRO && skb_shinfo(skb)->gso_size) {
+		skb_set_network_header(skb, 0);
+		switch (be16_to_cpu(skb->protocol)) {
+		case ETH_P_IP:
+			bnx2x_gro_ip_csum(bp, skb);
+			break;
+		case ETH_P_IPV6:
+			bnx2x_gro_ipv6_csum(bp, skb);
+			break;
+		default:
+			BNX2X_ERR("FW GRO supports only IPv4/IPv6, not 0x%04x\n",
+				  be16_to_cpu(skb->protocol));
+		}
+		tcp_gro_complete(skb);
+	}
+#endif
+	napi_gro_receive(&fp->napi, skb);
+}
+
 static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 			   struct bnx2x_agg_info *tpa_info,
 			   u16 pages,
@@ -648,7 +698,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 					 skb, cqe, cqe_idx)) {
 			if (tpa_info->parsing_flags & PARSING_FLAGS_VLAN)
 				__vlan_hwaccel_put_tag(skb, tpa_info->vlan_tag);
-			napi_gro_receive(&fp->napi, skb);
+			bnx2x_gro_receive(bp, fp, skb);
 		} else {
 			DP(NETIF_MSG_RX_STATUS,
 			   "Failed to allocate new pages - dropping packet!\n");
Signature · 1 line
1.8.1.227.g44fe835
#24 lore raw

PATCH 10/10 bnx2x: Introduce 2013 and advance version to 1.78.02

In reply to Yuval Mintz
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h             | 6 +++---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c         | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h         | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c         | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h         | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c     | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h     | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_file_hdr.h | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h         | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h        | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h    | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c        | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h        | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c        | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_mfw_req.h     | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h         | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c          | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h          | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c       | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h       | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c       | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h       | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c        | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h        | 2 +-
 24 files changed, 26 insertions(+), 26 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +3 -3
index 757fe2c..3e08a24 100644
@@ -1,6 +1,6 @@
 /* bnx2x.h: Broadcom Everest network driver.
  *
- * Copyright (c) 2007-2012 Broadcom Corporation
+ * Copyright (c) 2007-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -26,8 +26,8 @@
  * (you will need to reboot afterwards) */
 /* #define BNX2X_STOP_ON_ERROR */
 
-#define DRV_MODULE_VERSION      "1.78.01-0"
-#define DRV_MODULE_RELDATE      "2012/10/30"
+#define DRV_MODULE_VERSION      "1.78.02-0"
+#define DRV_MODULE_RELDATE      "2013/01/14"
 #define BNX2X_BC_VER            0x040200
 
 #if defined(CONFIG_DCB)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -1
index 963eb2d..42fe3c7 100644
@@ -1,6 +1,6 @@
 /* bnx2x_cmn.c: Broadcom Everest network driver.
  *
- * Copyright (c) 2007-2012 Broadcom Corporation
+ * Copyright (c) 2007-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +1 -1
index 8104b98..faad34f 100644
@@ -1,6 +1,6 @@
 /* bnx2x_cmn.h: Broadcom Everest network driver.
  *
- * Copyright (c) 2007-2012 Broadcom Corporation
+ * Copyright (c) 2007-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +1 -1
index 10bc093..37a2e9a 100644
@@ -1,6 +1,6 @@
 /* bnx2x_dcb.c: Broadcom Everest network driver.
  *
- * Copyright 2009-2012 Broadcom Corporation
+ * Copyright 2009-2013 Broadcom Corporation
  *
  * Unless you and Broadcom execute a separate written software license
  * agreement governing use of this software, this software is licensed to you
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h +1 -1
index 06c7a04..d153f44 100644
@@ -1,6 +1,6 @@
 /* bnx2x_dcb.h: Broadcom Everest network driver.
  *
- * Copyright 2009-2012 Broadcom Corporation
+ * Copyright 2009-2013 Broadcom Corporation
  *
  * Unless you and Broadcom execute a separate written software license
  * agreement governing use of this software, this software is licensed to you
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +1 -1
index 53374de..e05e5fc 100644
@@ -1,6 +1,6 @@
 /* bnx2x_ethtool.c: Broadcom Everest network driver.
  *
- * Copyright (c) 2007-2012 Broadcom Corporation
+ * Copyright (c) 2007-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h +1 -1
index 60a83ad..2959f2a 100644
@@ -1,6 +1,6 @@
 /* bnx2x_fw_defs.h: Broadcom Everest network driver.
  *
- * Copyright (c) 2007-2012 Broadcom Corporation
+ * Copyright (c) 2007-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_file_hdr.h +1 -1
index 4bed52b..f572ae1 100644
@@ -1,6 +1,6 @@
 /* bnx2x_fw_file_hdr.h: FW binary file header structure.
  *
- * Copyright (c) 2007-2012 Broadcom Corporation
+ * Copyright (c) 2007-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +1 -1
index d2e79be..76e30c9 100644
@@ -1,6 +1,6 @@
 /* bnx2x_hsi.h: Broadcom Everest network driver.
  *
- * Copyright (c) 2007-2012 Broadcom Corporation
+ * Copyright (c) 2007-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h +1 -1
index c8f10f0..76df015 100644
@@ -1,7 +1,7 @@
 /* bnx2x_init.h: Broadcom Everest network driver.
  *               Structures and macroes needed during the initialization.
  *
- * Copyright (c) 2007-2012 Broadcom Corporation
+ * Copyright (c) 2007-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h +1 -1
index d755acf..ae9b6ff 100644
@@ -2,7 +2,7 @@
  *               Static functions needed during the initialization.
  *               This file is "included" in bnx2x_main.c.
  *
- * Copyright (c) 2007-2012 Broadcom Corporation
+ * Copyright (c) 2007-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +1 -1
index cb41f54..859df75 100644
@@ -1,4 +1,4 @@
-/* Copyright 2008-2012 Broadcom Corporation
+/* Copyright 2008-2013 Broadcom Corporation
  *
  * Unless you and Broadcom execute a separate written software license
  * agreement governing use of this software, this software is licensed to you
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h +1 -1
index ee6e7ec..d25c7d7 100644
@@ -1,4 +1,4 @@
-/* Copyright 2008-2012 Broadcom Corporation
+/* Copyright 2008-2013 Broadcom Corporation
  *
  * Unless you and Broadcom execute a separate written software license
  * agreement governing use of this software, this software is licensed to you
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +1 -1
index ac09abd..4b0217b 100644
@@ -1,6 +1,6 @@
 /* bnx2x_main.c: Broadcom Everest network driver.
  *
- * Copyright (c) 2007-2012 Broadcom Corporation
+ * Copyright (c) 2007-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/bnx2x/bnx2x_mfw_req.h +1 -1
index ddd5106..caf1aef 100644
@@ -1,6 +1,6 @@
 /* bnx2x_mfw_req.h: Broadcom Everest network driver.
  *
- * Copyright (c) 2012 Broadcom Corporation
+ * Copyright (c) 2012-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +1 -1
index dec014e..791eb2d 100644
@@ -1,6 +1,6 @@
 /* bnx2x_reg.h: Broadcom Everest network driver.
  *
- * Copyright (c) 2007-2012 Broadcom Corporation
+ * Copyright (c) 2007-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +1 -1
index 147933a..8e8c91a 100644
@@ -1,6 +1,6 @@
 /* bnx2x_sp.c: Broadcom Everest network driver.
  *
- * Copyright (c) 2011-2012 Broadcom Corporation
+ * Copyright (c) 2011-2013 Broadcom Corporation
  *
  * Unless you and Broadcom execute a separate written software license
  * agreement governing use of this software, this software is licensed to you
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h +1 -1
index b304678..0beac4b 100644
@@ -1,6 +1,6 @@
 /* bnx2x_sp.h: Broadcom Everest network driver.
  *
- * Copyright (c) 2011-2012 Broadcom Corporation
+ * Copyright (c) 2011-2013 Broadcom Corporation
  *
  * Unless you and Broadcom execute a separate written software license
  * agreement governing use of this software, this software is licensed to you
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +1 -1
index 08db503..5e45cb9 100644
@@ -1,6 +1,6 @@
 /* bnx2x_sriov.c: Broadcom Everest network driver.
  *
- * Copyright 2009-2012 Broadcom Corporation
+ * Copyright 2009-2013 Broadcom Corporation
  *
  * Unless you and Broadcom execute a separate written software license
  * agreement governing use of this software, this software is licensed to you
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h +1 -1
index df4ae74..d51189b 100644
@@ -1,6 +1,6 @@
 /* bnx2x_sriov.h: Broadcom Everest network driver.
  *
- * Copyright 2009-2012 Broadcom Corporation
+ * Copyright 2009-2013 Broadcom Corporation
  *
  * Unless you and Broadcom execute a separate written software license
  * agreement governing use of this software, this software is licensed to you
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c +1 -1
index 93a8e74..18c2e61 100644
@@ -1,6 +1,6 @@
 /* bnx2x_stats.c: Broadcom Everest network driver.
  *
- * Copyright (c) 2007-2012 Broadcom Corporation
+ * Copyright (c) 2007-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h +1 -1
index b4d7b26..63a2f85 100644
@@ -1,6 +1,6 @@
 /* bnx2x_stats.h: Broadcom Everest network driver.
  *
- * Copyright (c) 2007-2012 Broadcom Corporation
+ * Copyright (c) 2007-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c +1 -1
index 850aad3..9cef520 100644
@@ -1,6 +1,6 @@
 /* bnx2x_vfpf.c: Broadcom Everest network driver.
  *
- * Copyright 2009-2012 Broadcom Corporation
+ * Copyright 2009-2013 Broadcom Corporation
  *
  * Unless you and Broadcom execute a separate written software license
  * agreement governing use of this software, this software is licensed to you
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h +1 -1
index 21d2985..a74477c 100644
@@ -1,6 +1,6 @@
 /* bnx2x_vfpf.h: Broadcom Everest network driver.
  *
- * Copyright (c) 2011-2012 Broadcom Corporation
+ * Copyright (c) 2011-2013 Broadcom Corporation
  *
  * Unless you and Broadcom execute a separate written software license
  * agreement governing use of this software, this software is licensed to you
Signature · 1 line
1.8.1.227.g44fe835
#10 lore raw

Re: [PATCH net-next 09/10] bnx2x: Added FW GRO bridging support

In reply to Yuval Mintz
Quoted 79 lines · Yuval Mintz

Since submit 621b4d6 the bnx2x driver support FW GRO. However, when using the device with GRO enabled in bridging scenarios throughput is very low, as the bridge expects all incoming packets to be passed with CHECKSUM_PARTIAL -
a demand which is satisfied by the SW GRO implementation, but was missed in the bnx2x driver implementation (which returned CHECKSUM_UNNECESSARY).

Now, given that the traffic is supported by FW GRO (TCP/IP), the bnx2x driver calculates the pseudo checksum by itself, passing skbs with CHECKSUM_PARTIAL and giving a much better throughput when receiving GRO traffic.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 54 ++++++++++++++++++++++++-
 1 file changed, 52 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +36 -1
index a6f4140..963eb2d 100644
@@ -21,6 +21,7 @@
 #include <linux/if_vlan.h>
 #include <linux/interrupt.h>
 #include <linux/ip.h>
+#include <net/tcp.h>
 #include <net/ipv6.h>
 #include <net/ip6_checksum.h>
 #include <linux/prefetch.h>
@@ -506,7 +507,7 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 					tpa_info->parsing_flags, len_on_bd);
 
 		/* set for GRO */
-		if (fp->mode == TPA_MODE_GRO)
+		if (fp->mode == TPA_MODE_GRO && skb_shinfo(skb)->gso_size)
 			skb_shinfo(skb)->gso_type =
 			    (GET_FLAG(tpa_info->parsing_flags,
 				      PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) ==
@@ -595,6 +596,55 @@ static void *bnx2x_frag_alloc(const struct bnx2x_fastpath *fp)
 }
 
 
+#ifdef CONFIG_INET
+static void bnx2x_gro_ip_csum(struct bnx2x *bp, struct sk_buff *skb)
+{
+	const struct iphdr *iph = ip_hdr(skb);
+	struct tcphdr *th;
+
+	skb_set_transport_header(skb, sizeof(struct iphdr));
+	th = tcp_hdr(skb);
+
+	th->check = ~tcp_v4_check(skb->len - skb_transport_offset(skb),
+				  iph->saddr, iph->daddr, 0);
+}
+
+static void bnx2x_gro_ipv6_csum(struct bnx2x *bp, struct sk_buff *skb)
+{
+	struct ipv6hdr *iph = ipv6_hdr(skb);
+	struct tcphdr *th;
+
+	skb_set_transport_header(skb, sizeof(struct ipv6hdr));
+	th = tcp_hdr(skb);
+
+	th->check = ~tcp_v6_check(skb->len - skb_transport_offset(skb),
+				  &iph->saddr, &iph->daddr, 0);
+}
+#endif
+
+static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp,
+			       struct sk_buff *skb)
+{
+#ifdef CONFIG_INET
+	if (fp->mode == TPA_MODE_GRO && skb_shinfo(skb)->gso_size) {
+		skb_set_network_header(skb, 0);
+		switch (be16_to_cpu(skb->protocol)) {
+		case ETH_P_IP:

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c static void *bnx2x_frag_alloc(const struct bnx2x_fastpath *fp) · line 642

Quoted 10 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +10 -0
+			bnx2x_gro_ip_csum(bp, skb);
+			break;
+		case ETH_P_IPV6:
+			bnx2x_gro_ipv6_csum(bp, skb);
+			break;
+		default:
+			BNX2X_ERR("FW GRO supports only IPv4/IPv6, not 0x%04x\n",
+				  be16_to_cpu(skb->protocol));
+		}
+		tcp_gro_complete(skb);

This looks weird to me. This should be called by GRO stack only.

What is the value of gso_segs ?

Quoted 17 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +6 -1
+	}
+#endif
+	napi_gro_receive(&fp->napi, skb);
+}
+
 static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 			   struct bnx2x_agg_info *tpa_info,
 			   u16 pages,
@@ -648,7 +698,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 					 skb, cqe, cqe_idx)) {
 			if (tpa_info->parsing_flags & PARSING_FLAGS_VLAN)
 				__vlan_hwaccel_put_tag(skb, tpa_info->vlan_tag);
-			napi_gro_receive(&fp->napi, skb);
+			bnx2x_gro_receive(bp, fp, skb);
 		} else {
 			DP(NETIF_MSG_RX_STATUS,
 			   "Failed to allocate new pages - dropping packet!\n");
#11 lore raw

Re: [PATCH net-next 09/10] bnx2x: Added FW GRO bridging support

Quoted 5 lines · Eric Dumazet

This looks weird to me. This should be called by GRO stack only.

What is the value of gso_segs ?

The reason I am pointing this out is the recent change in commit 1def9238d4aa2146924994aa4b7dc861f03b9362
(net_sched: more precise pkt_len computation)

bnx2x not setting gso_segs means that qdisc accounting on ingress is completely wrong.

#12 lore raw

Re: [PATCH net-next 09/10] bnx2x: Added FW GRO bridging support

Quoted 10 lines · Eric Dumazet

On Mon, 2013-01-14 at 09:22 -0800, Eric Dumazet wrote:

What is the value of gso_segs ?

The reason I am pointing this out is the recent change in commit 1def9238d4aa2146924994aa4b7dc861f03b9362
(net_sched: more precise pkt_len computation)

bnx2x not setting gso_segs means that qdisc accounting on ingress is completely wrong.

Hi Eric,

First I just want to state that you're totally correct about the gso_segs - bnx2x is not setting it correctly (it's currently totally omitted), and so it would incorrectly affect the accounting.

However, notice this behaviour was not introduced in this patch - Since 621b4d6 bnx2x is using FW GRO, overriding the kernel's GRO implementation:
As the bnx2x driver is supplied with the aggregated packet from its FW, the bnx2x passes a value in the gso_size' field of its skb, causing skb_is_gso' to return `true'.
This will cause the aggregated skb to override the GRO machinations (in dev_gro_receive'), overriding all calls to gro_receive' and thus also the call to skb_gro_receive' which whould have incremented gso_segs'.

This patch actually tries to correct said behaviour, obviously failing with the gso_segs but still improving the current state of bnx2x GRO in bridging scenarios.

Quoted 1 line
Quoted 1 line

This looks weird to me. This should be called by GRO stack only.

I think this is the main question - we could try and implement this inside the network-core itself, but as said behaviour is unique to the bnx2x driver (correct me if I'm wrong, but I'm unaware of any other driver which does GRO without the kernel GRO implementation), the solution is specially tailored for the bnx2x driver.

We could either:
1. Continue with this patch, later sending a patch correcting gso_segs, as this is not a new issue.
2. Send a V2 patch-series which will also set gso_segs correctly.
3. Send a V2 patch-series which omits this patch, and later send an RFC for some kernel implementation which fixes the issue.

Your thoughts on this matter will be greatly appreciated.

Thanks,
Yuval

#13 lore raw

Re: [PATCH net-next 09/10] bnx2x: Added FW GRO bridging support

Quoted 39 lines · Yuval Mintz
Quoted 10 lines · Eric Dumazet

On Mon, 2013-01-14 at 09:22 -0800, Eric Dumazet wrote:

What is the value of gso_segs ?

The reason I am pointing this out is the recent change in commit 1def9238d4aa2146924994aa4b7dc861f03b9362
(net_sched: more precise pkt_len computation)

bnx2x not setting gso_segs means that qdisc accounting on ingress is completely wrong.

Hi Eric,

First I just want to state that you're totally correct about the gso_segs - bnx2x is not setting it correctly (it's currently totally omitted), and so it would incorrectly affect the accounting.

However, notice this behaviour was not introduced in this patch - Since 621b4d6 bnx2x is using FW GRO, overriding the kernel's GRO implementation:
As the bnx2x driver is supplied with the aggregated packet from its FW, the bnx2x passes a value in the gso_size' field of its skb, causing skb_is_gso' to return `true'.
This will cause the aggregated skb to override the GRO machinations (in dev_gro_receive'), overriding all calls to gro_receive' and thus also the call to skb_gro_receive' which whould have incremented gso_segs'.

This patch actually tries to correct said behaviour, obviously failing with the gso_segs but still improving the current state of bnx2x GRO in bridging scenarios.

Quoted 1 line
Quoted 1 line

This looks weird to me. This should be called by GRO stack only.

I think this is the main question - we could try and implement this inside the network-core itself, but as said behaviour is unique to the bnx2x driver (correct me if I'm wrong, but I'm unaware of any other driver which does GRO without the kernel GRO implementation), the solution is specially tailored for the bnx2x driver.

Quoted 8 lines

We could either:
1. Continue with this patch, later sending a patch correcting gso_segs, as this is not a new issue.
2. Send a V2 patch-series which will also set gso_segs correctly.
3. Send a V2 patch-series which omits this patch, and later send an RFC for some kernel implementation which fixes the issue.

Your thoughts on this matter will be greatly appreciated.

I am fine with any solution, as long as we fix the problem.

If GRO is done by the FW/driver instead of core network stack, we should make sure :

- transport_header is set correctly (your patch seems to do that)
- gso_segs is computed (this could be done in core network, but this adds yet another conditional test in th fast path, and it seems only bnx2x would need this)

Thanks

#14 lore raw

Re: [PATCH net-next 09/10] bnx2x: Added FW GRO bridging support

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

bnx2x not setting gso_segs means that qdisc accounting on ingress is completely wrong.

Notice this behaviour was not introduced in this patch -

Quoted 8 lines
Quoted 6 lines
	...

We could either:
1. Continue with this patch, later sending a patch correcting gso_segs, as this is not a new issue.
2. Send a V2 patch-series which will also set gso_segs correctly.

I am fine with any solution, as long as we fix the problem.

Eric - Thanks.
Just to be certain - gso_segs should hold the number of non-aggregated packets contained in the skb's frags, right?

Dave -

Considering Eric's response, following with option (1) or (2) seems like the right way to go.

Do you want a new patch series which will include a fix for this, or will you accept a later fix that sets the gso_segs correctly?

(considering this issue is not introduced in this patch, merely isn't being solved by it)

Thanks,
Yuval Mintz

#15 lore raw

Re: [PATCH net-next 09/10] bnx2x: Added FW GRO bridging support

Quoted 12 lines · Yuval Mintz
Quoted 12 lines
Quoted 11 lines
Quoted 2 lines

bnx2x not setting gso_segs means that qdisc accounting on ingress is completely wrong.

Notice this behaviour was not introduced in this patch -

	...

We could either:
1. Continue with this patch, later sending a patch correcting gso_segs, as this is not a new issue.
2. Send a V2 patch-series which will also set gso_segs correctly.

Quoted 5 lines
Quoted 1 line

I am fine with any solution, as long as we fix the problem.

Eric - Thanks.
Just to be certain - gso_segs should hold the number of non-aggregated packets contained in the skb's frags, right?

Thats right

If the FW doesnt provide the info, you could for example do :

shinfo->gso_segs = DIV_ROUND_UP(skb->len - hdr_len, shinfo->gso_size);

(hdr_len being the length of all headers (ethernet+network+TCP))

maintainer
#16 lore raw

Re: [PATCH net-next 09/10] bnx2x: Added FW GRO bridging support

In reply to Yuval Mintz

From: "Yuval Mintz" <[email protected]>
Date: Tue, 15 Jan 2013 16:02:32 +0200

Quoted 8 lines

Considering Eric's response, following with option (1) or (2) seems like the right way to go.

Do you want a new patch series which will include a fix for this, or will you accept a later fix that sets the gso_segs correctly?

(considering this issue is not introduced in this patch, merely isn't being solved by it)

I've merged your patch series as-is to net-next, please work on fixing the problems Eric has pointed out.

Thanks.

#17 lore raw

Re: [PATCH net-next 09/10] bnx2x: Added FW GRO bridging support

Quoted 3 lines · David Miller

I've merged your patch series as-is to net-next, please work on fixing the problems Eric has pointed out.

I have two fixes :

One in net/core/dev.c you probably can apply after usual review

One for bnx2x, I guess Broadcom guys need to check it.

#18 lore raw

PATCH 1/1 bnx2x: fix GRO parameters

From: Eric Dumazet <[email protected]>

bnx2x does an internal GRO pass but doesn't provide gso_segs, thus breaking qdisc_pkt_len_init() in case ingress qdisc is used.

We store gso_segs in NAPI_GRO_CB(skb)->count, where tcp_gro_complete() expects to find the number of aggregated segments.

Cc Yuval Mintz <[email protected]>
Cc Eilon Greenstein <[email protected]>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c |   44 +++++++-------
 1 file changed, 24 insertions(+), 20 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +24 -20
index 18fc26e..e9bea2e 100644
@@ -439,31 +439,37 @@ static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue,
  */
 #define TPA_TSTAMP_OPT_LEN	12
 /**
- * bnx2x_set_lro_mss - calculate the approximate value of the MSS
+ * bnx2x_set_gro_params - compute GRO values
  *
+ * @skb:		packet skb
  * @bp:			driver handle
  * @parsing_flags:	parsing flags from the START CQE
  * @len_on_bd:		total length of the first packet for the
  *			aggregation.
+ * @pkt_len:		length of all segments
  *
  * Approximate value of the MSS for this aggregation calculated using
  * the first packet of it.
+ * Compute number of aggregated segments, and gso_type
  */
-static u16 bnx2x_set_lro_mss(struct bnx2x *bp, u16 parsing_flags,
-			     u16 len_on_bd)
+static void bnx2x_set_gro_params(struct sk_buff *skb, struct bnx2x *bp,
+				 u16 parsing_flags, u16 len_on_bd,
+				 unsigned int pkt_len)
 {
 	/*
-	 * TPA arrgregation won't have either IP options or TCP options
+	 * TPA aggregation won't have either IP options or TCP options
 	 * other than timestamp or IPv6 extension headers.
 	 */
 	u16 hdrs_len = ETH_HLEN + sizeof(struct tcphdr);
 
 	if (GET_FLAG(parsing_flags, PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) ==
-	    PRS_FLAG_OVERETH_IPV6)
+	    PRS_FLAG_OVERETH_IPV6) {
 		hdrs_len += sizeof(struct ipv6hdr);
-	else /* IPv4 */
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
+	} else {
 		hdrs_len += sizeof(struct iphdr);
-
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+	}
 
 	/* Check if there was a TCP timestamp, if there is it's will
 	 * always be 12 bytes length: nop nop kind length echo val.
@@ -473,7 +479,13 @@ static u16 bnx2x_set_lro_mss(struct bnx2x *bp, u16 parsing_flags,
 	if (parsing_flags & PARSING_FLAGS_TIME_STAMP_EXIST_FLAG)
 		hdrs_len += TPA_TSTAMP_OPT_LEN;
 
-	return len_on_bd - hdrs_len;
+	skb_shinfo(skb)->gso_size = len_on_bd - hdrs_len;
+
+	/* tcp_gro_complete() will copy NAPI_GRO_CB(skb)->count
+	 * to skb_shinfo(skb)->gso_segs
+	 */
+	NAPI_GRO_CB(skb)->count = DIV_ROUND_UP(pkt_len - hdrs_len,
+					       skb_shinfo(skb)->gso_size);
 }
 
 static int bnx2x_alloc_rx_sge(struct bnx2x *bp,
@@ -527,18 +539,10 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 	}
 
 	/* This is needed in order to enable forwarding support */
-	if (frag_size) {
-		skb_shinfo(skb)->gso_size = bnx2x_set_lro_mss(bp,
-					tpa_info->parsing_flags, len_on_bd);
+	if (frag_size)
+		bnx2x_set_gro_params(skb, bp, tpa_info->parsing_flags,
+				     len_on_bd, le16_to_cpu(cqe->pkt_len));
 
-		/* set for GRO */
-		if (fp->mode == TPA_MODE_GRO && skb_shinfo(skb)->gso_size)
-			skb_shinfo(skb)->gso_type =
-			    (GET_FLAG(tpa_info->parsing_flags,
-				      PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) ==
-						PRS_FLAG_OVERETH_IPV6) ?
-				SKB_GSO_TCPV6 : SKB_GSO_TCPV4;
-	}
 
 
 #ifdef BNX2X_STOP_ON_ERROR
@@ -651,7 +655,7 @@ static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 			       struct sk_buff *skb)
 {
 #ifdef CONFIG_INET
-	if (fp->mode == TPA_MODE_GRO && skb_shinfo(skb)->gso_size) {
+	if (skb_shinfo(skb)->gso_size) {
 		skb_set_network_header(skb, 0);
 		switch (be16_to_cpu(skb->protocol)) {
 		case ETH_P_IP:
#19 lore raw

Re: [PATCH net-next] bnx2x: fix GRO parameters

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue, · line 457

Quoted 5 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +3 -2
-static u16 bnx2x_set_lro_mss(struct bnx2x *bp, u16 parsing_flags,
-			     u16 len_on_bd)
+static void bnx2x_set_gro_params(struct sk_buff *skb, struct bnx2x *bp,
+				 u16 parsing_flags, u16 len_on_bd,
+				 unsigned int pkt_len)

This is purely semantic, but our convention is for `struct bnx2x' to be the first argument in our functions.

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue, · line 463

Quoted 7 lines

{

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -1
 	/*
-	 * TPA arrgregation won't have either IP options or TCP options
+	 * TPA aggregation won't have either IP options or TCP options
 	 * other than timestamp or IPv6 extension headers.
 	 */
 	u16 hdrs_len = ETH_HLEN + sizeof(struct tcphdr);

TPA_MODE_LRO indicates that an LRO aggregation was made by our FW. It seems like your patch eliminates the difference in configuration between the two (GRO and LRO)

perhaps instead we should do something like:

+ static void bnx2x_set_lro_params(struct bnx2x *bp, struct sk_buff *skb,
+ u16 parsing_flags, u16 len_on_bd,
+ unsigned int pkt_len,
+ bnx2x_tpa_mode_t mode)

And arrange its suggested code so that only gso_size will be set for LRO.

Quoted 18 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +5 -3
 	if (GET_FLAG(parsing_flags, PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) ==
-	    PRS_FLAG_OVERETH_IPV6)
+	    PRS_FLAG_OVERETH_IPV6) {
 		hdrs_len += sizeof(struct ipv6hdr);
-	else /* IPv4 */
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
+	} else {
 		hdrs_len += sizeof(struct iphdr);
-
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+	}
 
 
 
 
 #ifdef BNX2X_STOP_ON_ERROR

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp, · line 658

Quoted 5 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -1
@@ -651,7 +655,7 @@ static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 			       struct sk_buff *skb)
 {
 #ifdef CONFIG_INET
-	if (fp->mode == TPA_MODE_GRO && skb_shinfo(skb)->gso_size) {
+	if (skb_shinfo(skb)->gso_size) {

This also seems like an incorrect removal, as TPA_MODE_LRO is (again) a feasible option, and we wouldn't want the a `gro_complete' here.

Quoted 4 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +0 -0
 		skb_set_network_header(skb, 0);
 		switch (be16_to_cpu(skb->protocol)) {
 		case ETH_P_IP:
#20 lore raw

Re: [PATCH net-next] bnx2x: fix GRO parameters

Quoted 9 lines · Yuval Mintz

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue, · line 457

Quoted 5 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +3 -2
-static u16 bnx2x_set_lro_mss(struct bnx2x *bp, u16 parsing_flags,
-			     u16 len_on_bd)
+static void bnx2x_set_gro_params(struct sk_buff *skb, struct bnx2x *bp,
+				 u16 parsing_flags, u16 len_on_bd,
+				 unsigned int pkt_len)

This is purely semantic, but our convention is for `struct bnx2x' to be the first argument in our functions.

Quoted 12 lines

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue, · line 463

Quoted 7 lines

{

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -1
 	/*
-	 * TPA arrgregation won't have either IP options or TCP options
+	 * TPA aggregation won't have either IP options or TCP options
 	 * other than timestamp or IPv6 extension headers.
 	 */
 	u16 hdrs_len = ETH_HLEN + sizeof(struct tcphdr);

TPA_MODE_LRO indicates that an LRO aggregation was made by our FW. It seems like your patch eliminates the difference in configuration between the two (GRO and LRO)

Thats the case, since you call GRO functions even if 'LRO ' is ON

I specifically had to remove the tests you guys do.

Quoted 9 lines

perhaps instead we should do something like:

+ static void bnx2x_set_lro_params(struct bnx2x *bp, struct sk_buff *skb,

(quoted diff) +3 -0
+ 				   u16 parsing_flags, u16 len_on_bd,
+ 				   unsigned int pkt_len,
+				   bnx2x_tpa_mode_t mode)

And arrange its suggested code so that only gso_size will be set for LRO.

I fail to understand why adding a conditional would change something.

Setting it is needed for GRO as well.

Quoted 16 lines
Quoted 13 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +5 -3
 	if (GET_FLAG(parsing_flags, PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) ==
-	    PRS_FLAG_OVERETH_IPV6)
+	    PRS_FLAG_OVERETH_IPV6) {
 		hdrs_len += sizeof(struct ipv6hdr);
-	else /* IPv4 */
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
+	} else {
 		hdrs_len += sizeof(struct iphdr);
-
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+	}
Quoted 11 lines

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp, · line 658

Quoted 7 lines

#ifdef BNX2X_STOP_ON_ERROR

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -1
@@ -651,7 +655,7 @@ static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 			       struct sk_buff *skb)
 {
 #ifdef CONFIG_INET
-	if (fp->mode == TPA_MODE_GRO && skb_shinfo(skb)->gso_size) {
+	if (skb_shinfo(skb)->gso_size) {

This also seems like an incorrect removal, as TPA_MODE_LRO is (again) a feasible option, and we wouldn't want the a `gro_complete' here.

Problem is : You call GRO functions, faking a GRO packet.

You must therefore exactly present same attributes in skb than after a true software GRO step.

I did my tests booting a standard driver, that is with LRO on.

#21 lore raw

Re: [PATCH net-next] bnx2x: fix GRO parameters

Quoted 33 lines
Quoted 9 lines

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue, · line 457

Quoted 5 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +3 -2
-static u16 bnx2x_set_lro_mss(struct bnx2x *bp, u16 parsing_flags,
-			     u16 len_on_bd)
+static void bnx2x_set_gro_params(struct sk_buff *skb, struct bnx2x *bp,
+				 u16 parsing_flags, u16 len_on_bd,
+				 unsigned int pkt_len)

This is purely semantic, but our convention is for `struct bnx2x' to be the first argument in our functions.

Quoted 12 lines

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue, · line 463

Quoted 7 lines

{

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -1
 	/*
-	 * TPA arrgregation won't have either IP options or TCP options
+	 * TPA aggregation won't have either IP options or TCP options
 	 * other than timestamp or IPv6 extension headers.
 	 */
 	u16 hdrs_len = ETH_HLEN + sizeof(struct tcphdr);

TPA_MODE_LRO indicates that an LRO aggregation was made by our FW. It seems like your patch eliminates the difference in configuration between the two (GRO and LRO)

Thats the case, since you call GRO functions even if 'LRO ' is ON

I specifically had to remove the tests you guys do.

Quoted 7 lines

perhaps instead we should do something like:

+ static void bnx2x_set_lro_params(struct bnx2x *bp, struct sk_buff *skb,

(quoted diff) +3 -0
+ 				   u16 parsing_flags, u16 len_on_bd,
+ 				   unsigned int pkt_len,
+				   bnx2x_tpa_mode_t mode)
Quoted 7 lines
Quoted 2 lines

And arrange its suggested code so that only gso_size will be set for LRO.

I fail to understand why adding a conditional would change something.

Setting it is needed for GRO as well.

I was a bit unclear - I meant the for LRO, only gso_size will be set (while for GRO it will be set as well as the additional GRO fields)

Quoted 29 lines
Quoted 16 lines
Quoted 13 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +5 -3
 	if (GET_FLAG(parsing_flags, PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) ==
-	    PRS_FLAG_OVERETH_IPV6)
+	    PRS_FLAG_OVERETH_IPV6) {
 		hdrs_len += sizeof(struct ipv6hdr);
-	else /* IPv4 */
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
+	} else {
 		hdrs_len += sizeof(struct iphdr);
-
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+	}
Quoted 11 lines

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp, · line 658

Quoted 7 lines

#ifdef BNX2X_STOP_ON_ERROR

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -1
@@ -651,7 +655,7 @@ static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 			       struct sk_buff *skb)
 {
 #ifdef CONFIG_INET
-	if (fp->mode == TPA_MODE_GRO && skb_shinfo(skb)->gso_size) {
+	if (skb_shinfo(skb)->gso_size) {

This also seems like an incorrect removal, as TPA_MODE_LRO is (again) a feasible option, and we wouldn't want the a `gro_complete' here.

Quoted 6 lines

Problem is : You call GRO functions, faking a GRO packet.

You must therefore exactly present same attributes in skb than after a true software GRO step.

I did my tests booting a standard driver, that is with LRO on.

I think we have a misunderstanding here - when LRO is on, our FW works in TPA_MODE_LRO (LRO/GRO FW are mutually exclusive). In that mode, the bnx2x driver will not try to 'fake' GRO packets in the same manner.

#22 lore raw

Re: [PATCH net-next] bnx2x: fix GRO parameters

Quoted 3 lines · Yuval Mintz

I think we have a misunderstanding here - when LRO is on, our FW works in TPA_MODE_LRO (LRO/GRO FW are mutually exclusive). In that mode, the bnx2x driver will not try to 'fake' GRO packets in the same manner.

I think you didn't really understand the issue then.

Call the hardware assist Receive Offload "LRO" if you really want, even if not using net/ipv4/inet_lro.c , but provide :

gso_segs and gso_type as well. (Its useful for various things, check netif_skb_features() for another example)

Or else we need to parse the headers again to check IPv4/ v6 / TCP / UDP later.

There is no downside providing gso_segs and gso_type, you have all needed information as shown in the patch I cooked and tested.

Our goal is to remove CONFIG_INET_LRO, so all multi-segments packets should have the same set of parameters (gso_size, gso_segs, gso_type)

#23 lore raw

Re: [PATCH net-next] bnx2x: fix GRO parameters

Quoted 5 lines

There is no downside providing gso_segs and gso_type, you have all needed information as shown in the patch I cooked and tested.

Our goal is to remove CONFIG_INET_LRO, so all multi-segments packets should have the same set of parameters (gso_size, gso_segs, gso_type)

I concur - I'll make the semantic modification to your patch and re-submit it later on today.

Thanks,
Yuval