Skip to content

Commit c4445ae

Browse files
mawilli1Jeff Kirsher
authored andcommitted
i40evf: Fix VLAN features
Users of ethtool were being given the mistaken impression that this driver was able to change its VLAN tagging features, and were disappointed that this was not actually the case. Implement ndo_fix_features method so that we can adjust these flags as needed to avoid false impressions. Change-ID: I08584f103a4fa73d6a4128d472e4ef44dcfda57f Signed-off-by: Mitch Williams <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 442b25e commit c4445ae

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/net/ethernet/intel/i40evf/i40evf_main.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2252,6 +2252,28 @@ static int i40evf_change_mtu(struct net_device *netdev, int new_mtu)
22522252
return 0;
22532253
}
22542254

2255+
#define I40EVF_VLAN_FEATURES (NETIF_F_HW_VLAN_CTAG_TX |\
2256+
NETIF_F_HW_VLAN_CTAG_RX |\
2257+
NETIF_F_HW_VLAN_CTAG_FILTER)
2258+
2259+
/**
2260+
* i40evf_fix_features - fix up the netdev feature bits
2261+
* @netdev: our net device
2262+
* @features: desired feature bits
2263+
*
2264+
* Returns fixed-up features bits
2265+
**/
2266+
static netdev_features_t i40evf_fix_features(struct net_device *netdev,
2267+
netdev_features_t features)
2268+
{
2269+
struct i40evf_adapter *adapter = netdev_priv(netdev);
2270+
2271+
features &= ~I40EVF_VLAN_FEATURES;
2272+
if (adapter->vf_res->vf_offload_flags & I40E_VIRTCHNL_VF_OFFLOAD_VLAN)
2273+
features |= I40EVF_VLAN_FEATURES;
2274+
return features;
2275+
}
2276+
22552277
static const struct net_device_ops i40evf_netdev_ops = {
22562278
.ndo_open = i40evf_open,
22572279
.ndo_stop = i40evf_close,
@@ -2264,6 +2286,7 @@ static const struct net_device_ops i40evf_netdev_ops = {
22642286
.ndo_tx_timeout = i40evf_tx_timeout,
22652287
.ndo_vlan_rx_add_vid = i40evf_vlan_rx_add_vid,
22662288
.ndo_vlan_rx_kill_vid = i40evf_vlan_rx_kill_vid,
2289+
.ndo_fix_features = i40evf_fix_features,
22672290
#ifdef CONFIG_NET_POLL_CONTROLLER
22682291
.ndo_poll_controller = i40evf_netpoll,
22692292
#endif

0 commit comments

Comments
 (0)