Skip to contentSkip to conversation

i40e: Add source-pruning flag

PATCH Superseded Loktionov, Aleksandr 1 participant 1 message Aug 3, 2022

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i40e: Add source-pruning flag

From: Michal Jaron <[email protected]>

Add source-pruning flag to meet UI requirements for command names.

Source-pruning flag have opposite value to disable-source-pruning.

---
 drivers/net/ethernet/intel/i40e/i40e.h         |  7 +++++--
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 17 ++++++++++++++++-
 drivers/net/ethernet/intel/i40e/i40e_main.c    | 13 +++++++++----
 3 files changed, 30 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +5 -2
index d86b6d3..d2b2769 100644
@@ -559,14 +559,17 @@ struct i40e_pf {
 #define I40E_FLAG_PTP				BIT(17)
 #define I40E_FLAG_IWARP_ENABLED			BIT(18)
 #define I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED	BIT(19)
-#define I40E_FLAG_SOURCE_PRUNING_DISABLED       BIT(20)
+#define I40E_FLAG_SOURCE_PRUNING_DISABLED	BIT(20)
 #define I40E_FLAG_TC_MQPRIO			BIT(21)
 #define I40E_FLAG_FD_SB_INACTIVE		BIT(22)
 #define I40E_FLAG_FD_SB_TO_CLOUD_FILTER		BIT(23)
 #define I40E_FLAG_DISABLE_FW_LLDP		BIT(24)
 #define I40E_FLAG_RS_FEC			BIT(25)
 #define I40E_FLAG_BASE_R_FEC			BIT(26)
-#define I40E_FLAG_VF_VLAN_PRUNING		BIT(27)
+/* 27..29 bits are reserved for compatibility purposes */
+#define I40E_FLAG_VF_VLAN_PRUNING		BIT(30)
+#define I40E_FLAG_SOURCE_PRUNING		BIT(31)
+
 /* TOTAL_PORT_SHUTDOWN
  * Allows to physically disable the link on the NIC's port.
  * If enabled, (after link down request from the OS)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +16 -1
index 156e92c..58ca3f7 100644
@@ -457,6 +457,8 @@ static const struct i40e_priv_flags i40e_gstrings_priv_flags[] = {
 	I40E_PRIV_FLAG("base-r-fec", I40E_FLAG_BASE_R_FEC, 0),
 	I40E_PRIV_FLAG("vf-vlan-pruning",
 		       I40E_FLAG_VF_VLAN_PRUNING, 0),
+	I40E_PRIV_FLAG("source-pruning",
+		       I40E_FLAG_SOURCE_PRUNING, 0),
 };
 
 #define I40E_PRIV_FLAGS_STR_LEN ARRAY_SIZE(i40e_gstrings_priv_flags)
@@ -5283,7 +5285,8 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
 	if (changed_flags & I40E_FLAG_DISABLE_FW_LLDP)
 		reset_needed = I40E_PF_RESET_AND_REBUILD_FLAG;
 	if (changed_flags & (I40E_FLAG_VEB_STATS_ENABLED |
-	    I40E_FLAG_LEGACY_RX | I40E_FLAG_SOURCE_PRUNING_DISABLED))
+	    I40E_FLAG_LEGACY_RX | I40E_FLAG_SOURCE_PRUNING_DISABLED |
+	    I40E_FLAG_SOURCE_PRUNING))
 		reset_needed = BIT(__I40E_PF_RESET_REQUESTED);
 
 	/* Before we finalize any flag changes, we need to perform some
@@ -5397,6 +5400,18 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
 		dev_warn(&pf->pdev->dev,
 			 "Turning on link-down-on-close flag may affect other partitions\n");
 
+	if (changed_flags & I40E_FLAG_SOURCE_PRUNING_DISABLED) {
+		if (new_flags & I40E_FLAG_SOURCE_PRUNING_DISABLED)
+			new_flags &= ~(I40E_FLAG_SOURCE_PRUNING);
+		else
+			new_flags |= I40E_FLAG_SOURCE_PRUNING;
+	} else if (changed_flags & I40E_FLAG_SOURCE_PRUNING) {
+		if (new_flags & I40E_FLAG_SOURCE_PRUNING)
+			new_flags &= ~(I40E_FLAG_SOURCE_PRUNING_DISABLED);
+		else
+			new_flags |= I40E_FLAG_SOURCE_PRUNING_DISABLED;
+	}
+
 	if (changed_flags & I40E_FLAG_DISABLE_FW_LLDP) {
 		if (new_flags & I40E_FLAG_DISABLE_FW_LLDP) {
 #ifdef CONFIG_I40E_DCB
drivers/net/ethernet/intel/i40e/i40e_main.c +9 -4
index b36bf9c..fe3fea4 100644
@@ -12834,6 +12834,9 @@ static int i40e_sw_init(struct i40e_pf *pf)
 		dev_info(&pf->pdev->dev,
 			 "total-port-shutdown was enabled, link-down-on-close is forced on\n");
 	}
+	/* VSIs have source pruning enabled by default */
+	pf->flags |= I40E_FLAG_SOURCE_PRUNING;
+
 	mutex_init(&pf->switch_mutex);
 
 sw_init_done:
@@ -13880,11 +13883,13 @@ static int i40e_add_vsi(struct i40e_vsi *vsi)
 
 		enabled_tc = i40e_pf_get_tc_map(pf);
 
-		/* Source pruning is enabled by default, so the flag is
-		 * negative logic - if it's set, we need to fiddle with
-		 * the VSI to disable source pruning.
+		/* Source pruning is enabled by default, one flag is negative
+		 * logic and the second is positive logic if source pruning is
+		 * enabled, we need to fiddle with the VSI to disable source
+		 * pruning.
 		 */
-		if (pf->flags & I40E_FLAG_SOURCE_PRUNING_DISABLED) {
+		if ((pf->flags & I40E_FLAG_SOURCE_PRUNING_DISABLED) ||
+		    !(pf->flags & I40E_FLAG_SOURCE_PRUNING)) {
 			memset(&ctxt, 0, sizeof(ctxt));
 			ctxt.seid = pf->main_vsi_seid;
 			ctxt.pf_num = pf->hw.pf_id;
Signature · 6 lines
2.31.1

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan