Skip to contentSkip to conversation

i40e/i40evf updates

PATCH New Bimmy Pujari 2 participants 29 messages May 3, 2016 – May 9, 2016

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

cover i40e/i40evf updates

Akeem G Abodunrin corrects UDP packet header for non_tunnel ipv6.

Anjali Singhai Jain adds allmulti support for the VF and vf-true-promisc-support priv flag.

Catherine Sullivan refactors ethtool get_settings.

Jacob Keller changes Rx hang message into a WARN_ONCE.

Kevin Scott & Carolyn Wyborny add support for disabling all link and change bits needed for PHY interactions.

Mitch Williams adds code to lie to the VF, properly report rx packet hash and adds code for not adding broadcast filter for VFs.

Ashish Shah sets context to use VSI RSS Lut for SR-IOV.

Shannon Nelson implements the API function for aq_set_switch_config.

 drivers/net/ethernet/intel/i40e/i40e.h             |  16 +-
 drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h  |   3 +
 drivers/net/ethernet/intel/i40e/i40e_common.c      |  40 ++-
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c     | 332 +++++++++++++--------
 drivers/net/ethernet/intel/i40e/i40e_main.c        |  35 ++-
 drivers/net/ethernet/intel/i40e/i40e_prototype.h   |   7 +-
 drivers/net/ethernet/intel/i40e/i40e_ptp.c         |   4 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c        |   2 +-
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |  21 +-
 drivers/net/ethernet/intel/i40evf/i40evf.h         |   3 +
 drivers/net/ethernet/intel/i40evf/i40evf_main.c    |  15 +-
 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    |  15 +-
 12 files changed, 329 insertions(+), 164 deletions(-)
Signature · 1 line
2.4.11
#1 lore raw

PATCH 1/12 i40e: Add support for disabling all link and change bits needed for PHY interactions.

From: Kevin Scott <[email protected]>

Add flag to tell firmware to disable link on all ports.

This patch changes the bits set for telling firmware the PHY needs to be modified by driver. Without this patch, the setting will only set that mode for the current port on the device. Because the MDIO interface is common for the copper device. The command needs to set the mode for all ports.

Change-ID I8baa7da91d384291ac95b41ae1a516604f8eb67f

---
Testing Hints :
Test by blinking led on one
or more ports on Fort Pond device and do something to interact with the other PHY's on the same device at the same time, like lanconf and Dump PHY NVM.

 drivers/net/ethernet/intel/i40e/i40e.h            | 4 +++-
 drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 3 +++
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c    | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +3 -1
index 7f52bfe..0d9038f 100644
@@ -111,7 +111,9 @@
 #define I40E_OEM_VER_PATCH_MASK    0xff
 #define I40E_OEM_VER_BUILD_SHIFT   8
 #define I40E_OEM_VER_SHIFT         24
-#define I40E_PHY_DEBUG_PORT        BIT(4)
+#define I40E_PHY_DEBUG_ALL \
+	(I40E_AQ_PHY_DEBUG_DISABLE_LINK_FW | \
+	I40E_AQ_PHY_DEBUG_DISABLE_ALL_LINK_FW)
 
 /* The values in here are decimal coded as hex as is the case in the NVM map*/
 #define I40E_CURRENT_NVM_VERSION_HI 0x2
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +3 -0
index eacbe74..11cf1a5 100644
@@ -1833,7 +1833,10 @@ struct i40e_aqc_set_phy_debug {
 #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_NONE	0x00
 #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_HARD	0x01
 #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SOFT	0x02
+/* Disable link manageability on a single port */
 #define I40E_AQ_PHY_DEBUG_DISABLE_LINK_FW	0x10
+/* Disable link manageability on all ports */
+#define I40E_AQ_PHY_DEBUG_DISABLE_ALL_LINK_FW	0x20
 	u8	reserved[15];
 };
 
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1 -1
index 0a5374e..8460723 100644
@@ -1880,7 +1880,7 @@ static int i40e_set_phys_id(struct net_device *netdev,
 		if (!(pf->flags & I40E_FLAG_HAVE_10GBASET_PHY)) {
 			pf->led_status = i40e_led_get(hw);
 		} else {
-			i40e_aq_set_phy_debug(hw, I40E_PHY_DEBUG_PORT, NULL);
+			i40e_aq_set_phy_debug(hw, I40E_PHY_DEBUG_ALL, NULL);
 			ret = i40e_led_get_phy(hw, &temp_status,
 					       &pf->phy_led_val);
 			pf->led_status = temp_status;
Signature · 1 line
2.4.11
#2 lore raw

PATCH 1/12 i40e: Add support for disabling all link and change bits needed for PHY interactions.

Quoted 27 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 01/12] i40e: Add support for disabling all link and change bits needed for PHY interactions.

From: Kevin Scott <[email protected]>

Add flag to tell firmware to disable link on all ports.

This patch changes the bits set for telling firmware the PHY needs to be modified by driver. Without this patch, the setting will only set that mode for the current port on the device. Because the MDIO interface is common for the copper device. The command needs to set the mode for all ports.

Change-ID I8baa7da91d384291ac95b41ae1a516604f8eb67f

---
Testing Hints :
Test by blinking led on one
or more ports on Fort Pond device and do something to interact with the other PHY's on the same device at the same time, like lanconf and Dump PHY NVM.

Quoted 4 lines
 drivers/net/ethernet/intel/i40e/i40e.h            | 4 +++-
 drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 3 +++
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c    | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

Able to interact with PHY on multiple ports simultaneously

#3 lore raw

PATCH 2/12 i40e: Add allmulti support for the VF

In reply to Bimmy Pujari

From: Anjali Singhai Jain <[email protected]>

This patch enables a feature to enable/disable all multicast for a trusted VF.

Change-Id I926eba7f8850c8d40f8ad7e08bbe4056bbd3985f
---
 drivers/net/ethernet/intel/i40evf/i40evf.h          |  3 +++
 drivers/net/ethernet/intel/i40evf/i40evf_main.c     | 15 ++++++++++++++-
 drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 15 +++++++++++++--
 3 files changed, 30 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +3 -0
index 1b93d66..34d50ba 100644
@@ -215,6 +215,7 @@ struct i40evf_adapter {
 #define I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE	BIT(12)
 #define I40EVF_FLAG_ADDR_SET_BY_PF		BIT(13)
 #define I40EVF_FLAG_PROMISC_ON			 BIT(15)
+#define I40EVF_FLAG_ALLMULTI_ON			 BIT(16)
 /* duplicates for common code */
 #define I40E_FLAG_FDIR_ATR_ENABLED		 0
 #define I40E_FLAG_DCB_ENABLED			 0
@@ -241,6 +242,8 @@ struct i40evf_adapter {
 #define I40EVF_FLAG_AQ_SET_RSS_LUT		BIT(14)
 #define I40EVF_FLAG_AQ_REQUEST_PROMISC		BIT(15)
 #define I40EVF_FLAG_AQ_RELEASE_PROMISC		BIT(16)
+#define I40EVF_FLAG_AQ_REQUEST_ALLMULTI		BIT(17)
+#define I40EVF_FLAG_AQ_RELEASE_ALLMULTI		BIT(18)
 
 	/* OS defined structs */
 	struct net_device *netdev;
drivers/net/ethernet/intel/i40evf/i40evf_main.c +14 -1
index b548dbe..642bb45 100644
@@ -934,6 +934,13 @@ bottom_of_search_loop:
 		 adapter->flags & I40EVF_FLAG_PROMISC_ON)
 		adapter->aq_required |= I40EVF_FLAG_AQ_RELEASE_PROMISC;
 
+	if (netdev->flags & IFF_ALLMULTI &&
+	    !(adapter->flags & I40EVF_FLAG_ALLMULTI_ON))
+		adapter->aq_required |= I40EVF_FLAG_AQ_REQUEST_ALLMULTI;
+	else if (!(netdev->flags & IFF_ALLMULTI) &&
+		 adapter->flags & I40EVF_FLAG_ALLMULTI_ON)
+		adapter->aq_required |= I40EVF_FLAG_AQ_RELEASE_ALLMULTI;
+
 	clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);
 }
 
