iavf: update intel ethernet iavf driver to 4.2.7

Signed-off-by: Zhiping Du <zhipingdu@tencent.com>
This commit is contained in:
Zhiping du 2021-10-12 17:00:10 +08:00 committed by kaixuxiakx
parent 13f79fc883
commit c7997e144a
32 changed files with 11557 additions and 2085 deletions

View File

@ -1,16 +1,17 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright(c) 2013 - 2018 Intel Corporation.
#
# Makefile for the Intel(R) Ethernet Adaptive Virtual Function (iavf)
# driver
#
#
# Copyright (c) 2013, Intel Corporation.
ccflags-y += -I$(src)
subdir-ccflags-y += -I$(src)
obj-$(CONFIG_IAVF) += iavf.o
iavf-objs := iavf_main.o iavf_ethtool.o iavf_virtchnl.o \
iavf_txrx.o iavf_common.o iavf_adminq.o iavf_client.o \
kcompat_vfd.o kcompat.o
iavf-y := iavf_main.o \
iavf_ethtool.o \
iavf_virtchnl.o \
iavf_adminq.o \
iavf_common.o \
iavf_txrx.o \
kcompat.o
iavf-$(CONFIG_PTP_1588_CLOCK:m=y) += iavf_ptp.o

View File

@ -0,0 +1 @@
iavf.ko external

View File

@ -0,0 +1,352 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2013, Intel Corporation.
#
# common Makefile rules useful for out-of-tree Linux driver builds
#
# Usage: include common.mk
#
# After including, you probably want to add a minimum_kver_check call
#
# Required Variables:
# DRIVER
# -- Set to the lowercase driver name
#####################
# Helpful functions #
#####################
readlink = $(shell readlink -f ${1})
# helper functions for converting kernel version to version codes
get_kver = $(or $(word ${2},$(subst ., ,${1})),0)
get_kvercode = $(shell [ "${1}" -ge 0 -a "${1}" -le 255 2>/dev/null ] && \
[ "${2}" -ge 0 -a "${2}" -le 255 2>/dev/null ] && \
[ "${3}" -ge 0 -a "${3}" -le 255 2>/dev/null ] && \
printf %d $$(( ( ${1} << 16 ) + ( ${2} << 8 ) + ( ${3} ) )) )
################
# depmod Macro #
################
cmd_depmod = /sbin/depmod $(if ${SYSTEM_MAP_FILE},-e -F ${SYSTEM_MAP_FILE}) \
$(if $(strip ${INSTALL_MOD_PATH}),-b ${INSTALL_MOD_PATH}) \
-a ${KVER}
################
# dracut Macro #
################
cmd_initrd := $(shell \
if which dracut > /dev/null 2>&1 ; then \
echo "dracut --force"; \
elif which update-initramfs > /dev/null 2>&1 ; then \
echo "update-initramfs -u"; \
fi )
#####################
# Environment tests #
#####################
DRIVER_UPPERCASE := $(shell echo ${DRIVER} | tr "[:lower:]" "[:upper:]")
ifeq (,${BUILD_KERNEL})
BUILD_KERNEL=$(shell uname -r)
endif
# Kernel Search Path
# All the places we look for kernel source
KSP := /lib/modules/${BUILD_KERNEL}/source \
/lib/modules/${BUILD_KERNEL}/build \
/usr/src/linux-${BUILD_KERNEL} \
/usr/src/linux-$(${BUILD_KERNEL} | sed 's/-.*//') \
/usr/src/kernel-headers-${BUILD_KERNEL} \
/usr/src/kernel-source-${BUILD_KERNEL} \
/usr/src/linux-$(${BUILD_KERNEL} | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/') \
/usr/src/linux \
/usr/src/kernels/${BUILD_KERNEL} \
/usr/src/kernels
# prune the list down to only values that exist and have an include/linux
# sub-directory. We can't use include/config because some older kernels don't
# have this.
test_dir = $(shell [ -e ${dir}/include/linux ] && echo ${dir})
KSP := $(foreach dir, ${KSP}, ${test_dir})
# we will use this first valid entry in the search path
ifeq (,${KSRC})
KSRC := $(firstword ${KSP})
endif
ifeq (,${KSRC})
$(warning *** Kernel header files not in any of the expected locations.)
$(warning *** Install the appropriate kernel development package, e.g.)
$(error kernel-devel, for building kernel modules and try again)
else
ifeq (/lib/modules/${BUILD_KERNEL}/source, ${KSRC})
KOBJ := /lib/modules/${BUILD_KERNEL}/build
else
KOBJ := ${KSRC}
endif
endif
# Version file Search Path
VSP := ${KOBJ}/include/generated/utsrelease.h \
${KOBJ}/include/linux/utsrelease.h \
${KOBJ}/include/linux/version.h \
${KOBJ}/include/generated/uapi/linux/version.h \
/boot/vmlinuz.version.h
# Config file Search Path
CSP := ${KOBJ}/include/generated/autoconf.h \
${KOBJ}/include/linux/autoconf.h \
/boot/vmlinuz.autoconf.h
# System.map Search Path (for depmod)
MSP := ${KSRC}/System.map \
/boot/System.map-${BUILD_KERNEL}
# prune the lists down to only files that exist
test_file = $(shell [ -f ${file} ] && echo ${file})
VSP := $(foreach file, ${VSP}, ${test_file})
CSP := $(foreach file, ${CSP}, ${test_file})
MSP := $(foreach file, ${MSP}, ${test_file})
# and use the first valid entry in the Search Paths
ifeq (,${VERSION_FILE})
VERSION_FILE := $(firstword ${VSP})
endif
ifeq (,${CONFIG_FILE})
CONFIG_FILE := $(firstword ${CSP})
endif
ifeq (,${SYSTEM_MAP_FILE})
SYSTEM_MAP_FILE := $(firstword ${MSP})
endif
ifeq (,$(wildcard ${VERSION_FILE}))
$(error Linux kernel source not configured - missing version header file)
endif
ifeq (,$(wildcard ${CONFIG_FILE}))
$(error Linux kernel source not configured - missing autoconf.h)
endif
ifeq (,$(wildcard ${SYSTEM_MAP_FILE}))
$(warning Missing System.map file - depmod will not check for missing symbols during module installation)
endif
ifneq ($(words $(subst :, ,$(CURDIR))), 1)
$(error Sources directory '$(CURDIR)' cannot contain spaces nor colons. Rename directory or move sources to another path)
endif
########################
# Extract config value #
########################
get_config_value = $(shell ${CC} -E -dM ${CONFIG_FILE} 2> /dev/null |\
grep -m 1 ${1} | awk '{ print $$3 }')
########################
# Check module signing #
########################
CONFIG_MODULE_SIG_ALL := $(call get_config_value,CONFIG_MODULE_SIG_ALL)
CONFIG_MODULE_SIG_FORCE := $(call get_config_value,CONFIG_MODULE_SIG_FORCE)
CONFIG_MODULE_SIG_KEY := $(call get_config_value,CONFIG_MODULE_SIG_KEY)
SIG_KEY_SP := ${KOBJ}/${CONFIG_MODULE_SIG_KEY} \
${KOBJ}/certs/signing_key.pem
SIG_KEY_FILE := $(firstword $(foreach file, ${SIG_KEY_SP}, ${test_file}))
# print a warning if the kernel configuration attempts to sign modules but
# the signing key can't be found.
ifneq (${SIG_KEY_FILE},)
warn_signed_modules := : ;
else
warn_signed_modules :=
ifeq (${CONFIG_MODULE_SIG_ALL},1)
warn_signed_modules += \
echo "*** The target kernel has CONFIG_MODULE_SIG_ALL enabled, but" ; \
echo "*** the signing key cannot be found. Module signing has been" ; \
echo "*** disabled for this build." ;
endif # CONFIG_MODULE_SIG_ALL=y
ifeq (${CONFIG_MODULE_SIG_FORCE},1)
echo "warning: The target kernel has CONFIG_MODULE_SIG_FORCE enabled," ; \
echo "warning: but the signing key cannot be found. The module must" ; \
echo "warning: be signed manually using 'scripts/sign-file'." ;
endif # CONFIG_MODULE_SIG_FORCE
DISABLE_MODULE_SIGNING := Yes
endif
#######################
# Linux Version Setup #
#######################
# The following command line parameter is intended for development of KCOMPAT
# against upstream kernels such as net-next which have broken or non-updated
# version codes in their Makefile. They are intended for debugging and
# development purpose only so that we can easily test new KCOMPAT early. If you
# don't know what this means, you do not need to set this flag. There is no
# arcane magic here.
# Convert LINUX_VERSION into LINUX_VERSION_CODE
ifneq (${LINUX_VERSION},)
LINUX_VERSION_CODE=$(call get_kvercode,$(call get_kver,${LINUX_VERSION},1),$(call get_kver,${LINUX_VERSION},2),$(call get_kver,${LINUX_VERSION},3))
endif
# Honor LINUX_VERSION_CODE
ifneq (${LINUX_VERSION_CODE},)
$(warning Forcing target kernel to build with LINUX_VERSION_CODE of ${LINUX_VERSION_CODE}$(if ${LINUX_VERSION}, from LINUX_VERSION=${LINUX_VERSION}). Do this at your own risk.)
KVER_CODE := ${LINUX_VERSION_CODE}
EXTRA_CFLAGS += -DLINUX_VERSION_CODE=${LINUX_VERSION_CODE}
endif
# Determine SLE_KERNEL_REVISION for SuSE SLE >= 11 (needed by kcompat)
# This assumes SuSE will continue setting CONFIG_LOCALVERSION to the string
# appended to the stable kernel version on which their kernel is based with
# additional versioning information (up to 3 numbers), a possible abbreviated
# git SHA1 commit id and a kernel type, e.g. CONFIG_LOCALVERSION=-1.2.3-default
# or CONFIG_LOCALVERSION=-999.gdeadbee-default
#
# SLE_LOCALVERSION_CODE is also exported to support legacy kcompat.h
# definitions.
ifeq (1,$(call get_config_value,CONFIG_SUSE_KERNEL))
ifneq (10,$(call get_config_value,CONFIG_SLE_VERSION))
CONFIG_LOCALVERSION := $(call get_config_value,CONFIG_LOCALVERSION)
LOCALVERSION := $(shell echo ${CONFIG_LOCALVERSION} | \
cut -d'-' -f2 | sed 's/\.g[[:xdigit:]]\{7\}//')
LOCALVER_A := $(shell echo ${LOCALVERSION} | cut -d'.' -f1)
LOCALVER_B := $(shell echo ${LOCALVERSION} | cut -s -d'.' -f2)
LOCALVER_C := $(shell echo ${LOCALVERSION} | cut -s -d'.' -f3)
SLE_LOCALVERSION_CODE := $(shell expr ${LOCALVER_A} \* 65536 + \
0${LOCALVER_B} \* 256 + 0${LOCALVER_C})
EXTRA_CFLAGS += -DSLE_LOCALVERSION_CODE=${SLE_LOCALVERSION_CODE}
EXTRA_CFLAGS += -DSLE_KERNEL_REVISION=${LOCALVER_A}
endif
endif
EXTRA_CFLAGS += ${CFLAGS_EXTRA}
# get the kernel version - we use this to find the correct install path
KVER := $(shell ${CC} ${EXTRA_CFLAGS} -E -dM ${VERSION_FILE} | grep UTS_RELEASE | \
awk '{ print $$3 }' | sed 's/\"//g')
# assume source symlink is the same as build, otherwise adjust KOBJ
ifneq (,$(wildcard /lib/modules/${KVER}/build))
ifneq (${KSRC},$(call readlink,/lib/modules/${KVER}/build))
KOBJ=/lib/modules/${KVER}/build
endif
endif
ifeq (${KVER_CODE},)
KVER_CODE := $(shell ${CC} ${EXTRA_CFLAGS} -E -dM ${VSP} 2> /dev/null |\
grep -m 1 LINUX_VERSION_CODE | awk '{ print $$3 }' | sed 's/\"//g')
endif
# minimum_kver_check
#
# helper function to provide uniform output for different drivers to abort the
# build based on kernel version check. Usage: "$(call minimum_kver_check,2,6,XX)".
define _minimum_kver_check
ifeq (0,$(shell [ ${KVER_CODE} -lt $(call get_kvercode,${1},${2},${3}) ]; echo "$$?"))
$$(warning *** Aborting the build.)
$$(error This driver is not supported on kernel versions older than ${1}.${2}.${3})
endif
endef
minimum_kver_check = $(eval $(call _minimum_kver_check,${1},${2},${3}))
################
# Manual Pages #
################
MANSECTION = 7
ifeq (,${MANDIR})
# find the best place to install the man page
MANPATH := $(shell (manpath 2>/dev/null || echo $MANPATH) | sed 's/:/ /g')
ifneq (,${MANPATH})
# test based on inclusion in MANPATH
test_dir = $(findstring ${dir}, ${MANPATH})
else
# no MANPATH, test based on directory existence
test_dir = $(shell [ -e ${dir} ] && echo ${dir})
endif
# our preferred install path
# should /usr/local/man be in here ?
MANDIR := /usr/share/man /usr/man
MANDIR := $(foreach dir, ${MANDIR}, ${test_dir})
MANDIR := $(firstword ${MANDIR})
endif
ifeq (,${MANDIR})
# fallback to /usr/man
MANDIR := /usr/man
endif
####################
# CCFLAGS variable #
####################
# set correct CCFLAGS variable for kernels older than 2.6.24
ifeq (0,$(shell [ ${KVER_CODE} -lt $(call get_kvercode,2,6,24) ]; echo $$?))
CCFLAGS_VAR := EXTRA_CFLAGS
else
CCFLAGS_VAR := ccflags-y
endif
#################
# KBUILD_OUTPUT #
#################
# Only set KBUILD_OUTPUT if the real paths of KOBJ and KSRC differ
ifneq ($(call readlink,${KSRC}),$(call readlink,${KOBJ}))
export KBUILD_OUTPUT ?= ${KOBJ}
endif
############################
# Module Install Directory #
############################
# Default to using updates/drivers/net/ethernet/intel/ path, since depmod since
# v3.1 defaults to checking updates folder first, and only checking kernels/
# and extra afterwards. We use updates instead of kernel/* due to desire to
# prevent over-writing built-in modules files.
export INSTALL_MOD_DIR ?= updates/drivers/net/ethernet/intel/${DRIVER}
######################
# Kernel Build Macro #
######################
# kernel build function
# ${1} is the kernel build target
# ${2} may contain any extra rules to pass directly to the sub-make process
#
# This function is expected to be executed by
# @+$(call kernelbuild,<target>,<extra parameters>)
# from within a Makefile recipe.
#
# The following variables are expected to be defined for its use:
# GCC_I_SYS -- if set it will enable use of gcc-i-sys.sh wrapper to use -isystem
# CCFLAGS_VAR -- the CCFLAGS variable to set extra CFLAGS
# EXTRA_CFLAGS -- a set of extra CFLAGS to pass into the ccflags-y variable
# KSRC -- the location of the kernel source tree to build against
# DRIVER_UPPERCASE -- the uppercase name of the kernel module, set from DRIVER
# W -- if set, enables the W= kernel warnings options
# C -- if set, enables the C= kernel sparse build options
#
kernelbuild = $(call warn_signed_modules) \
${MAKE} $(if ${GCC_I_SYS},CC="${GCC_I_SYS}") \
${CCFLAGS_VAR}="${EXTRA_CFLAGS}" \
-C "${KSRC}" \
CONFIG_${DRIVER_UPPERCASE}=m \
$(if ${DISABLE_MODULE_SIGNING},CONFIG_MODULE_SIG=n) \
$(if ${DISABLE_MODULE_SIGNING},CONFIG_MODULE_SIG_ALL=) \
M="${CURDIR}" \
$(if ${W},W="${W}") \
$(if ${C},C="${C}") \
${2} ${1}

View File

@ -45,6 +45,7 @@
#include "iavf_type.h"
#include "virtchnl.h"
#include "iavf_txrx.h"
#include "iavf_ptp.h"
#include <linux/bitmap.h>
#define DEFAULT_DEBUG_LEVEL_SHIFT 3
@ -63,9 +64,10 @@ struct iavf_vsi {
struct net_device *netdev;
#ifdef HAVE_VLAN_RX_REGISTER
struct vlan_group *vlgrp;
#else
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
#endif
unsigned long active_cvlans[BITS_TO_LONGS(VLAN_N_VID)];
unsigned long active_svlans[BITS_TO_LONGS(VLAN_N_VID)];
/* dummy pointer - VF plans to add this functionality in the future */
struct iavf_ring **xdp_rings;
u16 seid;
@ -74,7 +76,6 @@ struct iavf_vsi {
int base_vector;
u16 work_limit;
u16 qs_handle;
void *priv; /* client driver data reference. */
};
/* How many Rx Buffers do we bundle into one write to the hardware ? */
@ -98,10 +99,100 @@ struct iavf_vsi {
(&(((struct iavf_tx_context_desc *)((R)->desc))[i]))
#define IAVF_MAX_REQ_QUEUES 16
#define IAVF_START_CHNL_TC 1
#define IAVF_HKEY_ARRAY_SIZE ((IAVF_VFQF_HKEY_MAX_INDEX + 1) * 4)
#define IAVF_HLUT_ARRAY_SIZE ((IAVF_VFQF_HLUT_MAX_INDEX + 1) * 4)
#define IAVF_MBPS_DIVISOR 125000 /* divisor to convert to Mbps */
#define IAVF_VIRTCHNL_VF_RESOURCE_SIZE (sizeof(struct virtchnl_vf_resource) + \
(IAVF_MAX_VF_VSI * \
sizeof(struct virtchnl_vsi_resource)))
#define IAVF_NETIF_F_HW_VLAN_BITS
#ifdef NETIF_F_HW_VLAN_CTAG_RX
#define IAVF_NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_CTAG_RX
#else
#define IAVF_NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_RX
#endif
#ifdef NETIF_F_HW_VLAN_CTAG_TX
#define IAVF_NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_CTAG_TX
#else
#define IAVF_NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX
#endif
#ifdef NETIF_F_HW_VLAN_CTAG_FILTER
#define IAVF_NETIF_F_HW_VLAN_CTAG_FILTER NETIF_F_HW_VLAN_CTAG_FILTER
#else
#define IAVF_NETIF_F_HW_VLAN_CTAG_FILTER NETIF_F_HW_VLAN_FILTER
#endif
enum iavf_chnl_vector_state {
IAVF_VEC_IN_BP,
IAVF_VEC_PREV_IN_BP,
IAVF_VEC_ONCE_IN_BP,
IAVF_VEC_PREV_DATA_PKT_RECV,
IAVF_VEC_NBITS, /* This must be last */
};
struct iavf_channel_ex {
atomic_t fd_queue;
u32 fd_cnt_idx;
u16 num_rxq;
u16 base_q;
/* number of filter specific to this channel (aka ADQ TC) */
u32 num_fltr;
};
struct iavf_q_vector_ch_stats {
/* following are used as part of managing driver internal
* state machine. Only to be used for perf debugging.
*/
u64 in_bp;
u64 in_intr;
u64 intr_to_bp;
u64 bp_to_intr;
u64 intr_to_intr;
u64 bp_to_bp;
/* This counter is used to track real transition of vector from
* BUSY_POLL to INTERRUPT based on enhanced logic (using state
* machine and control packets).
*/
u64 unlikely_cb_to_bp;
/* Tracking "unlikely_cb_bp and once_in_bp is true" */
u64 ucb_once_in_bp_true;
/* This is used to keep track of enabling interrupt from napi_poll
* when state machine condition indicated once_in_bp is false
*/
u64 intr_once_bp_false;
u64 bp_stop_need_resched;
u64 bp_stop_timeout;
u64 cleaned_any_data_pkt;
/* busy_poll stop, need_resched is set and did not clean
* any data packet during this previous invocation of napi_poll
*/
u64 need_resched_no_data_pkt;
/* busy_poll stop, need_resched is not set: hence it is inferred as
* possible timeout and did not clean any data packet during this
* previous invocation of napi_poll
*/
u64 timeout_no_data_pkt;
u64 sw_intr_timeout; /* track SW INTR from napi_poll */
u64 sw_intr_serv_task; /* track SW INTR from service_task */
/* This keeps track of how many times, bailout when once_in_bp is set,
* unlikely_cb_to_bp is set, but pkt based interrupt optimization
* is OFF
*/
u64 no_sw_intr_opt_off;
/* tracking, how many times WB_ON_ITR is set */
u64 wb_on_itr_set;
/* keeps track of SW triggered interrupt due to not clean_complete */
u64 intr_en_not_clean_complete;
};
/* MAX_MSIX_Q_VECTORS of these are allocated,
* but we only use one per queue-specific vector.
*/
@ -122,8 +213,151 @@ struct iavf_q_vector {
cpumask_t affinity_mask;
struct irq_affinity_notify affinity_notify;
#endif
/* This tracks current state of vector, BUSY_POLL or INTR */
#define IAVF_VECTOR_STATE_IN_BP BIT(IAVF_VEC_IN_BP)
/* This tracks prev state of vector, BUSY_POLL or INTR */
#define IAVF_VECTOR_STATE_PREV_IN_BP BIT(IAVF_VEC_PREV_IN_BP)
/* This tracks state of vector, was the ever in BUSY_POLL. This
* state goes to INTT if interrupt are enabled or SW interrupts
* are triggered from either service_task or napi_poll
*/
#define IAVF_VECTOR_STATE_ONCE_IN_BP BIT(IAVF_VEC_ONCE_IN_BP)
/* Tracks if previously - were there any data packets received
* on per channel enabled vector or not
*/
#define IAVF_VECTOR_STATE_PREV_DATA_PKT_RECV BIT(IAVF_VEC_PREV_DATA_PKT_RECV)
/* it is used to keep track of various states as defined earlier
* and those states are used during ADQ performance optimization
*/
u8 state_flags;
#define IAVF_VECTOR_CHNL_PERF_ENA BIT(0)
/* controls packet inspection based optimization is OFF/ON */
#define IAVF_VECTOR_CHNL_PKT_OPT_ENA BIT(1)
u16 chnl_flags;
/* Used in logic to determine if SW inter is needed or not.
* This is used only for channel enabled vector
*/
u64 jiffies;
struct iavf_channel_ex *ch;
struct iavf_q_vector_ch_stats ch_stats;
};
static inline bool vector_pkt_inspect_opt_ena(struct iavf_q_vector *q_vector)
{
return q_vector->chnl_flags & IAVF_VECTOR_CHNL_PKT_OPT_ENA;
}
static inline bool vector_ch_ena(struct iavf_q_vector *qv)
{
return !!qv->ch;
}
static inline bool vector_ch_perf_ena(struct iavf_q_vector *qv)
{
return qv->chnl_flags & IAVF_VECTOR_CHNL_PERF_ENA;
}
/**
* vector_busypoll_intr
* @qv: pointer to q_vector
*
* This function returns true if vector is transitioning from BUSY_POLL
* to INTERRUPT based on current and previous state of vector
*/
static inline bool vector_busypoll_intr(struct iavf_q_vector *qv)
{
return (qv->state_flags & IAVF_VECTOR_STATE_PREV_IN_BP) &&
!(qv->state_flags & IAVF_VECTOR_STATE_IN_BP);
}
/**
* vector_ever_in_busypoll
* @qv: pointer to q_vector
*
* This function returns true if vectors current OR previous state
* is BUSY_POLL
*/
static inline bool vector_ever_in_busypoll(struct iavf_q_vector *qv)
{
return (qv->state_flags & IAVF_VECTOR_STATE_PREV_IN_BP) ||
(qv->state_flags & IAVF_VECTOR_STATE_IN_BP);
}
/**
* vector_state_curr_prev_intr
* @qv: pointer to q_vector
*
* This function returns true if vectors current AND previous state
* is INTERRUPT
*/
static inline bool vector_state_curr_prev_intr(struct iavf_q_vector *qv)
{
return !(qv->state_flags & IAVF_VECTOR_STATE_PREV_IN_BP) &&
!(qv->state_flags & IAVF_VECTOR_STATE_IN_BP);
}
/**
* vector_intr_busypoll
* @qv: pointer to q_vector
*
* This function returns true if vector is transitioning from INTERRUPT
* to BUSY_POLL based on current and previous state of vector
*/
static inline bool vector_intr_busypoll(struct iavf_q_vector *qv)
{
return !(qv->state_flags & IAVF_VECTOR_STATE_PREV_IN_BP) &&
(qv->state_flags & IAVF_VECTOR_STATE_IN_BP);
}
/**
* iavf_inc_napi_sw_intr_counter
* @q_vector: pointer to q_vector
*
* Track software interrupt from napi_poll codeflow. Caller of this
* expected to call iavf_force_wb to actually trigger SW intr.
*/
static inline void
iavf_inc_napi_sw_intr_counter(struct iavf_q_vector *q_vector)
{
q_vector->ch_stats.sw_intr_timeout++;
}
/**
* iavf_inc_serv_task_sw_intr_counter
* @q_vector: pointer to q_vector
*
* Track software interrupt from service_task codeflow. Caller of this
* expected to call iavf_force_wb to actually trigger SW intr.
*/
static inline void
iavf_inc_serv_task_sw_intr_counter(struct iavf_q_vector *q_vector)
{
q_vector->ch_stats.sw_intr_serv_task++;
}
/**
* iavf_set_wb_on_itr - trigger force write-back by setting WB_ON_ITR bit
* @hw: ptr to HW
* @qv: pointer to vector
*
* This function is used to force write-backs by setting WB_ON_ITR bit
* in DYN_CTLN register. WB_ON_ITR and INTENA are mutually exclusive bits.
* Seting WB_ON_ITR bits means TX and RX descriptors are written back based
* on ITR expiration irrespective of INTENA setting
*/
static inline void
iavf_set_wb_on_itr(struct iavf_hw *hw, struct iavf_q_vector *qv)
{
qv->ch_stats.wb_on_itr_set++;
wr32(hw, IAVF_VFINT_DYN_CTLN1(qv->reg_idx),
IAVF_VFINT_DYN_CTLN1_ITR_INDX_MASK |
IAVF_VFINT_DYN_CTLN1_WB_ON_ITR_MASK);
}
/* 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
* supported by all of the iavf hardware is 8.
@ -150,11 +384,18 @@ struct iavf_mac_filter {
bool is_new_mac; /* filter is new, wait for PF decision */
bool remove; /* filter needs to be removed */
bool add; /* filter needs to be added */
bool is_primary; /* filter is a default VF MAC */
};
#define IAVF_VLAN(vid, tpid) ((struct iavf_vlan){ vid, tpid })
struct iavf_vlan {
u16 vid;
u16 tpid;
};
struct iavf_vlan_filter {
struct list_head list;
u16 vlan;
struct iavf_vlan vlan;
bool remove; /* filter needs to be removed */
bool add; /* filter needs to be added */
};
@ -170,6 +411,7 @@ struct iavf_channel_config {
struct virtchnl_channel_info ch_info[VIRTCHNL_MAX_ADQ_V2_CHANNELS];
enum iavf_tc_state_t state;
u8 total_qps;
struct iavf_channel_ex ch_ex_info[VIRTCHNL_MAX_ADQ_V2_CHANNELS];
};
/* State of cloud filter */
@ -186,6 +428,8 @@ enum iavf_state_t {
__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_INIT_EXTENDED_CAPS, /* process extended caps which require aq msg exchange */
__IAVF_INIT_CONFIG_ADAPTER,
__IAVF_INIT_SW, /* got resources, setting up structs */
__IAVF_INIT_FAILED, /* init failed, restarting procedure */
__IAVF_RESETTING, /* in reset */
@ -199,8 +443,8 @@ enum iavf_state_t {
enum iavf_critical_section_t {
__IAVF_IN_CRITICAL_TASK, /* cannot be interrupted */
__IAVF_IN_CLIENT_TASK,
__IAVF_IN_REMOVE_TASK, /* device being removed */
__IAVF_TX_TSTAMP_IN_PROGRESS, /* PTP Tx timestamp request in progress */
};
#define IAVF_CLOUD_FIELD_OMAC 0x01
@ -231,13 +475,17 @@ struct iavf_cloud_filter {
unsigned long cookie;
bool del; /* filter needs to be deleted */
bool add; /* filter needs to be added */
struct iavf_channel_ex *ch;
};
#define IAVF_RESET_WAIT_MS 10
#define IAVF_RESET_WAIT_DETECTED_COUNT 500
#define IAVF_RESET_WAIT_COMPLETE_COUNT 2000
/* board specific private data structure */
struct iavf_adapter {
struct work_struct adminq_task;
struct delayed_work watchdog_task;
struct delayed_work client_task;
wait_queue_head_t down_waitqueue;
struct iavf_q_vector *q_vectors;
struct list_head vlan_filter_list;
@ -245,6 +493,7 @@ struct iavf_adapter {
/* Lock to protect accesses to MAC and VLAN lists */
spinlock_t mac_vlan_list_lock;
char misc_vector_name[IFNAMSIZ + 9];
u8 rxdid;
int num_active_queues;
int num_req_queues;
@ -258,10 +507,6 @@ struct iavf_adapter {
u64 hw_csum_rx_error;
u32 rx_desc_count;
int num_msix_vectors;
int num_iwarp_msix;
int iwarp_base_vector;
u32 client_pending;
struct iavf_client_instance *cinst;
struct msix_entry *msix_entries;
u32 flags;
@ -270,47 +515,99 @@ struct iavf_adapter {
#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_ENABLED BIT(17)
#define IAVF_FLAG_QUEUES_DISABLED BIT(18)
#define IAVF_FLAG_REINIT_MSIX_NEEDED BIT(20)
#define IAVF_FLAG_REINIT_CHNL_NEEDED BIT(21)
#define IAVF_FLAG_RESET_DETECTED BIT(22)
u32 chnl_perf_flags;
#define IAVF_FLAG_CHNL_PKT_OPT_ENA BIT(0)
/* duplicates for common code */
#define IAVF_FLAG_DCB_ENABLED 0
/* flags for admin queue service task */
u32 aq_required;
#define IAVF_FLAG_AQ_ENABLE_QUEUES BIT(0)
#define IAVF_FLAG_AQ_DISABLE_QUEUES BIT(1)
#define IAVF_FLAG_AQ_ADD_MAC_FILTER BIT(2)
#define IAVF_FLAG_AQ_ADD_VLAN_FILTER BIT(3)
#define IAVF_FLAG_AQ_DEL_MAC_FILTER BIT(4)
#define IAVF_FLAG_AQ_DEL_VLAN_FILTER BIT(5)
#define IAVF_FLAG_AQ_CONFIGURE_QUEUES BIT(6)
#define IAVF_FLAG_AQ_MAP_VECTORS BIT(7)
#define IAVF_FLAG_AQ_HANDLE_RESET BIT(8)
#define IAVF_FLAG_AQ_CONFIGURE_RSS BIT(9) /* direct AQ config */
#define IAVF_FLAG_AQ_GET_CONFIG BIT(10)
u64 aq_required;
#define IAVF_FLAG_AQ_ENABLE_QUEUES BIT(0)
#define IAVF_FLAG_AQ_DISABLE_QUEUES BIT(1)
#define IAVF_FLAG_AQ_ADD_MAC_FILTER BIT(2)
#define IAVF_FLAG_AQ_ADD_VLAN_FILTER BIT(3)
#define IAVF_FLAG_AQ_DEL_MAC_FILTER BIT(4)
#define IAVF_FLAG_AQ_DEL_VLAN_FILTER BIT(5)
#define IAVF_FLAG_AQ_CONFIGURE_QUEUES BIT(6)
#define IAVF_FLAG_AQ_MAP_VECTORS BIT(7)
#define IAVF_FLAG_AQ_HANDLE_RESET BIT(8)
#define IAVF_FLAG_AQ_CONFIGURE_RSS BIT(9) /* direct AQ config */
#define IAVF_FLAG_AQ_GET_CONFIG BIT(10)
/* Newer style, RSS done by the PF so we can ignore hardware vagaries. */
#define IAVF_FLAG_AQ_GET_HENA BIT(11)
#define IAVF_FLAG_AQ_SET_HENA BIT(12)
#define IAVF_FLAG_AQ_SET_RSS_KEY BIT(13)
#define IAVF_FLAG_AQ_SET_RSS_LUT BIT(14)
#define IAVF_FLAG_AQ_REQUEST_PROMISC BIT(15)
#define IAVF_FLAG_AQ_RELEASE_PROMISC BIT(16)
#define IAVF_FLAG_AQ_REQUEST_ALLMULTI BIT(17)
#define IAVF_FLAG_AQ_RELEASE_ALLMULTI BIT(18)
#define IAVF_FLAG_AQ_ENABLE_VLAN_STRIPPING BIT(19)
#define IAVF_FLAG_AQ_DISABLE_VLAN_STRIPPING BIT(20)
#define IAVF_FLAG_AQ_ENABLE_CHANNELS BIT(21)
#define IAVF_FLAG_AQ_DISABLE_CHANNELS BIT(22)
#define IAVF_FLAG_AQ_ADD_CLOUD_FILTER BIT(23)
#define IAVF_FLAG_AQ_DEL_CLOUD_FILTER BIT(24)
#define IAVF_FLAG_AQ_GET_HENA BIT(11)
#define IAVF_FLAG_AQ_SET_HENA BIT(12)
#define IAVF_FLAG_AQ_SET_RSS_KEY BIT(13)
#define IAVF_FLAG_AQ_SET_RSS_LUT BIT(14)
#define IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODE BIT(15)
#define IAVF_FLAG_AQ_ENABLE_VLAN_STRIPPING BIT(19)
#define IAVF_FLAG_AQ_DISABLE_VLAN_STRIPPING BIT(20)
#define IAVF_FLAG_AQ_ENABLE_CHANNELS BIT(21)
#define IAVF_FLAG_AQ_DISABLE_CHANNELS BIT(22)
#define IAVF_FLAG_AQ_ADD_CLOUD_FILTER BIT(23)
#define IAVF_FLAG_AQ_DEL_CLOUD_FILTER BIT(24)
#define IAVF_FLAG_AQ_REQUEST_STATS BIT(25)
#define IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS BIT(26)
#define IAVF_FLAG_AQ_ENABLE_CTAG_VLAN_STRIPPING BIT(27)
#define IAVF_FLAG_AQ_DISABLE_CTAG_VLAN_STRIPPING BIT(28)
#define IAVF_FLAG_AQ_ENABLE_STAG_VLAN_STRIPPING BIT(29)
#define IAVF_FLAG_AQ_DISABLE_STAG_VLAN_STRIPPING BIT(30)
#define IAVF_FLAG_AQ_ENABLE_CTAG_VLAN_INSERTION BIT(31)
#define IAVF_FLAG_AQ_DISABLE_CTAG_VLAN_INSERTION BIT(32)
#define IAVF_FLAG_AQ_ENABLE_STAG_VLAN_INSERTION BIT(33)
#define IAVF_FLAG_AQ_DISABLE_STAG_VLAN_INSERTION BIT(34)
#define IAVF_FLAG_AQ_GET_SUPPORTED_RXDIDS BIT(35)
#define IAVF_FLAG_AQ_GET_PTP_CAPS BIT(36)
#define IAVF_FLAG_AQ_SEND_PTP_CMD BIT(37)
/* AQ messages that must be sent after IAVF_FLAG_AQ_GET_CONFIG, in
* order to negotiated extended capabilities.
*/
#define IAVF_FLAG_AQ_EXTENDED_CAPS \
(IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS | \
IAVF_FLAG_AQ_GET_SUPPORTED_RXDIDS | \
IAVF_FLAG_AQ_GET_PTP_CAPS)
/* 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(0)
#define IAVF_EXTENDED_CAP_RECV_VLAN_V2 BIT(1)
#define IAVF_EXTENDED_CAP_SEND_RXDID BIT(2)
#define IAVF_EXTENDED_CAP_RECV_RXDID BIT(3)
#define IAVF_EXTENDED_CAP_SEND_PTP BIT(4)
#define IAVF_EXTENDED_CAP_RECV_PTP BIT(5)
#define IAVF_EXTENDED_CAPS \
(IAVF_EXTENDED_CAP_SEND_VLAN_V2 | \
IAVF_EXTENDED_CAP_RECV_VLAN_V2 | \
IAVF_EXTENDED_CAP_SEND_RXDID | \
IAVF_EXTENDED_CAP_RECV_RXDID | \
IAVF_EXTENDED_CAP_SEND_PTP | \
IAVF_EXTENDED_CAP_RECV_PTP)
/* Lock to prevent possible clobbering of
* current_netdev_promisc_flags
*/
spinlock_t current_netdev_promisc_flags_lock;
#ifdef HAVE_RHEL6_NET_DEVICE_OPS_EXT
u32 current_netdev_promisc_flags;
#else
netdev_features_t current_netdev_promisc_flags;
#endif /* HAVE_RHEL6_NET_DEVICE_OPS_EXT */
/* OS defined structs */
struct net_device *netdev;
@ -352,25 +649,34 @@ struct iavf_adapter {
VIRTCHNL_VF_OFFLOAD_RSS_PF)))
#define VLAN_ALLOWED(_a) ((_a)->vf_res->vf_cap_flags & \
VIRTCHNL_VF_OFFLOAD_VLAN)
#define VLAN_V2_ALLOWED(_a) ((_a)->vf_res->vf_cap_flags & \
VIRTCHNL_VF_OFFLOAD_VLAN_V2)
#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)))
#ifdef VIRTCHNL_VF_CAP_ADV_LINK_SPEED
#define ADV_LINK_SUPPORT(_a) ((_a)->vf_res->vf_cap_flags & \
VIRTCHNL_VF_CAP_ADV_LINK_SPEED)
#ifdef SPEED_25000
#define ALL_SPEEDS (SPEED_100000 | SPEED_50000 | SPEED_25000 | SPEED_10000 | \
SPEED_5000 | SPEED_2500 | SPEED_1000 | SPEED_100 | SPEED_10)
#else
#define ALL_SPEEDS (SPEED_100000 | SPEED_50000 | SPEED_10000 | SPEED_5000 | \
SPEED_2500 | SPEED_1000 | SPEED_100 | SPEED_10)
#endif
#define SUPPORTED_SPEED(_s) ((_s) & ALL_SPEEDS)
#endif /* VIRTCHNL_VF_CAP_ADV_LINK_SPEED */
#define ADQ_ALLOWED(_a) ((_a)->vf_res->vf_cap_flags & \
VIRTCHNL_VF_OFFLOAD_ADQ)
#define ADQ_V2_ALLOWED(_a) ((_a)->vf_res->vf_cap_flags & \
VIRTCHNL_VF_OFFLOAD_ADQ_V2)
#define RXDID_ALLOWED(_a) ((_a)->vf_res->vf_cap_flags & \
VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
#define PTP_ALLOWED(_a) ((_a)->vf_res->vf_cap_flags & \
VIRTCHNL_VF_CAP_PTP)
struct virtchnl_vf_resource *vf_res; /* incl. all VSIs */
struct virtchnl_vsi_resource *vsi_res; /* our LAN VSI */
struct virtchnl_version_info pf_version;
#define PF_IS_V11(_a) (((_a)->pf_version.major == 1) && \
((_a)->pf_version.minor == 1))
struct virtchnl_vlan_caps vlan_v2_caps;
struct virtchnl_supported_rxdids supported_rxdids;
struct iavf_ptp ptp;
u16 msg_enable;
struct iavf_eth_stats current_stats;
struct iavf_vsi vsi;
@ -387,7 +693,16 @@ struct iavf_adapter {
struct list_head cloud_filter_list;
/* lock to protect access to the cloud filter list */
spinlock_t cloud_filter_list_lock;
/* max allowed ADQ filters */
#define IAVF_MAX_CLOUD_ADQ_FILTERS 128
u16 num_cloud_filters;
/* snapshot of "num_active_queues" before setup_tc for qdisc add
* is invoked. This information is useful during qdisc del flow,
* to restore correct number of queues
*/
int orig_num_active_queues;
#ifdef IAVF_ADD_PROBES
u64 tcp_segs;
u64 udp_segs;
@ -396,11 +711,13 @@ struct iavf_adapter {
u64 tx_sctp_cso;
u64 tx_ip4_cso;
u64 tx_vlano;
u64 tx_ad_vlano;
u64 rx_tcp_cso;
u64 rx_udp_cso;
u64 rx_sctp_cso;
u64 rx_ip4_cso;
u64 rx_vlano;
u64 rx_ad_vlano;
u64 rx_tcp_cso_err;
u64 hw_csum_rx_vxlan;
u64 hw_csum_rx_geneve;
@ -413,17 +730,51 @@ struct iavf_adapter {
/* Ethtool Private Flags */
/* lan device, used by client interface */
struct iavf_device {
struct list_head list;
struct iavf_adapter *vf;
};
/* needed by iavf_ethtool.c */
extern char iavf_driver_name[];
extern const char iavf_driver_version[];
extern struct workqueue_struct *iavf_wq;
/**
* iavf_is_adq_enabled - adq enabled or not
* @adapter: pointer to adapter
*
* This function returns true based on negotiated capability of ADQ,
* num_tc and channel config state and channel config state is _RUNNING and ADQ
* has been successfully configured
**/
static inline bool iavf_is_adq_enabled(struct iavf_adapter *adapter)
{
return (ADQ_ALLOWED(adapter) &&
(adapter->num_tc >= IAVF_START_CHNL_TC) &&
(adapter->ch_config.state == __IAVF_TC_RUNNING));
}
/**
* iavf_is_adq_v2_enabled - adq v2 enabled or not
* @adapter: pointer to adapter
*
* This function returns true based on negotiated capability ADQ_V2
* if set and basic ADQ enabled
**/
static inline bool iavf_is_adq_v2_enabled(struct iavf_adapter *adapter)
{
return (iavf_is_adq_enabled(adapter) && ADQ_V2_ALLOWED(adapter));
}
/**
* iavf_chnl_filters_exist - channel filters exists
* @adapter: pointer to adapter
*
* This function returns true if adq_v2_enabled is true and if there
* are active filters otherwise false
**/
static inline bool iavf_chnl_filters_exist(struct iavf_adapter *adapter)
{
return (iavf_is_adq_v2_enabled(adapter) &&
adapter->num_cloud_filters) ? true : false;
}
static inline void iavf_change_state(struct iavf_adapter *adapter,
enum iavf_state_t state)
{
@ -445,10 +796,35 @@ static inline bool iavf_is_reset(struct iavf_hw *hw)
return !(rd32(hw, IAVF_VF_ARQLEN1) & IAVF_VF_ARQLEN1_ARQENABLE_MASK);
}
/**
* iavf_force_wb - Issue SW Interrupt so HW does a wb
* @vsi: the VSI we care about
* @q_vector: the vector on which to force writeback
*
**/
static inline void iavf_force_wb(struct iavf_vsi *vsi,
struct iavf_q_vector *q_vector)
{
u32 val = IAVF_VFINT_DYN_CTLN1_INTENA_MASK |
IAVF_VFINT_DYN_CTLN1_ITR_INDX_MASK | /* set noitr */
IAVF_VFINT_DYN_CTLN1_SWINT_TRIG_MASK |
IAVF_VFINT_DYN_CTLN1_SW_ITR_INDX_ENA_MASK
/* allow 00 to be written to the index */;
if (vector_ch_ena(q_vector))
q_vector->state_flags &= ~IAVF_VECTOR_STATE_ONCE_IN_BP;
wr32(&vsi->back->hw,
IAVF_VFINT_DYN_CTLN1(q_vector->reg_idx),
val);
}
int iavf_up(struct iavf_adapter *adapter);
void iavf_down(struct iavf_adapter *adapter);
int iavf_process_config(struct iavf_adapter *adapter);
int iavf_parse_vf_resource_msg(struct iavf_adapter *adapter);
void iavf_schedule_reset(struct iavf_adapter *adapter);
void iavf_schedule_request_stats(struct iavf_adapter *adapter);
void iavf_reset(struct iavf_adapter *adapter);
void iavf_set_ethtool_ops(struct net_device *netdev);
void iavf_update_stats(struct iavf_adapter *adapter);
@ -465,6 +841,13 @@ 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);
int iavf_get_vf_vlan_v2_caps(struct iavf_adapter *adapter);
int iavf_send_vf_offload_vlan_v2_msg(struct iavf_adapter *adapter);
int iavf_send_vf_supported_rxdids_msg(struct iavf_adapter *adapter);
int iavf_get_vf_supported_rxdids(struct iavf_adapter *adapter);
int iavf_send_vf_ptp_caps_msg(struct iavf_adapter *adapter);
int iavf_get_vf_ptp_caps(struct iavf_adapter *adapter);
void iavf_set_queue_vlan_tag_loc(struct iavf_adapter *adapter);
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);
@ -476,7 +859,8 @@ 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_set_promiscuous(struct iavf_adapter *adapter);
bool iavf_promiscuous_mode_changed(struct iavf_adapter *adapter);
void iavf_request_stats(struct iavf_adapter *adapter);
int iavf_request_reset(struct iavf_adapter *adapter);
void iavf_get_hena(struct iavf_adapter *adapter);
@ -493,13 +877,13 @@ 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);
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);
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);
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);
int iavf_replace_primary_mac(struct iavf_adapter *adapter,
const u8 *new_mac);
void iavf_setup_ch_info(struct iavf_adapter *adapter, u32 flags);
#ifdef CONFIG_DEBUG_FS
void iavf_dbg_vf_init(struct iavf_adapter *adapter);
void iavf_dbg_vf_exit(struct iavf_adapter *adapter);

