All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] bnx2x: enhancement patch series
@ 2013-06-20 14:39 Yuval Mintz
  2013-06-20 14:39 ` [PATCH net-next 1/4] bnx2x: Improve PF behaviour toward VF Yuval Mintz
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Yuval Mintz @ 2013-06-20 14:39 UTC (permalink / raw)
  To: davem, netdev; +Cc: eilong, ariele

Hi Dave,

This patch series mostly revolves around improving SR-IOV implementation
(Better PF-VF relation, sanity checks and timings), as well as including
a patch correcting the (outward) advertisement of 20G capabilities.

Please consider applying these patches to `net-next'.

Thanks,
Yuval Mintz

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

* [PATCH net-next 1/4] bnx2x: Improve PF behaviour toward VF
  2013-06-20 14:39 [PATCH net-next 0/4] bnx2x: enhancement patch series Yuval Mintz
@ 2013-06-20 14:39 ` Yuval Mintz
  2013-06-20 14:39 ` [PATCH net-next 2/4] bnx2x: VF ndo sanity Yuval Mintz
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Yuval Mintz @ 2013-06-20 14:39 UTC (permalink / raw)
  To: davem, netdev; +Cc: eilong, ariele, Yuval Mintz

From: Ariel Elior <ariele@broadcom.com>

If PF is unloaded with loaded VFs, signal towards VFs so they can detect
this gracefully.

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.h       |  2 ++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c   |  3 +++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c  | 23 +++++++++++++++++++---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 24 ++++++++++++++++++++---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h |  2 ++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c  | 12 +++++++++++-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h  |  5 ++++-
 7 files changed, 63 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index f76597e..80346d5 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -1205,6 +1205,7 @@ enum {
 	BNX2X_SP_RTNL_AFEX_F_UPDATE,
 	BNX2X_SP_RTNL_ENABLE_SRIOV,
 	BNX2X_SP_RTNL_VFPF_MCAST,
+	BNX2X_SP_RTNL_VFPF_CHANNEL_DOWN,
 	BNX2X_SP_RTNL_VFPF_STORM_RX_MODE,
 	BNX2X_SP_RTNL_HYPERVISOR_VLAN,
 };
@@ -1375,6 +1376,7 @@ struct bnx2x {
 #define USING_SINGLE_MSIX_FLAG		(1 << 20)
 #define BC_SUPPORTS_DCBX_MSG_NON_PMF	(1 << 21)
 #define IS_VF_FLAG			(1 << 22)
+#define INTERRUPTS_ENABLED_FLAG		(1 << 23)
 
 #define BP_NOMCP(bp)			((bp)->flags & NO_MCP_FLAG)
 
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 4e42bdd..9086d827 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -2857,6 +2857,9 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link)
 	bp->state = BNX2X_STATE_CLOSING_WAIT4_HALT;
 	smp_mb();
 
+	/* indicate to VFs that the PF is going down */
+	bnx2x_iov_channel_down(bp);
+
 	if (CNIC_LOADED(bp))
 		bnx2x_cnic_notify(bp, CNIC_CTL_STOP_CMD);
 
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 658b9fd..12cc701 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -5458,9 +5458,19 @@ static void bnx2x_timer(unsigned long data)
 		bnx2x_stats_handle(bp, STATS_EVENT_UPDATE);
 
 	/* sample pf vf bulletin board for new posts from pf */
-	if (IS_VF(bp))
+	if (IS_VF(bp)) {
 		bnx2x_sample_bulletin(bp);
 
+		/* if channel is down we need to self destruct */
+		if (bp->old_bulletin.valid_bitmap & 1 << CHANNEL_DOWN) {
+			smp_mb__before_clear_bit();
+			set_bit(BNX2X_SP_RTNL_VFPF_CHANNEL_DOWN,
+				&bp->sp_rtnl_state);
+			smp_mb__after_clear_bit();
+			schedule_delayed_work(&bp->sp_rtnl_task, 0);
+		}
+	}
+
 	mod_timer(&bp->timer, jiffies + bp->current_interval);
 }
 
@@ -9621,6 +9631,13 @@ sp_rtnl_not_reset:
 		   "sending set mcast vf pf channel message from rtnl sp-task\n");
 		bnx2x_vfpf_set_mcast(bp->dev);
 	}
