Skip to contentSkip to conversation

bnx2x series

PATCH Superseded Dmitry Kravkov 5 participants 19 messages Nov 10, 2011 – Nov 13, 2011 1 message not in the archive

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#1 lore raw

PATCH 1/13 bnx2x: allow FCoE and DCB for 578xx

In reply to Dmitry Kravkov
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c  |    2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +1 -1
index 51bd748..5cba9d7 100644
@@ -923,7 +923,7 @@ static void bnx2x_dcbx_admin_mib_updated_params(struct bnx2x *bp,
 
 void bnx2x_dcbx_set_state(struct bnx2x *bp, bool dcb_on, u32 dcbx_enabled)
 {
-	if (!CHIP_IS_E1x(bp) && !CHIP_IS_E3(bp)) {
+	if (!CHIP_IS_E1x(bp)) {
 		bp->dcb_state = dcb_on;
 		bp->dcbx_enabled = dcbx_enabled;
 	} else {
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +2 -2
index 6486ab8..6f3a784 100644
@@ -10817,8 +10817,8 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
 	bp->qm_cid_count = bnx2x_set_qm_cid_count(bp);
 
 #ifdef BCM_CNIC
-	/* disable FCOE L2 queue for E1x and E3*/
-	if (CHIP_IS_E1x(bp) || CHIP_IS_E3(bp))
+	/* disable FCOE L2 queue for E1x */
+	if (CHIP_IS_E1x(bp))
 		bp->flags |= NO_FCOE_FLAG;
 
 #endif
Signature · 1 line
1.7.7.2
#0 lore raw

cover bnx2x series

Hello Dave,

The series includes re-enabling FCoE and DCB for 578xx devices, some improvements in licensing for cnic,
DCBX propagation in MF modes, handling of fan failures, removing napi struct from the stack, introduces pri_map module parameter and performs some code clean-ups.

Please consider applying the series to net-next.

Thanks
Dmitry

#2 lore raw

PATCH 2/13 bnx2x: use rx_queue index for skb_record_rx_queue()

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h      |    1 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c  |    2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h  |    1 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |    2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +1 -0
index aec7212..e17a739 100644
@@ -507,6 +507,7 @@ struct bnx2x_fastpath {
 	__le16			fp_hc_idx;
 
 	u8			index;		/* number in fp array */
+	u8			rx_queue;	/* index for skb_record */
 	u8			cl_id;		/* eth client id */
 	u8			cl_qzone_id;
 	u8			fw_sb_id;	/* status block number in FW */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -1
index 580b44e..1ace946 100644
@@ -755,7 +755,7 @@ reuse_rx:
 			}
 		}
 
-		skb_record_rx_queue(skb, fp->index);
+		skb_record_rx_queue(skb, fp->rx_queue);
 
 		if (le16_to_cpu(cqe_fp->pars_flags.flags) &
 		    PARSING_FLAGS_VLAN)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +1 -0
index 283d663..4a16757 100644
@@ -1318,6 +1318,7 @@ static inline void bnx2x_init_fcoe_fp(struct bnx2x *bp)
 	struct bnx2x_fastpath *fp = bnx2x_fcoe_fp(bp);
 	unsigned long q_type = 0;
 
+	bnx2x_fcoe(bp, rx_queue) = BNX2X_NUM_ETH_QUEUES(bp);
 	bnx2x_fcoe(bp, cl_id) = bnx2x_cnic_eth_cl_id(bp,
 						     BNX2X_FCOE_ETH_CL_ID_IDX);
 	/** Current BNX2X_FCOE_ETH_CID deffinition implies not more than
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +1 -1
index 6f3a784..1d185f2 100644
@@ -5247,7 +5247,7 @@ static void bnx2x_init_eth_fp(struct bnx2x *bp, int fp_idx)
 	u8 cos;
 	unsigned long q_type = 0;
 	u32 cids[BNX2X_MULTI_TX_COS] = { 0 };
-
+	fp->rx_queue = fp_idx;
 	fp->cid = fp_idx;
 	fp->cl_id = bnx2x_fp_cl_id(fp);
 	fp->fw_sb_id = bnx2x_fp_fw_sb_id(fp);
Signature · 1 line
1.7.7.2
#3 lore raw

PATCH 3/13 bnx2x: remove unused variable

In reply to Dmitry Kravkov
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -3
index 1ace946..f946a6e 100644
@@ -1094,13 +1094,11 @@ static void bnx2x_free_tx_skbs(struct bnx2x *bp)
 		for_each_cos_in_tx_queue(fp, cos) {
 			struct bnx2x_fp_txdata *txdata = &fp->txdata[cos];
 
-			u16 bd_cons = txdata->tx_bd_cons;
 			u16 sw_prod = txdata->tx_pkt_prod;
 			u16 sw_cons = txdata->tx_pkt_cons;
 
 			while (sw_cons != sw_prod) {
-				bd_cons = bnx2x_free_tx_pkt(bp, txdata,
-							    TX_BD(sw_cons));
+				bnx2x_free_tx_pkt(bp, txdata, TX_BD(sw_cons));
 				sw_cons++;
 			}
 		}
Signature · 1 line
1.7.7.2
#4 lore raw

PATCH 4/13 bnx2x: separate FCoE and iSCSI license initialization.

In reply to Dmitry Kravkov

FCoE license info must be initialized at probe(), but iSCSI at open().

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c  |    2 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h  |   10 +++++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   45 ++++++++++++++++-----
 3 files changed, 46 insertions(+), 11 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +2 -0
index f946a6e..3f80c11 100644
@@ -1934,6 +1934,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
 	mod_timer(&bp->timer, jiffies + bp->current_interval);
 
 #ifdef BCM_CNIC
+	/* re-read iscsi info */
+	bnx2x_get_iscsi_info(bp);
 	bnx2x_setup_cnic_irq_info(bp);
 	if (bp->state == BNX2X_STATE_OPEN)
 		bnx2x_cnic_notify(bp, CNIC_CTL_START_CMD);
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +10 -0
index 4a16757..c1d7833 100644
@@ -1489,4 +1489,14 @@ static inline u16 bnx2x_extract_max_cfg(struct bnx2x *bp, u32 mf_cfg)
 	return max_cfg;
 }
 
+#ifdef BCM_CNIC
+/**
+ * bnx2x_get_iscsi_info - update iSCSI params according to licensing info.
+ *
+ * @bp:		driver handle
+ *
+ */
+void bnx2x_get_iscsi_info(struct bnx2x *bp);
+#endif
+
 #endif /* BNX2X_CMN_H */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +34 -11

75 lines not on this page · raw message

Signature · 1 line
1.7.7.2
#5 lore raw

PATCH 5/13 bnx2x: propagate DCBX negotiation

In reply to Dmitry Kravkov

We need propagate the DCBX results from PMF to other functions on the same port, in order to properly update netdev structure and allow following new ETS and PFC configurations.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c  |    4 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h  |   54 ++++++++++++++++++++++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c  |   53 ++++++++++++---------
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   25 +---------
 4 files changed, 90 insertions(+), 46 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +3 -1
index 3f80c11..e9a91a3 100644
@@ -1927,7 +1927,9 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
 		break;
 	}
 
-	if (!bp->port.pmf)
+	if (bp->port.pmf)
+		bnx2x_update_drv_flags(bp, DRV_FLAGS_DCB_CONFIGURED, 0);
+	else
 		bnx2x__link_status_update(bp);
 
 	/* start the timer */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +54 -0

58 lines not on this page · raw message

drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +30 -23

91 lines not on this page · raw message

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +3 -22
index 26dc539..967c41b 100644
@@ -2318,12 +2318,6 @@ static void bnx2x_calc_vn_weight_sum(struct bnx2x *bp)
 					CMNG_FLAGS_PER_PORT_FAIRNESS_VN;
 }
 