@@ -1612,7 +1619,13 @@ static void i40evf_watchdog_task(struct work_struct *work)
 		goto watchdog_done;
 	}
 
-	if (adapter->aq_required & I40EVF_FLAG_AQ_RELEASE_PROMISC) {
+	if (adapter->aq_required & I40EVF_FLAG_AQ_REQUEST_ALLMULTI) {
+		i40evf_set_promiscuous(adapter, I40E_FLAG_VF_MULTICAST_PROMISC);
+		goto watchdog_done;
+	}
+
+	if ((adapter->aq_required & I40EVF_FLAG_AQ_RELEASE_PROMISC) &&
+	    (adapter->aq_required & I40EVF_FLAG_AQ_RELEASE_ALLMULTI)) {
 		i40evf_set_promiscuous(adapter, 0);
 		goto watchdog_done;
 	}
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +13 -2
index c5d33a2..f134456 100644
@@ -641,6 +641,7 @@ void i40evf_del_vlans(struct i40evf_adapter *adapter)
 void i40evf_set_promiscuous(struct i40evf_adapter *adapter, int flags)
 {
 	struct i40e_virtchnl_promisc_info vpi;
+	int promisc_all;
 
 	if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
 		/* bail because we already have a command pending */
@@ -649,11 +650,21 @@ void i40evf_set_promiscuous(struct i40evf_adapter *adapter, int flags)
 		return;
 	}
 
-	if (flags) {
+	promisc_all = I40E_FLAG_VF_UNICAST_PROMISC |
+		      I40E_FLAG_VF_MULTICAST_PROMISC;
+	if ((flags & promisc_all) == promisc_all) {
 		adapter->flags |= I40EVF_FLAG_PROMISC_ON;
 		adapter->aq_required &= ~I40EVF_FLAG_AQ_REQUEST_PROMISC;
 		dev_info(&adapter->pdev->dev, "Entering promiscuous mode\n");
-	} else {
+	}
+
+	if (flags & I40E_FLAG_VF_MULTICAST_PROMISC) {
+		adapter->flags |= I40EVF_FLAG_ALLMULTI_ON;
+		adapter->aq_required &= ~I40EVF_FLAG_AQ_REQUEST_ALLMULTI;
+		dev_info(&adapter->pdev->dev, "Entering multicast promiscuous mode\n");
+	}
+
+	if (!flags) {
 		adapter->flags &= ~I40EVF_FLAG_PROMISC_ON;
 		adapter->aq_required &= ~I40EVF_FLAG_AQ_RELEASE_PROMISC;
 		dev_info(&adapter->pdev->dev, "Leaving promiscuous mode\n");
Signature · 1 line
2.4.11
#4 lore raw

PATCH 2/12 i40e: Add allmulti support for the VF

Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 02/12] i40e: Add allmulti support for the VF

From: Anjali Singhai Jain <[email protected]>

This patch enables a feature to enable/disable all multicast for a trusted VF.

Quoted 7 lines
Change-Id I926eba7f8850c8d40f8ad7e08bbe4056bbd3985f
---
 drivers/net/ethernet/intel/i40evf/i40evf.h          |  3 +++
 drivers/net/ethernet/intel/i40evf/i40evf_main.c     | 15 ++++++++++++++-
 drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 15 +++++++++++++--
 3 files changed, 30 insertions(+), 3 deletions(-)

Code changes present, compiles cleanly, feature tested with subsequent patch

#5 lore raw

PATCH 2/12 i40e: Add allmulti support for the VF

In reply to Bimmy Pujari
Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 02/12] i40e: Add allmulti support for the VF

From: Anjali Singhai Jain <[email protected]>

This patch enables a feature to enable/disable all multicast for a trusted VF.

Quoted 7 lines
Change-Id I926eba7f8850c8d40f8ad7e08bbe4056bbd3985f
---
 drivers/net/ethernet/intel/i40evf/i40evf.h          |  3 +++
 drivers/net/ethernet/intel/i40evf/i40evf_main.c     | 15 ++++++++++++++-
 drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 15 +++++++++++++--
 3 files changed, 30 insertions(+), 3 deletions(-)

Driver correctly reports multicast promiscuous mode when enabled

#6 lore raw

PATCH 3/12 i40e: Implement the API function for aq_set_switch_config

In reply to Bimmy Pujari

From: Shannon Nelson <[email protected]>

Add the support code for calling the AdminQ API call aq_set_switch_config

---
Testing Hints : Apply and compile cleanly

 drivers/net/ethernet/intel/i40e/i40e_common.c    | 29 ++++++++++++++++++++++++
 drivers/net/ethernet/intel/i40e/i40e_prototype.h |  4 ++++
 2 files changed, 33 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_common.c +29 -0
index 4a934e1..4739a9c 100644
@@ -2283,6 +2283,35 @@ i40e_status i40e_aq_get_switch_config(struct i40e_hw *hw,
 }
 
 /**
+ * i40e_aq_set_switch_config
+ * @hw: pointer to the hardware structure
+ * @flags: bit flag values to set
+ * @valid_flags: which bit flags to set
+ * @cmd_details: pointer to command details structure or NULL
+ *
+ * Set switch configuration bits
+ **/
+enum i40e_status_code i40e_aq_set_switch_config(struct i40e_hw *hw,
+						u16 flags,
+						u16 valid_flags,
+				struct i40e_asq_cmd_details *cmd_details)
+{
+	struct i40e_aq_desc desc;
+	struct i40e_aqc_set_switch_config *scfg =
+		(struct i40e_aqc_set_switch_config *)&desc.params.raw;
+	enum i40e_status_code status;
+
+	i40e_fill_default_direct_cmd_desc(&desc,
+					  i40e_aqc_opc_set_switch_config);
+	scfg->flags = cpu_to_le16(flags);
+	scfg->valid_flags = cpu_to_le16(valid_flags);
+
+	status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
+
+	return status;
+}
+
+/**
  * i40e_aq_get_firmware_version
  * @hw: pointer to the hw struct
  * @fw_major_version: firmware major version
drivers/net/ethernet/intel/i40e/i40e_prototype.h +4 -0
index 4c8977c..b76b158 100644
@@ -182,6 +182,10 @@ i40e_status i40e_aq_get_switch_config(struct i40e_hw *hw,
 				struct i40e_aqc_get_switch_config_resp *buf,
 				u16 buf_size, u16 *start_seid,
 				struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code i40e_aq_set_switch_config(struct i40e_hw *hw,
+						u16 flags,
+						u16 valid_flags,
+				struct i40e_asq_cmd_details *cmd_details);
 i40e_status i40e_aq_request_resource(struct i40e_hw *hw,
 				enum i40e_aq_resources_ids resource,
 				enum i40e_aq_resource_access_type access,
Signature · 1 line
2.4.11
#7 lore raw

PATCH 3/12 i40e: Implement the API function for aq_set_switch_config

Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 03/12] i40e: Implement the API function for aq_set_switch_config

From: Shannon Nelson <[email protected]>

Add the support code for calling the AdminQ API call aq_set_switch_config

Quoted 8 lines

---
Testing Hints : Apply and compile cleanly

 drivers/net/ethernet/intel/i40e/i40e_common.c    | 29
++++++++++++++++++++++++
 drivers/net/ethernet/intel/i40e/i40e_prototype.h |  4 ++++
 2 files changed, 33 insertions(+)

Code changes present, compiles cleanly

#8 lore raw

PATCH 3/12 i40e: Implement the API function for aq_set_switch_config

Quoted 24 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bowers, AndrewX
Sent: Wednesday, May 04, 2016 8:34 AM
To: intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [next PATCH S36 03/12] i40e: Implement the API function for aq_set_switch_config

Quoted 16 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 03/12] i40e: Implement the API function for aq_set_switch_config

From: Shannon Nelson <[email protected]>

Add the support code for calling the AdminQ API call aq_set_switch_config

---
Testing Hints : Apply and compile cleanly

Quoted 7 lines
Quoted 4 lines
 drivers/net/ethernet/intel/i40e/i40e_common.c    | 29
++++++++++++++++++++++++
 drivers/net/ethernet/intel/i40e/i40e_prototype.h |  4 ++++
 2 files changed, 33 insertions(+)

Code changes present, compiles cleanly

We need to make sure we have the patch that actually uses this included in the patches sent upstream.

Thanks,

Carolyn

#9 lore raw

PATCH 3/12 i40e: Implement the API function for aq_set_switch_config

Quoted 39 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Wyborny, Carolyn
Sent: Wednesday, May 04, 2016 8:55 AM
To: Bowers, AndrewX <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [next PATCH S36 03/12] i40e: Implement the API function for aq_set_switch_config

Quoted 29 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bowers, AndrewX
Sent: Wednesday, May 04, 2016 8:34 AM
To: intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [next PATCH S36 03/12] i40e: Implement the API function for aq_set_switch_config

Quoted 20 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 03/12] i40e: Implement the API function for aq_set_switch_config

From: Shannon Nelson <[email protected]>

Add the support code for calling the AdminQ API call aq_set_switch_config

---
Testing Hints : Apply and compile cleanly

 drivers/net/ethernet/intel/i40e/i40e_common.c    | 29
++++++++++++++++++++++++
 drivers/net/ethernet/intel/i40e/i40e_prototype.h |  4 ++++
 2 files changed, 33 insertions(+)
Quoted 5 lines
Quoted 2 lines

Code changes present, compiles cleanly

We need to make sure we have the patch that actually uses this included in the patches sent upstream.

That patch *is* in this series, authored by Anjali.

Thanks,

Carolyn

#10 lore raw

PATCH 4/12 i40e: Add vf-true-promisc-support priv flag

In reply to Bimmy Pujari

From: Anjali Singhai Jain <[email protected]>

This patch adds priv-flag knob to configure global true promisc support. With this patch the user can decide the flavor of promiscuous that the VFs will see when promiscuous mode is enabled on the interface. Since this a global setting for the whole device, the priv-flag is exposed only on the first PF of the device.

The default is true promisc support is off, which means the promisc mode for the VF will be limited/defport mode.

For the PF, we still will be in limited promisc unless in MFP mode irrespective of the flavor picked through this knob.

Usage:
On PF0
ethtool --show-priv-flags p261p1
Private flags for p261p1:
MFP : off
LinkPolling : off
flow-director-atr : on
veb-stats : off
hw-atr-eviction : off
vf-true-promisc-support: off

to enable setting true promisc
ethtool --set-priv-flags p261p1 vf-true-promisc-support on

At this point if the VF is set to trust and promisc is enabled on the VF through
ip link set ... promisc on
The VF/VFs will be able to see ALL ingress traffic

Change-Id I8fac4b6eb1af9ca77b5376b79c50bdce5055bd94
---
 drivers/net/ethernet/intel/i40e/i40e.h             | 12 ++--
 drivers/net/ethernet/intel/i40e/i40e_common.c      |  9 ++-
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c     | 72 +++++++++++++++++++---
 drivers/net/ethernet/intel/i40e/i40e_main.c        | 30 ++++++++-
 drivers/net/ethernet/intel/i40e/i40e_prototype.h   |  3 +-
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |  3 +-
 6 files changed, 111 insertions(+), 18 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +7 -5
index 0d9038f..005ab0a 100644
@@ -97,11 +97,12 @@
 #define I40E_INT_NAME_STR_LEN        (IFNAMSIZ + 16)
 
 /* Ethtool Private Flags */
-#define I40E_PRIV_FLAGS_NPAR_FLAG	BIT(0)
-#define I40E_PRIV_FLAGS_LINKPOLL_FLAG	BIT(1)
-#define I40E_PRIV_FLAGS_FD_ATR		BIT(2)
-#define I40E_PRIV_FLAGS_VEB_STATS	BIT(3)
-#define I40E_PRIV_FLAGS_HW_ATR_EVICT	BIT(5)
+#define	I40E_PRIV_FLAGS_MFP_FLAG		BIT(0)
+#define	I40E_PRIV_FLAGS_LINKPOLL_FLAG		BIT(1)
+#define I40E_PRIV_FLAGS_FD_ATR			BIT(2)
+#define I40E_PRIV_FLAGS_VEB_STATS		BIT(3)
+#define I40E_PRIV_FLAGS_HW_ATR_EVICT		BIT(4)
+#define I40E_PRIV_FLAGS_TRUE_PROMISC_SUPPORT	BIT(5)
 
 #define I40E_NVM_VERSION_LO_SHIFT  0
 #define I40E_NVM_VERSION_LO_MASK   (0xff << I40E_NVM_VERSION_LO_SHIFT)
@@ -373,6 +374,7 @@ struct i40e_pf {
 #define I40E_FLAG_STOP_FW_LLDP			BIT_ULL(47)
 #define I40E_FLAG_HAVE_10GBASET_PHY		BIT_ULL(48)
 #define I40E_FLAG_PF_MAC			BIT_ULL(50)
+#define I40E_FLAG_TRUE_PROMISC_SUPPORT		BIT_ULL(51)
 
 	/* tracks features that get auto disabled by errors */
 	u64 auto_disable_flags;
drivers/net/ethernet/intel/i40e/i40e_common.c +6 -3
index 4739a9c..27c6f9d 100644
@@ -1972,10 +1972,12 @@ aq_add_vsi_exit:
  * @seid: vsi number
  * @set: set unicast promiscuous enable/disable
  * @cmd_details: pointer to command details structure or NULL
+ * @rx_only_promisc: flag to decide if egress traffic gets mirrored in promisc
  **/
 i40e_status i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
 				u16 seid, bool set,
-				struct i40e_asq_cmd_details *cmd_details)
+				struct i40e_asq_cmd_details *cmd_details,
+				bool rx_only_promisc)
 {
 	struct i40e_aq_desc desc;
 	struct i40e_aqc_set_vsi_promiscuous_modes *cmd =
@@ -1988,8 +1990,9 @@ i40e_status i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
 
 	if (set) {
 		flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
-		if (((hw->aq.api_maj_ver == 1) && (hw->aq.api_min_ver >= 5)) ||
-		    (hw->aq.api_maj_ver > 1))
+		if (rx_only_promisc &&
+		    (((hw->aq.api_maj_ver == 1) && (hw->aq.api_min_ver >= 5)) ||
+		     (hw->aq.api_maj_ver > 1)))
 			flags |= I40E_AQC_SET_VSI_PROMISC_TX;
 	}
 
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +65 -7

121 lines not on this page · raw message

drivers/net/ethernet/intel/i40e/i40e_main.c +29 -1
index 28823b5..3d3c70c 100644
@@ -2128,7 +2128,8 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
 			aq_ret = i40e_aq_set_vsi_unicast_promiscuous(
 							  &vsi->back->hw,
 							  vsi->seid,
-							  cur_promisc, NULL);
+							  cur_promisc, NULL,
+							  true);
 			if (aq_ret) {
 				retval =
 				i40e_aq_rc_to_posix(aq_ret,
@@ -10407,6 +10408,7 @@ int i40e_fetch_switch_configuration(struct i40e_pf *pf, bool printconfig)
  **/
 static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit)
 {
+	u16 flags = 0;
 	int ret;
 
 	/* find out what's out there already */
@@ -10420,6 +10422,32 @@ static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit)
 	}
 	i40e_pf_reset_stats(pf);
 