+	if (test_and_clear_bit(BNX2X_SP_RTNL_VFPF_CHANNEL_DOWN,
+			       &bp->sp_rtnl_state)){
+		if (!test_bit(__LINK_STATE_NOCARRIER, &bp->dev->state)) {
+			bnx2x_tx_disable(bp);
+			BNX2X_ERR("PF indicated channel is not servicable anymore. This means this VF device is no longer operational\n");
+		}
+	}
 
 	if (test_and_clear_bit(BNX2X_SP_RTNL_VFPF_STORM_RX_MODE,
 			       &bp->sp_rtnl_state)) {
@@ -12813,6 +12830,8 @@ static void __bnx2x_remove(struct pci_dev *pdev,
 		rtnl_unlock();
 	}
 
+	bnx2x_iov_remove_one(bp);
+
 	/* Power on: we can't let PCI layer write to us while we are in D3 */
 	if (IS_PF(bp))
 		bnx2x_set_power_state(bp, PCI_D0);
@@ -12827,8 +12846,6 @@ static void __bnx2x_remove(struct pci_dev *pdev,
 	/* Make sure RESET task is not scheduled before continuing */
 	cancel_delayed_work_sync(&bp->sp_rtnl_task);
 
-	bnx2x_iov_remove_one(bp);
-
 	/* send message via vfpf channel to release the resources of this vf */
 	if (IS_VF(bp))
 		bnx2x_vfpf_release(bp);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index 8a556dd..2a8ad6d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -1459,13 +1459,11 @@ static u8 bnx2x_vf_is_pcie_pending(struct bnx2x *bp, u8 abs_vfid)
 	struct bnx2x_virtf *vf = bnx2x_vf_by_abs_fid(bp, abs_vfid);
 
 	if (!vf)
-		goto unknown_dev;
+		return false;
 
 	dev = pci_get_bus_and_slot(vf->bus, vf->devfn);
 	if (dev)
 		return bnx2x_is_pcie_pending(dev);
-
-unknown_dev:
 	return false;
 }
 
@@ -3469,3 +3467,23 @@ int bnx2x_open_epilog(struct bnx2x *bp)
 
 	return 0;
 }
+
+void bnx2x_iov_channel_down(struct bnx2x *bp)
+{
+	int vf_idx;
+	struct pf_vf_bulletin_content *bulletin;
+
+	if (!IS_SRIOV(bp))
+		return;
+
+	for_each_vf(bp, vf_idx) {
+		/* locate this VFs bulletin board and update the channel down
+		 * bit
+		 */
+		bulletin = BP_VF_BULLETIN(bp, vf_idx);
+		bulletin->valid_bitmap |= 1 << CHANNEL_DOWN;
+
+		/* update vf bulletin board */
+		bnx2x_post_vf_bulletin(bp, vf_idx);
+	}
+}
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
index f08c604..ff153a3 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
@@ -761,6 +761,7 @@ static inline int bnx2x_vf_headroom(struct bnx2x *bp)
 }
 void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp);
 int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs);
+void bnx2x_iov_channel_down(struct bnx2x *bp);
 int bnx2x_open_epilog(struct bnx2x *bp);
 
 #else /* CONFIG_BNX2X_SRIOV */
@@ -817,6 +818,7 @@ static inline void __iomem *bnx2x_vf_doorbells(struct bnx2x *bp)
 static inline int bnx2x_vf_pci_alloc(struct bnx2x *bp) {return 0; }
 static inline void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp) {}
 static inline int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs) {return 0; }
