i40e: check vsi type before setting xdp_features flag
authorLorenzo Bianconi <lorenzo@kernel.org>
Tue, 14 Feb 2023 20:07:33 +0000 (21:07 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 16 Feb 2023 03:07:54 +0000 (19:07 -0800)
Set xdp_features flag just for I40E_VSI_MAIN vsi type since XDP is
supported just in this configuration.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/f2b537f86b34fc176fbc6b3d249b46a20a87a2f3.1676405131.git.lorenzo@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/i40e/i40e_main.c

index 3667ad6..1171188 100644 (file)
@@ -13787,8 +13787,6 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
        netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID;
 
        netdev->features &= ~NETIF_F_HW_TC;
-       netdev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
-                              NETDEV_XDP_ACT_XSK_ZEROCOPY;
 
        if (vsi->type == I40E_VSI_MAIN) {
                SET_NETDEV_DEV(netdev, &pf->pdev->dev);
@@ -13807,6 +13805,10 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
                spin_lock_bh(&vsi->mac_filter_hash_lock);
                i40e_add_mac_filter(vsi, mac_addr);
                spin_unlock_bh(&vsi->mac_filter_hash_lock);
+
+               netdev->xdp_features = NETDEV_XDP_ACT_BASIC |
+                                      NETDEV_XDP_ACT_REDIRECT |
+                                      NETDEV_XDP_ACT_XSK_ZEROCOPY;
        } else {
                /* Relate the VSI_VMDQ name to the VSI_MAIN name. Note that we
                 * are still limited by IFNAMSIZ, but we're adding 'v%d\0' to