+	/* set the switch config bit for the whole device to
+	 * support limited promisc or true promisc
+	 * when user requests promisc. The default is limited
+	 * promisc.
+	*/
+
+	if ((pf->hw.pf_id == 0) &&
+	    !(pf->flags & I40E_FLAG_TRUE_PROMISC_SUPPORT))
+		flags = I40E_AQ_SET_SWITCH_CFG_PROMISC;
+
+	if (pf->hw.pf_id == 0) {
+		u16 valid_flags;
+
+		valid_flags = I40E_AQ_SET_SWITCH_CFG_PROMISC;
+		ret = i40e_aq_set_switch_config(&pf->hw, flags, valid_flags,
+						NULL);
+		if (ret && pf->hw.aq.asq_last_status != I40E_AQ_RC_ESRCH) {
+			dev_info(&pf->pdev->dev,
+				 "couldn't set switch config bits, err %s aq_err %s\n",
+				 i40e_stat_str(&pf->hw, ret),
+				 i40e_aq_str(&pf->hw,
+					     pf->hw.aq.asq_last_status));
+			/* not a fatal problem, just keep going */
+		}
+	}
+
 	/* first time setup */
 	if (pf->lan_vsi == I40E_NO_VSI || reinit) {
 		struct i40e_vsi *vsi = NULL;
drivers/net/ethernet/intel/i40e/i40e_prototype.h +2 -1
index b76b158..80403c6 100644
@@ -130,7 +130,8 @@ i40e_status i40e_aq_set_vsi_broadcast(struct i40e_hw *hw,
 				u16 vsi_id, bool set_filter,
 				struct i40e_asq_cmd_details *cmd_details);
 i40e_status i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
-		u16 vsi_id, bool set, struct i40e_asq_cmd_details *cmd_details);
+		u16 vsi_id, bool set, struct i40e_asq_cmd_details *cmd_details,
+		bool rx_only_promisc);
 i40e_status i40e_aq_set_vsi_multicast_promiscuous(struct i40e_hw *hw,
 		u16 vsi_id, bool set, struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_set_vsi_mc_promisc_on_vlan(struct i40e_hw *hw,
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2 -1
index 651ce05..8ab029d 100644
@@ -1561,7 +1561,8 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf,
 		}
 	} else {
 		aq_ret = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
-							     allmulti, NULL);
+							     allmulti, NULL,
+							     true);
 		aq_err = pf->hw.aq.asq_last_status;
 		if (aq_ret)
 			dev_err(&pf->pdev->dev,
Signature · 1 line
2.4.11
#11 lore raw

PATCH 4/12 i40e: Add vf-true-promisc-support priv flag

Quoted 41 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 04/12] i40e: Add vf-true-promisc- support priv flag