+static inline void bnx2x_iov_channel_down(struct bnx2x *bp) {}
 static inline int bnx2x_open_epilog(struct bnx2x *bp) {return 0; }
 
 #endif /* CONFIG_BNX2X_SRIOV */
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
index 861809d..4983b73 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
@@ -113,7 +113,7 @@ static int bnx2x_send_msg2pf(struct bnx2x *bp, u8 *done, dma_addr_t msg_mapping)
 {
 	struct cstorm_vf_zone_data __iomem *zone_data =
 		REG_ADDR(bp, PXP_VF_ADDR_CSDM_GLOBAL_START);
-	int tout = 600, interval = 100; /* wait for 60 seconds */
+	int tout = 100, interval = 100; /* wait for 10 seconds */
 
 	if (*done) {
 		BNX2X_ERR("done was non zero before message to pf was sent\n");
@@ -121,6 +121,16 @@ static int bnx2x_send_msg2pf(struct bnx2x *bp, u8 *done, dma_addr_t msg_mapping)
 		return -EINVAL;
 	}
 
+	/* if PF indicated channel is down avoid sending message. Return success
+	 * so calling flow can continue
+	 */
+	bnx2x_sample_bulletin(bp);
+	if (bp->old_bulletin.valid_bitmap & 1 << CHANNEL_DOWN) {
+		DP(BNX2X_MSG_IOV, "detecting channel down. Aborting message\n");
+		*done = PFVF_STATUS_SUCCESS;
+		return 0;
+	}
+
 	/* Write message address */
 	writel(U64_LO(msg_mapping),
 	       &zone_data->non_trigger.vf_pf_channel.msg_addr_lo);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h
index 41708fa..f3ad174 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h
@@ -331,7 +331,10 @@ struct pf_vf_bulletin_content {
 #define VLAN_VALID		1	/* when set, the vf should not access
 					 * the vfpf channel
 					 */
-
+#define CHANNEL_DOWN		2	/* vfpf channel is disabled. VFs are not
+					 * to attempt to send messages on the
+					 * channel after this bit is set
+					 */
 	u8 mac[ETH_ALEN];
 	u8 mac_padding[2];
 
-- 
1.8.1.227.g44fe835

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

* [PATCH net-next 2/4] bnx2x: VF ndo sanity
  2013-06-20 14:39 [PATCH net-next 0/4] bnx2x: enhancement patch series Yuval Mintz
  2013-06-20 14:39 ` [PATCH net-next 1/4] bnx2x: Improve PF behaviour toward VF Yuval Mintz
@ 2013-06-20 14:39 ` Yuval Mintz
  2013-06-20 14:39 ` [PATCH net-next 3/4] bnx2x: improve VF timings Yuval Mintz
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Yuval Mintz @ 2013-06-20 14:39 UTC (permalink / raw)
  To: davem, netdev; +Cc: eilong, ariele, Yuval Mintz

From: Ariel Elior <ariele@broadcom.com>

If iproute2 VF callbacks are invoked before PF is loaded,
abort gracefully.

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 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index 2a8ad6d..f6177ba 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -3083,6 +3083,11 @@ void bnx2x_disable_sriov(struct bnx2x *bp)
 static int bnx2x_vf_ndo_sanity(struct bnx2x *bp, int vfidx,
 			       struct bnx2x_virtf *vf)
 {
+	if (bp->state != BNX2X_STATE_OPEN) {
+		BNX2X_ERR("vf ndo called though PF is down\n");
+		return -EINVAL;
+	}
+
 	if (!IS_SRIOV(bp)) {
 		BNX2X_ERR("vf ndo called though sriov is disabled\n");
 		return -EINVAL;
-- 
1.8.1.227.g44fe835

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

* [PATCH net-next 3/4] bnx2x: improve VF timings
  2013-06-20 14:39 [PATCH net-next 0/4] bnx2x: enhancement patch series Yuval Mintz
  2013-06-20 14:39 ` [PATCH net-next 1/4] bnx2x: Improve PF behaviour toward VF Yuval Mintz
  2013-06-20 14:39 ` [PATCH net-next 2/4] bnx2x: VF ndo sanity Yuval Mintz
@ 2013-06-20 14:39 ` Yuval Mintz
  2013-06-20 14:39 ` [PATCH net-next 04/04] bnx2x: Fix 20G KR2 support claims Yuval Mintz
  2013-06-24  6:54 ` [PATCH net-next 0/4] bnx2x: enhancement patch series David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Yuval Mintz @ 2013-06-20 14:39 UTC (permalink / raw)
  To: davem, netdev; +Cc: eilong, ariele, Yuval Mintz

From: Ariel Elior <ariele@broadcom.com>

Wait 100ms for FLR to complete in parallel over all VFs instead of serializing
the waits (which can amount to several seconds with 64 VFs).

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 | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index f6177ba..bda4d7e 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -1469,9 +1469,6 @@ static u8 bnx2x_vf_is_pcie_pending(struct bnx2x *bp, u8 abs_vfid)
 
 int bnx2x_vf_flr_clnup_epilog(struct bnx2x *bp, u8 abs_vfid)
 {
-	/* Wait 100ms */
-	msleep(100);
-
 	/* Verify no pending pci transactions */
 	if (bnx2x_vf_is_pcie_pending(bp, abs_vfid))
 		BNX2X_ERR("PCIE Transactions still pending\n");
@@ -2174,6 +2171,9 @@ int bnx2x_iov_nic_init(struct bnx2x *bp)
 
 	DP(BNX2X_MSG_IOV, "num of vfs: %d\n", (bp)->vfdb->sriov.nr_virtfn);
 
+	/* let FLR complete ... */
+	msleep(100);
+
 	/* initialize vf database */
 	for_each_vf(bp, vfid) {
 		struct bnx2x_virtf *vf = BP_VF(bp, vfid);
@@ -2775,6 +2775,10 @@ int bnx2x_vf_init(struct bnx2x *bp, struct bnx2x_virtf *vf, dma_addr_t *sb_map)
 		   vf->abs_vfid, vf->state);
 		return -EINVAL;
 	}
+
+	/* let FLR complete ... */
+	msleep(100);
+
 	/* FLR cleanup epilogue */
 	if (bnx2x_vf_flr_clnup_epilog(bp, vf->abs_vfid))
 		return -EBUSY;
-- 
1.8.1.227.g44fe835

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

* [PATCH net-next 04/04] bnx2x: Fix 20G KR2 support claims
  2013-06-20 14:39 [PATCH net-next 0/4] bnx2x: enhancement patch series Yuval Mintz
                   ` (2 preceding siblings ...)
  2013-06-20 14:39 ` [PATCH net-next 3/4] bnx2x: improve VF timings Yuval Mintz
@ 2013-06-20 14:39 ` Yuval Mintz
  2013-06-24  6:54 ` [PATCH net-next 0/4] bnx2x: enhancement patch series David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Yuval Mintz @ 2013-06-20 14:39 UTC (permalink / raw)
  To: davem, netdev; +Cc: eilong, ariele, Yaniv Rosner, Yuval Mintz

From: Yaniv Rosner <yanivr@broadcom.com>

Don't claim 20G is supported if the speed is unsupported by the phys
(reflected by various ethtools and ndos).

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 12cc701..ba3e7e8 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -10559,6 +10559,10 @@ static void bnx2x_link_settings_supported(struct bnx2x *bp, u32 switch_cfg)
 		if (!(bp->link_params.speed_cap_mask[idx] &
 					PORT_HW_CFG_SPEED_CAPABILITY_D0_10G))
 			bp->port.supported[idx] &= ~SUPPORTED_10000baseT_Full;
+
+		if (!(bp->link_params.speed_cap_mask[idx] &
+					PORT_HW_CFG_SPEED_CAPABILITY_D0_20G))
+			bp->port.supported[idx] &= ~SUPPORTED_20000baseKR2_Full;
 	}
 
 	BNX2X_DEV_INFO("supported 0x%x 0x%x\n", bp->port.supported[0],
-- 
1.8.1.227.g44fe835

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

* Re: [PATCH net-next 0/4] bnx2x: enhancement patch series
  2013-06-20 14:39 [PATCH net-next 0/4] bnx2x: enhancement patch series Yuval Mintz
                   ` (3 preceding siblings ...)
  2013-06-20 14:39 ` [PATCH net-next 04/04] bnx2x: Fix 20G KR2 support claims Yuval Mintz
@ 2013-06-24  6:54 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2013-06-24  6:54 UTC (permalink / raw)
  To: yuvalmin; +Cc: netdev, eilong, ariele

From: "Yuval Mintz" <yuvalmin@broadcom.com>
Date: Thu, 20 Jun 2013 17:39:07 +0300

> This patch series mostly revolves around improving SR-IOV implementation
> (Better PF-VF relation, sanity checks and timings), as well as including
> a patch correcting the (outward) advertisement of 20G capabilities.
> 
> Please consider applying these patches to `net-next'.

Series applied, thanks.

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

end of thread, other threads:[~2013-06-24  6:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-20 14:39 [PATCH net-next 0/4] bnx2x: enhancement patch series Yuval Mintz
2013-06-20 14:39 ` [PATCH net-next 1/4] bnx2x: Improve PF behaviour toward VF Yuval Mintz
2013-06-20 14:39 ` [PATCH net-next 2/4] bnx2x: VF ndo sanity Yuval Mintz
2013-06-20 14:39 ` [PATCH net-next 3/4] bnx2x: improve VF timings Yuval Mintz
2013-06-20 14:39 ` [PATCH net-next 04/04] bnx2x: Fix 20G KR2 support claims Yuval Mintz
2013-06-24  6:54 ` [PATCH net-next 0/4] bnx2x: enhancement patch series David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.