Skip to contentSkip to conversation

qed*: SmartAN query support

PATCH In review Sudarsana Reddy Kalluru 3 participants 9 messages Feb 7, 2019 – Feb 9, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover qed*: SmartAN query support

SmartAN feature detects the peer/cable capabilities and establishes the link in the best possible configuration.
The patch series adds support for querying the capability. Please consider applying it net-next.

Sudarsana Reddy Kalluru (2):
qed: Add API for SmartAN query.
qede: Add ethtool interface for SmartAN query.

 drivers/net/ethernet/qlogic/qed/qed_hsi.h       |  1 +
 drivers/net/ethernet/qlogic/qed/qed_main.c      |  2 ++
 drivers/net/ethernet/qlogic/qed/qed_mcp.c       |  6 ++++++
 drivers/net/ethernet/qlogic/qed/qed_mcp.h       | 10 ++++++++++
 drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 11 ++++++++++-
 include/linux/qed/qed_if.h                      |  1 +
 6 files changed, 30 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/2 qed: Add API for SmartAN query.

The patch adds driver interface to read the SmartAN capability from management firmware.

---
 drivers/net/ethernet/qlogic/qed/qed_hsi.h  |  1 +
 drivers/net/ethernet/qlogic/qed/qed_main.c |  2 ++
 drivers/net/ethernet/qlogic/qed/qed_mcp.c  |  6 ++++++
 drivers/net/ethernet/qlogic/qed/qed_mcp.h  | 10 ++++++++++
 include/linux/qed/qed_if.h                 |  1 +
 5 files changed, 20 insertions(+)
