Skip to contentSkip to conversation

bnx2x: ethtool and other enhancements

PATCH Superseded Merav Sicron 5 participants 28 messages Jun 13, 2012 – Jun 17, 2012

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover bnx2x: ethtool and other enhancements

Hi Dave,

This patch series adds few features to bnx2x:
Add support for external LB in ethtool self-test
Enable UDP RSS on 4-tupple, controlled by ethtool
Support up to 63 RSS queues (rather than 16)
Add support for setting the desired number of RSS queues via ethtool Allow to configure dcbx admin params from all drivers on a single physical port Add FCoE capabilities advertisement

Please consider applying this patch series to net-next.

Thanks,
Merav

#1 lore raw

PATCH 1/12 bnx2x: Add support for external LB

This change enables to do self-test with external loopback via ethtool.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h        |    5 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c    |    4 +-
 .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c    |   76 ++++++++++++++++++--
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c   |    7 +-
 4 files changed, 82 insertions(+), 10 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +4 -1
index e30e2a2..fb6de4a 100644
@@ -1832,6 +1832,7 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
 #define LOAD_NORMAL			0
 #define LOAD_OPEN			1
 #define LOAD_DIAG			2
+#define LOAD_LOOPBACK_EXT		3
 #define UNLOAD_NORMAL			0
 #define UNLOAD_CLOSE			1
 #define UNLOAD_RECOVERY			2
@@ -1915,12 +1916,14 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
 #define PCICFG_LINK_SPEED_SHIFT		16
 
 
-#define BNX2X_NUM_TESTS			7
+#define BNX2X_NUM_TESTS			8
 
 #define BNX2X_PHY_LOOPBACK		0
 #define BNX2X_MAC_LOOPBACK		1
+#define BNX2X_EXT_LOOPBACK		2
 #define BNX2X_PHY_LOOPBACK_FAILED	1
 #define BNX2X_MAC_LOOPBACK_FAILED	2
+#define BNX2X_EXT_LOOPBACK_FAILED	3
 #define BNX2X_LOOPBACK_FAILED		(BNX2X_MAC_LOOPBACK_FAILED | \
 					 BNX2X_PHY_LOOPBACK_FAILED)
 
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +3 -1
index ad0743b..09fcc55 100644
@@ -2161,6 +2161,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
 		break;
 
 	case LOAD_DIAG:
+	case LOAD_LOOPBACK_EXT:
 		bp->state = BNX2X_STATE_DIAG;
 		break;
 
@@ -2200,7 +2201,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
 		return -EBUSY;
 	}
 
-	bnx2x_dcbx_init(bp);
+	if (bp->state != BNX2X_STATE_DIAG)
+		bnx2x_dcbx_init(bp);
 	return 0;
 
 #ifndef BNX2X_STOP_ON_ERROR
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +69 -7

139 lines not on this page · raw message

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +6 -1
index a622bb7..21930be 100644
@@ -2124,7 +2124,12 @@ u8 bnx2x_initial_phy_init(struct bnx2x *bp, int load_mode)
 			}
 		}
 
-		rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars);
+	if (load_mode == LOAD_LOOPBACK_EXT) {
+		struct link_params *lp = &bp->link_params;
+		lp->loopback_mode = LOOPBACK_EXT;
+	}
+
+	rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars);
 
 		bnx2x_release_phy_lock(bp);
 
Signature · 1 line
1.7.10
#3 lore raw

PATCH 2/12 bnx2x: Return only online tests for MF

In reply to Merav Sicron

1. In multi-function device, show only the online tests in self-test results as only these test are performed (offline tests cannot be performed as they may corrupt the traffic of other functions on the same physical port). Note that multi-function mode cannot change while the driver is up.
2. Check result code in NIC load and act accordingly.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h        |    6 +-
 .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c    |   85 +++++++++++++-------
 2 files changed, 62 insertions(+), 29 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +4 -2
index fb6de4a..568c3c7 100644
@@ -1915,8 +1915,10 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
 #define PCICFG_LINK_SPEED		0xf0000
 #define PCICFG_LINK_SPEED_SHIFT		16
 
-
-#define BNX2X_NUM_TESTS			8
+#define BNX2X_NUM_TESTS_SF		7
+#define BNX2X_NUM_TESTS_MF		3
+#define BNX2X_NUM_TESTS(bp)		(IS_MF(bp) ? BNX2X_NUM_TESTS_MF : \
+						     BNX2X_NUM_TESTS_SF)
 
 #define BNX2X_PHY_LOOPBACK		0
 #define BNX2X_MAC_LOOPBACK		1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +58 -27

155 lines not on this page · raw message

Signature · 1 line
1.7.10
#4 lore raw

PATCH 3/12 bnx2x: Add support for 4-tupple UDP RSS

In reply to Merav Sicron

This change enables to control via ethtool whether to do UDP RSS on 2-tupple (IP source / destination only) or on 4-tupple (include UDP source / destination port). It also enables to read back the RSS configuration.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c    |   16 ++-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h    |    8 +-
 .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c    |  147 +++++++++++++++++++-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c     |    8 ++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h     |    6 +
 5 files changed, 170 insertions(+), 15 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +9 -7
index 09fcc55..5648078 100644
@@ -1651,14 +1651,13 @@ static void bnx2x_set_rx_buf_size(struct bnx2x *bp)
 static int bnx2x_init_rss_pf(struct bnx2x *bp)
 {
 	int i;
-	u8 ind_table[T_ETH_INDIRECTION_TABLE_SIZE] = {0};
 	u8 num_eth_queues = BNX2X_NUM_ETH_QUEUES(bp);
 
 	/* Prepare the initial contents fo the indirection table if RSS is
 	 * enabled
 	 */
-	for (i = 0; i < sizeof(ind_table); i++)
-		ind_table[i] =
+	for (i = 0; i < sizeof(bp->rss_conf_obj.ind_table); i++)
+		bp->rss_conf_obj.ind_table[i] =
 			bp->fp->cl_id +
 			ethtool_rxfh_indir_default(i, num_eth_queues);
 
@@ -1670,12 +1669,11 @@ static int bnx2x_init_rss_pf(struct bnx2x *bp)
 	 * For 57712 and newer on the other hand it's a per-function
 	 * configuration.
 	 */
-	return bnx2x_config_rss_eth(bp, ind_table,
-				    bp->port.pmf || !CHIP_IS_E1x(bp));
+	return bnx2x_config_rss_eth(bp, bp->port.pmf || !CHIP_IS_E1x(bp));
 }
 
 int bnx2x_config_rss_pf(struct bnx2x *bp, struct bnx2x_rss_config_obj *rss_obj,
-			u8 *ind_table, bool config_hash)
+			bool config_hash)
 {
 	struct bnx2x_config_rss_params params = {NULL};
 	int i;
@@ -1698,11 +1696,15 @@ int bnx2x_config_rss_pf(struct bnx2x *bp, struct bnx2x_rss_config_obj *rss_obj,
 	__set_bit(BNX2X_RSS_IPV4_TCP, &params.rss_flags);
 	__set_bit(BNX2X_RSS_IPV6, &params.rss_flags);
 	__set_bit(BNX2X_RSS_IPV6_TCP, &params.rss_flags);
+	if (rss_obj->udp_rss_v4)
+		__set_bit(BNX2X_RSS_IPV4_UDP, &params.rss_flags);
+	if (rss_obj->udp_rss_v6)
+		__set_bit(BNX2X_RSS_IPV6_UDP, &params.rss_flags);
 
 	/* Hash bits */
 	params.rss_result_mask = MULTI_MASK;
 
-	memcpy(params.ind_table, ind_table, sizeof(params.ind_table));
+	memcpy(params.ind_table, rss_obj->ind_table, sizeof(params.ind_table));
 
 	if (config_hash) {
 		/* RSS keys */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +3 -5
index 7cd99b7..bb47984 100644
@@ -94,7 +94,7 @@ void bnx2x_send_unload_done(struct bnx2x *bp);
  * @config_hash:	re-configure RSS hash keys configuration
  */
 int bnx2x_config_rss_pf(struct bnx2x *bp, struct bnx2x_rss_config_obj *rss_obj,
-			u8 *ind_table, bool config_hash);
+			bool config_hash);
 
 /**
  * bnx2x__init_func_obj - init function object
@@ -865,11 +865,9 @@ static inline int func_by_vn(struct bnx2x *bp, int vn)
 	return 2 * vn + BP_PORT(bp);
 }
 
-static inline int bnx2x_config_rss_eth(struct bnx2x *bp, u8 *ind_table,
-				       bool config_hash)
+static inline int bnx2x_config_rss_eth(struct bnx2x *bp, bool config_hash)
 {
-	return bnx2x_config_rss_pf(bp, &bp->rss_conf_obj, ind_table,
-				   config_hash);
+	return bnx2x_config_rss_pf(bp, &bp->rss_conf_obj, config_hash);
 }
 
 /**
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +144 -3

180 lines not on this page · raw message

drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +8 -0
index 6c14b4a..734fd87 100644
@@ -4107,6 +4107,10 @@ static int bnx2x_setup_rss(struct bnx2x *bp,
 		data->capabilities |=
 			ETH_RSS_UPDATE_RAMROD_DATA_IPV4_TCP_CAPABILITY;
 
+	if (test_bit(BNX2X_RSS_IPV4_UDP, &p->rss_flags))
+		data->capabilities |=
+			ETH_RSS_UPDATE_RAMROD_DATA_IPV4_UDP_CAPABILITY;
+
 	if (test_bit(BNX2X_RSS_IPV6, &p->rss_flags))
 		data->capabilities |=
 			ETH_RSS_UPDATE_RAMROD_DATA_IPV6_CAPABILITY;
@@ -4115,6 +4119,10 @@ static int bnx2x_setup_rss(struct bnx2x *bp,
 		data->capabilities |=
 			ETH_RSS_UPDATE_RAMROD_DATA_IPV6_TCP_CAPABILITY;
 
+	if (test_bit(BNX2X_RSS_IPV6_UDP, &p->rss_flags))
+		data->capabilities |=
+			ETH_RSS_UPDATE_RAMROD_DATA_IPV6_UDP_CAPABILITY;
+
 	/* Hashing mask */
 	data->rss_result_mask = p->rss_result_mask;
 
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h +6 -0
index efd80bd..76818ef 100644
@@ -694,8 +694,10 @@ enum {
 
 	BNX2X_RSS_IPV4,
 	BNX2X_RSS_IPV4_TCP,
+	BNX2X_RSS_IPV4_UDP,
 	BNX2X_RSS_IPV6,
 	BNX2X_RSS_IPV6_TCP,
+	BNX2X_RSS_IPV6_UDP,
 };
 
 struct bnx2x_config_rss_params {
@@ -729,6 +731,10 @@ struct bnx2x_rss_config_obj {
 	/* Last configured indirection table */
 	u8			ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
 
+	/* flags for enabling 4-tupple hash on UDP */
+	u8			udp_rss_v4;
+	u8			udp_rss_v6;
+
 	int (*config_rss)(struct bnx2x *bp,
 			  struct bnx2x_config_rss_params *p);
 };
Signature · 1 line
1.7.10
#6 lore raw

PATCH 4/12 bnx2x: Allow more than 64 L2 CIDs

In reply to Merav Sicron

With increased number of RSS queues, each multiplied by the number of traffic- classes, we may have up to 64*3=192 CIDs. The current driver scheme with regard to context allocation supports only 64 CIDs. The new scheme enables scatter- gatehr list of pages for the context.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h      |   10 +++-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   67 ++++++++++++++++------
 2 files changed, 57 insertions(+), 20 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +7 -3
index 568c3c7..feec032 100644
@@ -993,8 +993,8 @@ union cdu_context {
 };
 
 /* CDU host DB constants */
-#define CDU_ILT_PAGE_SZ_HW	3
-#define CDU_ILT_PAGE_SZ		(8192 << CDU_ILT_PAGE_SZ_HW) /* 64K */
+#define CDU_ILT_PAGE_SZ_HW	2
+#define CDU_ILT_PAGE_SZ		(8192 << CDU_ILT_PAGE_SZ_HW) /* 32K */
 #define ILT_PAGE_CIDS		(CDU_ILT_PAGE_SZ / sizeof(union cdu_context))
 
 #ifdef BCM_CNIC
@@ -1435,7 +1435,11 @@ struct bnx2x {
 	dma_addr_t			fw_stats_data_mapping;
 	int				fw_stats_data_sz;
 
-	struct hw_context	context;
+	/* For max 196 cids (64*3 + non-eth), 32KB ILT page size and 1KB
+	 * context size we need 8 ILT entries.
+	 */
+#define ILT_MAX_L2_LINES	8
+	struct hw_context	context[ILT_MAX_L2_LINES];
 
 	struct bnx2x_ilt	*ilt;
 #define BP_ILT(bp)		((bp)->ilt)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +50 -17

125 lines not on this page · raw message

Signature · 1 line
1.7.10
#9 lore raw

PATCH 7/12 bnx2x: Split the FP structure

In reply to Merav Sicron

From: Barak Witkowski <[email protected]>

This patch moves some fields out of the FP structure to different structures, in order to minimize size of contigiuous memory allocated.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h        |   41 +++++----
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c    |   87 +++++++++++++++-----
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h    |    8 +-
 .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c    |    4 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c   |   37 +++++----
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c  |   55 ++++++++-----
 6 files changed, 149 insertions(+), 83 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +25 -16
index 68d0d2c..60a72f5 100644
@@ -549,34 +549,23 @@ struct bnx2x_fastpath {
 				rx_calls;
 
 	/* TPA related */
-	struct bnx2x_agg_info	tpa_info[ETH_MAX_AGGREGATION_QUEUES_E1H_E2];
+	struct bnx2x_agg_info	*tpa_info;
 	u8			disable_tpa;
 #ifdef BNX2X_STOP_ON_ERROR
 	u64			tpa_queue_used;
 #endif
-
-	struct tstorm_per_queue_stats old_tclient;
-	struct ustorm_per_queue_stats old_uclient;
-	struct xstorm_per_queue_stats old_xclient;
-	struct bnx2x_eth_q_stats eth_q_stats;
-	struct bnx2x_eth_q_stats_old eth_q_stats_old;
-
 	/* The size is calculated using the following:
 	     sizeof name field from netdev structure +
 	     4 ('-Xx-' string) +
 	     4 (for the digits and to make it DWORD aligned) */
 #define FP_NAME_SIZE		(sizeof(((struct net_device *)0)->name) + 8)
 	char			name[FP_NAME_SIZE];
-
-	/* MACs object */
-	struct bnx2x_vlan_mac_obj mac_obj;
-
-	/* Queue State object */
-	struct bnx2x_queue_sp_obj q_obj;
-
 };
 
-#define bnx2x_fp(bp, nr, var)		(bp->fp[nr].var)
+#define bnx2x_fp(bp, nr, var)	((bp)->fp[(nr)].var)
+#define bnx2x_sp_obj(bp, fp)	((bp)->sp_objs[(fp)->index])
+#define bnx2x_fp_stats(bp, fp)	(&((bp)->fp_stats[(fp)->index]))
+#define bnx2x_fp_qstats(bp, fp)	(&((bp)->fp_stats[(fp)->index].eth_q_stats))
 
 /* Use 2500 as a mini-jumbo MTU for FCoE */
 #define BNX2X_FCOE_MINI_JUMBO_MTU	2500
@@ -587,6 +576,8 @@ struct bnx2x_fastpath {
 				 FCOE_IDX_OFFSET)
 #define bnx2x_fcoe_fp(bp)	(&bp->fp[FCOE_IDX(bp)])
 #define bnx2x_fcoe(bp, var)	(bnx2x_fcoe_fp(bp)->var)
+#define bnx2x_fcoe_inner_sp_obj(bp)	(&bp->sp_objs[FCOE_IDX(bp)])
+#define bnx2x_fcoe_sp_obj(bp, var)	(bnx2x_fcoe_inner_sp_obj(bp)->var)
 #define bnx2x_fcoe_tx(bp, var)	(bnx2x_fcoe_fp(bp)-> \
 						txdata_ptr[FIRST_TX_COS_INDEX] \
 						->var)
@@ -1202,11 +1193,29 @@ struct bnx2x_prev_path_list {
 	struct list_head list;
 };
 
+struct bnx2x_sp_objs {
+	/* MACs object */
+	struct bnx2x_vlan_mac_obj mac_obj;
+
+	/* Queue State object */
+	struct bnx2x_queue_sp_obj q_obj;
+};
+
+struct bnx2x_fp_stats {
+	struct tstorm_per_queue_stats old_tclient;
+	struct ustorm_per_queue_stats old_uclient;
+	struct xstorm_per_queue_stats old_xclient;
+	struct bnx2x_eth_q_stats eth_q_stats;
+	struct bnx2x_eth_q_stats_old eth_q_stats_old;
+};
+
 struct bnx2x {
 	/* Fields used in the tx and intr/napi performance paths
 	 * are grouped together in the beginning of the structure
 	 */
 	struct bnx2x_fastpath	*fp;
+	struct bnx2x_sp_objs	*sp_objs;
+	struct bnx2x_fp_stats	*fp_stats;
 	struct bnx2x_fp_txdata	*bnx2x_txq;
 	int			bnx2x_txq_size;
 	void __iomem		*regview;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +65 -22

231 lines not on this page · raw message

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +4 -4
index de79cdf..11afe5d 100644
@@ -981,8 +981,8 @@ static inline void bnx2x_init_vlan_mac_fp_objs(struct bnx2x_fastpath *fp,
 	struct bnx2x *bp = fp->bp;
 
 	/* Configure classification DBs */
-	bnx2x_init_mac_obj(bp, &fp->mac_obj, fp->cl_id, fp->cid,
-			   BP_FUNC(bp), bnx2x_sp(bp, mac_rdata),
+	bnx2x_init_mac_obj(bp, &bnx2x_sp_obj(bp, fp).mac_obj, fp->cl_id,
+			   fp->cid, BP_FUNC(bp), bnx2x_sp(bp, mac_rdata),
 			   bnx2x_sp_mapping(bp, mac_rdata),
 			   BNX2X_FILTER_MAC_PENDING,
 			   &bp->sp_state, obj_type,
@@ -1138,8 +1138,8 @@ static inline void bnx2x_init_fcoe_fp(struct bnx2x *bp)
 	/* No multi-CoS for FCoE L2 client */
 	BUG_ON(fp->max_cos != 1);
 
-	bnx2x_init_queue_obj(bp, &fp->q_obj, fp->cl_id, &fp->cid, 1,
-			     BP_FUNC(bp), bnx2x_sp(bp, q_rdata),
+	bnx2x_init_queue_obj(bp, &bnx2x_sp_obj(bp, fp).q_obj, fp->cl_id,
+			     &fp->cid, 1, BP_FUNC(bp), bnx2x_sp(bp, q_rdata),
 			     bnx2x_sp_mapping(bp, q_rdata), q_type);
 
 	DP(NETIF_MSG_IFUP,
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +2 -2
index 037eee6..13a51b0 100644
@@ -2292,7 +2292,7 @@ static int bnx2x_test_intr(struct bnx2x *bp)
 		return -ENODEV;
 	}
 
-	params.q_obj = &bp->fp->q_obj;
+	params.q_obj = &bp->sp_objs->q_obj;
 	params.cmd = BNX2X_Q_CMD_EMPTY;
 
 	__set_bit(RAMROD_COMP_WAIT, &params.ramrod_flags);
@@ -2516,7 +2516,7 @@ static void bnx2x_get_ethtool_stats(struct net_device *dev,
 
 	if (is_multi(bp)) {
 		for_each_eth_queue(bp, i) {
-			hw_stats = (u32 *)&bp->fp[i].eth_q_stats;
+			hw_stats = (u32 *)&bp->fp_stats[i].eth_q_stats;
 			for (j = 0; j < BNX2X_NUM_Q_STATS; j++) {
 				if (bnx2x_q_stats_arr[j].size == 0) {
 					/* skip this counter */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +19 -18
index 1895de5..fbade5c 100644
@@ -1583,7 +1583,7 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe)
 	int cid = SW_CID(rr_cqe->ramrod_cqe.conn_and_cmd_data);
 	int command = CQE_CMD(rr_cqe->ramrod_cqe.conn_and_cmd_data);
 	enum bnx2x_queue_cmd drv_cmd = BNX2X_Q_CMD_MAX;
-	struct bnx2x_queue_sp_obj *q_obj = &fp->q_obj;
+	struct bnx2x_queue_sp_obj *q_obj = &bnx2x_sp_obj(bp, fp).q_obj;
 
 	DP(BNX2X_MSG_SP,
 	   "fp %d  cid %d  got ramrod #%d  state is %x  type is %d\n",
@@ -3035,9 +3035,9 @@ static void bnx2x_drv_info_ether_stat(struct bnx2x *bp)
 	memcpy(ether_stat->version, DRV_MODULE_VERSION,
 	       ETH_STAT_INFO_VERSION_LEN - 1);
 
-	bp->fp[0].mac_obj.get_n_elements(bp, &bp->fp[0].mac_obj,
-					 DRV_INFO_ETH_STAT_NUM_MACS_REQUIRED,
-					 ether_stat->mac_local);
+	bp->sp_objs[0].mac_obj.get_n_elements(bp, &bp->sp_objs[0].mac_obj,
+					DRV_INFO_ETH_STAT_NUM_MACS_REQUIRED,
+					ether_stat->mac_local);
 
 	ether_stat->mtu_size = bp->dev->mtu;
 
@@ -4632,7 +4632,7 @@ static void bnx2x_handle_classification_eqe(struct bnx2x *bp,
 			vlan_mac_obj = &bp->iscsi_l2_mac_obj;
 		else
 #endif
-			vlan_mac_obj = &bp->fp[cid].mac_obj;
+			vlan_mac_obj = &bp->sp_objs[cid].mac_obj;
 
 		break;
 	case BNX2X_FILTER_MCAST_PENDING:
@@ -4730,7 +4730,7 @@ static void bnx2x_after_function_update(struct bnx2x *bp)
 	for_each_eth_queue(bp, q) {
 		/* Set the appropriate Queue object */
 		fp = &bp->fp[q];
-		queue_params.q_obj = &fp->q_obj;
+		queue_params.q_obj = &bnx2x_sp_obj(bp, fp).q_obj;
 
 		/* send the ramrod */
 		rc = bnx2x_queue_state_change(bp, &queue_params);
@@ -4742,7 +4742,7 @@ static void bnx2x_after_function_update(struct bnx2x *bp)
 #ifdef BCM_CNIC
 	if (!NO_FCOE(bp)) {
 		fp = &bp->fp[FCOE_IDX(bp)];
-		queue_params.q_obj = &fp->q_obj;
+		queue_params.q_obj = &bnx2x_sp_obj(bp, fp).q_obj;
 
 		/* clear pending completion bit */
 		__clear_bit(RAMROD_COMP_WAIT, &queue_params.ramrod_flags);
@@ -4775,10 +4775,10 @@ static struct bnx2x_queue_sp_obj *bnx2x_cid_to_q_obj(
 	DP(BNX2X_MSG_SP, "retrieving fp from cid %d\n", cid);
 #ifdef BCM_CNIC
 	if (cid == BNX2X_FCOE_ETH_CID(bp))
-		return &bnx2x_fcoe(bp, q_obj);
+		return &bnx2x_fcoe_sp_obj(bp, q_obj);
 	else
 #endif
-		return &bnx2x_fp(bp, CID_TO_FP(cid, bp), q_obj);
+		return &bp->sp_objs[CID_TO_FP(cid, bp)].q_obj;
 }
 
 static void bnx2x_eq_int(struct bnx2x *bp)
@@ -5667,8 +5667,8 @@ static void bnx2x_init_eth_fp(struct bnx2x *bp, int fp_idx)
 		cids[cos] = fp->txdata_ptr[cos]->cid;
 	}
 
-	bnx2x_init_queue_obj(bp, &fp->q_obj, fp->cl_id, cids, fp->max_cos,
-			     BP_FUNC(bp), bnx2x_sp(bp, q_rdata),
+	bnx2x_init_queue_obj(bp, &bnx2x_sp_obj(bp, fp).q_obj, fp->cl_id, cids,
+			     fp->max_cos, BP_FUNC(bp), bnx2x_sp(bp, q_rdata),
 			     bnx2x_sp_mapping(bp, q_rdata), q_type);
 
 	/**
@@ -7596,8 +7596,8 @@ int bnx2x_set_eth_mac(struct bnx2x *bp, bool set)
 
 	__set_bit(RAMROD_COMP_WAIT, &ramrod_flags);
 	/* Eth MAC is set on RSS leading client (fp[0]) */
-	return bnx2x_set_mac_one(bp, bp->dev->dev_addr, &bp->fp->mac_obj, set,
-				 BNX2X_ETH_MAC, &ramrod_flags);
+	return bnx2x_set_mac_one(bp, bp->dev->dev_addr, &bp->sp_objs->mac_obj,
+				 set, BNX2X_ETH_MAC, &ramrod_flags);
 }
 
 int bnx2x_setup_leading(struct bnx2x *bp)
@@ -7877,7 +7877,7 @@ int bnx2x_setup_queue(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 		bnx2x_ack_sb(bp, fp->igu_sb_id, USTORM_ID, 0,
 			     IGU_INT_ENABLE, 0);
 
-	q_params.q_obj = &fp->q_obj;
+	q_params.q_obj = &bnx2x_sp_obj(bp, fp).q_obj;
 	/* We want to wait for completion in this context */
 	__set_bit(RAMROD_COMP_WAIT, &q_params.ramrod_flags);
 
@@ -7950,7 +7950,7 @@ static int bnx2x_stop_queue(struct bnx2x *bp, int index)
 
 	DP(NETIF_MSG_IFDOWN, "stopping queue %d cid %d\n", index, fp->cid);
 
-	q_params.q_obj = &fp->q_obj;
+	q_params.q_obj = &bnx2x_sp_obj(bp, fp).q_obj;
 	/* We want to wait for completion in this context */
 	__set_bit(RAMROD_COMP_WAIT, &q_params.ramrod_flags);
 
@@ -8339,12 +8339,13 @@ void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode)
 	usleep_range(1000, 1000);
 
 	/* Clean all ETH MACs */
-	rc = bnx2x_del_all_macs(bp, &bp->fp[0].mac_obj, BNX2X_ETH_MAC, false);
+	rc = bnx2x_del_all_macs(bp, &bp->sp_objs[0].mac_obj, BNX2X_ETH_MAC,
+				false);
 	if (rc < 0)
 		BNX2X_ERR("Failed to delete all ETH macs: %d\n", rc);
 
 	/* Clean up UC list  */
-	rc = bnx2x_del_all_macs(bp, &bp->fp[0].mac_obj, BNX2X_UC_LIST_MAC,
+	rc = bnx2x_del_all_macs(bp, &bp->sp_objs[0].mac_obj, BNX2X_UC_LIST_MAC,
 				true);
 	if (rc < 0)
 		BNX2X_ERR("Failed to schedule DEL commands for UC MACs list: %d\n",
@@ -11049,7 +11050,7 @@ static int bnx2x_set_uc_list(struct bnx2x *bp)
 	int rc;
 	struct net_device *dev = bp->dev;
 	struct netdev_hw_addr *ha;
-	struct bnx2x_vlan_mac_obj *mac_obj = &bp->fp->mac_obj;
+	struct bnx2x_vlan_mac_obj *mac_obj = &bp->sp_objs->mac_obj;
 	unsigned long ramrod_flags = 0;
 
 	/* First schedule a cleanup up of old configuration */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c +34 -21

99 lines not on this page · raw message

Signature · 1 line
1.7.10
#10 lore raw

PATCH 8/12 bnx2x: Allow up to 63 RSS queues default 8 queues

In reply to Merav Sicron

This patch removed the limitation in the code for 16 RSS queues. The default (without other instruction from the user) number of queues is determined according to the number of MSI-X vectors supported for that function, the number of CPUs in the system, and a maximum of 8 queues.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h      |    2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h  |    4 +++-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   13 +++----------
 3 files changed, 7 insertions(+), 12 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +1 -1
index 60a72f5..4dde45a 100644
@@ -1643,7 +1643,7 @@ extern int num_queues;
 
 #define BNX2X_MAX_QUEUES(bp)	BNX2X_MAX_RSS_COUNT(bp)
 /* #define is_eth_multi(bp)	(BNX2X_NUM_ETH_QUEUES(bp) > 1) */
-
+#define BNX2X_DEFAULT_NUM_QUEUES	8
 #define RSS_IPV4_CAP_MASK						\
 	TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY
 
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +3 -1
index 11afe5d..2865575 100644
@@ -815,9 +815,11 @@ static inline void bnx2x_disable_msi(struct bnx2x *bp)
 
 static inline int bnx2x_calc_num_queues(struct bnx2x *bp)
 {
+	int num = min_t(int, num_online_cpus(), BNX2X_DEFAULT_NUM_QUEUES);
+
 	return  num_queues ?
 		 min_t(int, num_queues, BNX2X_MAX_QUEUES(bp)) :
-		 min_t(int, num_online_cpus(), BNX2X_MAX_QUEUES(bp));
+		 min_t(int, num, BNX2X_MAX_QUEUES(bp));
 }
 
 static inline void bnx2x_clear_sge_mask_next_elems(struct bnx2x_fastpath *fp)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +3 -10
index fbade5c..11bd0b6 100644
@@ -11813,13 +11813,6 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
 
 	max_non_def_sbs = bnx2x_get_num_non_def_sbs(pdev);
 
-	/* !!! FIXME !!!
-	 * Do not allow the maximum SB count to grow above 16
-	 * since Special CIDs starts from 16*BNX2X_MULTI_TX_COS=48.
-	 * We will use the FP_SB_MAX_E1x macro for this matter.
-	 */
-	max_non_def_sbs = min_t(int, FP_SB_MAX_E1x, max_non_def_sbs);
-
 	WARN_ON(!max_non_def_sbs);
 
 	/* Maximum number of RSS queues: one IGU SB goes to CNIC */
@@ -11841,9 +11834,6 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
 
 	bp = netdev_priv(dev);
 
-	BNX2X_DEV_INFO("Allocated netdev with %d tx and %d rx queues\n",
-			  tx_count, rx_count);
-
 	bp->igu_sb_cnt = max_non_def_sbs;
 	bp->msg_enable = debug;
 	pci_set_drvdata(pdev, dev);
@@ -11856,6 +11846,9 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
 
 	BNX2X_DEV_INFO("max_non_def_sbs %d\n", max_non_def_sbs);
 
+	BNX2X_DEV_INFO("Allocated netdev with %d tx and %d rx queues\n",
+			  tx_count, rx_count);
+
 	rc = bnx2x_init_bp(bp);
 	if (rc)
 		goto init_one_exit;
Signature · 1 line
1.7.10
#25 lore raw

PATCH 10/12 bnx2x: Support DCBX for all functions

In reply to Merav Sicron

From: Barak Witkowski <[email protected]>

In multi-function device, allow configuring dcbx admin params from all drivers on a single physical port.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h      |    1 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c  |    6 +++--
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h  |    2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c  |   30 +++++++++++++++-------
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h  |    1 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |    2 ++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h  |    1 +
 7 files changed, 31 insertions(+), 12 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +1 -0
index e0a3cc9..1f2e03a 100644
@@ -1333,6 +1333,7 @@ struct bnx2x {
 #define NO_FCOE_FLAG			(1 << 15)
 #define BC_SUPPORTS_PFC_STATS		(1 << 17)
 #define USING_SINGLE_MSIX_FLAG		(1 << 20)
+#define BC_SUPPORTS_DCBX_MSG_NON_PMF	(1 << 21)
 
 #define NO_ISCSI(bp)		((bp)->flags & NO_ISCSI_FLAG)
 #define NO_ISCSI_OOO(bp)	((bp)->flags & NO_ISCSI_OOO_FLAG)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +4 -2
index c8a83a3..f774acf 100644
@@ -2257,8 +2257,10 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
 		return -EBUSY;
 	}
 
-	if (bp->state != BNX2X_STATE_DIAG)
-		bnx2x_dcbx_init(bp);
+	/* If PMF - send ADMIN DCBX msg to MFW to initiate DCBX FSM */
+	if (bp->port.pmf && (bp->state != BNX2X_STATE_DIAG))
+		bnx2x_dcbx_init(bp, false);
+
 	return 0;
 
 #ifndef BNX2X_STOP_ON_ERROR
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +1 -1
index b6ae665..cd98a3a 100644
@@ -418,7 +418,7 @@ void bnx2x_ilt_set_info(struct bnx2x *bp);
  *
  * @bp:		driver handle
  */
-void bnx2x_dcbx_init(struct bnx2x *bp);
+void bnx2x_dcbx_init(struct bnx2x *bp, bool update_shmem);
 
 /**
  * bnx2x_set_power_state - set power state to the requested value.
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +21 -9
index 4f9244b..8a73374 100644
@@ -972,23 +972,26 @@ void bnx2x_dcbx_init_params(struct bnx2x *bp)
 	bp->dcbx_config_params.admin_default_priority = 0;
 }
 
-void bnx2x_dcbx_init(struct bnx2x *bp)
+void bnx2x_dcbx_init(struct bnx2x *bp, bool update_shmem)
 {
 	u32 dcbx_lldp_params_offset = SHMEM_LLDP_DCBX_PARAMS_NONE;
 
+	/* only PMF can send ADMIN msg to MFW in old MFW versions */
+	if ((!bp->port.pmf) && (!(bp->flags & BC_SUPPORTS_DCBX_MSG_NON_PMF)))
+		return;
+
 	if (bp->dcbx_enabled <= 0)
 		return;
 
 	/* validate:
 	 * chip of good for dcbx version,
 	 * dcb is wanted
-	 * the function is pmf
 	 * shmem2 contains DCBX support fields
 	 */
 	DP(BNX2X_MSG_DCB, "dcb_state %d bp->port.pmf %d\n",
 	   bp->dcb_state, bp->port.pmf);
 
-	if (bp->dcb_state == BNX2X_DCB_STATE_ON && bp->port.pmf &&
+	if (bp->dcb_state == BNX2X_DCB_STATE_ON &&
 	    SHMEM2_HAS(bp, dcbx_lldp_params_offset)) {
 		dcbx_lldp_params_offset =
 			SHMEM2_RD(bp, dcbx_lldp_params_offset);
@@ -999,12 +1002,23 @@ void bnx2x_dcbx_init(struct bnx2x *bp)
 		bnx2x_update_drv_flags(bp, 1 << DRV_FLAGS_DCB_CONFIGURED, 0);
 
 		if (SHMEM_LLDP_DCBX_PARAMS_NONE != dcbx_lldp_params_offset) {
-			bnx2x_dcbx_admin_mib_updated_params(bp,
-				dcbx_lldp_params_offset);
+			/* need HW lock to avoid scenario of two drivers
+			 * writing in parallel to shmem
+			 */
+			bnx2x_acquire_hw_lock(bp,
+					      HW_LOCK_RESOURCE_DCBX_ADMIN_MIB);
+			if (update_shmem)
+				bnx2x_dcbx_admin_mib_updated_params(bp,
+					dcbx_lldp_params_offset);
 
 			/* Let HW start negotiation */
 			bnx2x_fw_command(bp,
 					 DRV_MSG_CODE_DCBX_ADMIN_PMF_MSG, 0);
+			/* release HW lock only after MFW acks that it finished
+			 * reading values from shmem
+			 */
+			bnx2x_release_hw_lock(bp,
+					      HW_LOCK_RESOURCE_DCBX_ADMIN_MIB);
 		}
 	}
 }
@@ -2063,10 +2077,8 @@ static u8 bnx2x_dcbnl_set_all(struct net_device *netdev)
 			   "Handling parity error recovery. Try again later\n");
 		return 1;
 	}
-	if (netif_running(bp->dev)) {
-		bnx2x_nic_unload(bp, UNLOAD_NORMAL);
-		rc = bnx2x_nic_load(bp, LOAD_NORMAL);
-	}
+	if (netif_running(bp->dev))
+		bnx2x_dcbx_init(bp, true);
 	DP(BNX2X_MSG_DCB, "set_dcbx_params done (%d)\n", rc);
 	if (rc)
 		return 1;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +1 -0
index c61aa37..6b77630 100644
@@ -1253,6 +1253,7 @@ struct drv_func_mb {
 
 	#define DRV_MSG_CODE_DCBX_ADMIN_PMF_MSG         0xb0000000
 	#define DRV_MSG_CODE_DCBX_PMF_DRV_OK            0xb2000000
+	#define REQ_BC_VER_4_DCBX_ADMIN_MSG_NON_PMF     0x00070401
 
 	#define DRV_MSG_CODE_VF_DISABLED_DONE           0xc0000000
 
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +2 -0
index 3a4fefd..26a8296 100644
@@ -9732,6 +9732,8 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
 	bp->flags |= (val >= REQ_BC_VER_4_PFC_STATS_SUPPORTED) ?
 			BC_SUPPORTS_PFC_STATS : 0;
 
+	bp->flags |= (val >= REQ_BC_VER_4_DCBX_ADMIN_MSG_NON_PMF) ?
+			BC_SUPPORTS_DCBX_MSG_NON_PMF : 0;
 	boot_mode = SHMEM_RD(bp,
 			dev_info.port_feature_config[BP_PORT(bp)].mba_config) &
 			PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +1 -0
index bfef98f..a78e356 100644
@@ -5913,6 +5913,7 @@
 #define MISC_REGISTERS_SPIO_OUTPUT_LOW				 0
 #define MISC_REGISTERS_SPIO_SET_POS				 8
 #define HW_LOCK_MAX_RESOURCE_VALUE				 31
+#define HW_LOCK_RESOURCE_DCBX_ADMIN_MIB				 13
 #define HW_LOCK_RESOURCE_DRV_FLAGS				 10
 #define HW_LOCK_RESOURCE_GPIO					 1
 #define HW_LOCK_RESOURCE_MDIO					 0
Signature · 1 line
1.7.10
#26 lore raw

PATCH 11/12 bnx2x: Add FCoE capabilities advertisement

In reply to Merav Sicron

From: Barak Witkowski <[email protected]>

1. When FCoE offload driver is registered, copy its capabilities to the chip scratchpad.
2. Copy FCoE/iSCSI MAC addresses in aligned manner to chip scratchpad.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h      |    1 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h  |   41 +++++++++++++++++++++-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   41 +++++++++++++++++++---
 drivers/net/ethernet/broadcom/cnic_if.h          |    6 ++++
 4 files changed, 83 insertions(+), 6 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +1 -0
index 1f2e03a..47ec384 100644
@@ -1332,6 +1332,7 @@ struct bnx2x {
 #define NO_ISCSI_FLAG			(1 << 14)
 #define NO_FCOE_FLAG			(1 << 15)
 #define BC_SUPPORTS_PFC_STATS		(1 << 17)
+#define BC_SUPPORTS_FCOE_FEATURES	(1 << 19)
 #define USING_SINGLE_MSIX_FLAG		(1 << 20)
 #define BC_SUPPORTS_DCBX_MSG_NON_PMF	(1 << 21)
 
drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +40 -1

54 lines not on this page · raw message

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +36 -5

83 lines not on this page · raw message

drivers/net/ethernet/broadcom/cnic_if.h +6 -0
index 289274e..82872e6 100644
@@ -131,6 +131,11 @@ struct drv_ctl_l2_ring {
 	u32		cid;
 };
 
+struct drv_ctl_register_data {
+	int ulp_type;
+	struct fcoe_capabilities fcoe_features;
+};
+
 struct drv_ctl_info {
 	int	cmd;
 	union {
@@ -138,6 +143,7 @@ struct drv_ctl_info {
 		struct drv_ctl_io io;
 		struct drv_ctl_l2_ring ring;
 		int ulp_type;
+		struct drv_ctl_register_data register_data;
 		char bytes[MAX_DRV_CTL_DATA];
 	} data;
 };
Signature · 1 line
1.7.10
#27 lore raw

PATCH 12/12 bnx2x: Change date and version to 1.72.51-0

In reply to Merav Sicron

This change updates the date and version of the bnx2x driver.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +2 -2
index e30e2a2..85a3b84 100644
@@ -23,8 +23,8 @@
  * (you will need to reboot afterwards) */
 /* #define BNX2X_STOP_ON_ERROR */
 
-#define DRV_MODULE_VERSION      "1.72.50-0"
-#define DRV_MODULE_RELDATE      "2012/04/23"
+#define DRV_MODULE_VERSION      "1.72.51-0"
+#define DRV_MODULE_RELDATE      "2012/06/12"
 #define BNX2X_BC_VER            0x040200
 
 #if defined(CONFIG_DCB)
Signature · 1 line
1.7.10
#7 lore raw

PATCH 5/12 bnx2x: Make the transmission queues adjacent

In reply to Merav Sicron

In the current scheme the transmission queues of traffic-class 0 were 0-15, the transmission queues of traffic-class 1 were 16-31 and so on. If the number of RSS queues was smaller than 16, there were gaps in transmission queues numbering, as well as in CIDs numbering. This is both a waste (especially when 16 is increased to 64), and may causes problems with flushing queues when reducing the number of RSS queues (using ethtool -L). The new scheme eliminates the gaps.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h        |   66 +++++++-----
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c    |  105 +++++++++++++-------
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h    |   14 +--
 .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c    |    2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c   |   42 ++++----
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c  |    4 +-
 6 files changed, 139 insertions(+), 94 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +39 -27
index feec032..36ebc3d 100644
@@ -276,29 +276,32 @@ enum {
 #define FIRST_TX_ONLY_COS_INDEX		1
 #define FIRST_TX_COS_INDEX		0
 
-/* defines for decodeing the fastpath index and the cos index out of the
- * transmission queue index
- */
 #define MAX_TXQS_PER_COS	FP_SB_MAX_E1x
 
-#define TXQ_TO_FP(txq_index)	((txq_index) % MAX_TXQS_PER_COS)
-#define TXQ_TO_COS(txq_index)	((txq_index) / MAX_TXQS_PER_COS)
-
 /* rules for calculating the cids of tx-only connections */
-#define CID_TO_FP(cid)		((cid) % MAX_TXQS_PER_COS)
-#define CID_COS_TO_TX_ONLY_CID(cid, cos)	(cid + cos * MAX_TXQS_PER_COS)
+#define CID_TO_FP(cid, bp)		((cid) % BNX2X_NUM_NON_CNIC_QUEUES(bp))
+#define CID_COS_TO_TX_ONLY_CID(cid, cos, bp) \
+				(cid + cos * BNX2X_NUM_NON_CNIC_QUEUES(bp))
 
 /* fp index inside class of service range */
-#define FP_COS_TO_TXQ(fp, cos)    ((fp)->index + cos * MAX_TXQS_PER_COS)
-
-/*
- * 0..15 eth cos0
- * 16..31 eth cos1 if applicable
- * 32..47 eth cos2 If applicable
- * fcoe queue follows eth queues (16, 32, 48 depending on cos)
+#define FP_COS_TO_TXQ(fp, cos, bp) \
+			((fp)->index + cos * BNX2X_NUM_NON_CNIC_QUEUES(bp))
+
+/* Indexes for transmission queues array:
+ * txdata for RSS i CoS j is at location i + (j * num of RSS)
+ * txdata for FCoE (if exist) is at location max cos * num of RSS
+ * txdata for FWD (if exist) is one location after FCoE
+ * txdata for OOO (if exist) is one location after FWD
  */
-#define MAX_ETH_TXQ_IDX(bp)	(MAX_TXQS_PER_COS * (bp)->max_cos)
-#define FCOE_TXQ_IDX(bp)	(MAX_ETH_TXQ_IDX(bp))
+enum {
+	FCOE_TXQ_IDX_OFFSET,
+	FWD_TXQ_IDX_OFFSET,
+	OOO_TXQ_IDX_OFFSET,
+};
+#define MAX_ETH_TXQ_IDX(bp)	(BNX2X_NUM_NON_CNIC_QUEUES(bp) * (bp)->max_cos)
+#ifdef BCM_CNIC
+#define FCOE_TXQ_IDX(bp)	(MAX_ETH_TXQ_IDX(bp) + FCOE_TXQ_IDX_OFFSET)
+#endif
 
 /* fast path */
 /*
@@ -481,6 +484,8 @@ struct bnx2x_fp_txdata {
 	__le16			*tx_cons_sb;
 
 	int			txq_index;
+	struct bnx2x_fastpath	*parent_fp;
+	int			tx_ring_size;
 };
 
 enum bnx2x_tpa_mode_t {
@@ -507,7 +512,7 @@ struct bnx2x_fastpath {
 	enum bnx2x_tpa_mode_t	mode;
 
 	u8			max_cos; /* actual number of active tx coses */
-	struct bnx2x_fp_txdata	txdata[BNX2X_MULTI_TX_COS];
+	struct bnx2x_fp_txdata	*txdata_ptr[BNX2X_MULTI_TX_COS];
 
 	struct sw_rx_bd		*rx_buf_ring;	/* BDs mappings ring */
 	struct sw_rx_page	*rx_page_ring;	/* SGE pages mappings ring */
@@ -579,19 +584,22 @@ struct bnx2x_fastpath {
 /* Use 2500 as a mini-jumbo MTU for FCoE */
 #define BNX2X_FCOE_MINI_JUMBO_MTU	2500
 
-/* FCoE L2 `fastpath' entry is right after the eth entries */
-#define FCOE_IDX			BNX2X_NUM_ETH_QUEUES(bp)
-#define bnx2x_fcoe_fp(bp)		(&bp->fp[FCOE_IDX])
-#define bnx2x_fcoe(bp, var)		(bnx2x_fcoe_fp(bp)->var)
-#define bnx2x_fcoe_tx(bp, var)		(bnx2x_fcoe_fp(bp)-> \
-						txdata[FIRST_TX_COS_INDEX].var)
+#define	FCOE_IDX_OFFSET		0
+
+#define FCOE_IDX(bp)		(BNX2X_NUM_NON_CNIC_QUEUES(bp) + \
+				 FCOE_IDX_OFFSET)
+#define bnx2x_fcoe_fp(bp)	(&bp->fp[FCOE_IDX(bp)])
+#define bnx2x_fcoe(bp, var)	(bnx2x_fcoe_fp(bp)->var)
+#define bnx2x_fcoe_tx(bp, var)	(bnx2x_fcoe_fp(bp)-> \
+						txdata_ptr[FIRST_TX_COS_INDEX] \
+						->var)
 
 
 #define IS_ETH_FP(fp)			(fp->index < \
 					 BNX2X_NUM_ETH_QUEUES(fp->bp))
 #ifdef BCM_CNIC
-#define IS_FCOE_FP(fp)			(fp->index == FCOE_IDX)
-#define IS_FCOE_IDX(idx)		((idx) == FCOE_IDX)
+#define IS_FCOE_FP(fp)			(fp->index == FCOE_IDX(fp->bp))
+#define IS_FCOE_IDX(idx)		((idx) == FCOE_IDX(bp))
 #else
 #define IS_FCOE_FP(fp)		false
 #define IS_FCOE_IDX(idx)	false
@@ -1202,6 +1210,8 @@ struct bnx2x {
 	 * are grouped together in the beginning of the structure
 	 */
 	struct bnx2x_fastpath	*fp;
+	struct bnx2x_fp_txdata	*bnx2x_txq;
+	int			bnx2x_txq_size;
 	void __iomem		*regview;
 	void __iomem		*doorbells;
 	u16			db_size;
@@ -1404,6 +1414,7 @@ struct bnx2x {
 	u8			igu_dsb_id;
 	u8			igu_base_sb;
 	u8			igu_sb_cnt;
+
 	dma_addr_t		def_status_blk_mapping;
 
 	struct bnx2x_slowpath	*slowpath;
@@ -1458,7 +1469,6 @@ struct bnx2x {
 					NON_ETH_CONTEXT_USE + CNIC_PRESENT)
 #define L2_ILT_LINES(bp)	(DIV_ROUND_UP(BNX2X_L2_CID_COUNT(bp),\
 					ILT_PAGE_CIDS))
-#define BNX2X_DB_SIZE(bp)	(BNX2X_L2_CID_COUNT(bp) * (1 << BNX2X_DB_SHIFT))
 
 	int			qm_cid_count;
 
@@ -1617,6 +1627,8 @@ struct bnx2x {
 extern int num_queues;
 #define BNX2X_NUM_QUEUES(bp)	(bp->num_queues)
 #define BNX2X_NUM_ETH_QUEUES(bp) (BNX2X_NUM_QUEUES(bp) - NON_ETH_CONTEXT_USE)
+#define BNX2X_NUM_NON_CNIC_QUEUES(bp)	(BNX2X_NUM_QUEUES(bp) - \
+					 NON_ETH_CONTEXT_USE)
 #define BNX2X_NUM_RX_QUEUES(bp)	BNX2X_NUM_QUEUES(bp)
 
 #define is_multi(bp)		(BNX2X_NUM_QUEUES(bp) > 1)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +67 -38

263 lines not on this page · raw message

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +8 -6
index bb47984..112ffcc 100644
@@ -728,7 +728,7 @@ static inline bool bnx2x_has_tx_work(struct bnx2x_fastpath *fp)
 {
 	u8 cos;
 	for_each_cos_in_tx_queue(fp, cos)
-		if (bnx2x_tx_queue_has_work(&fp->txdata[cos]))
+		if (bnx2x_tx_queue_has_work(fp->txdata_ptr[cos]))
 			return true;
 	return false;
 }
@@ -1066,12 +1066,14 @@ static inline u32 bnx2x_rx_ustorm_prods_offset(struct bnx2x_fastpath *fp)
 }
 
 static inline void bnx2x_init_txdata(struct bnx2x *bp,
-	struct bnx2x_fp_txdata *txdata, u32 cid, int txq_index,
-	__le16 *tx_cons_sb)
+				     struct bnx2x_fp_txdata *txdata, u32 cid,
+				     int txq_index, __le16 *tx_cons_sb,
+				     struct bnx2x_fastpath *fp)
 {
 	txdata->cid = cid;
 	txdata->txq_index = txq_index;
 	txdata->tx_cons_sb = tx_cons_sb;
+	txdata->parent_fp = fp;
 
 	DP(NETIF_MSG_IFUP, "created tx data cid %d, txq %d\n",
 	   txdata->cid, txdata->txq_index);
@@ -1114,9 +1116,9 @@ static inline void bnx2x_init_fcoe_fp(struct bnx2x *bp)
 	bnx2x_fcoe(bp, fw_sb_id) = DEF_SB_ID;
 	bnx2x_fcoe(bp, igu_sb_id) = bp->igu_dsb_id;
 	bnx2x_fcoe(bp, rx_cons_sb) = BNX2X_FCOE_L2_RX_INDEX;
-
-	bnx2x_init_txdata(bp, &bnx2x_fcoe(bp, txdata[0]),
-			  fp->cid, FCOE_TXQ_IDX(bp), BNX2X_FCOE_L2_TX_INDEX);
+	bnx2x_init_txdata(bp, bnx2x_fcoe(bp, txdata_ptr[0]),
+			  fp->cid, FCOE_TXQ_IDX(bp), BNX2X_FCOE_L2_TX_INDEX,
+			  fp);
 
 	DP(NETIF_MSG_IFUP, "created fcoe tx data (fp index %d)\n", fp->index);
 
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +1 -1
index 7378b1d..037eee6 100644
@@ -1959,7 +1959,7 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode)
 	unsigned char *packet;
 	struct bnx2x_fastpath *fp_rx = &bp->fp[0];
 	struct bnx2x_fastpath *fp_tx = &bp->fp[0];
-	struct bnx2x_fp_txdata *txdata = &fp_tx->txdata[0];
+	struct bnx2x_fp_txdata *txdata = fp_tx->txdata_ptr[0];
 	u16 tx_start_idx, tx_idx;
 	u16 rx_start_idx, rx_idx;
 	u16 pkt_prod, bd_prod;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +22 -20

130 lines not on this page · raw message

drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c +2 -2
index 0e8bdcb..776b521 100644
@@ -1432,7 +1432,7 @@ static void bnx2x_prep_fw_stats_req(struct bnx2x *bp)
 					query[first_queue_query_index + i];
 
 		cur_query_entry->kind = STATS_TYPE_QUEUE;
-		cur_query_entry->index = bnx2x_stats_id(&bp->fp[FCOE_IDX]);
+		cur_query_entry->index = bnx2x_stats_id(&bp->fp[FCOE_IDX(bp)]);
 		cur_query_entry->funcID = cpu_to_le16(BP_FUNC(bp));
 		cur_query_entry->address.hi =
 			cpu_to_le32(U64_HI(cur_data_offset));
@@ -1573,7 +1573,7 @@ void bnx2x_afex_collect_stats(struct bnx2x *bp, void *void_afex_stats,
 	struct afex_stats *afex_stats = (struct afex_stats *)void_afex_stats;
 	struct bnx2x_eth_stats *estats = &bp->eth_stats;
 	struct per_queue_stats *fcoe_q_stats =
-		&bp->fw_stats_data->queue_stats[FCOE_IDX];
+		&bp->fw_stats_data->queue_stats[FCOE_IDX(bp)];
 
 	struct tstorm_per_queue_stats *fcoe_q_tstorm_stats =
 		&fcoe_q_stats->tstorm_queue_statistics;
Signature · 1 line
1.7.10
#8 lore raw

PATCH 6/12 bnx2x: Move the CNIC L2 CIDs to be right after the RSS CIDs

In reply to Merav Sicron

Currently the CNIC-related L2 CIDs (for sending control FCoE / iSCSI packets) were at fixed position, according to the maximal number of RSS queues multiplied by the number of traffic-classes. This change makes the CIDs dynamic, as they are defined to be right after the highest RSS CID. This decreases the memory allocated for the context.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h      |   19 +++++----
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c  |    1 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h  |   15 ++++---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   47 +++++++++++++++-------
 4 files changed, 52 insertions(+), 30 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +9 -10
index 36ebc3d..68d0d2c 100644
@@ -248,13 +248,12 @@ enum {
 	BNX2X_MAX_CNIC_ETH_CL_ID_IDX,
 };
 
-#define BNX2X_CNIC_START_ETH_CID	48
-enum {
+#define BNX2X_CNIC_START_ETH_CID(bp)	(BNX2X_NUM_NON_CNIC_QUEUES(bp) *\
+					 (bp)->max_cos)
 	/* iSCSI L2 */
-	BNX2X_ISCSI_ETH_CID = BNX2X_CNIC_START_ETH_CID,
+#define	BNX2X_ISCSI_ETH_CID(bp)		(BNX2X_CNIC_START_ETH_CID(bp))
 	/* FCoE L2 */
-	BNX2X_FCOE_ETH_CID,
-};
+#define	BNX2X_FCOE_ETH_CID(bp)		(BNX2X_CNIC_START_ETH_CID(bp) + 1)
 
 /** Additional rings budgeting */
 #ifdef BCM_CNIC
@@ -276,8 +275,6 @@ enum {
 #define FIRST_TX_ONLY_COS_INDEX		1
 #define FIRST_TX_COS_INDEX		0
 
-#define MAX_TXQS_PER_COS	FP_SB_MAX_E1x
-
 /* rules for calculating the cids of tx-only connections */
 #define CID_TO_FP(cid, bp)		((cid) % BNX2X_NUM_NON_CNIC_QUEUES(bp))
 #define CID_COS_TO_TX_ONLY_CID(cid, cos, bp) \
@@ -1463,10 +1460,12 @@ struct bnx2x {
 
 /*
  * Maximum CID count that might be required by the bnx2x:
- * Max Tss * Max_Tx_Multi_Cos + CNIC L2 Clients (FCoE and iSCSI related)
+ * Max RSS * Max_Tx_Multi_Cos + FCoE + iSCSI
  */
-#define BNX2X_L2_CID_COUNT(bp)	(MAX_TXQS_PER_COS * BNX2X_MULTI_TX_COS +\
-					NON_ETH_CONTEXT_USE + CNIC_PRESENT)
+#define BNX2X_L2_CID_COUNT(bp)	(BNX2X_NUM_ETH_QUEUES(bp) * BNX2X_MULTI_TX_COS \
+				+ NON_ETH_CONTEXT_USE + CNIC_PRESENT)
+#define BNX2X_L2_MAX_CID(bp)	(BNX2X_MAX_RSS_COUNT(bp) * BNX2X_MULTI_TX_COS \
+				+ NON_ETH_CONTEXT_USE + CNIC_PRESENT)
 #define L2_ILT_LINES(bp)	(DIV_ROUND_UP(BNX2X_L2_CID_COUNT(bp),\
 					ILT_PAGE_CIDS))
 
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -0
index 33132b1..d76df33 100644
@@ -2220,6 +2220,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
 	/* re-read iscsi info */
 	bnx2x_get_iscsi_info(bp);
 	bnx2x_setup_cnic_irq_info(bp);
+	bnx2x_setup_cnic_info(bp);
 	if (bp->state == BNX2X_STATE_OPEN)
 		bnx2x_cnic_notify(bp, CNIC_CTL_START_CMD);
 #endif
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +9 -6
index 112ffcc..de79cdf 100644
@@ -244,6 +244,14 @@ int bnx2x_cnic_notify(struct bnx2x *bp, int cmd);
  * @bp:		driver handle
  */
 void bnx2x_setup_cnic_irq_info(struct bnx2x *bp);
+
+/**
+ * bnx2x_setup_cnic_info - provides cnic with updated info
+ *
+ * @bp:		driver handle
+ */
+void bnx2x_setup_cnic_info(struct bnx2x *bp);
+
 #endif
 
 /**
@@ -1107,12 +1115,7 @@ static inline void bnx2x_init_fcoe_fp(struct bnx2x *bp)
 	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
-	 *  16 ETH clients per function when CNIC is enabled!
-	 *
-	 *  Fix it ASAP!!!
-	 */
-	bnx2x_fcoe(bp, cid) = BNX2X_FCOE_ETH_CID;
+	bnx2x_fcoe(bp, cid) = BNX2X_FCOE_ETH_CID(bp);
 	bnx2x_fcoe(bp, fw_sb_id) = DEF_SB_ID;
 	bnx2x_fcoe(bp, igu_sb_id) = bp->igu_dsb_id;
 	bnx2x_fcoe(bp, rx_cons_sb) = BNX2X_FCOE_L2_RX_INDEX;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +33 -14

104 lines not on this page · raw message

Signature · 1 line
1.7.10
#23 lore raw

PATCH 9/12 bnx2x: Add support for ethtool -L

In reply to Merav Sicron

Add support for ethtool -L/-l for setting and getting the number of RSS queues. The 'combined' field is used as we don't support separate IRQ for Rx and Tx.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h        |    4 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c    |    2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h    |   11 ++-
 .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c    |   81 ++++++++++++++++++++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c   |   15 ++--
 5 files changed, 101 insertions(+), 12 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +4 -0
index 4dde45a..e0a3cc9 100644
@@ -1408,6 +1408,7 @@ struct bnx2x {
 #define BNX2X_MAX_COS			3
 #define BNX2X_MAX_TX_COS		2
 	int			num_queues;
+	int			num_napi_queues;
 	int			disable_tpa;
 
 	u32			rx_mode;
@@ -1695,6 +1696,9 @@ struct bnx2x_func_init_params {
 			continue;		\
 		else
 
+#define for_each_napi_rx_queue(bp, var) \
+	for ((var) = 0; (var) < bp->num_napi_queues; (var)++)
+
 /* Skip OOO FP */
 #define for_each_tx_queue(bp, var) \
 	for ((var) = 0; (var) < BNX2X_NUM_QUEUES(bp); (var)++) \
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -1
index 915e680..c8a83a3 100644
@@ -1343,7 +1343,7 @@ void bnx2x_free_irq(struct bnx2x *bp)
 		free_irq(bp->dev->irq, bp->dev);
 }
 
-int __devinit bnx2x_enable_msix(struct bnx2x *bp)
+int bnx2x_enable_msix(struct bnx2x *bp)
 {
 	int msix_vec = 0, i, rc, req_cnt;
 
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +8 -3
index 2865575..b6ae665 100644
@@ -29,6 +29,7 @@
 extern int load_count[2][3]; /* per-path: 0-common, 1-port0, 2-port1 */
 
 extern int num_queues;
+extern int int_mode;
 
 /************************ Macros ********************************/
 #define BNX2X_PCI_FREE(x, y, size) \
@@ -495,7 +496,7 @@ void bnx2x_netif_start(struct bnx2x *bp);
  * fills msix_table, requests vectors, updates num_queues
  * according to number of available vectors.
  */
-int __devinit bnx2x_enable_msix(struct bnx2x *bp);
+int bnx2x_enable_msix(struct bnx2x *bp);
 
 /**
  * bnx2x_enable_msi - request msi mode from OS, updated internals accordingly
@@ -788,8 +789,10 @@ static inline void bnx2x_add_all_napi(struct bnx2x *bp)
 {
 	int i;
 
+	bp->num_napi_queues = bp->num_queues;
+
 	/* Add NAPI objects */
-	for_each_rx_queue(bp, i)
+	for_each_napi_rx_queue(bp, i)
 		netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi),
 			       bnx2x_poll, BNX2X_NAPI_WEIGHT);
 }
@@ -798,10 +801,12 @@ static inline void bnx2x_del_all_napi(struct bnx2x *bp)
 {
 	int i;
 
-	for_each_rx_queue(bp, i)
+	for_each_napi_rx_queue(bp, i)
 		netif_napi_del(&bnx2x_fp(bp, i, napi));
 }
 
+void bnx2x_set_int_mode(struct bnx2x *bp);
+
 static inline void bnx2x_disable_msi(struct bnx2x *bp)
 {
 	if (bp->flags & USING_MSIX_FLAG) {
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +81 -0

93 lines not on this page · raw message

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +7 -8
index 11bd0b6..3a4fefd 100644
@@ -104,7 +104,7 @@ MODULE_PARM_DESC(disable_tpa, " Disable the TPA (LRO) feature");
 
 #define INT_MODE_INTx			1
 #define INT_MODE_MSI			2
-static int int_mode;
+int int_mode;
 module_param(int_mode, int, 0);
 MODULE_PARM_DESC(int_mode, " Force interrupt mode other than MSI-X "
 				"(1 INT#x; 2 MSI)");
@@ -7612,7 +7612,7 @@ int bnx2x_setup_leading(struct bnx2x *bp)
  *
  * In case of MSI-X it will also try to enable MSI-X.
  */
-static void __devinit bnx2x_set_int_mode(struct bnx2x *bp)
+void bnx2x_set_int_mode(struct bnx2x *bp)
 {
 	switch (int_mode) {
 	case INT_MODE_MSI:
@@ -7623,11 +7623,6 @@ static void __devinit bnx2x_set_int_mode(struct bnx2x *bp)
 		BNX2X_DEV_INFO("set number of queues to 1\n");
 		break;
 	default:
-		/* Set number of queues for MSI-X mode */
-		bnx2x_set_num_queues(bp);
-
-		BNX2X_DEV_INFO("set number of queues to %d\n", bp->num_queues);
-
 		/* if we can't use MSI-X we only need one fp,
 		 * so try to enable MSI-X with the requested number of fp's
 		 * and fallback to MSI or legacy INTx with one fp
@@ -11883,8 +11878,12 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
 
 #endif
 
+
+	/* Set bp->num_queues for MSI-X mode*/
+	bnx2x_set_num_queues(bp);
+
 	/* Configure interrupt mode: try to enable MSI-X/MSI if
-	 * needed, set bp->num_queues appropriately.
+	 * needed.
 	 */
 	bnx2x_set_int_mode(bp);
 
Signature · 1 line
1.7.10
#11 lore raw

Re: [net-next patch 8/12] bnx2x: Allow up to 63 RSS queues default 8 queues

In reply to Merav Sicron
Quoted 4 lines · Merav Sicron

This patch removed the limitation in the code for 16 RSS queues. The default (without other instruction from the user) number of queues is determined according to the number of MSI-X vectors supported for that function, the number of CPUs in the system, and a maximum of 8 queues.

Thats a very confusing changelog

You meant : " a minimum of 8 queues" ?

You should give more explanations, because its a sensible area for performances.

#12 lore raw

Re: [net-next patch 8/12] bnx2x: Allow up to 63 RSS queues default 8 queues

Hi Eric,

Quoted 10 lines · Eric Dumazet
Quoted 4 lines · Merav Sicron

This patch removed the limitation in the code for 16 RSS queues. The default (without other instruction from the user) number of queues is determined according to the number of MSI-X vectors supported for that function, the number of CPUs in the system, and a maximum of 8 queues.

Thats a very confusing changelog

You meant : " a minimum of 8 queues" ?

No, I meant maximum...for example in a system with 16 CPUs we will allocate 8 RSS queues. We saw that in most scenarios we tested there was no need for more than 8 queues to get the maximal throughput, and by limiting to 8 by default we reduce the allocated memory. We do provide ethtool -L support so that the user could request more RSS queues if desired.

Quoted 3 lines

You should give more explanations, because its a sensible area for performances.

Thanks,
Merav

#14 lore raw

Re: [net-next patch 8/12] bnx2x: Allow up to 63 RSS queues default 8 queues

In reply to Eilon Greenstein
Quoted 25 lines · Eilon Greenstein
Quoted 11 lines · Merav Sicron

Hi Eric,

Quoted 8 lines · Eric Dumazet
Quoted 4 lines · Merav Sicron

This patch removed the limitation in the code for 16 RSS queues. The default (without other instruction from the user) number of queues is determined according to the number of MSI-X vectors supported for that function, the number of CPUs in the system, and a maximum of 8 queues.

Thats a very confusing changelog

Quoted 12 lines
Quoted 2 lines

You meant : " a minimum of 8 queues" ?

No, I meant maximum...for example in a system with 16 CPUs we will allocate 8 RSS queues. We saw that in most scenarios we tested there was no need for more than 8 queues to get the maximal throughput, and by limiting to 8 by default we reduce the allocated memory. We do provide ethtool -L support so that the user could request more RSS queues if desired.

Quoted 3 lines

You should give more explanations, because its a sensible area for performances.

Quoted 9 lines

Just to emphasis, since this is the patch series that enable the users to control the number of queues, we can reduce the default number and allow the user to increase it if he has a setup that needs more than 8 parallel CPUs to receive the traffic. When using a new FW on the board, the number can be increased up to 64, so using the maximal number can be an overkill (even if the machine has 64 CPUs, it does not mean that the user would like us to consume 64 MSI-X vectors and all the memory to set up 64 queues) - so a lower default value can be used to satisfy most users while allowing them to increase the number if they wish.

I am all for a reduction of default number of queues.

Even a laptop has now 8 cpus, so on servers, using one queue per cpu is overkill for most uses.

Thanks

#13 lore raw

Re: [net-next patch 8/12] bnx2x: Allow up to 63 RSS queues default 8 queues

In reply to Merav Sicron
Quoted 11 lines · Merav Sicron

Hi Eric,

Quoted 8 lines · Eric Dumazet
Quoted 4 lines · Merav Sicron

This patch removed the limitation in the code for 16 RSS queues. The default (without other instruction from the user) number of queues is determined according to the number of MSI-X vectors supported for that function, the number of CPUs in the system, and a maximum of 8 queues.

Thats a very confusing changelog

Quoted 12 lines
Quoted 2 lines

You meant : " a minimum of 8 queues" ?

No, I meant maximum...for example in a system with 16 CPUs we will allocate 8 RSS queues. We saw that in most scenarios we tested there was no need for more than 8 queues to get the maximal throughput, and by limiting to 8 by default we reduce the allocated memory. We do provide ethtool -L support so that the user could request more RSS queues if desired.

Quoted 3 lines

You should give more explanations, because its a sensible area for performances.

Just to emphasis, since this is the patch series that enable the users to control the number of queues, we can reduce the default number and allow the user to increase it if he has a setup that needs more than 8 parallel CPUs to receive the traffic. When using a new FW on the board, the number can be increased up to 64, so using the maximal number can be an overkill (even if the machine has 64 CPUs, it does not mean that the user would like us to consume 64 MSI-X vectors and all the memory to set up 64 queues) - so a lower default value can be used to satisfy most users while allowing them to increase the number if they wish.

Thanks,
Eilon

Acked-by on v1 1/12
#2 lore raw

Re: [net-next patch 1/12] bnx2x: Add support for external LB

In reply to Merav Sicron
Quoted 4 lines · Merav Sicron

This change enables to do self-test with external loopback via ethtool.

The ethtool bits look right.

[...]

Quoted 5 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +0 -0
@@ -2124,7 +2124,12 @@ u8 bnx2x_initial_phy_init(struct bnx2x *bp, int load_mode)
 			}
 		}

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c u8 bnx2x_initial_phy_init(struct bnx2x *bp, int load_mode) · line 2134

Quoted 10 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +6 -1
 
-		rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars);
+	if (load_mode == LOAD_LOOPBACK_EXT) {
+		struct link_params *lp = &bp->link_params;
+		lp->loopback_mode = LOOPBACK_EXT;
+	}
+
+	rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars);
 
 		bnx2x_release_phy_lock(bp);

Indentation is wrong here, though.

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.
#5 lore raw

Re: [net-next patch 3/12] bnx2x: Add support for 4-tupple UDP RSS

In reply to Merav Sicron
Quoted 3 lines · Merav Sicron

This change enables to control via ethtool whether to do UDP RSS on 2-tupple (IP source / destination only) or on 4-tupple (include UDP source / destination port). It also enables to read back the RSS configuration.

[...]

Quoted 38 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +32 -0
@@ -2600,6 +2600,52 @@ static int bnx2x_set_phys_id(struct net_device *dev,
 	return 0;
 }
 
+static int bnx2x_get_rss_flags(struct bnx2x *bp, struct ethtool_rxnfc *info)
+{
+
+	switch (info->flow_type) {
+	case TCP_V4_FLOW:
+	case TCP_V6_FLOW:
+		info->data = RXH_IP_SRC | RXH_IP_DST |
+			     RXH_L4_B_0_1 | RXH_L4_B_2_3;
+		break;
+	case UDP_V4_FLOW:
+		if (bp->rss_conf_obj.udp_rss_v4)
+			info->data = RXH_IP_SRC | RXH_IP_DST |
+				     RXH_L4_B_0_1 | RXH_L4_B_2_3;
+		else
+			info->data = RXH_IP_SRC | RXH_IP_DST;
+		break;
+	case UDP_V6_FLOW:
+		if (bp->rss_conf_obj.udp_rss_v6)
+			info->data = RXH_IP_SRC | RXH_IP_DST |
+				     RXH_L4_B_0_1 | RXH_L4_B_2_3;
+		else
+			info->data = RXH_IP_SRC | RXH_IP_DST;
+		break;
+	case IPV4_FLOW:
+	case IPV6_FLOW:
+		info->data = RXH_IP_SRC | RXH_IP_DST;
+		break;
+	case SCTP_V4_FLOW:
+	case AH_ESP_V4_FLOW:
+	case AH_V4_FLOW:
+	case ESP_V4_FLOW:
+	case SCTP_V6_FLOW:

drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c static int bnx2x_set_phys_id(struct net_device *dev, · line 2644

Quoted 10 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +10 -0
+	case AH_ESP_V6_FLOW:
+	case AH_V6_FLOW:
+	case ESP_V6_FLOW:
+	case IP_USER_FLOW:
+	case ETHER_FLOW:
+		info->data = 0;
+		break;
+	default:
+		return -EINVAL;
+	}

[...]

Don't try to enumerate all flow types; we may add others in future. You should set info->data = 0 for any type for which RSS is not supported.

Otherwise I think the ethtool bits are fine.

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.
maintainer
#15 lore raw

Re: [net-next patch 8/12] bnx2x: Allow up to 63 RSS queues default 8 queues

In reply to Eilon Greenstein

From: "Eilon Greenstein" <[email protected]>
Date: Wed, 13 Jun 2012 16:53:29 +0300

Quoted 9 lines

Just to emphasis, since this is the patch series that enable the users to control the number of queues, we can reduce the default number and allow the user to increase it if he has a setup that needs more than 8 parallel CPUs to receive the traffic. When using a new FW on the board, the number can be increased up to 64, so using the maximal number can be an overkill (even if the machine has 64 CPUs, it does not mean that the user would like us to consume 64 MSI-X vectors and all the memory to set up 64 queues) - so a lower default value can be used to satisfy most users while allowing them to increase the number if they wish.

I think you should look at other drivers for guidance in this area.

There is zero value in each and every driver author deciding what is a good default strategy, because this means the user gets a very inconsistent experience based purely upon the driver author's whims.

#16 lore raw

Re: [net-next patch 8/12] bnx2x: Allow up to 63 RSS queues default 8 queues

Quoted 13 lines · David Miller

From: "Eilon Greenstein" <[email protected]>
Date: Wed, 13 Jun 2012 16:53:29 +0300

Quoted 9 lines

Just to emphasis, since this is the patch series that enable the users to control the number of queues, we can reduce the default number and allow the user to increase it if he has a setup that needs more than 8 parallel CPUs to receive the traffic. When using a new FW on the board, the number can be increased up to 64, so using the maximal number can be an overkill (even if the machine has 64 CPUs, it does not mean that the user would like us to consume 64 MSI-X vectors and all the memory to set up 64 queues) - so a lower default value can be used to satisfy most users while allowing them to increase the number if they wish.

Quoted 7 lines

I think you should look at other drivers for guidance in this area.

There is zero value in each and every driver author deciding what is a good default strategy, because this means the user gets a very inconsistent experience based purely upon the driver author's whims.

We looked at few other drivers - their current behavior is similar to what bnx2x had before this change: Minimum between the number of CPU and a defined maximum (probably the HW limit).
bnx2x HW limit is 64 (in most other drivers it is smaller, but this can change). The number of CPUs in new systems becomes bigger and bigger, and allocaintg so many RSS queues seems like a waste. With the relatively new ethtool -L feature the user can change the number of queues. That's why we think (and so does Eric Dumazet) that it is better to have a smaller default number which is good for most cases. Do you agree with that?

Thanks,
Merav

maintainer
#17 lore raw

Re: [net-next patch 8/12] bnx2x: Allow up to 63 RSS queues default 8 queues

From: "Merav Sicron" <[email protected]>
Date: Thu, 14 Jun 2012 18:34:06 +0300

Quoted 3 lines

That's why we think (and so does Eric Dumazet) that it is better to have a smaller default number which is good for most cases. Do you agree with that?

What I think is that the thing which is more important than the default we choose, is that it is consistently followed by all multiqueue drivers.

By blazing your own unique path here, that is nearly guaranteed not to happen.

I'd much rather have a bad default that every driver adheres to.

#24 lore raw

Re: [net-next patch 9/12] bnx2x: Add support for ethtool -L

In reply to Merav Sicron
Quoted 2 lines · Merav Sicron

Add support for ethtool -L/-l for setting and getting the number of RSS queues. The 'combined' field is used as we don't support separate IRQ for Rx and Tx.

[...]

Quoted 11 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +5 -0
@@ -2809,6 +2809,85 @@ static int bnx2x_set_rxfh_indir(struct net_device *dev, const u32 *indir)
 	return bnx2x_config_rss_eth(bp, false);
 }
 
+/**
+ * bnx2x_get_channels - gets the number of RSS queues.
+ *
+ * @dev:		net device
+ * @channels:		returns the number of max / current queues

drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c static int bnx2x_set_rxfh_indir(struct net_device *dev, const u32 *indir) · line 2826

Quoted 10 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +10 -0
+ */
+static void bnx2x_get_channels(struct net_device *dev,
+			       struct ethtool_channels *channels)
+{
+	struct bnx2x *bp = netdev_priv(dev);
+
+	channels->max_rx = channels->max_tx = channels->max_other = 0;
+	channels->max_combined = BNX2X_MAX_RSS_COUNT(bp);
+	channels->rx_count = channels->tx_count = channels->other_count = 0;
+	channels->combined_count = BNX2X_NUM_ETH_QUEUES(bp);

Don't bother setting fields to 0; you can assume the ethtool core does that for you.

Quoted 5 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +5 -0
+}
+
+/**
+ * bnx2x_change_num_queues - change the number of RSS queues.
+ *

drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c static int bnx2x_set_rxfh_indir(struct net_device *dev, const u32 *indir) · line 2841

Quoted 10 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +10 -0
+ * @bp:			bnx2x private structure
+ *
+ * Re-configure interrupt mode to get the new number of MSI-X
+ * vectors and re-add NAPI objects.
+ */
+static void bnx2x_change_num_queues(struct bnx2x *bp, int num_rss)
+{
+	bnx2x_del_all_napi(bp);
+	bnx2x_disable_msi(bp);
+	BNX2X_NUM_QUEUES(bp) = num_rss + NON_ETH_CONTEXT_USE;

The NON_ETH_CONTEXT_USE queues could possibly be counted as 'other'. Depends on how closely they are associated with the net device.

Quoted 16 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +16 -0
+	bnx2x_set_int_mode(bp);
+	bnx2x_add_all_napi(bp);
+}
+
+/**
+ * bnx2x_set_channels - sets the number of RSS queues.
+ *
+ * @dev:		net device
+ * @channels:		includes the number of queues requested
+ */
+static int bnx2x_set_channels(struct net_device *dev,
+			      struct ethtool_channels *channels)
+{
+	struct bnx2x *bp = netdev_priv(dev);
+
+

drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c static int bnx2x_set_rxfh_indir(struct net_device *dev, const u32 *indir) · line 2867

Quoted 10 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +10 -0
+	DP(BNX2X_MSG_ETHTOOL,
+	   "set-channels command parameters: rx = %d, tx = %d, other = %d, combined = %d\n",
+	   channels->rx_count, channels->tx_count, channels->other_count,
+	   channels->combined_count);
+
+	/* We don't support separate rx / tx channels.
+	 * We don't allow setting 'other' channels.
+	 */
+	if (channels->rx_count || channels->tx_count || channels->other_count
+	    || (channels->combined_count > BNX2X_MAX_RSS_COUNT(bp))) {

Missing a check for combined_count == 0.

Ben.

Quoted 22 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +22 -0
+		DP(BNX2X_MSG_ETHTOOL, "command parameters not supported\n");
+		return -EINVAL;
+	}
+
+	/* Check if there was a change in the active parameters */
+	if (channels->combined_count == BNX2X_NUM_ETH_QUEUES(bp)) {
+		DP(BNX2X_MSG_ETHTOOL, "No change in active parameters\n");
+		return 0;
+	}
+
+	/* Set the requested number of queues in bp context.
+	 * Note that the actual number of queues created during load may be
+	 * less than requested if memory is low.
+	 */
+	if (unlikely(!netif_running(dev))) {
+		bnx2x_change_num_queues(bp, channels->combined_count);
+		return 0;
+	}
+	bnx2x_nic_unload(bp, UNLOAD_NORMAL);
+	bnx2x_change_num_queues(bp, channels->combined_count);
+	return bnx2x_nic_load(bp, LOAD_NORMAL);
+}

[...]

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.
#18 lore raw

Re: [net-next patch 8/12] bnx2x: Allow up to 63 RSS queues default 8 queues

In reply to David Miller
Quoted 7 lines · David Miller

From: "Merav Sicron" <[email protected]>
Date: Thu, 14 Jun 2012 18:34:06 +0300

Quoted 3 lines

That's why we think (and so does Eric Dumazet) that it is better to have a smaller default number which is good for most cases. Do you agree with that?

Quoted 9 lines

What I think is that the thing which is more important than the default we choose, is that it is consistently followed by all multiqueue drivers.

By blazing your own unique path here, that is nearly guaranteed not to happen.

I'd much rather have a bad default that every driver adheres to.

The increasing number of CPUs together with the increasing number of supported MSI-X vectors per device, is causing a lot of memory to be allocated for the networking channels. This is a problem on low memory platforms such as 32bits installations. 64 queues per device (and in most cases, there are few devices) is a becoming a real problem.

If the device does not implement the ethtool .set_channels operation, then the default is practically the only way to go, and there is no such thing as a good default - it really depends on the use case. This is the reason why we are only setting the default in the series that adds support for this operation.

So what do you say about setting a new default only for devices that supports .set_channels? There are only 2 of those right now (qlcnic, bnx2 and hopefully bnx2x soon). Is it acceptable to keep the default hard coded value or do you want it to be configurable? If the latter, is a kernel parameter a valid option?

Please note that today, on a system with enough CPUs, you cannot really tell how many channels will be created per device - each vendor is allocating up to its HW limit - usually 8 or 16, but there is no easy way to determine it beside reading the code. So adding a kernel parameter to limit the number can actually increase the consistency.

Thanks,
Eilon

maintainer
#19 lore raw

Re: [net-next patch 8/12] bnx2x: Allow up to 63 RSS queues default 8 queues

If you're not going to read what I wrote, don't pretend that you did. That really irritates me and makes me want to not review or apply your patches.

I didn't say that there wasn't a problem.

I said that I don't want you to just blaze your own trail without getting agreement and coordinating to adjust the other drivers in unison as well. I refuse to allow you to just change the default of your driver and then well... maybe other drivers follow and maybe others do not. That hodge-podge inconsistent situation sucks for users.

So now are you going to try again to explain the problem to me or are you going to understand what my actual concern is?

Thanks.

#20 lore raw

Re: [net-next patch 8/12] bnx2x: Allow up to 63 RSS queues default 8 queues

Quoted 13 lines · David Miller

If you're not going to read what I wrote, don't pretend that you did. That really irritates me and makes me want to not review or apply your patches.

I didn't say that there wasn't a problem.

I said that I don't want you to just blaze your own trail without getting agreement and coordinating to adjust the other drivers in unison as well. I refuse to allow you to just change the default of your driver and then well... maybe other drivers follow and maybe others do not. That hodge-podge inconsistent situation sucks for users.

Quoted 3 lines

So now are you going to try again to explain the problem to me or are you going to understand what my actual concern is?

I understood what you are saying, and if it looks like I was still pushing for this patch to be accepted then I apologize, it is not what I'm trying to do. What I am trying to do now, is to find a way to set a default for all drivers. Since set_channels is applicable to only two drivers now, it does not sound like a good path - so I was asking if you can consider a kernel parameter as acceptable path. To be clear, I'm asking if adding the default for all multi-queue drivers in the form of a kernel parameter is a good path to explore.

maintainer
#21 lore raw

Re: [net-next patch 8/12] bnx2x: Allow up to 63 RSS queues default 8 queues

From: "Eilon Greenstein" <[email protected]>
Date: Sun, 17 Jun 2012 11:33:56 +0300

Quoted 4 lines

drivers now, it does not sound like a good path - so I was asking if you can consider a kernel parameter as acceptable path. To be clear, I'm asking if adding the default for all multi-queue drivers in the form of a kernel parameter is a good path to explore.

If it's the default, there's no need for a kernel command line parameter. Those suck, just pick a good default.

#22 lore raw

Re: [net-next patch 8/12] bnx2x: Allow up to 63 RSS queues default 8 queues

Quoted 11 lines · David Miller

From: "Eilon Greenstein" <[email protected]>
Date: Sun, 17 Jun 2012 11:33:56 +0300

Quoted 4 lines

drivers now, it does not sound like a good path - so I was asking if you can consider a kernel parameter as acceptable path. To be clear, I'm asking if adding the default for all multi-queue drivers in the form of a kernel parameter is a good path to explore.

If it's the default, there's no need for a kernel command line parameter. Those suck, just pick a good default.

OK. So we will send an RFC series setting the default (hard coded define) to 8 for all multi-queue drivers and that will start a discussion if this is a good default number or not. The side-effect of this series will be that drivers that did not implement set_channels will not be able to change this default back to the HW limit like they run today (assuming the HW limit is higher than the chosen default).

On top of that, we will send this series for the bnx2x again without any default -allowing up to 64 queues unless set_channels is used.

Eilon