All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/3] qed: Fix series II.
@ 2018-07-19  5:50 Sudarsana Reddy Kalluru
  2018-07-19  5:50 ` [PATCH net 1/3] qed: Fix link flap issue due to mismatching EEE capabilities Sudarsana Reddy Kalluru
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sudarsana Reddy Kalluru @ 2018-07-19  5:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, Michal.Kalderon, ariel.elior, Sudarsana Reddy Kalluru

From: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>

The patch series fixes few issues in the qed driver.

Please  consider applying it to 'net' branch.

Sudarsana Reddy Kalluru (3):
  qed: Fix link flap issue due to mismatching EEE capabilities.
  qed: Fix possible race for the link state value.
  qed: Correct Multicast API to reflect existence of 256 approximate
    buckets.

 drivers/net/ethernet/qlogic/qed/qed_l2.c    | 15 +++++++--------
 drivers/net/ethernet/qlogic/qed/qed_l2.h    |  2 +-
 drivers/net/ethernet/qlogic/qed/qed_mcp.c   | 13 ++++++++++---
 drivers/net/ethernet/qlogic/qed/qed_sriov.c |  2 +-
 drivers/net/ethernet/qlogic/qed/qed_vf.c    |  4 ++--
 drivers/net/ethernet/qlogic/qed/qed_vf.h    |  7 ++++++-
 6 files changed, 27 insertions(+), 16 deletions(-)

-- 
1.8.3.1

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

* [PATCH net 1/3] qed: Fix link flap issue due to mismatching EEE capabilities.
  2018-07-19  5:50 [PATCH net 0/3] qed: Fix series II Sudarsana Reddy Kalluru
@ 2018-07-19  5:50 ` Sudarsana Reddy Kalluru
  2018-07-19  5:50 ` [PATCH net 2/3] qed: Fix possible race for the link state value Sudarsana Reddy Kalluru
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Sudarsana Reddy Kalluru @ 2018-07-19  5:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, Michal.Kalderon, ariel.elior

Apparently, MFW publishes EEE capabilities even for Fiber-boards that don't
support them, and later since qed internally sets adv_caps it would cause
link-flap avoidance (LFA) to fail when driver would initiate the link.
This in turn delays the link, causing traffic to fail.

Driver has been modified to not to ask MFW for any EEE config if EEE isn't
to be enabled.

Fixes: 645874e5 ("qed: Add support for Energy efficient ethernet.")
Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Ariel Elior <ariel.elior@cavium.com>
Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>
---
 drivers/net/ethernet/qlogic/qed/qed_mcp.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
index 4e0b443..fcd3466 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
@@ -1305,9 +1305,15 @@ int qed_mcp_set_link(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, bool b_up)
 	phy_cfg.pause |= (params->pause.forced_tx) ? ETH_PAUSE_TX : 0;
 	phy_cfg.adv_speed = params->speed.advertised_speeds;
 	phy_cfg.loopback_mode = params->loopback_mode;
-	if (p_hwfn->mcp_info->capabilities & FW_MB_PARAM_FEATURE_SUPPORT_EEE) {
-		if (params->eee.enable)
-			phy_cfg.eee_cfg |= EEE_CFG_EEE_ENABLED;
+
+	/* There are MFWs that share this capability regardless of whether
+	 * this is feasible or not. And given that at the very least adv_caps
+	 * would be set internally by qed, we want to make sure LFA would
+	 * still work.
+	 */
+	if ((p_hwfn->mcp_info->capabilities &
+	     FW_MB_PARAM_FEATURE_SUPPORT_EEE) && params->eee.enable) {
+		phy_cfg.eee_cfg |= EEE_CFG_EEE_ENABLED;
 		if (params->eee.tx_lpi_enable)
 			phy_cfg.eee_cfg |= EEE_CFG_TX_LPI;
 		if (params->eee.adv_caps & QED_EEE_1G_ADV)
-- 
1.8.3.1

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

* [PATCH net 2/3] qed: Fix possible race for the link state value.
  2018-07-19  5:50 [PATCH net 0/3] qed: Fix series II Sudarsana Reddy Kalluru
  2018-07-19  5:50 ` [PATCH net 1/3] qed: Fix link flap issue due to mismatching EEE capabilities Sudarsana Reddy Kalluru