From: Anjali Singhai Jain <[email protected]>

This patch adds priv-flag knob to configure global true promisc support. With this patch the user can decide the flavor of promiscuous that the VFs will see when promiscuous mode is enabled on the interface. Since this a global setting for the whole device, the priv-flag is exposed only on the first PF of the device.

The default is true promisc support is off, which means the promisc mode for the VF will be limited/defport mode.

For the PF, we still will be in limited promisc unless in MFP mode irrespective of the flavor picked through this knob.

Usage:
On PF0
ethtool --show-priv-flags p261p1
Private flags for p261p1:
MFP : off
LinkPolling : off
flow-director-atr : on
veb-stats : off
hw-atr-eviction : off
vf-true-promisc-support: off

to enable setting true promisc
ethtool --set-priv-flags p261p1 vf-true-promisc-support on

At this point if the VF is set to trust and promisc is enabled on the VF through ip link set ... promisc on The VF/VFs will be able to see ALL ingress traffic

Change-Id I8fac4b6eb1af9ca77b5376b79c50bdce5055bd94
Quoted 9 lines
---
 drivers/net/ethernet/intel/i40e/i40e.h             | 12 ++--
 drivers/net/ethernet/intel/i40e/i40e_common.c      |  9 ++-
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c     | 72
+++++++++++++++++++---
 drivers/net/ethernet/intel/i40e/i40e_main.c        | 30 ++++++++-
 drivers/net/ethernet/intel/i40e/i40e_prototype.h   |  3 +-
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |  3 +-
 6 files changed, 111 insertions(+), 18 deletions(-)

VF promiscuous mode works as expected

#12 lore raw

PATCH 5/12 i40e: lie to the VF

In reply to Bimmy Pujari

From: Mitch Williams <[email protected]>

If an untrusted VF attempts to configure promiscuous mode, log a message pointing out its naughty behavior. But then, instead of returning an error to the offender, just lie to it and say everything's OK. It will continue on its way, thinking it's in promiscuous mode, but receiving no packets except its own.

Change-ID I63369215b1720f3c531eedfc06af86ff8c0e3dc8

---
Testing Hints : Configure promiscuous mode on a non-trusted VF and observe the results. Make sure trusted VFs still work.

 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +7 -3
index 8ab029d..333945c 100644
@@ -1474,12 +1474,16 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf,
 
 	vsi = i40e_find_vsi_from_id(pf, info->vsi_id);
 	if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states) ||
-	    !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) ||
 	    !i40e_vc_isvalid_vsi_id(vf, info->vsi_id)) {
+		aq_ret = I40E_ERR_PARAM;
+		goto error_param;
+	}
+	if (!test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps)) {
 		dev_err(&pf->pdev->dev,
-			"VF %d doesn't meet requirements to enter promiscuous mode\n",
+			"Unprivileged VF %d is attempting to configure promiscuous mode\n",
 			vf->vf_id);
-		aq_ret = I40E_ERR_PARAM;
+		/* Lie to the VF on purpose. */
+		aq_ret = 0;
 		goto error_param;
 	}
 	/* Multicast promiscuous handling*/
Signature · 1 line
2.4.11
#13 lore raw

PATCH 5/12 i40e: lie to the VF

Quoted 14 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 05/12] i40e: lie to the VF

From: Mitch Williams <[email protected]>

If an untrusted VF attempts to configure promiscuous mode, log a message pointing out its naughty behavior. But then, instead of returning an error to the offender, just lie to it and say everything's OK. It will continue on its way, thinking it's in promiscuous mode, but receiving no packets except its own.

Quoted 8 lines
Change-ID I63369215b1720f3c531eedfc06af86ff8c0e3dc8

---
Testing Hints : Configure promiscuous mode on a non-trusted VF and observe the results. Make sure trusted VFs still work.

 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Promisc mode only actually works on trusted VFs as expected. Naughty behavior logged in dmesg if attempt is made on untrusted VF

#14 lore raw

PATCH 6/12 i40e: Refactor ethtool get_settings

In reply to Bimmy Pujari

From: Catherine Sullivan <[email protected]>

Previously we were only looking at the FW supported phy types if link was down, because we want to be more specific when link is up. This refactor changes this. When link is down, we still rely on the FW supported phy types, but when link is up, we select the possible supported link modes from what we know about the current phy type, and AND that with the FW supported phy types.

