netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next 0/8] bnx2x feature patch series
@ 2012-03-12 18:53 Yuval Mintz
  2012-03-12 18:53 ` [net-next 1/8] bnx2x: move LLH_CAM to header, apply naming conventions Yuval Mintz
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Yuval Mintz @ 2012-03-12 18:53 UTC (permalink / raw)
  To: davem, netdev; +Cc: Yuval Mintz

Hello Dave,

This patch series contains several small features to the bnx2x driver,
as well as small changes which are mostly semantic, but make the driver's
various flows more uniform.

Please consider applying it to 'net-next'.

Thanks,
Yuval

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

* [net-next 1/8] bnx2x: move LLH_CAM to header, apply naming conventions
  2012-03-12 18:53 [net-next 0/8] bnx2x feature patch series Yuval Mintz
@ 2012-03-12 18:53 ` Yuval Mintz
  2012-03-12 18:53 ` [net-next 2/8] bnx2x: removed unused function bnx2x_queue_set_cos_cid Yuval Mintz
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2012-03-12 18:53 UTC (permalink / raw)
  To: davem, netdev; +Cc: Yuval Mintz, Eilon Greenstein

These definitions are united into the header.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c |   13 ++++---------
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h |    7 +++++++
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index adfae6b..f7896c2 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
@@ -611,12 +611,6 @@ static inline u8 bnx2x_vlan_mac_get_rx_tx_flag(struct bnx2x_vlan_mac_obj *o)
 	return rx_tx_flag;
 }
 
-/* LLH CAM line allocations */
-enum {
-	LLH_CAM_ISCSI_ETH_LINE = 0,
-	LLH_CAM_ETH_LINE,
-	LLH_CAM_MAX_PF_LINE = NIG_REG_LLH1_FUNC_MEM_SIZE / 2
-};
 
 static inline void bnx2x_set_mac_in_nig(struct bnx2x *bp,
 				 bool add, unsigned char *dev_addr, int index)
@@ -625,7 +619,7 @@ static inline void bnx2x_set_mac_in_nig(struct bnx2x *bp,
 	u32 reg_offset = BP_PORT(bp) ? NIG_REG_LLH1_FUNC_MEM :
 			 NIG_REG_LLH0_FUNC_MEM;
 
-	if (!IS_MF_SI(bp) || index > LLH_CAM_MAX_PF_LINE)
+	if (!IS_MF_SI(bp) || index > BNX2X_LLH_CAM_MAX_PF_LINE)
 		return;
 
 	DP(BNX2X_MSG_SP, "Going to %s LLH configuration at entry %d\n",
@@ -731,9 +725,10 @@ static void bnx2x_set_one_mac_e2(struct bnx2x *bp,
 	if (cmd != BNX2X_VLAN_MAC_MOVE) {
 		if (test_bit(BNX2X_ISCSI_ETH_MAC, vlan_mac_flags))
 			bnx2x_set_mac_in_nig(bp, add, mac,
-					     LLH_CAM_ISCSI_ETH_LINE);
+					     BNX2X_LLH_CAM_ISCSI_ETH_LINE);
 		else if (test_bit(BNX2X_ETH_MAC, vlan_mac_flags))
-			bnx2x_set_mac_in_nig(bp, add, mac, LLH_CAM_ETH_LINE);
+			bnx2x_set_mac_in_nig(bp, add, mac,
+					     BNX2X_LLH_CAM_ETH_LINE);
 	}
 
 	/* Reset the ramrod data buffer for the first rule */
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
index 685d42e..0be63e7 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
@@ -423,6 +423,13 @@ struct bnx2x_vlan_mac_obj {
 	int (*wait)(struct bnx2x *bp, struct bnx2x_vlan_mac_obj *o);
 };
 
+enum {
+	BNX2X_LLH_CAM_ISCSI_ETH_LINE = 0,
+	BNX2X_LLH_CAM_ETH_LINE,
+	BNX2X_LLH_CAM_MAX_PF_LINE = NIG_REG_LLH1_FUNC_MEM_SIZE / 2
+};
+
+
 /** RX_MODE verbs:DROP_ALL/ACCEPT_ALL/ACCEPT_ALL_MULTI/ACCEPT_ALL_VLAN/NORMAL */
 
 /* RX_MODE ramrod spesial flags: set in rx_mode_flags field in
-- 
1.7.9.rc2

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

* [net-next 2/8] bnx2x: removed unused function bnx2x_queue_set_cos_cid
  2012-03-12 18:53 [net-next 0/8] bnx2x feature patch series Yuval Mintz
  2012-03-12 18:53 ` [net-next 1/8] bnx2x: move LLH_CAM to header, apply naming conventions Yuval Mintz
