iavf: Fix handling of vlan strip virtual channel messages
Subsystems (2)
PATCH 1/1 iavf: Fix handling of vlan strip virtual channel messages
Modify netdev->features for vlan stripping based on virtual channel messages received from the PF. Change is needed to synchronize vlan strip status between PF sysfs and iavf ethtool.
--- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 48 ++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +47 -1
@@ -1456,6 +1456,22 @@ void iavf_request_reset(struct iavf_adapter *adapter) adapter->current_op =VIRTCHNL_OP_UNKNOWN ; } +/** +* iavf_netdev_features_vlan_strip_set +* @netdev: ptr to netdev being adjusted +* @enable: enable or disable vlan strip +* +* Helper function to change vlan strip status in netdev->features. +**/ +static void iavf_netdev_features_vlan_strip_set (struct net_device *netdev, +const bool enable) +{ +if (enable) + netdev->features |=NETIF_F_HW_VLAN_CTAG_RX |NETIF_F_HW_VLAN_RX ; +else + netdev->features &= ~NETIF_F_HW_VLAN_CTAG_RX & ~NETIF_F_HW_VLAN_RX ; +} +/** * iavf_virtchnl_completion * @adapter: adapter structure
@@ -1679,8 +1695,22 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, }break ;case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING : +dev_warn (&adapter->pdev->dev, +"Changing VLAN Stripping is not allowed when Port VLAN is configured\n" ); +/* +* Vlan stripping could not be enabled by ethtool. +* Disable it in netdev->features. +*/ +iavf_netdev_features_vlan_strip_set (netdev, false); +break ;case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING : -dev_warn (&adapter->pdev->dev,"Changing VLAN Stripping is not allowed when Port VLAN is configured\n" ); +dev_warn (&adapter->pdev->dev, +"Changing VLAN Stripping is not allowed when Port VLAN is configured\n" ); +/* +* Vlan stripping could not be disabled by ethtool. +* Enable it in netdev->features. +*/ +iavf_netdev_features_vlan_strip_set (netdev, true);break ;default : dev_err(&adapter->pdev->dev, "PF returned error %d (%s) to our request %d\n",
@@ -1897,6 +1927,22 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,spin_unlock_bh (&adapter->adv_rss_lock); }break ; +case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING : +/* +* Got information that PF enabled vlan strip on this VF. +* Update netdev->features if needed to be in sync with ethtool. +*/ +if (!v_retval) +iavf_netdev_features_vlan_strip_set (netdev, true); +break ; +case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING : +/* +* Got information that PF disabled vlan strip on this VF. +* Update netdev->features if needed to be in sync with ethtool. +*/ +if (!v_retval) +iavf_netdev_features_vlan_strip_set (netdev, false); +break ;default :if (adapter->current_op && (v_opcode != adapter->current_op)) dev_dbg(&adapter->pdev->dev, "Expected response %d from PF, received %d\n",
Signature · 1 line
2.27.0
Nguyen
PATCH 1/1 iavf: Fix handling of vlan strip virtual channel messages
Quoted 3 lines · Michal Maloszewski
Modify
netdev->featuresfor vlan stripping based on virtual channel messages received from the PF. Change is needed to synchronize vlan strip status between PF sysfs and iavf ethtool.
This patch doesn't apply.
Quoted 2 lines
Fixes: iavf:
129cf89e58567("rename functions and structs to new name")
The Fixes tag is incorrect. It should look like this:
number of pages it actually freed")
https://www.kernel.org/doc/html/latest/process/submitting-
patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and- fixes
Quoted 43 lines
Signed-off-by Norbert Ciosek <[email protected]>Signed-off-by Michal Maloszewski <[email protected]>---
?.../net/ethernet/intel/iavf/iavf_virtchnl.c?? | 48
++++++++++++++++++-
?1 file changed, 47 insertions(+), 1 deletion(-)drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +0
-0@@ -1456,6 +1456,22 @@ void iavf_request_reset(struct iavf_adapter *adapter) ????????adapter->current_op = VIRTCHNL_OP_UNKNOWN; ?}?
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +8
-0+/** +* iavf_netdev_features_vlan_strip_set +* @netdev: ptr to netdev being adjusted +* @enable: enable or disable vlan strip +* +* Helper function to change vlan strip status in netdev->features. +**/ +static void iavf_netdev_features_vlan_strip_set(struct net_device*netdev,
+????????????????????????????????????????????? const bool enable) +{
+???????if (enable)
+???????????netdev->features|=NETIF_F_HW_VLAN_CTAG_RX|NETIF_F_HW_VLAN_RX;
+???????else
+???????????netdev->features&= ~NETIF_F_HW_VLAN_CTAG_RX & ~NETIF_F_HW_VLAN_RX;drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +2
-0+} +?/**
? *iavf_virtchnl_completion
? * @adapter: adapter structuredrivers/net/ethernet/intel/iavf/iavf_virtchnl.c +0
-0@@ -1679,8 +1695,22 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, ????????????????????????} ????????????????????????break;
Quoted 4 lines
????????????????case
VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:
+???????????????????????dev_warn(&adapter->pdev->dev, +??????????????????????????????? "Changing VLAN Stripping is not allowed when Port VLAN is configured\n");
splitting this line isn't needed
Quoted 6 lines
+???????????????????????/*
+??????????????????????? * Vlan stripping could not be enabled by ethtool.
+??????????????????????? * Disable it innetdev->features. +??????????????????????? */ +???????????????????????iavf_netdev_features_vlan_strip_set(netdev,
Quoted 8 lines
false);
+???????????????????????break;
????????????????caseVIRTCHNL_OP_DISABLE_VLAN_STRIPPING:
-???????????????????????dev_warn(&adapter->pdev->dev, "Changing VLAN Stripping is not allowed when Port VLAN is configured\n"); +???????????????????????dev_warn(&adapter->pdev->dev, +??????????????????????????????? "Changing VLAN Stripping is not allowed when Port VLAN is configured\n");
Why the change? Strings can be long line
Quoted 7 lines
+???????????????????????/*
+??????????????????????? * Vlan stripping could not be disabled by ethtool.
+??????????????????????? * Enable it innetdev->features. +??????????????????????? */ +???????????????????????iavf_netdev_features_vlan_strip_set(netdev, true);
This comment style is incorrect for netdev patches.
For files in net/ and drivers/net/ the preferred style for long (multi- line) comments is a little different.
/* The preferred comment style for files in net/ and drivers/net
* looks like this.
*
* It is nearly the same as the generally preferred comment style,
* but there is no initial almost-blank line.
*/
https://www.kernel.org/doc/html/latest/process/coding-style.html
Quoted 12 lines
????????????????????????break;
????????????????default:
????????????????????????dev_err(&adapter->pdev->dev, "PF returned error %d (%s) to our request %d\n",drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +3
-0@@ -1897,6 +1927,22 @@ void iavf_virtchnl_completion(structiavf_adapter *adapter, ????????????????spin_unlock_bh(&adapter->adv_rss_lock); ????????????????} ????????????????break; +???????case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING: +???????????????/* +??????????????? * Got information that PF enabled vlan strip on this
Quoted 4 lines
VF.
+??????????????? * Updatenetdev->featuresif needed to be in sync with ethtool.
+??????????????? */
ditto for comment style
Quoted 11 lines
+???????????????if (!v_retval) +???????????????????????iavf_netdev_features_vlan_strip_set(netdev, true);
+???????????????break;
+???????caseVIRTCHNL_OP_DISABLE_VLAN_STRIPPING:
+???????????????/*
+??????????????? * Got information that PF disabled vlan strip on this VF.
+??????????????? * Updatenetdev->featuresif needed to be in sync with ethtool.
+??????????????? */
ditto for comment style
Quoted 9 lines
+???????????????if (!v_retval) +???????????????????????iavf_netdev_features_vlan_strip_set(netdev, false);
+???????????????break;
????????default:
????????????????if (adapter->current_op&& (v_opcode!= adapter-Quoted 1 line
current_op))????????????????????????dev_dbg(&adapter->pdev->dev, "Expected response %d from PF, received %d\n",