-/* returns func by VN for current port */
-static inline int func_by_vn(struct bnx2x *bp, int vn)
-{
-	return 2 * vn + BP_PORT(bp);
-}
-
 static void bnx2x_init_vn_minmax(struct bnx2x *bp, int vn)
 {
 	struct rate_shaping_vars_per_vn m_rs_vn;
@@ -2475,22 +2469,6 @@ static void bnx2x_cmng_fns_init(struct bnx2x *bp, u8 read_cfg, u8 cmng_type)
 	   "rate shaping and fairness are disabled\n");
 }
 
-static inline void bnx2x_link_sync_notify(struct bnx2x *bp)
-{
-	int func;
-	int vn;
-
-	/* Set the attention towards other drivers on the same port */
-	for (vn = VN_0; vn < BP_MAX_VN_NUM(bp); vn++) {
-		if (vn == BP_VN(bp))
-			continue;
-
-		func = func_by_vn(bp, vn);
-		REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_0 +
-		       (LINK_SYNC_ATTENTION_BIT_FUNC_0 + func)*4, 1);
-	}
-}
-
 /* This function is called upon link interrupt */
 static void bnx2x_link_attn(struct bnx2x *bp)
 {
@@ -2549,6 +2527,9 @@ void bnx2x__link_status_update(struct bnx2x *bp)
 	if (bp->state != BNX2X_STATE_OPEN)
 		return;
 
+	/* read updated dcb configuration */
+	bnx2x_dcbx_pmf_update(bp);
+
 	bnx2x_link_status_update(&bp->link_params, &bp->link_vars);
 
 	if (bp->link_vars.link_up)
Signature · 1 line
1.7.7.2
#7 lore raw

PATCH 7/13 bnx2x: simplify definition of RX_SGE_MASK_LEN and use it.

In reply to Dmitry Kravkov
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h     |    3 +--
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +1 -2
index e17a739..b78c384 100644
@@ -411,8 +411,7 @@ union db_prod {
 
 
 /* Number of u64 elements in SGE mask array */
-#define RX_SGE_MASK_LEN			((NUM_RX_SGE_PAGES * RX_SGE_CNT) / \
-					 BIT_VEC64_ELEM_SZ)
+#define RX_SGE_MASK_LEN			(NUM_RX_SGE / BIT_VEC64_ELEM_SZ)
 #define RX_SGE_MASK_LEN_MASK		(RX_SGE_MASK_LEN - 1)
 #define NEXT_SGE_MASK_ELEM(el)		(((el) + 1) & RX_SGE_MASK_LEN_MASK)
 
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +1 -2
index 59f1291..e8efb01 100644
@@ -874,8 +874,7 @@ static inline void bnx2x_clear_sge_mask_next_elems(struct bnx2x_fastpath *fp)
 static inline void bnx2x_init_sge_ring_bit_mask(struct bnx2x_fastpath *fp)
 {
 	/* Set the mask to all 1-s: it's faster to compare to 0 than to 0xf-s */
-	memset(fp->sge_mask, 0xff,
-	       (NUM_RX_SGE >> BIT_VEC64_ELEM_SHIFT)*sizeof(u64));
+	memset(fp->sge_mask, 0xff, RX_SGE_MASK_LEN * sizeof(u64));
 
 	/* Clear the two last indices in the page to 1:
 	   these are the indices that correspond to the "next" element,
Signature · 1 line
1.7.7.2
#6 lore raw

PATCH 6/13 bnx2x: DCBX: use #define instead of magic

In reply to Dmitry Kravkov
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c |    6 +++---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h |    4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +3 -3
index a0598fd..5051cf3 100644
@@ -874,7 +874,7 @@ static void bnx2x_dcbx_admin_mib_updated_params(struct bnx2x *bp,
 		/*For IEEE admin_recommendation_bw_precentage
 		 *For IEEE admin_recommendation_ets_pg */
 		af->pfc.pri_en_bitmap = (u8)dp->admin_pfc_bitmap;
-		for (i = 0; i < 4; i++) {
+		for (i = 0; i < DCBX_CONFIG_MAX_APP_PROTOCOL; i++) {
 			if (dp->admin_priority_app_table[i].valid) {
 				struct bnx2x_admin_priority_app_table *table =
 					dp->admin_priority_app_table;
@@ -2249,7 +2249,7 @@ static int bnx2x_set_admin_app_up(struct bnx2x *bp, u8 idtype, u16 idval, u8 up)
 	int i, ff;
 
 	/* iterate over the app entries looking for idtype and idval */
-	for (i = 0, ff = -1; i < 4; i++) {
+	for (i = 0, ff = -1; i < DCBX_CONFIG_MAX_APP_PROTOCOL; i++) {
 		struct bnx2x_admin_priority_app_table *app_ent =
 			&bp->dcbx_config_params.admin_priority_app_table[i];
 		if (bnx2x_admin_app_is_equal(app_ent, idtype, idval))
@@ -2258,7 +2258,7 @@ static int bnx2x_set_admin_app_up(struct bnx2x *bp, u8 idtype, u16 idval, u8 up)
 		if (ff < 0 && !app_ent->valid)
 			ff = i;
 	}
-	if (i < 4)
+	if (i < DCBX_CONFIG_MAX_APP_PROTOCOL)
 		/* if found overwrite up */
 		bp->dcbx_config_params.
 			admin_priority_app_table[i].priority = up;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.h +3 -1
index 2c6a3bc..2ab9254 100644
@@ -90,6 +90,7 @@ struct bnx2x_admin_priority_app_table {
 		u32 app_id;
 };
 
+#define DCBX_CONFIG_MAX_APP_PROTOCOL 4
 struct bnx2x_config_dcbx_params {
 	u32 overwrite_settings;
 	u32 admin_dcbx_version;
@@ -109,7 +110,8 @@ struct bnx2x_config_dcbx_params {
 	u32 admin_recommendation_bw_precentage[8];
 	u32 admin_recommendation_ets_pg[8];
 	u32 admin_pfc_bitmap;
-	struct bnx2x_admin_priority_app_table admin_priority_app_table[4];
+	struct bnx2x_admin_priority_app_table
+		admin_priority_app_table[DCBX_CONFIG_MAX_APP_PROTOCOL];
 	u32 admin_default_priority;
 };
 
Signature · 1 line
1.7.7.2
#8 lore raw

PATCH 8/13 bnx2x: remove unused #define

In reply to Dmitry Kravkov
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +0 -7
index b78c384..23e91f4 100644
@@ -1984,13 +1984,6 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
 #define HW_PRTY_ASSERT_SET_4 (AEU_INPUTS_ATTN_BITS_PGLUE_PARITY_ERROR | \
 			      AEU_INPUTS_ATTN_BITS_ATC_PARITY_ERROR)
 
-#define RSS_FLAGS(bp) \
-		(TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY | \
-		 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY | \
-		 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY | \
-		 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY | \
-		 (bp->multi_mode << \
-		  TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT))
 #define MULTI_MASK			0x7f
 
 
Signature · 1 line
1.7.7.2
#9 lore raw

PATCH 9/13 bnx2x: add pri_map module parameter

In reply to Dmitry Kravkov

From: Ariel Elior <[email protected]>

The optional parameter pri_map is used to map the skb->priority to a Class Of Service (CoS) in the HW. This 32 bit parameter is evaluated by the driver as 8 values of 4 bits each. Each nibble sets the desired HW queue number for that priority.

Also:
on the 5771x family this feature is unavailable (a single COS services all). on the 57712 family two classes of service are available.
on the 578xx family three classes of service are availabe. configuring priorities to unavailable COSs will log an error and default to COS 0.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   26 ++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +26 -0
index 967c41b..5b44b85 100644
@@ -92,6 +92,10 @@ MODULE_FIRMWARE(FW_FILE_NAME_E1);
 MODULE_FIRMWARE(FW_FILE_NAME_E1H);
 MODULE_FIRMWARE(FW_FILE_NAME_E2);
 
+static uint pri_map;
+module_param(pri_map, uint, 0);
+MODULE_PARM_DESC(pri_map, " Priority to HW queue mapping");
+
 static int multi_mode = 1;
 module_param(multi_mode, int, 0);
 MODULE_PARM_DESC(multi_mode, " Multi queue mode "
@@ -9682,6 +9686,25 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp)
 	return rc;
 }
 
+static void bnx2x_init_multi_cos(struct bnx2x *bp)
+{
+	int pri, cos;
+	for (pri = 0; pri < BNX2X_MAX_PRIORITY; pri++) {
+		cos = ((pri_map & (0xf << pri*4)) >> pri*4);
+		if (cos < bp->max_cos) {
+			bp->prio_to_cos[pri] = cos;
+			DP(BNX2X_MSG_SP, "configuring priority %d to cos %d",
+			   pri, cos);
+		} else {
+			netdev_err(bp->dev,
+			       "Illegal COS (%d) for priority %d "
+			       "Max COS allowed is %d "
+			       "defaulting to 0\n", cos, pri, bp->max_cos - 1);
+			bp->prio_to_cos[pri] = 0;
+		}
+	}
+}
+
 static void __devinit bnx2x_read_fwinfo(struct bnx2x *bp)
 {
 	int cnt, i, block_end, rodi;
@@ -10832,6 +10855,9 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
 	 */
 	bnx2x_set_int_mode(bp);
 
+	/* configure priority to cos map according to pri_map module param */
+	bnx2x_init_multi_cos(bp);
+
 	/* Add all NAPI objects */
 	bnx2x_add_all_napi(bp);
 
Signature · 1 line
1.7.7.2
#16 lore raw

PATCH 10/13 bnx2x: add fan failure event handling

In reply to Dmitry Kravkov

From: Ariel Elior <[email protected]>

Shut down the device in case of fan failure to prevent HW damage.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h      |    3 ++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   24 +++++++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +3 -0
index 23e91f4..78613ef 100644
@@ -1141,6 +1141,7 @@ struct bnx2x_fw_stats_data {
 enum {
 	BNX2X_SP_RTNL_SETUP_TC,
 	BNX2X_SP_RTNL_TX_TIMEOUT,
+	BNX2X_SP_RTNL_FAN_FAILURE,
 };
 
 
@@ -2048,6 +2049,8 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
 #define BNX2X_VPD_LEN			128
 #define VENDOR_ID_LEN			4
 
+int bnx2x_close(struct net_device *dev);
+
 /* Congestion management fairness mode */
 #define CMNG_FNS_NONE		0
 #define CMNG_FNS_MINMAX		1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +23 -1
index 5b44b85..1f65391 100644
@@ -3303,6 +3303,17 @@ static inline void bnx2x_fan_failure(struct bnx2x *bp)
 	netdev_err(bp->dev, "Fan Failure on Network Controller has caused"
 	       " the driver to shutdown the card to prevent permanent"
 	       " damage.  Please contact OEM Support for assistance\n");
+
+	/*
+	 * Scheudle device reset (unload)
+	 * This is due to some boards consuming sufficient power when driver is
+	 * up to overheat if fan fails.
+	 */
+	smp_mb__before_clear_bit();
+	set_bit(BNX2X_SP_RTNL_FAN_FAILURE, &bp->sp_rtnl_state);
+	smp_mb__after_clear_bit();
+	schedule_delayed_work(&bp->sp_rtnl_task, 0);
+
 }
 
 static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn)
@@ -8507,6 +8518,17 @@ sp_rtnl_not_reset:
 	if (test_and_clear_bit(BNX2X_SP_RTNL_SETUP_TC, &bp->sp_rtnl_state))
 		bnx2x_setup_tc(bp->dev, bp->dcbx_port_params.ets.num_of_cos);
 
+	/*
+	 * in case of fan failure we need to reset id if the "stop on error"
+	 * debug flag is set, since we trying to prevent permanent overheating
+	 * damage
+	 */
+	if (test_and_clear_bit(BNX2X_SP_RTNL_FAN_FAILURE, &bp->sp_rtnl_state)) {
+		DP(BNX2X_MSG_SP, "fan failure detected. Unloading driver");
+		netif_device_detach(bp->dev);
+		bnx2x_close(bp->dev);
+	}
+
 sp_rtnl_exit:
 	rtnl_unlock();
 }
@@ -9992,7 +10014,7 @@ static int bnx2x_open(struct net_device *dev)
 }
 
 /* called with rtnl_lock */
-static int bnx2x_close(struct net_device *dev)
+int bnx2x_close(struct net_device *dev)
 {
 	struct bnx2x *bp = netdev_priv(dev);
 
Signature · 1 line
1.7.7.2
#17 lore raw

PATCH 11/13 bnx2x: prevent race in statistics flow

In reply to Dmitry Kravkov

The race may cause access of registers while MAC hw block is in reset state. As a result syslog will show error messages. We can prevent this by using state from local variable.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c +3 -1
index 02ac6a7..3034f0e 100644
@@ -1349,12 +1349,14 @@ void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event)
 	enum bnx2x_stats_state state;
 	if (unlikely(bp->panic))
 		return;
-	bnx2x_stats_stm[bp->stats_state][event].action(bp);
+
 	spin_lock_bh(&bp->stats_lock);
 	state = bp->stats_state;
 	bp->stats_state = bnx2x_stats_stm[state][event].next_state;
 	spin_unlock_bh(&bp->stats_lock);
 
+	bnx2x_stats_stm[state][event].action(bp);
+
 	if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp))
 		DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n",
 		   state, event, bp->stats_state);