@ 2012-03-12 18:53 ` Yuval Mintz
  2012-03-12 18:53 ` [net-next 3/8] bnx2x: set_one_mac_e1x uses raw's state as input Yuval Mintz
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2012-03-12 18:53 UTC (permalink / raw)
  To: davem, netdev; +Cc: Yuval Mintz, Eilon Greenstein

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index f7896c2..2b18ccd 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
@@ -5181,13 +5181,6 @@ void bnx2x_init_queue_obj(struct bnx2x *bp,
 	obj->set_pending = bnx2x_queue_set_pending;
 }
 
-void bnx2x_queue_set_cos_cid(struct bnx2x *bp,
-			     struct bnx2x_queue_sp_obj *obj,
-			     u32 cid, u8 index)
-{
-	obj->cids[index] = cid;
-}
-
 /********************** Function state object *********************************/
 enum bnx2x_func_state bnx2x_func_get_state(struct bnx2x *bp,
 					   struct bnx2x_func_sp_obj *o)
-- 
1.7.9.rc2

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

* [net-next 3/8] bnx2x: set_one_mac_e1x uses raw's state as input
  2012-03-12 18:53 [net-next 0/8] bnx2x feature patch series Yuval Mintz
  2012-03-12 18:53 ` [net-next 1/8] bnx2x: move LLH_CAM to header, apply naming conventions Yuval Mintz
  2012-03-12 18:53 ` [net-next 2/8] bnx2x: removed unused function bnx2x_queue_set_cos_cid Yuval Mintz
@ 2012-03-12 18:53 ` Yuval Mintz
  2012-03-12 18:53 ` [net-next 4/8] bnx2x: use param's id instead of sp_obj's id Yuval Mintz
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2012-03-12 18:53 UTC (permalink / raw)
  To: davem, netdev; +Cc: Yuval Mintz, Eilon Greenstein