Change-ID Ice5dad83f2a17932b0b8b59f07439696ad6aa013

---
Testing Hints:
Make sure that various cables and cards report the correct supported/advertised link settings with ethtool.

 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 258 +++++++++++++------------
 1 file changed, 135 insertions(+), 123 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +135 -123
index a9ff781..dce812e 100644
@@ -262,6 +262,110 @@ static void i40e_partition_setting_complaint(struct i40e_pf *pf)
 }
 
 /**
+ * i40e_phy_type_to_ethtool - convert the phy_types to ethtool link modes
+ * @phy_types: phy types to convert
+ * @supported: pointer to the ethtool supported variable to fill in
+ * @advertising: pointer to the ethtool advertising variable to fill in
+ *
+ **/
+static void i40e_phy_type_to_ethtool(struct i40e_pf *pf, u32 *supported,
+				     u32 *advertising)
+{
+	enum i40e_aq_capabilities_phy_type phy_types = pf->hw.phy.phy_types;
+
+	*supported = 0x0;
+	*advertising = 0x0;
+
+	if (phy_types & I40E_CAP_PHY_TYPE_SGMII) {
+		*supported |= SUPPORTED_Autoneg |
+			     SUPPORTED_1000baseT_Full;
+		*advertising |= ADVERTISED_Autoneg |
+			       ADVERTISED_1000baseT_Full;
+		if (pf->flags & I40E_FLAG_100M_SGMII_CAPABLE) {
+			*supported |= SUPPORTED_100baseT_Full;
+			*advertising |= ADVERTISED_100baseT_Full;
+		}
+	}
+	if (phy_types & I40E_CAP_PHY_TYPE_XAUI ||
+	    phy_types & I40E_CAP_PHY_TYPE_XFI ||
+	    phy_types & I40E_CAP_PHY_TYPE_SFI ||
+	    phy_types & I40E_CAP_PHY_TYPE_10GBASE_SFPP_CU ||
+	    phy_types & I40E_CAP_PHY_TYPE_10GBASE_AOC)
+		*supported |= SUPPORTED_10000baseT_Full;
+	if (phy_types & I40E_CAP_PHY_TYPE_10GBASE_CR1_CU ||
+	    phy_types & I40E_CAP_PHY_TYPE_10GBASE_CR1 ||
+	    phy_types & I40E_CAP_PHY_TYPE_10GBASE_T ||
+	    phy_types & I40E_CAP_PHY_TYPE_10GBASE_SR ||
+	    phy_types & I40E_CAP_PHY_TYPE_10GBASE_LR) {
+		*supported |= SUPPORTED_Autoneg |
+			     SUPPORTED_10000baseT_Full;
+		*advertising |= ADVERTISED_Autoneg |
+			       ADVERTISED_10000baseT_Full;
+	}
+	if (phy_types & I40E_CAP_PHY_TYPE_XLAUI ||
+	    phy_types & I40E_CAP_PHY_TYPE_XLPPI ||
+	    phy_types & I40E_CAP_PHY_TYPE_40GBASE_AOC)
+		*supported |= SUPPORTED_40000baseCR4_Full;
+	if (phy_types & I40E_CAP_PHY_TYPE_40GBASE_CR4_CU ||
+	    phy_types & I40E_CAP_PHY_TYPE_40GBASE_CR4) {
+		*supported |= SUPPORTED_Autoneg |
+			     SUPPORTED_40000baseCR4_Full;
+		*advertising |= ADVERTISED_Autoneg |
+			       ADVERTISED_40000baseCR4_Full;
+	}
+	if ((phy_types & I40E_CAP_PHY_TYPE_100BASE_TX) &&
+	    !(phy_types & I40E_CAP_PHY_TYPE_1000BASE_T)) {
+		*supported |= SUPPORTED_Autoneg |
+			     SUPPORTED_100baseT_Full;
+		*advertising |= ADVERTISED_Autoneg |
+			       ADVERTISED_100baseT_Full;
+	}
+	if (phy_types & I40E_CAP_PHY_TYPE_1000BASE_T ||
+	    phy_types & I40E_CAP_PHY_TYPE_1000BASE_SX ||
+	    phy_types & I40E_CAP_PHY_TYPE_1000BASE_LX ||
+	    phy_types & I40E_CAP_PHY_TYPE_1000BASE_T_OPTICAL) {
+		*supported |= SUPPORTED_Autoneg |
+			     SUPPORTED_1000baseT_Full;
+		*advertising |= ADVERTISED_Autoneg |
+			       ADVERTISED_1000baseT_Full;
+	}
+	if (phy_types & I40E_CAP_PHY_TYPE_40GBASE_SR4)
+		*supported |= SUPPORTED_40000baseSR4_Full;
+	if (phy_types & I40E_CAP_PHY_TYPE_40GBASE_LR4)
+		*supported |= SUPPORTED_40000baseLR4_Full;
+	if (phy_types & I40E_CAP_PHY_TYPE_40GBASE_KR4) {
+		*supported |= SUPPORTED_40000baseKR4_Full |
+			     SUPPORTED_Autoneg;
+		*advertising |= ADVERTISED_40000baseKR4_Full |
+			       ADVERTISED_Autoneg;
+	}
+	if (phy_types & I40E_CAP_PHY_TYPE_20GBASE_KR2) {
+		*supported |= SUPPORTED_20000baseKR2_Full |
+			     SUPPORTED_Autoneg;
+		*advertising |= ADVERTISED_20000baseKR2_Full |
+			       ADVERTISED_Autoneg;
+	}
+	if (phy_types & I40E_CAP_PHY_TYPE_10GBASE_KR) {
+		*supported |= SUPPORTED_10000baseKR_Full |
+			     SUPPORTED_Autoneg;
+		*advertising |= ADVERTISED_10000baseKR_Full |
+			       ADVERTISED_Autoneg;
+	}
+	if (phy_types & I40E_CAP_PHY_TYPE_10GBASE_KX4) {
+		*supported |= SUPPORTED_10000baseKX4_Full |
+			     SUPPORTED_Autoneg;
+		*advertising |= ADVERTISED_10000baseKX4_Full |
+			       ADVERTISED_Autoneg;
+	}
+	if (phy_types & I40E_CAP_PHY_TYPE_1000BASE_KX) {
+		*supported |= SUPPORTED_1000baseKX_Full |
+			     SUPPORTED_Autoneg;
+		*advertising |= ADVERTISED_1000baseKX_Full |
+			       ADVERTISED_Autoneg;
+	}
+}
+
+/**
  * i40e_get_settings_link_up - Get the Link settings for when link is up
  * @hw: hw structure
  * @ecmd: ethtool command to fill in
@@ -275,6 +379,8 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,
 {
 	struct i40e_link_status *hw_link_info = &hw->phy.link_info;
 	u32 link_speed = hw_link_info->link_speed;
+	u32 e_advertising = 0x0;
+	u32 e_supported = 0x0;
 
 	/* Initialize supported and advertised settings based on phy settings */
 	switch (hw_link_info->phy_type) {
@@ -315,21 +421,18 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,
 		break;
 	case I40E_PHY_TYPE_10GBASE_T:
 	case I40E_PHY_TYPE_1000BASE_T:
+	case I40E_PHY_TYPE_100BASE_TX:
 		ecmd->supported = SUPPORTED_Autoneg |
 				  SUPPORTED_10000baseT_Full |
-				  SUPPORTED_1000baseT_Full;
+				  SUPPORTED_1000baseT_Full |
+				  SUPPORTED_100baseT_Full;
 		ecmd->advertising = ADVERTISED_Autoneg;
 		if (hw_link_info->requested_speeds & I40E_LINK_SPEED_10GB)
 			ecmd->advertising |= ADVERTISED_10000baseT_Full;
 		if (hw_link_info->requested_speeds & I40E_LINK_SPEED_1GB)
 			ecmd->advertising |= ADVERTISED_1000baseT_Full;
-		/* adding 100baseT support for 10GBASET_PHY */
-		if (pf->flags & I40E_FLAG_HAVE_10GBASET_PHY) {
-			ecmd->supported |= SUPPORTED_100baseT_Full;
-			ecmd->advertising |= ADVERTISED_100baseT_Full |
-					     ADVERTISED_1000baseT_Full |
-					     ADVERTISED_10000baseT_Full;
-		}
+		if (hw_link_info->requested_speeds & I40E_LINK_SPEED_100MB)
+			ecmd->advertising |= ADVERTISED_100baseT_Full;
 		break;
 	case I40E_PHY_TYPE_1000BASE_T_OPTICAL:
 		ecmd->supported = SUPPORTED_Autoneg |
@@ -337,21 +440,6 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,
 		ecmd->advertising = ADVERTISED_Autoneg |
 				    ADVERTISED_1000baseT_Full;
 		break;
-	case I40E_PHY_TYPE_100BASE_TX:
-		ecmd->supported = SUPPORTED_Autoneg |
-				  SUPPORTED_100baseT_Full;
-		if (hw_link_info->requested_speeds & I40E_LINK_SPEED_100MB)
-			ecmd->advertising |= ADVERTISED_100baseT_Full;
-		/* firmware detects 10G phy as 100M phy at 100M speed */
-		if (pf->flags & I40E_FLAG_HAVE_10GBASET_PHY) {
-			ecmd->supported |= SUPPORTED_10000baseT_Full |
-					   SUPPORTED_1000baseT_Full;
-			ecmd->advertising |= ADVERTISED_Autoneg |
-					     ADVERTISED_100baseT_Full |
-					     ADVERTISED_1000baseT_Full |
-					     ADVERTISED_10000baseT_Full;
-		}
-		break;
 	case I40E_PHY_TYPE_10GBASE_CR1_CU:
 	case I40E_PHY_TYPE_10GBASE_CR1:
 		ecmd->supported = SUPPORTED_Autoneg |
@@ -378,14 +466,23 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,
 				ecmd->advertising |= ADVERTISED_100baseT_Full;
 		}
 		break;