Signature · 1 line
1.7.7.2
#18 lore raw

PATCH 12/13 bnx2x: Remove on-stack napi struct variable

In reply to Dmitry Kravkov

From: Ariel Elior <[email protected]>

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +7 -5
index e9a91a3..13dad92 100644
@@ -79,19 +79,21 @@ static inline void bnx2x_bz_fp(struct bnx2x *bp, int index)
  * @to:		destination FP index
  *
  * Makes sure the contents of the bp->fp[to].napi is kept
- * intact.
+ * intact. This is done by first copying the napi struct from
+ * the target to the source, and then mem copying the entire
+ * source onto the target
  */
 static inline void bnx2x_move_fp(struct bnx2x *bp, int from, int to)
 {
 	struct bnx2x_fastpath *from_fp = &bp->fp[from];
 	struct bnx2x_fastpath *to_fp = &bp->fp[to];
-	struct napi_struct orig_napi = to_fp->napi;
+
+	/* Copy the NAPI object as it has been already initialized */
+	from_fp->napi = to_fp->napi;
+
 	/* Move bnx2x_fastpath contents */
 	memcpy(to_fp, from_fp, sizeof(*to_fp));
 	to_fp->index = to;
-
-	/* Restore the NAPI object as it has been already initialized */
-	to_fp->napi = orig_napi;
 }
 
 int load_count[2][3] = { {0} }; /* per-path: 0-common, 1-port0, 2-port1 */
Signature · 1 line
1.7.7.2
#19 lore raw

PATCH 13/13 bnx2x: update driver version to 1.70.35-0

In reply to Dmitry Kravkov
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +2 -2
index 78613ef..4b90b51 100644
@@ -23,8 +23,8 @@
  * (you will need to reboot afterwards) */
 /* #define BNX2X_STOP_ON_ERROR */
 
-#define DRV_MODULE_VERSION      "1.70.30-0"
-#define DRV_MODULE_RELDATE      "2011/10/25"
+#define DRV_MODULE_VERSION      "1.70.35-0"
+#define DRV_MODULE_RELDATE      "2011/11/10"
 #define BNX2X_BC_VER            0x040200
 
 #if defined(CONFIG_DCB)
Signature · 1 line
1.7.7.2
#10 lore raw

Re: [PATCH net-next 09/13] bnx2x: add pri_map module parameter

In reply to Dmitry Kravkov
Quoted 7 lines · Dmitry Kravkov

From: Ariel Elior <[email protected]>

The optional parameter pri_map is used to map the skb->priority to a Class Of Service (CoS) in the HW. This 32 bit parameter is evaluated by the driver as 8 values of 4 bits each. Each nibble sets the desired HW queue number for that priority.

[...]

You should implement ndo_tc_setup instead of adding a driver-specific parameter (that should be per-device anyway).

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#12 lore raw

