From 067fc67930613b9371744504f809b0c87c492560 Mon Sep 17 00:00:00 2001 From: Jesse Brandeburg Date: Sat, 15 Oct 2022 05:27:34 -0700 Subject: [PATCH] Intel official release 5.17.1 --- README | 2 +- SUMS | 125 +++++------ ixgbe.spec | 39 +++- src/common.mk | 23 +- src/ixgbe.h | 2 + src/ixgbe_main.c | 49 +++-- src/kcompat.c | 216 +++++++++++-------- src/kcompat.h | 165 +-------------- src/kcompat_defs.h | 2 + src/kcompat_impl.h | 436 ++++++++++++++++++++++++++++++++++++++ src/kcompat_oracle_defs.h | 37 ++++ src/kcompat_rhel_defs.h | 44 +++- src/kcompat_sles_defs.h | 27 ++- src/kcompat_std_defs.h | 58 ++++- 14 files changed, 879 insertions(+), 346 deletions(-) create mode 100644 src/kcompat_oracle_defs.h diff --git a/README b/README index f62cff5..9681924 100644 --- a/README +++ b/README @@ -304,7 +304,7 @@ Note: RPM functionality has only been tested in Red Hat distributions. NOTES: - To compile the driver on some kernel/arch combinations, you may need to install a package with the development version of libelf (e.g. libelf-dev, -libelf-devel, elfutilsl-libelf-devel). +libelf-devel, elfutils-libelf-devel). - When compiling an out-of-tree driver, details will vary by distribution. However, you will usually need a kernel-devel RPM or some RPM that provides the kernel headers at a minimum. The RPM kernel-devel will usually fill in the link diff --git a/SUMS b/SUMS index 030b988..e194876 100644 --- a/SUMS +++ b/SUMS @@ -1,62 +1,63 @@ -57879 9 ixgbe-5.16.5/scripts/set_irq_affinity -28051 28 ixgbe-5.16.5/src/ixgbe_fcoe.c -00245 32 ixgbe-5.16.5/src/ixgbe_param.c -34956 8 ixgbe-5.16.5/src/ixgbe_phy.h -50229 8 ixgbe-5.16.5/src/kcompat_sles_defs.h -00247 7 ixgbe-5.16.5/src/Makefile -41773 126 ixgbe-5.16.5/src/ixgbe_x550.c -61530 3 ixgbe-5.16.5/src/ixgbe_sriov.h -48938 2 ixgbe-5.16.5/src/ixgbe_x540.h -20148 29 ixgbe-5.16.5/src/kcompat_impl.h -51698 18 ixgbe-5.16.5/src/common.mk -15524 143 ixgbe-5.16.5/src/ixgbe_common.c -55396 71 ixgbe-5.16.5/src/ixgbe_phy.c -29027 30 ixgbe-5.16.5/src/ixgbe_mbx.c -14476 6 ixgbe-5.16.5/src/kcompat_rhel_defs.h -42384 374 ixgbe-5.16.5/src/ixgbe_main.c -46495 54 ixgbe-5.16.5/src/ixgbe_sriov.c -37769 5 ixgbe-5.16.5/src/ixgbe_x550.h -35540 76 ixgbe-5.16.5/src/ixgbe_82599.c -29968 4 ixgbe-5.16.5/src/ixgbe_dcb_82599.h -41704 137 ixgbe-5.16.5/src/ixgbe_ethtool.c -04826 17 ixgbe-5.16.5/src/ixgbe_dcb_82599.c -25858 2 ixgbe-5.16.5/src/ixgbe_82599.h -62975 7 ixgbe-5.16.5/src/ixgbe_debugfs.c -25264 39 ixgbe-5.16.5/src/ixgbe_lib.c -29738 30 ixgbe-5.16.5/src/ixgbe_x540.c -27557 3 ixgbe-5.16.5/src/ixgbe_txrx_common.h -40372 10 ixgbe-5.16.5/src/ixgbe_dcb_82598.c -17957 1 ixgbe-5.16.5/src/kcompat_gcc.h -33940 51 ixgbe-5.16.5/src/ixgbe_ptp.c -10919 47 ixgbe-5.16.5/src/ixgbe_api.c -13672 171 ixgbe-5.16.5/src/ixgbe_type.h -63969 10 ixgbe-5.16.5/src/ixgbe_api.h -20464 20 ixgbe-5.16.5/src/ixgbe_dcb.c -11416 7 ixgbe-5.16.5/src/ixgbe_common.h -53142 3 ixgbe-5.16.5/src/ixgbe_dcb_82598.h -09326 2 ixgbe-5.16.5/src/ixgbe_82598.h -48833 75 ixgbe-5.16.5/src/kcompat.c -05019 2 ixgbe-5.16.5/src/ixgbe_osdep2.h -14487 29 ixgbe-5.16.5/src/kcompat_ethtool.c -55592 23 ixgbe-5.16.5/src/ixgbe_dcb_nl.c -44001 2 ixgbe-5.16.5/src/kcompat_ubuntu_defs.h -18110 5 ixgbe-5.16.5/src/ixgbe_dcb.h -47955 10 ixgbe-5.16.5/src/kcompat_overflow.h -07223 8 ixgbe-5.16.5/src/ixgbe_mbx.h -09539 3 ixgbe-5.16.5/src/ixgbe_model.h -04527 6 ixgbe-5.16.5/src/ixgbe_osdep.h -47745 25 ixgbe-5.16.5/src/ixgbe_xsk.c -13782 39 ixgbe-5.16.5/src/ixgbe_82598.c -55412 25 ixgbe-5.16.5/src/ixgbe_procfs.c -03764 10 ixgbe-5.16.5/src/kcompat_std_defs.h -12190 1 ixgbe-5.16.5/src/Module.supported -51835 2 ixgbe-5.16.5/src/ixgbe_fcoe.h -52716 8 ixgbe-5.16.5/src/ixgbe_sysfs.c -18174 1 ixgbe-5.16.5/src/kcompat_defs.h -06322 40 ixgbe-5.16.5/src/ixgbe.h -38177 224 ixgbe-5.16.5/src/kcompat.h -61939 11 ixgbe-5.16.5/ixgbe.spec -45537 9 ixgbe-5.16.5/ixgbe.7 -20636 60 ixgbe-5.16.5/README -12529 18 ixgbe-5.16.5/COPYING -07471 7 ixgbe-5.16.5/pci.updates +52569 60 ixgbe-5.17.1/README +07471 7 ixgbe-5.17.1/pci.updates +29738 30 ixgbe-5.17.1/src/ixgbe_x540.c +55396 71 ixgbe-5.17.1/src/ixgbe_phy.c +28051 28 ixgbe-5.17.1/src/ixgbe_fcoe.c +46495 54 ixgbe-5.17.1/src/ixgbe_sriov.c +00247 7 ixgbe-5.17.1/src/Makefile +55412 25 ixgbe-5.17.1/src/ixgbe_procfs.c +48938 2 ixgbe-5.17.1/src/ixgbe_x540.h +14487 29 ixgbe-5.17.1/src/kcompat_ethtool.c +41704 137 ixgbe-5.17.1/src/ixgbe_ethtool.c +05019 2 ixgbe-5.17.1/src/ixgbe_osdep2.h +44001 2 ixgbe-5.17.1/src/kcompat_ubuntu_defs.h +12190 1 ixgbe-5.17.1/src/Module.supported +37769 5 ixgbe-5.17.1/src/ixgbe_x550.h +15524 143 ixgbe-5.17.1/src/ixgbe_common.c +47745 25 ixgbe-5.17.1/src/ixgbe_xsk.c +15415 12 ixgbe-5.17.1/src/kcompat_std_defs.h +53142 3 ixgbe-5.17.1/src/ixgbe_dcb_82598.h +03809 40 ixgbe-5.17.1/src/ixgbe.h +09326 2 ixgbe-5.17.1/src/ixgbe_82598.h +17957 1 ixgbe-5.17.1/src/kcompat_gcc.h +61530 3 ixgbe-5.17.1/src/ixgbe_sriov.h +04826 17 ixgbe-5.17.1/src/ixgbe_dcb_82599.c +63969 10 ixgbe-5.17.1/src/ixgbe_api.h +36173 2 ixgbe-5.17.1/src/kcompat_oracle_defs.h +33940 51 ixgbe-5.17.1/src/ixgbe_ptp.c +55592 23 ixgbe-5.17.1/src/ixgbe_dcb_nl.c +13672 171 ixgbe-5.17.1/src/ixgbe_type.h +51835 2 ixgbe-5.17.1/src/ixgbe_fcoe.h +56361 220 ixgbe-5.17.1/src/kcompat.h +52716 8 ixgbe-5.17.1/src/ixgbe_sysfs.c +34956 8 ixgbe-5.17.1/src/ixgbe_phy.h +20464 20 ixgbe-5.17.1/src/ixgbe_dcb.c +25858 2 ixgbe-5.17.1/src/ixgbe_82599.h +02164 1 ixgbe-5.17.1/src/kcompat_defs.h +29027 30 ixgbe-5.17.1/src/ixgbe_mbx.c +10919 47 ixgbe-5.17.1/src/ixgbe_api.c +29968 4 ixgbe-5.17.1/src/ixgbe_dcb_82599.h +04527 6 ixgbe-5.17.1/src/ixgbe_osdep.h +27557 3 ixgbe-5.17.1/src/ixgbe_txrx_common.h +43231 375 ixgbe-5.17.1/src/ixgbe_main.c +41773 126 ixgbe-5.17.1/src/ixgbe_x550.c +13782 39 ixgbe-5.17.1/src/ixgbe_82598.c +25264 39 ixgbe-5.17.1/src/ixgbe_lib.c +00245 32 ixgbe-5.17.1/src/ixgbe_param.c +11416 7 ixgbe-5.17.1/src/ixgbe_common.h +18110 5 ixgbe-5.17.1/src/ixgbe_dcb.h +07223 8 ixgbe-5.17.1/src/ixgbe_mbx.h +40372 10 ixgbe-5.17.1/src/ixgbe_dcb_82598.c +15740 7 ixgbe-5.17.1/src/kcompat_rhel_defs.h +09539 3 ixgbe-5.17.1/src/ixgbe_model.h +62975 7 ixgbe-5.17.1/src/ixgbe_debugfs.c +28203 75 ixgbe-5.17.1/src/kcompat.c +54118 42 ixgbe-5.17.1/src/kcompat_impl.h +35446 9 ixgbe-5.17.1/src/kcompat_sles_defs.h +47955 10 ixgbe-5.17.1/src/kcompat_overflow.h +20484 19 ixgbe-5.17.1/src/common.mk +35540 76 ixgbe-5.17.1/src/ixgbe_82599.c +56103 12 ixgbe-5.17.1/ixgbe.spec +57879 9 ixgbe-5.17.1/scripts/set_irq_affinity +45537 9 ixgbe-5.17.1/ixgbe.7 +12529 18 ixgbe-5.17.1/COPYING diff --git a/ixgbe.spec b/ixgbe.spec index 1f170e9..e261412 100644 --- a/ixgbe.spec +++ b/ixgbe.spec @@ -1,10 +1,10 @@ Name: ixgbe Summary: Intel(R) 10GbE PCI Express Linux Network Driver -Version: 5.16.5 +Version: 5.17.1 Release: 1 Source: %{name}-%{version}.tar.gz Vendor: Intel Corporation -License: GPL-2.0 +License: @ ExclusiveOS: linux Group: System Environment/Kernel Provides: %{name} @@ -18,9 +18,26 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-root %define pciids %find %{_pciids} %define pcitable %find %{_pcitable} Requires: kernel, findutils, gawk, bash -%define need_aux_rpm %(rpm -q --whatprovides /lib/modules/`uname -r`/build/include/linux/auxiliary_bus.h > /dev/null 2>&1 && echo 0 || echo 2) + +%if 0%{?BUILD_KERNEL:1} +%define kernel_ver %{BUILD_KERNEL} +%define check_aux_args_kernel -b %{BUILD_KERNEL} +%else +%define kernel_ver %(uname -r) +%endif + +%if 0%{?KSRC:1} +%define check_aux_args_ksrc -k %{KSRC} +%endif + +%define check_aux_args %check_aux_args_kernel %check_aux_args_ksrc + +%define need_aux_rpm %( [ -L /lib/modules/%kernel_ver/source ] && \ + (rpm -q --whatprovides /lib/modules/%kernel_ver/source/include/linux/auxiliary_bus.h > /dev/null 2>&1 && echo 0 || echo 2) || \ + (rpm -q --whatprovides /lib/modules/%kernel_ver/build/include/linux/auxiliary_bus.h > /dev/null 2>&1 && echo 0 || echo 2) ) + %if (%need_aux_rpm == 2) -Requires: auxiliary +Requires: intel_auxiliary %endif # Check for existence of %kernel_module_package_buildreqs ... @@ -55,13 +72,13 @@ find lib -name "ixgbe.ko" -printf "/%p\n" \ %if (%need_aux_rpm == 2) make -C %{_builddir}/%{name}-%{version}/src INSTALL_MOD_PATH=%{buildroot} auxiliary_install -find lib -path "*extern-symvers/auxiliary.symvers" -printf "/%p\n" \ +find lib -path "*extern-symvers/intel_auxiliary.symvers" -printf "/%p\n" \ >%{_builddir}/%{name}-%{version}/aux.list find * -name "auxiliary_bus.h" -printf "/%p\n" \ >>%{_builddir}/%{name}-%{version}/aux.list %endif -if [ "$(%{_builddir}/%{name}-%{version}/scripts/./check_aux_bus; echo $?)" == "2" ] ; then -find lib -name "auxiliary.ko" -printf "/%p\n" \ +if [ "$(%{_builddir}/%{name}-%{version}/scripts/./check_aux_bus %check_aux_args; echo $?)" == "2" ] ; then + find lib -name "intel_auxiliary.ko" -printf "/%p\n" \ >>%{_builddir}/%{name}-%{version}/file.list fi @@ -423,16 +440,16 @@ else fi %if (%need_aux_rpm == 2) && (%req_aux == 0) -%package -n auxiliary +%package -n intel_auxiliary Summary: Auxiliary bus driver (backport) Version: 1.0.0 -%description -n auxiliary -The Auxiliary bus driver (auxiliary.ko), backported from upstream, for use by kernels that don't have auxiliary bus. +%description -n intel_auxiliary +The Auxiliary bus driver (intel_auxiliary.ko), backported from upstream, for use by kernels that don't have auxiliary bus. # The if is used to hide this whole section. This causes RPM to skip the build # of the auxiliary subproject entirely. -%files -n auxiliary -f aux.list +%files -n intel_auxiliary -f aux.list %doc aux.list %endif diff --git a/src/common.mk b/src/common.mk index 5b7c4fc..7647c78 100644 --- a/src/common.mk +++ b/src/common.mk @@ -106,7 +106,7 @@ ifneq ($(and $(SIGN_FILE_EXISTS),$(PRIV_KEY_EXISTS),$(PUB_KEY_EXISTS)),) echo "*** Is public key present: ${PUB_KEY_EXISTS}" ; info_signed_modules += echo "*** All files are present, signing driver." ; sign_driver = $(shell ${SCRIPT_PATH}/sign-file sha256 intel-linux-key.key \ - intel-linux-key.crt i40e.ko) + intel-linux-key.crt ${DRIVER}.ko) else info_signed_modules += echo "*** Files are missing, cannot sign driver." ; sign_driver = @@ -199,6 +199,7 @@ warn_signed_modules += \ echo "*** disabled for this build." ; endif # CONFIG_MODULE_SIG_ALL=y ifeq (${CONFIG_MODULE_SIG_FORCE},1) + warn_signed_modules += \ 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'." ; @@ -269,6 +270,13 @@ endif endif endif +# Check if it is Oracle Linux UEK kernel and take release patch number from it +ifneq (,$(findstring uek,${BUILD_KERNEL})) + EXTRAVERSION := $(shell BK=${BUILD_KERNEL}; echo $${BK\#*-}) + UEK_RELEASE_NUMBER := $(shell EV=${EXTRAVERSION}; echo $${EV%%\.*}) + EXTRA_CFLAGS += -DUEK_RELEASE_NUMBER=${UEK_RELEASE_NUMBER} +endif + EXTRA_CFLAGS += ${CFLAGS_EXTRA} # get the kernel version - we use this to find the correct install path @@ -424,10 +432,10 @@ export INSTALL_AUX_DIR ?= updates/drivers/net/ethernet/intel/auxiliary AUX_BUS_HEADER ?= linux/auxiliary_bus.h ifeq (${NEED_AUX_BUS},2) define auxiliary_post_install - install -D -m 644 Module.symvers ${INSTALL_MOD_PATH}/lib/modules/${KVER}/extern-symvers/auxiliary.symvers + install -D -m 644 Module.symvers ${INSTALL_MOD_PATH}/lib/modules/${KVER}/extern-symvers/intel_auxiliary.symvers install -d ${INSTALL_MOD_PATH}/lib/modules/${KVER}/${INSTALL_AUX_DIR} - mv -f ${INSTALL_MOD_PATH}/lib/modules/${KVER}/${INSTALL_MOD_DIR}/auxiliary.ko \ - ${INSTALL_MOD_PATH}/lib/modules/${KVER}/${INSTALL_AUX_DIR}/auxiliary.ko + mv -f ${INSTALL_MOD_PATH}/lib/modules/${KVER}/${INSTALL_MOD_DIR}/intel_auxiliary.ko \ + ${INSTALL_MOD_PATH}/lib/modules/${KVER}/${INSTALL_AUX_DIR}/intel_auxiliary.ko install -D -m 644 ${AUX_BUS_HEADER} ${INSTALL_MOD_PATH}/${KSRC}/include/linux/auxiliary_bus.h endef else @@ -436,14 +444,17 @@ endif ifeq (${NEED_AUX_BUS},2) define auxiliary_post_uninstall - rm -f ${INSTALL_MOD_PATH}/lib/modules/${KVER}/extern-symvers/auxiliary.symvers - rm -f ${INSTALL_MOD_PATH}/lib/modules/${KVER}/${INSTALL_AUX_DIR}/auxiliary.ko + rm -f ${INSTALL_MOD_PATH}/lib/modules/${KVER}/extern-symvers/intel_auxiliary.symvers + rm -f ${INSTALL_MOD_PATH}/lib/modules/${KVER}/${INSTALL_AUX_DIR}/intel_auxiliary.ko rm -f ${INSTALL_MOD_PATH}/${KSRC}/include/linux/auxiliary_bus.h endef else auxiliary_post_uninstall = endif +ifeq (${NEED_AUX_BUS},2) +EXTRA_CFLAGS += -DUSE_INTEL_AUX_BUS +endif ###################### # Kernel Build Macro # ###################### diff --git a/src/ixgbe.h b/src/ixgbe.h index c5b7831..cfe7987 100644 --- a/src/ixgbe.h +++ b/src/ixgbe.h @@ -246,6 +246,7 @@ struct vf_stats { u64 gotc; u64 mprc; }; + struct vf_data_storage { struct pci_dev *vfdev; unsigned char vf_mac_addresses[ETH_ALEN]; @@ -482,6 +483,7 @@ struct ixgbe_ring { struct ixgbe_tx_queue_stats tx_stats; struct ixgbe_rx_queue_stats rx_stats; }; + u16 rx_offset; spinlock_t tx_lock; /* used in XDP mode */ #ifdef HAVE_XDP_BUFF_RXQ struct xdp_rxq_info xdp_rxq; diff --git a/src/ixgbe_main.c b/src/ixgbe_main.c index 0450844..977a012 100644 --- a/src/ixgbe_main.c +++ b/src/ixgbe_main.c @@ -72,7 +72,7 @@ #define RELEASE_TAG -#define DRV_VERSION "5.16.5" \ +#define DRV_VERSION "5.17.1" \ DRIVERIOV DRV_HW_PERF FPGA \ BYPASS_TAG RELEASE_TAG #define DRV_SUMMARY "Intel(R) 10GbE PCI Express Linux Network Driver" @@ -1220,7 +1220,7 @@ static bool ixgbe_alloc_mapped_skb(struct ixgbe_ring *rx_ring, } #else /* !CONFIG_IXGBE_DISABLE_PACKET_SPLIT */ -static inline unsigned int ixgbe_rx_offset(struct ixgbe_ring *rx_ring) +static unsigned int ixgbe_rx_offset(struct ixgbe_ring *rx_ring) { return ring_uses_build_skb(rx_ring) ? IXGBE_SKB_PAD : 0; } @@ -1465,7 +1465,7 @@ static void ixgbe_receive_skb(struct ixgbe_q_vector *q_vector, static void ixgbe_set_rsc_gso_size(struct ixgbe_ring __maybe_unused *ring, struct sk_buff *skb) { - u16 hdr_len = eth_get_headlen(skb->dev, skb->data, skb_headlen(skb)); + u16 hdr_len = skb_headlen(skb); /* set gso_size to avoid messing up TCP MSS */ skb_shinfo(skb)->gso_size = DIV_ROUND_UP((skb->len - hdr_len), @@ -1889,8 +1889,8 @@ static void ixgbe_add_rx_frag(struct ixgbe_ring *rx_ring, #if (PAGE_SIZE < 8192) unsigned int truesize = ixgbe_rx_pg_size(rx_ring) / 2; #else - unsigned int truesize = ring_uses_build_skb(rx_ring) ? - SKB_DATA_ALIGN(IXGBE_SKB_PAD + size) : + unsigned int truesize = rx_ring->rx_offset ? + SKB_DATA_ALIGN(rx_ring->rx_offset + size) : SKB_DATA_ALIGN(size); #endif @@ -2178,8 +2178,8 @@ static unsigned int ixgbe_rx_frame_truesize(struct ixgbe_ring *rx_ring, #if (PAGE_SIZE < 8192) truesize = ixgbe_rx_pg_size(rx_ring) / 2; #else - truesize = ring_uses_build_skb(rx_ring) ? - SKB_DATA_ALIGN(IXGBE_SKB_PAD + size) + truesize = rx_ring->rx_offset ? + SKB_DATA_ALIGN(rx_ring->rx_offset + size) #ifdef HAVE_XDP_BUFF_FRAME_SZ + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) #endif @@ -2225,6 +2225,7 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, unsigned int mss = 0; #endif /* CONFIG_FCOE */ u16 cleaned_count = ixgbe_desc_unused(rx_ring); + unsigned int offset = rx_ring->rx_offset; unsigned int xdp_xmit = 0; struct xdp_buff xdp; @@ -2273,8 +2274,7 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, #ifdef HAVE_XDP_BUFF_DATA_META xdp.data_meta = xdp.data; #endif - xdp.data_hard_start = xdp.data - - ixgbe_rx_offset(rx_ring); + xdp.data_hard_start = xdp.data - offset; xdp.data_end = xdp.data + size; #ifdef HAVE_XDP_BUFF_FRAME_SZ @@ -4403,6 +4403,7 @@ void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter, break; } + ring->rx_offset = ixgbe_rx_offset(ring); #ifdef HAVE_AF_XDP_ZC_SUPPORT if (ring->xsk_pool && hw->mac.type != ixgbe_mac_82599EB) { #ifndef HAVE_MEM_TYPE_XSK_BUFF_POOL @@ -8289,7 +8290,7 @@ ixgbe_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats) return stats; #endif } -#else +#else /* !HAVE_NDO_GET_STATS64 */ /** * ixgbe_get_stats - Get System Network Statistics * @netdev: network interface device structure @@ -8312,7 +8313,27 @@ static struct net_device_stats *ixgbe_get_stats(struct net_device *netdev) return &adapter->net_stats; #endif /* HAVE_NETDEV_STATS_IN_NETDEV */ } -#endif +#endif /* HAVE_NDO_GET_STATS64 */ + +#ifdef HAVE_VF_STATS +static int ixgbe_ndo_get_vf_stats(struct net_device *netdev, int vf, + struct ifla_vf_stats *vf_stats) +{ + struct ixgbe_adapter *adapter = netdev_priv(netdev); + + if (vf < 0 || vf >= adapter->num_vfs) + return -EINVAL; + + vf_stats->rx_packets = adapter->vfinfo[vf].vfstats.gprc; + vf_stats->rx_bytes = adapter->vfinfo[vf].vfstats.gorc; + vf_stats->tx_packets = adapter->vfinfo[vf].vfstats.gptc; + vf_stats->tx_bytes = adapter->vfinfo[vf].vfstats.gotc; + vf_stats->multicast = adapter->vfinfo[vf].vfstats.mprc; + + return 0; +} +#endif /* HAVE_VF_STATS */ + /** * ixgbe_update_stats - Update the board statistics counters. * @adapter: board private structure @@ -8561,8 +8582,7 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter) net_stats->rx_crc_errors = hwstats->crcerrs; net_stats->rx_missed_errors = total_mpc; - /* - * VF Stats Collection - skip while resetting because these + /* VF Stats Collection - skip while resetting because these * are not clear on read and otherwise you'll sometimes get * crazy values. */ @@ -12219,6 +12239,9 @@ static const struct net_device_ops ixgbe_netdev_ops = { #endif /* HAVE_NDO_SET_VF_TRUST */ .ndo_get_vf_config = ixgbe_ndo_get_vf_config, #endif /* IFLA_VF_MAX */ +#ifdef HAVE_VF_STATS + .ndo_get_vf_stats = ixgbe_ndo_get_vf_stats, +#endif /* HAVE_VF_STATS */ #ifdef HAVE_NDO_GET_STATS64 .ndo_get_stats64 = ixgbe_get_stats64, #else diff --git a/src/kcompat.c b/src/kcompat.c index 1fa4d80..e45a456 100644 --- a/src/kcompat.c +++ b/src/kcompat.c @@ -2883,94 +2883,6 @@ void _kc_pcie_print_link_status(struct pci_dev *dev) { } #endif /* 4.17.0 */ -/*****************************************************************************/ -#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; \ - struct flow_dissector *__d = (__m)->dissector; \ - \ - (__out)->key = skb_flow_dissector_target(__d, __type, (__m)->key); \ - (__out)->mask = skb_flow_dissector_target(__d, __type, (__m)->mask); \ - -void flow_rule_match_basic(const struct flow_rule *rule, - struct flow_match_basic *out) -{ - FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_BASIC, out); -} - -void flow_rule_match_control(const struct flow_rule *rule, - struct flow_match_control *out) -{ - FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_CONTROL, out); -} - -void flow_rule_match_eth_addrs(const struct flow_rule *rule, - struct flow_match_eth_addrs *out) -{ - FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_ETH_ADDRS, out); -} - -#ifdef HAVE_TC_FLOWER_ENC -void flow_rule_match_enc_keyid(const struct flow_rule *rule, - struct flow_match_enc_keyid *out) -{ - FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_ENC_KEYID, out); -} - -void flow_rule_match_enc_ports(const struct flow_rule *rule, - struct flow_match_ports *out) -{ - FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_ENC_PORTS, out); -} - -void flow_rule_match_enc_control(const struct flow_rule *rule, - struct flow_match_control *out) -{ - FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_ENC_CONTROL, out); -} - -void flow_rule_match_enc_ipv4_addrs(const struct flow_rule *rule, - struct flow_match_ipv4_addrs *out) -{ - FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS, out); -} - -void flow_rule_match_enc_ipv6_addrs(const struct flow_rule *rule, - struct flow_match_ipv6_addrs *out) -{ - FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS, out); -} -#endif - -#ifndef HAVE_TC_FLOWER_VLAN_IN_TAGS -void flow_rule_match_vlan(const struct flow_rule *rule, - struct flow_match_vlan *out) -{ - FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_VLAN, out); -} -#endif - -void flow_rule_match_ipv4_addrs(const struct flow_rule *rule, - struct flow_match_ipv4_addrs *out) -{ - FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_IPV4_ADDRS, out); -} - -void flow_rule_match_ipv6_addrs(const struct flow_rule *rule, - struct flow_match_ipv6_addrs *out) -{ - FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_IPV6_ADDRS, out); -} - -void flow_rule_match_ports(const struct flow_rule *rule, - struct flow_match_ports *out) -{ - FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_PORTS, out); -} -#endif /* HAVE_TC_SETUP_CLSFLOWER */ -#endif /* 5.1.0 || (RHEL && RHEL < 8.1) */ - /*****************************************************************************/ #if (LINUX_VERSION_CODE < KERNEL_VERSION(5,3,0)) #if (!(RHEL_RELEASE_CODE && (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8,2)))) @@ -3031,3 +2943,131 @@ u64 _kc_pci_get_dsn(struct pci_dev *dev) return dsn; } #endif /* 5.7.0 */ + +#ifdef NEED_DEVM_KASPRINTF +char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, + va_list ap) +{ + unsigned int len; + char *p; + va_list aq; + + va_copy(aq, ap); + len = vsnprintf(NULL, 0, fmt, aq); + va_end(aq); + + p = devm_kmalloc(dev, len + 1, gfp); + if (!p) + return NULL; + + vsnprintf(p, len + 1, fmt, ap); + + return p; +} + +char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...) +{ + va_list ap; + char *p; + + va_start(ap, fmt); + p = devm_kvasprintf(dev, gfp, fmt, ap); + va_end(ap); + + return p; +} +#endif /* NEED_DEVM_KASPRINTF */ + +#ifdef NEED_PCI_IOV_VF_ID +/* + * Below function needs to access pci_sriov offset and stride. Since + * pci_sriov structure is defined in drivers/pci/pci.h which can not + * be included as linux kernel header file, the structure definition + * is not globally visible. + * As a result, one copy of structure definition is added. Since the + * definition is a copy, you need to make sure the kernel you want + * to backport must have exactly the same pci_sriov definition as the + * copy, otherwise you'll access wrong field offset and value. + */ + +/* Single Root I/O Virtualization */ +struct pci_sriov { + int pos; /* Capability position */ + int nres; /* Number of resources */ + u32 cap; /* SR-IOV Capabilities */ + u16 ctrl; /* SR-IOV Control */ + u16 total_VFs; /* Total VFs associated with the PF */ + u16 initial_VFs; /* Initial VFs associated with the PF */ + u16 num_VFs; /* Number of VFs available */ + u16 offset; /* First VF Routing ID offset */ + u16 stride; /* Following VF stride */ + u16 vf_device; /* VF device ID */ + u32 pgsz; /* Page size for BAR alignment */ + u8 link; /* Function Dependency Link */ + u8 max_VF_buses; /* Max buses consumed by VFs */ + u16 driver_max_VFs; /* Max num VFs driver supports */ + struct pci_dev *dev; /* Lowest numbered PF */ + struct pci_dev *self; /* This PF */ + u32 cfg_size; /* VF config space size */ + u32 class; /* VF device */ + u8 hdr_type; /* VF header type */ + u16 subsystem_vendor; /* VF subsystem vendor */ + u16 subsystem_device; /* VF subsystem device */ + resource_size_t barsz[PCI_SRIOV_NUM_BARS]; /* VF BAR size */ + bool drivers_autoprobe; /* Auto probing of VFs by driver */ +}; + +int _kc_pci_iov_vf_id(struct pci_dev *dev) +{ + struct pci_dev *pf; + + if (!dev->is_virtfn) + return -EINVAL; + + pf = pci_physfn(dev); + return (((dev->bus->number << 8) + dev->devfn) - + ((pf->bus->number << 8) + pf->devfn + pf->sriov->offset)) / + pf->sriov->stride; +} +#endif /* NEED_PCI_IOV_VF_ID */ + +#ifdef NEED_MUL_U64_U64_DIV_U64 +u64 mul_u64_u64_div_u64(u64 a, u64 b, u64 c) +{ + u64 res = 0, div, rem; + int shift; + + /* can a * b overflow ? */ + if (ilog2(a) + ilog2(b) > 62) { + /* + * (b * a) / c is equal to + * + * (b / c) * a + + * (b % c) * a / c + * + * if nothing overflows. Can the 1st multiplication + * overflow? Yes, but we do not care: this can only + * happen if the end result can't fit in u64 anyway. + * + * So the code below does + * + * res = (b / c) * a; + * b = b % c; + */ + div = div64_u64_rem(b, c, &rem); + res = div * a; + b = rem; + + shift = ilog2(a) + ilog2(b) - 62; + if (shift > 0) { + /* drop precision */ + b >>= shift; + c >>= shift; + if (!c) + return res; + } + } + + return res + div64_u64(a * b, c); +} +#endif /* NEED_MUL_U64_U64_DIV_U64 */ diff --git a/src/kcompat.h b/src/kcompat.h index f5f0df3..3d6ccb9 100644 --- a/src/kcompat.h +++ b/src/kcompat.h @@ -965,7 +965,6 @@ struct _kc_ethtool_pauseparam { #ifdef __KLOCWORK__ - */ #ifdef ARRAY_SIZE #undef ARRAY_SIZE #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) @@ -6907,114 +6906,12 @@ ptp_read_system_postts(struct ptp_system_timestamp __always_unused *sts) #define HAVE_NDO_FDB_ADD_EXTACK #define HAVE_DEVLINK_INFO_GET #define HAVE_DEVLINK_FLASH_UPDATE -#else /* RHEL < 8.1 */ -#ifdef HAVE_TC_SETUP_CLSFLOWER -#include - -struct flow_match { - struct flow_dissector *dissector; - void *mask; - void *key; -}; - -struct flow_match_basic { - struct flow_dissector_key_basic *key, *mask; -}; - -struct flow_match_control { - struct flow_dissector_key_control *key, *mask; -}; - -struct flow_match_eth_addrs { - struct flow_dissector_key_eth_addrs *key, *mask; -}; - -#ifdef HAVE_TC_FLOWER_ENC -struct flow_match_enc_keyid { - struct flow_dissector_key_keyid *key, *mask; -}; -#endif - -#ifndef HAVE_TC_FLOWER_VLAN_IN_TAGS -struct flow_match_vlan { - struct flow_dissector_key_vlan *key, *mask; -}; -#endif - -struct flow_match_ipv4_addrs { - struct flow_dissector_key_ipv4_addrs *key, *mask; -}; - -struct flow_match_ipv6_addrs { - struct flow_dissector_key_ipv6_addrs *key, *mask; -}; - -struct flow_match_ports { - struct flow_dissector_key_ports *key, *mask; -}; - -struct flow_rule { - struct flow_match match; -#if 0 - /* In 5.1+ kernels, action is a member of struct flow_rule but is - * not compatible with how we kcompat tc_cls_flower_offload_flow_rule - * below. By not declaring it here, any driver that attempts to use - * action as an element of struct flow_rule will fail to compile - * instead of silently trying to access memory that shouldn't be. - */ - struct flow_action action; -#endif -}; - -void flow_rule_match_basic(const struct flow_rule *rule, - struct flow_match_basic *out); -void flow_rule_match_control(const struct flow_rule *rule, - struct flow_match_control *out); -void flow_rule_match_eth_addrs(const struct flow_rule *rule, - struct flow_match_eth_addrs *out); -#ifndef HAVE_TC_FLOWER_VLAN_IN_TAGS -void flow_rule_match_vlan(const struct flow_rule *rule, - struct flow_match_vlan *out); -#endif -void flow_rule_match_ipv4_addrs(const struct flow_rule *rule, - struct flow_match_ipv4_addrs *out); -void flow_rule_match_ipv6_addrs(const struct flow_rule *rule, - struct flow_match_ipv6_addrs *out); -void flow_rule_match_ports(const struct flow_rule *rule, - struct flow_match_ports *out); -#ifdef HAVE_TC_FLOWER_ENC -void flow_rule_match_enc_ports(const struct flow_rule *rule, - struct flow_match_ports *out); -void flow_rule_match_enc_control(const struct flow_rule *rule, - struct flow_match_control *out); -void flow_rule_match_enc_ipv4_addrs(const struct flow_rule *rule, - struct flow_match_ipv4_addrs *out); -void flow_rule_match_enc_ipv6_addrs(const struct flow_rule *rule, - struct flow_match_ipv6_addrs *out); -void flow_rule_match_enc_keyid(const struct flow_rule *rule, - struct flow_match_enc_keyid *out); -#endif - -static inline struct flow_rule * -tc_cls_flower_offload_flow_rule(struct tc_cls_flower_offload *tc_flow_cmd) -{ - return (struct flow_rule *)&tc_flow_cmd->dissector; -} - -static inline bool flow_rule_match_key(const struct flow_rule *rule, - enum flow_dissector_key_id key) -{ - return dissector_uses_key(rule->match.dissector, key); -} -#endif /* HAVE_TC_SETUP_CLSFLOWER */ - #endif /* RHEL < 8.1 */ #else /* >= 5.1.0 */ #define HAVE_NDO_FDB_ADD_EXTACK #define NO_XDP_QUERY_XSK_UMEM #define HAVE_AF_XDP_NETDEV_UMEM #define HAVE_TC_FLOW_RULE_INFRASTRUCTURE -#define HAVE_TC_FLOWER_ENC_IP #define HAVE_DEVLINK_INFO_GET #define HAVE_DEVLINK_FLASH_UPDATE #define HAVE_DEVLINK_PORT_PARAMS @@ -7172,9 +7069,10 @@ u64 _kc_pci_get_dsn(struct pci_dev *dev); /* add a check for the Oracle UEK 5.4.17 kernel which * backported the rename of the aer functions */ -#if !(SLE_VERSION_CODE > SLE_VERSION(15,2,0)) && \ +#if defined(NEED_ORCL_LIN_PCI_AER_CLEAR_NONFATAL_STATUS) || \ +!(SLE_VERSION_CODE > SLE_VERSION(15, 2, 0)) && \ !((LINUX_VERSION_CODE == KERNEL_VERSION(5,3,18)) && \ - (SLE_LOCALVERSION_CODE >= KERNEL_VERSION(14,0,0))) && \ +(SLE_LOCALVERSION_CODE >= KERNEL_VERSION(14, 0, 0))) && \ !(LINUX_VERSION_CODE == KERNEL_VERSION(5,4,17)) && \ !(RHEL_RELEASE_CODE && (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8,3))) #define pci_aer_clear_nonfatal_status pci_cleanup_aer_uncorrect_error_status @@ -7199,21 +7097,6 @@ u64 _kc_pci_get_dsn(struct pci_dev *dev); #endif #define flex_array_size(p, member, count) \ array_size(count, sizeof(*(p)->member) + __must_be_array((p)->member)) -#if (!(SLE_VERSION_CODE && SLE_VERSION_CODE >= SLE_VERSION(15,3,0))) -#ifdef HAVE_AF_XDP_ZC_SUPPORT -#ifndef xsk_umem_get_rx_frame_size -static inline u32 _xsk_umem_get_rx_frame_size(struct xdp_umem *umem) -{ - return umem->chunk_size_nohr - XDP_PACKET_HEADROOM; -} - -#define xsk_umem_get_rx_frame_size _xsk_umem_get_rx_frame_size -#endif /* xsk_umem_get_rx_frame_size */ -#endif /* HAVE_AF_XDP_ZC_SUPPORT */ -#else /* SLE >= 15.3 */ -#define HAVE_XDP_BUFF_FRAME_SZ -#define HAVE_MEM_TYPE_XSK_BUFF_POOL -#endif /* SLE >= 15.3 */ #else /* >= 5.8.0 */ #define HAVE_TC_FLOW_INDIR_DEV #define HAVE_TC_FLOW_INDIR_BLOCK_CLEANUP @@ -7245,41 +7128,6 @@ static inline u32 _xsk_umem_get_rx_frame_size(struct xdp_umem *umem) #define HAVE_FLOW_INDIR_BLOCK_QDISC #endif /* SLE_VERSION_CODE && SLE_VERSION_CODE >= SLES15SP3 */ -/*****************************************************************************/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)) -#if (!(SLE_VERSION_CODE && (SLE_VERSION_CODE >= SLE_VERSION(15,3,0)))) -#define XDP_SETUP_XSK_POOL XDP_SETUP_XSK_UMEM -#define xsk_get_pool_from_qid xdp_get_umem_from_qid -#define xsk_pool_get_rx_frame_size xsk_umem_get_rx_frame_size -#define xsk_pool_set_rxq_info xsk_buff_set_rxq_info -#define xsk_pool_dma_unmap xsk_buff_dma_unmap -#define xsk_pool_dma_map xsk_buff_dma_map -#define xsk_tx_peek_desc xsk_umem_consume_tx -#define xsk_tx_release xsk_umem_consume_tx_done -#define xsk_tx_completed xsk_umem_complete_tx -#define xsk_uses_need_wakeup xsk_umem_uses_need_wakeup - -#ifdef HAVE_MEM_TYPE_XSK_BUFF_POOL -#include -static inline void -_kc_xsk_buff_dma_sync_for_cpu(struct xdp_buff *xdp, - void __always_unused *pool) -{ - xsk_buff_dma_sync_for_cpu(xdp); -} - -#define xsk_buff_dma_sync_for_cpu(xdp, pool) \ - _kc_xsk_buff_dma_sync_for_cpu(xdp, pool) -#endif /* HAVE_MEM_TYPE_XSK_BUFF_POOL */ - -#else /* SLE >= 15.3 */ -#define HAVE_NETDEV_BPF_XSK_POOL -#endif /* SLE >= 15.3 */ -#else /* >= 5.10.0 */ -#define HAVE_NETDEV_BPF_XSK_POOL -#endif /* <5.10.0 */ - - /*****************************************************************************/ #ifdef HAVE_XDP_RXQ_INFO_REG_3_PARAMS #ifdef HAVE_XDP_BUFF_IN_XDP_H @@ -7316,6 +7164,13 @@ _kc_napi_busy_loop(unsigned int napi_id, #endif /* HAVE_NAPI_BUSY_LOOP */ #endif /* <5.11.0 */ +/*****************************************************************************/ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0)) +#define HAVE_GRO_HEADER +#endif /* >=5.12.0 */ + +/*****************************************************************************/ + /* * Load the implementations file which actually defines kcompat backports. * Legacy backports still exist in this file, but all new backports must be diff --git a/src/kcompat_defs.h b/src/kcompat_defs.h index 49dcc0f..9ed297c 100644 --- a/src/kcompat_defs.h +++ b/src/kcompat_defs.h @@ -32,6 +32,8 @@ #include "kcompat_ubuntu_defs.h" #elif RHEL_RELEASE_CODE #include "kcompat_rhel_defs.h" +#elif defined(UEK_RELEASE_NUMBER) +#include "kcompat_oracle_defs.h" #endif #endif /* _KCOMPAT_DEFS_H_ */ diff --git a/src/kcompat_impl.h b/src/kcompat_impl.h index 54c3866..f0a7bfd 100644 --- a/src/kcompat_impl.h +++ b/src/kcompat_impl.h @@ -941,4 +941,440 @@ static inline void eth_hw_addr_set(struct net_device *dev, const u8 *addr) #endif /* CONFIG_RETPOLINE */ #endif /* NEED_EXPORT_INDIRECT_CALLABLE */ +#ifdef NEED_DEVM_KASPRINTF +/* NEED_DEVM_KASPRINTF + * + * devm_kvasprintf and devm_kasprintf were added by commit + * 75f2a4ead5d5 ("devres: Add devm_kasprintf and devm_kvasprintf API") + * in Linux 3.17. + */ +__printf(3, 0) char *devm_kvasprintf(struct device *dev, gfp_t gfp, + const char *fmt, va_list ap); +__printf(3, 4) char *devm_kasprintf(struct device *dev, gfp_t gfp, + const char *fmt, ...); +#endif /* NEED_DEVM_KASPRINTF */ + +#ifdef NEED_XSK_UMEM_GET_RX_FRAME_SIZE +#ifdef HAVE_AF_XDP_ZC_SUPPORT +#ifndef xsk_umem_get_rx_frame_size +static inline u32 _xsk_umem_get_rx_frame_size(struct xdp_umem *umem) +{ + return umem->chunk_size_nohr - XDP_PACKET_HEADROOM; +} + +#define xsk_umem_get_rx_frame_size _xsk_umem_get_rx_frame_size +#endif /* xsk_umem_get_rx_frame_size */ +#endif /* HAVE_AF_XDP_ZC_SUPPORT */ +#endif + +#ifdef NEED_XSK_BUFF_DMA_SYNC_FOR_CPU +#ifdef HAVE_MEM_TYPE_XSK_BUFF_POOL +#include +static inline void +_kc_xsk_buff_dma_sync_for_cpu(struct xdp_buff *xdp, + void __always_unused *pool) +{ + xsk_buff_dma_sync_for_cpu(xdp); +} + +#define xsk_buff_dma_sync_for_cpu(xdp, pool) \ + _kc_xsk_buff_dma_sync_for_cpu(xdp, pool) +#endif /* HAVE_MEM_TYPE_XSK_BUFF_POOL */ +#endif /* NEED_XSK_BUFF_DMA_SYNC_FOR_CPU */ + +#ifdef NEED_XSK_BUFF_POOL_RENAME +#define XDP_SETUP_XSK_POOL XDP_SETUP_XSK_UMEM +#define xsk_get_pool_from_qid xdp_get_umem_from_qid +#define xsk_pool_get_rx_frame_size xsk_umem_get_rx_frame_size +#define xsk_pool_set_rxq_info xsk_buff_set_rxq_info +#define xsk_pool_dma_unmap xsk_buff_dma_unmap +#define xsk_pool_dma_map xsk_buff_dma_map +#define xsk_tx_peek_desc xsk_umem_consume_tx +#define xsk_tx_release xsk_umem_consume_tx_done +#define xsk_tx_completed xsk_umem_complete_tx +#define xsk_uses_need_wakeup xsk_umem_uses_need_wakeup +#endif /* NEED_XSK_BUFF_POOL_RENAME */ + +#ifdef NEED_PCI_IOV_VF_ID +/* NEED_PCI_IOV_VF_ID + * + * pci_iov_vf_id were added by commit 21ca9fb62d468 ("PCI/IOV: + * Add pci_iov_vf_id() to get VF index") in Linux 5.18 + */ +int _kc_pci_iov_vf_id(struct pci_dev *dev); +#define pci_iov_vf_id _kc_pci_iov_vf_id +#endif /* NEED_PCI_IOV_VF_ID */ + +/* NEED_MUL_U64_U64_DIV_U64 + * + * mul_u64_u64_div_u64 was introduced in Linux 5.9 as part of commit + * 3dc167ba5729 ("sched/cputime: Improve cputime_adjust()") + */ +#ifdef NEED_MUL_U64_U64_DIV_U64 +u64 mul_u64_u64_div_u64(u64 a, u64 mul, u64 div); +#endif /* NEED_MUL_U64_U64_DIV_U64 */ + +#ifndef HAVE_LINKMODE +static inline void linkmode_set_bit(int nr, volatile unsigned long *addr) +{ + __set_bit(nr, addr); +} + +static inline void linkmode_zero(unsigned long *dst) +{ + bitmap_zero(dst, __ETHTOOL_LINK_MODE_MASK_NBITS); +} +#endif /* !HAVE_LINKMODE */ + +#ifndef ETHTOOL_GLINKSETTINGS +/* Link mode bit indices */ +enum ethtool_link_mode_bit_indices { + ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0, + ETHTOOL_LINK_MODE_10baseT_Full_BIT = 1, + ETHTOOL_LINK_MODE_100baseT_Half_BIT = 2, + ETHTOOL_LINK_MODE_100baseT_Full_BIT = 3, + ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 4, + ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 5, + ETHTOOL_LINK_MODE_Autoneg_BIT = 6, + ETHTOOL_LINK_MODE_TP_BIT = 7, + ETHTOOL_LINK_MODE_AUI_BIT = 8, + ETHTOOL_LINK_MODE_MII_BIT = 9, + ETHTOOL_LINK_MODE_FIBRE_BIT = 10, + ETHTOOL_LINK_MODE_BNC_BIT = 11, + ETHTOOL_LINK_MODE_10000baseT_Full_BIT = 12, + ETHTOOL_LINK_MODE_Pause_BIT = 13, + ETHTOOL_LINK_MODE_Asym_Pause_BIT = 14, + ETHTOOL_LINK_MODE_2500baseX_Full_BIT = 15, + ETHTOOL_LINK_MODE_Backplane_BIT = 16, + ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 17, + ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT = 18, + ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 19, + ETHTOOL_LINK_MODE_10000baseR_FEC_BIT = 20, + ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 21, + ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT = 22, + ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 23, + ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 24, + ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT = 25, + ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT = 26, + ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT = 27, + ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 28, + ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 29, + ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 30, + + /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit + * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_* + * macro for bits > 31. The only way to use indices > 31 is to + * use the new ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. + */ + + __ETHTOOL_LINK_MODE_LAST + = ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT, +}; +#endif /* !ETHTOOL_GLINKSETTINGS */ + +#if defined(NEED_FLOW_MATCH) && defined(HAVE_TC_SETUP_CLSFLOWER) +/* NEED_FLOW_MATCH + * + * flow_match*, FLOW_DISSECTOR_MATCH, flow_rule*, flow_rule_match_key, and + * tc_cls_flower_offload_flow_rule were added by commit + * 8f2566225ae2 ("flow_offload: add flow_rule and flow_match structures and use + * them") in Linux 5.1. + */ + +#include + +struct flow_match { + struct flow_dissector *dissector; + void *mask; + void *key; +}; + +struct flow_match_basic { + struct flow_dissector_key_basic *key, *mask; +}; + +struct flow_match_control { + struct flow_dissector_key_control *key, *mask; +}; + +struct flow_match_eth_addrs { + struct flow_dissector_key_eth_addrs *key, *mask; +}; + +#ifndef HAVE_TC_FLOWER_VLAN_IN_TAGS +struct flow_match_vlan { + struct flow_dissector_key_vlan *key, *mask; +}; +#endif /* HAVE_TC_FLOWER_VLAN_IN_TAGS */ + +struct flow_match_ipv4_addrs { + struct flow_dissector_key_ipv4_addrs *key, *mask; +}; + +struct flow_match_ipv6_addrs { + struct flow_dissector_key_ipv6_addrs *key, *mask; +}; + +#ifdef HAVE_FLOW_DISSECTOR_KEY_IP +struct flow_match_ip { + struct flow_dissector_key_ip *key, *mask; +}; +#endif /* HAVE_FLOW_DISSECTOR_KEY_IP */ + +struct flow_match_ports { + struct flow_dissector_key_ports *key, *mask; +}; + +#ifdef HAVE_TC_FLOWER_ENC +struct flow_match_enc_keyid { + struct flow_dissector_key_keyid *key, *mask; +}; +#endif /* HAVE_TC_FLOWER_ENC */ + +struct flow_rule { + struct flow_match match; +#if 0 + /* In 5.1+ kernels, action is a member of struct flow_rule but is + * not compatible with how we kcompat tc_cls_flower_offload_flow_rule + * below. By not declaring it here, any driver that attempts to use + * action as an element of struct flow_rule will fail to compile + * instead of silently trying to access memory that shouldn't be. + */ + struct flow_action action; +#endif +}; + +static inline struct flow_rule * +tc_cls_flower_offload_flow_rule(struct tc_cls_flower_offload *tc_flow_cmd) +{ + return (struct flow_rule *)&tc_flow_cmd->dissector; +} + +static inline bool flow_rule_match_key(const struct flow_rule *rule, + enum flow_dissector_key_id key) +{ + return dissector_uses_key(rule->match.dissector, key); +} + +#define FLOW_DISSECTOR_MATCH(__rule, __type, __out) \ + const struct flow_match *__m = &(__rule)->match; \ + struct flow_dissector *__d = (__m)->dissector; \ + \ + (__out)->key = skb_flow_dissector_target(__d, __type, (__m)->key); \ + (__out)->mask = skb_flow_dissector_target(__d, __type, (__m)->mask); \ + +static inline void +flow_rule_match_basic(const struct flow_rule *rule, + struct flow_match_basic *out) +{ + FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_BASIC, out); +} + +static inline void +flow_rule_match_control(const struct flow_rule *rule, + struct flow_match_control *out) +{ + FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_CONTROL, out); +} + +static inline void +flow_rule_match_eth_addrs(const struct flow_rule *rule, + struct flow_match_eth_addrs *out) +{ + FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_ETH_ADDRS, out); +} + +#ifndef HAVE_TC_FLOWER_VLAN_IN_TAGS +static inline void +flow_rule_match_vlan(const struct flow_rule *rule, struct flow_match_vlan *out) +{ + FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_VLAN, out); +} +#endif /* HAVE_TC_FLOWER_VLAN_IN_TAGS */ + +static inline void +flow_rule_match_ipv4_addrs(const struct flow_rule *rule, + struct flow_match_ipv4_addrs *out) +{ + FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_IPV4_ADDRS, out); +} + +static inline void +flow_rule_match_ipv6_addrs(const struct flow_rule *rule, + struct flow_match_ipv6_addrs *out) +{ + FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_IPV6_ADDRS, out); +} + +#ifdef HAVE_FLOW_DISSECTOR_KEY_IP +static inline void +flow_rule_match_ip(const struct flow_rule *rule, struct flow_match_ip *out) +{ + FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_IP, out); +} +#endif /* HAVE_FLOW_DISSECTOR_KEY_IP */ + +static inline void +flow_rule_match_ports(const struct flow_rule *rule, + struct flow_match_ports *out) +{ + FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_PORTS, out); +} + +#ifdef HAVE_TC_FLOWER_ENC +static inline void +flow_rule_match_enc_control(const struct flow_rule *rule, + struct flow_match_control *out) +{ + FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_ENC_CONTROL, out); +} + +static inline void +flow_rule_match_enc_ipv4_addrs(const struct flow_rule *rule, + struct flow_match_ipv4_addrs *out) +{ + FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS, out); +} + +static inline void +flow_rule_match_enc_ipv6_addrs(const struct flow_rule *rule, + struct flow_match_ipv6_addrs *out) +{ + FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS, out); +} + +#ifdef HAVE_FLOW_DISSECTOR_KEY_IP +#ifdef HAVE_FLOW_DISSECTOR_KEY_ENC_IP +static inline void +flow_rule_match_enc_ip(const struct flow_rule *rule, struct flow_match_ip *out) +{ + FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_ENC_IP, out); +} +#endif /* HAVE_FLOW_DISSECTOR_KEY_ENC_IP */ +#endif /* HAVE_FLOW_DISSECTOR_KEY_IP */ + +static inline void +flow_rule_match_enc_ports(const struct flow_rule *rule, + struct flow_match_ports *out) +{ + FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_ENC_PORTS, out); +} + +static inline void +flow_rule_match_enc_keyid(const struct flow_rule *rule, + struct flow_match_enc_keyid *out) +{ + FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_ENC_KEYID, out); +} +#endif /* HAVE_TC_FLOWER_ENC */ +#endif /* NEED_FLOW_MATCH && HAVE_TC_SETUP_CLSFLOWER */ + +#ifndef HAVE_INCLUDE_BITFIELD +/* linux/bitfield.h has been added in Linux 4.9 in upstream commit + * 3e9b3112ec74 ("add basic register-field manipulation macros") + */ +#define __bf_shf(x) (__builtin_ffsll(x) - 1) + +#define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx) \ + ({ \ + BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \ + _pfx "mask is not constant"); \ + BUILD_BUG_ON_MSG(!(_mask), _pfx "mask is zero"); \ + BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \ + ~((_mask) >> __bf_shf(_mask)) & (_val) : 0, \ + _pfx "value too large for the field"); \ + BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \ + _pfx "type of reg too small for mask"); \ + __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) + \ + (1ULL << __bf_shf(_mask))); \ + }) + +/** + * FIELD_MAX() - produce the maximum value representable by a field + * @_mask: shifted mask defining the field's length and position + * + * FIELD_MAX() returns the maximum value that can be held in the field + * specified by @_mask. + */ +#define FIELD_MAX(_mask) \ + ({ \ + __BF_FIELD_CHECK(_mask, 0ULL, 0ULL, "FIELD_MAX: "); \ + (typeof(_mask))((_mask) >> __bf_shf(_mask)); \ + }) + +/** + * FIELD_FIT() - check if value fits in the field + * @_mask: shifted mask defining the field's length and position + * @_val: value to test against the field + * + * Return: true if @_val can fit inside @_mask, false if @_val is too big. + */ +#define FIELD_FIT(_mask, _val) \ + ({ \ + __BF_FIELD_CHECK(_mask, 0ULL, 0ULL, "FIELD_FIT: "); \ + !((((typeof(_mask))_val) << __bf_shf(_mask)) & ~(_mask)); \ + }) + +/** + * FIELD_PREP() - prepare a bitfield element + * @_mask: shifted mask defining the field's length and position + * @_val: value to put in the field + * + * FIELD_PREP() masks and shifts up the value. The result should + * be combined with other fields of the bitfield using logical OR. + */ +#define FIELD_PREP(_mask, _val) \ + ({ \ + __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \ + ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \ + }) + +/** + * FIELD_GET() - extract a bitfield element + * @_mask: shifted mask defining the field's length and position + * @_reg: value of entire bitfield + * + * FIELD_GET() extracts the field specified by @_mask from the + * bitfield passed in as @_reg by masking and shifting it down. + */ +#define FIELD_GET(_mask, _reg) \ + ({ \ + __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \ + (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \ + }) +#endif /* HAVE_INCLUDE_BITFIELD */ + +#ifdef NEED_BUILD_BUG_ON +/* Force a compilation error if a constant expression is not a power of 2 */ +#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \ + BUILD_BUG_ON(((n) & ((n) - 1)) != 0) + +/** + * BUILD_BUG_ON_MSG - break compile if a condition is true & emit supplied + * error message. + * @condition: the condition which the compiler should know is false. + * + * See BUILD_BUG_ON for description. + */ +#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) + +/** + * BUILD_BUG_ON - break compile if a condition is true. + * @condition: the condition which the compiler should know is false. + * + * If you have some code which relies on certain constants being equal, or + * some other compile-time-evaluated condition, you should use BUILD_BUG_ON to + * detect if someone changes it. + */ +#define BUILD_BUG_ON(condition) \ + BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) +#endif /* NEED_BUILD_BUG_ON */ + +#ifdef NEED_IN_TASK +#define in_hardirq() (hardirq_count()) +#define in_serving_softirq() (softirq_count() & SOFTIRQ_OFFSET) +#define in_task() (!(in_nmi() | in_hardirq() | \ + in_serving_softirq())) +#endif /* NEED_IN_TASK */ + #endif /* _KCOMPAT_IMPL_H_ */ diff --git a/src/kcompat_oracle_defs.h b/src/kcompat_oracle_defs.h new file mode 100644 index 0000000..cc5ccee --- /dev/null +++ b/src/kcompat_oracle_defs.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright(c) 1999 - 2022 Intel Corporation. */ + +#ifndef _KCOMPAT_ORACLE_DEFS_H_ +#define _KCOMPAT_ORACLE_DEFS_H_ + +/* UEK kernel versions are a combination of the LINUX_VERSION_CODE along with + * an extra 3 digits. This values are part of BUILD_KERNEL string, and first + * number extracted by common.mk and placed into UEK_RELEASE_NUMBER. + * + * We combine the value of UEK_RELEASE_NUMBER along with the LINUX_VERSION code + * to generate the useful value that determines what specific kernel we're + * dealing with. + * + * Just in case the UEK_RELEASE_NUMBER ever goes above 255, we reserve 16 bits + * instead of 8 for this value. + */ +#if !defined(UEK_RELEASE_NUMBER) +#error "UEK_RELEASE_NUMBER is undefined" +#endif + +#if UEK_RELEASE_NUMBER > 65535 +#error "UEK_RELEASE_NUMBER is unexpectedly large" +#endif + +#define UEK_KERNEL_CODE ((LINUX_VERSION_CODE << 16) + UEK_RELEASE_NUMBER) +#define UEK_KERNEL_VERSION(a, b, c, d) ((KERNEL_VERSION(a, b, c) << 16) + (d)) + +#if UEK_KERNEL_VERSION(5, 4, 17, 2136) > UEK_KERNEL_CODE +#define NEED_ORCL_LIN_PCI_AER_CLEAR_NONFATAL_STATUS +#endif + +#if UEK_KERNEL_VERSION(5, 4, 17, 2136) == UEK_KERNEL_CODE +#undef NEED_NET_PREFETCH +#endif + +#endif /* _KCOMPAT_ORACLE_DEFS_H_ */ diff --git a/src/kcompat_rhel_defs.h b/src/kcompat_rhel_defs.h index 7136e40..6ab5ab2 100644 --- a/src/kcompat_rhel_defs.h +++ b/src/kcompat_rhel_defs.h @@ -29,18 +29,22 @@ #define NEED_NETDEV_TXQ_BQL_PREFETCH #else /* >= 7.3 */ #undef NEED_DEV_PRINTK_ONCE +#undef NEED_DEVM_KASPRINTF #endif /* 7.3 */ /*****************************************************************************/ #if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,4)) +#define NEED_BUILD_BUG_ON #else /* >= 7.4 */ #define HAVE_RHEL7_EXTENDED_OFFLOAD_STATS +#define HAVE_INCLUDE_BITFIELD #endif /* 7.4 */ /*****************************************************************************/ #if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,5)) #else /* >= 7.5 */ #define HAVE_TCF_EXTS_TO_LIST +#define HAVE_FLOW_DISSECTOR_KEY_IP #endif /* 7.5 */ /*****************************************************************************/ @@ -59,8 +63,26 @@ #define HAVE_DEVLINK_PORT_ATTRS_SET_PORT_FLAVOUR #define HAVE_ETHTOOL_NEW_100G_BITS #undef NEED_NETDEV_TX_SENT_QUEUE +#undef NEED_IN_TASK +#define HAVE_FLOW_DISSECTOR_KEY_ENC_IP #endif /* 7.7 */ +/*****************************************************************************/ +#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,8)) +#else /* >= 7.8 */ +#endif /* 7.8 */ + +/*****************************************************************************/ +#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,9)) +#else /* >= 7.9 */ +/* mul_u64_u64_div_u64 was backported into RHEL 7.9 but not into the early + * 8.x releases + */ +#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(8,0)) +#undef NEED_MUL_U64_U64_DIV_U64 +#endif /* < 8.0 */ +#endif /* 7.9 */ + /*****************************************************************************/ #if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(8,0)) #else /* >= 8.0 */ @@ -78,13 +100,17 @@ /*****************************************************************************/ #if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(8,1)) #define NEED_IDA_ALLOC_MIN_MAX_RANGE_FREE +#define NEED_FLOW_MATCH #else /* >= 8.1 */ #define HAVE_ETHTOOL_NEW_100G_BITS #undef NEED_IDA_ALLOC_MIN_MAX_RANGE_FREE +#undef NEED_FLOW_MATCH #define HAVE_DEVLINK_PARAMS_PUBLISH #undef NEED_NETDEV_TX_SENT_QUEUE #undef NEED_INDIRECT_CALL_WRAPPER_MACROS #define HAVE_INDIRECT_CALL_WRAPPER_HEADER +#define HAVE_GRETAP_TYPE +#define HAVE_LINKMODE #endif /* 8.1 */ /*****************************************************************************/ @@ -108,7 +134,9 @@ #define HAVE_DEVLINK_HEALTH_OPS_EXTACK #define HAVE_DEVLINK_HEALTH_DEFAULT_AUTO_RECOVER #define HAVE_DEVLINK_REGION_OPS_SNAPSHOT +#define HAVE_DEVLINK_RELOAD_ENABLE_DISABLE #undef NEED_DEVLINK_REGION_CREATE_OPS +#undef NEED_MUL_U64_U64_DIV_U64 #endif /* 8.3 */ /*****************************************************************************/ @@ -118,6 +146,11 @@ #undef NEED_NET_PREFETCH #undef NEED_DEVLINK_FLASH_UPDATE_TIMEOUT_NOTIFY #undef HAVE_XDP_QUERY_PROG +#define HAVE_AF_XDP_ZC_SUPPORT +#define HAVE_MEM_TYPE_XSK_BUFF_POOL +#define HAVE_NDO_XSK_WAKEUP +#define XSK_UMEM_RETURNS_XDP_DESC +#undef NEED_XSK_UMEM_GET_RX_FRAME_SIZE #define HAVE_ETHTOOL_COALESCE_PARAMS_SUPPORT #endif /* 8.4 */ @@ -127,9 +160,15 @@ #define HAVE_DEVLINK_FLASH_UPDATE_PARAMS #define HAVE_DEVLINK_FLASH_UPDATE_PARAMS_FW #define HAVE_DEVLINK_REGION_OPS_SNAPSHOT_OPS +#define HAVE_DEVLINK_RELOAD_ACTION_AND_LIMIT #undef HAVE_DEVLINK_FLASH_UPDATE_BEGIN_END_NOTIFY #undef HAVE_NAPI_BUSY_LOOP #undef HAVE_XDP_RXQ_INFO_REG_3_PARAMS +#undef NEED_XSK_BUFF_DMA_SYNC_FOR_CPU +#define NO_XDP_QUERY_XSK_UMEM +#undef NEED_XSK_BUFF_POOL_RENAME +#define HAVE_NETDEV_BPF_XSK_POOL +#define HAVE_AF_XDP_NETDEV_UMEM #endif /* 8.5 */ /*****************************************************************************/ @@ -145,10 +184,13 @@ #if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(9,0)) #else /* >= 9.0 */ #define HAVE_XDP_BUFF_RXQ +#define HAVE_NDO_ETH_IOCTL #undef NEED_DEVLINK_ALLOC_SETS_DEV #undef HAVE_DEVLINK_PARAMS_PUBLISH -#undef HAVE_DEVLINK_RELOAD_ACTION_AND_LIMIT +#undef HAVE_DEVLINK_RELOAD_ENABLE_DISABLE #undef HAVE_DEVLINK_REGISTER_SETS_DEV +#define HAVE_DEVLINK_NOTIFY_REGISTER +#define HAVE_DEVLINK_SET_FEATURES #endif /* 9.0 */ #endif /* _KCOMPAT_RHEL_DEFS_H_ */ diff --git a/src/kcompat_sles_defs.h b/src/kcompat_sles_defs.h index c30ffdc..1e94a87 100644 --- a/src/kcompat_sles_defs.h +++ b/src/kcompat_sles_defs.h @@ -119,8 +119,8 @@ /*****************************************************************************/ /* SLES 12-SP5 base kernel version */ -#if (SLE_KERNEL_CODE < SLE_KERNEL_VERSION(4,12,14,120)) -#else /* >= 4.12.14-120 */ +#if (SLE_KERNEL_CODE < SLE_KERNEL_VERSION(4,12,14,115)) +#else /* >= 4.12.14-115 */ #define HAVE_NDO_SELECT_QUEUE_SB_DEV #define HAVE_TCF_MIRRED_DEV #define HAVE_TCF_BLOCK @@ -129,7 +129,8 @@ #undef NEED_TC_SETUP_QDISC_MQPRIO #undef NEED_TC_CLS_CAN_OFFLOAD_AND_CHAIN0 #undef NEED_NETDEV_TX_SENT_QUEUE -#endif /* 4.12.14-120 */ +#define HAVE_LINKMODE +#endif /* 4.12.14-115 */ /*****************************************************************************/ /* SLES 15-SP1 base */ @@ -147,6 +148,7 @@ #undef NEED_SKB_FRAG_OFF #undef NEED_SKB_FRAG_OFF_ADD #define HAVE_FLOW_INDR_BLOCK_LOCK +#define HAVE_DEVLINK_PARAMS_PUBLISH #endif /* 5.3.8-2 */ #if (SLE_KERNEL_CODE < SLE_KERNEL_VERSION(5,3,16,2)) @@ -154,11 +156,17 @@ #define HAVE_DEVLINK_HEALTH_OPS_EXTACK #endif /* 5.3.16-2 */ +#if (SLE_KERNEL_CODE < SLE_KERNEL_VERSION(5,3,18,24)) +#else /* >= 5.3.18-24 */ +#undef NEED_MUL_U64_U64_DIV_U64 +#endif + #if (SLE_KERNEL_CODE < SLE_KERNEL_VERSION(5,3,18,26)) #else /* >= 5.3.18-26 */ #undef NEED_CPU_LATENCY_QOS_RENAME #define HAVE_DEVLINK_REGION_OPS_SNAPSHOT_OPS #define HAVE_DEVLINK_FLASH_UPDATE_PARAMS +#define HAVE_DEVLINK_RELOAD_ENABLE_DISABLE #endif /*****************************************************************************/ @@ -181,6 +189,18 @@ #undef NEED_DEVLINK_FLASH_UPDATE_TIMEOUT_NOTIFY #endif /* 5.3.18-38 */ +/*****************************************************************************/ +#if (SLE_KERNEL_CODE < SLE_KERNEL_VERSION(5,3,18,41)) +#define NEED_XSK_BUFF_POOL_RENAME +#else /* >= 5.3.18-41 */ +#define HAVE_XDP_BUFF_FRAME_SZ +#define HAVE_NETDEV_BPF_XSK_POOL +#undef NEED_XSK_UMEM_GET_RX_FRAME_SIZE +#undef NEED_XSK_BUFF_POOL_RENAME +#undef NEED_XSK_BUFF_DMA_SYNC_FOR_CPU +#define HAVE_MEM_TYPE_XSK_BUFF_POOL +#endif /* 5.3.18-41 */ + /*****************************************************************************/ #if (SLE_KERNEL_CODE < SLE_KERNEL_VERSION(5,3,18,59)) #else /* >= 5.3.18-59 */ @@ -199,6 +219,7 @@ #if (SLE_KERNEL_CODE < SLE_KERNEL_VERSION(5,14,21,9)) #else /* >= 5.14.21-150400.9 */ #undef NEED_DEVLINK_ALLOC_SETS_DEV +#undef HAVE_DEVLINK_RELOAD_ENABLE_DISABLE #define HAVE_ETHTOOL_COALESCE_EXTACK #endif /* 5.14.21-150400.9 */ diff --git a/src/kcompat_std_defs.h b/src/kcompat_std_defs.h index 7efbafc..6518977 100644 --- a/src/kcompat_std_defs.h +++ b/src/kcompat_std_defs.h @@ -31,6 +31,12 @@ #error "KERNEL_VERSION is undefined" #endif +/*****************************************************************************/ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)) +#define NEED_DEVM_KASPRINTF +#else /* >= 3,17,0 */ +#endif /* 3,17,0 */ + /*****************************************************************************/ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)) #define NEED_DEV_PM_DOMAIN_ATTACH_DETACH @@ -65,14 +71,27 @@ #define HAVE_KTHREAD_DELAYED_API #define HAVE_NDO_OFFLOAD_STATS #undef NEED_DECLARE_STATIC_KEY_FALSE +#define HAVE_INCLUDE_BITFIELD #endif /* 4,9,0 */ +/*****************************************************************************/ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,9,62)) +#define NEED_IN_TASK +#else /* >= 4,9,62 */ +#endif /* 4,9,62 */ + /*****************************************************************************/ #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0)) #else /* >= 4,12,0 */ #define HAVE_NAPI_BUSY_LOOP #endif /* 4,12,0 */ +/*****************************************************************************/ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,13,0)) +#else /* >= 4,13,0 */ +#define HAVE_FLOW_DISSECTOR_KEY_IP +#endif /* 4,13,0 */ + /*****************************************************************************/ #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)) #define NEED_TC_SETUP_QDISC_MQPRIO @@ -114,23 +133,27 @@ #define HAVE_DEVLINK_REGIONS #define HAVE_TC_ETF_QOPT_OFFLOAD #define HAVE_DEVLINK_PARAMS +#define HAVE_FLOW_DISSECTOR_KEY_ENC_IP #endif /* 4,19,0 */ /*****************************************************************************/ #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0)) #define NEED_NETDEV_TX_SENT_QUEUE #else /* >= 4.20.0 */ +#define HAVE_LINKMODE #endif /* 4.20.0 */ /*****************************************************************************/ #if (LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0)) #define NEED_INDIRECT_CALL_WRAPPER_MACROS #else /* >= 5.0.0 */ +#define HAVE_GRETAP_TYPE #define HAVE_INDIRECT_CALL_WRAPPER_HEADER #endif /* 5.0.0 */ /*****************************************************************************/ #if (LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0)) +#define NEED_FLOW_MATCH #else /* >= 5.1.0 */ #define HAVE_ETHTOOL_200G_BITS #define HAVE_ETHTOOL_NEW_100G_BITS @@ -149,6 +172,9 @@ #define NEED_DEVLINK_FLASH_UPDATE_STATUS_NOTIFY #define NEED_BUS_FIND_DEVICE_CONST_DATA #else /* >= 5.3.0 */ +#if (LINUX_VERSION_CODE > KERNEL_VERSION(5,3,10)) +#define HAVE_DEVLINK_RELOAD_ENABLE_DISABLE +#endif /* 5.3.10 */ #endif /* 5.3.0 */ /*****************************************************************************/ @@ -187,6 +213,7 @@ /*****************************************************************************/ #if (LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0)) +#define NEED_XSK_UMEM_GET_RX_FRAME_SIZE #else /* >= 5.8.0 */ #undef HAVE_XSK_UNALIGNED_CHUNK_PLACEMENT #endif /* 5.8.0 */ @@ -196,6 +223,7 @@ #define NEED_DEVLINK_PORT_ATTRS_SET_STRUCT #define HAVE_XDP_QUERY_PROG #define NEED_INDIRECT_CALL_3_AND_4 +#define NEED_MUL_U64_U64_DIV_U64 #else /* >= 5.9.0 */ #define HAVE_TASKLET_SETUP #endif /* 5.9.0 */ @@ -204,11 +232,14 @@ #if (LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)) #define NEED_NET_PREFETCH #define NEED_DEVLINK_FLASH_UPDATE_TIMEOUT_NOTIFY +#define NEED_XSK_BUFF_DMA_SYNC_FOR_CPU +#define NEED_XSK_BUFF_POOL_RENAME #else /* >= 5.10.0 */ #define HAVE_DEVLINK_RELOAD_ACTION_AND_LIMIT #define HAVE_DEVLINK_REGION_OPS_SNAPSHOT_OPS #define HAVE_DEVLINK_FLASH_UPDATE_PARAMS #define HAVE_UDP_TUNNEL_NIC_SHARED +#define HAVE_NETDEV_BPF_XSK_POOL #endif /* 5.10.0 */ /*****************************************************************************/ @@ -219,6 +250,7 @@ #define HAVE_XSK_BATCHED_DESCRIPTOR_INTERFACES #define HAVE_PASID_SUPPORT #undef HAVE_XDP_RXQ_INFO_REG_3_PARAMS +#define HAVE_XSK_TX_PEEK_RELEASE_DESC_BATCH_3_PARAMS #endif /* 5.11.0 */ /*****************************************************************************/ @@ -256,8 +288,8 @@ #define HAVE_ETHTOOL_COALESCE_EXTACK #define HAVE_NDO_ETH_IOCTL #define HAVE_DEVICE_IN_MDEV_PARENT_OPS -#undef HAVE_DEVLINK_RELOAD_ACTION_AND_LIMIT -#undef HAVE_DEVLINK_PARAMS_PUBLISH +#define HAVE_LMV1_SUPPORT +#define NEED_PCI_IOV_VF_ID #endif /* 5.15.0 */ /*****************************************************************************/ @@ -266,6 +298,8 @@ #undef HAVE_PASID_SUPPORT #define HAVE_DEVLINK_SET_FEATURES #define HAVE_DEVLINK_NOTIFY_REGISTER +#undef HAVE_DEVLINK_RELOAD_ENABLE_DISABLE +#undef HAVE_DEVLINK_PARAMS_PUBLISH #endif /* 5.16.0 */ /*****************************************************************************/ @@ -278,11 +312,23 @@ /*****************************************************************************/ #if (LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)) -#define HAVE_XSK_TX_PEEK_RELEASE_DESC_BATCH_3_PARAMS -#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,11,0)) -#undef HAVE_XSK_TX_PEEK_RELEASE_DESC_BATCH_3_PARAMS -#endif /* 5.11.0 */ #else /* >=5.18.0*/ +#undef HAVE_LMV1_SUPPORT +#undef NEED_PCI_IOV_VF_ID +#define HAVE_GTP_SUPPORT +#undef HAVE_XSK_TX_PEEK_RELEASE_DESC_BATCH_3_PARAMS #endif /* 5.18.0 */ +/*****************************************************************************/ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,19,0)) +#else /* >=5.19.0 */ +#define HAVE_NDO_FDB_DEL_EXTACK +#endif /* 5.19.0 */ + +/*****************************************************************************/ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(6,0,0)) +#else /* >=6.0.0 */ +#define HAVE_FLOW_DISSECTOR_KEY_PPPOE +#endif /* 6.0.0 */ + #endif /* _KCOMPAT_STD_DEFS_H_ */