-	/* Backplane is set based on supported phy types in get_settings
-	 * so don't set anything here but don't warn either
-	 */
 	case I40E_PHY_TYPE_40GBASE_KR4:
 	case I40E_PHY_TYPE_20GBASE_KR2:
 	case I40E_PHY_TYPE_10GBASE_KR:
 	case I40E_PHY_TYPE_10GBASE_KX4:
 	case I40E_PHY_TYPE_1000BASE_KX:
+		ecmd->supported |= SUPPORTED_40000baseKR4_Full |
+				   SUPPORTED_20000baseKR2_Full |
+				   SUPPORTED_10000baseKR_Full |
+				   SUPPORTED_10000baseKX4_Full |
+				   SUPPORTED_1000baseKX_Full |
+				   SUPPORTED_Autoneg;
+		ecmd->advertising |= ADVERTISED_40000baseKR4_Full |
+				     ADVERTISED_20000baseKR2_Full |
+				     ADVERTISED_10000baseKR_Full |
+				     ADVERTISED_10000baseKX4_Full |
+				     ADVERTISED_1000baseKX_Full |
+				     ADVERTISED_Autoneg;
 		break;
 	default:
 		/* if we got here and link is up something bad is afoot */
@@ -393,6 +490,16 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,
 			    hw_link_info->phy_type);
 	}
 
+	/* Now that we've worked out everything that could be supported by the
+	 * current phy type, get what is supported by the NVM and and them to
+	 * get what is truly supported
+	 */
+	i40e_phy_type_to_ethtool(pf, &e_supported,
+				 &e_advertising);
+
+	ecmd->supported = ecmd->supported & e_supported;
+	ecmd->advertising = ecmd->advertising & e_advertising;
+
 	/* Set speed and duplex */
 	switch (link_speed) {
 	case I40E_LINK_SPEED_40GB:
@@ -427,74 +534,11 @@ static void i40e_get_settings_link_down(struct i40e_hw *hw,
 					struct ethtool_cmd *ecmd,
 					struct i40e_pf *pf)
 {
-	enum i40e_aq_capabilities_phy_type phy_types = hw->phy.phy_types;
-
 	/* link is down and the driver needs to fall back on
 	 * supported phy types to figure out what info to display
 	 */
-	ecmd->supported = 0x0;
-	ecmd->advertising = 0x0;
-	if (phy_types & I40E_CAP_PHY_TYPE_SGMII) {
-		ecmd->supported |= SUPPORTED_Autoneg |
-				   SUPPORTED_1000baseT_Full;
-		ecmd->advertising |= ADVERTISED_Autoneg |
-				     ADVERTISED_1000baseT_Full;
-		if (pf->hw.mac.type == I40E_MAC_X722) {
-			ecmd->supported |= SUPPORTED_100baseT_Full;
-			ecmd->advertising |= ADVERTISED_100baseT_Full;
-			if (pf->flags & I40E_FLAG_100M_SGMII_CAPABLE) {
-				ecmd->supported |= SUPPORTED_100baseT_Full;
-				ecmd->advertising |= ADVERTISED_100baseT_Full;
-			}
-		}
-	}
-	if (phy_types & I40E_CAP_PHY_TYPE_XAUI ||
-	    phy_types & I40E_CAP_PHY_TYPE_XFI ||
-	    phy_types & I40E_CAP_PHY_TYPE_SFI ||
-	    phy_types & I40E_CAP_PHY_TYPE_10GBASE_SFPP_CU ||
-	    phy_types & I40E_CAP_PHY_TYPE_10GBASE_AOC)
-		ecmd->supported |= SUPPORTED_10000baseT_Full;
-	if (phy_types & I40E_CAP_PHY_TYPE_10GBASE_CR1_CU ||
-	    phy_types & I40E_CAP_PHY_TYPE_10GBASE_CR1 ||
-	    phy_types & I40E_CAP_PHY_TYPE_10GBASE_T ||
-	    phy_types & I40E_CAP_PHY_TYPE_10GBASE_SR ||
-	    phy_types & I40E_CAP_PHY_TYPE_10GBASE_LR) {
-		ecmd->supported |= SUPPORTED_Autoneg |
-				   SUPPORTED_10000baseT_Full;
-		ecmd->advertising |= ADVERTISED_Autoneg |
-				     ADVERTISED_10000baseT_Full;
-	}
-	if (phy_types & I40E_CAP_PHY_TYPE_XLAUI ||
-	    phy_types & I40E_CAP_PHY_TYPE_XLPPI ||
-	    phy_types & I40E_CAP_PHY_TYPE_40GBASE_AOC)
-		ecmd->supported |= SUPPORTED_40000baseCR4_Full;
-	if (phy_types & I40E_CAP_PHY_TYPE_40GBASE_CR4_CU ||
-	    phy_types & I40E_CAP_PHY_TYPE_40GBASE_CR4) {
-		ecmd->supported |= SUPPORTED_Autoneg |
-				  SUPPORTED_40000baseCR4_Full;
-		ecmd->advertising |= ADVERTISED_Autoneg |
-				    ADVERTISED_40000baseCR4_Full;
-	}
-	if ((phy_types & I40E_CAP_PHY_TYPE_100BASE_TX) &&
-	    !(phy_types & I40E_CAP_PHY_TYPE_1000BASE_T)) {
-		ecmd->supported |= SUPPORTED_Autoneg |
-				   SUPPORTED_100baseT_Full;
-		ecmd->advertising |= ADVERTISED_Autoneg |
-				     ADVERTISED_100baseT_Full;
-	}
-	if (phy_types & I40E_CAP_PHY_TYPE_1000BASE_T ||
-	    phy_types & I40E_CAP_PHY_TYPE_1000BASE_SX ||
-	    phy_types & I40E_CAP_PHY_TYPE_1000BASE_LX ||
-	    phy_types & I40E_CAP_PHY_TYPE_1000BASE_T_OPTICAL) {
-		ecmd->supported |= SUPPORTED_Autoneg |
-				   SUPPORTED_1000baseT_Full;
-		ecmd->advertising |= ADVERTISED_Autoneg |
-				     ADVERTISED_1000baseT_Full;
-	}
-	if (phy_types & I40E_CAP_PHY_TYPE_40GBASE_SR4)
-		ecmd->supported |= SUPPORTED_40000baseSR4_Full;
-	if (phy_types & I40E_CAP_PHY_TYPE_40GBASE_LR4)
-		ecmd->supported |= SUPPORTED_40000baseLR4_Full;
+	i40e_phy_type_to_ethtool(pf, &ecmd->supported,
+				 &ecmd->advertising);
 
 	/* With no link speed and duplex are unknown */
 	ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
@@ -523,38 +567,6 @@ static int i40e_get_settings(struct net_device *netdev,
 		i40e_get_settings_link_down(hw, ecmd, pf);
 
 	/* Now set the settings that don't rely on link being up/down */
-
-	/* For backplane, supported and advertised are only reliant on the
-	 * phy types the NVM specifies are supported.
-	 */
-	if (hw->device_id == I40E_DEV_ID_KX_B ||
-	    hw->device_id == I40E_DEV_ID_KX_C ||
-	    hw->device_id == I40E_DEV_ID_20G_KR2 ||
-	    hw->device_id ==  I40E_DEV_ID_20G_KR2_A) {
-		ecmd->supported = SUPPORTED_Autoneg;
-		ecmd->advertising = ADVERTISED_Autoneg;
-		if (hw->phy.phy_types & I40E_CAP_PHY_TYPE_40GBASE_KR4) {
-			ecmd->supported |= SUPPORTED_40000baseKR4_Full;
-			ecmd->advertising |= ADVERTISED_40000baseKR4_Full;
-		}
-		if (hw->phy.phy_types & I40E_CAP_PHY_TYPE_20GBASE_KR2) {
-			ecmd->supported |= SUPPORTED_20000baseKR2_Full;
-			ecmd->advertising |= ADVERTISED_20000baseKR2_Full;
-		}
-		if (hw->phy.phy_types & I40E_CAP_PHY_TYPE_10GBASE_KR) {
-			ecmd->supported |= SUPPORTED_10000baseKR_Full;
-			ecmd->advertising |= ADVERTISED_10000baseKR_Full;
-		}
-		if (hw->phy.phy_types & I40E_CAP_PHY_TYPE_10GBASE_KX4) {
-			ecmd->supported |= SUPPORTED_10000baseKX4_Full;
-			ecmd->advertising |= ADVERTISED_10000baseKX4_Full;
-		}
-		if (hw->phy.phy_types & I40E_CAP_PHY_TYPE_1000BASE_KX) {
-			ecmd->supported |= SUPPORTED_1000baseKX_Full;
-			ecmd->advertising |= ADVERTISED_1000baseKX_Full;
-		}
-	}
-
 	/* Set autoneg settings */
 	ecmd->autoneg = ((hw_link_info->an_info & I40E_AQ_AN_COMPLETED) ?
 			  AUTONEG_ENABLE : AUTONEG_DISABLE);
Signature · 1 line
2.4.11
#15 lore raw

PATCH 6/12 i40e: Refactor ethtool get_settings

Quoted 19 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 06/12] i40e: Refactor ethtool get_settings

From: Catherine Sullivan <[email protected]>

Previously we were only looking at the FW supported phy types if link was down, because we want to be more specific when link is up. This refactor changes this. When link is down, we still rely on the FW supported phy types, but when link is up, we select the possible supported link modes from what we know about the current phy type, and AND that with the FW supported phy types.

Change-ID Ice5dad83f2a17932b0b8b59f07439696ad6aa013
Quoted 8 lines

---
Testing Hints:
Make sure that various cables and cards report the correct supported/advertised link settings with ethtool.

 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 258 +++++++++++++-------
-----
 1 file changed, 135 insertions(+), 123 deletions(-)

various cables and cards report the correct supported/advertised link settings with ethtool

#16 lore raw

PATCH 7/12 i40e: change Rx hang message into a WARN_ONCE

In reply to Bimmy Pujari

From: Jacob Keller <[email protected]>

Use WARN_ONCE in order to highlight the issue, but don't display a warning every time. The user should be able to see the ethtool counter we created if necessary to see how often it is occurring.

Change-ID I40c4ea159819b64a7d33b7f5716749089791533a
---
 drivers/net/ethernet/intel/i40e/i40e_ptp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ptp.c +1 -3
index a1b878a..ed39cba 100644
@@ -289,9 +289,7 @@ void i40e_ptp_rx_hang(struct i40e_vsi *vsi)
 		rd32(hw, I40E_PRTTSYN_RXTIME_H(3));
 		pf->last_rx_ptp_check = jiffies;
 		pf->rx_hwtstamp_cleared++;
-		dev_warn(&vsi->back->pdev->dev,
-			 "%s: clearing Rx timestamp hang\n",
-			 __func__);
+		WARN_ONCE(1, "Detected Rx timestamp register hang\n");
 	}
 }
 
Signature · 1 line
2.4.11
#17 lore raw

PATCH 7/12 i40e: change Rx hang message into a WARN_ONCE

Quoted 14 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 07/12] i40e: change Rx hang message into a WARN_ONCE

From: Jacob Keller <[email protected]>

Use WARN_ONCE in order to highlight the issue, but don't display a warning every time. The user should be able to see the ethtool counter we created if necessary to see how often it is occurring.

Quoted 5 lines
Change-ID I40c4ea159819b64a7d33b7f5716749089791533a
---
 drivers/net/ethernet/intel/i40e/i40e_ptp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Driver builds, compiles, and passes traffic.

#18 lore raw

PATCH 8/12 i40e: Correct UDP packet header for non_tunnel-ipv6

In reply to Bimmy Pujari

From: Akeem G Abodunrin <[email protected]>

This patch corrects Rx ptype payload layer for non_tunneled ipv6. It should be layer 4 for UDP, instead of layer 3.

Change-ID I9382e4458ab3c4e58f6d2e9f195d5d4ee513805e
---
 drivers/net/ethernet/intel/i40e/i40e_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +1 -1
index 27c6f9d..422b41d 100644
@@ -696,7 +696,7 @@ struct i40e_rx_ptype_decoded i40e_ptype_lookup[] = {
 	/* Non Tunneled IPv6 */
 	I40E_PTT(88, IP, IPV6, FRG, NONE, NONE, NOF, NONE, PAY3),
 	I40E_PTT(89, IP, IPV6, NOF, NONE, NONE, NOF, NONE, PAY3),
-	I40E_PTT(90, IP, IPV6, NOF, NONE, NONE, NOF, UDP,  PAY3),
+	I40E_PTT(90, IP, IPV6, NOF, NONE, NONE, NOF, UDP,  PAY4),
 	I40E_PTT_UNUSED_ENTRY(91),
 	I40E_PTT(92, IP, IPV6, NOF, NONE, NONE, NOF, TCP,  PAY4),
 	I40E_PTT(93, IP, IPV6, NOF, NONE, NONE, NOF, SCTP, PAY4),
Signature · 1 line
2.4.11
#19 lore raw

PATCH 8/12 i40e: Correct UDP packet header for non_tunnel-ipv6

Quoted 18 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 08/12] i40e: Correct UDP packet header for non_tunnel-ipv6

