提交 b0fe3306 编写于 作者: A Alexander Duyck 提交者: Jeff Kirsher

i40e/i40evf: Clean up feature flags

The feature flags list for i40e and i40evf is beginning to become pretty
massive.  I plan to add another 4 or so features to these drivers and
duplicating the flags for each and every flags list is becoming a bit
repetitive.

The primary change here is that we now build our features list around
hw_encap_features.  After that we assign that to vlan_features,
hw_features, and finally map that onto features.  In addition we end up
throwing features onto hw_encap_features that end up having no effect such
as the Rx offloads and SCTP_CRC.  However that should have no impact and
makes things a bit easier for us as hw_encap_features is one of the less
updated features maps available.

For i40evf I went through and sanity checked a few features as well.
Specifically RXCSUM was being set as a read-only feature which didn't make
much sense.  I have updated things so we can clear the NETIF_F_RXCSUM flag
since that is really a software feature and not a hardware one anyway so
disabling it is just a matter of ignoring the result from the hardware.
Signed-off-by: NAlexander Duyck <aduyck@mirantis.com>
Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 6a025a50
...@@ -9111,40 +9111,36 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) ...@@ -9111,40 +9111,36 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
np = netdev_priv(netdev); np = netdev_priv(netdev);
np->vsi = vsi; np->vsi = vsi;
netdev->hw_enc_features |= NETIF_F_IP_CSUM | netdev->hw_enc_features |= NETIF_F_SG |
NETIF_F_IPV6_CSUM | NETIF_F_IP_CSUM |
NETIF_F_TSO | NETIF_F_IPV6_CSUM |
NETIF_F_TSO6 | NETIF_F_HIGHDMA |
NETIF_F_TSO_ECN | NETIF_F_SOFT_FEATURES |
NETIF_F_GSO_GRE | NETIF_F_TSO |
NETIF_F_GSO_UDP_TUNNEL | NETIF_F_TSO_ECN |
NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_TSO6 |
NETIF_F_GSO_GRE |
NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_RXHASH |
NETIF_F_RXCSUM |
0; 0;
netdev->features = NETIF_F_SG | if (!(pf->flags & I40E_FLAG_OUTER_UDP_CSUM_CAPABLE))
NETIF_F_IP_CSUM | netdev->hw_enc_features ^= NETIF_F_GSO_UDP_TUNNEL_CSUM;
NETIF_F_SCTP_CRC |
NETIF_F_HIGHDMA | /* record features VLANs can make use of */
NETIF_F_GSO_UDP_TUNNEL | netdev->vlan_features |= netdev->hw_enc_features;
NETIF_F_GSO_GRE |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_IPV6_CSUM |
NETIF_F_TSO |
NETIF_F_TSO_ECN |
NETIF_F_TSO6 |
NETIF_F_RXCSUM |
NETIF_F_RXHASH |
0;
if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) if (!(pf->flags & I40E_FLAG_MFP_ENABLED))
netdev->features |= NETIF_F_NTUPLE; netdev->hw_features |= NETIF_F_NTUPLE;
if (pf->flags & I40E_FLAG_OUTER_UDP_CSUM_CAPABLE)
netdev->features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; netdev->hw_features |= netdev->hw_enc_features |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX;
/* copy netdev features into list of user selectable features */ netdev->features |= netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER;
netdev->hw_features |= netdev->features;
if (vsi->type == I40E_VSI_MAIN) { if (vsi->type == I40E_VSI_MAIN) {
SET_NETDEV_DEV(netdev, &pf->pdev->dev); SET_NETDEV_DEV(netdev, &pf->pdev->dev);
...@@ -9183,12 +9179,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) ...@@ -9183,12 +9179,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
ether_addr_copy(netdev->dev_addr, mac_addr); ether_addr_copy(netdev->dev_addr, mac_addr);
ether_addr_copy(netdev->perm_addr, mac_addr); ether_addr_copy(netdev->perm_addr, mac_addr);
/* vlan gets same features (except vlan offload)
* after any tweaks for specific VSI types
*/
netdev->vlan_features = netdev->features & ~(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_FILTER);
netdev->priv_flags |= IFF_UNICAST_FLT; netdev->priv_flags |= IFF_UNICAST_FLT;
netdev->priv_flags |= IFF_SUPP_NOFCS; netdev->priv_flags |= IFF_SUPP_NOFCS;
/* Setup netdev TC information */ /* Setup netdev TC information */
......
...@@ -2337,40 +2337,38 @@ int i40evf_process_config(struct i40evf_adapter *adapter) ...@@ -2337,40 +2337,38 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
return -ENODEV; return -ENODEV;
} }
netdev->features |= NETIF_F_HIGHDMA | netdev->hw_enc_features |= NETIF_F_SG |
NETIF_F_SG | NETIF_F_IP_CSUM |
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_SCTP_CRC | NETIF_F_HIGHDMA |
NETIF_F_IPV6_CSUM | NETIF_F_SOFT_FEATURES |
NETIF_F_TSO | NETIF_F_TSO |
NETIF_F_TSO6 | NETIF_F_TSO_ECN |
NETIF_F_TSO_ECN | NETIF_F_TSO6 |
NETIF_F_GSO_GRE | NETIF_F_GSO_GRE |
NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_RXCSUM | NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GRO; NETIF_F_SCTP_CRC |
NETIF_F_RXHASH |
netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
NETIF_F_IPV6_CSUM | 0;
NETIF_F_TSO |
NETIF_F_TSO6 | if (!(adapter->flags & I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE))
NETIF_F_TSO_ECN | netdev->hw_enc_features ^= NETIF_F_GSO_UDP_TUNNEL_CSUM;
NETIF_F_GSO_GRE |
NETIF_F_GSO_UDP_TUNNEL | /* record features VLANs can make use of */
NETIF_F_GSO_UDP_TUNNEL_CSUM; netdev->vlan_features |= netdev->hw_enc_features;
if (adapter->flags & I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE) /* Write features and hw_features separately to avoid polluting
netdev->features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; * with, or dropping, features that are set when we registgered.
*/
/* always clear VLAN features because they can change at every reset */ netdev->hw_features |= netdev->hw_enc_features;
netdev->features &= ~(I40EVF_VLAN_FEATURES);
/* copy netdev features into list of user selectable features */ netdev->features |= netdev->hw_enc_features | I40EVF_VLAN_FEATURES;
netdev->hw_features |= netdev->features;
/* disable VLAN features if not supported */
if (vfres->vf_offload_flags & I40E_VIRTCHNL_VF_OFFLOAD_VLAN) { if (!(vfres->vf_offload_flags & I40E_VIRTCHNL_VF_OFFLOAD_VLAN))
netdev->vlan_features = netdev->features; netdev->features ^= I40EVF_VLAN_FEATURES;
netdev->features |= I40EVF_VLAN_FEATURES;
}
adapter->vsi.id = adapter->vsi_res->vsi_id; adapter->vsi.id = adapter->vsi_res->vsi_id;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册