Re: [PATCH net-next 09/13] bnx2x: add pri_map module parameter

In reply to a message not in the archive

Resending for netdev

Quoted 20 lines · Dmitry Kravkov
Quoted 9 lines · Ben Hutchings
Quoted 7 lines · Dmitry Kravkov

From: Ariel Elior <[email protected]>

The optional parameter pri_map is used to map the skb->priority to a Class Of Service (CoS) in the HW. This 32 bit parameter is evaluated by the  driver as 8 values of 4 bits each. Each nibble sets the desired HW queue number for that priority.

Quoted 4 lines

[...]

You should implement ndo_tc_setup instead of adding a driver-specific parameter (that should be per-device anyway).

bnx2x has ndo_setup_tc, but the callback configures device for number of traffic only, when actual mapping of priority to cos is done according to DCB negotiation. The parameter allow user to force mapping if the link partner is not DCB capable.

#13 lore raw

Re: [PATCH net-next 09/13] bnx2x: add pri_map module parameter

Quoted 15 lines · Dmitry Kravkov

Resending for netdev

Quoted 13 lines · Dmitry Kravkov
Quoted 11 lines · Ben Hutchings
Quoted 7 lines · Dmitry Kravkov

From: Ariel Elior <[email protected]>

The optional parameter pri_map is used to map the skb->priority to a Class Of Service (CoS) in the HW. This 32 bit parameter is evaluated by the driver as 8 values of 4 bits each. Each nibble sets the desired HW queue number for that priority.

