netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/5] bnx2x: Bug fixes patch series
@ 2013-08-27 22:12 Yuval Mintz
  2013-08-27 22:13 ` [PATCH net 1/5] bnx2x: vf mark stats started Yuval Mintz
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Yuval Mintz @ 2013-08-27 22:12 UTC (permalink / raw)
  To: davem, netdev; +Cc: ariele, eilong

Hi Dave,

This patch series contains VF bug fixes (with the exception of one unrelated
bug fix).

Please consider applying these patches to `net'.

Thanks,
Yuval Mintz

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

* [PATCH net 1/5] bnx2x: vf mark stats started
  2013-08-27 22:12 [PATCH net 0/5] bnx2x: Bug fixes patch series Yuval Mintz
@ 2013-08-27 22:13 ` Yuval Mintz
  2013-08-27 22:13 ` [PATCH net 2/5] bnx2x: Fix move FP memory deallocations Yuval Mintz
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Yuval Mintz @ 2013-08-27 22:13 UTC (permalink / raw)
  To: davem, netdev; +Cc: ariele, eilong, Yuval Mintz

From: Ariel Elior <ariele@broadcom.com>

Solve issue where no stats were being collected for VF devices due to missing
configuration in the stats' atomic synchronization mechanism.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
index d63d132..fed9b15 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
@@ -522,20 +522,16 @@ static void bnx2x_func_stats_init(struct bnx2x *bp)
 /* should be called under stats_sema */
 static void __bnx2x_stats_start(struct bnx2x *bp)
 {
-	/* vfs travel through here as part of the statistics FSM, but no action
-	 * is required
-	 */
-	if (IS_VF(bp))
-		return;
-
-	if (bp->port.pmf)
-		bnx2x_port_stats_init(bp);
+	if (IS_PF(bp)) {
+		if (bp->port.pmf)
+			bnx2x_port_stats_init(bp);
 
-	else if (bp->func_stx)
-		bnx2x_func_stats_init(bp);
+		else if (bp->func_stx)
+			bnx2x_func_stats_init(bp);
 
-	bnx2x_hw_stats_post(bp);
-	bnx2x_storm_stats_post(bp);
+		bnx2x_hw_stats_post(bp);
+		bnx2x_storm_stats_post(bp);
+	}
 
 	bp->stats_started = true;
 }
-- 
1.8.1.227.g44fe835

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

* [PATCH net 2/5] bnx2x: Fix move FP memory deallocations
  2013-08-27 22:12 [PATCH net 0/5] bnx2x: Bug fixes patch series Yuval Mintz
  2013-08-27 22:13 ` [PATCH net 1/5] bnx2x: vf mark stats started Yuval Mintz
@ 2013-08-27 22:13 ` Yuval Mintz
  2013-08-27 22:13 ` [PATCH net 3/5] bnx2x: Fix functionality of configuring vlan list Yuval Mintz
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Yuval Mintz @ 2013-08-27 22:13 UTC (permalink / raw)
  To: davem, netdev; +Cc: ariele, eilong, Yuval Mintz

If driver will fail to allocate all queues, it will shrink the number of
queues and move the storage queue to its correct place (i.e., the last
queue among the newly supported number).

When changing the pointers of the new location of the FCoE queue, we need
to pay special attention to the aggregations pointer - that memory is allocated
during probe and released upon driver removal. Current implementation has 2
pointers pointing to the same chunk of allocated memory, meaning upon removal
there will be two kfree() of the same chunk while the other won't be released.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index f2d1ff1..26b4dfc 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -53,6 +53,7 @@ static inline void bnx2x_move_fp(struct bnx2x *bp, int from, int to)
 	struct bnx2x_fp_stats *to_fp_stats = &bp->fp_stats[to];
 	int old_max_eth_txqs, new_max_eth_txqs;
 	int old_txdata_index = 0, new_txdata_index = 0;
+	struct bnx2x_agg_info *old_tpa_info = to_fp->tpa_info;
 
 	/* Copy the NAPI object as it has been already initialized */
 	from_fp->napi = to_fp->napi;
@@ -61,6 +62,11 @@ static inline void bnx2x_move_fp(struct bnx2x *bp, int from, int to)
 	memcpy(to_fp, from_fp, sizeof(*to_fp));
 	to_fp->index = to;
 
+	/* Retain the tpa_info of the original `to' version as we don't want
+	 * 2 FPs to contain the same tpa_info pointer.
+	 */
+	to_fp->tpa_info = old_tpa_info;
+
 	/* move sp_objs contents as well, as their indices match fp ones */
 	memcpy(to_sp_objs, from_sp_objs, sizeof(*to_sp_objs));
 