drivers/net/ethernet/qlogic/qed/qed_hsi.h +1 -0
index 417121e..37edaa8 100644
@@ -12796,6 +12796,7 @@ struct public_drv_mb {
 #define FW_MB_PARAM_GET_PF_RDMA_BOTH		0x3
 
 /* get MFW feature support response */
+#define FW_MB_PARAM_FEATURE_SUPPORT_SMARTLINQ	0x00000001
 #define FW_MB_PARAM_FEATURE_SUPPORT_EEE		0x00000002
 #define FW_MB_PARAM_FEATURE_SUPPORT_VLINK	0x00010000
 
drivers/net/ethernet/qlogic/qed/qed_main.c +2 -0
index b473526..f164d4a 100644
@@ -281,6 +281,8 @@ int qed_fill_dev_info(struct qed_dev *cdev,
 		if (hw_info->b_wol_support == QED_WOL_SUPPORT_PME)
 			dev_info->wol_support = true;
 
+		dev_info->smart_an = qed_mcp_is_smart_an_supported(p_hwfn);
+
 		dev_info->abs_pf_id = QED_LEADING_HWFN(cdev)->abs_pf_id;
 	} else {
 		qed_vf_get_fw_version(&cdev->hwfns[0], &dev_info->fw_major,
drivers/net/ethernet/qlogic/qed/qed_mcp.c +6 -0
index bb85418..cc27fd6 100644
@@ -3654,6 +3654,12 @@ void qed_mcp_resc_lock_default_init(struct qed_resc_lock_params *p_lock,
 	}
 }
 
+bool qed_mcp_is_smart_an_supported(struct qed_hwfn *p_hwfn)
+{
+	return !!(p_hwfn->mcp_info->capabilities &
+		  FW_MB_PARAM_FEATURE_SUPPORT_SMARTLINQ);
+}
+
 int qed_mcp_get_capabilities(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
 {
 	u32 mcp_resp;
drivers/net/ethernet/qlogic/qed/qed_mcp.h +10 -0
index 6e1d72a..2799e67 100644
@@ -1148,6 +1148,16 @@ void qed_mcp_resc_lock_default_init(struct qed_resc_lock_params *p_lock,
 				    struct qed_resc_unlock_params *p_unlock,
 				    enum qed_resc_lock
 				    resource, bool b_is_permanent);
+
+/**
+ * @brief - Return whether management firmware support smart AN
+ *
+ * @param p_hwfn
+ *
+ * @return bool - true if feature is supported.
+ */
+bool qed_mcp_is_smart_an_supported(struct qed_hwfn *p_hwfn);
+
 /**
  * @brief Learn of supported MFW features; To be done during early init
  *
include/linux/qed/qed_if.h +1 -0
index 35170f7..f6165d3 100644
@@ -643,6 +643,7 @@ struct qed_dev_info {
 	u16		mtu;
 
 	bool wol_support;
+	bool smart_an;
 
 	/* MBI version */
 	u32 mbi_version;
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/2 qede: Add ethtool interface for SmartAN query.

In reply to Sudarsana Reddy Kalluru

The patch adds driver support to query SmartAN capability via ethtool.

---
 drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qede/qede_ethtool.c +10 -1
index 16331c6..c623808 100644
@@ -186,11 +186,13 @@
 
 enum {
 	QEDE_PRI_FLAG_CMT,
+	QEDE_PRI_FLAG_SMART_AN_SUPPORT, /* MFW supports SmartAN */
 	QEDE_PRI_FLAG_LEN,
 };
 
 static const char qede_private_arr[QEDE_PRI_FLAG_LEN][ETH_GSTRING_LEN] = {
 	"Coupled-Function",
+	"SmartAN capable",
 };
 
 enum qede_ethtool_tests {
@@ -404,8 +406,15 @@ static int qede_get_sset_count(struct net_device *dev, int stringset)
 static u32 qede_get_priv_flags(struct net_device *dev)
 {
 	struct qede_dev *edev = netdev_priv(dev);
+	u32 flags = 0;
 
-	return (!!(edev->dev_info.common.num_hwfns > 1)) << QEDE_PRI_FLAG_CMT;
+	if (edev->dev_info.common.num_hwfns > 1)
+		flags |= BIT(QEDE_PRI_FLAG_CMT);
+
+	if (edev->dev_info.common.smart_an)
+		flags |= BIT(QEDE_PRI_FLAG_SMART_AN_SUPPORT);
+
+	return flags;
 }
 
 struct qede_link_mode_mapping {
Signature · 1 line
1.8.3.1
#3 lore raw
In reply to Sudarsana Reddy Kalluru
Quoted 2 lines · Sudarsana Reddy Kalluru

SmartAN feature detects the peer/cable capabilities and establishes the link in the best possible configuration.

It sounds familiar, I need to check with FW team, but I think we may be doing a similar thing, and adding a common API rather than ethtool flag would be preferable.

Could you please share a little bit more detail? What are the configurations this would choose between?

#4 lore raw
Quoted 15 lines

-----Original Message-----
From: Jakub Kicinski [mailto:[email protected]]
Sent: 08 February 2019 01:24
To: Sudarsana Reddy Kalluru <[email protected]>
Cc: [email protected]; [email protected]; Ariel Elior <[email protected]>; Michal Kalderon <[email protected]>
Subject: [EXT] Re: [PATCH net-next 0/2] qed*: SmartAN query support

External Email

----------------------------------------------------------------------

Quoted 2 lines · Sudarsana Reddy Kalluru

SmartAN feature detects the peer/cable capabilities and establishes the link in the best possible configuration.

Quoted 6 lines

It sounds familiar, I need to check with FW team, but I think we may be doing a similar thing, and adding a common API rather than ethtool flag would be preferable.

Could you please share a little bit more detail? What are the configurations this would choose between?

Jakub,
Following doc provides detailed information on this feature. We simply need a flag to display whether the feature is enabled in the hardware or not, hence adding it to "ethtool --show-priv-flags".
https://www.cavium.com/Dell/Documents/Converged/TB_Establishing_Adaptive_Links_with_SmartAN_Dell.pdf
****
When an administrator first plugs a device (discrete optical module or Active Optical Cable assembly or DAC) into the Cavium FastLinQ adapter SFP/QSFP interface, the Cavium SmartAN technology reads the device type (discrete optics or AOC or DAC), what its speed rating is, special optics data (such as what FEC mode is required or if it is multi-speed capable), DAC CA-x type, and DAC length. Armed with this information, the FastLinQ adapter attempts each possible mode (supported by that device) until it secures a link with the connected link partner (switch), without input from the end user.
****

Thanks,
Sudarsana

#5 lore raw
Quoted 8 lines · Sudarsana Reddy Kalluru
Quoted 8 lines · Sudarsana Reddy Kalluru
Quoted 2 lines

SmartAN feature detects the peer/cable capabilities and establishes the link in the best possible configuration.

It sounds familiar, I need to check with FW team, but I think we may be doing a similar thing, and adding a common API rather than ethtool flag would be preferable.

Quoted 6 lines
Quoted 2 lines

Could you please share a little bit more detail? What are the configurations this would choose between?

Jakub,
Following doc provides detailed information on this feature. We simply need a flag to display whether the feature is enabled in the hardware or not, hence adding it to "ethtool --show-priv-flags".
https://www.cavium.com/Dell/Documents/Converged/TB_Establishing_Adaptive_Links_with_SmartAN_Dell.pdf

Thanks! Yes, that's exactly the same thing. In a nutshell trying different serdes and FEC speeds. I guess I'll just put adding an API for this down as a TODO, and add it once we have ethtool netlink. And keep IOCTL ethtool frozen until then.

So I think the priv flag is fine for now.

maintainer
#6 lore raw

From: Jakub Kicinski <[email protected]>
Date: Fri, 8 Feb 2019 08:04:29 -0800

Quoted 6 lines

Thanks! Yes, that's exactly the same thing. In a nutshell trying different serdes and FEC speeds. I guess I'll just put adding an API for this down as a TODO, and add it once we have ethtool netlink. And keep IOCTL ethtool frozen until then.

So I think the priv flag is fine for now.

Series applied to net-next.

maintainer
#7 lore raw
In reply to Sudarsana Reddy Kalluru

From: Sudarsana Reddy Kalluru <[email protected]>
Date: Thu, 7 Feb 2019 06:20:10 -0800

Quoted 4 lines

SmartAN feature detects the peer/cable capabilities and establishes the link in the best possible configuration.
The patch series adds support for querying the capability. Please consider applying it net-next.

Series applied, thanks.

maintainer
#8 lore raw

From: David Miller <[email protected]>
Date: Thu, 07 Feb 2019 13:22:35 -0800 (PST)

Quoted 9 lines

From: Sudarsana Reddy Kalluru <[email protected]>
Date: Thu, 7 Feb 2019 06:20:10 -0800

Quoted 4 lines

SmartAN feature detects the peer/cable capabilities and establishes the link in the best possible configuration.
The patch series adds support for querying the capability. Please consider applying it net-next.

Series applied, thanks.

Nevermind, I reverted before pushing out as I see Jakub has some questions.