View File

@ -85,8 +85,8 @@ struct iavf_adminq_info {
/**
* iavf_aq_rc_to_posix - convert errors to user-land codes
* aq_ret: AdminQ handler error code can override aq_rc
* aq_rc: AdminQ firmware error code to convert
* @aq_ret: AdminQ handler error code can override aq_rc
* @aq_rc: AdminQ firmware error code to convert
**/
static inline int iavf_aq_rc_to_posix(int aq_ret, int aq_rc)
{

View File

@ -1,585 +0,0 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2013, Intel Corporation. */
#include <linux/list.h>
#include <linux/errno.h>
#include "iavf.h"
#include "iavf_prototype.h"
#include "iavf_client.h"
static
const char iavf_client_interface_version_str[] = IAVF_CLIENT_VERSION_STR;
static struct iavf_client *vf_registered_client;
static LIST_HEAD(iavf_devices);
static DEFINE_MUTEX(iavf_device_mutex);
static u32 iavf_client_virtchnl_send(struct iavf_info *ldev,
struct iavf_client *client,
u8 *msg, u16 len);
static int iavf_client_setup_qvlist(struct iavf_info *ldev,
struct iavf_client *client,
struct iavf_qvlist_info *qvlist_info);
static struct iavf_ops iavf_lan_ops = {
.virtchnl_send = iavf_client_virtchnl_send,
.setup_qvlist = iavf_client_setup_qvlist,
};
/**
* iavf_client_get_params - retrieve relevant client parameters
* @vsi: VSI with parameters
* @params: client param struct
**/
static
void iavf_client_get_params(struct iavf_vsi *vsi, struct iavf_params *params)
{
int i;
memset(params, 0, sizeof(struct iavf_params));
params->mtu = vsi->netdev->mtu;
params->link_up = vsi->back->link_up;
for (i = 0; i < IAVF_MAX_USER_PRIORITY; i++) {
params->qos.prio_qos[i].tc = 0;
params->qos.prio_qos[i].qs_handle = vsi->qs_handle;
}
}
/**
* iavf_notify_client_message - call the client message receive callback
* @vsi: the VSI associated with this client
* @msg: message buffer
* @len: length of message
*
* If there is a client to this VSI, call the client
**/
void iavf_notify_client_message(struct iavf_vsi *vsi, u8 *msg, u16 len)
{
struct iavf_client_instance *cinst;
cinst = vsi->back->cinst;
if (!cinst || !cinst->client || !cinst->client->ops ||
!cinst->client->ops->virtchnl_receive) {
dev_dbg(&vsi->back->pdev->dev,
"Cannot locate client instance virtchnl_receive function\n");
return;
}
cinst->client->ops->virtchnl_receive(&cinst->lan_info, cinst->client,
msg, len);
}
/**
* iavf_notify_client_l2_params - call the client notify callback
* @vsi: the VSI with l2 param changes
*
* If there is a client to this VSI, call the client
**/
void iavf_notify_client_l2_params(struct iavf_vsi *vsi)
{
struct iavf_client_instance *cinst;
struct iavf_params params;
cinst = vsi->back->cinst;
if (!cinst || !cinst->client || !cinst->client->ops ||
!cinst->client->ops->l2_param_change) {
dev_dbg(&vsi->back->pdev->dev,
"Cannot locate client instance l2_param_change function\n");
return;
}
iavf_client_get_params(vsi, &params);
cinst->lan_info.params = params;
cinst->client->ops->l2_param_change(&cinst->lan_info, cinst->client,
&params);
}
/**
* iavf_notify_client_open - call the client open callback
* @vsi: the VSI with netdev opened
*
* If there is a client to this netdev, call the client with open
**/
void iavf_notify_client_open(struct iavf_vsi *vsi)
{
struct iavf_adapter *adapter = vsi->back;
struct iavf_client_instance *cinst = adapter->cinst;
int ret;
if (!cinst || !cinst->client || !cinst->client->ops ||
!cinst->client->ops->open) {
dev_dbg(&vsi->back->pdev->dev,
"Cannot locate client instance open function\n");
return;
}
if (!(test_bit(__IAVF_CLIENT_INSTANCE_OPENED, &cinst->state))) {
ret = cinst->client->ops->open(&cinst->lan_info, cinst->client);
if (!ret)
set_bit(__IAVF_CLIENT_INSTANCE_OPENED, &cinst->state);
}
}
/**
* iavf_client_release_qvlist - send a message to the PF to release iwarp qv map
* @ldev: pointer to L2 context.
*
* Return 0 on success or < 0 on error
**/
static int iavf_client_release_qvlist(struct iavf_info *ldev)
{
struct iavf_adapter *adapter = ldev->vf;
enum iavf_status err;
if (adapter->aq_required)
return -EAGAIN;
err = iavf_aq_send_msg_to_pf(&adapter->hw,
VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP,
IAVF_SUCCESS, NULL, 0, NULL);
if (err)
dev_err(&adapter->pdev->dev,
"Unable to send iWarp vector release message to PF, error %d, aq status %d\n",
err, adapter->hw.aq.asq_last_status);
return err;
}
/**
* iavf_notify_client_close - call the client close callback
* @vsi: the VSI with netdev closed
* @reset: true when close called due to reset pending
*
* If there is a client to this netdev, call the client with close
**/
void iavf_notify_client_close(struct iavf_vsi *vsi, bool reset)
{
struct iavf_adapter *adapter = vsi->back;
struct iavf_client_instance *cinst = adapter->cinst;
if (!cinst || !cinst->client || !cinst->client->ops ||
!cinst->client->ops->close) {
dev_dbg(&vsi->back->pdev->dev,
"Cannot locate client instance close function\n");
return;
}
cinst->client->ops->close(&cinst->lan_info, cinst->client, reset);
iavf_client_release_qvlist(&cinst->lan_info);
clear_bit(__IAVF_CLIENT_INSTANCE_OPENED, &cinst->state);
}
/**
* iavf_client_add_instance - add a client instance to the instance list
* @adapter: pointer to the board struct
*
* Returns cinst ptr on success, NULL on failure
**/
static struct iavf_client_instance *
iavf_client_add_instance(struct iavf_adapter *adapter)
{
struct iavf_client_instance *cinst = NULL;
struct iavf_vsi *vsi = &adapter->vsi;
struct netdev_hw_addr *mac = NULL;
struct iavf_params params;
if (!vf_registered_client)
goto out;
if (adapter->cinst) {
cinst = adapter->cinst;
goto out;
}
cinst = kzalloc(sizeof(*cinst), GFP_KERNEL);
if (!cinst)
goto out;
cinst->lan_info.vf = (void *)adapter;
cinst->lan_info.netdev = vsi->netdev;
cinst->lan_info.pcidev = adapter->pdev;
cinst->lan_info.fid = 0;
cinst->lan_info.ftype = IAVF_CLIENT_FTYPE_VF;
cinst->lan_info.hw_addr = adapter->hw.hw_addr;
cinst->lan_info.ops = &iavf_lan_ops;
cinst->lan_info.version.major = IAVF_CLIENT_VERSION_MAJOR;
cinst->lan_info.version.minor = IAVF_CLIENT_VERSION_MINOR;
cinst->lan_info.version.build = IAVF_CLIENT_VERSION_BUILD;
iavf_client_get_params(vsi, &params);
cinst->lan_info.params = params;
set_bit(__IAVF_CLIENT_INSTANCE_NONE, &cinst->state);
cinst->lan_info.msix_count = adapter->num_iwarp_msix;
cinst->lan_info.msix_entries =
&adapter->msix_entries[adapter->iwarp_base_vector];
mac = list_first_entry(&cinst->lan_info.netdev->dev_addrs.list,
struct netdev_hw_addr, list);
if (mac)
ether_addr_copy(cinst->lan_info.lanmac, mac->addr);
else
dev_err(&adapter->pdev->dev, "MAC address list is empty!\n");
cinst->client = vf_registered_client;
adapter->cinst = cinst;
out:
return cinst;
}
/**
* iavf_client_del_instance - removes a client instance from the list
* @adapter: pointer to the board struct
*
**/
static
void iavf_client_del_instance(struct iavf_adapter *adapter)
{
kfree(adapter->cinst);
adapter->cinst = NULL;
}
/**
* iavf_client_subtask - client maintenance work
* @adapter: board private structure
* Called under client lock
**/
void iavf_client_subtask(struct iavf_adapter *adapter)
{
struct iavf_client *client = vf_registered_client;
struct iavf_client_instance *cinst;
int ret = 0;
if (adapter->state < __IAVF_DOWN)
return;
/* first check client is registered */
if (!client)
return;
/* Add the client instance to the instance list */
cinst = adapter->cinst;
if (!cinst)
return;
dev_info(&adapter->pdev->dev, "Added instance of Client %s\n",
client->name);
if (!test_bit(__IAVF_CLIENT_INSTANCE_OPENED, &cinst->state)) {
/* Send an Open request to the client */
if (client->ops && client->ops->open)
ret = client->ops->open(&cinst->lan_info, client);
if (!ret)
set_bit(__IAVF_CLIENT_INSTANCE_OPENED,
&cinst->state);
else
/* remove client instance */
iavf_client_del_instance(adapter);
}
}
/**
* iavf_lan_add_device - add a lan device struct to the list of lan devices
* @adapter: pointer to the board struct
*
* Returns 0 on success or none 0 on error
**/
int iavf_lan_add_device(struct iavf_adapter *adapter)
{
struct iavf_device *ldev;
int ret = 0;
mutex_lock(&iavf_device_mutex);
list_for_each_entry(ldev, &iavf_devices, list) {
if (ldev->vf == adapter) {
ret = -EEXIST;
goto out;
}
}
ldev = kzalloc(sizeof(*ldev), GFP_KERNEL);
if (!ldev) {
ret = -ENOMEM;
goto out;
}
ldev->vf = adapter;
INIT_LIST_HEAD(&ldev->list);
list_add(&ldev->list, &iavf_devices);
dev_info(&adapter->pdev->dev, "Added LAN device bus=0x%02x dev=0x%02x func=0x%02x\n",
adapter->hw.bus.bus_id, adapter->hw.bus.device,
adapter->hw.bus.func);
/* Since in some cases register may have happened before a device gets
* added, we can schedule a subtask to go initiate the clients.
*/
adapter->flags |= IAVF_FLAG_SERVICE_CLIENT_REQUESTED;
out:
mutex_unlock(&iavf_device_mutex);
return ret;
}
/**
* iavf_lan_del_device - removes a lan device from the device list
* @adapter: pointer to the board struct
*
* Returns 0 on success or non-0 on error
**/
int iavf_lan_del_device(struct iavf_adapter *adapter)
{
struct iavf_device *ldev, *tmp;
int ret = -ENODEV;
mutex_lock(&iavf_device_mutex);
list_for_each_entry_safe(ldev, tmp, &iavf_devices, list) {
if (ldev->vf == adapter) {
dev_info(&adapter->pdev->dev,
"Deleted LAN device bus=0x%02x dev=0x%02x func=0x%02x\n",
adapter->hw.bus.bus_id, adapter->hw.bus.device,
adapter->hw.bus.func);
list_del(&ldev->list);
kfree(ldev);
ret = 0;
break;
}
}
mutex_unlock(&iavf_device_mutex);
return ret;
}
/**
* iavf_client_release - release client specific resources
* @client: pointer to the registered client
*
**/
static void iavf_client_release(struct iavf_client *client)
{
struct iavf_client_instance *cinst;
struct iavf_device *ldev;
struct iavf_adapter *adapter;
mutex_lock(&iavf_device_mutex);
list_for_each_entry(ldev, &iavf_devices, list) {
adapter = ldev->vf;
cinst = adapter->cinst;
if (!cinst)
continue;
adapter->flags &= ~(IAVF_FLAG_CLIENT_NEEDS_OPEN |
IAVF_FLAG_CLIENT_NEEDS_CLOSE |
IAVF_FLAG_CLIENT_NEEDS_L2_PARAMS |
IAVF_FLAG_SERVICE_CLIENT_REQUESTED);
cancel_delayed_work_sync(&adapter->client_task);
while (test_and_set_bit(__IAVF_IN_CLIENT_TASK,
&adapter->crit_section))
usleep_range(500, 1000);
if (test_bit(__IAVF_CLIENT_INSTANCE_OPENED, &cinst->state)) {
if (client->ops && client->ops->close)
client->ops->close(&cinst->lan_info, client,
false);
iavf_client_release_qvlist(&cinst->lan_info);
clear_bit(__IAVF_CLIENT_INSTANCE_OPENED, &cinst->state);
dev_warn(&adapter->pdev->dev,
"Client %s instance closed\n", client->name);
}
/* delete the client instance */
iavf_client_del_instance(adapter);
dev_info(&adapter->pdev->dev, "Deleted client instance of Client %s\n",
client->name);
clear_bit(__IAVF_IN_CLIENT_TASK, &adapter->crit_section);
}
mutex_unlock(&iavf_device_mutex);
}
/**
* iavf_client_prepare - prepare client specific resources
* @client: pointer to the registered client
*
**/
static void iavf_client_prepare(struct iavf_client *client)
{
struct iavf_device *ldev;
struct iavf_adapter *adapter;
mutex_lock(&iavf_device_mutex);
list_for_each_entry(ldev, &iavf_devices, list) {
adapter = ldev->vf;
iavf_client_add_instance(adapter);
/* Signal the watchdog to service the client */
adapter->flags |= IAVF_FLAG_SERVICE_CLIENT_REQUESTED;
}
mutex_unlock(&iavf_device_mutex);
}
/**
* iavf_client_virtchnl_send - send a message to the PF instance
* @ldev: pointer to L2 context.
* @client: Client pointer.
* @msg: pointer to message buffer
* @len: message length
*
* Return 0 on success or < 0 on error
**/
static u32 iavf_client_virtchnl_send(struct iavf_info *ldev,
struct iavf_client *client,
u8 *msg, u16 len)
{
struct iavf_adapter *adapter = ldev->vf;
enum iavf_status err;
if (adapter->aq_required)
return -EAGAIN;
err = iavf_aq_send_msg_to_pf(&adapter->hw, VIRTCHNL_OP_IWARP,
IAVF_SUCCESS, msg, len, NULL);
if (err)
dev_err(&adapter->pdev->dev, "Unable to send iWarp message to PF, error %d, aq status %d\n",
err, adapter->hw.aq.asq_last_status);
return err;
}
/**
* iavf_client_setup_qvlist - send a message to the PF to setup iwarp qv map
* @ldev: pointer to L2 context.
* @client: Client pointer.
* @qvlist_info: queue and vector list
*
* Return 0 on success or < 0 on error
**/
static int iavf_client_setup_qvlist(struct iavf_info *ldev,
struct iavf_client *client,
struct iavf_qvlist_info *qvlist_info)
{
struct virtchnl_iwarp_qvlist_info *v_qvlist_info;
struct iavf_adapter *adapter = ldev->vf;
struct iavf_qv_info *qv_info;
enum iavf_status err;
u32 v_idx, i;
u32 msg_size;
if (adapter->aq_required)
return -EAGAIN;
/* A quick check on whether the vectors belong to the client */
for (i = 0; i < qvlist_info->num_vectors; i++) {
qv_info = &qvlist_info->qv_info[i];
if (!qv_info)
continue;
v_idx = qv_info->v_idx;
if ((v_idx >=
(adapter->iwarp_base_vector + adapter->num_iwarp_msix)) ||
(v_idx < adapter->iwarp_base_vector))
return -EINVAL;
}
v_qvlist_info = (struct virtchnl_iwarp_qvlist_info *)qvlist_info;
msg_size = sizeof(struct virtchnl_iwarp_qvlist_info) +
(sizeof(struct virtchnl_iwarp_qv_info) *
(v_qvlist_info->num_vectors - 1));
adapter->client_pending |= BIT(VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP);
err = iavf_aq_send_msg_to_pf(&adapter->hw,
VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP, IAVF_SUCCESS,
(u8 *)v_qvlist_info, msg_size, NULL);
if (err) {
dev_err(&adapter->pdev->dev,
"Unable to send iWarp vector config message to PF, error %d, aq status %d\n",
err, adapter->hw.aq.asq_last_status);
goto out;
}
err = -EBUSY;
for (i = 0; i < 5; i++) {
msleep(100);
if (!(adapter->client_pending &
BIT(VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP))) {
err = 0;
break;
}
}
out:
return err;
}
/**
* iavf_register_client - Register a iavf client driver with the L2 driver
* @client: pointer to the iavf_client struct
*
* Returns 0 on success or non-0 on error
**/
int iavf_register_client(struct iavf_client *client)
{
int ret = 0;
if (!client) {
ret = -EIO;
goto out;
}
if (strlen(client->name) == 0) {
pr_info("iavf: Failed to register client with no name\n");
ret = -EIO;
goto out;
}
if (vf_registered_client) {
pr_info("iavf: Client %s has already been registered!\n",
client->name);
ret = -EEXIST;
goto out;
}
if ((client->version.major != IAVF_CLIENT_VERSION_MAJOR) ||
(client->version.minor != IAVF_CLIENT_VERSION_MINOR)) {
pr_info("iavf: Failed to register client %s due to mismatched client interface version\n",
client->name);
pr_info("Client is using version: %02d.%02d.%02d while LAN driver supports %s\n",
client->version.major, client->version.minor,
client->version.build,
iavf_client_interface_version_str);
ret = -EIO;
goto out;
}
vf_registered_client = client;
iavf_client_prepare(client);
pr_info("iavf: Registered client %s with return code %d\n",
client->name, ret);
out:
return ret;
}
EXPORT_SYMBOL(iavf_register_client);
/**
* iavf_unregister_client - Unregister a iavf client driver with the L2 driver
* @client: pointer to the iavf_client struct
*
* Returns 0 on success or non-0 on error
**/
int iavf_unregister_client(struct iavf_client *client)
{
int ret = 0;
if (vf_registered_client != client) {
pr_info("iavf: Client %s has not been registered\n",
client->name);
ret = -ENODEV;
goto out;
}
vf_registered_client = NULL;
/* When a unregister request comes through we would have to send
* a close for each of the client instances that were opened.
* client_release function is called to handle this.
*/
iavf_client_release(client);
pr_info("iavf: Unregistered client %s\n", client->name);
out:
return ret;
}
EXPORT_SYMBOL(iavf_unregister_client);

View File

@ -1,169 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2013, Intel Corporation. */
#ifndef _IAVF_CLIENT_H_
#define _IAVF_CLIENT_H_
#define IAVF_CLIENT_STR_LENGTH 10
/* Client interface version should be updated anytime there is a change in the
* existing APIs or data structures.
*/
#define IAVF_CLIENT_VERSION_MAJOR 0
#define IAVF_CLIENT_VERSION_MINOR 01
#define IAVF_CLIENT_VERSION_BUILD 00
#define IAVF_CLIENT_VERSION_STR \
__stringify(IAVF_CLIENT_VERSION_MAJOR) "." \
__stringify(IAVF_CLIENT_VERSION_MINOR) "." \
__stringify(IAVF_CLIENT_VERSION_BUILD)
struct iavf_client_version {
u8 major;
u8 minor;
u8 build;
u8 rsvd;
};
enum iavf_client_state {
__IAVF_CLIENT_NULL,
__IAVF_CLIENT_REGISTERED
};
enum iavf_client_instance_state {
__IAVF_CLIENT_INSTANCE_NONE,
__IAVF_CLIENT_INSTANCE_OPENED,
};
struct iavf_ops;
struct iavf_client;
/* HW does not define a type value for AEQ; only for RX/TX and CEQ.
* In order for us to keep the interface simple, SW will define a
* unique type value for AEQ.
*/
#define IAVF_QUEUE_TYPE_PE_AEQ 0x80
#define IAVF_QUEUE_INVALID_IDX 0xFFFF
struct iavf_qv_info {
u32 v_idx; /* msix_vector */
u16 ceq_idx;
u16 aeq_idx;
u8 itr_idx;
};
struct iavf_qvlist_info {
u32 num_vectors;
struct iavf_qv_info qv_info[1];
};
#define IAVF_CLIENT_MSIX_ALL 0xFFFFFFFF
/* set of LAN parameters useful for clients managed by LAN */
/* Struct to hold per priority info */
struct iavf_prio_qos_params {
u16 qs_handle; /* qs handle for prio */
u8 tc; /* TC mapped to prio */
u8 reserved;
};
#define IAVF_CLIENT_MAX_USER_PRIORITY 8
/* Struct to hold Client QoS */
struct iavf_qos_params {
struct iavf_prio_qos_params prio_qos[IAVF_CLIENT_MAX_USER_PRIORITY];
};
struct iavf_params {
struct iavf_qos_params qos;
u16 mtu;
u16 link_up; /* boolean */
};
/* Structure to hold LAN device info for a client device */
struct iavf_info {
struct iavf_client_version version;
u8 lanmac[6];
struct net_device *netdev;
struct pci_dev *pcidev;
u8 __iomem *hw_addr;
u8 fid; /* function id, PF id or VF id */
#define IAVF_CLIENT_FTYPE_PF 0
#define IAVF_CLIENT_FTYPE_VF 1
u8 ftype; /* function type, PF or VF */
void *vf; /* cast to iavf_adapter */
/* All L2 params that could change during the life span of the device
* and needs to be communicated to the client when they change
*/
struct iavf_params params;
struct iavf_ops *ops;
u16 msix_count; /* number of msix vectors*/
/* Array down below will be dynamically allocated based on msix_count */
struct msix_entry *msix_entries;
u16 itr_index; /* Which ITR index the PE driver is suppose to use */
};
struct iavf_ops {
/* setup_q_vector_list enables queues with a particular vector */
int (*setup_qvlist)(struct iavf_info *ldev, struct iavf_client *client,
struct iavf_qvlist_info *qv_info);
u32 (*virtchnl_send)(struct iavf_info *ldev, struct iavf_client *client,
u8 *msg, u16 len);
/* If the PE Engine is unresponsive, RDMA driver can request a reset.*/
void (*request_reset)(struct iavf_info *ldev,
struct iavf_client *client);
};
struct iavf_client_ops {
/* Should be called from register_client() or whenever the driver is
* ready to create a specific client instance.
*/
int (*open)(struct iavf_info *ldev, struct iavf_client *client);
/* Should be closed when netdev is unavailable or when unregister
* call comes in. If the close happens due to a reset, set the reset
* bit to true.
*/
void (*close)(struct iavf_info *ldev, struct iavf_client *client,
bool reset);
/* called when some l2 managed parameters changes - mss */
void (*l2_param_change)(struct iavf_info *ldev,
struct iavf_client *client,
struct iavf_params *params);
/* called when a message is received from the PF */
int (*virtchnl_receive)(struct iavf_info *ldev,
struct iavf_client *client,
u8 *msg, u16 len);
};
/* Client device */
struct iavf_client_instance {
struct list_head list;
struct iavf_info lan_info;
struct iavf_client *client;
unsigned long state;
};
struct iavf_client {
struct list_head list; /* list of registered clients */
char name[IAVF_CLIENT_STR_LENGTH];
struct iavf_client_version version;
unsigned long state; /* client state */
atomic_t ref_cnt; /* Count of all the client devices of this kind */
u32 flags;
#define IAVF_CLIENT_FLAGS_LAUNCH_ON_PROBE BIT(0)
#define IAVF_TX_FLAGS_NOTIFY_OTHER_EVENTS BIT(2)
u8 type;
#define IAVF_CLIENT_IWARP 0
struct iavf_client_ops *ops; /* client ops provided by the client */
};
/* used by clients */
int iavf_register_client(struct iavf_client *client);
int iavf_unregister_client(struct iavf_client *client);
#endif /* _IAVF_CLIENT_H_ */

View File

@ -505,9 +505,9 @@ enum iavf_status iavf_aq_set_rss_key(struct iavf_hw *hw,
return iavf_aq_get_set_rss_key(hw, vsi_id, key, true);
}
/* The iavf_ptype_lookup table is used to convert from the 8-bit ptype in the
* hardware to a bit-field that can be used by SW to more easily determine the
* packet type.
/* The iavf_ptype_lookup table is used to convert from the 8-bit and 10-bit
* ptype in the hardware to a bit-field that can be used by SW to more easily
* determine the packet type.
*
* Macros are used to shorten the table lines and make this table human
* readable.
@ -867,7 +867,852 @@ struct iavf_rx_ptype_decoded iavf_ptype_lookup[] = {
IAVF_PTT_UNUSED_ENTRY(252),
IAVF_PTT_UNUSED_ENTRY(253),
IAVF_PTT_UNUSED_ENTRY(254),
IAVF_PTT_UNUSED_ENTRY(255)
IAVF_PTT_UNUSED_ENTRY(255),
IAVF_PTT_UNUSED_ENTRY(256),
IAVF_PTT_UNUSED_ENTRY(257),
IAVF_PTT_UNUSED_ENTRY(258),
IAVF_PTT_UNUSED_ENTRY(259),
IAVF_PTT_UNUSED_ENTRY(260),
IAVF_PTT_UNUSED_ENTRY(261),
IAVF_PTT_UNUSED_ENTRY(262),
IAVF_PTT_UNUSED_ENTRY(263),
IAVF_PTT_UNUSED_ENTRY(264),
IAVF_PTT_UNUSED_ENTRY(265),
IAVF_PTT_UNUSED_ENTRY(266),
IAVF_PTT_UNUSED_ENTRY(267),
IAVF_PTT_UNUSED_ENTRY(268),
IAVF_PTT_UNUSED_ENTRY(269),
IAVF_PTT_UNUSED_ENTRY(270),
IAVF_PTT_UNUSED_ENTRY(271),
IAVF_PTT_UNUSED_ENTRY(272),
IAVF_PTT_UNUSED_ENTRY(273),
IAVF_PTT_UNUSED_ENTRY(274),
IAVF_PTT_UNUSED_ENTRY(275),
IAVF_PTT_UNUSED_ENTRY(276),
IAVF_PTT_UNUSED_ENTRY(277),
IAVF_PTT_UNUSED_ENTRY(278),
IAVF_PTT_UNUSED_ENTRY(279),
IAVF_PTT_UNUSED_ENTRY(280),
IAVF_PTT_UNUSED_ENTRY(281),
IAVF_PTT_UNUSED_ENTRY(282),
IAVF_PTT_UNUSED_ENTRY(283),
IAVF_PTT_UNUSED_ENTRY(284),
IAVF_PTT_UNUSED_ENTRY(285),
IAVF_PTT_UNUSED_ENTRY(286),
IAVF_PTT_UNUSED_ENTRY(287),
IAVF_PTT_UNUSED_ENTRY(288),
IAVF_PTT_UNUSED_ENTRY(289),
IAVF_PTT_UNUSED_ENTRY(290),
IAVF_PTT_UNUSED_ENTRY(291),
IAVF_PTT_UNUSED_ENTRY(292),
IAVF_PTT_UNUSED_ENTRY(293),
IAVF_PTT_UNUSED_ENTRY(294),
IAVF_PTT_UNUSED_ENTRY(295),
IAVF_PTT_UNUSED_ENTRY(296),
IAVF_PTT_UNUSED_ENTRY(297),
IAVF_PTT_UNUSED_ENTRY(298),
IAVF_PTT_UNUSED_ENTRY(299),
IAVF_PTT_UNUSED_ENTRY(300),
IAVF_PTT_UNUSED_ENTRY(301),
IAVF_PTT_UNUSED_ENTRY(302),
IAVF_PTT_UNUSED_ENTRY(303),
IAVF_PTT_UNUSED_ENTRY(304),
IAVF_PTT_UNUSED_ENTRY(305),
IAVF_PTT_UNUSED_ENTRY(306),
IAVF_PTT_UNUSED_ENTRY(307),
IAVF_PTT_UNUSED_ENTRY(308),
IAVF_PTT_UNUSED_ENTRY(309),
IAVF_PTT_UNUSED_ENTRY(310),
IAVF_PTT_UNUSED_ENTRY(311),
IAVF_PTT_UNUSED_ENTRY(312),
IAVF_PTT_UNUSED_ENTRY(313),
IAVF_PTT_UNUSED_ENTRY(314),
IAVF_PTT_UNUSED_ENTRY(315),
IAVF_PTT_UNUSED_ENTRY(316),
IAVF_PTT_UNUSED_ENTRY(317),
IAVF_PTT_UNUSED_ENTRY(318),
IAVF_PTT_UNUSED_ENTRY(319),
IAVF_PTT_UNUSED_ENTRY(320),
IAVF_PTT_UNUSED_ENTRY(321),
IAVF_PTT_UNUSED_ENTRY(322),
IAVF_PTT_UNUSED_ENTRY(323),
IAVF_PTT_UNUSED_ENTRY(324),
IAVF_PTT_UNUSED_ENTRY(325),
IAVF_PTT_UNUSED_ENTRY(326),
IAVF_PTT_UNUSED_ENTRY(327),
IAVF_PTT_UNUSED_ENTRY(328),
IAVF_PTT_UNUSED_ENTRY(329),
IAVF_PTT_UNUSED_ENTRY(330),
IAVF_PTT_UNUSED_ENTRY(331),
IAVF_PTT_UNUSED_ENTRY(332),
IAVF_PTT_UNUSED_ENTRY(333),
IAVF_PTT_UNUSED_ENTRY(334),
IAVF_PTT_UNUSED_ENTRY(335),
IAVF_PTT_UNUSED_ENTRY(336),
IAVF_PTT_UNUSED_ENTRY(337),
IAVF_PTT_UNUSED_ENTRY(338),
IAVF_PTT_UNUSED_ENTRY(339),
IAVF_PTT_UNUSED_ENTRY(340),
IAVF_PTT_UNUSED_ENTRY(341),
IAVF_PTT_UNUSED_ENTRY(342),
IAVF_PTT_UNUSED_ENTRY(343),
IAVF_PTT_UNUSED_ENTRY(344),
IAVF_PTT_UNUSED_ENTRY(345),
IAVF_PTT_UNUSED_ENTRY(346),
IAVF_PTT_UNUSED_ENTRY(347),
IAVF_PTT_UNUSED_ENTRY(348),
IAVF_PTT_UNUSED_ENTRY(349),
IAVF_PTT_UNUSED_ENTRY(350),
IAVF_PTT_UNUSED_ENTRY(351),
IAVF_PTT_UNUSED_ENTRY(352),
IAVF_PTT_UNUSED_ENTRY(353),
IAVF_PTT_UNUSED_ENTRY(354),
IAVF_PTT_UNUSED_ENTRY(355),
IAVF_PTT_UNUSED_ENTRY(356),
IAVF_PTT_UNUSED_ENTRY(357),
IAVF_PTT_UNUSED_ENTRY(358),
IAVF_PTT_UNUSED_ENTRY(359),
IAVF_PTT_UNUSED_ENTRY(360),
IAVF_PTT_UNUSED_ENTRY(361),
IAVF_PTT_UNUSED_ENTRY(362),
IAVF_PTT_UNUSED_ENTRY(363),
IAVF_PTT_UNUSED_ENTRY(364),
IAVF_PTT_UNUSED_ENTRY(365),
IAVF_PTT_UNUSED_ENTRY(366),
IAVF_PTT_UNUSED_ENTRY(367),
IAVF_PTT_UNUSED_ENTRY(368),
IAVF_PTT_UNUSED_ENTRY(369),
IAVF_PTT_UNUSED_ENTRY(370),
IAVF_PTT_UNUSED_ENTRY(371),
IAVF_PTT_UNUSED_ENTRY(372),
IAVF_PTT_UNUSED_ENTRY(373),
IAVF_PTT_UNUSED_ENTRY(374),
IAVF_PTT_UNUSED_ENTRY(375),
IAVF_PTT_UNUSED_ENTRY(376),
IAVF_PTT_UNUSED_ENTRY(377),
IAVF_PTT_UNUSED_ENTRY(378),
IAVF_PTT_UNUSED_ENTRY(379),
IAVF_PTT_UNUSED_ENTRY(380),
IAVF_PTT_UNUSED_ENTRY(381),
IAVF_PTT_UNUSED_ENTRY(382),
IAVF_PTT_UNUSED_ENTRY(383),
IAVF_PTT_UNUSED_ENTRY(384),
IAVF_PTT_UNUSED_ENTRY(385),
IAVF_PTT_UNUSED_ENTRY(386),
IAVF_PTT_UNUSED_ENTRY(387),
IAVF_PTT_UNUSED_ENTRY(388),
IAVF_PTT_UNUSED_ENTRY(389),
IAVF_PTT_UNUSED_ENTRY(390),
IAVF_PTT_UNUSED_ENTRY(391),
IAVF_PTT_UNUSED_ENTRY(392),
IAVF_PTT_UNUSED_ENTRY(393),
IAVF_PTT_UNUSED_ENTRY(394),
IAVF_PTT_UNUSED_ENTRY(395),
IAVF_PTT_UNUSED_ENTRY(396),
IAVF_PTT_UNUSED_ENTRY(397),
IAVF_PTT_UNUSED_ENTRY(398),
IAVF_PTT_UNUSED_ENTRY(399),
IAVF_PTT_UNUSED_ENTRY(400),
IAVF_PTT_UNUSED_ENTRY(401),
IAVF_PTT_UNUSED_ENTRY(402),
IAVF_PTT_UNUSED_ENTRY(403),
IAVF_PTT_UNUSED_ENTRY(404),
IAVF_PTT_UNUSED_ENTRY(405),
IAVF_PTT_UNUSED_ENTRY(406),
IAVF_PTT_UNUSED_ENTRY(407),
IAVF_PTT_UNUSED_ENTRY(408),
IAVF_PTT_UNUSED_ENTRY(409),
IAVF_PTT_UNUSED_ENTRY(410),
IAVF_PTT_UNUSED_ENTRY(411),
IAVF_PTT_UNUSED_ENTRY(412),
IAVF_PTT_UNUSED_ENTRY(413),
IAVF_PTT_UNUSED_ENTRY(414),
IAVF_PTT_UNUSED_ENTRY(415),
IAVF_PTT_UNUSED_ENTRY(416),
IAVF_PTT_UNUSED_ENTRY(417),
IAVF_PTT_UNUSED_ENTRY(418),
IAVF_PTT_UNUSED_ENTRY(419),
IAVF_PTT_UNUSED_ENTRY(420),
IAVF_PTT_UNUSED_ENTRY(421),
IAVF_PTT_UNUSED_ENTRY(422),
IAVF_PTT_UNUSED_ENTRY(423),
IAVF_PTT_UNUSED_ENTRY(424),
IAVF_PTT_UNUSED_ENTRY(425),
IAVF_PTT_UNUSED_ENTRY(426),
IAVF_PTT_UNUSED_ENTRY(427),
IAVF_PTT_UNUSED_ENTRY(428),
IAVF_PTT_UNUSED_ENTRY(429),
IAVF_PTT_UNUSED_ENTRY(430),
IAVF_PTT_UNUSED_ENTRY(431),
IAVF_PTT_UNUSED_ENTRY(432),
IAVF_PTT_UNUSED_ENTRY(433),
IAVF_PTT_UNUSED_ENTRY(434),
IAVF_PTT_UNUSED_ENTRY(435),
IAVF_PTT_UNUSED_ENTRY(436),
IAVF_PTT_UNUSED_ENTRY(437),
IAVF_PTT_UNUSED_ENTRY(438),
IAVF_PTT_UNUSED_ENTRY(439),
IAVF_PTT_UNUSED_ENTRY(440),
IAVF_PTT_UNUSED_ENTRY(441),
IAVF_PTT_UNUSED_ENTRY(442),
IAVF_PTT_UNUSED_ENTRY(443),
IAVF_PTT_UNUSED_ENTRY(444),
IAVF_PTT_UNUSED_ENTRY(445),
IAVF_PTT_UNUSED_ENTRY(446),
IAVF_PTT_UNUSED_ENTRY(447),
IAVF_PTT_UNUSED_ENTRY(448),
IAVF_PTT_UNUSED_ENTRY(449),
IAVF_PTT_UNUSED_ENTRY(450),
IAVF_PTT_UNUSED_ENTRY(451),
IAVF_PTT_UNUSED_ENTRY(452),
IAVF_PTT_UNUSED_ENTRY(453),
IAVF_PTT_UNUSED_ENTRY(454),
IAVF_PTT_UNUSED_ENTRY(455),
IAVF_PTT_UNUSED_ENTRY(456),
IAVF_PTT_UNUSED_ENTRY(457),
IAVF_PTT_UNUSED_ENTRY(458),
IAVF_PTT_UNUSED_ENTRY(459),
IAVF_PTT_UNUSED_ENTRY(460),
IAVF_PTT_UNUSED_ENTRY(461),
IAVF_PTT_UNUSED_ENTRY(462),
IAVF_PTT_UNUSED_ENTRY(463),
IAVF_PTT_UNUSED_ENTRY(464),
IAVF_PTT_UNUSED_ENTRY(465),
IAVF_PTT_UNUSED_ENTRY(466),
IAVF_PTT_UNUSED_ENTRY(467),
IAVF_PTT_UNUSED_ENTRY(468),
IAVF_PTT_UNUSED_ENTRY(469),
IAVF_PTT_UNUSED_ENTRY(470),
IAVF_PTT_UNUSED_ENTRY(471),
IAVF_PTT_UNUSED_ENTRY(472),
IAVF_PTT_UNUSED_ENTRY(473),
IAVF_PTT_UNUSED_ENTRY(474),
IAVF_PTT_UNUSED_ENTRY(475),
IAVF_PTT_UNUSED_ENTRY(476),
IAVF_PTT_UNUSED_ENTRY(477),
IAVF_PTT_UNUSED_ENTRY(478),
IAVF_PTT_UNUSED_ENTRY(479),
IAVF_PTT_UNUSED_ENTRY(480),
IAVF_PTT_UNUSED_ENTRY(481),
IAVF_PTT_UNUSED_ENTRY(482),
IAVF_PTT_UNUSED_ENTRY(483),
IAVF_PTT_UNUSED_ENTRY(484),
IAVF_PTT_UNUSED_ENTRY(485),
IAVF_PTT_UNUSED_ENTRY(486),
IAVF_PTT_UNUSED_ENTRY(487),
IAVF_PTT_UNUSED_ENTRY(488),
IAVF_PTT_UNUSED_ENTRY(489),
IAVF_PTT_UNUSED_ENTRY(490),
IAVF_PTT_UNUSED_ENTRY(491),
IAVF_PTT_UNUSED_ENTRY(492),
IAVF_PTT_UNUSED_ENTRY(493),
IAVF_PTT_UNUSED_ENTRY(494),
IAVF_PTT_UNUSED_ENTRY(495),
IAVF_PTT_UNUSED_ENTRY(496),
IAVF_PTT_UNUSED_ENTRY(497),
IAVF_PTT_UNUSED_ENTRY(498),
IAVF_PTT_UNUSED_ENTRY(499),
IAVF_PTT_UNUSED_ENTRY(500),
IAVF_PTT_UNUSED_ENTRY(501),
IAVF_PTT_UNUSED_ENTRY(502),
IAVF_PTT_UNUSED_ENTRY(503),
IAVF_PTT_UNUSED_ENTRY(504),
IAVF_PTT_UNUSED_ENTRY(505),
IAVF_PTT_UNUSED_ENTRY(506),
IAVF_PTT_UNUSED_ENTRY(507),
IAVF_PTT_UNUSED_ENTRY(508),
IAVF_PTT_UNUSED_ENTRY(509),
IAVF_PTT_UNUSED_ENTRY(510),
IAVF_PTT_UNUSED_ENTRY(511),
IAVF_PTT_UNUSED_ENTRY(512),
IAVF_PTT_UNUSED_ENTRY(513),
IAVF_PTT_UNUSED_ENTRY(514),
IAVF_PTT_UNUSED_ENTRY(515),
IAVF_PTT_UNUSED_ENTRY(516),
IAVF_PTT_UNUSED_ENTRY(517),
IAVF_PTT_UNUSED_ENTRY(518),
IAVF_PTT_UNUSED_ENTRY(519),
IAVF_PTT_UNUSED_ENTRY(520),
IAVF_PTT_UNUSED_ENTRY(521),
IAVF_PTT_UNUSED_ENTRY(522),
IAVF_PTT_UNUSED_ENTRY(523),
IAVF_PTT_UNUSED_ENTRY(524),
IAVF_PTT_UNUSED_ENTRY(525),
IAVF_PTT_UNUSED_ENTRY(526),
IAVF_PTT_UNUSED_ENTRY(527),
IAVF_PTT_UNUSED_ENTRY(528),
IAVF_PTT_UNUSED_ENTRY(529),
IAVF_PTT_UNUSED_ENTRY(530),
IAVF_PTT_UNUSED_ENTRY(531),
IAVF_PTT_UNUSED_ENTRY(532),
IAVF_PTT_UNUSED_ENTRY(533),
IAVF_PTT_UNUSED_ENTRY(534),
IAVF_PTT_UNUSED_ENTRY(535),
IAVF_PTT_UNUSED_ENTRY(536),
IAVF_PTT_UNUSED_ENTRY(537),
IAVF_PTT_UNUSED_ENTRY(538),
IAVF_PTT_UNUSED_ENTRY(539),
IAVF_PTT_UNUSED_ENTRY(540),
IAVF_PTT_UNUSED_ENTRY(541),
IAVF_PTT_UNUSED_ENTRY(542),
IAVF_PTT_UNUSED_ENTRY(543),
IAVF_PTT_UNUSED_ENTRY(544),
IAVF_PTT_UNUSED_ENTRY(545),
IAVF_PTT_UNUSED_ENTRY(546),
IAVF_PTT_UNUSED_ENTRY(547),
IAVF_PTT_UNUSED_ENTRY(548),
IAVF_PTT_UNUSED_ENTRY(549),
IAVF_PTT_UNUSED_ENTRY(550),
IAVF_PTT_UNUSED_ENTRY(551),
IAVF_PTT_UNUSED_ENTRY(552),
IAVF_PTT_UNUSED_ENTRY(553),
IAVF_PTT_UNUSED_ENTRY(554),
IAVF_PTT_UNUSED_ENTRY(555),
IAVF_PTT_UNUSED_ENTRY(556),
IAVF_PTT_UNUSED_ENTRY(557),
IAVF_PTT_UNUSED_ENTRY(558),
IAVF_PTT_UNUSED_ENTRY(559),
IAVF_PTT_UNUSED_ENTRY(560),
IAVF_PTT_UNUSED_ENTRY(561),
IAVF_PTT_UNUSED_ENTRY(562),
IAVF_PTT_UNUSED_ENTRY(563),
IAVF_PTT_UNUSED_ENTRY(564),
IAVF_PTT_UNUSED_ENTRY(565),
IAVF_PTT_UNUSED_ENTRY(566),
IAVF_PTT_UNUSED_ENTRY(567),
IAVF_PTT_UNUSED_ENTRY(568),
IAVF_PTT_UNUSED_ENTRY(569),
IAVF_PTT_UNUSED_ENTRY(570),
IAVF_PTT_UNUSED_ENTRY(571),
IAVF_PTT_UNUSED_ENTRY(572),
IAVF_PTT_UNUSED_ENTRY(573),
IAVF_PTT_UNUSED_ENTRY(574),
IAVF_PTT_UNUSED_ENTRY(575),
IAVF_PTT_UNUSED_ENTRY(576),
IAVF_PTT_UNUSED_ENTRY(577),
IAVF_PTT_UNUSED_ENTRY(578),
IAVF_PTT_UNUSED_ENTRY(579),
IAVF_PTT_UNUSED_ENTRY(580),
IAVF_PTT_UNUSED_ENTRY(581),
IAVF_PTT_UNUSED_ENTRY(582),
IAVF_PTT_UNUSED_ENTRY(583),
IAVF_PTT_UNUSED_ENTRY(584),
IAVF_PTT_UNUSED_ENTRY(585),
IAVF_PTT_UNUSED_ENTRY(586),
IAVF_PTT_UNUSED_ENTRY(587),
IAVF_PTT_UNUSED_ENTRY(588),
IAVF_PTT_UNUSED_ENTRY(589),
IAVF_PTT_UNUSED_ENTRY(590),
IAVF_PTT_UNUSED_ENTRY(591),
IAVF_PTT_UNUSED_ENTRY(592),
IAVF_PTT_UNUSED_ENTRY(593),
IAVF_PTT_UNUSED_ENTRY(594),
IAVF_PTT_UNUSED_ENTRY(595),
IAVF_PTT_UNUSED_ENTRY(596),
IAVF_PTT_UNUSED_ENTRY(597),
IAVF_PTT_UNUSED_ENTRY(598),
IAVF_PTT_UNUSED_ENTRY(599),
IAVF_PTT_UNUSED_ENTRY(600),
IAVF_PTT_UNUSED_ENTRY(601),
IAVF_PTT_UNUSED_ENTRY(602),
IAVF_PTT_UNUSED_ENTRY(603),
IAVF_PTT_UNUSED_ENTRY(604),
IAVF_PTT_UNUSED_ENTRY(605),
IAVF_PTT_UNUSED_ENTRY(606),
IAVF_PTT_UNUSED_ENTRY(607),
IAVF_PTT_UNUSED_ENTRY(608),
IAVF_PTT_UNUSED_ENTRY(609),
IAVF_PTT_UNUSED_ENTRY(610),
IAVF_PTT_UNUSED_ENTRY(611),
IAVF_PTT_UNUSED_ENTRY(612),
IAVF_PTT_UNUSED_ENTRY(613),
IAVF_PTT_UNUSED_ENTRY(614),
IAVF_PTT_UNUSED_ENTRY(615),
IAVF_PTT_UNUSED_ENTRY(616),
IAVF_PTT_UNUSED_ENTRY(617),
IAVF_PTT_UNUSED_ENTRY(618),
IAVF_PTT_UNUSED_ENTRY(619),
IAVF_PTT_UNUSED_ENTRY(620),
IAVF_PTT_UNUSED_ENTRY(621),
IAVF_PTT_UNUSED_ENTRY(622),
IAVF_PTT_UNUSED_ENTRY(623),
IAVF_PTT_UNUSED_ENTRY(624),
IAVF_PTT_UNUSED_ENTRY(625),
IAVF_PTT_UNUSED_ENTRY(626),
IAVF_PTT_UNUSED_ENTRY(627),
IAVF_PTT_UNUSED_ENTRY(628),
IAVF_PTT_UNUSED_ENTRY(629),
IAVF_PTT_UNUSED_ENTRY(630),
IAVF_PTT_UNUSED_ENTRY(631),
IAVF_PTT_UNUSED_ENTRY(632),
IAVF_PTT_UNUSED_ENTRY(633),
IAVF_PTT_UNUSED_ENTRY(634),
IAVF_PTT_UNUSED_ENTRY(635),
IAVF_PTT_UNUSED_ENTRY(636),
IAVF_PTT_UNUSED_ENTRY(637),
IAVF_PTT_UNUSED_ENTRY(638),
IAVF_PTT_UNUSED_ENTRY(639),
IAVF_PTT_UNUSED_ENTRY(640),
IAVF_PTT_UNUSED_ENTRY(641),
IAVF_PTT_UNUSED_ENTRY(642),
IAVF_PTT_UNUSED_ENTRY(643),
IAVF_PTT_UNUSED_ENTRY(644),
IAVF_PTT_UNUSED_ENTRY(645),
IAVF_PTT_UNUSED_ENTRY(646),
IAVF_PTT_UNUSED_ENTRY(647),
IAVF_PTT_UNUSED_ENTRY(648),
IAVF_PTT_UNUSED_ENTRY(649),
IAVF_PTT_UNUSED_ENTRY(650),
IAVF_PTT_UNUSED_ENTRY(651),
IAVF_PTT_UNUSED_ENTRY(652),
IAVF_PTT_UNUSED_ENTRY(653),
IAVF_PTT_UNUSED_ENTRY(654),
IAVF_PTT_UNUSED_ENTRY(655),
IAVF_PTT_UNUSED_ENTRY(656),
IAVF_PTT_UNUSED_ENTRY(657),
IAVF_PTT_UNUSED_ENTRY(658),
IAVF_PTT_UNUSED_ENTRY(659),
IAVF_PTT_UNUSED_ENTRY(660),
IAVF_PTT_UNUSED_ENTRY(661),
IAVF_PTT_UNUSED_ENTRY(662),
IAVF_PTT_UNUSED_ENTRY(663),
IAVF_PTT_UNUSED_ENTRY(664),
IAVF_PTT_UNUSED_ENTRY(665),
IAVF_PTT_UNUSED_ENTRY(666),
IAVF_PTT_UNUSED_ENTRY(667),
IAVF_PTT_UNUSED_ENTRY(668),
IAVF_PTT_UNUSED_ENTRY(669),
IAVF_PTT_UNUSED_ENTRY(670),
IAVF_PTT_UNUSED_ENTRY(671),
IAVF_PTT_UNUSED_ENTRY(672),
IAVF_PTT_UNUSED_ENTRY(673),
IAVF_PTT_UNUSED_ENTRY(674),
IAVF_PTT_UNUSED_ENTRY(675),
IAVF_PTT_UNUSED_ENTRY(676),
IAVF_PTT_UNUSED_ENTRY(677),
IAVF_PTT_UNUSED_ENTRY(678),
IAVF_PTT_UNUSED_ENTRY(679),
IAVF_PTT_UNUSED_ENTRY(680),
IAVF_PTT_UNUSED_ENTRY(681),
IAVF_PTT_UNUSED_ENTRY(682),
IAVF_PTT_UNUSED_ENTRY(683),
IAVF_PTT_UNUSED_ENTRY(684),
IAVF_PTT_UNUSED_ENTRY(685),
IAVF_PTT_UNUSED_ENTRY(686),
IAVF_PTT_UNUSED_ENTRY(687),
IAVF_PTT_UNUSED_ENTRY(688),
IAVF_PTT_UNUSED_ENTRY(689),
IAVF_PTT_UNUSED_ENTRY(690),
IAVF_PTT_UNUSED_ENTRY(691),
IAVF_PTT_UNUSED_ENTRY(692),
IAVF_PTT_UNUSED_ENTRY(693),
IAVF_PTT_UNUSED_ENTRY(694),
IAVF_PTT_UNUSED_ENTRY(695),
IAVF_PTT_UNUSED_ENTRY(696),
IAVF_PTT_UNUSED_ENTRY(697),
IAVF_PTT_UNUSED_ENTRY(698),
IAVF_PTT_UNUSED_ENTRY(699),
IAVF_PTT_UNUSED_ENTRY(700),
IAVF_PTT_UNUSED_ENTRY(701),
IAVF_PTT_UNUSED_ENTRY(702),
IAVF_PTT_UNUSED_ENTRY(703),
IAVF_PTT_UNUSED_ENTRY(704),
IAVF_PTT_UNUSED_ENTRY(705),
IAVF_PTT_UNUSED_ENTRY(706),
IAVF_PTT_UNUSED_ENTRY(707),
IAVF_PTT_UNUSED_ENTRY(708),
IAVF_PTT_UNUSED_ENTRY(709),
IAVF_PTT_UNUSED_ENTRY(710),
IAVF_PTT_UNUSED_ENTRY(711),
IAVF_PTT_UNUSED_ENTRY(712),
IAVF_PTT_UNUSED_ENTRY(713),
IAVF_PTT_UNUSED_ENTRY(714),
IAVF_PTT_UNUSED_ENTRY(715),
IAVF_PTT_UNUSED_ENTRY(716),
IAVF_PTT_UNUSED_ENTRY(717),
IAVF_PTT_UNUSED_ENTRY(718),
IAVF_PTT_UNUSED_ENTRY(719),
IAVF_PTT_UNUSED_ENTRY(720),
IAVF_PTT_UNUSED_ENTRY(721),
IAVF_PTT_UNUSED_ENTRY(722),
IAVF_PTT_UNUSED_ENTRY(723),
IAVF_PTT_UNUSED_ENTRY(724),
IAVF_PTT_UNUSED_ENTRY(725),
IAVF_PTT_UNUSED_ENTRY(726),
IAVF_PTT_UNUSED_ENTRY(727),
IAVF_PTT_UNUSED_ENTRY(728),
IAVF_PTT_UNUSED_ENTRY(729),
IAVF_PTT_UNUSED_ENTRY(730),
IAVF_PTT_UNUSED_ENTRY(731),
IAVF_PTT_UNUSED_ENTRY(732),
IAVF_PTT_UNUSED_ENTRY(733),
IAVF_PTT_UNUSED_ENTRY(734),
IAVF_PTT_UNUSED_ENTRY(735),
IAVF_PTT_UNUSED_ENTRY(736),
IAVF_PTT_UNUSED_ENTRY(737),
IAVF_PTT_UNUSED_ENTRY(738),
IAVF_PTT_UNUSED_ENTRY(739),
IAVF_PTT_UNUSED_ENTRY(740),
IAVF_PTT_UNUSED_ENTRY(741),
IAVF_PTT_UNUSED_ENTRY(742),
IAVF_PTT_UNUSED_ENTRY(743),
IAVF_PTT_UNUSED_ENTRY(744),
IAVF_PTT_UNUSED_ENTRY(745),
IAVF_PTT_UNUSED_ENTRY(746),
IAVF_PTT_UNUSED_ENTRY(747),
IAVF_PTT_UNUSED_ENTRY(748),
IAVF_PTT_UNUSED_ENTRY(749),
IAVF_PTT_UNUSED_ENTRY(750),
IAVF_PTT_UNUSED_ENTRY(751),
IAVF_PTT_UNUSED_ENTRY(752),
IAVF_PTT_UNUSED_ENTRY(753),
IAVF_PTT_UNUSED_ENTRY(754),
IAVF_PTT_UNUSED_ENTRY(755),
IAVF_PTT_UNUSED_ENTRY(756),
IAVF_PTT_UNUSED_ENTRY(757),
IAVF_PTT_UNUSED_ENTRY(758),
IAVF_PTT_UNUSED_ENTRY(759),
IAVF_PTT_UNUSED_ENTRY(760),
IAVF_PTT_UNUSED_ENTRY(761),
IAVF_PTT_UNUSED_ENTRY(762),
IAVF_PTT_UNUSED_ENTRY(763),
IAVF_PTT_UNUSED_ENTRY(764),
IAVF_PTT_UNUSED_ENTRY(765),
IAVF_PTT_UNUSED_ENTRY(766),
IAVF_PTT_UNUSED_ENTRY(767),
IAVF_PTT_UNUSED_ENTRY(768),
IAVF_PTT_UNUSED_ENTRY(769),
IAVF_PTT_UNUSED_ENTRY(770),
IAVF_PTT_UNUSED_ENTRY(771),
IAVF_PTT_UNUSED_ENTRY(772),
IAVF_PTT_UNUSED_ENTRY(773),
IAVF_PTT_UNUSED_ENTRY(774),
IAVF_PTT_UNUSED_ENTRY(775),
IAVF_PTT_UNUSED_ENTRY(776),
IAVF_PTT_UNUSED_ENTRY(777),
IAVF_PTT_UNUSED_ENTRY(778),
IAVF_PTT_UNUSED_ENTRY(779),
IAVF_PTT_UNUSED_ENTRY(780),
IAVF_PTT_UNUSED_ENTRY(781),
IAVF_PTT_UNUSED_ENTRY(782),
IAVF_PTT_UNUSED_ENTRY(783),
IAVF_PTT_UNUSED_ENTRY(784),
IAVF_PTT_UNUSED_ENTRY(785),
IAVF_PTT_UNUSED_ENTRY(786),
IAVF_PTT_UNUSED_ENTRY(787),
IAVF_PTT_UNUSED_ENTRY(788),
IAVF_PTT_UNUSED_ENTRY(789),
IAVF_PTT_UNUSED_ENTRY(790),
IAVF_PTT_UNUSED_ENTRY(791),
IAVF_PTT_UNUSED_ENTRY(792),
IAVF_PTT_UNUSED_ENTRY(793),
IAVF_PTT_UNUSED_ENTRY(794),
IAVF_PTT_UNUSED_ENTRY(795),
IAVF_PTT_UNUSED_ENTRY(796),
IAVF_PTT_UNUSED_ENTRY(797),
IAVF_PTT_UNUSED_ENTRY(798),
IAVF_PTT_UNUSED_ENTRY(799),
IAVF_PTT_UNUSED_ENTRY(800),
IAVF_PTT_UNUSED_ENTRY(801),
IAVF_PTT_UNUSED_ENTRY(802),
IAVF_PTT_UNUSED_ENTRY(803),
IAVF_PTT_UNUSED_ENTRY(804),
IAVF_PTT_UNUSED_ENTRY(805),
IAVF_PTT_UNUSED_ENTRY(806),
IAVF_PTT_UNUSED_ENTRY(807),
IAVF_PTT_UNUSED_ENTRY(808),
IAVF_PTT_UNUSED_ENTRY(809),
IAVF_PTT_UNUSED_ENTRY(810),
IAVF_PTT_UNUSED_ENTRY(811),
IAVF_PTT_UNUSED_ENTRY(812),
IAVF_PTT_UNUSED_ENTRY(813),
IAVF_PTT_UNUSED_ENTRY(814),
IAVF_PTT_UNUSED_ENTRY(815),
IAVF_PTT_UNUSED_ENTRY(816),
IAVF_PTT_UNUSED_ENTRY(817),
IAVF_PTT_UNUSED_ENTRY(818),
IAVF_PTT_UNUSED_ENTRY(819),
IAVF_PTT_UNUSED_ENTRY(820),
IAVF_PTT_UNUSED_ENTRY(821),
IAVF_PTT_UNUSED_ENTRY(822),
IAVF_PTT_UNUSED_ENTRY(823),
IAVF_PTT_UNUSED_ENTRY(824),
IAVF_PTT_UNUSED_ENTRY(825),
IAVF_PTT_UNUSED_ENTRY(826),
IAVF_PTT_UNUSED_ENTRY(827),
IAVF_PTT_UNUSED_ENTRY(828),
IAVF_PTT_UNUSED_ENTRY(829),
IAVF_PTT_UNUSED_ENTRY(830),
IAVF_PTT_UNUSED_ENTRY(831),
IAVF_PTT_UNUSED_ENTRY(832),
IAVF_PTT_UNUSED_ENTRY(833),
IAVF_PTT_UNUSED_ENTRY(834),
IAVF_PTT_UNUSED_ENTRY(835),
IAVF_PTT_UNUSED_ENTRY(836),
IAVF_PTT_UNUSED_ENTRY(837),
IAVF_PTT_UNUSED_ENTRY(838),
IAVF_PTT_UNUSED_ENTRY(839),
IAVF_PTT_UNUSED_ENTRY(840),
IAVF_PTT_UNUSED_ENTRY(841),
IAVF_PTT_UNUSED_ENTRY(842),
IAVF_PTT_UNUSED_ENTRY(843),
IAVF_PTT_UNUSED_ENTRY(844),
IAVF_PTT_UNUSED_ENTRY(845),
IAVF_PTT_UNUSED_ENTRY(846),
IAVF_PTT_UNUSED_ENTRY(847),
IAVF_PTT_UNUSED_ENTRY(848),
IAVF_PTT_UNUSED_ENTRY(849),
IAVF_PTT_UNUSED_ENTRY(850),
IAVF_PTT_UNUSED_ENTRY(851),
IAVF_PTT_UNUSED_ENTRY(852),
IAVF_PTT_UNUSED_ENTRY(853),
IAVF_PTT_UNUSED_ENTRY(854),
IAVF_PTT_UNUSED_ENTRY(855),
IAVF_PTT_UNUSED_ENTRY(856),
IAVF_PTT_UNUSED_ENTRY(857),
IAVF_PTT_UNUSED_ENTRY(858),
IAVF_PTT_UNUSED_ENTRY(859),
IAVF_PTT_UNUSED_ENTRY(860),
IAVF_PTT_UNUSED_ENTRY(861),
IAVF_PTT_UNUSED_ENTRY(862),
IAVF_PTT_UNUSED_ENTRY(863),
IAVF_PTT_UNUSED_ENTRY(864),
IAVF_PTT_UNUSED_ENTRY(865),
IAVF_PTT_UNUSED_ENTRY(866),
IAVF_PTT_UNUSED_ENTRY(867),
IAVF_PTT_UNUSED_ENTRY(868),
IAVF_PTT_UNUSED_ENTRY(869),
IAVF_PTT_UNUSED_ENTRY(870),
IAVF_PTT_UNUSED_ENTRY(871),
IAVF_PTT_UNUSED_ENTRY(872),
IAVF_PTT_UNUSED_ENTRY(873),
IAVF_PTT_UNUSED_ENTRY(874),
IAVF_PTT_UNUSED_ENTRY(875),
IAVF_PTT_UNUSED_ENTRY(876),
IAVF_PTT_UNUSED_ENTRY(877),
IAVF_PTT_UNUSED_ENTRY(878),
IAVF_PTT_UNUSED_ENTRY(879),
IAVF_PTT_UNUSED_ENTRY(880),
IAVF_PTT_UNUSED_ENTRY(881),
IAVF_PTT_UNUSED_ENTRY(882),
IAVF_PTT_UNUSED_ENTRY(883),
IAVF_PTT_UNUSED_ENTRY(884),
IAVF_PTT_UNUSED_ENTRY(885),
IAVF_PTT_UNUSED_ENTRY(886),
IAVF_PTT_UNUSED_ENTRY(887),
IAVF_PTT_UNUSED_ENTRY(888),
IAVF_PTT_UNUSED_ENTRY(889),
IAVF_PTT_UNUSED_ENTRY(890),
IAVF_PTT_UNUSED_ENTRY(891),
IAVF_PTT_UNUSED_ENTRY(892),
IAVF_PTT_UNUSED_ENTRY(893),
IAVF_PTT_UNUSED_ENTRY(894),
IAVF_PTT_UNUSED_ENTRY(895),
IAVF_PTT_UNUSED_ENTRY(896),
IAVF_PTT_UNUSED_ENTRY(897),
IAVF_PTT_UNUSED_ENTRY(898),
IAVF_PTT_UNUSED_ENTRY(899),
IAVF_PTT_UNUSED_ENTRY(900),
IAVF_PTT_UNUSED_ENTRY(901),
IAVF_PTT_UNUSED_ENTRY(902),
IAVF_PTT_UNUSED_ENTRY(903),
IAVF_PTT_UNUSED_ENTRY(904),
IAVF_PTT_UNUSED_ENTRY(905),
IAVF_PTT_UNUSED_ENTRY(906),
IAVF_PTT_UNUSED_ENTRY(907),
IAVF_PTT_UNUSED_ENTRY(908),
IAVF_PTT_UNUSED_ENTRY(909),
IAVF_PTT_UNUSED_ENTRY(910),
IAVF_PTT_UNUSED_ENTRY(911),
IAVF_PTT_UNUSED_ENTRY(912),
IAVF_PTT_UNUSED_ENTRY(913),
IAVF_PTT_UNUSED_ENTRY(914),
IAVF_PTT_UNUSED_ENTRY(915),
IAVF_PTT_UNUSED_ENTRY(916),
IAVF_PTT_UNUSED_ENTRY(917),
IAVF_PTT_UNUSED_ENTRY(918),
IAVF_PTT_UNUSED_ENTRY(919),
IAVF_PTT_UNUSED_ENTRY(920),
IAVF_PTT_UNUSED_ENTRY(921),
IAVF_PTT_UNUSED_ENTRY(922),
IAVF_PTT_UNUSED_ENTRY(923),
IAVF_PTT_UNUSED_ENTRY(924),
IAVF_PTT_UNUSED_ENTRY(925),
IAVF_PTT_UNUSED_ENTRY(926),
IAVF_PTT_UNUSED_ENTRY(927),
IAVF_PTT_UNUSED_ENTRY(928),
IAVF_PTT_UNUSED_ENTRY(929),
IAVF_PTT_UNUSED_ENTRY(930),
IAVF_PTT_UNUSED_ENTRY(931),
IAVF_PTT_UNUSED_ENTRY(932),
IAVF_PTT_UNUSED_ENTRY(933),
IAVF_PTT_UNUSED_ENTRY(934),
IAVF_PTT_UNUSED_ENTRY(935),
IAVF_PTT_UNUSED_ENTRY(936),
IAVF_PTT_UNUSED_ENTRY(937),
IAVF_PTT_UNUSED_ENTRY(938),
IAVF_PTT_UNUSED_ENTRY(939),
IAVF_PTT_UNUSED_ENTRY(940),
IAVF_PTT_UNUSED_ENTRY(941),
IAVF_PTT_UNUSED_ENTRY(942),
IAVF_PTT_UNUSED_ENTRY(943),
IAVF_PTT_UNUSED_ENTRY(944),
IAVF_PTT_UNUSED_ENTRY(945),
IAVF_PTT_UNUSED_ENTRY(946),
IAVF_PTT_UNUSED_ENTRY(947),
IAVF_PTT_UNUSED_ENTRY(948),
IAVF_PTT_UNUSED_ENTRY(949),
IAVF_PTT_UNUSED_ENTRY(950),
IAVF_PTT_UNUSED_ENTRY(951),
IAVF_PTT_UNUSED_ENTRY(952),
IAVF_PTT_UNUSED_ENTRY(953),
IAVF_PTT_UNUSED_ENTRY(954),
IAVF_PTT_UNUSED_ENTRY(955),
IAVF_PTT_UNUSED_ENTRY(956),
IAVF_PTT_UNUSED_ENTRY(957),
IAVF_PTT_UNUSED_ENTRY(958),
IAVF_PTT_UNUSED_ENTRY(959),
IAVF_PTT_UNUSED_ENTRY(960),
IAVF_PTT_UNUSED_ENTRY(961),
IAVF_PTT_UNUSED_ENTRY(962),
IAVF_PTT_UNUSED_ENTRY(963),
IAVF_PTT_UNUSED_ENTRY(964),
IAVF_PTT_UNUSED_ENTRY(965),
IAVF_PTT_UNUSED_ENTRY(966),
IAVF_PTT_UNUSED_ENTRY(967),
IAVF_PTT_UNUSED_ENTRY(968),
IAVF_PTT_UNUSED_ENTRY(969),
IAVF_PTT_UNUSED_ENTRY(970),
IAVF_PTT_UNUSED_ENTRY(971),
IAVF_PTT_UNUSED_ENTRY(972),
IAVF_PTT_UNUSED_ENTRY(973),
IAVF_PTT_UNUSED_ENTRY(974),
IAVF_PTT_UNUSED_ENTRY(975),
IAVF_PTT_UNUSED_ENTRY(976),
IAVF_PTT_UNUSED_ENTRY(977),
IAVF_PTT_UNUSED_ENTRY(978),
IAVF_PTT_UNUSED_ENTRY(979),
IAVF_PTT_UNUSED_ENTRY(980),
IAVF_PTT_UNUSED_ENTRY(981),
IAVF_PTT_UNUSED_ENTRY(982),
IAVF_PTT_UNUSED_ENTRY(983),
IAVF_PTT_UNUSED_ENTRY(984),
IAVF_PTT_UNUSED_ENTRY(985),
IAVF_PTT_UNUSED_ENTRY(986),
IAVF_PTT_UNUSED_ENTRY(987),
IAVF_PTT_UNUSED_ENTRY(988),
IAVF_PTT_UNUSED_ENTRY(989),
IAVF_PTT_UNUSED_ENTRY(990),
IAVF_PTT_UNUSED_ENTRY(991),
IAVF_PTT_UNUSED_ENTRY(992),
IAVF_PTT_UNUSED_ENTRY(993),
IAVF_PTT_UNUSED_ENTRY(994),
IAVF_PTT_UNUSED_ENTRY(995),
IAVF_PTT_UNUSED_ENTRY(996),
IAVF_PTT_UNUSED_ENTRY(997),
IAVF_PTT_UNUSED_ENTRY(998),
IAVF_PTT_UNUSED_ENTRY(999),
IAVF_PTT_UNUSED_ENTRY(1000),
IAVF_PTT_UNUSED_ENTRY(1001),
IAVF_PTT_UNUSED_ENTRY(1002),
IAVF_PTT_UNUSED_ENTRY(1003),
IAVF_PTT_UNUSED_ENTRY(1004),
IAVF_PTT_UNUSED_ENTRY(1005),
IAVF_PTT_UNUSED_ENTRY(1006),
IAVF_PTT_UNUSED_ENTRY(1007),
IAVF_PTT_UNUSED_ENTRY(1008),
IAVF_PTT_UNUSED_ENTRY(1009),
IAVF_PTT_UNUSED_ENTRY(1010),
IAVF_PTT_UNUSED_ENTRY(1011),
IAVF_PTT_UNUSED_ENTRY(1012),
IAVF_PTT_UNUSED_ENTRY(1013),
IAVF_PTT_UNUSED_ENTRY(1014),
IAVF_PTT_UNUSED_ENTRY(1015),
IAVF_PTT_UNUSED_ENTRY(1016),
IAVF_PTT_UNUSED_ENTRY(1017),
IAVF_PTT_UNUSED_ENTRY(1018),
IAVF_PTT_UNUSED_ENTRY(1019),
IAVF_PTT_UNUSED_ENTRY(1020),
IAVF_PTT_UNUSED_ENTRY(1021),
IAVF_PTT_UNUSED_ENTRY(1022),
IAVF_PTT_UNUSED_ENTRY(1023),
};
/**
@ -885,7 +1730,7 @@ struct iavf_rx_ptype_decoded iavf_ptype_lookup[] = {
**/
enum iavf_status iavf_aq_send_msg_to_pf(struct iavf_hw *hw,
enum virtchnl_ops v_opcode,
enum iavf_status v_retval,
enum virtchnl_status_code v_retval,
u8 *msg, u16 msglen,
struct iavf_asq_cmd_details *cmd_details)
{
@ -936,6 +1781,7 @@ void iavf_vf_parse_hw_config(struct iavf_hw *hw,
hw->dev_caps.num_msix_vectors_vf = msg->max_vectors;
hw->dev_caps.dcb = msg->vf_cap_flags &
VIRTCHNL_VF_OFFLOAD_L2;
hw->dev_caps.max_mtu = msg->max_mtu;
for (i = 0; i < msg->num_vsis; i++) {
if (vsi_res->vsi_type == VIRTCHNL_VSI_SRIOV) {
ether_addr_copy(hw->mac.perm_addr,
@ -958,7 +1804,7 @@ void iavf_vf_parse_hw_config(struct iavf_hw *hw,
enum iavf_status iavf_vf_reset(struct iavf_hw *hw)
{
return iavf_aq_send_msg_to_pf(hw, VIRTCHNL_OP_RESET_VF,
IAVF_SUCCESS, NULL, 0, NULL);
VIRTCHNL_STATUS_SUCCESS, NULL, 0, NULL);
}
/**

View File

@ -33,6 +33,8 @@ static const struct iavf_stats iavf_gstrings_stats[] = {
VF_STAT("tx_broadcast", current_stats.tx_broadcast),
VF_STAT("tx_discards", current_stats.tx_discards),
VF_STAT("tx_errors", current_stats.tx_errors),
VF_STAT("tx_hwtstamp_skipped", ptp.tx_hwtstamp_skipped),
VF_STAT("tx_hwtstamp_timeouts", ptp.tx_hwtstamp_timeouts),
#ifdef IAVF_ADD_PROBES
VF_STAT("tx_tcp_segments", tcp_segs),
VF_STAT("tx_udp_segments", udp_segs),
@ -41,11 +43,13 @@ static const struct iavf_stats iavf_gstrings_stats[] = {
VF_STAT("tx_sctp_cso", tx_sctp_cso),
VF_STAT("tx_ip4_cso", tx_ip4_cso),
VF_STAT("tx_vlano", tx_vlano),
VF_STAT("tx_ad_vlano", tx_ad_vlano),
VF_STAT("rx_tcp_cso", rx_tcp_cso),
VF_STAT("rx_udp_cso", rx_udp_cso),
VF_STAT("rx_sctp_cso", rx_sctp_cso),
VF_STAT("rx_ip4_cso", rx_ip4_cso),
VF_STAT("rx_vlano", rx_vlano),
VF_STAT("rx_ad_vlano", rx_ad_vlano),
VF_STAT("rx_tcp_cso_error", rx_tcp_cso_err),
VF_STAT("rx_udp_cso_error", rx_udp_cso_err),
VF_STAT("rx_sctp_cso_error", rx_sctp_cso_err),
@ -55,7 +59,11 @@ static const struct iavf_stats iavf_gstrings_stats[] = {
#define IAVF_STATS_LEN ARRAY_SIZE(iavf_gstrings_stats)
#define IAVF_QUEUE_STATS_LEN ARRAY_SIZE(iavf_gstrings_queue_stats)
#define IAVF_QUEUE_STATS_LEN (ARRAY_SIZE(iavf_gstrings_queue_stats) + \
ARRAY_SIZE(iavf_gstrings_queue_stats_poll))
#define IAVF_TX_QUEUE_STATS_LEN ARRAY_SIZE(iavf_gstrings_queue_stats_tx)
#define IAVF_RX_QUEUE_STATS_LEN ARRAY_SIZE(iavf_gstrings_queue_stats_rx)
#define IAVF_VECTOR_STATS_LEN ARRAY_SIZE(iavf_gstrings_queue_stats_vector)
#ifdef HAVE_SWIOTLB_SKIP_CPU_SYNC
/* For now we have one and only one private flag and it is only defined
@ -80,6 +88,13 @@ static const struct iavf_priv_flags iavf_gstrings_priv_flags[] = {
};
#define IAVF_PRIV_FLAGS_STR_LEN ARRAY_SIZE(iavf_gstrings_priv_flags)
static const struct iavf_priv_flags iavf_gstrings_chnl_priv_flags[] = {
IAVF_PRIV_FLAG("channel-pkt-inspect-optimize",
IAVF_FLAG_CHNL_PKT_OPT_ENA, 0),
};
#define IAVF_CHNL_PRIV_FLAGS_STR_LEN ARRAY_SIZE(iavf_gstrings_chnl_priv_flags)
#endif /* HAVE_SWIOTLB_SKIP_CPU_SYNC */
/**
@ -100,15 +115,17 @@ static int iavf_get_link_ksettings(struct net_device *netdev,
cmd->base.autoneg = AUTONEG_DISABLE;
cmd->base.port = PORT_NONE;
/* Set speed and duplex */
cmd->base.duplex = DUPLEX_FULL;
#ifdef VIRTCHNL_VF_CAP_ADV_LINK_SPEED
if (ADV_LINK_SUPPORT(adapter)) {
if (SUPPORTED_SPEED(adapter->link_speed_mbps))
if (adapter->link_speed_mbps &&
adapter->link_speed_mbps < U32_MAX)
cmd->base.speed = adapter->link_speed_mbps;
else
cmd->base.speed = SPEED_UNKNOWN;
goto set_duplex;
return 0;
}
#endif /* VIRTCHNL_VF_CAP_ADV_LINK_SPEED */
@ -130,6 +147,12 @@ static int iavf_get_link_ksettings(struct net_device *netdev,
case VIRTCHNL_LINK_SPEED_10GB:
cmd->base.speed = SPEED_10000;
break;
case VIRTCHNL_LINK_SPEED_5GB:
cmd->base.speed = SPEED_5000;
break;
case VIRTCHNL_LINK_SPEED_2_5GB:
cmd->base.speed = SPEED_2500;
break;
case VIRTCHNL_LINK_SPEED_1GB:
cmd->base.speed = SPEED_1000;
break;
@ -141,11 +164,6 @@ static int iavf_get_link_ksettings(struct net_device *netdev,
break;
}
#ifdef VIRTCHNL_VF_CAP_ADV_LINK_SPEED
set_duplex:
#endif /* VIRTCHNL_VF_CAP_ADV_LINK_SPEED */
cmd->base.duplex = DUPLEX_FULL;
return 0;
}
@ -180,12 +198,20 @@ static int iavf_get_settings(struct net_device *netdev,
**/
static int iavf_get_sset_count(struct net_device *netdev, int sset)
{
/* Report the maximum number queues, even if not every queue is
* currently configured. Since allocation of queues is in pairs,
* use netdev->real_num_tx_queues * 2. The real_num_tx_queues is set
* at device creation and never changes.
*/
if (sset == ETH_SS_STATS)
return IAVF_STATS_LEN +
(IAVF_QUEUE_STATS_LEN * 2 * IAVF_MAX_REQ_QUEUES);
(IAVF_QUEUE_STATS_LEN * 2 *
netdev->real_num_tx_queues) +
((IAVF_TX_QUEUE_STATS_LEN + IAVF_RX_QUEUE_STATS_LEN +
IAVF_VECTOR_STATS_LEN) * netdev->real_num_tx_queues);
#ifdef HAVE_SWIOTLB_SKIP_CPU_SYNC
else if (sset == ETH_SS_PRIV_FLAGS)
return IAVF_PRIV_FLAGS_STR_LEN;
return IAVF_PRIV_FLAGS_STR_LEN + IAVF_PRIV_FLAGS_STR_LEN;
#endif
else
return -EINVAL;
@ -205,21 +231,30 @@ static void iavf_get_ethtool_stats(struct net_device *netdev,
struct iavf_adapter *adapter = netdev_priv(netdev);
unsigned int i;
/* Explicitly request stats refresh */
iavf_schedule_request_stats(adapter);
iavf_add_ethtool_stats(&data, adapter, iavf_gstrings_stats);
rcu_read_lock();
for (i = 0; i < IAVF_MAX_REQ_QUEUES; i++) {
/* As num_active_queues describe both tx and rx queues, we can use
* it to iterate over rings' stats.
*/
for (i = 0; i < adapter->num_active_queues; i++) {
struct iavf_ring *ring;
/* Avoid accessing un-allocated queues */
ring = (i < adapter->num_active_queues ?
&adapter->tx_rings[i] : NULL);
/* Tx rings stats */
ring = &adapter->tx_rings[i];
iavf_add_queue_stats(&data, ring);
iavf_add_queue_stats_chnl(&data, ring, IAVF_CHNL_STAT_POLL);
iavf_add_queue_stats_chnl(&data, ring, IAVF_CHNL_STAT_TX);
/* Avoid accessing un-allocated queues */
ring = (i < adapter->num_active_queues ?
&adapter->rx_rings[i] : NULL);
/* Rx rings stats */
ring = &adapter->rx_rings[i];
iavf_add_queue_stats(&data, ring);
iavf_add_queue_stats_chnl(&data, ring, IAVF_CHNL_STAT_POLL);
iavf_add_queue_stats_chnl(&data, ring, IAVF_CHNL_STAT_RX);
iavf_add_queue_stats_chnl(&data, ring, IAVF_CHNL_STAT_VECTOR);
}
rcu_read_unlock();
}
@ -241,6 +276,12 @@ static void iavf_get_priv_flag_strings(struct net_device *netdev, u8 *data)
iavf_gstrings_priv_flags[i].flag_string);
data += ETH_GSTRING_LEN;
}
for (i = 0; i < IAVF_CHNL_PRIV_FLAGS_STR_LEN; i++) {
snprintf(data, ETH_GSTRING_LEN, "%s",
iavf_gstrings_chnl_priv_flags[i].flag_string);
data += ETH_GSTRING_LEN;
}
}
#endif
@ -257,14 +298,24 @@ static void iavf_get_stat_strings(struct net_device *netdev, u8 *data)
iavf_add_stat_strings(&data, iavf_gstrings_stats);
/* Queues are always allocated in pairs, so we just use num_tx_queues
* for both Tx and Rx queues.
/* Queues are always allocated in pairs, so we just use
* real_num_tx_queues for both Tx and Rx queues.
*/
for (i = 0; i < netdev->num_tx_queues; i++) {
for (i = 0; i < netdev->real_num_tx_queues; i++) {
iavf_add_stat_strings(&data, iavf_gstrings_queue_stats,
"tx", i);
iavf_add_stat_strings(&data, iavf_gstrings_queue_stats_poll,
"tx", i);
iavf_add_stat_strings(&data, iavf_gstrings_queue_stats_tx,
"tx", i);
iavf_add_stat_strings(&data, iavf_gstrings_queue_stats,
"rx", i);
iavf_add_stat_strings(&data, iavf_gstrings_queue_stats_poll,
"rx", i);
iavf_add_stat_strings(&data, iavf_gstrings_queue_stats_rx,
"rx", i);
iavf_add_stat_strings(&data, iavf_gstrings_queue_stats_vector,
"rx", i);
}
}
@ -306,40 +357,50 @@ static void iavf_get_strings(struct net_device *netdev, u32 sset, u8 *data)
static u32 iavf_get_priv_flags(struct net_device *netdev)
{
struct iavf_adapter *adapter = netdev_priv(netdev);
const struct iavf_priv_flags *priv_flags;
u32 i, ret_flags = 0;
for (i = 0; i < IAVF_PRIV_FLAGS_STR_LEN; i++) {
const struct iavf_priv_flags *priv_flags;
priv_flags = &iavf_gstrings_priv_flags[i];
if (priv_flags->flag & adapter->flags)
ret_flags |= BIT(i);
}
for (i = 0; i < IAVF_CHNL_PRIV_FLAGS_STR_LEN; i++) {
priv_flags = &iavf_gstrings_chnl_priv_flags[i];
if (priv_flags->flag & adapter->chnl_perf_flags)
ret_flags |= BIT(i + IAVF_PRIV_FLAGS_STR_LEN);
}
return ret_flags;
}
/**
* iavf_set_priv_flags - set private flags
* @netdev: network interface device structure
* iavf_determine_priv_flag_change - detect any change in private flags
* @priv_flags: Ptr to private flags array
* @num: count of private flags
* @bit_offset: "offset" into unified view of bits
* @flags: bit flags to be set
* @orig: Ptr to flags
* @changed_flags: bits changed (based on orig and new value)
*
* Detect any changes in priv flags and return those changed bits
**/
static int iavf_set_priv_flags(struct net_device *netdev, u32 flags)
static int
iavf_determine_priv_flag_change(const struct iavf_priv_flags *priv_flags,
int num, int bit_offset, u32 flags, u32 *orig,
u32 *changed_flags)
{
struct iavf_adapter *adapter = netdev_priv(netdev);
u32 orig_flags, new_flags, changed_flags;
u32 i;
u32 orig_flags = READ_ONCE(*orig);
u32 new_flags;
int i;
orig_flags = READ_ONCE(adapter->flags);
new_flags = orig_flags;
for (i = 0; i < IAVF_PRIV_FLAGS_STR_LEN; i++) {
const struct iavf_priv_flags *priv_flags;
priv_flags = &iavf_gstrings_priv_flags[i];
if (flags & BIT(i))
for (i = 0; i < num; i++) {
if (flags & BIT(i + bit_offset))
new_flags |= priv_flags->flag;
else
new_flags &= ~(priv_flags->flag);
@ -347,6 +408,7 @@ static int iavf_set_priv_flags(struct net_device *netdev, u32 flags)
if (priv_flags->read_only &&
((orig_flags ^ new_flags) & ~BIT(i)))
return -EOPNOTSUPP;
priv_flags++;
}
/* Before we finalize any flag changes, any checks which we need to
@ -360,13 +422,47 @@ static int iavf_set_priv_flags(struct net_device *netdev, u32 flags)
* copied it. We'll just punt with an error and log something in the
* message buffer.
*/
if (cmpxchg(&adapter->flags, orig_flags, new_flags) != orig_flags) {
dev_warn(&adapter->pdev->dev,
"Unable to update adapter->flags as it was modified by another thread...\n");
if (cmpxchg(orig, orig_flags, new_flags) != orig_flags)
return -EAGAIN;
*changed_flags = orig_flags ^ new_flags;
return 0;
}
/**
* iavf_set_priv_flags - set private flags
* @netdev: network interface device structure
* @flags: bit flags to be set
**/
static int iavf_set_priv_flags(struct net_device *netdev, u32 flags)
{
struct iavf_adapter *adapter = netdev_priv(netdev);
u32 changed_chnl_flags;
u32 changed_flags;
int ret;
ret = iavf_determine_priv_flag_change(&iavf_gstrings_priv_flags[0],
IAVF_PRIV_FLAGS_STR_LEN, 0,
flags, &adapter->flags,
&changed_flags);
if (ret) {
if (ret == -EAGAIN)
dev_warn(&adapter->pdev->dev,
"Unable to update adapter->flags as it was modified by another thread...\n");
return ret;
}
changed_flags = orig_flags ^ new_flags;
ret = iavf_determine_priv_flag_change(&iavf_gstrings_chnl_priv_flags[0],
IAVF_CHNL_PRIV_FLAGS_STR_LEN,
IAVF_PRIV_FLAGS_STR_LEN,
flags, &adapter->chnl_perf_flags,
&changed_chnl_flags);
if (ret) {
if (ret == -EAGAIN)
dev_warn(&adapter->pdev->dev,
"Unable to update adapter->chnl_perf_flags as it was modified by another thread...\n");
return ret;
}
/* Process any additional changes needed as a result of flag changes.
* The changed_flags value reflects the list of bits that were changed
@ -378,6 +474,10 @@ static int iavf_set_priv_flags(struct net_device *netdev, u32 flags)
if (netif_running(netdev))
iavf_schedule_reset(adapter);
}
/* Process any additional changes needed as a result of change
* in channel specific flag(s)
*/
iavf_setup_ch_info(adapter, changed_chnl_flags);
return 0;
}
@ -568,23 +668,44 @@ static int iavf_set_ringparam(struct net_device *netdev,
if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
return -EINVAL;
new_tx_count = clamp_t(u32, ring->tx_pending,
IAVF_MIN_TXD,
IAVF_MAX_TXD);
new_tx_count = ALIGN(new_tx_count, IAVF_REQ_DESCRIPTOR_MULTIPLE);
if (ring->tx_pending > IAVF_MAX_TXD ||
ring->tx_pending < IAVF_MIN_TXD ||
ring->rx_pending > IAVF_MAX_RXD ||
ring->rx_pending < IAVF_MIN_RXD) {
netdev_err(netdev, "Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d] (increment %d)\n",
ring->tx_pending, ring->rx_pending, IAVF_MIN_TXD,
IAVF_MAX_RXD, IAVF_REQ_DESCRIPTOR_MULTIPLE);
return -EINVAL;
}
new_rx_count = clamp_t(u32, ring->rx_pending,
IAVF_MIN_RXD,
IAVF_MAX_RXD);
new_rx_count = ALIGN(new_rx_count, IAVF_REQ_DESCRIPTOR_MULTIPLE);
new_tx_count = ALIGN(ring->tx_pending, IAVF_REQ_DESCRIPTOR_MULTIPLE);
if (new_tx_count != ring->tx_pending)
netdev_info(netdev, "Requested Tx descriptor count rounded up to %d\n",
new_tx_count);
new_rx_count = ALIGN(ring->rx_pending, IAVF_REQ_DESCRIPTOR_MULTIPLE);
if (new_rx_count != ring->rx_pending)
netdev_info(netdev, "Requested Rx descriptor count rounded up to %d\n",
new_rx_count);
/* if nothing to do return success */
if ((new_tx_count == adapter->tx_desc_count) &&
(new_rx_count == adapter->rx_desc_count))
(new_rx_count == adapter->rx_desc_count)) {
netdev_dbg(netdev, "Nothing to change, descriptor count is same as requested\n");
return 0;
}
adapter->tx_desc_count = new_tx_count;
adapter->rx_desc_count = new_rx_count;
if (new_tx_count != adapter->tx_desc_count) {
netdev_info(netdev, "Changing Tx descriptor count from %d to %d\n",
adapter->tx_desc_count, new_tx_count);
adapter->tx_desc_count = new_tx_count;
}
if (new_rx_count != adapter->rx_desc_count) {
netdev_info(netdev, "Changing Rx descriptor count from %d to %d\n",
adapter->rx_desc_count, new_rx_count);
adapter->rx_desc_count = new_rx_count;
}
if (netif_running(netdev))
iavf_schedule_reset(adapter);
@ -882,12 +1003,12 @@ static int iavf_set_channels(struct net_device *netdev,
{
struct iavf_adapter *adapter = netdev_priv(netdev);
u32 num_req = ch->combined_count;
int i;
#ifdef __TC_MQPRIO_MODE_MAX
if ((adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADQ) &&
adapter->num_tc) {
if (iavf_is_adq_enabled(adapter)) {
dev_info(&adapter->pdev->dev, "Cannot set channels since ADQ is enabled.\n");
return -EINVAL;
return -EOPNOTSUPP;
}
#endif /* __TC_MQPRIO_MODE_MAX */
@ -906,6 +1027,20 @@ static int iavf_set_channels(struct net_device *netdev,
adapter->num_req_queues = num_req;
adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED;
iavf_schedule_reset(adapter);
/* wait for the reset is done */
for (i = 0; i < IAVF_RESET_WAIT_COMPLETE_COUNT; i++) {
msleep(IAVF_RESET_WAIT_MS);
if (adapter->flags & IAVF_FLAG_RESET_PENDING)
continue;
break;
}
if (i == IAVF_RESET_WAIT_COMPLETE_COUNT) {
adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED;
adapter->num_active_queues = num_req;
return -EOPNOTSUPP;
}
return 0;
}
@ -999,6 +1134,14 @@ static int iavf_set_rxfh(struct net_device *netdev, const u32 *indir,
struct iavf_adapter *adapter = netdev_priv(netdev);
u16 i;
#ifdef __TC_MQPRIO_MODE_MAX
if (iavf_is_adq_enabled(adapter)) {
dev_info(&adapter->pdev->dev,
"Change in RSS params is not supported when ADQ is configured.\n");
return -EOPNOTSUPP;
}
#endif /* __TC_MQPRIO_MODE_MAX */
#ifdef HAVE_RXFH_HASHFUNC
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP;
@ -1025,7 +1168,58 @@ static int iavf_set_rxfh(struct net_device *netdev, const u32 *indir,
}
#endif /* ETHTOOL_GRSSH && ETHTOOL_SRSSH */
#ifdef HAVE_ETHTOOL_GET_TS_INFO
#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
/**
* iavf_get_ts_info - Report available timestamping capabilities
* @netdev: the netdevice to report for
* @info: structure to fill in
*
* Based on device features enabled, report the Tx and Rx timestamp
* capabilities, as well as the PTP hardware clock index to user space.
*/
static int iavf_get_ts_info(struct net_device *netdev, struct ethtool_ts_info *info)
{
struct iavf_adapter *adapter = netdev_priv(netdev);
info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
SOF_TIMESTAMPING_RX_SOFTWARE |
SOF_TIMESTAMPING_SOFTWARE;
if (iavf_ptp_cap_supported(adapter, VIRTCHNL_1588_PTP_CAP_TX_TSTAMP)) {
info->so_timestamping |= SOF_TIMESTAMPING_TX_HARDWARE |
SOF_TIMESTAMPING_RAW_HARDWARE;
info->tx_types = BIT(HWTSTAMP_TX_OFF) | BIT(HWTSTAMP_TX_ON);
}
/* Rx timestamps are only supported on the flexible descriptors. Do
* not report support unless we both have the capability and
* configured with the appropriate descriptor format
*/
if (iavf_ptp_cap_supported(adapter, VIRTCHNL_1588_PTP_CAP_RX_TSTAMP) &&
adapter->rxdid == VIRTCHNL_RXDID_2_FLEX_SQ_NIC) {
info->so_timestamping |= SOF_TIMESTAMPING_RX_HARDWARE |
SOF_TIMESTAMPING_RAW_HARDWARE;
info->rx_filters = BIT(HWTSTAMP_FILTER_NONE) | BIT(HWTSTAMP_FILTER_ALL);
}
if (adapter->ptp.initialized)
info->phc_index = ptp_clock_index(adapter->ptp.clock);
else
info->phc_index = -1;
return 0;
}
#endif /* CONFIG_PTP_1588_CLOCK */
#endif /* HAVE_ETHTOOL_GET_TS_INFO */
static const struct ethtool_ops iavf_ethtool_ops = {
#ifdef ETHTOOL_COALESCE_USECS
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
ETHTOOL_COALESCE_MAX_FRAMES |
ETHTOOL_COALESCE_MAX_FRAMES_IRQ |
ETHTOOL_COALESCE_USE_ADAPTIVE,
#endif /* ETHTOOL_COALESCE_USECS */
.get_drvinfo = iavf_get_drvinfo,
.get_link = ethtool_op_get_link,
.get_ringparam = iavf_get_ringparam,
@ -1075,6 +1269,11 @@ static const struct ethtool_ops iavf_ethtool_ops = {
#else
.get_settings = iavf_get_settings,
#endif /* ETHTOOL_GLINKSETTINGS */
#ifdef HAVE_ETHTOOL_GET_TS_INFO
#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
.get_ts_info = iavf_get_ts_info,
#endif
#endif
};
#ifdef HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT

View File

@ -52,6 +52,80 @@ static const struct iavf_stats iavf_gstrings_queue_stats[] = {
IAVF_QUEUE_STAT("%s-%u.bytes", stats.bytes),
};
#define IAVF_VECTOR_STAT(_name, _stat) \
IAVF_STAT(struct iavf_q_vector, _name, _stat)
/* Stats associated with a Tx or Rx ring */
static struct iavf_stats iavf_gstrings_queue_stats_poll[] = {
IAVF_QUEUE_STAT("%s-%u.pkt_busy_poll", ch_q_stats.poll.pkt_busy_poll),
IAVF_QUEUE_STAT("%s-%u.pkt_not_busy_poll",
ch_q_stats.poll.pkt_not_busy_poll),
};
static struct iavf_stats iavf_gstrings_queue_stats_tx[] = {
};
static struct iavf_stats iavf_gstrings_queue_stats_rx[] = {
IAVF_QUEUE_STAT("%s-%u.tcp_ctrl_pkts", ch_q_stats.rx.tcp_ctrl_pkts),
IAVF_QUEUE_STAT("%s-%u.only_ctrl_pkts", ch_q_stats.rx.only_ctrl_pkts),
IAVF_QUEUE_STAT("%s-%u.tcp_fin_recv", ch_q_stats.rx.tcp_fin_recv),
IAVF_QUEUE_STAT("%s-%u.tcp_rst_recv", ch_q_stats.rx.tcp_rst_recv),
IAVF_QUEUE_STAT("%s-%u.tcp_syn_recv", ch_q_stats.rx.tcp_syn_recv),
IAVF_QUEUE_STAT("%s-%u.bp_no_data_pkt", ch_q_stats.rx.bp_no_data_pkt),
};
static struct iavf_stats iavf_gstrings_queue_stats_vector[] = {
/* tracking BP, INT, BP->INT, INT->BP */
IAVF_VECTOR_STAT("%s-%u.in_bp", ch_stats.in_bp),
IAVF_VECTOR_STAT("%s-%u.intr_to_bp", ch_stats.intr_to_bp),
IAVF_VECTOR_STAT("%s-%u.bp_to_bp", ch_stats.bp_to_bp),
IAVF_VECTOR_STAT("%s-%u.in_intr", ch_stats.in_intr),
IAVF_VECTOR_STAT("%s-%u.bp_to_intr", ch_stats.bp_to_intr),
IAVF_VECTOR_STAT("%s-%u.intr_to_intr", ch_stats.intr_to_intr),
/* unlikely comeback to busy_poll */
IAVF_VECTOR_STAT("%s-%u.unlikely_cb_to_bp", ch_stats.unlikely_cb_to_bp),
/* unlikely comeback to busy_poll and once_in_bp is true */
IAVF_VECTOR_STAT("%s-%u.ucb_once_in_bp_true",
ch_stats.ucb_once_in_bp_true),
/* once_in_bp is false */
IAVF_VECTOR_STAT("%s-%u.intr_once_in_bp_false",
ch_stats.intr_once_bp_false),
/* busy_poll stop due to need_resched() */
IAVF_VECTOR_STAT("%s-%u.bp_stop_need_resched",
ch_stats.bp_stop_need_resched),
/* busy_poll stop due to possible due to timeout */
IAVF_VECTOR_STAT("%s-%u.bp_stop_timeout", ch_stats.bp_stop_timeout),
/* Transition: BP->INT: previously cleaned data packets */
IAVF_VECTOR_STAT("%s-%u.cleaned_any_data_pkt",
ch_stats.cleaned_any_data_pkt),
/* need_resched(), but didn't clean any data packets */
IAVF_VECTOR_STAT("%s-%u.need_resched_no_data_pkt",
ch_stats.need_resched_no_data_pkt),
/* possible timeout(), but didn't clean any data packets */
IAVF_VECTOR_STAT("%s-%u.timeout_no_data_pkt",
ch_stats.timeout_no_data_pkt),
/* number of SW triggered interrupt from napi_poll due to
* possible timeout detected
*/
IAVF_VECTOR_STAT("%s-%u.sw_intr_timeout", ch_stats.sw_intr_timeout),
/* number of SW triggered interrupt from service_task */
IAVF_VECTOR_STAT("%s-%u.sw_intr_service_task",
ch_stats.sw_intr_serv_task),
/* number of times, SW triggered interrupt is not triggered from
* napi_poll even when unlikely_cb_to_bp is set, once_in_bp is set
* but ethtool private featute flag is off (for interrupt optimization
* strategy
*/
IAVF_VECTOR_STAT("%s-%u.no_sw_intr_opt_off",
ch_stats.no_sw_intr_opt_off),
/* number of times WB_ON_ITR is set */
IAVF_VECTOR_STAT("%s-%u.wb_on_itr_set", ch_stats.wb_on_itr_set),
/* enable SW triggered interrupt due to not_clean_complete */
IAVF_VECTOR_STAT("%s-%u.sw_intr_not_cc",
ch_stats.intr_en_not_clean_complete),
};
/**
* iavf_add_one_ethtool_stat - copy the stat into the supplied buffer
@ -138,6 +212,90 @@ __iavf_add_ethtool_stats(u64 **data, void *pointer,
#define iavf_add_ethtool_stats(data, pointer, stats) \
__iavf_add_ethtool_stats(data, pointer, stats, ARRAY_SIZE(stats))
enum iavf_chnl_stat_type {
IAVF_CHNL_STAT_INVALID,
IAVF_CHNL_STAT_POLL,
IAVF_CHNL_STAT_TX,
IAVF_CHNL_STAT_RX,
IAVF_CHNL_STAT_VECTOR,
IAVF_CHNL_STAT_LAST, /* This must be last */_
};
/**
* iavf_add_queue_stats_chnl - copy channel specific queue stats
* @data: ethtool stats buffer
* @ring: the ring to copy
* @stat_type: stat_type could be TX/TX/VECTOR
*
* Queue statistics must be copied while protected by
* u64_stats_fetch_begin_irq, so we can't directly use iavf_add_ethtool_stats.
* Assumes that queue stats are defined in iavf_gstrings_queue_stats. If the
* ring pointer is null, zero out the queue stat values and update the data
* pointer. Otherwise safely copy the stats from the ring into the supplied
* buffer and update the data pointer when finished.
*
* This function expects to be called while under rcu_read_lock().
**/
static void
iavf_add_queue_stats_chnl(u64 **data, struct iavf_ring *ring,
enum iavf_chnl_stat_type stat_type)
{
struct iavf_stats *stats = NULL;
#ifdef HAVE_NDO_GET_STATS64
unsigned int start;
#endif
unsigned int size;
unsigned int i;
switch (stat_type) {
case IAVF_CHNL_STAT_POLL:
size = ARRAY_SIZE(iavf_gstrings_queue_stats_poll);
stats = iavf_gstrings_queue_stats_poll;
break;
case IAVF_CHNL_STAT_TX:
size = ARRAY_SIZE(iavf_gstrings_queue_stats_tx);
stats = iavf_gstrings_queue_stats_tx;
break;
case IAVF_CHNL_STAT_RX:
size = ARRAY_SIZE(iavf_gstrings_queue_stats_rx);
stats = iavf_gstrings_queue_stats_rx;
break;
case IAVF_CHNL_STAT_VECTOR:
size = ARRAY_SIZE(iavf_gstrings_queue_stats_vector);
stats = iavf_gstrings_queue_stats_vector;
break;
default:
break; /* unsupported stat type */
}
if (!stats)
return;
/* To avoid invalid statistics values, ensure that we keep retrying
* the copy until we get a consistent value according to
* u64_stats_fetch_retry_irq. But first, make sure our ring is
* non-null before attempting to access its syncp.
*/
#ifdef HAVE_NDO_GET_STATS64
do {
start = !ring ? 0 : u64_stats_fetch_begin_irq(&ring->syncp);
#endif
for (i = 0; i < size; i++) {
void *ptr = ring;
if (stat_type == IAVF_CHNL_STAT_VECTOR)
ptr = ring ? ring->q_vector : NULL;
iavf_add_one_ethtool_stat(&(*data)[i], ptr,
&stats[i]);
}
#ifdef HAVE_NDO_GET_STATS64
} while (ring && u64_stats_fetch_retry_irq(&ring->syncp, start));
#endif
/* Once we successfully copy the stats in, update the data pointer */
*data += size;
}
/**
* iavf_add_queue_stats - copy queue statistics into supplied buffer
* @data: ethtool stats buffer

View File

@ -10,6 +10,7 @@
* iavf_allocate_dma_mem_d - OS specific memory alloc for shared code
* @hw: pointer to the HW structure
* @mem: ptr to mem struct to fill out
* @mtype: unused parameter for documenting memory type of dma
* @size: size of memory requested
* @alignment: what to align the allocation to
**/

File diff suppressed because it is too large Load Diff

View File

@ -54,7 +54,7 @@ enum iavf_status iavf_set_mac_type(struct iavf_hw *hw);
extern struct iavf_rx_ptype_decoded iavf_ptype_lookup[];
static inline struct iavf_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
static inline struct iavf_rx_ptype_decoded decode_rx_desc_ptype(u16 ptype)
{
return iavf_ptype_lookup[ptype];
}
@ -70,7 +70,7 @@ void iavf_vf_parse_hw_config(struct iavf_hw *hw,
enum iavf_status iavf_vf_reset(struct iavf_hw *hw);
enum iavf_status iavf_aq_send_msg_to_pf(struct iavf_hw *hw,
enum virtchnl_ops v_opcode,
enum iavf_status v_retval,
enum virtchnl_status_code v_retval,
u8 *msg, u16 msglen,
struct iavf_asq_cmd_details *cmd_details);
enum iavf_status iavf_aq_debug_dump(struct iavf_hw *hw, u8 cluster_id,

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,80 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2013, Intel Corporation. */
#ifndef _IAVF_PTP_H_
#define _IAVF_PTP_H_
#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
#include <linux/clocksource.h>
#include <linux/net_tstamp.h>
#include <linux/ptp_clock_kernel.h>
#endif /* CONFIG_PTP_1588_CLOCK */
struct iavf_adapter;
/* bit indicating whether a 40bit timestamp is valid */
#define IAVF_PTP_40B_TSTAMP_VALID BIT(0)
/* structure used to queue PTP commands for processing */
struct iavf_ptp_aq_cmd {
struct list_head list;
enum virtchnl_ops v_opcode;
u16 msglen;
u8 msg[];
};
/* fields used for PTP support */
struct iavf_ptp {
wait_queue_head_t phc_time_waitqueue;
struct virtchnl_ptp_caps hw_caps;
struct list_head aq_cmds;
/* Lock protecting access to the AQ command list */
spinlock_t aq_cmd_lock;
struct hwtstamp_config hwtstamp_config;
u64 cached_phc_time;
unsigned long cached_phc_updated;
u64 tx_hwtstamp_skipped;
u64 tx_hwtstamp_timeouts;
struct sk_buff *tx_skb; /* protected by __IAVF_TX_TSTAMP_IN_PROGRESS */
unsigned long tx_start; /* protected by __IAVF_TX_TSTAMP_IN_PROGRESS */
u8 __iomem *phc_addr; /* PHC register mapping */
bool initialized;
bool phc_time_ready;
#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
struct ptp_clock_info info;
struct ptp_clock *clock;
#endif
};
void iavf_virtchnl_send_ptp_cmd(struct iavf_adapter *adapter);
#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
void iavf_ptp_init(struct iavf_adapter *adapter);
void iavf_ptp_release(struct iavf_adapter *adapter);
void iavf_ptp_process_caps(struct iavf_adapter *adapter);
long iavf_ptp_do_aux_work(struct ptp_clock_info *ptp);
bool iavf_ptp_cap_supported(struct iavf_adapter *adapter, u32 cap);
u64 iavf_ptp_extend_32b_timestamp(u64 cached_phc_time, u32 in_tstamp);
u64 iavf_ptp_extend_40b_timestamp(u64 cached_phc_time, u64 in_tstamp);
int iavf_ptp_get_ts_config(struct iavf_adapter *adapter, struct ifreq *ifr);
int iavf_ptp_set_ts_config(struct iavf_adapter *adapter, struct ifreq *ifr);
#else
static inline void iavf_ptp_init(struct iavf_adapter *adapter) {}
static inline void iavf_ptp_release(struct iavf_adapter *adapter) {}
static inline void iavf_ptp_process_caps(struct iavf_adapter *adapter) {}
static inline bool iavf_ptp_cap_supported(struct iavf_adapter *adapter, u32 cap) { return false; }
static inline u64 iavf_ptp_extend_32b_timestamp(u64 cached_phc_time, u32 in_tstamp) { return 0; }
static inline u64 iavf_ptp_extend_40b_timestamp(u64 cached_phc_time, u64 in_tstamp) { return 0; }
static inline int iavf_ptp_get_ts_config(struct iavf_adapter *adapter, struct ifreq *ifr)
{
return -EOPNOTSUPP;
}
static inline int iavf_ptp_set_ts_config(struct iavf_adapter *adapter, struct ifreq *ifr)
{
return -EOPNOTSUPP;
}
#endif
#endif /* _IAVF_PTP_H_ */

View File

@ -37,7 +37,7 @@
#include <linux/tracepoint.h>
/**
/*
* iavf_trace() macro enables shared code to refer to trace points
* like:
*

File diff suppressed because it is too large Load Diff

View File

@ -262,19 +262,21 @@ static inline unsigned int iavf_txd_use_count(unsigned int size)
#define DESC_NEEDED (MAX_SKB_FRAGS + 6)
#define IAVF_MIN_DESC_PENDING 4
#define IAVF_TX_FLAGS_HW_VLAN BIT(1)
#define IAVF_TX_FLAGS_SW_VLAN BIT(2)
#define IAVF_TX_FLAGS_TSO BIT(3)
#define IAVF_TX_FLAGS_IPV4 BIT(4)
#define IAVF_TX_FLAGS_IPV6 BIT(5)
#define IAVF_TX_FLAGS_FCCRC BIT(6)
#define IAVF_TX_FLAGS_FSO BIT(7)
#define IAVF_TX_FLAGS_FD_SB BIT(9)
#define IAVF_TX_FLAGS_TUNNEL BIT(10)
#define IAVF_TX_FLAGS_VLAN_MASK 0xffff0000
#define IAVF_TX_FLAGS_VLAN_PRIO_MASK 0xe0000000
#define IAVF_TX_FLAGS_VLAN_PRIO_SHIFT 29
#define IAVF_TX_FLAGS_VLAN_SHIFT 16
#define IAVF_TX_FLAGS_HW_VLAN BIT(1)
#define IAVF_TX_FLAGS_SW_VLAN BIT(2)
#define IAVF_TX_FLAGS_TSO BIT(3)
#define IAVF_TX_FLAGS_IPV4 BIT(4)
#define IAVF_TX_FLAGS_IPV6 BIT(5)
#define IAVF_TX_FLAGS_FCCRC BIT(6)
#define IAVF_TX_FLAGS_FSO BIT(7)
#define IAVF_TX_FLAGS_FD_SB BIT(9)
#define IAVF_TX_FLAGS_TUNNEL BIT(10)
#define IAVF_TX_FLAGS_HW_OUTER_SINGLE_VLAN BIT(11)
#define IAVF_TX_FLAGS_TSTAMP BIT(12)
#define IAVF_TX_FLAGS_VLAN_MASK 0xffff0000
#define IAVF_TX_FLAGS_VLAN_PRIO_MASK 0xe0000000
#define IAVF_TX_FLAGS_VLAN_PRIO_SHIFT 29
#define IAVF_TX_FLAGS_VLAN_SHIFT 16
struct iavf_tx_buffer {
struct iavf_tx_desc *next_to_watch;
@ -324,6 +326,32 @@ struct iavf_rx_queue_stats {
u64 realloc_count;
};
struct iavf_ch_tx_q_stats {
};
struct iavf_ch_rx_q_stats {
u64 tcp_ctrl_pkts;
u64 only_ctrl_pkts;
u64 bp_no_data_pkt;
u64 tcp_fin_recv;
u64 tcp_rst_recv;
u64 tcp_syn_recv;
};
struct iavf_ch_q_poll_stats {
/* general packet counters for busy_poll versus napi_poll */
u64 pkt_busy_poll;
u64 pkt_not_busy_poll;
};
struct iavf_ch_q_stats {
struct iavf_ch_q_poll_stats poll;
union {
struct iavf_ch_tx_q_stats tx;
struct iavf_ch_rx_q_stats rx;
};
};
enum iavf_ring_state_t {
__IAVF_TX_FDIR_INIT_DONE,
__IAVF_TX_XPS_INIT_DONE,
@ -379,10 +407,16 @@ struct iavf_ring {
bool arm_wb; /* do something to arm write back */
u8 packet_stride;
u8 rxdid; /* Rx descriptor format */
u16 flags;
#define IAVF_TXR_FLAGS_WB_ON_ITR BIT(0)
#define IAVF_RXR_FLAGS_BUILD_SKB_ENABLED BIT(1)
#define IAVF_TXR_FLAGS_XDP BIT(2)
#define IAVF_TXRX_FLAGS_VLAN_TAG_LOC_L2TAG1 BIT(3)
#define IAVF_TXR_FLAGS_VLAN_TAG_LOC_L2TAG2 BIT(4)
#define IAVF_RXR_FLAGS_VLAN_TAG_LOC_L2TAG2_2 BIT(5)
#define IAVF_TXRX_FLAGS_HW_TSTAMP BIT(6)
/* stats structs */
struct iavf_queue_stats stats;
@ -394,6 +428,8 @@ struct iavf_ring {
struct iavf_rx_queue_stats rx_stats;
};
struct iavf_ch_q_stats ch_q_stats;
unsigned int size; /* length of descriptor ring in bytes */
dma_addr_t dma; /* physical address of ring */
@ -411,12 +447,26 @@ struct iavf_ring {
* for this ring.
*/
struct iavf_channel *ch;
u16 chnl_flags;
#define IAVF_RING_CHNL_PERF_ENA BIT(0)
struct iavf_channel_ex *ch;
#ifdef HAVE_XDP_BUFF_RXQ
struct xdp_rxq_info xdp_rxq;
#endif
} ____cacheline_internodealigned_in_smp;
static inline bool ring_ch_ena(struct iavf_ring *ring)
{
return !!ring->ch;
}
static inline bool ring_ch_perf_ena(struct iavf_ring *ring)
{
return ring->chnl_flags & IAVF_RING_CHNL_PERF_ENA;
}
static inline bool ring_uses_build_skb(struct iavf_ring *ring)
{
return !!(ring->flags & IAVF_RXR_FLAGS_BUILD_SKB_ENABLED);
@ -483,9 +533,9 @@ int iavf_setup_rx_descriptors(struct iavf_ring *rx_ring);
void iavf_free_tx_resources(struct iavf_ring *tx_ring);
void iavf_free_rx_resources(struct iavf_ring *rx_ring);
int iavf_napi_poll(struct napi_struct *napi, int budget);
void iavf_force_wb(struct iavf_vsi *vsi, struct iavf_q_vector *q_vector);
u32 iavf_get_tx_pending(struct iavf_ring *ring, bool in_sw);
void iavf_detect_recover_hung(struct iavf_vsi *vsi);
void iavf_chnl_detect_recover(struct iavf_vsi *vsi);
int __iavf_maybe_stop_tx(struct iavf_ring *tx_ring, int size);
bool __iavf_chk_linearize(struct sk_buff *skb);
#ifdef HAVE_XDP_FRAME_STRUCT
@ -500,7 +550,6 @@ void iavf_xdp_flush(struct net_device *dev);
/**
* iavf_xmit_descriptor_count - calculate number of Tx descriptors needed
* @skb: send buffer
* @tx_ring: ring to send buffer on
*
* Returns number of data descriptors needed for this skb. Returns 0 to indicate
* there is not enough descriptors available in this ring since we need at least

View File

@ -158,6 +158,7 @@ struct iavf_hw_capabilities {
u32 num_tx_qp;
u32 base_queue;
u32 num_msix_vectors_vf;
u32 max_mtu;
bool apm_wol_support;
enum iavf_acpi_programming_method acpi_prog_method;
bool proxy_support;
@ -328,6 +329,45 @@ union iavf_16byte_rx_desc {
} wb; /* writeback */
};
/* Rx Flex Descriptor NIC Profile
* RxDID Profile ID 2
* Flex-field 0: RSS hash lower 16-bits
* Flex-field 1: RSS hash upper 16-bits
* Flex-field 2: Flow ID lower 16-bits
* Flex-field 3: Flow ID higher 16-bits
* Flex-field 4: reserved, VLAN ID taken from L2Tag
*/
struct iavf_32byte_rx_flex_wb {
/* Qword 0 */
u8 rxdid;
u8 mir_id_umb_cast;
__le16 ptype_flexi_flags0;
__le16 pkt_len;
__le16 hdr_len_sph_flex_flags1;
/* Qword 1 */
__le16 status_error0;
__le16 l2tag1;
__le32 rss_hash;
/* Qword 2 */
__le16 status_error1;
u8 flexi_flags2;
u8 ts_low;
__le16 l2tag2_1st;
__le16 l2tag2_2nd;
/* Qword 3 */
__le32 flow_id;
union {
struct {
__le16 rsvd;
__le16 flow_id_ipv6;
} flex;
__le32 ts_high;
} flex_ts;
};
union iavf_32byte_rx_desc {
struct {
__le64 pkt_addr; /* Packet buffer address */
@ -375,6 +415,7 @@ union iavf_32byte_rx_desc {
} hi_dword;
} qword3;
} wb; /* writeback */
struct iavf_32byte_rx_flex_wb flex_wb;
};
enum iavf_rx_desc_status_bits {
@ -443,6 +484,47 @@ enum iavf_rx_desc_error_l3l4e_fcoe_masks {
#define IAVF_RXD_QW1_PTYPE_SHIFT 30
#define IAVF_RXD_QW1_PTYPE_MASK (0xFFULL << IAVF_RXD_QW1_PTYPE_SHIFT)
/* for iavf_32byte_rx_flex_wb.ptype_flexi_flags0 member */
#define IAVF_RX_FLEX_DESC_PTYPE_M (0x3FF) /* 10-bits */
/* for iavf_32byte_rx_flex_wb.pkt_length member */
#define IAVF_RX_FLEX_DESC_PKT_LEN_M (0x3FFF) /* 14-bits */
enum iavf_rx_flex_desc_status_error_0_bits {
/* Note: These are predefined bit offsets */
IAVF_RX_FLEX_DESC_STATUS0_DD_S = 0,
IAVF_RX_FLEX_DESC_STATUS0_EOF_S,
IAVF_RX_FLEX_DESC_STATUS0_HBO_S,
IAVF_RX_FLEX_DESC_STATUS0_L3L4P_S,
IAVF_RX_FLEX_DESC_STATUS0_XSUM_IPE_S,
IAVF_RX_FLEX_DESC_STATUS0_XSUM_L4E_S,
IAVF_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S,
IAVF_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S,
IAVF_RX_FLEX_DESC_STATUS0_LPBK_S,
IAVF_RX_FLEX_DESC_STATUS0_IPV6EXADD_S,
IAVF_RX_FLEX_DESC_STATUS0_RXE_S,
IAVF_RX_FLEX_DESC_STATUS0_CRCP_S,
IAVF_RX_FLEX_DESC_STATUS0_RSS_VALID_S,
IAVF_RX_FLEX_DESC_STATUS0_L2TAG1P_S,
IAVF_RX_FLEX_DESC_STATUS0_XTRMD0_VALID_S,
IAVF_RX_FLEX_DESC_STATUS0_XTRMD1_VALID_S,
IAVF_RX_FLEX_DESC_STATUS0_LAST /* this entry must be last!!! */
};
enum iavf_rx_flex_desc_status_error_1_bits {
/* Note: These are predefined bit offsets */
IAVF_RX_FLEX_DESC_STATUS1_CPM_S = 0, /* 4 bits */
IAVF_RX_FLEX_DESC_STATUS1_NAT_S = 4,
IAVF_RX_FLEX_DESC_STATUS1_CRYPTO_S = 5,
/* [10:6] reserved */
IAVF_RX_FLEX_DESC_STATUS1_L2TAG2P_S = 11,
IAVF_RX_FLEX_DESC_STATUS1_XTRMD2_VALID_S = 12,
IAVF_RX_FLEX_DESC_STATUS1_XTRMD3_VALID_S = 13,
IAVF_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S = 14,
IAVF_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S = 15,
IAVF_RX_FLEX_DESC_STATUS1_LAST /* this entry must be last!!! */
};
/* Packet type non-ip values */
enum iavf_rx_l2_ptype {
IAVF_RX_PTYPE_L2_RESERVED = 0,
@ -470,11 +552,12 @@ enum iavf_rx_l2_ptype {
IAVF_RX_PTYPE_GRENAT4_MAC_PAY3 = 58,
IAVF_RX_PTYPE_GRENAT4_MACVLAN_IPV6_ICMP_PAY4 = 87,
IAVF_RX_PTYPE_GRENAT6_MAC_PAY3 = 124,
IAVF_RX_PTYPE_GRENAT6_MACVLAN_IPV6_ICMP_PAY4 = 153
IAVF_RX_PTYPE_GRENAT6_MACVLAN_IPV6_ICMP_PAY4 = 153,
IAVF_RX_PTYPE_PARSER_ABORTED = 255
};
struct iavf_rx_ptype_decoded {
u32 ptype:8;
u32 ptype:10;
u32 known:1;
u32 outer_ip:1;
u32 outer_ip_ver:1;

File diff suppressed because it is too large Load Diff

View File

@ -1475,7 +1475,6 @@ static const unsigned char __maybe_unused pcie_link_speed[] = {
int __kc_pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed,
enum pcie_link_width *width)
{
int ret;
*speed = PCI_SPEED_UNKNOWN;
*width = PCIE_LNK_WIDTH_UNKNOWN;
@ -1484,8 +1483,8 @@ int __kc_pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed,
u16 lnksta;
enum pci_bus_speed next_speed;
enum pcie_link_width next_width;
int ret = pcie_capability_read_word(dev, PCI_EXP_LNKSTA, &lnksta);
ret = pcie_capability_read_word(dev, PCI_EXP_LNKSTA, &lnksta);
if (ret)
return ret;
@ -1541,6 +1540,50 @@ int __kc_dma_set_mask_and_coherent(struct device *dev, u64 mask)
err = dma_set_coherent_mask(dev, mask);
return err;
}
#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0))
static bool _kc_pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn,
u32 *l, int crs_timeout)
{
int delay = 1;
if (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, l))
return false;
/* some broken boards return 0 or ~0 if a slot is empty: */
if (*l == 0xffffffff || *l == 0x00000000 ||
*l == 0x0000ffff || *l == 0xffff0000)
return false;
/* Configuration request Retry Status */
while (*l == 0xffff0001) {
if (!crs_timeout)
return false;
msleep(delay);
delay *= 2;
if (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, l))
return false;
/* Card hasn't responded in 60 seconds? Must be stuck. */
if (delay > crs_timeout) {
printk(KERN_WARNING "pci %04x:%02x:%02x.%d: not "
"responding\n", pci_domain_nr(bus),
bus->number, PCI_SLOT(devfn),
PCI_FUNC(devfn));
return false;
}
}
return true;
}
bool _kc_pci_device_is_present(struct pci_dev *pdev)
{
u32 v;
return _kc_pci_bus_read_dev_vendor_id(pdev->bus, pdev->devfn, &v, 0);
}
#endif /* <RHEL7.0 */
#endif /* 3.13.0 */
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) )
@ -1553,7 +1596,6 @@ int __kc_ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
{
unsigned int start = skb_network_offset(skb) + sizeof(struct ipv6hdr);
u8 nexthdr = ipv6_hdr(skb)->nexthdr;
unsigned int len;
bool found;
#define __KC_IP6_FH_F_FRAG BIT(0)
@ -1574,7 +1616,6 @@ int __kc_ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
start = *offset + sizeof(struct ipv6hdr);
nexthdr = ip6->nexthdr;
}
len = skb->len - start;
do {
struct ipv6_opt_hdr _hdr, *hp;
@ -1639,7 +1680,6 @@ int __kc_ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
if (!found) {
nexthdr = hp->nexthdr;
len -= hdrlen;
start += hdrlen;
}
} while (!found);
@ -2111,6 +2151,100 @@ unsigned int _kc_cpumask_local_spread(unsigned int i, int node)
#endif
#endif
/******************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0))
#if (!(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,4)) && \
!(SLE_VERSION_CODE >= SLE_VERSION(12,2,0)))
/**
* _kc_skb_flow_dissect_flow_keys - parse SKB to fill _kc_flow_keys
* @skb: SKB used to fille _kc_flow_keys
* @flow: _kc_flow_keys to set with SKB fields
* @flags: currently unused flags
*
* The purpose of using kcompat for this function is so the caller doesn't have
* to care about which kernel version they are on, which prevents a larger than
* normal #ifdef mess created by using a HAVE_* flag for this case. This is also
* done for 4.2 kernels to simplify calling skb_flow_dissect_flow_keys()
* because in 4.2 kernels skb_flow_dissect_flow_keys() exists, but only has 2
* arguments. Recent kernels have skb_flow_dissect_flow_keys() that has 3
* arguments.
*
* The caller needs to understand that this function was only implemented as a
* bare-minimum replacement for recent versions of skb_flow_dissect_flow_keys()
* and this function is in no way similar to skb_flow_dissect_flow_keys(). An
* example use can be found in the ice driver, specifically ice_arfs.c.
*
* This function is treated as a whitelist of supported fields the SKB can
* parse. If new functionality is added make sure to keep this format (i.e. only
* check for fields that are explicity wanted).
*
* Current whitelist:
*
* TCPv4, TCPv6, UDPv4, UDPv6
*
* If any unexpected protocol or other field is found this function memsets the
* flow passed in back to 0 and returns false. Otherwise the flow is populated
* and returns true.
*/
bool
_kc_skb_flow_dissect_flow_keys(const struct sk_buff *skb,
struct _kc_flow_keys *flow,
unsigned int __always_unused flags)
{
memset(flow, 0, sizeof(*flow));
flow->basic.n_proto = skb->protocol;
switch (flow->basic.n_proto) {
case htons(ETH_P_IP):
flow->basic.ip_proto = ip_hdr(skb)->protocol;
flow->addrs.v4addrs.src = ip_hdr(skb)->saddr;
flow->addrs.v4addrs.dst = ip_hdr(skb)->daddr;
break;
case htons(ETH_P_IPV6):
flow->basic.ip_proto = ipv6_hdr(skb)->nexthdr;
memcpy(&flow->addrs.v6addrs.src, &ipv6_hdr(skb)->saddr,
sizeof(struct in6_addr));
memcpy(&flow->addrs.v6addrs.dst, &ipv6_hdr(skb)->daddr,
sizeof(struct in6_addr));
break;
default:
netdev_dbg(skb->dev, "%s: Unsupported/unimplemented layer 3 protocol %04x\n", __func__, htons(flow->basic.n_proto));
goto unsupported;
}
switch (flow->basic.ip_proto) {
case IPPROTO_TCP:
{
struct tcphdr *tcph;
tcph = tcp_hdr(skb);
flow->ports.src = tcph->source;
flow->ports.dst = tcph->dest;
break;
}
case IPPROTO_UDP:
{
struct udphdr *udph;
udph = udp_hdr(skb);
flow->ports.src = udph->source;
flow->ports.dst = udph->dest;
break;
}
default:
netdev_dbg(skb->dev, "%s: Unsupported/unimplemented layer 4 protocol %02x\n", __func__, flow->basic.ip_proto);
return false;
}
return true;
unsupported:
memset(flow, 0, sizeof(*flow));
return false;
}
#endif /* ! >= RHEL7.4 && ! >= SLES12.2 */
#endif /* 4.3.0 */
/******************************************************************************/
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) )
#if (!(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,3)))
@ -2220,6 +2354,38 @@ void _kc_ethtool_intersect_link_masks(struct ethtool_link_ksettings *dst,
}
#endif /* 4.15.0 */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,16,0))
#if !(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8,0)) && \
!(SLE_VERSION_CODE >= SLE_VERSION(12,5,0) && \
SLE_VERSION_CODE < SLE_VERSION(15,0,0) || \
SLE_VERSION_CODE >= SLE_VERSION(15,1,0))
#if BITS_PER_LONG == 64
/**
* bitmap_from_arr32 - copy the contents of u32 array of bits to bitmap
* @bitmap: array of unsigned longs, the destination bitmap
* @buf: array of u32 (in host byte order), the source bitmap
* @nbits: number of bits in @bitmap
*/
void bitmap_from_arr32(unsigned long *bitmap, const u32 *buf, unsigned int nbits)
{
unsigned int i, halfwords;
halfwords = DIV_ROUND_UP(nbits, 32);
for (i = 0; i < halfwords; i++) {
bitmap[i/2] = (unsigned long) buf[i];
if (++i < halfwords)
bitmap[i/2] |= ((unsigned long) buf[i]) << 32;
}
/* Clear tail bits in last word beyond nbits. */
if (nbits % BITS_PER_LONG)
bitmap[(halfwords - 1) / 2] &= BITMAP_LAST_WORD_MASK(nbits);
}
#endif /* BITS_PER_LONG == 64 */
#endif /* !(RHEL >= 8.0) && !(SLES >= 12.5 && SLES < 15.0 || SLES >= 15.1) */
#endif /* 4.16.0 */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,17,0))
/* PCIe link information */
@ -2369,10 +2535,7 @@ void _kc_pcie_print_link_status(struct pci_dev *dev) {
#endif /* 4.17.0 */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0))
#if (RHEL_RELEASE_CODE && (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8,1)))
#define HAVE_NDO_FDB_ADD_EXTACK
#else /* !RHEL || RHEL < 8.1 */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0)) || (RHEL_RELEASE_CODE && (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(8,1)))
#ifdef HAVE_TC_SETUP_CLSFLOWER
#define FLOW_DISSECTOR_MATCH(__rule, __type, __out) \
const struct flow_match *__m = &(__rule)->match; \
@ -2457,8 +2620,7 @@ void flow_rule_match_ports(const struct flow_rule *rule,
FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_PORTS, out);
}
#endif /* HAVE_TC_SETUP_CLSFLOWER */
#endif /* !RHEL || RHEL < 8.1 */
#endif /* 5.1.0 */
#endif /* 5.1.0 || (RHEL && RHEL < 8.1) */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,3,0))
@ -2493,3 +2655,30 @@ int _kc_flow_block_cb_setup_simple(struct flow_block_offload *f,
#endif /* HAVE_TC_CB_AND_SETUP_QDISC_MQPRIO */
#endif /* !RHEL >= 8.2 */
#endif /* 5.3.0 */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,7,0))
u64 _kc_pci_get_dsn(struct pci_dev *dev)
{
u32 dword;
u64 dsn;
int pos;
pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DSN);
if (!pos)
return 0;
/*
* The Device Serial Number is two dwords offset 4 bytes from the
* capability position. The specification says that the first dword is
* the lower half, and the second dword is the upper half.
*/
pos += 4;
pci_read_config_dword(dev, pos, &dword);
dsn = (u64)dword;
pci_read_config_dword(dev, pos + 4, &dword);
dsn |= ((u64)dword) << 32;
return dsn;
}
#endif /* 5.7.0 */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,411 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2013, Intel Corporation. */
#ifndef _KCOMPAT_IMPL_H_
#define _KCOMPAT_IMPL_H_
/* This file contains implementations of backports from various kernels. It
* must rely only on NEED_<FLAG> and HAVE_<FLAG> checks. It must not make any
* checks to determine the kernel version when deciding whether to include an
* implementation.
*
* All new implementations must go in this file, and legacy implementations
* should be migrated to the new format over time.
*/
/*
* generic network stack functions
*/
/* NEED_NET_PREFETCH
*
* net_prefetch was introduced by commit f468f21b7af0 ("net: Take common
* prefetch code structure into a function")
*
* This function is trivial to re-implement in full.
*/
#ifdef NEED_NET_PREFETCH
static inline void net_prefetch(void *p)
{
prefetch(p);
#if L1_CACHE_BYTES < 128
prefetch((u8 *)p + L1_CACHE_BYTES);
#endif
}
#endif /* NEED_NET_PREFETCH */
/* NEED_SKB_FRAG_OFF_ACCESSORS
*
* skb_frag_off and skb_frag_off_add were added in upstream commit
* 7240b60c98d6 ("linux: Add skb_frag_t page_offset accessors")
*
* Implementing the wrappers directly for older kernels which still have the
* old implementation of skb_frag_t is trivial.
*/
#ifdef NEED_SKB_FRAG_OFF_ACCESSORS
static inline unsigned int skb_frag_off(const skb_frag_t *frag)
{
return frag->page_offset;
}
static inline void skb_frag_off_add(skb_frag_t *frag, int delta)
{
frag->page_offset += delta;
}
#endif
/*
* NETIF_F_HW_L2FW_DOFFLOAD related functions
*
* Support for NETIF_F_HW_L2FW_DOFFLOAD was first introduced upstream by
* commit a6cc0cfa72e0 ("net: Add layer 2 hardware acceleration operations for
* macvlan devices")
*/
#ifdef NETIF_F_HW_L2FW_DOFFLOAD
#include <linux/if_macvlan.h>
/* NEED_MACVLAN_ACCEL_PRIV
*
* macvlan_accel_priv is an accessor function that replaced direct access to
* the macvlan->fwd_priv variable. It was introduced in commit 7d775f63470c
* ("macvlan: Rename fwd_priv to accel_priv and add accessor function")
*
* Implement the new wrapper name by simply accessing the older
* macvlan->fwd_priv name.
*/
#ifdef NEED_MACVLAN_ACCEL_PRIV
static inline void *macvlan_accel_priv(struct net_device *dev)
{
struct macvlan_dev *macvlan = netdev_priv(dev);
return macvlan->fwd_priv;
}
#endif /* NEED_MACVLAN_ACCEL_PRIV */
/* NEED_MACVLAN_RELEASE_L2FW_OFFLOAD
*
* macvlan_release_l2fw_offload was introduced upstream by commit 53cd4d8e4dfb
* ("macvlan: Provide function for interfaces to release HW offload")
*
* Implementing this is straight forward, but we must be careful to use
* fwd_priv instead of accel_priv. Note that both the change to accel_priv and
* introduction of this function happened in the same release.
*/
#ifdef NEED_MACVLAN_RELEASE_L2FW_OFFLOAD
static inline int macvlan_release_l2fw_offload(struct net_device *dev)
{
struct macvlan_dev *macvlan = netdev_priv(dev);
macvlan->fwd_priv = NULL;
return dev_uc_add(macvlan->lowerdev, dev->dev_addr);
}
#endif /* NEED_MACVLAN_RELEASE_L2FW_OFFLOAD */
/* NEED_MACVLAN_SUPPORTS_DEST_FILTER
*
* macvlan_supports_dest_filter was introduced upstream by commit 6cb1937d4eff
* ("macvlan: Add function to test for destination filtering support")
*
* The implementation doesn't rely on anything new and is trivial to backport
* for kernels that have NETIF_F_HW_L2FW_DOFFLOAD support.
*/
#ifdef NEED_MACVLAN_SUPPORTS_DEST_FILTER
static inline bool macvlan_supports_dest_filter(struct net_device *dev)
{
struct macvlan_dev *macvlan = netdev_priv(dev);
return macvlan->mode == MACVLAN_MODE_PRIVATE ||
macvlan->mode == MACVLAN_MODE_VEPA ||
macvlan->mode == MACVLAN_MODE_BRIDGE;
}
#endif /* NEED_MACVLAN_SUPPORTS_DEST_FILTER */
#endif /* NETIF_F_HW_L2FW_DOFFLOAD */
/*
* tc functions
*/
/* NEED_FLOW_INDR_BLOCK_CB_REGISTER
*
* __flow_indr_block_cb_register and __flow_indr_block_cb_unregister were
* added in upstream commit 4e481908c51b ("flow_offload: move tc indirect
* block to flow offload")
*
* This was a simple rename so we can just translate from the old
* naming scheme with a macro.
*/
#ifdef NEED_FLOW_INDR_BLOCK_CB_REGISTER
#define __flow_indr_block_cb_register __tc_indr_block_cb_register
#define __flow_indr_block_cb_unregister __tc_indr_block_cb_unregister
#endif
/*
* devlink support
*/
#if IS_ENABLED(CONFIG_NET_DEVLINK)
#include <net/devlink.h>
#ifdef HAVE_DEVLINK_REGIONS
/* NEED_DEVLINK_REGION_CREATE_OPS
*
* The ops parameter to devlink_region_create was added by commit e8937681797c
* ("devlink: prepare to support region operations")
*
* For older kernels, define _kc_devlink_region_create that takes an ops
* parameter, and calls the old implementation function by extracting the name
* from the structure.
*/
#ifdef NEED_DEVLINK_REGION_CREATE_OPS
struct devlink_region_ops {
const char *name;
void (*destructor)(const void *data);
};
static inline struct devlink_region *
_kc_devlink_region_create(struct devlink *devlink,
const struct devlink_region_ops *ops,
u32 region_max_snapshots, u64 region_size)
{
return devlink_region_create(devlink, ops->name, region_max_snapshots,
region_size);
}
#define devlink_region_create _kc_devlink_region_create
#endif /* NEED_DEVLINK_REGION_CREATE_OPS */
#endif /* HAVE_DEVLINK_REGIONS */
/* NEED_DEVLINK_FLASH_UPDATE_STATUS_NOTIFY
*
* devlink_flash_update_status_notify, _begin_notify, and _end_notify were
* added by upstream commit 191ed2024de9 ("devlink: allow driver to update
* progress of flash update")
*
* For older kernels that lack the netlink messages, convert the functions
* into no-ops.
*/
#ifdef NEED_DEVLINK_FLASH_UPDATE_STATUS_NOTIFY
static inline void
devlink_flash_update_begin_notify(struct devlink __always_unused *devlink)
{
}
static inline void
devlink_flash_update_end_notify(struct devlink __always_unused *devlink)
{
}
static inline void
devlink_flash_update_status_notify(struct devlink __always_unused *devlink,
const char __always_unused *status_msg,
const char __always_unused *component,
unsigned long __always_unused done,
unsigned long __always_unused total)
{
}
#endif /* NEED_DEVLINK_FLASH_UPDATE_STATUS_NOTIFY */
/* NEED_DEVLINK_FLASH_UPDATE_TIMEOUT_NOTIFY
*
* devlink_flash_update_timeout_notify was added by upstream commit
* f92970c694b3 ("devlink: add timeout information to status_notify").
*
* For older kernels, just convert timeout notifications into regular status
* notification messages without timeout information.
*/
#ifdef NEED_DEVLINK_FLASH_UPDATE_TIMEOUT_NOTIFY
static inline void
devlink_flash_update_timeout_notify(struct devlink *devlink,
const char *status_msg,
const char *component,
unsigned long __always_unused timeout)
{
devlink_flash_update_status_notify(devlink, status_msg, component, 0, 0);
}
#endif /* NEED_DEVLINK_FLASH_UPDATE_TIMEOUT_NOTIFY */
/*
* NEED_DEVLINK_PORT_ATTRS_SET_STRUCT
*
* HAVE_DEVLINK_PORT_ATTRS_SET_PORT_FLAVOUR
* HAVE_DEVLINK_PORT_ATTRS_SET_SWITCH_ID
*
* devlink_port_attrs_set was introduced by commit b9ffcbaf56d3 ("devlink:
* introduce devlink_port_attrs_set")
*
* It's function signature has changed multiple times over several kernel
* releases:
*
* commit 5ec1380a21bb ("devlink: extend attrs_set for setting port
* flavours") added the ability to set port flavour. (Note that there is no
* official kernel release with devlink_port_attrs_set without the flavour
* argument, as they were introduced in the same series.)
*
* commit bec5267cded2 ("net: devlink: extend port attrs for switch ID") added
* the ability to set the switch ID (HAVE_DEVLINK_PORT_ATTRS_SET_SWITCH_ID)
*
* Finally commit 71ad8d55f8e5 ("devlink: Replace devlink_port_attrs_set
* parameters with a struct") refactored to pass devlink_port_attrs struct
* instead of individual parameters. (!NEED_DEVLINK_PORT_ATTRS_SET_STRUCT)
*
* We want core drivers to just use the latest form that takes
* a devlink_port_attrs structure. Note that this structure did exist as part
* of <net/devlink.h> but was never used directly by driver code prior to the
* function parameter change. For this reason, the implementation always
* relies on _kc_devlink_port_attrs instead of what was defined in the kernel.
*/
#ifdef NEED_DEVLINK_PORT_ATTRS_SET_STRUCT
#ifndef HAVE_DEVLINK_PORT_ATTRS_SET_PORT_FLAVOUR
enum devlink_port_flavour {
DEVLINK_PORT_FLAVOUR_PHYSICAL,
DEVLINK_PORT_FLAVOUR_CPU,
DEVLINK_PORT_FLAVOUR_DSA,
DEVLINK_PORT_FLAVOUR_PCI_PF,
DEVLINK_PORT_FLAVOUR_PCI_VF,
};
#endif
struct _kc_devlink_port_phys_attrs {
u32 port_number;
u32 split_subport_number;
};
struct _kc_devlink_port_pci_pf_attrs {
u16 pf;
};
struct _kc_devlink_port_pci_vf_attrs {
u16 pf;
u16 vf;
};
struct _kc_devlink_port_attrs {
u8 split:1,
splittable:1;
u32 lanes;
enum devlink_port_flavour flavour;
struct netdev_phys_item_id switch_id;
union {
struct _kc_devlink_port_phys_attrs phys;
struct _kc_devlink_port_pci_pf_attrs pci_pf;
struct _kc_devlink_port_pci_vf_attrs pci_vf;
};
};
#define devlink_port_attrs _kc_devlink_port_attrs
static inline void
_kc_devlink_port_attrs_set(struct devlink_port *devlink_port,
struct _kc_devlink_port_attrs *attrs)
{
#if defined(HAVE_DEVLINK_PORT_ATTRS_SET_SWITCH_ID)
devlink_port_attrs_set(devlink_port, attrs->flavour, attrs->phys.port_number,
attrs->split, attrs->phys.split_subport_number,
attrs->switch_id.id, attrs->switch_id.id_len);
#elif defined(HAVE_DEVLINK_PORT_ATTRS_SET_PORT_FLAVOUR)
devlink_port_attrs_set(devlink_port, attrs->flavour, attrs->phys.port_number,
attrs->split, attrs->phys.split_subport_number);
#else
if (attrs->split)
devlink_port_split_set(devlink_port, attrs->phys.port_number);
#endif
}
#define devlink_port_attrs_set _kc_devlink_port_attrs_set
#endif /* NEED_DEVLINK_PORT_ATTRS_SET_STRUCT */
#endif /* CONFIG_NET_DEVLINK */
/*
* dev_printk implementations
*/
/* NEED_DEV_PRINTK_ONCE
*
* The dev_*_once family of printk functions was introduced by commit
* e135303bd5be ("device: Add dev_<level>_once variants")
*
* The implementation is very straight forward so we will just implement them
* as-is here.
*/
#ifdef NEED_DEV_PRINTK_ONCE
#ifdef CONFIG_PRINTK
#define dev_level_once(dev_level, dev, fmt, ...) \
do { \
static bool __print_once __read_mostly; \
\
if (!__print_once) { \
__print_once = true; \
dev_level(dev, fmt, ##__VA_ARGS__); \
} \
} while (0)
#else
#define dev_level_once(dev_level, dev, fmt, ...) \
do { \
if (0) \
dev_level(dev, fmt, ##__VA_ARGS__); \
} while (0)
#endif
#define dev_emerg_once(dev, fmt, ...) \
dev_level_once(dev_emerg, dev, fmt, ##__VA_ARGS__)
#define dev_alert_once(dev, fmt, ...) \
dev_level_once(dev_alert, dev, fmt, ##__VA_ARGS__)
#define dev_crit_once(dev, fmt, ...) \
dev_level_once(dev_crit, dev, fmt, ##__VA_ARGS__)
#define dev_err_once(dev, fmt, ...) \
dev_level_once(dev_err, dev, fmt, ##__VA_ARGS__)
#define dev_warn_once(dev, fmt, ...) \
dev_level_once(dev_warn, dev, fmt, ##__VA_ARGS__)
#define dev_notice_once(dev, fmt, ...) \
dev_level_once(dev_notice, dev, fmt, ##__VA_ARGS__)
#define dev_info_once(dev, fmt, ...) \
dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__)
#define dev_dbg_once(dev, fmt, ...) \
dev_level_once(dev_dbg, dev, fmt, ##__VA_ARGS__)
#endif /* NEED_DEV_PRINTK_ONCE */
#ifdef HAVE_TC_CB_AND_SETUP_QDISC_MQPRIO
/* NEED_TC_CLS_CAN_OFFLOAD_AND_CHAIN0
*
* tc_cls_can_offload_and_chain0 was added by upstream commit
* 878db9f0f26d ("pkt_cls: add new tc cls helper to check offload flag and
* chain index").
*
* This patch backports this function for older kernels by calling
* tc_can_offload() directly.
*/
#ifdef NEED_TC_CLS_CAN_OFFLOAD_AND_CHAIN0
#include <net/pkt_cls.h>
static inline bool
tc_cls_can_offload_and_chain0(const struct net_device *dev,
struct tc_cls_common_offload *common)
{
if (!tc_can_offload(dev))
return false;
if (common->chain_index)
return false;
return true;
}
#endif /* NEED_TC_CLS_CAN_OFFLOAD_AND_CHAIN0 */
#endif /* HAVE_TC_CB_AND_SETUP_QDISC_MQPRIO */
/* NEED_TC_SETUP_QDISC_MQPRIO
*
* TC_SETUP_QDISC_MQPRIO was added by upstream commit
* 575ed7d39e2f ("net_sch: mqprio: Change TC_SETUP_MQPRIO to
* TC_SETUP_QDISC_MQPRIO").
*
* For older kernels which are using TC_SETUP_MQPRIO
*/
#ifdef NEED_TC_SETUP_QDISC_MQPRIO
#define TC_SETUP_QDISC_MQPRIO TC_SETUP_MQPRIO
#endif /* NEED_TC_SETUP_QDISC_MQPRIO */
#endif /* _KCOMPAT_IMPL_H_ */

View File

@ -0,0 +1,77 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2013, Intel Corporation. */
#ifndef _KCOMPAT_RHEL_DEFS_H_
#define _KCOMPAT_RHEL_DEFS_H_
/* This is the RedHat Enterprise Linux distribution specific definitions file.
* It defines what features need backports for a given version of the RHEL
* kernel.
*
* It checks the RHEL_RELEASE_CODE and RHEL_RELEASE_VERSION macros to decide
* what support the target kernel has.
*
* It assumes that kcompat_std_defs.h has already been processed, and will
* #define or #undef any flags that have changed based on backports done by
* RHEL.
*/
#if !RHEL_RELEASE_CODE
#error "RHEL_RELEASE_CODE is 0 or undefined"
#endif
#ifndef RHEL_RELEASE_VERSION
#error "RHEL_RELEASE_VERSION is undefined"
#endif
/*****************************************************************************/
#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,3))
#else /* >= 7.3 */
#undef NEED_DEV_PRINTK_ONCE
#endif /* 7.3 */
/*****************************************************************************/
#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,5))
#else /* >= 7.5 */
#define HAVE_TCF_EXTS_TO_LIST
#endif /* 7.5 */
/*****************************************************************************/
#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6))
#else /* >= 7.6 */
#undef NEED_TC_CLS_CAN_OFFLOAD_AND_CHAIN0
#undef NEED_TC_SETUP_QDISC_MQPRIO
#endif /* 7.6 */
/*****************************************************************************/
#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,7))
#else /* >= 7.7 */
#define HAVE_DEVLINK_PORT_ATTRS_SET_PORT_FLAVOUR
#endif /* 7.7 */
/*****************************************************************************/
#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(8,0))
#else /* >= 8.0 */
#undef HAVE_TCF_EXTS_TO_LIST
#define HAVE_TCF_EXTS_FOR_EACH_ACTION
#endif /* 7.5 */
/*****************************************************************************/
#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(8,2))
#else /* >= 8.2 */
#undef NEED_DEVLINK_FLASH_UPDATE_STATUS_NOTIFY
#undef NEED_SKB_FRAG_OFF_ACCESSORS
#undef NEED_FLOW_INDR_BLOCK_CB_REGISTER
#define HAVE_DEVLINK_PORT_ATTRS_SET_SWITCH_ID
#endif /* 8.2 */
/*****************************************************************************/
#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(8,4))
#else /* >= 8.4 */
#undef NEED_DEVLINK_PORT_ATTRS_SET_STRUCT
#undef NEED_NET_PREFETCH
#undef NEED_DEVLINK_FLASH_UPDATE_TIMEOUT_NOTIFY
#undef HAVE_XDP_QUERY_PROG
#endif /* 8.4 */
#endif /* _KCOMPAT_RHEL_DEFS_H_ */

View File

@ -0,0 +1,149 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2013, Intel Corporation. */
#ifndef _KCOMPAT_SLES_DEFS_H_
#define _KCOMPAT_SLES_DEFS_H_
/* This is the SUSE Linux Enterprise distribution specific definitions file.
* It defines what features need backports for a given version of the SUSE
* Linux Enterprise kernel.
*
* It checks a combination of the LINUX_VERSION code and the
* SLE_LOCALVERSION_CODE to determine what support the kernel has.
*
* It assumes that kcompat_std_defs.h has already been processed, and will
* #define or #undef any flags that have changed based on backports done by
* SUSE.
*/
#ifndef LINUX_VERSION_CODE
#error "LINUX_VERSION_CODE is undefined"
#endif
#ifndef KERNEL_VERSION
#error "KERNEL_VERSION is undefined"
#endif
#if !SLE_KERNEL_REVISION
#error "SLE_KERNEL_REVISION is 0 or undefined"
#endif
#if SLE_KERNEL_REVISION > 65535
#error "SLE_KERNEL_REVISION is unexpectedly large"
#endif
/* SLE kernel versions are a combination of the LINUX_VERSION_CODE along with
* an extra digit that indicates the SUSE specific revision of that kernel.
* This value is found in the CONFIG_LOCALVERSION of the SUSE kernel, which is
* extracted by common.mk and placed into SLE_KERNEL_REVISION_CODE.
*
* We combine the value of SLE_KERNEL_REVISION along with the LINUX_VERSION code
* to generate the useful value that determines what specific kernel we're
* dealing with.
*
* Just in case the SLE_KERNEL_REVISION ever goes above 255, we reserve 16 bits
* instead of 8 for this value.
*/
#define SLE_KERNEL_CODE ((LINUX_VERSION_CODE << 16) + SLE_KERNEL_REVISION)
#define SLE_KERNEL_VERSION(a,b,c,d) ((KERNEL_VERSION(a,b,c) << 16) + (d))
/* Unlike RHEL, SUSE kernels are not always tied to a single service pack. For
* example, 4.12.14 was used as the base for SLE 15 SP1, SLE 12 SP4, and SLE 12
* SP5.
*
* You can find the patches that SUSE applied to the kernel tree at
* https://github.com/SUSE/kernel-source.
*
* You can find the correct kernel version for a check by using steps similar
* to the following
*
* 1) download the kernel-source repo
* 2) checkout the relevant branch, i.e SLE15-SP3
* 3) find the relevant backport you're interested in the patches.suse
* directory
* 4) git log <patch file> to locate the commit that introduced the backport
* 5) git describe --contains to find the relevant tag that includes that
* commit, i.e. rpm-5.3.18-37
* 6) those digits represent the SLE kernel that introduced that backport.
*
* Try to keep the checks in SLE_KERNEL_CODE order and condense where
* possible.
*/
/*****************************************************************************/
#if (SLE_KERNEL_CODE > SLE_KERNEL_VERSION(4,12,14,23) && \
SLE_KERNEL_CODE < SLE_KERNEL_VERSION(4,12,14,94))
/*
* 4.12.14 is used as the base for SLE 12 SP4, SLE 12 SP5, SLE 15, and SLE 15
* SP1. Unfortunately the revision codes do not line up cleanly. SLE 15
* launched with 4.12.14-23. It appears that SLE 12 SP4 and SLE 15 SP1 both
* diverged from this point, with SLE 12 SP4 kernels starting around
* 4.12.14-94. A few backports for SLE 15 SP1 landed in some alpha and beta
* kernels tagged between 4.12.14-25 up to 4.12.14-32. These changes did not
* make it into SLE 12 SP4. This was cleaned up with SLE 12 SP5 by an apparent
* merge in 4.12.14-111. The official launch of SLE 15 SP1 ended up with
* version 4.12.14-195.
*
* Because of this inconsistency and because all of these kernels appear to be
* alpha or beta kernel releases for SLE 15 SP1, we do not rely on version
* checks between this range. Issue a warning to indicate that we do not
* support these.
*/
#warning "SLE kernel versions between 4.12.14-23 and 4.12.14-94 are not supported"
#endif
/*****************************************************************************/
#if (SLE_KERNEL_CODE < SLE_KERNEL_VERSION(4,12,14,100))
#else /* >= 4.12.14-100 */
#undef HAVE_TCF_EXTS_TO_LIST
#define HAVE_TCF_EXTS_FOR_EACH_ACTION
#endif /* 4.12.14-100 */
/*****************************************************************************/
#if (SLE_KERNEL_CODE < SLE_KERNEL_VERSION(4,12,14,111))
#else /* >= 4.12.14-111 */
#define HAVE_DEVLINK_PORT_ATTRS_SET_PORT_FLAVOUR
#undef NEED_MACVLAN_ACCEL_PRIV
#undef NEED_MACVLAN_RELEASE_L2FW_OFFLOAD
#undef NEED_MACVLAN_SUPPORTS_DEST_FILTER
#endif /* 4.12.14-111 */
/*****************************************************************************/
#if (SLE_KERNEL_CODE < SLE_KERNEL_VERSION(4,12,14,120))
#else /* >= 4.12.14-120 */
#define HAVE_NDO_SELECT_QUEUE_SB_DEV
#define HAVE_TCF_MIRRED_DEV
#define HAVE_TCF_BLOCK
#define HAVE_TC_CB_AND_SETUP_QDISC_MQPRIO
#define HAVE_TCF_BLOCK_CB_REGISTER_EXTACK
#undef NEED_TC_SETUP_QDISC_MQPRIO
#undef NEED_TC_CLS_CAN_OFFLOAD_AND_CHAIN0
#endif /* 4.12.14-120 */
/*****************************************************************************/
#if (SLE_KERNEL_CODE < SLE_KERNEL_VERSION(5,3,8,2))
#else /* >= 5.3.8-2 */
#undef NEED_FLOW_INDR_BLOCK_CB_REGISTER
#undef NEED_SKB_FRAG_OFF_ACCESSORS
#endif /* 5.3.8-2 */
/*****************************************************************************/
#if (SLE_KERNEL_CODE < SLE_KERNEL_VERSION(5,3,18,34))
#else /* >= 5.3.18-34 */
#undef NEED_DEVLINK_REGION_CREATE_OPS
#undef NEED_DEVLINK_PORT_ATTRS_SET_STRUCT
#endif /* 5.3.18-34 */
/*****************************************************************************/
#if (SLE_KERNEL_CODE < SLE_KERNEL_VERSION(5,3,18,37))
#else /* >= 5.3.18-37 */
#undef NEED_NET_PREFETCH
#endif /* 5.3.18-37 */
/*****************************************************************************/
#if (SLE_KERNEL_CODE < SLE_KERNEL_VERSION(5,3,18,38))
#else /* >= 5.3.18-38 */
#undef NEED_DEVLINK_FLASH_UPDATE_TIMEOUT_NOTIFY
#endif /* 5.3.18-38 */
#endif /* _KCOMPAT_SLES_DEFS_H_ */

View File

@ -0,0 +1,114 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2013, Intel Corporation. */
#ifndef _KCOMPAT_STD_DEFS_H_
#define _KCOMPAT_STD_DEFS_H_
/* This file contains the definitions for what kernel features need backports
* for a given kernel. It targets only the standard stable kernel releases.
* It must check only LINUX_VERSION_CODE and assume the kernel is a standard
* release, and not a custom distribution.
*
* It must define HAVE_<FLAG> and NEED_<FLAG> for features. It must not
* implement any backports, instead leaving the implementation to the
* kcompat_impl.h header.
*
* If a feature can be easily implemented as a replacement macro or fully
* backported, use a NEED_<FLAG> to indicate that the feature needs
* a backport. (If NEED_<FLAG> is undefined, then no backport for that feature
* is needed).
*
* If a feature cannot be easily implemented in kcompat directly, but
* requires drivers to make specific changes such as stripping out an entire
* feature or modifying a function pointer prototype, use a HAVE_<FLAG>.
*/
#ifndef LINUX_VERSION_CODE
#error "LINUX_VERSION_CODE is undefined"
#endif
#ifndef KERNEL_VERSION
#error "KERNEL_VERSION is undefined"
#endif
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0))
#define NEED_DEV_PRINTK_ONCE
#else /* >= 3,19,0 */
#endif /* 3,19,0 */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0))
#else /* >= 4,8,0 */
#define HAVE_TCF_EXTS_TO_LIST
#endif /* 4,8,0 */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0))
#define NEED_TC_SETUP_QDISC_MQPRIO
#else /* >= 4,15,0 */
#define HAVE_TC_CB_AND_SETUP_QDISC_MQPRIO
#endif /* 4,15,0 */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,16,0))
#define NEED_TC_CLS_CAN_OFFLOAD_AND_CHAIN0
#else /* >= 4,16,0 */
#endif /* 4,16,0 */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,18,0))
#define NEED_MACVLAN_ACCEL_PRIV
#define NEED_MACVLAN_RELEASE_L2FW_OFFLOAD
#define NEED_MACVLAN_SUPPORTS_DEST_FILTER
#else /* >= 4,18,0 */
#define HAVE_DEVLINK_PORT_ATTRS_SET_PORT_FLAVOUR
#endif /* 4,18,0 */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,19,0))
#else /* >= 4,19,0 */
#undef HAVE_TCF_EXTS_TO_LIST
#define HAVE_TCF_EXTS_FOR_EACH_ACTION
#endif /* 4,19,0 */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0))
#else /* >= 5.2.0 */
#define HAVE_DEVLINK_PORT_ATTRS_SET_SWITCH_ID
#endif /* 5.2.0 */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,3,0))
#define NEED_DEVLINK_FLASH_UPDATE_STATUS_NOTIFY
#else /* >= 5.3.0 */
#endif /* 5.3.0 */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,7,0))
#define NEED_DEVLINK_REGION_CREATE_OPS
#else /* >= 5.7.0 */
#endif /* 5.7.0 */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0))
#define NEED_SKB_FRAG_OFF_ACCESSORS
#define NEED_FLOW_INDR_BLOCK_CB_REGISTER
#else /* >= 5.4.0 */
#endif /* 5.4.0 */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0))
#define NEED_DEVLINK_PORT_ATTRS_SET_STRUCT
#define HAVE_XDP_QUERY_PROG
#else /* >= 5.9.0 */
#endif /* 5.9.0 */
/*****************************************************************************/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0))
#define NEED_NET_PREFETCH
#define NEED_DEVLINK_FLASH_UPDATE_TIMEOUT_NOTIFY
#else /* >= 5.10.0 */
#endif /* 5.10.0 */
#endif /* _KCOMPAT_STD_DEFS_H_ */

View File

@ -0,0 +1,28 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2013, Intel Corporation. */
#ifndef _KCOMPAT_UBUNTU_DEFS_H_
#define _KCOMPAT_UBUNTU_DEFS_H_
/* This file contains the definitions for the Ubuntu specific distribution of
* the Linux kernel.
*
* It checks the UBUNTU_VERSION_CODE to decide which features are available in
* the target kernel. It assumes that kcompat_std_defs.h has already been
* processed, and will #define or #undef the relevant flags based on what
* features were backported by Ubuntu.
*/
#if !UTS_UBUNTU_RELEASE_ABI
#error "UTS_UBUNTU_RELEASE_ABI is 0 or undefined"
#endif
#if !UBUNTU_VERSION_CODE
#error "UBUNTU_VERSION_CODE is 0 or undefined"
#endif
#ifndef UBUNTU_VERSION
#error "UBUNTU_VERSION is undefined"
#endif
#endif /* _KCOMPAT_UBUNTU_DEFS_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,11 @@
#define VFD_EGRESS_MIRROR_OFF -1
#define VFD_INGRESS_MIRROR_OFF -1
#define VFD_QUEUE_TYPE_RSS 0x00
#define VFD_QUEUE_TYPE_QOS 0x01
#define VFD_NUM_TC 0x8
/**
* struct vfd_objects - VF-d kobjects information struct
* @num_vfs: number of VFs allocated
@ -24,7 +29,30 @@
struct vfd_objects {
int num_vfs;
struct kobject *sriov_kobj;
struct kobject *vf_kobj[0];
struct vfd_vf_obj *vfs;
struct vfd_qos_objects *qos;
};
/**
* struct vfd_vf_obj - VF-d VF kobjects information struct
* @vf_kobj: pointer to VF qos kobject
* @vf_qos_kobj: pointer to VF kobject
* @vf_tc_kobj: pointer to VF TC kobjects
*/
struct vfd_vf_obj {
struct kobject *vf_qos_kobj;
struct kobject *vf_kobj;
struct kobject *vf_tc_kobjs[VFD_NUM_TC];
};
/**
* struct vfd_qos_objects - VF-d qos kobjects information struct
* @qos_kobj: pointer to PF qos kobject
* @pf_qos_kobj: pointer to PF TC kobjects
*/
struct vfd_qos_objects {
struct kobject *qos_kobj;
struct kobject *pf_qos_kobjs[VFD_NUM_TC];
};
struct vfd_macaddr {
@ -134,6 +162,26 @@ struct vfd_ops {
int (*set_num_queues)(struct pci_dev *pdev, int vf_id, const int num_queues);
int (*get_trust_state)(struct pci_dev *pdev, int vf_id, bool *data);
int (*set_trust_state)(struct pci_dev *pdev, int vf_id, bool data);
int (*get_queue_type)(struct pci_dev *pdev, int vf_id, u8 *data);
int (*set_queue_type)(struct pci_dev *pdev, int vf_id, const u8 data);
int (*get_allow_bcast)(struct pci_dev *pdev, int vf_id, bool *data);
int (*set_allow_bcast)(struct pci_dev *pdev, int vf_id, const bool data);
int (*get_pf_qos_tc_max_bw)(struct pci_dev *pdev, int tc, u16 *req_bw);
int (*set_pf_qos_tc_max_bw)(struct pci_dev *pdev, int tc, u16 req_bw);
int (*get_pf_qos_tc_lsp)(struct pci_dev *pdev, int tc, bool *on);
int (*set_pf_qos_tc_lsp)(struct pci_dev *pdev, int tc, bool on);
int (*get_pf_qos_tc_priority)(struct pci_dev *pdev, int tc,
char *tc_bitmap);
int (*set_pf_qos_tc_priority)(struct pci_dev *pdev, int tc,
char tc_bitmap);
int (*get_vf_qos_tc_share)(struct pci_dev *pdev, int vf_id, int tc,
u8 *share);
int (*set_vf_qos_tc_share)(struct pci_dev *pdev, int vf_id, int tc,
u8 share);
int (*get_vf_max_tc_tx_rate)(struct pci_dev *pdev, int vf_id, int tc,
int *rate);
int (*set_vf_max_tc_tx_rate)(struct pci_dev *pdev, int vf_id, int tc,
int rate);
};
extern const struct vfd_ops *vfd_ops;

File diff suppressed because it is too large Load Diff

View File

@ -10,8 +10,11 @@
#define VIRTCHNL_IPSEC_MAX_CRYPTO_ITEM_NUMBER 2
#define VIRTCHNL_IPSEC_MAX_KEY_LEN 128
#define VIRTCHNL_IPSEC_MAX_SA_DESTROY_NUM 8
#define VIRTCHNL_IPSEC_SELECTED_SA_DESTROY 0
#define VIRTCHNL_IPSEC_ALL_SA_DESTROY 1
#define VIRTCHNL_IPSEC_SA_DESTROY 0
#define VIRTCHNL_IPSEC_BROADCAST_VFID 0xFFFFFFFF
#define VIRTCHNL_IPSEC_INVALID_REQ_ID 0xFFFF
#define VIRTCHNL_IPSEC_INVALID_SA_CFG_RESP 0xFFFFFFFF
#define VIRTCHNL_IPSEC_INVALID_SP_CFG_RESP 0xFFFFFFFF
/* crypto type */
#define VIRTCHNL_AUTH 1
@ -20,7 +23,7 @@
/* algorithm type */
/* Hash Algorithm */
#define VIRTCHNL_NO_ALG 0 /* NULL algorithm */
#define VIRTCHNL_HASH_NO_ALG 0 /* NULL algorithm */
#define VIRTCHNL_AES_CBC_MAC 1 /* AES-CBC-MAC algorithm */
#define VIRTCHNL_AES_CMAC 2 /* AES CMAC algorithm */
#define VIRTCHNL_AES_GMAC 3 /* AES GMAC algorithm */
@ -36,13 +39,14 @@
#define VIRTCHNL_SHA3_384_HMAC 13 /* HMAC using 384 bit SHA3 algorithm */
#define VIRTCHNL_SHA3_512_HMAC 14 /* HMAC using 512 bit SHA3 algorithm */
/* Cipher Algorithm */
#define VIRTCHNL_3DES_CBC 15 /* Triple DES algorithm in CBC mode */
#define VIRTCHNL_AES_CBC 16 /* AES algorithm in CBC mode */
#define VIRTCHNL_AES_CTR 17 /* AES algorithm in Counter mode */
#define VIRTCHNL_CIPHER_NO_ALG 15 /* NULL algorithm */
#define VIRTCHNL_3DES_CBC 16 /* Triple DES algorithm in CBC mode */
#define VIRTCHNL_AES_CBC 17 /* AES algorithm in CBC mode */
#define VIRTCHNL_AES_CTR 18 /* AES algorithm in Counter mode */
/* AEAD Algorithm */
#define VIRTCHNL_AES_CCM 18 /* AES algorithm in CCM mode */
#define VIRTCHNL_AES_GCM 19 /* AES algorithm in GCM mode */
#define VIRTCHNL_CHACHA20_POLY1305 20 /* algorithm of ChaCha20-Poly1305 */
#define VIRTCHNL_AES_CCM 19 /* AES algorithm in CCM mode */
#define VIRTCHNL_AES_GCM 20 /* AES algorithm in GCM mode */
#define VIRTCHNL_CHACHA20_POLY1305 21 /* algorithm of ChaCha20-Poly1305 */
/* protocol type */
#define VIRTCHNL_PROTO_ESP 1
@ -68,6 +72,31 @@
#define VIRTCHNL_IPV4 1
#define VIRTCHNL_IPV6 2
/* for virtchnl_ipsec_resp */
enum inline_ipsec_resp {
INLINE_IPSEC_SUCCESS = 0,
INLINE_IPSEC_FAIL = -1,
INLINE_IPSEC_ERR_FIFO_FULL = -2,
INLINE_IPSEC_ERR_NOT_READY = -3,
INLINE_IPSEC_ERR_VF_DOWN = -4,
INLINE_IPSEC_ERR_INVALID_PARAMS = -5,
INLINE_IPSEC_ERR_NO_MEM = -6,
};
/* Detailed opcodes for DPDK and IPsec use */
enum inline_ipsec_ops {
INLINE_IPSEC_OP_GET_CAP = 0,
INLINE_IPSEC_OP_GET_STATUS = 1,
INLINE_IPSEC_OP_SA_CREATE = 2,
INLINE_IPSEC_OP_SA_UPDATE = 3,
INLINE_IPSEC_OP_SA_DESTROY = 4,
INLINE_IPSEC_OP_SP_CREATE = 5,
INLINE_IPSEC_OP_SP_DESTROY = 6,
INLINE_IPSEC_OP_SA_READ = 7,
INLINE_IPSEC_OP_EVENT = 8,
INLINE_IPSEC_OP_RESP = 9,
};
/* Not all valid, if certain field is invalid, set 1 for all bits */
struct virtchnl_algo_cap {
u32 algo_type;
@ -89,7 +118,7 @@ struct virtchnl_algo_cap {
u16 min_aad_size;
u16 max_aad_size;
u16 inc_aad_size;
};
} __packed;
/* vf record the capability of crypto from the virtchnl */
struct virtchnl_sym_crypto_cap {
@ -149,17 +178,6 @@ struct virtchnl_ipsec_cap {
struct virtchnl_sym_crypto_cap cap[VIRTCHNL_IPSEC_MAX_CRYPTO_CAP_NUM];
};
/* using desc_id to record the format of rx descriptor */
struct virtchnl_rx_desc_fmt {
u16 desc_id;
};
/* using desc_id to record the format of tx descriptor */
struct virtchnl_tx_desc_fmt {
u8 desc_num;
u16 desc_ids[VIRTCHNL_IPSEC_MAX_TX_DESC_NUM];
};
/* configuration of crypto function */
struct virtchnl_ipsec_crypto_cfg_item {
u8 crypto_type;
@ -172,12 +190,15 @@ struct virtchnl_ipsec_crypto_cfg_item {
/* Length of digest */
u16 digest_len;
/* SA salt */
u32 salt;
/* The length of the symmetric key */
u16 key_len;
/* key data buffer */
u8 key_data[VIRTCHNL_IPSEC_MAX_KEY_LEN];
};
} __packed;
struct virtchnl_ipsec_sym_crypto_cfg {
struct virtchnl_ipsec_crypto_cfg_item
@ -220,9 +241,6 @@ struct virtchnl_ipsec_sa_cfg {
/* outer dst ip address */
u8 dst_addr[16];
/* SA salt */
u32 salt;
/* SPD reference. Used to link an SA with its policy.
* PF drivers may ignore this field.
*/
@ -281,7 +299,7 @@ struct virtchnl_ipsec_sa_cfg {
/* crypto configuration */
struct virtchnl_ipsec_sym_crypto_cfg crypto_cfg;
};
} __packed;
/* VIRTCHNL_OP_IPSEC_SA_UPDATE
* VF send configuration of index of SA to PF
@ -300,17 +318,15 @@ struct virtchnl_ipsec_sa_update {
* be destroyed
*/
struct virtchnl_ipsec_sa_destroy {
/* VIRTCHNL_SELECTED_SA_DESTROY: selected SA will be destroyed.
* VIRTCHNL_ALL_SA_DESTROY: all SA will be destroyed.
/* All zero bitmap indicates all SA will be destroyed.
* Non-zero bitmap indicates the selected SA in
* array sa_index will be destroyed.
*/
u8 flag;
u8 pad1; /* pading */
u16 pad2; /* pading */
/* selected SA index */
u32 sa_index[VIRTCHNL_IPSEC_MAX_SA_DESTROY_NUM];
};
} __packed;
/* VIRTCHNL_OP_IPSEC_SA_READ
* VF send this SA configuration to PF using virtchnl;
@ -415,6 +431,125 @@ struct virtchnl_ipsec_sa_read {
/* crypto configuration. Salt and keys are set to 0 */
struct virtchnl_ipsec_sym_crypto_cfg crypto_cfg;
} __packed;
/* Add allowlist entry in IES */
struct virtchnl_ipsec_sp_cfg {
u32 spi;
u32 dip[4];
/* Drop frame if true or redirect to QAT if false. */
u8 drop;
/* Congestion domain. For future use. */
u8 cgd;
/* 0 for IPv4 table, 1 for IPv6 table. */
u8 table_id;
/* Set TC (congestion domain) if true. For future use. */
u8 set_tc;
};
/* Delete allowlist entry in IES */
struct virtchnl_ipsec_sp_destroy {
/* 0 for IPv4 table, 1 for IPv6 table. */
u8 table_id;
u32 rule_id;
} __packed;
/* Response from IES to allowlist operations */
struct virtchnl_ipsec_sp_cfg_resp {
u32 rule_id;
};
struct virtchnl_ipsec_sa_cfg_resp {
u32 sa_handle;
};
#define INLINE_IPSEC_EVENT_RESET 0x1
#define INLINE_IPSEC_EVENT_CRYPTO_ON 0x2
#define INLINE_IPSEC_EVENT_CRYPTO_OFF 0x4
struct virtchnl_ipsec_event {
u32 ipsec_event_data;
};
#define INLINE_IPSEC_STATUS_AVAILABLE 0x1
#define INLINE_IPSEC_STATUS_UNAVAILABLE 0x2
struct virtchnl_ipsec_status {
u32 status;
};
struct virtchnl_ipsec_resp {
u32 resp;
};
/* Internal message descriptor for VF <-> IPsec communication */
struct inline_ipsec_msg {
u16 ipsec_opcode;
u16 req_id;
union {
/* IPsec request */
struct virtchnl_ipsec_sa_cfg sa_cfg[0];
struct virtchnl_ipsec_sp_cfg sp_cfg[0];
struct virtchnl_ipsec_sa_update sa_update[0];
struct virtchnl_ipsec_sa_destroy sa_destroy[0];
struct virtchnl_ipsec_sp_destroy sp_destroy[0];
/* IPsec response */
struct virtchnl_ipsec_sa_cfg_resp sa_cfg_resp[0];
struct virtchnl_ipsec_sp_cfg_resp sp_cfg_resp[0];
struct virtchnl_ipsec_cap ipsec_cap[0];
struct virtchnl_ipsec_status ipsec_status[0];
/* response to del_sa, del_sp, update_sa */
struct virtchnl_ipsec_resp ipsec_resp[0];
/* IPsec event (no req_id is required) */
struct virtchnl_ipsec_event event[0];
/* Reserved */
struct virtchnl_ipsec_sa_read sa_read[0];
} ipsec_data;
};
static inline u16 virtchnl_inline_ipsec_val_msg_len(u16 opcode)
{
u16 valid_len = sizeof(struct inline_ipsec_msg);
switch (opcode) {
case INLINE_IPSEC_OP_GET_CAP:
case INLINE_IPSEC_OP_GET_STATUS:
break;
case INLINE_IPSEC_OP_SA_CREATE:
valid_len += sizeof(struct virtchnl_ipsec_sa_cfg);
break;
case INLINE_IPSEC_OP_SP_CREATE:
valid_len += sizeof(struct virtchnl_ipsec_sp_cfg);
break;
case INLINE_IPSEC_OP_SA_UPDATE:
valid_len += sizeof(struct virtchnl_ipsec_sa_update);
break;
case INLINE_IPSEC_OP_SA_DESTROY:
valid_len += sizeof(struct virtchnl_ipsec_sa_destroy);
break;
case INLINE_IPSEC_OP_SP_DESTROY:
valid_len += sizeof(struct virtchnl_ipsec_sp_destroy);
break;
/* Only for msg length caculation of response to VF in case of
* inline ipsec failure.
*/
case INLINE_IPSEC_OP_RESP:
valid_len += sizeof(struct virtchnl_ipsec_resp);
break;
default:
valid_len = 0;
break;
}
return valid_len;
}
#endif /* _VIRTCHNL_INLINE_IPSEC_H_ */

View File

@ -0,0 +1,525 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2013, Intel Corporation. */
/*
* Copyright (C) 2019 Intel Corporation
*
* For licensing information, see the file 'LICENSE' in the root folder
*/
#ifndef _VIRTCHNL_LAN_DESC_H_
#define _VIRTCHNL_LAN_DESC_H_
/* Rx */
/* For virtchnl_splitq_base_rx_flex desc members */
#define VIRTCHNL_RXD_FLEX_PTYPE_S 0
#define VIRTCHNL_RXD_FLEX_PTYPE_M \
MAKEMASK(0x3FFUL, VIRTCHNL_RXD_FLEX_PTYPE_S)
#define VIRTCHNL_RXD_FLEX_UMBCAST_S 10
#define VIRTCHNL_RXD_FLEX_UMBCAST_M \
MAKEMASK(0x3UL, VIRTCHNL_RXD_FLEX_UMBCAST_S)
#define VIRTCHNL_RXD_FLEX_FF0_S 12
#define VIRTCHNL_RXD_FLEX_FF0_M MAKEMASK(0xFUL, VIRTCHNL_RXD_FLEX_FF0_S)
#define VIRTCHNL_RXD_FLEX_LEN_PBUF_S 0
#define VIRTCHNL_RXD_FLEX_LEN_PBUF_M \
MAKEMASK(0x3FFFUL, VIRTCHNL_RXD_FLEX_LEN_PBUF_S)
#define VIRTCHNL_RXD_FLEX_GEN_S 14
#define VIRTCHNL_RXD_FLEX_GEN_M BIT_ULL(VIRTCHNL_RXD_FLEX_GEN_S)
#define VIRTCHNL_RXD_FLEX_BUFQ_ID_S 15
#define VIRTCHNL_RXD_FLEX_BUFQ_ID_M \
BIT_ULL(VIRTCHNL_RXD_FLEX_BUFQ_ID_S)
#define VIRTCHNL_RXD_FLEX_LEN_HDR_S 0
#define VIRTCHNL_RXD_FLEX_LEN_HDR_M \
MAKEMASK(0x3FFUL, VIRTCHNL_RXD_FLEX_LEN_HDR_S)
#define VIRTCHNL_RXD_FLEX_RSC_S 10
#define VIRTCHNL_RXD_FLEX_RSC_M BIT_ULL(VIRTCHNL_RXD_FLEX_RSC_S)
#define VIRTCHNL_RXD_FLEX_SPH_S 11
#define VIRTCHNL_RXD_FLEX_SPH_M BIT_ULL(VIRTCHNL_RXD_FLEX_SPH_S)
#define VIRTCHNL_RXD_FLEX_MISS_S 12
#define VIRTCHNL_RXD_FLEX_MISS_M \
BIT_ULL(VIRTCHNL_RXD_FLEX_MISS_S)
#define VIRTCHNL_RXD_FLEX_FF1_S 13
#define VIRTCHNL_RXD_FLEX_FF1_M MAKEMASK(0x7UL, VIRTCHNL_RXD_FLEX_FF1_M)
/* For virtchnl_singleq_base_rx_legacy desc members */
#define VIRTCHNL_RXD_QW1_LEN_SPH_S 63
#define VIRTCHNL_RXD_QW1_LEN_SPH_M BIT_ULL(VIRTCHNL_RXD_QW1_LEN_SPH_S)
#define VIRTCHNL_RXD_QW1_LEN_HBUF_S 52
#define VIRTCHNL_RXD_QW1_LEN_HBUF_M \
MAKEMASK(0x7FFULL, VIRTCHNL_RXD_QW1_LEN_HBUF_S)
#define VIRTCHNL_RXD_QW1_LEN_PBUF_S 38
#define VIRTCHNL_RXD_QW1_LEN_PBUF_M \
MAKEMASK(0x3FFFULL, VIRTCHNL_RXD_QW1_LEN_PBUF_S)
#define VIRTCHNL_RXD_QW1_PTYPE_S 30
#define VIRTCHNL_RXD_QW1_PTYPE_M \
MAKEMASK(0xFFULL, VIRTCHNL_RXD_QW1_PTYPE_S)
#define VIRTCHNL_RXD_QW1_ERROR_S 19
#define VIRTCHNL_RXD_QW1_ERROR_M \
MAKEMASK(0xFFUL, VIRTCHNL_RXD_QW1_ERROR_S)
#define VIRTCHNL_RXD_QW1_STATUS_S 0
#define VIRTCHNL_RXD_QW1_STATUS_M \
MAKEMASK(0x7FFFFUL, VIRTCHNL_RXD_QW1_STATUS_S)
enum virtchnl_rx_flex_desc_status_error_0_qw1_bits {
/* Note: These are predefined bit offsets */
VIRTCHNL_RX_FLEX_DESC_STATUS0_DD_S = 0,
VIRTCHNL_RX_FLEX_DESC_STATUS0_EOF_S,
VIRTCHNL_RX_FLEX_DESC_STATUS0_HBO_S,
VIRTCHNL_RX_FLEX_DESC_STATUS0_L3L4P_S,
VIRTCHNL_RX_FLEX_DESC_STATUS0_XSUM_IPE_S,
VIRTCHNL_RX_FLEX_DESC_STATUS0_XSUM_L4E_S,
VIRTCHNL_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S,
VIRTCHNL_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S,
};
enum virtchnl_rx_flex_desc_status_error_0_qw0_bits {
VIRTCHNL_RX_FLEX_DESC_STATUS0_LPBK_S = 0,
VIRTCHNL_RX_FLEX_DESC_STATUS0_IPV6EXADD_S,
VIRTCHNL_RX_FLEX_DESC_STATUS0_RXE_S,
VIRTCHNL_RX_FLEX_DESC_STATUS0_CRCP_S,
VIRTCHNL_RX_FLEX_DESC_STATUS0_RSS_VALID_S,
VIRTCHNL_RX_FLEX_DESC_STATUS0_L2TAG1P_S,
VIRTCHNL_RX_FLEX_DESC_STATUS0_XTRMD0_VALID_S,
VIRTCHNL_RX_FLEX_DESC_STATUS0_XTRMD1_VALID_S,
VIRTCHNL_RX_FLEX_DESC_STATUS0_LAST /* this entry must be last!!! */
};
enum virtchnl_rx_flex_desc_status_error_1_bits {
/* Note: These are predefined bit offsets */
VIRTCHNL_RX_FLEX_DESC_STATUS1_RSVD_S = 0, /* 2 bits */
VIRTCHNL_RX_FLEX_DESC_STATUS1_ATRAEFAIL_S = 2,
VIRTCHNL_RX_FLEX_DESC_STATUS1_L2TAG2P_S = 3,
VIRTCHNL_RX_FLEX_DESC_STATUS1_XTRMD2_VALID_S = 4,
VIRTCHNL_RX_FLEX_DESC_STATUS1_XTRMD3_VALID_S = 5,
VIRTCHNL_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S = 6,
VIRTCHNL_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S = 7,
VIRTCHNL_RX_FLEX_DESC_STATUS1_LAST /* this entry must be last!!! */
};
enum virtchnl_rx_base_desc_status_bits {
/* Note: These are predefined bit offsets */
VIRTCHNL_RX_BASE_DESC_STATUS_DD_S = 0,
VIRTCHNL_RX_BASE_DESC_STATUS_EOF_S = 1,
VIRTCHNL_RX_BASE_DESC_STATUS_L2TAG1P_S = 2,
VIRTCHNL_RX_BASE_DESC_STATUS_L3L4P_S = 3,
VIRTCHNL_RX_BASE_DESC_STATUS_CRCP_S = 4,
VIRTCHNL_RX_BASE_DESC_STATUS_RSVD_S = 5, /* 3 BITS */
VIRTCHNL_RX_BASE_DESC_STATUS_EXT_UDP_0_S = 8,
VIRTCHNL_RX_BASE_DESC_STATUS_UMBCAST_S = 9, /* 2 BITS */
VIRTCHNL_RX_BASE_DESC_STATUS_FLM_S = 11,
VIRTCHNL_RX_BASE_DESC_STATUS_FLTSTAT_S = 12, /* 2 BITS */
VIRTCHNL_RX_BASE_DESC_STATUS_LPBK_S = 14,
VIRTCHNL_RX_BASE_DESC_STATUS_IPV6EXADD_S = 15,
VIRTCHNL_RX_BASE_DESC_STATUS_RSVD1_S = 16, /* 2 BITS */
VIRTCHNL_RX_BASE_DESC_STATUS_INT_UDP_0_S = 18,
VIRTCHNL_RX_BASE_DESC_STATUS_LAST /* this entry must be last!!! */
};
enum virtchnl_rx_desc_fltstat_values {
VIRTCHNL_RX_DESC_FLTSTAT_NO_DATA = 0,
VIRTCHNL_RX_DESC_FLTSTAT_RSV_FD_ID = 1, /* 16byte desc? FD_ID : RSV */
VIRTCHNL_RX_DESC_FLTSTAT_RSV = 2,
VIRTCHNL_RX_DESC_FLTSTAT_RSS_HASH = 3,
};
enum virtchnl_rx_base_desc_error_bits {
/* Note: These are predefined bit offsets */
VIRTCHNL_RX_BASE_DESC_ERROR_RXE_S = 0,
VIRTCHNL_RX_BASE_DESC_ERROR_ATRAEFAIL_S = 1,
VIRTCHNL_RX_BASE_DESC_ERROR_HBO_S = 2,
VIRTCHNL_RX_BASE_DESC_ERROR_L3L4E_S = 3, /* 3 BITS */
VIRTCHNL_RX_BASE_DESC_ERROR_IPE_S = 3,
VIRTCHNL_RX_BASE_DESC_ERROR_L4E_S = 4,
VIRTCHNL_RX_BASE_DESC_ERROR_EIPE_S = 5,
VIRTCHNL_RX_BASE_DESC_ERROR_OVERSIZE_S = 6,
VIRTCHNL_RX_BASE_DESC_ERROR_RSVD_S = 7
};
/* Receive Descriptors */
/* splitq buf
| 16| 0|
----------------------------------------------------------------
| RSV | Buffer ID |
----------------------------------------------------------------
| Rx packet buffer adresss |
----------------------------------------------------------------
| Rx header buffer adresss |
----------------------------------------------------------------
| RSV |
----------------------------------------------------------------
| 0|
*/
struct virtchnl_splitq_rx_buf_desc {
struct {
__le16 buf_id; /* Buffer Identifier */
__le16 rsvd0;
__le32 rsvd1;
} qword0;
__le64 pkt_addr; /* Packet buffer address */
__le64 hdr_addr; /* Header buffer address */
__le64 rsvd2;
}; /* read used with buffer queues*/
/* singleq buf
| 0|
----------------------------------------------------------------
| Rx packet buffer adresss |
----------------------------------------------------------------
| Rx header buffer adresss |
----------------------------------------------------------------
| RSV |
----------------------------------------------------------------
| RSV |
----------------------------------------------------------------
| 0|
*/
struct virtchnl_singleq_rx_buf_desc {
__le64 pkt_addr; /* Packet buffer address */
__le64 hdr_addr; /* Header buffer address */
__le64 rsvd1;
__le64 rsvd2;
}; /* read used with buffer queues*/
union virtchnl_rx_buf_desc {
struct virtchnl_singleq_rx_buf_desc read;
struct virtchnl_splitq_rx_buf_desc split_rd;
};
/* (0x00) singleq wb(compl) */
struct virtchnl_singleq_base_rx_desc {
struct {
struct {
__le16 mirroring_status;
__le16 l2tag1;
} lo_dword;
union {
__le32 rss; /* RSS Hash */
__le32 fd_id; /* Flow Director filter id */
} hi_dword;
} qword0;
struct {
/* status/error/PTYPE/length */
__le64 status_error_ptype_len;
} qword1;
struct {
__le16 ext_status; /* extended status */
__le16 rsvd;
__le16 l2tag2_1;
__le16 l2tag2_2;
} qword2;
struct {
__le32 reserved;
__le32 fd_id;
} qword3;
}; /* writeback */
/* (0x01) singleq flex compl */
struct virtchnl_rx_flex_desc {
/* Qword 0 */
u8 rxdid; /* descriptor builder profile id */
u8 mir_id_umb_cast; /* mirror=[5:0], umb=[7:6] */
__le16 ptype_flex_flags0; /* ptype=[9:0], ff0=[15:10] */
__le16 pkt_len; /* [15:14] are reserved */
__le16 hdr_len_sph_flex_flags1; /* header=[10:0] */
/* sph=[11:11] */
/* ff1/ext=[15:12] */
/* Qword 1 */
__le16 status_error0;
__le16 l2tag1;
__le16 flex_meta0;
__le16 flex_meta1;
/* Qword 2 */
__le16 status_error1;
u8 flex_flags2;
u8 time_stamp_low;
__le16 l2tag2_1st;
__le16 l2tag2_2nd;
/* Qword 3 */
__le16 flex_meta2;
__le16 flex_meta3;
union {
struct {
__le16 flex_meta4;
__le16 flex_meta5;
} flex;
__le32 ts_high;
} flex_ts;
};
/* (0x02) */
struct virtchnl_rx_flex_desc_nic {
/* Qword 0 */
u8 rxdid;
u8 mir_id_umb_cast;
__le16 ptype_flexi_flags0;
__le16 pkt_len;
__le16 hdr_len_sph_flex_flags1;
/* Qword 1 */
__le16 status_error0;
__le16 l2tag1;
__le32 rss_hash;
/* Qword 2 */
__le16 status_error1;
u8 flexi_flags2;
u8 ts_low;
__le16 l2tag2_1st;
__le16 l2tag2_2nd;
/* Qword 3 */
__le32 flow_id;
union {
struct {
__le16 rsvd;
__le16 flow_id_ipv6;
} flex;
__le32 ts_high;
} flex_ts;
};
/* Rx Flex Descriptor Switch Profile
* RxDID Profile Id 3
* Flex-field 0: Source Vsi
*/
struct virtchnl_rx_flex_desc_sw {
/* Qword 0 */
u8 rxdid;
u8 mir_id_umb_cast;
__le16 ptype_flexi_flags0;
__le16 pkt_len;
__le16 hdr_len_sph_flex_flags1;
/* Qword 1 */
__le16 status_error0;
__le16 l2tag1;
__le16 src_vsi; /* [10:15] are reserved */
__le16 flex_md1_rsvd;
/* Qword 2 */
__le16 status_error1;
u8 flex_flags2;
u8 ts_low;
__le16 l2tag2_1st;
__le16 l2tag2_2nd;
/* Qword 3 */
__le32 rsvd; /* flex words 2-3 are reserved */
__le32 ts_high;
};
/* Rx Flex Descriptor NIC VEB Profile
* RxDID Profile Id 4
* Flex-field 0: Destination Vsi
*/
struct virtchnl_rx_flex_desc_nic_veb_dbg {
/* Qword 0 */
u8 rxdid;
u8 mir_id_umb_cast;
__le16 ptype_flexi_flags0;
__le16 pkt_len;
__le16 hdr_len_sph_flex_flags1;
/* Qword 1 */
__le16 status_error0;
__le16 l2tag1;
__le16 dst_vsi; /* [0:12]: destination vsi */
/* 13: vsi valid bit */
/* [14:15] are reserved */
__le16 flex_field_1;
/* Qword 2 */
__le16 status_error1;
u8 flex_flags2;
u8 ts_low;
__le16 l2tag2_1st;
__le16 l2tag2_2nd;
/* Qword 3 */
__le32 rsvd; /* flex words 2-3 are reserved */
__le32 ts_high;
};
/* Rx Flex Descriptor NIC ACL Profile
* RxDID Profile Id 5
* Flex-field 0: ACL Counter 0
* Flex-field 1: ACL Counter 1
* Flex-field 2: ACL Counter 2
*/
struct virtchnl_rx_flex_desc_nic_acl_dbg {
/* Qword 0 */
u8 rxdid;
u8 mir_id_umb_cast;
__le16 ptype_flexi_flags0;
__le16 pkt_len;
__le16 hdr_len_sph_flex_flags1;
/* Qword 1 */
__le16 status_error0;
__le16 l2tag1;
__le16 acl_ctr0;
__le16 acl_ctr1;
/* Qword 2 */
__le16 status_error1;
u8 flex_flags2;
u8 ts_low;
__le16 l2tag2_1st;
__le16 l2tag2_2nd;
/* Qword 3 */
__le16 acl_ctr2;
__le16 rsvd; /* flex words 2-3 are reserved */
__le32 ts_high;
};
/* Rx Flex Descriptor NIC Profile
* RxDID Profile Id 6
* Flex-field 0: RSS hash lower 16-bits
* Flex-field 1: RSS hash upper 16-bits
* Flex-field 2: Flow Id lower 16-bits
* Flex-field 3: Source Vsi
* Flex-field 4: reserved, Vlan id taken from L2Tag
*/
struct virtchnl_rx_flex_desc_nic_2 {
/* Qword 0 */
u8 rxdid;
u8 mir_id_umb_cast;
__le16 ptype_flexi_flags0;
__le16 pkt_len;
__le16 hdr_len_sph_flex_flags1;
/* Qword 1 */
__le16 status_error0;
__le16 l2tag1;
__le32 rss_hash;
/* Qword 2 */
__le16 status_error1;
u8 flexi_flags2;
u8 ts_low;
__le16 l2tag2_1st;
__le16 l2tag2_2nd;
/* Qword 3 */
__le16 flow_id;
__le16 src_vsi;
union {
struct {
__le16 rsvd;
__le16 flow_id_ipv6;
} flex;
__le32 ts_high;
} flex_ts;
};
/* Rx Flex Descriptor Advanced (Split Queue Model)
* RxDID Profile Id 7
*/
struct virtchnl_rx_flex_desc_adv {
/* Qword 0 */
u8 rxdid_ucast; /* profile_id=[3:0] */
/* rsvd=[5:4] */
/* ucast=[7:6] */
u8 status_err0_qw0;
__le16 ptype_err_fflags0; /* ptype=[9:0] */
/* ip_hdr_err=[10:10] */
/* udp_len_err=[11:11] */
/* ff0=[15:12] */
__le16 pktlen_gen_bufq_id; /* plen=[13:0] */
/* gen=[14:14] only in splitq */
/* bufq_id=[15:15] only in splitq */
__le16 hdrlen_flags; /* header=[9:0] */
/* rsc=[10:10] only in splitq */
/* sph=[11:11] only in splitq */
/* ext_udp_0=[12:12] */
/* int_udp_0=[13:13] */
/* trunc_mirr=[14:14] */
/* miss_prepend=[15:15] */
/* Qword 1 */
u8 status_err0_qw1;
u8 status_err1;
u8 fflags1;
u8 ts_low;
__le16 fmd0;
__le16 fmd1;
/* Qword 2 */
__le16 fmd2;
u8 fflags2;
u8 hash3;
__le16 fmd3;
__le16 fmd4;
/* Qword 3 */
__le16 fmd5;
__le16 fmd6;
__le16 fmd7_0;
__le16 fmd7_1;
}; /* writeback */
/* Rx Flex Descriptor Advanced (Split Queue Model) NIC Profile
* RxDID Profile Id 8
* Flex-field 0: BufferID
* Flex-field 1: Raw checksum/L2TAG1/RSC Seg Len (determined by HW)
* Flex-field 2: Hash[15:0]
* Flex-flags 2: Hash[23:16]
* Flex-field 3: L2TAG2
* Flex-field 5: L2TAG1
* Flex-field 7: Timestamp (upper 32 bits)
*/
struct virtchnl_rx_flex_desc_adv_nic_3 {
/* Qword 0 */
u8 rxdid_ucast; /* profile_id=[3:0] */
/* rsvd=[5:4] */
/* ucast=[7:6] */
u8 status_err0_qw0;
__le16 ptype_err_fflags0; /* ptype=[9:0] */
/* ip_hdr_err=[10:10] */
/* udp_len_err=[11:11] */
/* ff0=[15:12] */
__le16 pktlen_gen_bufq_id; /* plen=[13:0] */
/* gen=[14:14] only in splitq */
/* bufq_id=[15:15] only in splitq */
__le16 hdrlen_flags; /* header=[9:0] */
/* rsc=[10:10] only in splitq */
/* sph=[11:11] only in splitq */
/* ext_udp_0=[12:12] */
/* int_udp_0=[13:13] */
/* trunc_mirr=[14:14] */
/* miss_prepend=[15:15] */
/* Qword 1 */
u8 status_err0_qw1;
u8 status_err1;
u8 fflags1;
u8 ts_low;
__le16 buf_id; /* only in splitq */
union {
__le16 raw_cs;
__le16 l2tag1;
__le16 rscseglen;
} misc;
/* Qword 2 */
__le16 hash1;
union {
u8 fflags2;
u8 mirrorid;
u8 hash2;
} ff2_mirrid_hash2;
u8 hash3;
__le16 l2tag2;
__le16 fmd4;
/* Qword 3 */
__le16 l2tag1;
__le16 fmd6;
__le32 ts_high;
}; /* writeback */
union virtchnl_rx_desc {
struct virtchnl_singleq_rx_buf_desc read;
struct virtchnl_singleq_base_rx_desc base_wb;
struct virtchnl_rx_flex_desc flex_wb;
struct virtchnl_rx_flex_desc_adv flex_wb_adv;
};
#endif /* _VIRTCHNL_LAN_DESC_H_ */