@ 2018-07-19  5:50 ` Sudarsana Reddy Kalluru
  2018-07-19  5:50 ` [PATCH net 3/3] qed: Correct Multicast API to reflect existence of 256 approximate buckets Sudarsana Reddy Kalluru
  2018-07-21 23:19 ` [PATCH net 0/3] qed: Fix series II David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Sudarsana Reddy Kalluru @ 2018-07-19  5:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, Michal.Kalderon, ariel.elior

There's a possible race where driver can read link status in mid-transition
and see that virtual-link is up yet speed is 0. Since in this
mid-transition we're guaranteed to see a mailbox from MFW soon, we can
afford to treat this as link down.

Fixes: cc875c2e ("qed: Add link support")
Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Ariel Elior <ariel.elior@cavium.com>
Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>
---
 drivers/net/ethernet/qlogic/qed/qed_mcp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
index fcd3466..1a12093 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
@@ -1208,6 +1208,7 @@ static void qed_mcp_handle_link_change(struct qed_hwfn *p_hwfn,
 		break;
 	default:
 		p_link->speed = 0;
+		p_link->link_up = 0;
 	}
 
 	if (p_link->link_up && p_link->speed)
-- 
1.8.3.1

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

* [PATCH net 3/3] qed: Correct Multicast API to reflect existence of 256 approximate buckets.
  2018-07-19  5:50 [PATCH net 0/3] qed: Fix series II Sudarsana Reddy Kalluru
  2018-07-19  5:50 ` [PATCH net 1/3] qed: Fix link flap issue due to mismatching EEE capabilities Sudarsana Reddy Kalluru
  2018-07-19  5:50 ` [PATCH net 2/3] qed: Fix possible race for the link state value Sudarsana Reddy Kalluru
@ 2018-07-19  5:50 ` Sudarsana Reddy Kalluru
  2018-07-21 23:19 ` [PATCH net 0/3] qed: Fix series II David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Sudarsana Reddy Kalluru @ 2018-07-19  5:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, Michal.Kalderon, ariel.elior

FW hsi contains 256 approximation buckets which are split in ramrod into
eight u32 values, but driver is using eight 'unsigned long' variables.

This patch fixes the mcast logic by making the API utilize u32.

Fixes: 83aeb933 ("qed*: Trivial modifications")
Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Ariel Elior <ariel.elior@cavium.com>
Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>
---
 drivers/net/ethernet/qlogic/qed/qed_l2.c    | 15 +++++++--------
 drivers/net/ethernet/qlogic/qed/qed_l2.h    |  2 +-
 drivers/net/ethernet/qlogic/qed/qed_sriov.c |  2 +-
 drivers/net/ethernet/qlogic/qed/qed_vf.c    |  4 ++--
 drivers/net/ethernet/qlogic/qed/qed_vf.h    |  7 ++++++-
 5 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c
index 99973e1..5ede640 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_l2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c
@@ -665,7 +665,7 @@ static int qed_sp_vport_start(struct qed_hwfn *p_hwfn,
 
 	p_ramrod->common.update_approx_mcast_flg = 1;
 	for (i = 0; i < ETH_MULTICAST_MAC_BINS_IN_REGS; i++) {
-		u32 *p_bins = (u32 *)p_params->bins;
+		u32 *p_bins = p_params->bins;
 
 		p_ramrod->approx_mcast.bins[i] = cpu_to_le32(p_bins[i]);
 	}
@@ -1476,8 +1476,8 @@ u8 qed_mcast_bin_from_mac(u8 *mac)
 			enum spq_mode comp_mode,
 			struct qed_spq_comp_cb *p_comp_data)
 {
-	unsigned long bins[ETH_MULTICAST_MAC_BINS_IN_REGS];
 	struct vport_update_ramrod_data *p_ramrod = NULL;
+	u32 bins[ETH_MULTICAST_MAC_BINS_IN_REGS];
 	struct qed_spq_entry *p_ent = NULL;
 	struct qed_sp_init_data init_data;
 	u8 abs_vport_id = 0;
@@ -1513,26 +1513,25 @@ u8 qed_mcast_bin_from_mac(u8 *mac)
 	/* explicitly clear out the entire vector */
 	memset(&p_ramrod->approx_mcast.bins, 0,
 	       sizeof(p_ramrod->approx_mcast.bins));
-	memset(bins, 0, sizeof(unsigned long) *
-	       ETH_MULTICAST_MAC_BINS_IN_REGS);
+	memset(bins, 0, sizeof(bins));
 	/* filter ADD op is explicit set op and it removes
 	 *  any existing filters for the vport
 	 */
 	if (p_filter_cmd->opcode == QED_FILTER_ADD) {
 		for (i = 0; i < p_filter_cmd->num_mc_addrs; i++) {
-			u32 bit;
+			u32 bit, nbits;
 
 			bit = qed_mcast_bin_from_mac(p_filter_cmd->mac[i]);
-			__set_bit(bit, bins);
+			nbits = sizeof(u32) * BITS_PER_BYTE;
+			bins[bit / nbits] |= 1 << (bit % nbits);
 		}
 
 		/* Convert to correct endianity */
 		for (i = 0; i < ETH_MULTICAST_MAC_BINS_IN_REGS; i++) {
 			struct vport_update_ramrod_mcast *p_ramrod_bins;
-			u32 *p_bins = (u32 *)bins;
 
 			p_ramrod_bins = &p_ramrod->approx_mcast;
-			p_ramrod_bins->bins[i] = cpu_to_le32(p_bins[i]);
+			p_ramrod_bins->bins[i] = cpu_to_le32(bins[i]);
 		}
 	}
 
diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.h b/drivers/net/ethernet/qlogic/qed/qed_l2.h
index 806a8da..8d80f10 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_l2.h
+++ b/drivers/net/ethernet/qlogic/qed/qed_l2.h
@@ -215,7 +215,7 @@ struct qed_sp_vport_update_params {
 	u8				anti_spoofing_en;
 	u8				update_accept_any_vlan_flg;
 	u8				accept_any_vlan;
-	unsigned long			bins[8];
+	u32				bins[8];
 	struct qed_rss_params		*rss_params;
 	struct qed_filter_accept_flags	accept_flags;
 	struct qed_sge_tpa_params	*sge_tpa_params;
diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c
index fd59cf4..26e918d 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c
@@ -2831,7 +2831,7 @@ void *qed_iov_search_list_tlvs(struct qed_hwfn *p_hwfn,
 
 	p_data->update_approx_mcast_flg = 1;
 	memcpy(p_data->bins, p_mcast_tlv->bins,
-	       sizeof(unsigned long) * ETH_MULTICAST_MAC_BINS_IN_REGS);
+	       sizeof(u32) * ETH_MULTICAST_MAC_BINS_IN_REGS);
 	*tlvs_mask |= 1 << QED_IOV_VP_UPDATE_MCAST;
 }
 
diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.c b/drivers/net/ethernet/qlogic/qed/qed_vf.c
index 2d7fcd6..be6ddde 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_vf.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c
@@ -1126,7 +1126,7 @@ int qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn,
 		resp_size += sizeof(struct pfvf_def_resp_tlv);
 
 		memcpy(p_mcast_tlv->bins, p_params->bins,
-		       sizeof(unsigned long) * ETH_MULTICAST_MAC_BINS_IN_REGS);
+		       sizeof(u32) * ETH_MULTICAST_MAC_BINS_IN_REGS);
 	}
 
 	update_rx = p_params->accept_flags.update_rx_mode_config;
@@ -1272,7 +1272,7 @@ void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn,
 			u32 bit;
 
 			bit = qed_mcast_bin_from_mac(p_filter_cmd->mac[i]);
-			__set_bit(bit, sp_params.bins);
+			sp_params.bins[bit / 32] |= 1 << (bit % 32);
 		}
 	}
 
diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.h b/drivers/net/ethernet/qlogic/qed/qed_vf.h
index 4f05d5e..033409d 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_vf.h
+++ b/drivers/net/ethernet/qlogic/qed/qed_vf.h
@@ -392,7 +392,12 @@ struct vfpf_vport_update_mcast_bin_tlv {
 	struct channel_tlv tl;
 	u8 padding[4];
 
-	u64 bins[8];
+	/* There are only 256 approx bins, and in HSI they're divided into
+	 * 32-bit values. As old VFs used to set-bit to the values on its side,
+	 * the upper half of the array is never expected to contain any data.
+	 */
+	u64 bins[4];
+	u64 obsolete_bins[4];
 };
 
 struct vfpf_vport_update_accept_param_tlv {
-- 
1.8.3.1

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

* Re: [PATCH net 0/3] qed: Fix series II.
  2018-07-19  5:50 [PATCH net 0/3] qed: Fix series II Sudarsana Reddy Kalluru
                   ` (2 preceding siblings ...)
  2018-07-19  5:50 ` [PATCH net 3/3] qed: Correct Multicast API to reflect existence of 256 approximate buckets Sudarsana Reddy Kalluru
@ 2018-07-21 23:19 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2018-07-21 23:19 UTC (permalink / raw)
  To: sudarsana.kalluru; +Cc: netdev, Michal.Kalderon, ariel.elior

From: Sudarsana Reddy Kalluru <sudarsana.kalluru@cavium.com>
Date: Wed, 18 Jul 2018 22:50:01 -0700

> The patch series fixes few issues in the qed driver.
> 
> Please  consider applying it to 'net' branch.

Series applied, thanks.

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

end of thread, other threads:[~2018-07-22  0:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19  5:50 [PATCH net 0/3] qed: Fix series II Sudarsana Reddy Kalluru
2018-07-19  5:50 ` [PATCH net 1/3] qed: Fix link flap issue due to mismatching EEE capabilities Sudarsana Reddy Kalluru
2018-07-19  5:50 ` [PATCH net 2/3] qed: Fix possible race for the link state value Sudarsana Reddy Kalluru
2018-07-19  5:50 ` [PATCH net 3/3] qed: Correct Multicast API to reflect existence of 256 approximate buckets Sudarsana Reddy Kalluru
2018-07-21 23:19 ` [PATCH net 0/3] qed: Fix series II 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.