2018-03-22 10:08:48 -07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2018-04-26 08:08:09 -07:00
|
|
|
/* Copyright(c) 2013 - 2018 Intel Corporation. */
|
2013-12-21 06:13:06 +00:00
|
|
|
|
2018-09-14 17:37:46 -07:00
|
|
|
#ifndef _IAVF_H_
|
|
|
|
#define _IAVF_H_
|
2013-12-21 06:13:06 +00:00
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/aer.h>
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/vmalloc.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/ethtool.h>
|
|
|
|
#include <linux/if_vlan.h>
|
|
|
|
#include <linux/ip.h>
|
|
|
|
#include <linux/tcp.h>
|
|
|
|
#include <linux/sctp.h>
|
|
|
|
#include <linux/ipv6.h>
|
2017-06-20 15:17:01 -07:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/bitops.h>
|
|
|
|
#include <linux/timer.h>
|
|
|
|
#include <linux/workqueue.h>
|
2017-06-23 04:24:44 -04:00
|
|
|
#include <linux/wait.h>
|
2017-06-20 15:17:01 -07:00
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/gfp.h>
|
|
|
|
#include <linux/skbuff.h>
|
|
|
|
#include <linux/dma-mapping.h>
|
|
|
|
#include <linux/etherdevice.h>
|
|
|
|
#include <linux/socket.h>
|
|
|
|
#include <linux/jiffies.h>
|
2013-12-21 06:13:06 +00:00
|
|
|
#include <net/ip6_checksum.h>
|
2018-01-23 08:50:57 -08:00
|
|
|
#include <net/pkt_cls.h>
|
2013-12-21 06:13:06 +00:00
|
|
|
#include <net/udp.h>
|
2018-01-23 08:51:05 -08:00
|
|
|
#include <net/tc_act/tc_gact.h>
|
|
|
|
#include <net/tc_act/tc_mirred.h>
|
2013-12-21 06:13:06 +00:00
|
|
|
|
2018-09-14 17:37:56 -07:00
|
|
|
#include "iavf_type.h"
|
2017-05-11 11:23:09 -07:00
|
|
|
#include <linux/avf/virtchnl.h>
|
2018-09-14 17:37:48 -07:00
|
|
|
#include "iavf_txrx.h"
|
2021-03-09 11:08:11 +08:00
|
|
|
#include "iavf_fdir.h"
|
2021-04-13 08:48:41 +08:00
|
|
|
#include "iavf_adv_rss.h"
|
2021-06-04 09:53:27 -07:00
|
|
|
#include <linux/bitmap.h>
|
2013-12-21 06:13:06 +00:00
|
|
|
|
|
|
|
#define DEFAULT_DEBUG_LEVEL_SHIFT 3
|
2018-09-14 17:37:46 -07:00
|
|
|
#define PFX "iavf: "
|
2013-12-21 06:13:06 +00:00
|
|
|
|
2022-01-27 15:16:29 +01:00
|
|
|
int iavf_status_to_errno(enum iavf_status status);
|
|
|
|
int virtchnl_status_to_errno(enum virtchnl_status_code v_status);
|
|
|
|
|
2017-04-21 13:38:05 -07:00
|
|
|
/* VSI state flags shared with common code */
|
2018-09-14 17:37:46 -07:00
|
|
|
enum iavf_vsi_state_t {
|
2018-09-14 17:37:55 -07:00
|
|
|
__IAVF_VSI_DOWN,
|
2017-04-19 09:25:55 -04:00
|
|
|
/* This must be last as it determines the size of the BITMAP */
|
2018-09-14 17:37:55 -07:00
|
|
|
__IAVF_VSI_STATE_SIZE__,
|
2017-04-21 13:38:05 -07:00
|
|
|
};
|
|
|
|
|
2013-12-21 06:13:06 +00:00
|
|
|
/* dummy struct to make common code less painful */
|
2018-09-14 17:37:55 -07:00
|
|
|
struct iavf_vsi {
|
2018-09-14 17:37:46 -07:00
|
|
|
struct iavf_adapter *back;
|
2013-12-21 06:13:06 +00:00
|
|
|
struct net_device *netdev;
|
iavf: Add support VIRTCHNL_VF_OFFLOAD_VLAN_V2 during netdev config
Based on VIRTCHNL_VF_OFFLOAD_VLAN_V2, the VF can now support more VLAN
capabilities (i.e. 802.1AD offloads and filtering). In order to
communicate these capabilities to the netdev layer, the VF needs to
parse its VLAN capabilities based on whether it was able to negotiation
VIRTCHNL_VF_OFFLOAD_VLAN or VIRTCHNL_VF_OFFLOAD_VLAN_V2 or neither of
these.
In order to support this, add the following functionality:
iavf_get_netdev_vlan_hw_features() - This is used to determine the VLAN
features that the underlying hardware supports and that can be toggled
off/on based on the negotiated capabiltiies. For example, if
VIRTCHNL_VF_OFFLOAD_VLAN_V2 was negotiated, then any capability marked
with VIRTCHNL_VLAN_TOGGLE can be toggled on/off by the VF. If
VIRTCHNL_VF_OFFLOAD_VLAN was negotiated, then only VLAN insertion and/or
stripping can be toggled on/off.
iavf_get_netdev_vlan_features() - This is used to determine the VLAN
features that the underlying hardware supports and that should be
enabled by default. For example, if VIRTHCNL_VF_OFFLOAD_VLAN_V2 was
negotiated, then any supported capability that has its ethertype_init
filed set should be enabled by default. If VIRTCHNL_VF_OFFLOAD_VLAN was
negotiated, then filtering, stripping, and insertion should be enabled
by default.
Also, refactor iavf_fix_features() to take into account the new
capabilities. To do this, query all the supported features (enabled by
default and toggleable) and make sure the requested change is supported.
If VIRTCHNL_VF_OFFLOAD_VLAN_V2 is successfully negotiated, there is no
need to check VIRTCHNL_VLAN_TOGGLE here because the driver already told
the netdev layer which features can be toggled via netdev->hw_features
during iavf_process_config(), so only those features will be requested
to change.
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-11-29 16:16:01 -08:00
|
|
|
unsigned long active_cvlans[BITS_TO_LONGS(VLAN_N_VID)];
|
|
|
|
unsigned long active_svlans[BITS_TO_LONGS(VLAN_N_VID)];
|
2013-12-21 06:13:06 +00:00
|
|
|
u16 seid;
|
|
|
|
u16 id;
|
2018-09-14 17:37:55 -07:00
|
|
|
DECLARE_BITMAP(state, __IAVF_VSI_STATE_SIZE__);
|
2013-12-21 06:13:06 +00:00
|
|
|
int base_vector;
|
2015-08-28 17:55:58 -04:00
|
|
|
u16 qs_handle;
|
2017-01-24 10:23:59 -08:00
|
|
|
void *priv; /* client driver data reference. */
|
2013-12-21 06:13:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* How many Rx Buffers do we bundle into one write to the hardware ? */
|
2018-09-14 17:37:46 -07:00
|
|
|
#define IAVF_RX_BUFFER_WRITE 16 /* Must be power of 2 */
|
|
|
|
#define IAVF_DEFAULT_TXD 512
|
|
|
|
#define IAVF_DEFAULT_RXD 512
|
|
|
|
#define IAVF_MAX_TXD 4096
|
|
|
|
#define IAVF_MIN_TXD 64
|
|
|
|
#define IAVF_MAX_RXD 4096
|
|
|
|
#define IAVF_MIN_RXD 64
|
|
|
|
#define IAVF_REQ_DESCRIPTOR_MULTIPLE 32
|
|
|
|
#define IAVF_MAX_AQ_BUF_SIZE 4096
|
|
|
|
#define IAVF_AQ_LEN 32
|
|
|
|
#define IAVF_AQ_MAX_ERR 20 /* times to try before resetting AQ */
|
2013-12-21 06:13:06 +00:00
|
|
|
|
|
|
|
#define MAXIMUM_ETHERNET_VLAN_SIZE (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN)
|
|
|
|
|
2018-09-14 17:37:55 -07:00
|
|
|
#define IAVF_RX_DESC(R, i) (&(((union iavf_32byte_rx_desc *)((R)->desc))[i]))
|
|
|
|
#define IAVF_TX_DESC(R, i) (&(((struct iavf_tx_desc *)((R)->desc))[i]))
|
2018-09-14 17:37:49 -07:00
|
|
|
#define IAVF_TX_CTXTDESC(R, i) \
|
2018-09-14 17:37:55 -07:00
|
|
|
(&(((struct iavf_tx_context_desc *)((R)->desc))[i]))
|
2020-02-27 10:14:51 -08:00
|
|
|
#define IAVF_MAX_REQ_QUEUES 16
|
2013-12-21 06:13:06 +00:00
|
|
|
|
2018-09-14 17:37:49 -07:00
|
|
|
#define IAVF_HKEY_ARRAY_SIZE ((IAVF_VFQF_HKEY_MAX_INDEX + 1) * 4)
|
|
|
|
#define IAVF_HLUT_ARRAY_SIZE ((IAVF_VFQF_HLUT_MAX_INDEX + 1) * 4)
|
2018-09-14 17:37:46 -07:00
|
|
|
#define IAVF_MBPS_DIVISOR 125000 /* divisor to convert to Mbps */
|
2022-06-13 18:41:23 -04:00
|
|
|
#define IAVF_MBPS_QUANTA 50
|
2015-06-23 19:00:04 -04:00
|
|
|
|
2020-06-05 10:09:43 -07:00
|
|
|
#define IAVF_VIRTCHNL_VF_RESOURCE_SIZE (sizeof(struct virtchnl_vf_resource) + \
|
|
|
|
(IAVF_MAX_VF_VSI * \
|
|
|
|
sizeof(struct virtchnl_vsi_resource)))
|
|
|
|
|
2013-12-21 06:13:06 +00:00
|
|
|
/* MAX_MSIX_Q_VECTORS of these are allocated,
|
|
|
|
* but we only use one per queue-specific vector.
|
|
|
|
*/
|
2018-09-14 17:37:55 -07:00
|
|
|
struct iavf_q_vector {
|
2018-09-14 17:37:46 -07:00
|
|
|
struct iavf_adapter *adapter;
|
2018-09-14 17:37:55 -07:00
|
|
|
struct iavf_vsi *vsi;
|
2013-12-21 06:13:06 +00:00
|
|
|
struct napi_struct napi;
|
2018-09-14 17:37:55 -07:00
|
|
|
struct iavf_ring_container rx;
|
|
|
|
struct iavf_ring_container tx;
|
2013-12-21 06:13:06 +00:00
|
|
|
u32 ring_mask;
|
2017-12-29 08:52:19 -05:00
|
|
|
u8 itr_countdown; /* when 0 should adjust adaptive ITR */
|
2013-12-21 06:13:06 +00:00
|
|
|
u8 num_ringpairs; /* total number of ring pairs in vector */
|
2017-12-29 08:48:53 -05:00
|
|
|
u16 v_idx; /* index in the vsi->q_vector array. */
|
|
|
|
u16 reg_idx; /* register index of the interrupt */
|
2017-07-12 05:46:11 -04:00
|
|
|
char name[IFNAMSIZ + 15];
|
2015-06-05 12:20:30 -04:00
|
|
|
bool arm_wb_state;
|
i40e/i40evf: fix interrupt affinity bug
There exists a bug in which a 'perfect storm' can occur and cause
interrupts to fail to be correctly affinitized. This causes unexpected
behavior and has a substantial impact on performance when it happens.
The bug occurs if there is heavy traffic, any number of CPUs that have
an i40e interrupt are pegged at 100%, and the interrupt afffinity for
those CPUs is changed. Instead of moving to the new CPU, the interrupt
continues to be polled while there is heavy traffic.
The bug is most readily realized as the driver is first brought up and
all interrupts start on CPU0. If there is heavy traffic and the
interrupt starts polling before the interrupt is affinitized, the
interrupt will be stuck on CPU0 until traffic stops. The bug, however,
can also be wrought out more simply by affinitizing all the interrupts
to a single CPU and then attempting to move any of those interrupts off
while there is heavy traffic.
This patch fixes the bug by registering for update notifications from
the kernel when the interrupt affinity changes. When that fires, we
cache the intended affinity mask. Then, while polling, if the cpu is
pegged at 100% and we failed to clean the rings, we check to make sure
we have the correct affinity and stop polling if we're firing on the
wrong CPU. When the kernel successfully moves the interrupt, it will
start polling on the correct CPU. The performance impact is minimal
since the only time this section gets executed is when performance is
already compromised by the CPU.
Change-ID: I4410a880159b9dba1f8297aa72bef36dca34e830
Signed-off-by: Alan Brady <alan.brady@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2016-09-14 16:24:38 -07:00
|
|
|
cpumask_t affinity_mask;
|
|
|
|
struct irq_affinity_notify affinity_notify;
|
2013-12-21 06:13:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Helper macros to switch between ints/sec and what the register uses.
|
|
|
|
* And yes, it's the same math going both ways. The lowest value
|
2019-04-17 15:17:36 -07:00
|
|
|
* supported by all of the iavf hardware is 8.
|
2013-12-21 06:13:06 +00:00
|
|
|
*/
|
|
|
|
#define EITR_INTS_PER_SEC_TO_REG(_eitr) \
|
|
|
|
((_eitr) ? (1000000000 / ((_eitr) * 256)) : 8)
|
|
|
|
#define EITR_REG_TO_INTS_PER_SEC EITR_INTS_PER_SEC_TO_REG
|
|
|
|
|
2018-09-14 17:37:46 -07:00
|
|
|
#define IAVF_DESC_UNUSED(R) \
|
2013-12-21 06:13:06 +00:00
|
|
|
((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
|
|
|
|
(R)->next_to_clean - (R)->next_to_use - 1)
|
|
|
|
|
|
|
|
#define OTHER_VECTOR 1
|
|
|
|
#define NONQ_VECS (OTHER_VECTOR)
|
|
|
|
|
|
|
|
#define MIN_MSIX_Q_VECTORS 1
|
|
|
|
#define MIN_MSIX_COUNT (MIN_MSIX_Q_VECTORS + NONQ_VECS)
|
|
|
|
|
2018-09-14 17:37:46 -07:00
|
|
|
#define IAVF_QUEUE_END_OF_LIST 0x7FF
|
|
|
|
#define IAVF_FREE_VECTOR 0x7FFF
|
|
|
|
struct iavf_mac_filter {
|
2013-12-21 06:13:06 +00:00
|
|
|
struct list_head list;
|
|
|
|
u8 macaddr[ETH_ALEN];
|
2021-08-30 08:25:36 +00:00
|
|
|
struct {
|
|
|
|
u8 is_new_mac:1; /* filter is new, wait for PF decision */
|
|
|
|
u8 remove:1; /* filter needs to be removed */
|
|
|
|
u8 add:1; /* filter needs to be added */
|
|
|
|
u8 is_primary:1; /* filter is a default VF MAC */
|
|
|
|
u8 padding:4;
|
|
|
|
};
|
2013-12-21 06:13:06 +00:00
|
|
|
};
|
|
|
|
|
iavf: Add support VIRTCHNL_VF_OFFLOAD_VLAN_V2 during netdev config
Based on VIRTCHNL_VF_OFFLOAD_VLAN_V2, the VF can now support more VLAN
capabilities (i.e. 802.1AD offloads and filtering). In order to
communicate these capabilities to the netdev layer, the VF needs to
parse its VLAN capabilities based on whether it was able to negotiation
VIRTCHNL_VF_OFFLOAD_VLAN or VIRTCHNL_VF_OFFLOAD_VLAN_V2 or neither of
these.
In order to support this, add the following functionality:
iavf_get_netdev_vlan_hw_features() - This is used to determine the VLAN
features that the underlying hardware supports and that can be toggled
off/on based on the negotiated capabiltiies. For example, if
VIRTCHNL_VF_OFFLOAD_VLAN_V2 was negotiated, then any capability marked
with VIRTCHNL_VLAN_TOGGLE can be toggled on/off by the VF. If
VIRTCHNL_VF_OFFLOAD_VLAN was negotiated, then only VLAN insertion and/or
stripping can be toggled on/off.
iavf_get_netdev_vlan_features() - This is used to determine the VLAN
features that the underlying hardware supports and that should be
enabled by default. For example, if VIRTHCNL_VF_OFFLOAD_VLAN_V2 was
negotiated, then any supported capability that has its ethertype_init
filed set should be enabled by default. If VIRTCHNL_VF_OFFLOAD_VLAN was
negotiated, then filtering, stripping, and insertion should be enabled
by default.
Also, refactor iavf_fix_features() to take into account the new
capabilities. To do this, query all the supported features (enabled by
default and toggleable) and make sure the requested change is supported.
If VIRTCHNL_VF_OFFLOAD_VLAN_V2 is successfully negotiated, there is no
need to check VIRTCHNL_VLAN_TOGGLE here because the driver already told
the netdev layer which features can be toggled via netdev->hw_features
during iavf_process_config(), so only those features will be requested
to change.
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-11-29 16:16:01 -08:00
|
|
|
#define IAVF_VLAN(vid, tpid) ((struct iavf_vlan){ vid, tpid })
|
|
|
|
struct iavf_vlan {
|
|
|
|
u16 vid;
|
|
|
|
u16 tpid;
|
|
|
|
};
|
|
|
|
|
2018-09-14 17:37:46 -07:00
|
|
|
struct iavf_vlan_filter {
|
2013-12-21 06:13:06 +00:00
|
|
|
struct list_head list;
|
iavf: Add support VIRTCHNL_VF_OFFLOAD_VLAN_V2 during netdev config
Based on VIRTCHNL_VF_OFFLOAD_VLAN_V2, the VF can now support more VLAN
capabilities (i.e. 802.1AD offloads and filtering). In order to
communicate these capabilities to the netdev layer, the VF needs to
parse its VLAN capabilities based on whether it was able to negotiation
VIRTCHNL_VF_OFFLOAD_VLAN or VIRTCHNL_VF_OFFLOAD_VLAN_V2 or neither of
these.
In order to support this, add the following functionality:
iavf_get_netdev_vlan_hw_features() - This is used to determine the VLAN
features that the underlying hardware supports and that can be toggled
off/on based on the negotiated capabiltiies. For example, if
VIRTCHNL_VF_OFFLOAD_VLAN_V2 was negotiated, then any capability marked
with VIRTCHNL_VLAN_TOGGLE can be toggled on/off by the VF. If
VIRTCHNL_VF_OFFLOAD_VLAN was negotiated, then only VLAN insertion and/or
stripping can be toggled on/off.
iavf_get_netdev_vlan_features() - This is used to determine the VLAN
features that the underlying hardware supports and that should be
enabled by default. For example, if VIRTHCNL_VF_OFFLOAD_VLAN_V2 was
negotiated, then any supported capability that has its ethertype_init
filed set should be enabled by default. If VIRTCHNL_VF_OFFLOAD_VLAN was
negotiated, then filtering, stripping, and insertion should be enabled
by default.
Also, refactor iavf_fix_features() to take into account the new
capabilities. To do this, query all the supported features (enabled by
default and toggleable) and make sure the requested change is supported.
If VIRTCHNL_VF_OFFLOAD_VLAN_V2 is successfully negotiated, there is no
need to check VIRTCHNL_VLAN_TOGGLE here because the driver already told
the netdev layer which features can be toggled via netdev->hw_features
during iavf_process_config(), so only those features will be requested
to change.
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-11-29 16:16:01 -08:00
|
|
|
struct iavf_vlan vlan;
|
2022-06-10 14:15:54 +02:00
|
|
|
struct {
|
|
|
|
u8 is_new_vlan:1; /* filter is new, wait for PF answer */
|
|
|
|
u8 remove:1; /* filter needs to be removed */
|
|
|
|
u8 add:1; /* filter needs to be added */
|
|
|
|
u8 padding:5;
|
|
|
|
};
|
2013-12-21 06:13:06 +00:00
|
|
|
};
|
|
|
|
|
2018-09-14 17:37:46 -07:00
|
|
|
#define IAVF_MAX_TRAFFIC_CLASS 4
|
2018-01-23 08:50:57 -08:00
|
|
|
/* State of traffic class creation */
|
2018-09-14 17:37:46 -07:00
|
|
|
enum iavf_tc_state_t {
|
|
|
|
__IAVF_TC_INVALID, /* no traffic class, default state */
|
|
|
|
__IAVF_TC_RUNNING, /* traffic classes have been created */
|
2018-01-23 08:50:57 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* channel info */
|
2018-09-14 17:37:46 -07:00
|
|
|
struct iavf_channel_config {
|
|
|
|
struct virtchnl_channel_info ch_info[IAVF_MAX_TRAFFIC_CLASS];
|
|
|
|
enum iavf_tc_state_t state;
|
2018-01-23 08:50:57 -08:00
|
|
|
u8 total_qps;
|
|
|
|
};
|
|
|
|
|
2018-01-23 08:51:05 -08:00
|
|
|
/* State of cloud filter */
|
2018-09-14 17:37:46 -07:00
|
|
|
enum iavf_cloud_filter_state_t {
|
|
|
|
__IAVF_CF_INVALID, /* cloud filter not added */
|
|
|
|
__IAVF_CF_ADD_PENDING, /* cloud filter pending add by the PF */
|
|
|
|
__IAVF_CF_DEL_PENDING, /* cloud filter pending del by the PF */
|
|
|
|
__IAVF_CF_ACTIVE, /* cloud filter is active */
|
2018-01-23 08:51:05 -08:00
|
|
|
};
|
|
|
|
|
2013-12-21 06:13:06 +00:00
|
|
|
/* Driver state. The order of these is important! */
|
2018-09-14 17:37:46 -07:00
|
|
|
enum iavf_state_t {
|
|
|
|
__IAVF_STARTUP, /* driver loaded, probe complete */
|
|
|
|
__IAVF_REMOVE, /* driver is being unloaded */
|
|
|
|
__IAVF_INIT_VERSION_CHECK, /* aq msg sent, awaiting reply */
|
|
|
|
__IAVF_INIT_GET_RESOURCES, /* aq msg sent, awaiting reply */
|
iavf: refactor processing of VLAN V2 capability message
In order to handle the capability exchange necessary for
VIRTCHNL_VF_OFFLOAD_VLAN_V2, the driver must send
a VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS message. This must occur prior to
__IAVF_CONFIG_ADAPTER, and the driver must wait for the response from
the PF.
To handle this, the __IAVF_INIT_GET_OFFLOAD_VLAN_V2_CAPS state was
introduced. This state is intended to process the response from the VLAN
V2 caps message. This works ok, but is difficult to extend to adding
more extended capability exchange.
Existing (and future) AVF features are relying more and more on these
sort of extended ops for processing additional capabilities. Just like
VLAN V2, this exchange must happen prior to __IAVF_CONFIG_ADPATER.
Since we only send one outstanding AQ message at a time during init, it
is not clear where to place this state. Adding more capability specific
states becomes a mess. Instead of having the "previous" state send
a message and then transition into a capability-specific state,
introduce __IAVF_EXTENDED_CAPS state. This state will use a list of
extended_caps that determines what messages to send and receive. As long
as there are extended_caps bits still set, the driver will remain in
this state performing one send or one receive per state machine loop.
Refactor the VLAN V2 negotiation to use this new state, and remove the
capability-specific state. This makes it significantly easier to add
a new similar capability exchange going forward.
Extended capabilities are processed by having an associated SEND and
RECV extended capability bit. During __IAVF_EXTENDED_CAPS, the
driver checks these bits in order by feature, first the send bit for
a feature, then the recv bit for a feature. Each send flag will call
a function that sends the necessary response, while each receive flag
will wait for the response from the PF. If a given feature can't be
negotiated with the PF, the associated flags will be cleared in
order to skip processing of that feature.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2022-01-14 10:36:36 +01:00
|
|
|
__IAVF_INIT_EXTENDED_CAPS, /* process extended caps which require aq msg exchange */
|
2021-11-29 16:16:00 -08:00
|
|
|
__IAVF_INIT_CONFIG_ADAPTER,
|
2018-09-14 17:37:46 -07:00
|
|
|
__IAVF_INIT_SW, /* got resources, setting up structs */
|
2021-08-19 08:47:49 +00:00
|
|
|
__IAVF_INIT_FAILED, /* init failed, restarting procedure */
|
2018-09-14 17:37:46 -07:00
|
|
|
__IAVF_RESETTING, /* in reset */
|
2019-05-14 10:37:06 -07:00
|
|
|
__IAVF_COMM_FAILED, /* communication with PF failed */
|
2013-12-21 06:13:06 +00:00
|
|
|
/* Below here, watchdog is running */
|
2018-09-14 17:37:46 -07:00
|
|
|
__IAVF_DOWN, /* ready, can be opened */
|
|
|
|
__IAVF_DOWN_PENDING, /* descending, waiting for watchdog */
|
|
|
|
__IAVF_TESTING, /* in ethtool self-test */
|
|
|
|
__IAVF_RUNNING, /* opened, working */
|
2013-12-21 06:13:06 +00:00
|
|
|
};
|
|
|
|
|
2022-02-23 13:37:10 +01:00
|
|
|
enum iavf_critical_section_t {
|
|
|
|
__IAVF_IN_REMOVE_TASK, /* device being removed */
|
|
|
|
};
|
|
|
|
|
2018-09-14 17:37:46 -07:00
|
|
|
#define IAVF_CLOUD_FIELD_OMAC 0x01
|
|
|
|
#define IAVF_CLOUD_FIELD_IMAC 0x02
|
|
|
|
#define IAVF_CLOUD_FIELD_IVLAN 0x04
|
|
|
|
#define IAVF_CLOUD_FIELD_TEN_ID 0x08
|
|
|
|
#define IAVF_CLOUD_FIELD_IIP 0x10
|
|
|
|
|
|
|
|
#define IAVF_CF_FLAGS_OMAC IAVF_CLOUD_FIELD_OMAC
|
|
|
|
#define IAVF_CF_FLAGS_IMAC IAVF_CLOUD_FIELD_IMAC
|
|
|
|
#define IAVF_CF_FLAGS_IMAC_IVLAN (IAVF_CLOUD_FIELD_IMAC |\
|
|
|
|
IAVF_CLOUD_FIELD_IVLAN)
|
|
|
|
#define IAVF_CF_FLAGS_IMAC_TEN_ID (IAVF_CLOUD_FIELD_IMAC |\
|
|
|
|
IAVF_CLOUD_FIELD_TEN_ID)
|
|
|
|
#define IAVF_CF_FLAGS_OMAC_TEN_ID_IMAC (IAVF_CLOUD_FIELD_OMAC |\
|
|
|
|
IAVF_CLOUD_FIELD_IMAC |\
|
|
|
|
IAVF_CLOUD_FIELD_TEN_ID)
|
|
|
|
#define IAVF_CF_FLAGS_IMAC_IVLAN_TEN_ID (IAVF_CLOUD_FIELD_IMAC |\
|
|
|
|
IAVF_CLOUD_FIELD_IVLAN |\
|
|
|
|
IAVF_CLOUD_FIELD_TEN_ID)
|
2018-09-14 17:37:55 -07:00
|
|
|
#define IAVF_CF_FLAGS_IIP IAVF_CLOUD_FIELD_IIP
|
2018-01-23 08:51:05 -08:00
|
|
|
|
|
|
|
/* bookkeeping of cloud filters */
|
2018-09-14 17:37:46 -07:00
|
|
|
struct iavf_cloud_filter {
|
|
|
|
enum iavf_cloud_filter_state_t state;
|
2018-01-23 08:51:05 -08:00
|
|
|
struct list_head list;
|
|
|
|
struct virtchnl_filter f;
|
|
|
|
unsigned long cookie;
|
|
|
|
bool del; /* filter needs to be deleted */
|
|
|
|
bool add; /* filter needs to be added */
|
|
|
|
};
|
|
|
|
|
2020-06-05 10:09:46 -07:00
|
|
|
#define IAVF_RESET_WAIT_MS 10
|
|
|
|
#define IAVF_RESET_WAIT_DETECTED_COUNT 500
|
|
|
|
#define IAVF_RESET_WAIT_COMPLETE_COUNT 2000
|
|
|
|
|
2013-12-21 06:13:06 +00:00
|
|
|
/* board specific private data structure */
|
2018-09-14 17:37:46 -07:00
|
|
|
struct iavf_adapter {
|
2013-12-21 06:13:06 +00:00
|
|
|
struct work_struct reset_task;
|
|
|
|
struct work_struct adminq_task;
|
2017-01-24 10:23:59 -08:00
|
|
|
struct delayed_work client_task;
|
2017-06-23 04:24:44 -04:00
|
|
|
wait_queue_head_t down_waitqueue;
|
2018-09-14 17:37:55 -07:00
|
|
|
struct iavf_q_vector *q_vectors;
|
2013-12-21 06:13:06 +00:00
|
|
|
struct list_head vlan_filter_list;
|
2017-10-27 11:06:50 -04:00
|
|
|
struct list_head mac_filter_list;
|
2021-08-04 10:22:24 +02:00
|
|
|
struct mutex crit_lock;
|
|
|
|
struct mutex client_lock;
|
2017-10-27 11:06:50 -04:00
|
|
|
/* Lock to protect accesses to MAC and VLAN lists */
|
|
|
|
spinlock_t mac_vlan_list_lock;
|
2014-02-13 03:48:51 -08:00
|
|
|
char misc_vector_name[IFNAMSIZ + 9];
|
2014-10-25 03:24:34 +00:00
|
|
|
int num_active_queues;
|
2017-08-22 06:57:50 -04:00
|
|
|
int num_req_queues;
|
2013-12-21 06:13:06 +00:00
|
|
|
|
|
|
|
/* TX */
|
2018-09-14 17:37:55 -07:00
|
|
|
struct iavf_ring *tx_rings;
|
2013-12-21 06:13:06 +00:00
|
|
|
u32 tx_timeout_count;
|
2014-04-24 06:41:37 +00:00
|
|
|
u32 tx_desc_count;
|
2013-12-21 06:13:06 +00:00
|
|
|
|
|
|
|
/* RX */
|
2018-09-14 17:37:55 -07:00
|
|
|
struct iavf_ring *rx_rings;
|
2013-12-21 06:13:06 +00:00
|
|
|
u64 hw_csum_rx_error;
|
2014-04-24 06:41:37 +00:00
|
|
|
u32 rx_desc_count;
|
2013-12-21 06:13:06 +00:00
|
|
|
int num_msix_vectors;
|
2017-01-24 10:23:59 -08:00
|
|
|
int num_iwarp_msix;
|
|
|
|
int iwarp_base_vector;
|
2017-02-09 23:35:18 -08:00
|
|
|
u32 client_pending;
|
2019-04-17 15:17:34 -07:00
|
|
|
struct iavf_client_instance *cinst;
|
2013-12-21 06:13:06 +00:00
|
|
|
struct msix_entry *msix_entries;
|
|
|
|
|
2014-02-13 03:48:52 -08:00
|
|
|
u32 flags;
|
2018-09-14 17:37:46 -07:00
|
|
|
#define IAVF_FLAG_RX_CSUM_ENABLED BIT(0)
|
|
|
|
#define IAVF_FLAG_PF_COMMS_FAILED BIT(3)
|
|
|
|
#define IAVF_FLAG_RESET_PENDING BIT(4)
|
|
|
|
#define IAVF_FLAG_RESET_NEEDED BIT(5)
|
|
|
|
#define IAVF_FLAG_WB_ON_ITR_CAPABLE BIT(6)
|
|
|
|
#define IAVF_FLAG_SERVICE_CLIENT_REQUESTED BIT(9)
|
|
|
|
#define IAVF_FLAG_CLIENT_NEEDS_OPEN BIT(10)
|
|
|
|
#define IAVF_FLAG_CLIENT_NEEDS_CLOSE BIT(11)
|
|
|
|
#define IAVF_FLAG_CLIENT_NEEDS_L2_PARAMS BIT(12)
|
|
|
|
#define IAVF_FLAG_PROMISC_ON BIT(13)
|
|
|
|
#define IAVF_FLAG_ALLMULTI_ON BIT(14)
|
|
|
|
#define IAVF_FLAG_LEGACY_RX BIT(15)
|
|
|
|
#define IAVF_FLAG_REINIT_ITR_NEEDED BIT(16)
|
|
|
|
#define IAVF_FLAG_QUEUES_DISABLED BIT(17)
|
2022-02-23 13:37:50 +01:00
|
|
|
#define IAVF_FLAG_SETUP_NETDEV_FEATURES BIT(18)
|
2022-02-02 12:44:54 +00:00
|
|
|
#define IAVF_FLAG_REINIT_MSIX_NEEDED BIT(20)
|
2015-06-05 12:20:26 -04:00
|
|
|
/* duplicates for common code */
|
2018-09-14 17:37:55 -07:00
|
|
|
#define IAVF_FLAG_DCB_ENABLED 0
|
2013-12-21 06:13:06 +00:00
|
|
|
/* flags for admin queue service task */
|
2021-11-29 16:16:03 -08:00
|
|
|
u64 aq_required;
|
|
|
|
#define IAVF_FLAG_AQ_ENABLE_QUEUES BIT_ULL(0)
|
|
|
|
#define IAVF_FLAG_AQ_DISABLE_QUEUES BIT_ULL(1)
|
|
|
|
#define IAVF_FLAG_AQ_ADD_MAC_FILTER BIT_ULL(2)
|
|
|
|
#define IAVF_FLAG_AQ_ADD_VLAN_FILTER BIT_ULL(3)
|
|
|
|
#define IAVF_FLAG_AQ_DEL_MAC_FILTER BIT_ULL(4)
|
|
|
|
#define IAVF_FLAG_AQ_DEL_VLAN_FILTER BIT_ULL(5)
|
|
|
|
#define IAVF_FLAG_AQ_CONFIGURE_QUEUES BIT_ULL(6)
|
|
|
|
#define IAVF_FLAG_AQ_MAP_VECTORS BIT_ULL(7)
|
|
|
|
#define IAVF_FLAG_AQ_HANDLE_RESET BIT_ULL(8)
|
|
|
|
#define IAVF_FLAG_AQ_CONFIGURE_RSS BIT_ULL(9) /* direct AQ config */
|
|
|
|
#define IAVF_FLAG_AQ_GET_CONFIG BIT_ULL(10)
|
2016-04-12 08:30:44 -07:00
|
|
|
/* Newer style, RSS done by the PF so we can ignore hardware vagaries. */
|
2021-11-29 16:16:03 -08:00
|
|
|
#define IAVF_FLAG_AQ_GET_HENA BIT_ULL(11)
|
|
|
|
#define IAVF_FLAG_AQ_SET_HENA BIT_ULL(12)
|
|
|
|
#define IAVF_FLAG_AQ_SET_RSS_KEY BIT_ULL(13)
|
|
|
|
#define IAVF_FLAG_AQ_SET_RSS_LUT BIT_ULL(14)
|
|
|
|
#define IAVF_FLAG_AQ_REQUEST_PROMISC BIT_ULL(15)
|
|
|
|
#define IAVF_FLAG_AQ_RELEASE_PROMISC BIT_ULL(16)
|
|
|
|
#define IAVF_FLAG_AQ_REQUEST_ALLMULTI BIT_ULL(17)
|
|
|
|
#define IAVF_FLAG_AQ_RELEASE_ALLMULTI BIT_ULL(18)
|
|
|
|
#define IAVF_FLAG_AQ_ENABLE_VLAN_STRIPPING BIT_ULL(19)
|
|
|
|
#define IAVF_FLAG_AQ_DISABLE_VLAN_STRIPPING BIT_ULL(20)
|
|
|
|
#define IAVF_FLAG_AQ_ENABLE_CHANNELS BIT_ULL(21)
|
|
|
|
#define IAVF_FLAG_AQ_DISABLE_CHANNELS BIT_ULL(22)
|
|
|
|
#define IAVF_FLAG_AQ_ADD_CLOUD_FILTER BIT_ULL(23)
|
|
|
|
#define IAVF_FLAG_AQ_DEL_CLOUD_FILTER BIT_ULL(24)
|
|
|
|
#define IAVF_FLAG_AQ_ADD_FDIR_FILTER BIT_ULL(25)
|
|
|
|
#define IAVF_FLAG_AQ_DEL_FDIR_FILTER BIT_ULL(26)
|
|
|
|
#define IAVF_FLAG_AQ_ADD_ADV_RSS_CFG BIT_ULL(27)
|
|
|
|
#define IAVF_FLAG_AQ_DEL_ADV_RSS_CFG BIT_ULL(28)
|
|
|
|
#define IAVF_FLAG_AQ_REQUEST_STATS BIT_ULL(29)
|
|
|
|
#define IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS BIT_ULL(30)
|
|
|
|
#define IAVF_FLAG_AQ_ENABLE_CTAG_VLAN_STRIPPING BIT_ULL(31)
|
|
|
|
#define IAVF_FLAG_AQ_DISABLE_CTAG_VLAN_STRIPPING BIT_ULL(32)
|
|
|
|
#define IAVF_FLAG_AQ_ENABLE_STAG_VLAN_STRIPPING BIT_ULL(33)
|
|
|
|
#define IAVF_FLAG_AQ_DISABLE_STAG_VLAN_STRIPPING BIT_ULL(34)
|
|
|
|
#define IAVF_FLAG_AQ_ENABLE_CTAG_VLAN_INSERTION BIT_ULL(35)
|
|
|
|
#define IAVF_FLAG_AQ_DISABLE_CTAG_VLAN_INSERTION BIT_ULL(36)
|
|
|
|
#define IAVF_FLAG_AQ_ENABLE_STAG_VLAN_INSERTION BIT_ULL(37)
|
|
|
|
#define IAVF_FLAG_AQ_DISABLE_STAG_VLAN_INSERTION BIT_ULL(38)
|
i40evf: refactor reset handling
Respond better to a VF reset event. When a reset is signaled by the
PF, or detected by the watchdog task, prevent the watchdog from
processing admin queue requests, and schedule the reset task.
In the reset task, wait first for the reset to start, then for it to
complete, then reinit the driver.
If the reset never appears to complete after a long, long time (>10
seconds is possible depending on what's going on with the PF driver),
then set a flag to indicate that PF communications have failed.
If this flag is set, check for the reset to complete in the watchdog,
and attempt to do a full reinitialization of the driver from scratch.
With these changes the VF driver correctly handles a PF reset event
while running on bare metal, or in a VM.
Also update copyrights.
Change-ID: I93513efd0b50523a8345e7f6a33a5e4f8a2a5996
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-02-13 03:48:53 -08:00
|
|
|
|
iavf: refactor processing of VLAN V2 capability message
In order to handle the capability exchange necessary for
VIRTCHNL_VF_OFFLOAD_VLAN_V2, the driver must send
a VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS message. This must occur prior to
__IAVF_CONFIG_ADAPTER, and the driver must wait for the response from
the PF.
To handle this, the __IAVF_INIT_GET_OFFLOAD_VLAN_V2_CAPS state was
introduced. This state is intended to process the response from the VLAN
V2 caps message. This works ok, but is difficult to extend to adding
more extended capability exchange.
Existing (and future) AVF features are relying more and more on these
sort of extended ops for processing additional capabilities. Just like
VLAN V2, this exchange must happen prior to __IAVF_CONFIG_ADPATER.
Since we only send one outstanding AQ message at a time during init, it
is not clear where to place this state. Adding more capability specific
states becomes a mess. Instead of having the "previous" state send
a message and then transition into a capability-specific state,
introduce __IAVF_EXTENDED_CAPS state. This state will use a list of
extended_caps that determines what messages to send and receive. As long
as there are extended_caps bits still set, the driver will remain in
this state performing one send or one receive per state machine loop.
Refactor the VLAN V2 negotiation to use this new state, and remove the
capability-specific state. This makes it significantly easier to add
a new similar capability exchange going forward.
Extended capabilities are processed by having an associated SEND and
RECV extended capability bit. During __IAVF_EXTENDED_CAPS, the
driver checks these bits in order by feature, first the send bit for
a feature, then the recv bit for a feature. Each send flag will call
a function that sends the necessary response, while each receive flag
will wait for the response from the PF. If a given feature can't be
negotiated with the PF, the associated flags will be cleared in
order to skip processing of that feature.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2022-01-14 10:36:36 +01:00
|
|
|
/* flags for processing extended capability messages during
|
|
|
|
* __IAVF_INIT_EXTENDED_CAPS. Each capability exchange requires
|
|
|
|
* both a SEND and a RECV step, which must be processed in sequence.
|
|
|
|
*
|
|
|
|
* During the __IAVF_INIT_EXTENDED_CAPS state, the driver will
|
|
|
|
* process one flag at a time during each state loop.
|
|
|
|
*/
|
|
|
|
u64 extended_caps;
|
|
|
|
#define IAVF_EXTENDED_CAP_SEND_VLAN_V2 BIT_ULL(0)
|
|
|
|
#define IAVF_EXTENDED_CAP_RECV_VLAN_V2 BIT_ULL(1)
|
|
|
|
|
|
|
|
#define IAVF_EXTENDED_CAPS \
|
|
|
|
(IAVF_EXTENDED_CAP_SEND_VLAN_V2 | \
|
|
|
|
IAVF_EXTENDED_CAP_RECV_VLAN_V2)
|
|
|
|
|
2013-12-21 06:13:06 +00:00
|
|
|
/* OS defined structs */
|
|
|
|
struct net_device *netdev;
|
|
|
|
struct pci_dev *pdev;
|
|
|
|
|
2018-09-14 17:37:56 -07:00
|
|
|
struct iavf_hw hw; /* defined in iavf_type.h */
|
2013-12-21 06:13:06 +00:00
|
|
|
|
2018-09-14 17:37:46 -07:00
|
|
|
enum iavf_state_t state;
|
2021-08-19 08:47:40 +00:00
|
|
|
enum iavf_state_t last_state;
|
2014-11-11 20:02:42 +00:00
|
|
|
unsigned long crit_section;
|
2013-12-21 06:13:06 +00:00
|
|
|
|
2019-05-14 10:37:05 -07:00
|
|
|
struct delayed_work watchdog_task;
|
2013-12-21 06:13:06 +00:00
|
|
|
bool netdev_registered;
|
|
|
|
bool link_up;
|
2017-05-11 11:23:16 -07:00
|
|
|
enum virtchnl_link_speed link_speed;
|
2020-06-05 10:09:43 -07:00
|
|
|
/* This is only populated if the VIRTCHNL_VF_CAP_ADV_LINK_SPEED is set
|
|
|
|
* in vf_res->vf_cap_flags. Use ADV_LINK_SUPPORT macro to determine if
|
|
|
|
* this field is valid. This field should be used going forward and the
|
|
|
|
* enum virtchnl_link_speed above should be considered the legacy way of
|
|
|
|
* storing/communicating link speeds.
|
|
|
|
*/
|
|
|
|
u32 link_speed_mbps;
|
|
|
|
|
2017-05-11 11:23:11 -07:00
|
|
|
enum virtchnl_ops current_op;
|
2017-01-24 10:23:59 -08:00
|
|
|
#define CLIENT_ALLOWED(_a) ((_a)->vf_res ? \
|
2017-06-29 15:12:24 +02:00
|
|
|
(_a)->vf_res->vf_cap_flags & \
|
2017-05-11 11:23:11 -07:00
|
|
|
VIRTCHNL_VF_OFFLOAD_IWARP : \
|
2016-04-12 08:30:41 -07:00
|
|
|
0)
|
2017-01-24 10:23:59 -08:00
|
|
|
#define CLIENT_ENABLED(_a) ((_a)->cinst)
|
2016-04-12 08:30:44 -07:00
|
|
|
/* RSS by the PF should be preferred over RSS via other methods. */
|
2017-06-29 15:12:24 +02:00
|
|
|
#define RSS_PF(_a) ((_a)->vf_res->vf_cap_flags & \
|
2017-05-11 11:23:11 -07:00
|
|
|
VIRTCHNL_VF_OFFLOAD_RSS_PF)
|
2017-06-29 15:12:24 +02:00
|
|
|
#define RSS_AQ(_a) ((_a)->vf_res->vf_cap_flags & \
|
2017-05-11 11:23:11 -07:00
|
|
|
VIRTCHNL_VF_OFFLOAD_RSS_AQ)
|
2017-06-29 15:12:24 +02:00
|
|
|
#define RSS_REG(_a) (!((_a)->vf_res->vf_cap_flags & \
|
2017-05-11 11:23:11 -07:00
|
|
|
(VIRTCHNL_VF_OFFLOAD_RSS_AQ | \
|
|
|
|
VIRTCHNL_VF_OFFLOAD_RSS_PF)))
|
2017-06-29 15:12:24 +02:00
|
|
|
#define VLAN_ALLOWED(_a) ((_a)->vf_res->vf_cap_flags & \
|
2017-05-11 11:23:11 -07:00
|
|
|
VIRTCHNL_VF_OFFLOAD_VLAN)
|
2021-11-29 16:16:00 -08:00
|
|
|
#define VLAN_V2_ALLOWED(_a) ((_a)->vf_res->vf_cap_flags & \
|
|
|
|
VIRTCHNL_VF_OFFLOAD_VLAN_V2)
|
iavf: Add support VIRTCHNL_VF_OFFLOAD_VLAN_V2 during netdev config
Based on VIRTCHNL_VF_OFFLOAD_VLAN_V2, the VF can now support more VLAN
capabilities (i.e. 802.1AD offloads and filtering). In order to
communicate these capabilities to the netdev layer, the VF needs to
parse its VLAN capabilities based on whether it was able to negotiation
VIRTCHNL_VF_OFFLOAD_VLAN or VIRTCHNL_VF_OFFLOAD_VLAN_V2 or neither of
these.
In order to support this, add the following functionality:
iavf_get_netdev_vlan_hw_features() - This is used to determine the VLAN
features that the underlying hardware supports and that can be toggled
off/on based on the negotiated capabiltiies. For example, if
VIRTCHNL_VF_OFFLOAD_VLAN_V2 was negotiated, then any capability marked
with VIRTCHNL_VLAN_TOGGLE can be toggled on/off by the VF. If
VIRTCHNL_VF_OFFLOAD_VLAN was negotiated, then only VLAN insertion and/or
stripping can be toggled on/off.
iavf_get_netdev_vlan_features() - This is used to determine the VLAN
features that the underlying hardware supports and that should be
enabled by default. For example, if VIRTHCNL_VF_OFFLOAD_VLAN_V2 was
negotiated, then any supported capability that has its ethertype_init
filed set should be enabled by default. If VIRTCHNL_VF_OFFLOAD_VLAN was
negotiated, then filtering, stripping, and insertion should be enabled
by default.
Also, refactor iavf_fix_features() to take into account the new
capabilities. To do this, query all the supported features (enabled by
default and toggleable) and make sure the requested change is supported.
If VIRTCHNL_VF_OFFLOAD_VLAN_V2 is successfully negotiated, there is no
need to check VIRTCHNL_VLAN_TOGGLE here because the driver already told
the netdev layer which features can be toggled via netdev->hw_features
during iavf_process_config(), so only those features will be requested
to change.
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-11-29 16:16:01 -08:00
|
|
|
#define VLAN_V2_FILTERING_ALLOWED(_a) \
|
|
|
|
(VLAN_V2_ALLOWED((_a)) && \
|
|
|
|
((_a)->vlan_v2_caps.filtering.filtering_support.outer || \
|
|
|
|
(_a)->vlan_v2_caps.filtering.filtering_support.inner))
|
|
|
|
#define VLAN_FILTERING_ALLOWED(_a) \
|
|
|
|
(VLAN_ALLOWED((_a)) || VLAN_V2_FILTERING_ALLOWED((_a)))
|
2020-06-05 10:09:43 -07:00
|
|
|
#define ADV_LINK_SUPPORT(_a) ((_a)->vf_res->vf_cap_flags & \
|
|
|
|
VIRTCHNL_VF_CAP_ADV_LINK_SPEED)
|
2021-03-09 11:08:11 +08:00
|
|
|
#define FDIR_FLTR_SUPPORT(_a) ((_a)->vf_res->vf_cap_flags & \
|
|
|
|
VIRTCHNL_VF_OFFLOAD_FDIR_PF)
|
2021-04-13 08:48:41 +08:00
|
|
|
#define ADV_RSS_SUPPORT(_a) ((_a)->vf_res->vf_cap_flags & \
|
|
|
|
VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF)
|
2017-05-11 11:23:11 -07:00
|
|
|
struct virtchnl_vf_resource *vf_res; /* incl. all VSIs */
|
|
|
|
struct virtchnl_vsi_resource *vsi_res; /* our LAN VSI */
|
|
|
|
struct virtchnl_version_info pf_version;
|
2015-06-04 16:23:56 -04:00
|
|
|
#define PF_IS_V11(_a) (((_a)->pf_version.major == 1) && \
|
|
|
|
((_a)->pf_version.minor == 1))
|
2021-11-29 16:16:00 -08:00
|
|
|
struct virtchnl_vlan_caps vlan_v2_caps;
|
2013-12-21 06:13:06 +00:00
|
|
|
u16 msg_enable;
|
2018-09-14 17:37:55 -07:00
|
|
|
struct iavf_eth_stats current_stats;
|
|
|
|
struct iavf_vsi vsi;
|
2013-12-21 06:13:06 +00:00
|
|
|
u32 aq_wait_count;
|
2016-04-12 08:30:44 -07:00
|
|
|
/* RSS stuff */
|
|
|
|
u64 hena;
|
|
|
|
u16 rss_key_size;
|
|
|
|
u16 rss_lut_size;
|
|
|
|
u8 *rss_key;
|
|
|
|
u8 *rss_lut;
|
2018-01-23 08:50:57 -08:00
|
|
|
/* ADQ related members */
|
2018-09-14 17:37:46 -07:00
|
|
|
struct iavf_channel_config ch_config;
|
2018-01-23 08:50:57 -08:00
|
|
|
u8 num_tc;
|
2018-01-23 08:51:05 -08:00
|
|
|
struct list_head cloud_filter_list;
|
2018-09-25 08:42:18 -07:00
|
|
|
/* lock to protect access to the cloud filter list */
|
2018-01-23 08:51:05 -08:00
|
|
|
spinlock_t cloud_filter_list_lock;
|
|
|
|
u16 num_cloud_filters;
|
2021-03-09 11:08:11 +08:00
|
|
|
|
|
|
|
#define IAVF_MAX_FDIR_FILTERS 128 /* max allowed Flow Director filters */
|
|
|
|
u16 fdir_active_fltr;
|
|
|
|
struct list_head fdir_list_head;
|
|
|
|
spinlock_t fdir_fltr_lock; /* protect the Flow Director filter list */
|
2021-04-13 08:48:41 +08:00
|
|
|
|
|
|
|
struct list_head adv_rss_list_head;
|
|
|
|
spinlock_t adv_rss_lock; /* protect the RSS management list */
|
2013-12-21 06:13:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-01-15 14:33:10 -08:00
|
|
|
/* Ethtool Private Flags */
|
|
|
|
|
2018-09-14 17:37:55 -07:00
|
|
|
/* lan device, used by client interface */
|
2019-04-17 15:17:36 -07:00
|
|
|
struct iavf_device {
|
2017-01-24 10:23:59 -08:00
|
|
|
struct list_head list;
|
2018-09-14 17:37:46 -07:00
|
|
|
struct iavf_adapter *vf;
|
2017-01-24 10:23:59 -08:00
|
|
|
};
|
|
|
|
|
2018-09-14 17:37:46 -07:00
|
|
|
/* needed by iavf_ethtool.c */
|
|
|
|
extern char iavf_driver_name[];
|
2019-05-14 10:37:05 -07:00
|
|
|
extern struct workqueue_struct *iavf_wq;
|
2018-09-14 17:37:46 -07:00
|
|
|
|
iavf: Fix kernel BUG in free_msi_irqs
Fix driver not freeing VF's traffic irqs, prior to calling
pci_disable_msix in iavf_remove.
There were possible 2 erroneous states in which, iavf_close would
not be called.
One erroneous state is fixed by allowing netdev to register, when state
is already running. It was possible for VF adapter to enter state loop
from running to resetting, where iavf_open would subsequently fail.
If user would then unload driver/remove VF pci, iavf_close would not be
called, as the netdev was not registered, leaving traffic pcis still
allocated.
Fixed this by breaking loop, allowing netdev to open device when adapter
state is __IAVF_RUNNING and it is not explicitily downed.
Other possiblity is entering to iavf_remove from __IAVF_RESETTING state,
where iavf_close would not free irqs, but just return 0.
Fixed this by checking for last adapter state and then removing irqs.
Kernel panic:
[ 2773.628585] kernel BUG at drivers/pci/msi.c:375!
...
[ 2773.631567] RIP: 0010:free_msi_irqs+0x180/0x1b0
...
[ 2773.640939] Call Trace:
[ 2773.641572] pci_disable_msix+0xf7/0x120
[ 2773.642224] iavf_reset_interrupt_capability.part.41+0x15/0x30 [iavf]
[ 2773.642897] iavf_remove+0x12e/0x500 [iavf]
[ 2773.643578] pci_device_remove+0x3b/0xc0
[ 2773.644266] device_release_driver_internal+0x103/0x1f0
[ 2773.644948] pci_stop_bus_device+0x69/0x90
[ 2773.645576] pci_stop_and_remove_bus_device+0xe/0x20
[ 2773.646215] pci_iov_remove_virtfn+0xba/0x120
[ 2773.646862] sriov_disable+0x2f/0xe0
[ 2773.647531] ice_free_vfs+0x2f8/0x350 [ice]
[ 2773.648207] ice_sriov_configure+0x94/0x960 [ice]
[ 2773.648883] ? _kstrtoull+0x3b/0x90
[ 2773.649560] sriov_numvfs_store+0x10a/0x190
[ 2773.650249] kernfs_fop_write+0x116/0x190
[ 2773.650948] vfs_write+0xa5/0x1a0
[ 2773.651651] ksys_write+0x4f/0xb0
[ 2773.652358] do_syscall_64+0x5b/0x1a0
[ 2773.653075] entry_SYSCALL_64_after_hwframe+0x65/0xca
Fixes: 22ead37f8af8 ("i40evf: Add longer wait after remove module")
Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-10-22 10:30:14 +02:00
|
|
|
static inline const char *iavf_state_str(enum iavf_state_t state)
|
|
|
|
{
|
|
|
|
switch (state) {
|
|
|
|
case __IAVF_STARTUP:
|
|
|
|
return "__IAVF_STARTUP";
|
|
|
|
case __IAVF_REMOVE:
|
|
|
|
return "__IAVF_REMOVE";
|
|
|
|
case __IAVF_INIT_VERSION_CHECK:
|
|
|
|
return "__IAVF_INIT_VERSION_CHECK";
|
|
|
|
case __IAVF_INIT_GET_RESOURCES:
|
|
|
|
return "__IAVF_INIT_GET_RESOURCES";
|
2022-06-15 13:57:20 -04:00
|
|
|
case __IAVF_INIT_EXTENDED_CAPS:
|
|
|
|
return "__IAVF_INIT_EXTENDED_CAPS";
|
|
|
|
case __IAVF_INIT_CONFIG_ADAPTER:
|
|
|
|
return "__IAVF_INIT_CONFIG_ADAPTER";
|
iavf: Fix kernel BUG in free_msi_irqs
Fix driver not freeing VF's traffic irqs, prior to calling
pci_disable_msix in iavf_remove.
There were possible 2 erroneous states in which, iavf_close would
not be called.
One erroneous state is fixed by allowing netdev to register, when state
is already running. It was possible for VF adapter to enter state loop
from running to resetting, where iavf_open would subsequently fail.
If user would then unload driver/remove VF pci, iavf_close would not be
called, as the netdev was not registered, leaving traffic pcis still
allocated.
Fixed this by breaking loop, allowing netdev to open device when adapter
state is __IAVF_RUNNING and it is not explicitily downed.
Other possiblity is entering to iavf_remove from __IAVF_RESETTING state,
where iavf_close would not free irqs, but just return 0.
Fixed this by checking for last adapter state and then removing irqs.
Kernel panic:
[ 2773.628585] kernel BUG at drivers/pci/msi.c:375!
...
[ 2773.631567] RIP: 0010:free_msi_irqs+0x180/0x1b0
...
[ 2773.640939] Call Trace:
[ 2773.641572] pci_disable_msix+0xf7/0x120
[ 2773.642224] iavf_reset_interrupt_capability.part.41+0x15/0x30 [iavf]
[ 2773.642897] iavf_remove+0x12e/0x500 [iavf]
[ 2773.643578] pci_device_remove+0x3b/0xc0
[ 2773.644266] device_release_driver_internal+0x103/0x1f0
[ 2773.644948] pci_stop_bus_device+0x69/0x90
[ 2773.645576] pci_stop_and_remove_bus_device+0xe/0x20
[ 2773.646215] pci_iov_remove_virtfn+0xba/0x120
[ 2773.646862] sriov_disable+0x2f/0xe0
[ 2773.647531] ice_free_vfs+0x2f8/0x350 [ice]
[ 2773.648207] ice_sriov_configure+0x94/0x960 [ice]
[ 2773.648883] ? _kstrtoull+0x3b/0x90
[ 2773.649560] sriov_numvfs_store+0x10a/0x190
[ 2773.650249] kernfs_fop_write+0x116/0x190
[ 2773.650948] vfs_write+0xa5/0x1a0
[ 2773.651651] ksys_write+0x4f/0xb0
[ 2773.652358] do_syscall_64+0x5b/0x1a0
[ 2773.653075] entry_SYSCALL_64_after_hwframe+0x65/0xca
Fixes: 22ead37f8af8 ("i40evf: Add longer wait after remove module")
Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-10-22 10:30:14 +02:00
|
|
|
case __IAVF_INIT_SW:
|
|
|
|
return "__IAVF_INIT_SW";
|
|
|
|
case __IAVF_INIT_FAILED:
|
|
|
|
return "__IAVF_INIT_FAILED";
|
|
|
|
case __IAVF_RESETTING:
|
|
|
|
return "__IAVF_RESETTING";
|
|
|
|
case __IAVF_COMM_FAILED:
|
|
|
|
return "__IAVF_COMM_FAILED";
|
|
|
|
case __IAVF_DOWN:
|
|
|
|
return "__IAVF_DOWN";
|
|
|
|
case __IAVF_DOWN_PENDING:
|
|
|
|
return "__IAVF_DOWN_PENDING";
|
|
|
|
case __IAVF_TESTING:
|
|
|
|
return "__IAVF_TESTING";
|
|
|
|
case __IAVF_RUNNING:
|
|
|
|
return "__IAVF_RUNNING";
|
|
|
|
default:
|
|
|
|
return "__IAVF_UNKNOWN_STATE";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-19 08:47:40 +00:00
|
|
|
static inline void iavf_change_state(struct iavf_adapter *adapter,
|
|
|
|
enum iavf_state_t state)
|
|
|
|
{
|
|
|
|
if (adapter->state != state) {
|
|
|
|
adapter->last_state = adapter->state;
|
|
|
|
adapter->state = state;
|
|
|
|
}
|
iavf: Fix kernel BUG in free_msi_irqs
Fix driver not freeing VF's traffic irqs, prior to calling
pci_disable_msix in iavf_remove.
There were possible 2 erroneous states in which, iavf_close would
not be called.
One erroneous state is fixed by allowing netdev to register, when state
is already running. It was possible for VF adapter to enter state loop
from running to resetting, where iavf_open would subsequently fail.
If user would then unload driver/remove VF pci, iavf_close would not be
called, as the netdev was not registered, leaving traffic pcis still
allocated.
Fixed this by breaking loop, allowing netdev to open device when adapter
state is __IAVF_RUNNING and it is not explicitily downed.
Other possiblity is entering to iavf_remove from __IAVF_RESETTING state,
where iavf_close would not free irqs, but just return 0.
Fixed this by checking for last adapter state and then removing irqs.
Kernel panic:
[ 2773.628585] kernel BUG at drivers/pci/msi.c:375!
...
[ 2773.631567] RIP: 0010:free_msi_irqs+0x180/0x1b0
...
[ 2773.640939] Call Trace:
[ 2773.641572] pci_disable_msix+0xf7/0x120
[ 2773.642224] iavf_reset_interrupt_capability.part.41+0x15/0x30 [iavf]
[ 2773.642897] iavf_remove+0x12e/0x500 [iavf]
[ 2773.643578] pci_device_remove+0x3b/0xc0
[ 2773.644266] device_release_driver_internal+0x103/0x1f0
[ 2773.644948] pci_stop_bus_device+0x69/0x90
[ 2773.645576] pci_stop_and_remove_bus_device+0xe/0x20
[ 2773.646215] pci_iov_remove_virtfn+0xba/0x120
[ 2773.646862] sriov_disable+0x2f/0xe0
[ 2773.647531] ice_free_vfs+0x2f8/0x350 [ice]
[ 2773.648207] ice_sriov_configure+0x94/0x960 [ice]
[ 2773.648883] ? _kstrtoull+0x3b/0x90
[ 2773.649560] sriov_numvfs_store+0x10a/0x190
[ 2773.650249] kernfs_fop_write+0x116/0x190
[ 2773.650948] vfs_write+0xa5/0x1a0
[ 2773.651651] ksys_write+0x4f/0xb0
[ 2773.652358] do_syscall_64+0x5b/0x1a0
[ 2773.653075] entry_SYSCALL_64_after_hwframe+0x65/0xca
Fixes: 22ead37f8af8 ("i40evf: Add longer wait after remove module")
Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-10-22 10:30:14 +02:00
|
|
|
dev_dbg(&adapter->pdev->dev,
|
|
|
|
"state transition from:%s to:%s\n",
|
|
|
|
iavf_state_str(adapter->last_state),
|
|
|
|
iavf_state_str(adapter->state));
|
2021-08-19 08:47:40 +00:00
|
|
|
}
|
|
|
|
|
2018-09-14 17:37:46 -07:00
|
|
|
int iavf_up(struct iavf_adapter *adapter);
|
|
|
|
void iavf_down(struct iavf_adapter *adapter);
|
|
|
|
int iavf_process_config(struct iavf_adapter *adapter);
|
2021-11-29 16:16:00 -08:00
|
|
|
int iavf_parse_vf_resource_msg(struct iavf_adapter *adapter);
|
2018-09-14 17:37:46 -07:00
|
|
|
void iavf_schedule_reset(struct iavf_adapter *adapter);
|
2021-09-15 09:01:00 +00:00
|
|
|
void iavf_schedule_request_stats(struct iavf_adapter *adapter);
|
2018-09-14 17:37:46 -07:00
|
|
|
void iavf_reset(struct iavf_adapter *adapter);
|
|
|
|
void iavf_set_ethtool_ops(struct net_device *netdev);
|
|
|
|
void iavf_update_stats(struct iavf_adapter *adapter);
|
|
|
|
void iavf_reset_interrupt_capability(struct iavf_adapter *adapter);
|
|
|
|
int iavf_init_interrupt_scheme(struct iavf_adapter *adapter);
|
|
|
|
void iavf_irq_enable_queues(struct iavf_adapter *adapter, u32 mask);
|
|
|
|
void iavf_free_all_tx_resources(struct iavf_adapter *adapter);
|
|
|
|
void iavf_free_all_rx_resources(struct iavf_adapter *adapter);
|
|
|
|
|
2018-09-14 17:37:55 -07:00
|
|
|
void iavf_napi_add_all(struct iavf_adapter *adapter);
|
|
|
|
void iavf_napi_del_all(struct iavf_adapter *adapter);
|
2018-09-14 17:37:46 -07:00
|
|
|
|
|
|
|
int iavf_send_api_ver(struct iavf_adapter *adapter);
|
|
|
|
int iavf_verify_api_ver(struct iavf_adapter *adapter);
|
|
|
|
int iavf_send_vf_config_msg(struct iavf_adapter *adapter);
|
|
|
|
int iavf_get_vf_config(struct iavf_adapter *adapter);
|
2021-11-29 16:16:00 -08:00
|
|
|
int iavf_get_vf_vlan_v2_caps(struct iavf_adapter *adapter);
|
|
|
|
int iavf_send_vf_offload_vlan_v2_msg(struct iavf_adapter *adapter);
|
2021-11-29 16:16:02 -08:00
|
|
|
void iavf_set_queue_vlan_tag_loc(struct iavf_adapter *adapter);
|
2022-06-10 14:15:54 +02:00
|
|
|
u16 iavf_get_num_vlans_added(struct iavf_adapter *adapter);
|
2018-09-14 17:37:46 -07:00
|
|
|
void iavf_irq_enable(struct iavf_adapter *adapter, bool flush);
|
|
|
|
void iavf_configure_queues(struct iavf_adapter *adapter);
|
|
|
|
void iavf_deconfigure_queues(struct iavf_adapter *adapter);
|
|
|
|
void iavf_enable_queues(struct iavf_adapter *adapter);
|
|
|
|
void iavf_disable_queues(struct iavf_adapter *adapter);
|
|
|
|
void iavf_map_queues(struct iavf_adapter *adapter);
|
|
|
|
int iavf_request_queues(struct iavf_adapter *adapter, int num);
|
|
|
|
void iavf_add_ether_addrs(struct iavf_adapter *adapter);
|
|
|
|
void iavf_del_ether_addrs(struct iavf_adapter *adapter);
|
|
|
|
void iavf_add_vlans(struct iavf_adapter *adapter);
|
|
|
|
void iavf_del_vlans(struct iavf_adapter *adapter);
|
|
|
|
void iavf_set_promiscuous(struct iavf_adapter *adapter, int flags);
|
|
|
|
void iavf_request_stats(struct iavf_adapter *adapter);
|
2022-01-27 15:16:29 +01:00
|
|
|
int iavf_request_reset(struct iavf_adapter *adapter);
|
2018-09-14 17:37:46 -07:00
|
|
|
void iavf_get_hena(struct iavf_adapter *adapter);
|
|
|
|
void iavf_set_hena(struct iavf_adapter *adapter);
|
|
|
|
void iavf_set_rss_key(struct iavf_adapter *adapter);
|
|
|
|
void iavf_set_rss_lut(struct iavf_adapter *adapter);
|
|
|
|
void iavf_enable_vlan_stripping(struct iavf_adapter *adapter);
|
|
|
|
void iavf_disable_vlan_stripping(struct iavf_adapter *adapter);
|
|
|
|
void iavf_virtchnl_completion(struct iavf_adapter *adapter,
|
|
|
|
enum virtchnl_ops v_opcode,
|
2019-04-17 15:17:30 -07:00
|
|
|
enum iavf_status v_retval, u8 *msg, u16 msglen);
|
2018-09-14 17:37:46 -07:00
|
|
|
int iavf_config_rss(struct iavf_adapter *adapter);
|
|
|
|
int iavf_lan_add_device(struct iavf_adapter *adapter);
|
|
|
|
int iavf_lan_del_device(struct iavf_adapter *adapter);
|
|
|
|
void iavf_client_subtask(struct iavf_adapter *adapter);
|
2018-09-14 17:37:55 -07:00
|
|
|
void iavf_notify_client_message(struct iavf_vsi *vsi, u8 *msg, u16 len);
|
|
|
|
void iavf_notify_client_l2_params(struct iavf_vsi *vsi);
|
|
|
|
void iavf_notify_client_open(struct iavf_vsi *vsi);
|
|
|
|
void iavf_notify_client_close(struct iavf_vsi *vsi, bool reset);
|
2018-09-14 17:37:46 -07:00
|
|
|
void iavf_enable_channels(struct iavf_adapter *adapter);
|
|
|
|
void iavf_disable_channels(struct iavf_adapter *adapter);
|
|
|
|
void iavf_add_cloud_filter(struct iavf_adapter *adapter);
|
|
|
|
void iavf_del_cloud_filter(struct iavf_adapter *adapter);
|
2021-11-29 16:16:03 -08:00
|
|
|
void iavf_enable_vlan_stripping_v2(struct iavf_adapter *adapter, u16 tpid);
|
|
|
|
void iavf_disable_vlan_stripping_v2(struct iavf_adapter *adapter, u16 tpid);
|
|
|
|
void iavf_enable_vlan_insertion_v2(struct iavf_adapter *adapter, u16 tpid);
|
|
|
|
void iavf_disable_vlan_insertion_v2(struct iavf_adapter *adapter, u16 tpid);
|
|
|
|
void
|
|
|
|
iavf_set_vlan_offload_features(struct iavf_adapter *adapter,
|
|
|
|
netdev_features_t prev_features,
|
|
|
|
netdev_features_t features);
|
2021-03-09 11:08:11 +08:00
|
|
|
void iavf_add_fdir_filter(struct iavf_adapter *adapter);
|
|
|
|
void iavf_del_fdir_filter(struct iavf_adapter *adapter);
|
2021-04-13 08:48:41 +08:00
|
|
|
void iavf_add_adv_rss_cfg(struct iavf_adapter *adapter);
|
|
|
|
void iavf_del_adv_rss_cfg(struct iavf_adapter *adapter);
|
2019-12-17 11:29:23 +01:00
|
|
|
struct iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter,
|
|
|
|
const u8 *macaddr);
|
iavf: Fix VLAN feature flags after VFR
When a VF goes through a reset, it's possible for the VF's feature set
to change. For example it may lose the VIRTCHNL_VF_OFFLOAD_VLAN
capability after VF reset. Unfortunately, the driver doesn't correctly
deal with this situation and errors are seen from downing/upping the
interface and/or moving the interface in/out of a network namespace.
When setting the interface down/up we see the following errors after the
VIRTCHNL_VF_OFFLOAD_VLAN capability was taken away from the VF:
ice 0000:51:00.1: VF 1 failed opcode 12, retval: -64 iavf 0000:51:09.1:
Failed to add VLAN filter, error IAVF_NOT_SUPPORTED ice 0000:51:00.1: VF
1 failed opcode 13, retval: -64 iavf 0000:51:09.1: Failed to delete VLAN
filter, error IAVF_NOT_SUPPORTED
These add/delete errors are happening because the VLAN filters are
tracked internally to the driver and regardless of the VLAN_ALLOWED()
setting the driver tries to delete/re-add them over virtchnl.
Fix the delete failure by making sure to delete any VLAN filter tracking
in the driver when a removal request is made, while preventing the
virtchnl request. This makes it so the driver's VLAN list is up to date
and the errors are
Fix the add failure by making sure the check for VLAN_ALLOWED() during
reset is done after the VF receives its capability list from the PF via
VIRTCHNL_OP_GET_VF_RESOURCES. If VLAN functionality is not allowed, then
prevent requesting re-adding the filters over virtchnl.
When moving the interface into a network namespace we see the following
errors after the VIRTCHNL_VF_OFFLOAD_VLAN capability was taken away from
the VF:
iavf 0000:51:09.1 enp81s0f1v1: NIC Link is Up Speed is 25 Gbps Full Duplex
iavf 0000:51:09.1 temp_27: renamed from enp81s0f1v1
iavf 0000:51:09.1 mgmt: renamed from temp_27
iavf 0000:51:09.1 dev27: set_features() failed (-22); wanted 0x020190001fd54833, left 0x020190001fd54bb3
These errors are happening because we aren't correctly updating the
netdev capabilities and dealing with ndo_fix_features() and
ndo_set_features() correctly.
Fix this by only reporting errors in the driver's ndo_set_features()
callback when VIRTCHNL_VF_OFFLOAD_VLAN is not allowed and any attempt to
enable the VLAN features is made. Also, make sure to disable VLAN
insertion, filtering, and stripping since the VIRTCHNL_VF_OFFLOAD_VLAN
flag applies to all of them and not just VLAN stripping.
Also, after we process the capabilities in the VF reset path, make sure
to call netdev_update_features() in case the capabilities have changed
in order to update the netdev's feature set to match the VF's actual
capabilities.
Lastly, make sure to always report success on VLAN filter delete when
VIRTCHNL_VF_OFFLOAD_VLAN is not supported. The changed flow in
iavf_del_vlans() allows the stack to delete previosly existing VLAN
filters even if VLAN filtering is not allowed. This makes it so the VLAN
filter list is up to date.
Fixes: 8774370d268f ("i40e/i40evf: support for VF VLAN tag stripping control")
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-11-05 09:20:25 -07:00
|
|
|
int iavf_lock_timeout(struct mutex *lock, unsigned int msecs);
|
2018-09-14 17:37:46 -07:00
|
|
|
#endif /* _IAVF_H_ */
|