-- 
1.8.1.227.g44fe835

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

* [PATCH net 3/5] bnx2x: Fix functionality of configuring vlan list
  2013-08-27 22:12 [PATCH net 0/5] bnx2x: Bug fixes patch series Yuval Mintz
  2013-08-27 22:13 ` [PATCH net 1/5] bnx2x: vf mark stats started Yuval Mintz
  2013-08-27 22:13 ` [PATCH net 2/5] bnx2x: Fix move FP memory deallocations Yuval Mintz
@ 2013-08-27 22:13 ` Yuval Mintz
  2013-08-27 22:13 ` [PATCH net 4/5] bnx2x: Fix VF memory leak unload Yuval Mintz
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Yuval Mintz @ 2013-08-27 22:13 UTC (permalink / raw)
  To: davem, netdev; +Cc: ariele, eilong, Yuval Mintz

From: Ariel Elior <ariele@broadcom.com>

The check on return code of bnx2x_vfop_config_vlan0() would lead to error
handling flow as the return value indicating an existing pending ramrod would
be erroneously considered as an error.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 37 ++---------------------
 1 file changed, 2 insertions(+), 35 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index ad83f4b..b7efe27 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -522,23 +522,6 @@ static int bnx2x_vfop_set_user_req(struct bnx2x *bp,
 	return 0;
 }
 
-static int
-bnx2x_vfop_config_vlan0(struct bnx2x *bp,
-			struct bnx2x_vlan_mac_ramrod_params *vlan_mac,
-			bool add)
-{
-	int rc;
-
-	vlan_mac->user_req.cmd = add ? BNX2X_VLAN_MAC_ADD :
-		BNX2X_VLAN_MAC_DEL;
-	vlan_mac->user_req.u.vlan.vlan = 0;
-
-	rc = bnx2x_config_vlan_mac(bp, vlan_mac);
-	if (rc == -EEXIST)
-		rc = 0;
-	return rc;
-}
-
 static int bnx2x_vfop_config_list(struct bnx2x *bp,
 				  struct bnx2x_vfop_filters *filters,
 				  struct bnx2x_vlan_mac_ramrod_params *vlan_mac)
@@ -643,30 +626,14 @@ static void bnx2x_vfop_vlan_mac(struct bnx2x *bp, struct bnx2x_virtf *vf)
 
 	case BNX2X_VFOP_VLAN_CONFIG_LIST:
 		/* next state */
-		vfop->state = BNX2X_VFOP_VLAN_CONFIG_LIST_0;
-
-		/* remove vlan0 - could be no-op */
-		vfop->rc = bnx2x_vfop_config_vlan0(bp, vlan_mac, false);
-		if (vfop->rc)
-			goto op_err;
+		vfop->state = BNX2X_VFOP_VLAN_MAC_CHK_DONE;
 
-		/* Do vlan list config. if this operation fails we try to
-		 * restore vlan0 to keep the queue is working order
-		 */
+		/* do list config */
 		vfop->rc = bnx2x_vfop_config_list(bp, filters, vlan_mac);
 		if (!vfop->rc) {
 			set_bit(RAMROD_CONT, &vlan_mac->ramrod_flags);
 			vfop->rc = bnx2x_config_vlan_mac(bp, vlan_mac);
 		}
-		bnx2x_vfop_finalize(vf, vfop->rc, VFOP_CONT); /* fall-through */
-
-	case BNX2X_VFOP_VLAN_CONFIG_LIST_0:
-		/* next state */
-		vfop->state = BNX2X_VFOP_VLAN_MAC_CHK_DONE;
-
-		if (list_empty(&obj->head))
-			/* add vlan0 */
-			vfop->rc = bnx2x_vfop_config_vlan0(bp, vlan_mac, true);
 		bnx2x_vfop_finalize(vf, vfop->rc, VFOP_DONE);
 
 	default:
-- 
1.8.1.227.g44fe835

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

* [PATCH net 4/5] bnx2x: Fix VF memory leak unload
  2013-08-27 22:12 [PATCH net 0/5] bnx2x: Bug fixes patch series Yuval Mintz
                   ` (2 preceding siblings ...)
  2013-08-27 22:13 ` [PATCH net 3/5] bnx2x: Fix functionality of configuring vlan list Yuval Mintz
@ 2013-08-27 22:13 ` Yuval Mintz
  2013-08-27 22:13 ` [PATCH net 5/5] bnx2x: Fix VF stats sync Yuval Mintz
  2013-08-28  2:04 ` [PATCH net 0/5] bnx2x: Bug fixes patch series David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Yuval Mintz @ 2013-08-27 22:13 UTC (permalink / raw)
  To: davem, netdev; +Cc: ariele, eilong, Yuval Mintz

From: Ariel Elior <ariele@broadcom.com>

Due to incorrect VF/PF conditions, when unloading a VF it will not release
part of the memory it has previously allocated.

Signed-off-by: Ariel Elior <ariele@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.c  | 3 ++-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 9 ++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 26b4dfc..0cc2611 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -2962,8 +2962,9 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link)
 	if (IS_PF(bp)) {
 		if (CNIC_LOADED(bp))
 			bnx2x_free_mem_cnic(bp);
-		bnx2x_free_mem(bp);
 	}
+	bnx2x_free_mem(bp);
+
 	bp->state = BNX2X_STATE_CLOSED;
 	bp->cnic_loaded = false;
 
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 8bdc8b9..1627a4e 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -7855,12 +7855,15 @@ void bnx2x_free_mem(struct bnx2x *bp)
 {
 	int i;
 
-	BNX2X_PCI_FREE(bp->def_status_blk, bp->def_status_blk_mapping,
-		       sizeof(struct host_sp_status_block));
-
 	BNX2X_PCI_FREE(bp->fw_stats, bp->fw_stats_mapping,
 		       bp->fw_stats_data_sz + bp->fw_stats_req_sz);
 
+	if (IS_VF(bp))
+		return;
+
+	BNX2X_PCI_FREE(bp->def_status_blk, bp->def_status_blk_mapping,
+		       sizeof(struct host_sp_status_block));
+
 	BNX2X_PCI_FREE(bp->slowpath, bp->slowpath_mapping,
 		       sizeof(struct bnx2x_slowpath));
 
-- 
1.8.1.227.g44fe835

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

* [PATCH net 5/5] bnx2x: Fix VF stats sync
  2013-08-27 22:12 [PATCH net 0/5] bnx2x: Bug fixes patch series Yuval Mintz
                   ` (3 preceding siblings ...)
  2013-08-27 22:13 ` [PATCH net 4/5] bnx2x: Fix VF memory leak unload Yuval Mintz
@ 2013-08-27 22:13 ` Yuval Mintz
  2013-08-28  2:04 ` [PATCH net 0/5] bnx2x: Bug fixes patch series David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Yuval Mintz @ 2013-08-27 22:13 UTC (permalink / raw)
  To: davem, netdev; +Cc: ariele, eilong, Yuval Mintz

From: Ariel Elior <ariele@broadcom.com>

Since the PF gathers statistics for the VF, when the VF is about to unload
we must synchronize the release of its statistics buffer with the PF, so that
no DMA operation will be made to that address after the buffer release.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 26 ++++++++++++++++++++++-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c | 11 ++++++++++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h |  3 +++
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index b7efe27..e8706e1 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -2786,6 +2786,18 @@ int bnx2x_vf_init(struct bnx2x *bp, struct bnx2x_virtf *vf, dma_addr_t *sb_map)
 	return 0;
 }
 
+struct set_vf_state_cookie {
+	struct bnx2x_virtf *vf;
+	u8 state;
+};
+
+void bnx2x_set_vf_state(void *cookie)
+{
+	struct set_vf_state_cookie *p = (struct set_vf_state_cookie *)cookie;
+
+	p->vf->state = p->state;
+}
+
 /* VFOP close (teardown the queues, delete mcasts and close HW) */
 static void bnx2x_vfop_close(struct bnx2x *bp, struct bnx2x_virtf *vf)
 {
@@ -2836,7 +2848,19 @@ static void bnx2x_vfop_close(struct bnx2x *bp, struct bnx2x_virtf *vf)
 op_err:
 	BNX2X_ERR("VF[%d] CLOSE error: rc %d\n", vf->abs_vfid, vfop->rc);
 op_done:
-	vf->state = VF_ACQUIRED;
+
+	/* need to make sure there are no outstanding stats ramrods which may
+	 * cause the device to access the VF's stats buffer which it will free
+	 * as soon as we return from the close flow.
+	 */
+	{
+		struct set_vf_state_cookie cookie;
+
+		cookie.vf = vf;
+		cookie.state = VF_ACQUIRED;
+		bnx2x_stats_safe_exec(bp, bnx2x_set_vf_state, &cookie);
+	}
+
 	DP(BNX2X_MSG_IOV, "set state to acquired\n");
 	bnx2x_vfop_end(bp, vf, vfop);
 }
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
index fed9b15..86436c7 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
@@ -1993,3 +1993,14 @@ void bnx2x_afex_collect_stats(struct bnx2x *bp, void *void_afex_stats,
 		       estats->mac_discard);
 	}
 }
+
+void bnx2x_stats_safe_exec(struct bnx2x *bp,
+			   void (func_to_exec)(void *cookie),
+			   void *cookie){
+	if (down_timeout(&bp->stats_sema, HZ/10))
+		BNX2X_ERR("Unable to acquire stats lock\n");
+	bnx2x_stats_comp(bp);
+	func_to_exec(cookie);
+	__bnx2x_stats_start(bp);
+	up(&bp->stats_sema);
+}
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h
index 853824d..f358450 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h
@@ -539,6 +539,9 @@ struct bnx2x;
 void bnx2x_memset_stats(struct bnx2x *bp);
 void bnx2x_stats_init(struct bnx2x *bp);
 void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event);
+void bnx2x_stats_safe_exec(struct bnx2x *bp,
+			   void (func_to_exec)(void *cookie),
+			   void *cookie);
 
 /**
  * bnx2x_save_statistics - save statistics when unloading.
-- 
1.8.1.227.g44fe835

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

* Re: [PATCH net 0/5] bnx2x: Bug fixes patch series
  2013-08-27 22:12 [PATCH net 0/5] bnx2x: Bug fixes patch series Yuval Mintz
                   ` (4 preceding siblings ...)
  2013-08-27 22:13 ` [PATCH net 5/5] bnx2x: Fix VF stats sync Yuval Mintz
@ 2013-08-28  2:04 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2013-08-28  2:04 UTC (permalink / raw)
  To: yuvalmin; +Cc: netdev, ariele, eilong

From: "Yuval Mintz" <yuvalmin@broadcom.com>
Date: Wed, 28 Aug 2013 01:12:59 +0300

> This patch series contains VF bug fixes (with the exception of one unrelated
> bug fix).
> 
> Please consider applying these patches to `net'.

Series applied, thanks.

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

end of thread, other threads:[~2013-08-28  2:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-27 22:12 [PATCH net 0/5] bnx2x: Bug fixes patch series Yuval Mintz
2013-08-27 22:13 ` [PATCH net 1/5] bnx2x: vf mark stats started Yuval Mintz
2013-08-27 22:13 ` [PATCH net 2/5] bnx2x: Fix move FP memory deallocations Yuval Mintz
2013-08-27 22:13 ` [PATCH net 3/5] bnx2x: Fix functionality of configuring vlan list Yuval Mintz
2013-08-27 22:13 ` [PATCH net 4/5] bnx2x: Fix VF memory leak unload Yuval Mintz
2013-08-27 22:13 ` [PATCH net 5/5] bnx2x: Fix VF stats sync Yuval Mintz
2013-08-28  2:04 ` [PATCH net 0/5] bnx2x: Bug fixes 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).