From: Akeem G Abodunrin <[email protected]>

This patch corrects Rx ptype payload layer for non_tunneled ipv6. It should be layer 4 for UDP, instead of layer 3.

Change-ID I9382e4458ab3c4e58f6d2e9f195d5d4ee513805e
---
 drivers/net/ethernet/intel/i40e/i40e_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#20 lore raw

PATCH 8/12 i40e: Correct UDP packet header for non_tunnel-ipv6

In reply to Bimmy Pujari
Quoted 10 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 08/12] i40e: Correct UDP packet header for non_tunnel-ipv6

From: Akeem G Abodunrin <[email protected]>

Quoted 8 lines

This patch corrects Rx ptype payload layer for non_tunneled ipv6. It should be layer 4 for UDP, instead of layer 3.

Change-ID I9382e4458ab3c4e58f6d2e9f195d5d4ee513805e
---
 drivers/net/ethernet/intel/i40e/i40e_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

non-tunnel IPv6 UDP traffic works as expected with correct identification

#21 lore raw

PATCH 9/12 i40e: set context to use VSI RSS Lut for SR-IOV

In reply to Bimmy Pujari

From: "Ashish Shah" <[email protected]>

For the SR-IOV VSIs, when the queue filtering section is valid, the RSS LUT needs to be set to use the VSI specific lookup table (otherwise it will use the PF RSS LUT table).

Change-ID Ia9377cc818078238a75c3bdeade1b593a91b3480
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -1
index 3d3c70c..e75bf94 100644
@@ -9362,7 +9362,8 @@ static int i40e_add_vsi(struct i40e_vsi *vsi)
 			ctxt.info.valid_sections |=
 				cpu_to_le16(I40E_AQ_VSI_PROP_QUEUE_OPT_VALID);
 			ctxt.info.queueing_opt_flags |=
-						I40E_AQ_VSI_QUE_OPT_TCP_ENA;
+				(I40E_AQ_VSI_QUE_OPT_TCP_ENA |
+				 I40E_AQ_VSI_QUE_OPT_RSS_LUT_VSI);
 		}
 
 		ctxt.info.valid_sections |= cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
Signature · 1 line
2.4.11
#22 lore raw

PATCH 9/12 i40e: set context to use VSI RSS Lut for SR-IOV

Quoted 14 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 09/12] i40e: set context to use VSI RSS Lut for SR-IOV

From: "Ashish Shah" <[email protected]>

For the SR-IOV VSIs, when the queue filtering section is valid, the RSS LUT needs to be set to use the VSI specific lookup table (otherwise it will use the PF RSS LUT table).

Quoted 5 lines
Change-ID Ia9377cc818078238a75c3bdeade1b593a91b3480
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

RSS works as expected on PF and VF with correct look up table for each

#23 lore raw

PATCH 10/12 i40e/i40evf: properly report rx packet hash

In reply to Bimmy Pujari

From: Mitch Williams <[email protected]>

This logic is inverted. If the RXHASH flag is set, then we should go ahead and call skb_set_hash.

Change-ID Ib2e30356dced1d3e939c8061ab6ad5bd94197e7c

---
Testing Hints : Not sure how to test this without instrumenting the driver.

 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +1 -1
index 6b18c8a..a5def20 100644
@@ -1412,7 +1412,7 @@ static inline void i40e_rx_hash(struct i40e_ring *ring,
 		cpu_to_le64((u64)I40E_RX_DESC_FLTSTAT_RSS_HASH <<
 			    I40E_RX_DESC_STATUS_FLTSTAT_SHIFT);
 
-	if (ring->netdev->features & NETIF_F_RXHASH)
+	if (!(ring->netdev->features & NETIF_F_RXHASH))
 		return;
 
 	if ((rx_desc->wb.qword1.status_error_len & rss_mask) == rss_mask) {
Signature · 1 line
2.4.11
#24 lore raw

PATCH 10/12 i40e/i40evf: properly report rx packet hash

Quoted 13 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 10/12] i40e/i40evf: properly report rx packet hash

From: Mitch Williams <[email protected]>

This logic is inverted. If the RXHASH flag is set, then we should go ahead and call skb_set_hash.

Quoted 7 lines
Change-ID Ib2e30356dced1d3e939c8061ab6ad5bd94197e7c

---
Testing Hints : Not sure how to test this without instrumenting the driver.

 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Compiles and applies cleanly

#25 lore raw

PATCH 11/12 i40e: don't add broadcast filter for VFs

In reply to Bimmy Pujari

From: Mitch Williams <[email protected]>

Now that all VSIs are configured to receive broadcasts as default, we don't need to add a filter. This eliminates an annoying but harmless error message each time VFs are created or reset.

Change-ID I4cd6339684df45b0d2722133eeb84c14fa93ea19

---
Testing Hints : Enable VFs. Note annoying error is gone.

 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +0 -8
index 333945c..31014a7 100644
@@ -665,8 +665,6 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type)
 		goto error_alloc_vsi_res;
 	}
 	if (type == I40E_VSI_SRIOV) {
-		u8 brdcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-
 		vf->lan_vsi_idx = vsi->idx;
 		vf->lan_vsi_id = vsi->id;
 		/* If the port VLAN has been configured and then the
@@ -688,12 +686,6 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type)
 					 "Could not add MAC filter %pM for VF %d\n",
 					vf->default_lan_addr.addr, vf->vf_id);
 		}
-		f = i40e_add_filter(vsi, brdcast,
-				    vf->port_vlan_id ? vf->port_vlan_id : -1,
-				    true, false);
-		if (!f)
-			dev_info(&pf->pdev->dev,
-				 "Could not allocate VF broadcast filter\n");
 		spin_unlock_bh(&vsi->mac_filter_list_lock);
 	}
 
Signature · 1 line
2.4.11
#26 lore raw

PATCH 11/12 i40e: don't add broadcast filter for VFs

Quoted 14 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 11/12] i40e: don't add broadcast filter for VFs

From: Mitch Williams <[email protected]>

Now that all VSIs are configured to receive broadcasts as default, we don't need to add a filter. This eliminates an annoying but harmless error message each time VFs are created or reset.

Quoted 7 lines
Change-ID I4cd6339684df45b0d2722133eeb84c14fa93ea19

---
Testing Hints : Enable VFs. Note annoying error is gone.

 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 8 --------
 1 file changed, 8 deletions(-)

Error message does not appear on VF create/reset

#27 lore raw

PATCH 12/12 i40e: Bump version from 1.5.10 to 1.5.16

In reply to Bimmy Pujari
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
index e75bf94..d091c76 100644
@@ -46,7 +46,7 @@ static const char i40e_driver_string[] =
 
 #define DRV_VERSION_MAJOR 1
 #define DRV_VERSION_MINOR 5
-#define DRV_VERSION_BUILD 10
+#define DRV_VERSION_BUILD 16
 #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
 	     __stringify(DRV_VERSION_MINOR) "." \
 	     __stringify(DRV_VERSION_BUILD)    DRV_KERN
Signature · 1 line
2.4.11
#28 lore raw

PATCH 12/12 i40e: Bump version from 1.5.10 to 1.5.16

Quoted 8 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, May 03, 2016 3:13 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S36 12/12] i40e: Bump version from 1.5.10 to 1.5.16

Quoted 4 lines
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Driver reports correct version