Skip to contentSkip to conversation

iavf: Fix handling of vlan strip virtual channel messages

PATCH New Michal Maloszewski 3 participants 4 messages Oct 28, 2021 – Nov 1, 2021

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

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.

Fixes 310a2ad92e3f ("virtchnl: rename i40e to generic virtchnl")
---
 .../net/ethernet/intel/iavf/iavf_virtchnl.c   | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +42 -0
index bdc6040361..ed1c8bc3f4 100644
@@ -1456,6 +1456,24 @@ void iavf_request_reset(struct iavf_adapter *adapter)
 	adapter->current_op = VIRTCHNL_OP_UNKNOWN;
 }
 
+/**
+ * iavf_netdev_features_vlan_strip_set - update vlan strip status
+ * @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 +1697,18 @@ 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");
+			/* 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 +1925,20 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,
 		spin_unlock_bh(&adapter->adv_rss_lock);
 		}
 		break;
+	case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:
+		/* 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:
+		/* 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
#1 lore raw

PATCH 1/1 iavf: Fix handling of vlan strip virtual channel messages

Quoted 9 lines · Michal Maloszewski

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.

Fixes 310a2ad92e3f ("virtchnl: rename i40e to generic virtchnl")

---

Since this an update to a previous patch, this should be a v2 and include changelog.

Also, this doesn't seem to address Jesse's comment on netdev_update_features()

Quoted 92 lines

?.../net/ethernet/intel/iavf/iavf_virtchnl.c?? | 42
+++++++++++++++++++
?1 file changed, 42 insertions(+)

drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +0 -0
index bdc6040361..ed1c8bc3f4 100644
@@ -1456,6 +1456,24 @@ 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 - update vlan strip status
+ * @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 structure

drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +0 -0
@@ -1679,8 +1697,18 @@ 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"); +???????????????????????/* 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",

drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +3 -0
@@ -1897,6 +1925,20 @@ void iavf_virtchnl_completion(struct
 iavf_adapter *adapter,
 ????????????????spin_unlock_bh(&adapter->adv_rss_lock);
 ????????????????}
 ????????????????break;
+???????case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:
+???????????????/* 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:
+???????????????/* 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-

Quoted 1 line

current_op))

????????????????????????dev_dbg(&adapter->pdev->dev, "Expected response %d from PF, received %d\n",

#2 lore raw
In reply to Michal Maloszewski
Thank you for the patch! Yet something to improve:

Hi Michal,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tnguy-next-queue/dev-queue]
[also build test ERROR on v5.15-rc7 next-20211029]
[cannot apply to net/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Michal-Maloszewski/iavf-Fix-handling-of-vlan-strip-virtual-channel-messages/20211028-190947
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue
config: x86_64-randconfig-a011-20211031 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d321548c3ce987f4f21350ba1c81fdb5d4354224)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/a899b5944ecc501aa3c6075c2edfe0ec702802f7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Michal-Maloszewski/iavf-Fix-handling-of-vlan-strip-virtual-channel-messages/20211028-190947 git checkout a899b5944ecc501aa3c6075c2edfe0ec702802f7
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

>> drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1471:30: error: use of undeclared identifier 'NETIF_F_HW_VLAN_RX'
                           NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_RX;
                                                     ^
   drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1474:32: error: use of undeclared identifier 'NETIF_F_HW_VLAN_RX'
                           ~NETIF_F_HW_VLAN_CTAG_RX & ~NETIF_F_HW_VLAN_RX;
                                                       ^

2 errors generated.

vim +/NETIF_F_HW_VLAN_RX +1471 drivers/net/ethernet/intel/iavf/iavf_virtchnl.c

1458
1459 /**
1460 * iavf_netdev_features_vlan_strip_set - update vlan strip status
1461 * @netdev: ptr to netdev being adjusted
1462 * @enable: enable or disable vlan strip
1463 *
1464 * Helper function to change vlan strip status in netdev->features.
1465 */
1466 static void iavf_netdev_features_vlan_strip_set(struct net_device *netdev,
1467 const bool enable)
1468 {
1469 if (enable)
1470 netdev->features |=

> 1471				NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_RX;

1472 else
1473 netdev->features &=
1474 ~NETIF_F_HW_VLAN_CTAG_RX & ~NETIF_F_HW_VLAN_RX;
1475 }
1476

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 34630 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20211031/87d1b25c/attachment-0001.bin>

#3 lore raw
In reply to Michal Maloszewski
Thank you for the patch! Yet something to improve:

Hi Michal,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tnguy-next-queue/dev-queue]
[also build test ERROR on v5.15 next-20211029]
[cannot apply to net/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Michal-Maloszewski/iavf-Fix-handling-of-vlan-strip-virtual-channel-messages/20211028-190947
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue
config: s390-allyesconfig (attached as .config)
compiler: s390-linux-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/a899b5944ecc501aa3c6075c2edfe0ec702802f7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Michal-Maloszewski/iavf-Fix-handling-of-vlan-strip-virtual-channel-messages/20211028-190947 git checkout a899b5944ecc501aa3c6075c2edfe0ec702802f7
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

drivers/net/ethernet/intel/iavf/iavf_virtchnl.c: In function 'iavf_netdev_features_vlan_strip_set':

>> drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1471:51: error: 'NETIF_F_HW_VLAN_RX' undeclared (first use in this function); did you mean 'NETIF_F_HW_TLS_RX'?
    1471 |                         NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_RX;
         |                                                   ^~~~~~~~~~~~~~~~~~
         |                                                   NETIF_F_HW_TLS_RX

drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1471:51: note: each undeclared identifier is reported only once for each function it appears in

vim +1471 drivers/net/ethernet/intel/iavf/iavf_virtchnl.c

1458
1459 /**
1460 * iavf_netdev_features_vlan_strip_set - update vlan strip status
1461 * @netdev: ptr to netdev being adjusted
1462 * @enable: enable or disable vlan strip
1463 *
1464 * Helper function to change vlan strip status in netdev->features.
1465 */
1466 static void iavf_netdev_features_vlan_strip_set(struct net_device *netdev,
1467 const bool enable)
1468 {
1469 if (enable)
1470 netdev->features |=

> 1471				NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_RX;

1472 else
1473 netdev->features &=
1474 ~NETIF_F_HW_VLAN_CTAG_RX & ~NETIF_F_HW_VLAN_RX;
1475 }
1476

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 67922 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20211101/f61ea037/attachment-0001.bin>