Previously, we used a hard-coded value as paramater, instead of using the
input's value. This is now remedied, as in other flows.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index 2b18ccd..f913cdd 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
@@ -864,7 +864,7 @@ static void bnx2x_set_one_mac_e1x(struct bnx2x *bp,
 	/* Reset the ramrod data buffer */
 	memset(config, 0, sizeof(*config));
 
-	bnx2x_vlan_mac_set_rdata_e1x(bp, o, BNX2X_FILTER_MAC_PENDING,
+	bnx2x_vlan_mac_set_rdata_e1x(bp, o, raw->state,
 				     cam_offset, add,
 				     elem->cmd_data.vlan_mac.u.mac.mac, 0,
 				     ETH_VLAN_FILTER_ANY_VLAN, config);
-- 
1.7.9.rc2

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

* [net-next 4/8] bnx2x: use param's id instead of sp_obj's id
  2012-03-12 18:53 [net-next 0/8] bnx2x feature patch series Yuval Mintz
                   ` (2 preceding siblings ...)
  2012-03-12 18:53 ` [net-next 3/8] bnx2x: set_one_mac_e1x uses raw's state as input Yuval Mintz
@ 2012-03-12 18:53 ` Yuval Mintz
  2012-03-12 18:53 ` [net-next 5/8] bnx2x: mark functions as loaded on shared memory Yuval Mintz
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2012-03-12 18:53 UTC (permalink / raw)
  To: davem, netdev; +Cc: Yuval Mintz, Eilon Greenstein

Previously, we've used the object's function id instead of using the
input's value. This is remedied, as in other flows.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |    1 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c   |    2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h   |    3 +++
 3 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index b4afef6..bf14a08 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -2800,6 +2800,7 @@ static void bnx2x_pf_rx_q_prep(struct bnx2x *bp,
 	rxq_init->sge_buf_sz = sge_sz;
 	rxq_init->max_sges_pkt = max_sge;
 	rxq_init->rss_engine_id = BP_FUNC(bp);
+	rxq_init->mcast_engine_id = BP_FUNC(bp);
 
 	/* Maximum number or simultaneous TPA aggregation for this Queue.
 	 *
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index f913cdd..1999fa5 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
@@ -4473,7 +4473,7 @@ static void bnx2x_q_fill_init_rx_data(struct bnx2x_queue_sp_obj *o,
 	rx_data->is_leading_rss = test_bit(BNX2X_Q_FLG_LEADING_RSS, flags);
 
 	if (test_bit(BNX2X_Q_FLG_MCAST, flags)) {
-		rx_data->approx_mcast_engine_id = o->func_id;
+		rx_data->approx_mcast_engine_id = params->mcast_engine_id;
 		rx_data->is_approx_mcast = 1;
 	}
 
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
index 0be63e7..4ce351b 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
@@ -897,6 +897,9 @@ struct bnx2x_rxq_setup_params {
 	u8		max_tpa_queues;
 	u8		rss_engine_id;
 
+	/* valid iff BNX2X_Q_FLG_MCAST */
+	u8		mcast_engine_id;
+
 	u8		cache_line_log;
 
 	u8		sb_cq_index;
-- 
1.7.9.rc2

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

* [net-next 5/8] bnx2x: mark functions as loaded on shared memory
  2012-03-12 18:53 [net-next 0/8] bnx2x feature patch series Yuval Mintz
                   ` (3 preceding siblings ...)
  2012-03-12 18:53 ` [net-next 4/8] bnx2x: use param's id instead of sp_obj's id Yuval Mintz
@ 2012-03-12 18:53 ` Yuval Mintz
  2012-03-12 18:53 ` [net-next 6/8] bnx2x: ethtool now returns unknown speed/duplex Yuval Mintz
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2012-03-12 18:53 UTC (permalink / raw)
  To: davem, netdev; +Cc: Yuval Mintz, Eilon Greenstein

This change enables the FW to make more accurate decisions regarding the
active functions.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index f82dfff..c11e50d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -2007,6 +2007,15 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
 		bnx2x_cnic_notify(bp, CNIC_CTL_START_CMD);
 #endif
 
+	/* mark driver is loaded in shmem2 */
+	if (SHMEM2_HAS(bp, drv_capabilities_flag)) {
+		u32 val;
+		val = SHMEM2_RD(bp, drv_capabilities_flag[BP_FW_MB_IDX(bp)]);
+		SHMEM2_WR(bp, drv_capabilities_flag[BP_FW_MB_IDX(bp)],
+			  val | DRV_FLAGS_CAPABILITIES_LOADED_SUPPORTED |
+			  DRV_FLAGS_CAPABILITIES_LOADED_L2);
+	}
+
 	/* Wait for all pending SP commands to complete */
 	if (!bnx2x_wait_sp_comp(bp, ~0x0UL)) {
 		BNX2X_ERR("Timeout waiting for SP elements to complete\n");
@@ -2060,6 +2069,14 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
 	int i;
 	bool global = false;
 
+	/* mark driver is unloaded in shmem2 */
+	if (SHMEM2_HAS(bp, drv_capabilities_flag)) {
+		u32 val;
+		val = SHMEM2_RD(bp, drv_capabilities_flag[BP_FW_MB_IDX(bp)]);
+		SHMEM2_WR(bp, drv_capabilities_flag[BP_FW_MB_IDX(bp)],
+			  val & ~DRV_FLAGS_CAPABILITIES_LOADED_L2);
+	}
+
 	if ((bp->state == BNX2X_STATE_CLOSED) ||
 	    (bp->state == BNX2X_STATE_ERROR)) {
 		/* We can get here if the driver has been unloaded
-- 
1.7.9.rc2

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

* [net-next 6/8] bnx2x: ethtool now returns unknown speed/duplex
  2012-03-12 18:53 [net-next 0/8] bnx2x feature patch series Yuval Mintz
                   ` (4 preceding siblings ...)
  2012-03-12 18:53 ` [net-next 5/8] bnx2x: mark functions as loaded on shared memory Yuval Mintz
@ 2012-03-12 18:53 ` Yuval Mintz
  2012-03-12 18:53 ` [net-next 7/8] bnx2x: ethtool returns req. AN even when AN fails Yuval Mintz
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2012-03-12 18:53 UTC (permalink / raw)
  To: davem, netdev; +Cc: Yuval Mintz, Eilon Greenstein

Previously, unless both interface and link were up, ethtool returned
the requested speed/duplex when asked for the interface's settings.
This change will now enable the driver to answer correctly (i.e., 
return unknown as its answer).

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c    |   29 ++++++++++++-------
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 9c24d53..8f8421d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -222,20 +222,23 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 		 (SUPPORTED_TP | SUPPORTED_FIBRE));
 	cmd->advertising = bp->port.advertising[cfg_idx];
 
-	if ((bp->state == BNX2X_STATE_OPEN) &&
-	    !(bp->flags & MF_FUNC_DIS) &&
-	    (bp->link_vars.link_up)) {
-		ethtool_cmd_speed_set(cmd, bp->link_vars.line_speed);
-		cmd->duplex = bp->link_vars.duplex;
+	if ((bp->state == BNX2X_STATE_OPEN) && (bp->link_vars.link_up)) {
+		if (!(bp->flags & MF_FUNC_DIS)) {
+			ethtool_cmd_speed_set(cmd, bp->link_vars.line_speed);
+			cmd->duplex = bp->link_vars.duplex;
+		} else {
+			ethtool_cmd_speed_set(
+				cmd, bp->link_params.req_line_speed[cfg_idx]);
+			cmd->duplex = bp->link_params.req_duplex[cfg_idx];
+		}
+
+		if (IS_MF(bp) && !BP_NOMCP(bp))
+			ethtool_cmd_speed_set(cmd, bnx2x_get_mf_speed(bp));
 	} else {
-		ethtool_cmd_speed_set(
-			cmd, bp->link_params.req_line_speed[cfg_idx]);
-		cmd->duplex = bp->link_params.req_duplex[cfg_idx];
+		cmd->duplex = DUPLEX_UNKNOWN;
+		ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
 	}
 
-	if (IS_MF(bp))
-		ethtool_cmd_speed_set(cmd, bnx2x_get_mf_speed(bp));
-
 	cmd->port = bnx2x_get_port_type(bp);
 
 	cmd->phy_address = bp->mdio.prtad;
@@ -309,6 +312,10 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 
 	speed = ethtool_cmd_speed(cmd);
 
+	/* If recieved a request for an unknown duplex, assume full*/
+	if (cmd->duplex == DUPLEX_UNKNOWN)
+		cmd->duplex = DUPLEX_FULL;
+
 	if (IS_MF_SI(bp)) {
 		u32 part;
 		u32 line_speed = bp->link_vars.line_speed;
-- 
1.7.9.rc2

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

* [net-next 7/8] bnx2x: ethtool returns req. AN even when AN fails
  2012-03-12 18:53 [net-next 0/8] bnx2x feature patch series Yuval Mintz
                   ` (5 preceding siblings ...)
  2012-03-12 18:53 ` [net-next 6/8] bnx2x: ethtool now returns unknown speed/duplex Yuval Mintz
@ 2012-03-12 18:53 ` Yuval Mintz
  2012-03-12 18:53 ` [net-next 8/8] bnx2x: code doesn't use stats for allocating Rx BDs Yuval Mintz
  2012-03-13  0:11 ` [net-next 0/8] bnx2x feature patch series David Miller
  8 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2012-03-12 18:53 UTC (permalink / raw)
  To: davem, netdev; +Cc: Yuval Mintz, Eilon Greenstein

Previously, if autoneg failed, ethtool would return the achieved autoneg.
This patch corrects this, causing ethtool to return the requested autoneg
capabilities even if autoneg fails.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c    |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 8f8421d..858d1b5 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -1450,7 +1450,7 @@ static void bnx2x_get_pauseparam(struct net_device *dev,
 			   BNX2X_FLOW_CTRL_AUTO);
 
 	if (!epause->autoneg)
-		cfg_reg = bp->link_vars.flow_ctrl;
+		cfg_reg = bp->link_params.req_flow_ctrl[cfg_idx];
 	else
 		cfg_reg = bp->link_params.req_fc_auto_adv;
 
-- 
1.7.9.rc2

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

* [net-next 8/8] bnx2x: code doesn't use stats for allocating Rx BDs
  2012-03-12 18:53 [net-next 0/8] bnx2x feature patch series Yuval Mintz
                   ` (6 preceding siblings ...)
  2012-03-12 18:53 ` [net-next 7/8] bnx2x: ethtool returns req. AN even when AN fails Yuval Mintz
@ 2012-03-12 18:53 ` Yuval Mintz
  2012-03-13  0:11 ` [net-next 0/8] bnx2x feature patch series David Miller
  8 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2012-03-12 18:53 UTC (permalink / raw)
  To: davem, netdev; +Cc: Dmitry Kravkov, Yuval Mintz, Eilon Greenstein

From: Dmitry Kravkov <dmitry@broadcom.com>

Previously, allocation used queue statistics directly in its calcualtion.
This change causes these calculations to be summed into the statistics,
without being affected by them.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
index 33aa7de..85a1c5d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
@@ -1143,7 +1143,7 @@ static inline int bnx2x_alloc_rx_bds(struct bnx2x_fastpath *fp,
 {
 	struct bnx2x *bp = fp->bp;
 	u16 ring_prod, cqe_ring_prod;
-	int i;
+	int i, failure_cnt = 0;
 
 	fp->rx_comp_cons = 0;
 	cqe_ring_prod = ring_prod = 0;
@@ -1153,18 +1153,17 @@ static inline int bnx2x_alloc_rx_bds(struct bnx2x_fastpath *fp,
 	 */
 	for (i = 0; i < rx_ring_size; i++) {
 		if (bnx2x_alloc_rx_data(bp, fp, ring_prod) < 0) {
-			fp->eth_q_stats.rx_skb_alloc_failed++;
+			failure_cnt++;
 			continue;
 		}
 		ring_prod = NEXT_RX_IDX(ring_prod);
 		cqe_ring_prod = NEXT_RCQ_IDX(cqe_ring_prod);
-		WARN_ON(ring_prod <= (i - fp->eth_q_stats.rx_skb_alloc_failed));
+		WARN_ON(ring_prod <= (i - failure_cnt));
 	}
 
-	if (fp->eth_q_stats.rx_skb_alloc_failed)
-		BNX2X_ERR("was only able to allocate "
-			  "%d rx skbs on queue[%d]\n",
-			  (i - fp->eth_q_stats.rx_skb_alloc_failed), fp->index);
+	if (failure_cnt)
+		BNX2X_ERR("was only able to allocate %d rx skbs on queue[%d]\n",
+			  i - failure_cnt, fp->index);
 
 	fp->rx_bd_prod = ring_prod;
 	/* Limit the CQE producer by the CQE ring size */
@@ -1172,7 +1171,9 @@ static inline int bnx2x_alloc_rx_bds(struct bnx2x_fastpath *fp,
 			       cqe_ring_prod);
 	fp->rx_pkt = fp->rx_calls = 0;
 
-	return i - fp->eth_q_stats.rx_skb_alloc_failed;
+	fp->eth_q_stats.rx_skb_alloc_failed += failure_cnt;
+
+	return i - failure_cnt;
 }
 
 /* Statistics ID are global per chip/path, while Client IDs for E1x are per
-- 
1.7.9.rc2

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

* Re: [net-next 0/8] bnx2x feature patch series
  2012-03-12 18:53 [net-next 0/8] bnx2x feature patch series Yuval Mintz
                   ` (7 preceding siblings ...)
  2012-03-12 18:53 ` [net-next 8/8] bnx2x: code doesn't use stats for allocating Rx BDs Yuval Mintz
@ 2012-03-13  0:11 ` David Miller
  8 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2012-03-13  0:11 UTC (permalink / raw)
  To: yuvalmin; +Cc: netdev

From: "Yuval Mintz" <yuvalmin@broadcom.com>
Date: Mon, 12 Mar 2012 14:53:06 -0400

> This patch series contains several small features to the bnx2x driver,
> as well as small changes which are mostly semantic, but make the driver's
> various flows more uniform.
> 
> Please consider applying it to 'net-next'.

All applied, thanks.

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

end of thread, other threads:[~2012-03-13  0:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-12 18:53 [net-next 0/8] bnx2x feature patch series Yuval Mintz
2012-03-12 18:53 ` [net-next 1/8] bnx2x: move LLH_CAM to header, apply naming conventions Yuval Mintz
2012-03-12 18:53 ` [net-next 2/8] bnx2x: removed unused function bnx2x_queue_set_cos_cid Yuval Mintz
2012-03-12 18:53 ` [net-next 3/8] bnx2x: set_one_mac_e1x uses raw's state as input Yuval Mintz
2012-03-12 18:53 ` [net-next 4/8] bnx2x: use param's id instead of sp_obj's id Yuval Mintz
2012-03-12 18:53 ` [net-next 5/8] bnx2x: mark functions as loaded on shared memory Yuval Mintz
2012-03-12 18:53 ` [net-next 6/8] bnx2x: ethtool now returns unknown speed/duplex Yuval Mintz
2012-03-12 18:53 ` [net-next 7/8] bnx2x: ethtool returns req. AN even when AN fails Yuval Mintz
2012-03-12 18:53 ` [net-next 8/8] bnx2x: code doesn't use stats for allocating Rx BDs Yuval Mintz
2012-03-13  0:11 ` [net-next 0/8] bnx2x feature patch series David Miller

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