i40e/i40evf: support for VF VLAN tag stripping control
This patch gives VF capability to control VLAN tag stripping via ethtool. As rx-vlan-offload was fixed before, now the VF is able to change it using "ethtool --offload <IF> rxvlan on/off" settings. Signed-off-by: Mariusz Stachura <mariusz.stachura@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
committed by
Jeff Kirsher
parent
8c9eb350aa
commit
8774370d26
@ -261,6 +261,8 @@ struct i40evf_adapter {
|
||||
#define I40EVF_FLAG_AQ_RELEASE_PROMISC BIT(16)
|
||||
#define I40EVF_FLAG_AQ_REQUEST_ALLMULTI BIT(17)
|
||||
#define I40EVF_FLAG_AQ_RELEASE_ALLMULTI BIT(18)
|
||||
#define I40EVF_FLAG_AQ_ENABLE_VLAN_STRIPPING BIT(19)
|
||||
#define I40EVF_FLAG_AQ_DISABLE_VLAN_STRIPPING BIT(20)
|
||||
|
||||
/* OS defined structs */
|
||||
struct net_device *netdev;
|
||||
@ -358,6 +360,8 @@ void i40evf_get_hena(struct i40evf_adapter *adapter);
|
||||
void i40evf_set_hena(struct i40evf_adapter *adapter);
|
||||
void i40evf_set_rss_key(struct i40evf_adapter *adapter);
|
||||
void i40evf_set_rss_lut(struct i40evf_adapter *adapter);
|
||||
void i40evf_enable_vlan_stripping(struct i40evf_adapter *adapter);
|
||||
void i40evf_disable_vlan_stripping(struct i40evf_adapter *adapter);
|
||||
void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
|
||||
enum virtchnl_ops v_opcode,
|
||||
i40e_status v_retval, u8 *msg, u16 msglen);
|
||||
|
@ -1676,6 +1676,16 @@ static void i40evf_watchdog_task(struct work_struct *work)
|
||||
goto watchdog_done;
|
||||
}
|
||||
|
||||
if (adapter->aq_required & I40EVF_FLAG_AQ_ENABLE_VLAN_STRIPPING) {
|
||||
i40evf_enable_vlan_stripping(adapter);
|
||||
goto watchdog_done;
|
||||
}
|
||||
|
||||
if (adapter->aq_required & I40EVF_FLAG_AQ_DISABLE_VLAN_STRIPPING) {
|
||||
i40evf_disable_vlan_stripping(adapter);
|
||||
goto watchdog_done;
|
||||
}
|
||||
|
||||
if (adapter->aq_required & I40EVF_FLAG_AQ_CONFIGURE_QUEUES) {
|
||||
i40evf_configure_queues(adapter);
|
||||
goto watchdog_done;
|
||||
@ -2293,6 +2303,28 @@ static int i40evf_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* i40e_set_features - set the netdev feature flags
|
||||
* @netdev: ptr to the netdev being adjusted
|
||||
* @features: the feature set that the stack is suggesting
|
||||
* Note: expects to be called while under rtnl_lock()
|
||||
**/
|
||||
static int i40evf_set_features(struct net_device *netdev,
|
||||
netdev_features_t features)
|
||||
{
|
||||
struct i40evf_adapter *adapter = netdev_priv(netdev);
|
||||
|
||||
if (!VLAN_ALLOWED(adapter))
|
||||
return -EINVAL;
|
||||
|
||||
if (features & NETIF_F_HW_VLAN_CTAG_RX)
|
||||
adapter->aq_required |= I40EVF_FLAG_AQ_ENABLE_VLAN_STRIPPING;
|
||||
else
|
||||
adapter->aq_required |= I40EVF_FLAG_AQ_DISABLE_VLAN_STRIPPING;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* i40evf_features_check - Validate encapsulated packet conforms to limits
|
||||
* @skb: skb buff
|
||||
@ -2386,6 +2418,7 @@ static const struct net_device_ops i40evf_netdev_ops = {
|
||||
.ndo_vlan_rx_kill_vid = i40evf_vlan_rx_kill_vid,
|
||||
.ndo_features_check = i40evf_features_check,
|
||||
.ndo_fix_features = i40evf_fix_features,
|
||||
.ndo_set_features = i40evf_set_features,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
.ndo_poll_controller = i40evf_netpoll,
|
||||
#endif
|
||||
|
@ -820,6 +820,46 @@ void i40evf_set_rss_lut(struct i40evf_adapter *adapter)
|
||||
kfree(vrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* i40evf_enable_vlan_stripping
|
||||
* @adapter: adapter structure
|
||||
*
|
||||
* Request VLAN header stripping to be enabled
|
||||
**/
|
||||
void i40evf_enable_vlan_stripping(struct i40evf_adapter *adapter)
|
||||
{
|
||||
if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
|
||||
/* bail because we already have a command pending */
|
||||
dev_err(&adapter->pdev->dev, "Cannot enable stripping, command %d pending\n",
|
||||
adapter->current_op);
|
||||
return;
|
||||
}
|
||||
adapter->current_op = VIRTCHNL_OP_ENABLE_VLAN_STRIPPING;
|
||||
adapter->aq_required &= ~I40EVF_FLAG_AQ_ENABLE_VLAN_STRIPPING;
|
||||
i40evf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_VLAN_STRIPPING,
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* i40evf_disable_vlan_stripping
|
||||
* @adapter: adapter structure
|
||||
*
|
||||
* Request VLAN header stripping to be disabled
|
||||
**/
|
||||
void i40evf_disable_vlan_stripping(struct i40evf_adapter *adapter)
|
||||
{
|
||||
if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
|
||||
/* bail because we already have a command pending */
|
||||
dev_err(&adapter->pdev->dev, "Cannot disable stripping, command %d pending\n",
|
||||
adapter->current_op);
|
||||
return;
|
||||
}
|
||||
adapter->current_op = VIRTCHNL_OP_DISABLE_VLAN_STRIPPING;
|
||||
adapter->aq_required &= ~I40EVF_FLAG_AQ_DISABLE_VLAN_STRIPPING;
|
||||
i40evf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING,
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* i40evf_print_link_message - print link up or down
|
||||
* @adapter: adapter structure
|
||||
|
Reference in New Issue
Block a user