[...]

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

You should implement ndo_tc_setup instead of adding a driver-specific parameter (that should be per-device anyway).

bnx2x has ndo_setup_tc, but the callback configures device for number of traffic only, when actual mapping of priority to cos is done according to DCB negotiation. The parameter allow user to force mapping if the link partner is not DCB capable.

--

Use 'tc' to configure the mapping explicitly then. Or allow DCBnl set commands to be sent down either ieee_setets() or setpgtccfgtx() are used to configure priority to traffic class mappings. Then you could use a user space tool to set up all your DCB attributes without DCBX running (e.g. dcbtool/lldptol but I'm partial).

For example 'tc' commands,

# tc qdisc add dev eth3 root mqprio map 0 1 2 3 
# tc qdisc add dev eth3 root mqprio help
Usage: ... mqprio [num_tc NUMBER] [map P0 P1 ...]
                  [queues count1@offset1 count2@offset2 ...] [hw 1|0]

It might be nice to add the ability to change the mapping after the tc has been created though. Maybe I'll get to this in the next week or two.

John.

maintainer
#15 lore raw

Re: [PATCH net-next 09/13] bnx2x: add pri_map module parameter

In reply to Dmitry Kravkov

From: "Dmitry Kravkov" <[email protected]>
Date: Thu, 10 Nov 2011 17:14:10 +0200

Quoted 15 lines

From: Ariel Elior <[email protected]>

The optional parameter pri_map is used to map the skb->priority to a Class Of Service (CoS) in the HW. This 32 bit parameter is evaluated by the driver as 8 values of 4 bits each. Each nibble sets the desired HW queue number for that priority.

Also:
on the 5771x family this feature is unavailable (a single COS services all). on the 57712 family two classes of service are available.
on the 578xx family three classes of service are availabe. configuring priorities to unavailable COSs will log an error and default to COS 0.

Quoted 2 lines

You can't do driver specific things like this.

Make a generic facility that any driver can make use of, not just your's.

#14 lore raw

Re: [PATCH net-next 09/13] bnx2x: add pri_map module parameter

In reply to John Fastabend
Quoted 8 lines · John Fastabend

Use 'tc' to configure the mapping explicitly then. Or allow DCBnl set commands to be sent down either ieee_setets() or setpgtccfgtx() are used to configure priority to traffic class mappings. Then you could use a user space tool to set up all your DCB attributes without DCBX running (e.g. dcbtool/lldptol but I'm partial).

For example 'tc' commands,

Quoted 9 lines
# tc qdisc add dev eth3 root mqprio map 0 1 2 3 
# tc qdisc add dev eth3 root mqprio help
Usage: ... mqprio [num_tc NUMBER] [map P0 P1 ...]
                  [queues count1@offset1 count2@offset2 ...] [hw 1|0]

It might be nice to add the ability to change the mapping after the tc has been created though. Maybe I'll get to this in the next week or two.

John, thanks for the clarification and the example.

Dave, i will re-spin the sequence without the patch, soon.

Thanks all,
Dmitry