From 42b40dcc8475af2352e0fbd6c3893267300e89f8 Mon Sep 17 00:00:00 2001 From: Alfredo Cardigliano Date: Fri, 24 May 2024 08:05:42 +0000 Subject: [PATCH] Fix ixgbe zc compilation on ubuntu 24 --- .../ixgbe/ixgbe-5.19.6-zc/src/ixgbe_ethtool.c | 44 +++++++ .../ixgbe/ixgbe-5.19.6-zc/src/ixgbe_main.c | 4 + .../ixgbe-5.19.6-zc/src/kcompat-generator.sh | 118 +++++++++++++++--- .../ixgbe/ixgbe-5.19.6-zc/src/kcompat-lib.sh | 83 ++++++++++-- .../intel/ixgbe/ixgbe-5.19.6-zc/src/kcompat.h | 8 ++ 5 files changed, 226 insertions(+), 31 deletions(-) diff --git a/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/ixgbe_ethtool.c b/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/ixgbe_ethtool.c index 26be72a4cb..181d86d871 100644 --- a/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/ixgbe_ethtool.c +++ b/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/ixgbe_ethtool.c @@ -4375,8 +4375,12 @@ static void ixgbe_get_reta(struct ixgbe_adapter *adapter, u32 *indir) } #ifdef HAVE_RXFH_HASHFUNC +#ifdef HAVE_ETHTOOL_RXFH_PARAM +static int ixgbe_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh) +#else static int ixgbe_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc) +#endif /* HAVE_ETHTOOL_RXFH_PARAM */ #else static int ixgbe_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key) #endif @@ -4384,22 +4388,41 @@ static int ixgbe_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key) struct ixgbe_adapter *adapter = netdev_priv(netdev); #ifdef HAVE_RXFH_HASHFUNC +#ifdef HAVE_ETHTOOL_RXFH_PARAM + rxfh->hfunc = ETH_RSS_HASH_TOP; +#else if (hfunc) *hfunc = ETH_RSS_HASH_TOP; +#endif /* HAVE_ETHTOOL_RXFH_PARAM */ #endif +#ifdef HAVE_ETHTOOL_RXFH_PARAM + if (rxfh->indir) + ixgbe_get_reta(adapter, rxfh->indir); +#else if (indir) ixgbe_get_reta(adapter, indir); +#endif /* HAVE_ETHTOOL_RXFH_PARAM */ +#ifdef HAVE_ETHTOOL_RXFH_PARAM + if (rxfh->key) + memcpy(rxfh->key, adapter->rss_key, ixgbe_get_rxfh_key_size(netdev)); +#else if (key) memcpy(key, adapter->rss_key, ixgbe_get_rxfh_key_size(netdev)); +#endif /* HAVE_ETHTOOL_RXFH_PARAM */ return 0; } #ifdef HAVE_RXFH_HASHFUNC +#ifdef HAVE_ETHTOOL_RXFH_PARAM +static int ixgbe_set_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh, + struct netlink_ext_ack *extack) +#else static int ixgbe_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key, const u8 hfunc) +#endif /* HAVE_ETHTOOL_RXFH_PARAM */ #else #ifdef HAVE_RXFH_NONCONST static int ixgbe_set_rxfh(struct net_device *netdev, u32 *indir, u8 *key) @@ -4414,12 +4437,20 @@ static int ixgbe_set_rxfh(struct net_device *netdev, const u32 *indir, u32 reta_entries = ixgbe_rss_indir_tbl_entries(adapter); #ifdef HAVE_RXFH_HASHFUNC +#ifdef HAVE_ETHTOOL_RXFH_PARAM + if (rxfh->hfunc) +#else if (hfunc) +#endif /* HAVE_ETHTOOL_RXFH_PARAM */ return -EINVAL; #endif /* Fill out the redirection table */ +#ifdef HAVE_ETHTOOL_RXFH_PARAM + if (rxfh->indir) { +#else if (indir) { +#endif /* HAVE_ETHTOOL_RXFH_PARAM */ int max_queues = min_t(int, adapter->num_rx_queues, ixgbe_rss_indir_tbl_max(adapter)); @@ -4430,18 +4461,31 @@ static int ixgbe_set_rxfh(struct net_device *netdev, const u32 *indir, /* Verify user input. */ for (i = 0; i < reta_entries; i++) +#ifdef HAVE_ETHTOOL_RXFH_PARAM + if (rxfh->indir[i] >= max_queues) +#else if (indir[i] >= max_queues) +#endif /* HAVE_ETHTOOL_RXFH_PARAM */ return -EINVAL; for (i = 0; i < reta_entries; i++) +#ifdef HAVE_ETHTOOL_RXFH_PARAM + adapter->rss_indir_tbl[i] = rxfh->indir[i]; +#else adapter->rss_indir_tbl[i] = indir[i]; +#endif /* HAVE_ETHTOOL_RXFH_PARAM */ ixgbe_store_reta(adapter); } /* Fill out the rss hash key */ +#ifdef HAVE_ETHTOOL_RXFH_PARAM + if (rxfh->key) { + memcpy(adapter->rss_key, rxfh->key, ixgbe_get_rxfh_key_size(netdev)); +#else if (key) { memcpy(adapter->rss_key, key, ixgbe_get_rxfh_key_size(netdev)); +#endif /* HAVE_ETHTOOL_RXFH_PARAM */ ixgbe_store_key(adapter); } diff --git a/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/ixgbe_main.c b/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/ixgbe_main.c index b3194597b4..8aa40ece4b 100644 --- a/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/ixgbe_main.c +++ b/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/ixgbe_main.c @@ -13519,7 +13519,9 @@ static int ixgbe_probe(struct pci_dev *pdev, if (mac_type == ixgbe_mac_82598EB) pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S); +#ifdef HAVE_PCI_ENABLE_PCIE_ERROR_REPORTING pci_enable_pcie_error_reporting(pdev); +#endif /* HAVE_PCI_ENABLE_PCIE_ERROR_REPORTING */ pci_set_master(pdev); @@ -14236,7 +14238,9 @@ static void ixgbe_remove(struct pci_dev *pdev) disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state); free_netdev(netdev); +#ifdef HAVE_PCI_ENABLE_PCIE_ERROR_REPORTING pci_disable_pcie_error_reporting(pdev); +#endif /* HAVE_PCI_ENABLE_PCIE_ERROR_REPORTING */ if (disable_dev) pci_disable_device(pdev); diff --git a/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/kcompat-generator.sh b/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/kcompat-generator.sh index eccac66a6e..6c80df6a7c 100644 --- a/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/kcompat-generator.sh +++ b/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/kcompat-generator.sh @@ -1,6 +1,6 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0-only -# Copyright (C) 1999 - 2023 Intel Corporation +# Copyright (C) 2013-2024 Intel Corporation set -Eeuo pipefail @@ -28,11 +28,12 @@ set -Eeuo pipefail # Most of the implementation is in kcompat-lib.sh, here are actual 'gen' calls. export LC_ALL=C +SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")" ORIG_CWD="$(pwd)" trap 'rc=$?; echo >&2 "$(realpath "$ORIG_CWD/${BASH_SOURCE[0]}"):$LINENO: failed with rc: $rc"' ERR # shellcheck source=kcompat-lib.sh -source "$ORIG_CWD"/kcompat-lib.sh +source "$SCRIPT_DIR"/kcompat-lib.sh # DO NOT break gen calls below (via \), to make our compat code more grep-able, # keep them also grouped, first by feature (like DEVLINK), then by .h filename @@ -41,6 +42,27 @@ source "$ORIG_CWD"/kcompat-lib.sh # handy line of DOC copy-pasted form kcompat-lib.sh: # gen DEFINE if (KIND [METHOD of]) NAME [(matches|lacks) PATTERN|absent] in +function gen-aux() { + ah='include/linux/auxiliary_bus.h' + mh='include/linux/mod_devicetable.h' + if config_has CONFIG_AUXILIARY_BUS; then + gen HAVE_AUXILIARY_DRIVER_INT_REMOVE if method remove of auxiliary_driver matches 'int' in "$ah" + fi + + # generate HAVE_AUXILIARY_DEVICE_ID only for cases when it's disabled in .config + if ! config_has CONFIG_AUXILIARY_BUS; then + gen HAVE_AUXILIARY_DEVICE_ID if struct auxiliary_device_id in "$mh" + fi +} + +function gen-bitfield() { + bf='include/linux/bitfield.h' + gen HAVE_INCLUDE_BITFIELD if macro FIELD_PREP in "$bf" + gen NEED_BITFIELD_FIELD_FIT if macro FIELD_FIT absent in "$bf" + gen NEED_BITFIELD_FIELD_MASK if fun field_mask absent in "$bf" + gen NEED_BITFIELD_FIELD_MAX if macro FIELD_MAX absent in "$bf" +} + function gen-device() { dh='include/linux/device.h' dph='include/linux/dev_printk.h' @@ -58,15 +80,20 @@ function gen-devlink() { gen HAVE_DEVLINK_FLASH_UPDATE_PARAMS if struct devlink_flash_update_params in "$dh" gen HAVE_DEVLINK_FLASH_UPDATE_PARAMS_FW if struct devlink_flash_update_params matches 'struct firmware \\*fw' in "$dh" gen HAVE_DEVLINK_HEALTH if enum devlink_health_reporter_state in "$dh" - gen HAVE_DEVLINK_HEALTH_DEFAULT_AUTO_RECOVER if fun devlink_health_reporter_create lacks auto_recover in "$dh" - gen HAVE_DEVLINK_HEALTH_OPS_EXTACK if method dump of devlink_health_reporter_ops matches ext_ack in "$dh" + gen HAVE_DEVLINK_HEALTH_OPS_EXTACK if method dump of devlink_health_reporter_ops matches extack in "$dh" gen HAVE_DEVLINK_INFO_DRIVER_NAME_PUT if fun devlink_info_driver_name_put in "$dh" - gen HAVE_DEVLINK_NOTIFY_REGISTER if fun devlink_notify_register in "$dh" - gen HAVE_DEVLINK_PARAMS if method validate of devlink_param matches ext_ack in "$dh" + gen HAVE_DEVLINK_PARAMS if method validate of devlink_param matches extack in "$dh" gen HAVE_DEVLINK_PARAMS_PUBLISH if fun devlink_params_publish in "$dh" + gen HAVE_DEVLINK_PORT_NEW if method port_new of devlink_ops in "$dh" + gen HAVE_DEVLINK_PORT_OPS if struct devlink_port_ops in "$dh" gen HAVE_DEVLINK_PORT_SPLIT if method port_split of devlink_ops in "$dh" - gen HAVE_DEVLINK_PORT_SPLIT_EXTACK if method port_split of devlink_ops matches netlink_ext_ack in "$dh" + gen HAVE_DEVLINK_PORT_SPLIT if method port_split of devlink_port_ops in "$dh" + gen HAVE_DEVLINK_PORT_SPLIT_EXTACK if method port_split of devlink_ops matches extack in "$dh" + gen HAVE_DEVLINK_PORT_SPLIT_EXTACK if method port_split of devlink_port_ops matches extack in "$dh" + gen HAVE_DEVLINK_PORT_SPLIT_IN_OPS if method port_split of devlink_ops in "$dh" + gen HAVE_DEVLINK_PORT_SPLIT_IN_PORT_OPS if method port_split of devlink_port_ops in "$dh" gen HAVE_DEVLINK_PORT_SPLIT_PORT_STRUCT if method port_split of devlink_ops matches devlink_port in "$dh" + gen HAVE_DEVLINK_PORT_SPLIT_PORT_STRUCT if method port_split of devlink_port_ops matches devlink_port in "$dh" gen HAVE_DEVLINK_PORT_TYPE_ETH_HAS_NETDEV if fun devlink_port_type_eth_set matches 'struct net_device' in "$dh" gen HAVE_DEVLINK_RATE_NODE_CREATE if fun devl_rate_node_create in "$dh" # keep devlink_region_ops body in variable, to not look 4 times for @@ -79,22 +106,32 @@ function gen-devlink() { gen HAVE_DEVLINK_REGISTER_SETS_DEV if fun devlink_register matches 'struct device' in "$dh" gen HAVE_DEVLINK_RELOAD_ENABLE_DISABLE if fun devlink_reload_enable in "$dh" gen HAVE_DEVLINK_SET_FEATURES if fun devlink_set_features in "$dh" - gen HAVE_DEVLINK_UNLOCKED_RESOURCE if fun devl_resource_size_get in "$dh" + gen HAVE_DEVL_HEALTH_REPORTER_DESTROY if fun devl_health_reporter_destroy in "$dh" gen HAVE_DEVL_PORT_REGISTER if fun devl_port_register in "$dh" + gen NEED_DEVLINK_HEALTH_DEFAULT_AUTO_RECOVER if fun devlink_health_reporter_create matches auto_recover in "$dh" + gen NEED_DEVLINK_RESOURCES_UNREGISTER_NO_RESOURCE if fun devlink_resources_unregister matches 'struct devlink_resource \\*' in "$dh" + gen NEED_DEVLINK_TO_DEV if fun devlink_to_dev absent in "$dh" + gen NEED_DEVLINK_UNLOCKED_RESOURCE if fun devl_resource_size_get absent in "$dh" + gen HAVE_DEVLINK_PORT_FLAVOUR_PCI_SF if enum devlink_port_flavour matches DEVLINK_PORT_FLAVOUR_PCI_SF in include/uapi/linux/devlink.h gen HAVE_DEVLINK_RELOAD_ACTION_AND_LIMIT if enum devlink_reload_action matches DEVLINK_RELOAD_ACTION_FW_ACTIVATE in include/uapi/linux/devlink.h } function gen-ethtool() { eth='include/linux/ethtool.h' + ueth='include/uapi/linux/ethtool.h' + gen HAVE_ETHTOOL_COALESCE_EXTACK if method get_coalesce of ethtool_ops matches 'struct kernel_ethtool_coalesce \\*' in "$eth" gen HAVE_ETHTOOL_EXTENDED_RINGPARAMS if method get_ringparam of ethtool_ops matches 'struct kernel_ethtool_ringparam \\*' in "$eth" + gen HAVE_ETHTOOL_KEEE if struct ethtool_keee in "$eth" + gen HAVE_ETHTOOL_RXFH_PARAM if struct ethtool_rxfh_param in "$eth" gen NEED_ETHTOOL_SPRINTF if fun ethtool_sprintf absent in "$eth" + gen HAVE_ETHTOOL_FLOW_RSS if macro FLOW_RSS in "$ueth" } function gen-filter() { fh='include/linux/filter.h' - gen HAVE_XDP_DO_FLUSH if fun xdp_do_flush_map in "$fh" gen NEED_NO_NETDEV_PROG_XDP_WARN_ACTION if fun bpf_warn_invalid_xdp_action lacks 'struct net_device \\*' in "$fh" + gen NEED_XDP_DO_FLUSH if fun xdp_do_flush absent in "$fh" } function gen-flow-dissector() { @@ -107,30 +144,40 @@ function gen-flow-dissector() { function gen-gnss() { cdh='include/linux/cdev.h' clh='include/linux/device/class.h' + dh='include/linux/device.h' gh='include/linux/gnss.h' th='include/uapi/linux/types.h' fh='include/linux/fs.h' gen HAVE_CDEV_DEVICE if fun cdev_device_add in "$cdh" - gen HAVE_DEV_UEVENT_CONST if method dev_uevent of class matches 'const struct device' in "$clh" - gen HAVE_POLL_T if typedef __poll_t in "$th" + gen HAVE_DEV_UEVENT_CONST if method dev_uevent of class matches '(const|RH_KABI_CONST) struct device' in "$clh" "$dh" gen HAVE_STREAM_OPEN if fun stream_open in "$fh" + # There can be either macro class_create or a function + gen NEED_CLASS_CREATE_WITH_MODULE_PARAM if fun class_create matches 'owner' in "$clh" "$dh" + gen NEED_CLASS_CREATE_WITH_MODULE_PARAM if macro class_create in "$clh" "$dh" - if ! grep -qE CONFIG_SUSE_KERNEL.+1 "$CONFFILE"; then + if ! config_has CONFIG_SUSE_KERNEL; then gen HAVE_GNSS_MODULE if struct gnss_device in "$gh" fi + + gen HAVE_POLL_T if typedef __poll_t in "$th" } function gen-netdevice() { ndh='include/linux/netdevice.h' + gen HAVE_NDO_ETH_IOCTL if fun ndo_eth_ioctl in "$ndh" + gen HAVE_NDO_EXTENDED_SET_TX_MAXRATE if method ndo_set_tx_maxrate of net_device_ops_extended in "$ndh" gen HAVE_NDO_FDB_ADD_VID if method ndo_fdb_del of net_device_ops matches 'u16 vid' in "$ndh" - gen HAVE_NDO_FDB_DEL_EXTACK if method ndo_fdb_del of net_device_ops matches ext_ack in "$ndh" + gen HAVE_NDO_FDB_DEL_EXTACK if method ndo_fdb_del of net_device_ops matches extack in "$ndh" gen HAVE_NDO_GET_DEVLINK_PORT if method ndo_get_devlink_port of net_device_ops in "$ndh" gen HAVE_NDO_UDP_TUNNEL_CALLBACK if method ndo_udp_tunnel_add of net_device_ops in "$ndh" + gen HAVE_NETDEV_EXTENDED_MIN_MAX_MTU if struct net_device_extended matches min_mtu in "$ndh" + gen HAVE_NETDEV_MIN_MAX_MTU if struct net_device matches min_mtu in "$ndh" gen HAVE_NETIF_SET_TSO_MAX if fun netif_set_tso_max_size in "$ndh" gen HAVE_SET_NETDEV_DEVLINK_PORT if macro SET_NETDEV_DEVLINK_PORT in "$ndh" gen NEED_NETIF_NAPI_ADD_NO_WEIGHT if fun netif_napi_add matches 'int weight' in "$ndh" gen NEED_NET_PREFETCH if fun net_prefetch absent in "$ndh" + gen NEED_XDP_FEATURES if enum netdev_xdp_act absent in include/uapi/linux/netdev.h } function gen-pci() { @@ -140,38 +187,68 @@ function gen-pci() { gen HAVE_PCI_MSIX_FREE_IRQ if fun pci_msix_free_irq in "$pcih" gen HAVE_PER_VF_MSIX_SYSFS if method sriov_set_msix_vec_count of pci_driver in "$pcih" gen HAVE_STRUCT_PCI_DEV_PTM_ENABLED if struct pci_dev matches ptm_enabled in "$pcih" + gen NEED_PCIE_FLR if fun pcie_flr absent in "$pcih" + gen NEED_PCIE_FLR_RETVAL if fun pcie_flr lacks 'int pcie_flr' in "$pcih" gen NEED_PCIE_PTM_ENABLED if fun pcie_ptm_enabled absent in "$pcih" gen NEED_PCI_ENABLE_PTM if fun pci_enable_ptm absent in "$pcih" } function gen-other() { - gen NEED_PCI_AER_CLEAR_NONFATAL_STATUS if fun pci_aer_clear_nonfatal_status absent in include/linux/aer.h + pciaerh='include/linux/aer.h' + ush='include/linux/u64_stats_sync.h' + gen HAVE_PCI_ENABLE_PCIE_ERROR_REPORTING if fun pci_enable_pcie_error_reporting in "$pciaerh" + gen NEED_PCI_AER_CLEAR_NONFATAL_STATUS if fun pci_aer_clear_nonfatal_status absent in "$pciaerh" gen NEED_BITMAP_COPY_CLEAR_TAIL if fun bitmap_copy_clear_tail absent in include/linux/bitmap.h gen NEED_BITMAP_FROM_ARR32 if fun bitmap_from_arr32 absent in include/linux/bitmap.h gen NEED_BITMAP_TO_ARR32 if fun bitmap_to_arr32 absent in include/linux/bitmap.h + gen NEED_ASSIGN_BIT if fun assign_bit absent in include/linux/bitops.h + gen NEED___STRUCT_SIZE if macro __struct_size absent in include/linux/compiler_types.h include/linux/fortify-string.h gen HAVE_COMPLETION_RAW_SPINLOCK if struct completion matches 'struct swait_queue_head' in include/linux/completion.h + gen NEED_IS_CONSTEXPR if macro __is_constexpr absent in include/linux/const.h include/linux/minmax.h include/linux/kernel.h + gen NEED_DEBUGFS_LOOKUP if fun debugfs_lookup absent in include/linux/debugfs.h + gen NEED_DEBUGFS_LOOKUP_AND_REMOVE if fun debugfs_lookup_and_remove absent in include/linux/debugfs.h gen NEED_ETH_HW_ADDR_SET if fun eth_hw_addr_set absent in include/linux/etherdevice.h + gen NEED_FIND_NEXT_BIT_WRAP if fun find_next_bit_wrap absent in include/linux/find.h + gen HAVE_FS_FILE_DENTRY if fun file_dentry in include/linux/fs.h + gen HAVE_HWMON_DEVICE_REGISTER_WITH_INFO if fun hwmon_device_register_with_info in include/linux/hwmon.h + gen NEED_HWMON_CHANNEL_INFO if macro HWMON_CHANNEL_INFO absent in include/linux/hwmon.h gen HAVE_IOMMU_DEV_FEAT_AUX if enum iommu_dev_features matches IOMMU_DEV_FEAT_AUX in include/linux/iommu.h gen NEED_DEFINE_STATIC_KEY_FALSE if macro DEFINE_STATIC_KEY_FALSE absent in include/linux/jump_label.h gen NEED_STATIC_BRANCH_LIKELY if macro static_branch_likely absent in include/linux/jump_label.h gen HAVE_STRUCT_STATIC_KEY_FALSE if struct static_key_false in include/linux/jump_label.h include/linux/jump_label_type.h gen NEED_DECLARE_STATIC_KEY_FALSE if macro DECLARE_STATIC_KEY_FALSE absent in include/linux/jump_label.h include/linux/jump_label_type.h + gen NEED_LOWER_16_BITS if macro lower_16_bits absent in include/linux/kernel.h + gen NEED_UPPER_16_BITS if macro upper_16_bits absent in include/linux/kernel.h + gen NEED_LIST_COUNT_NODES if fun list_count_nodes absent in include/linux/list.h gen NEED_MUL_U64_U64_DIV_U64 if fun mul_u64_u64_div_u64 absent in include/linux/math64.h + gen HAVE_MDEV_GET_DRVDATA if fun mdev_get_drvdata in include/linux/mdev.h + gen HAVE_MDEV_REGISTER_PARENT if fun mdev_register_parent in include/linux/mdev.h + gen HAVE_NO_STRSCPY if fun strscpy absent in include/linux/string.h gen NEED_DEV_PM_DOMAIN_ATTACH if fun dev_pm_domain_attach absent in include/linux/pm_domain.h include/linux/pm.h gen NEED_DEV_PM_DOMAIN_DETACH if fun dev_pm_domain_detach absent in include/linux/pm_domain.h include/linux/pm.h + gen NEED_PTP_CLASSIFY_RAW if fun ptp_classify_raw absent in include/linux/ptp_classify.h gen NEED_PTP_PARSE_HEADER if fun ptp_parse_header absent in include/linux/ptp_classify.h + gen HAVE_PTP_CLOCK_INFO_ADJFINE if method adjfine of ptp_clock_info in include/linux/ptp_clock_kernel.h gen NEED_DIFF_BY_SCALED_PPM if fun diff_by_scaled_ppm absent in include/linux/ptp_clock_kernel.h gen NEED_PTP_SYSTEM_TIMESTAMP if fun ptp_read_system_prets absent in include/linux/ptp_clock_kernel.h + gen NEED_DEV_PAGE_IS_REUSABLE if fun dev_page_is_reusable absent in include/linux/skbuff.h + gen NEED_NAPI_BUILD_SKB if fun napi_build_skb absent in include/linux/skbuff.h + gen NEED_KREALLOC_ARRAY if fun krealloc_array absent in include/linux/slab.h + gen NEED_DECLARE_FLEX_ARRAY if macro DECLARE_FLEX_ARRAY absent in include/linux/stddef.h gen NEED_SYSFS_EMIT if fun sysfs_emit absent in include/linux/sysfs.h - gen HAVE_U64_STATS_FETCH_BEGIN_IRQ if fun u64_stats_fetch_begin_irq in include/linux/u64_stats_sync.h - gen HAVE_U64_STATS_FETCH_RETRY_IRQ if fun u64_stats_fetch_retry_irq in include/linux/u64_stats_sync.h + gen HAVE_TRACE_ENABLED_SUPPORT if implementation of macro __DECLARE_TRACE matches 'trace_##name##_enabled' in include/linux/tracepoint.h + gen HAVE_TTY_OP_WRITE_SIZE_T if method write of tty_operations matches size_t in include/linux/tty_driver.h + gen HAVE_U64_STATS_FETCH_BEGIN_IRQ if fun u64_stats_fetch_begin_irq in "$ush" + gen HAVE_U64_STATS_FETCH_RETRY_IRQ if fun u64_stats_fetch_retry_irq in "$ush" + gen NEED_U64_STATS_READ if fun u64_stats_read absent in "$ush" + gen NEED_U64_STATS_SET if fun u64_stats_set absent in "$ush" gen HAVE_LMV1_SUPPORT if macro VFIO_REGION_TYPE_MIGRATION in include/uapi/linux/vfio.h } # all the generations, extracted from main() to keep normal code and various # prep separated function gen-all() { - if grep -qE CONFIG_NET_DEVLINK.+1 "$CONFFILE"; then + if config_has CONFIG_NET_DEVLINK; then gen-devlink fi gen-netdevice @@ -179,6 +256,8 @@ function gen-all() { if [ -n "${JUST_UNIT_TESTING-}" ]; then return fi + gen-aux + gen-bitfield gen-device gen-ethtool gen-filter @@ -218,14 +297,17 @@ function main() { exit 8 fi - # we need just CONFIG_NET_DEVLINK so far, but it's in .config, required + # we need some flags from .config or (autoconf.h), required if [ ! -f "${CONFFILE-}" ]; then echo >&2 ".config should be passed as env CONFFILE (and it's not set or not a file)" exit 9 fi + echo "#ifndef _KCOMPAT_GENERATED_DEFS_H_" + echo "#define _KCOMPAT_GENERATED_DEFS_H_" gen-all + echo "#endif /* _KCOMPAT_GENERATED_DEFS_H_ */" if [ -n "${OUT-}" ]; then cd "$ORIG_CWD" diff --git a/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/kcompat-lib.sh b/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/kcompat-lib.sh index 454cbb564c..280951ac53 100644 --- a/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/kcompat-lib.sh +++ b/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/kcompat-lib.sh @@ -1,6 +1,6 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0-only -# Copyright (C) 1999 - 2023 Intel Corporation +# Copyright (C) 2013-2024 Intel Corporation # to be sourced @@ -36,10 +36,6 @@ function filter-out-bad-files() { fi local any=0 diagmsgs=/dev/stderr re=$'[\t \n]' [ -n "${QUIET_COMPAT-}" ] && diagmsgs=/dev/null - - # HAVE_PF_RING - diagmsgs=/dev/null - for x in "$@"; do if [ -e "$x" ]; then if [[ "$x" =~ $re ]]; then @@ -108,7 +104,7 @@ function find-fun-decl() { function find-enum-decl() { test $# -ge 2 local what end - what="/^$WB*enum $1"' \{$/' + what="/^$WB*enum$WB+$1"' \{$/' end='/\};$/' shift find-decl "$what" "$end" "$@" @@ -118,7 +114,7 @@ function find-enum-decl() { function find-struct-decl() { test $# -ge 2 local what end - what="/^$WB*struct $1"' \{$/' + what="/^$WB*struct$WB+$1"' \{$/' end='/^\};$/' # that's (^) different from enum-decl shift find-decl "$what" "$end" "$@" @@ -129,8 +125,21 @@ function find-macro-decl() { test $# -ge 2 local what end # only unindented defines, only whole-word match - what="/^#define $1"'([ \t\(]|$)/' - end=1 # only first line (bumping to bigger number does not bring more ;) + what="/^#define$WB+$1"'([ \t\(]|$)/' + end=1 # only first line; use find-macro-implementation-decl for full body + shift + find-decl "$what" "$end" "$@" +} + +# yield full macro implementation +function find-macro-implementation-decl() { + test $# -ge 2 + local what end + # only unindented defines, only whole-word match + what="/^#define$WB+$1"'([ \t\(]|$)/' + # full implementation, until a line not ending in a backslash. + # Does not handle macros with comments embedded within the definition. + end='/[^\\]$/' shift find-decl "$what" "$end" "$@" } @@ -158,10 +167,15 @@ function find-typedef-decl() { # NAME is the name for what we are looking for; # # KIND specifies what kind of declaration/definition we are looking for, -# could be: fun, enum, struct, method, macro, typedef +# could be: fun, enum, struct, method, macro, typedef, +# 'implementation of macro' # for KIND=method, we are looking for function ptr named METHOD in struct # named NAME (two optional args are then necessary (METHOD & of)); # +# for KIND='implementation of macro' we are looking for the full +# implementation of the macro, not just its first line. This is usually +# combined with "matches" or "lacks". +# # next [optional] args could be used: # matches PATTERN - use to grep for the PATTERN within definition # (eg, for ext_ack param) @@ -178,7 +192,7 @@ function find-typedef-decl() { # is just space-separate list of files to look in, # single (-) for stdin. # -# PATTERN is awk pattern, will be wrapped by two slashes (/) +# PATTERN is an awk pattern, will be wrapped by two slashes (/) function gen() { test $# -ge 6 || die 20 "too few arguments, $# given, at least 6 needed" local define if_kw kind name in_kw # mandatory @@ -203,6 +217,16 @@ function gen() { shift 3 [ "$of_kw" != of ] && die 23 "$src_line: 'of' keyword expected, '$of_kw' given" ;; + implementation) + test $# -ge 5 || die 28 "$src_line: too few arguments, $orig_args_cnt given, at least 8 needed" + of_kw="$1" + kind="$2" + name="$3" + shift 3 + [ "$of_kw" != of ] && die 29 "$src_line: 'of' keyword expected, '$of_kw' given" + [ "$kind" != macro ] && die 30 "$src_line: implementation only supports 'macro', '$kind' given" + kind=macro-implementation + ;; *) die 24 "$src_line: unknown KIND ($kind) to look for" ;; esac operator="$1" @@ -230,7 +254,7 @@ function gen() { local first_decl= if [ "$kind" = method ]; then - first_decl="$(find-struct-decl "$name" "$@")" || exit 28 + first_decl="$(find-struct-decl "$name" "$@")" || exit 40 # prepare params for next lookup phase set -- - # overwrite $@ to be single dash (-) name="$method_name" @@ -242,8 +266,23 @@ function gen() { # lookup the NAME local body - body="$(find-$kind-decl "$name" "$@" <<< "$first_decl")" || exit 29 + body="$(find-$kind-decl "$name" "$@" <<< "$first_decl")" || exit 41 awk -v define="$define" -v pattern="$pattern" -v "$operator"=1 ' + BEGIN { + # prepend "identifier boundary" to pattern, also append + # it, but only for patterns not ending with such already + # + # eg: "foo" -> "\bfoo\b" + # "struct foo *" -> "\bstruct foo *" + + # Note that mawk does not support "\b", so we have our + # own approximation, NI + NI = "[^A-Za-z0-9_]" # "Not an Indentifier" + + if (!match(pattern, NI "$")) + pattern = pattern "(" NI "|$)" + pattern = "(^|" NI ")" pattern + } /./ { not_empty = 1 } $0 ~ pattern { found = 1 } END { @@ -252,3 +291,21 @@ function gen() { } ' <<< "$body" } + +# tell if given flag is enabled in .config +# return 0 if given flag is enabled, 1 otherwise +# inputs: +# $1 - flag to check (whole word, without _MODULE suffix) +# env flag $CONFFILE +# +# there are two "config" formats supported, to ease up integrators lifes +# .config (without leading #~ prefix): +#~ # CONFIG_ACPI_EC_DEBUGFS is not set +#~ CONFIG_ACPI_AC=y +#~ CONFIG_ACPI_VIDEO=m +# and autoconf.h, which would be: +#~ #define CONFIG_ACPI_AC 1 +#~ #define CONFIG_ACPI_VIDEO_MODULE 1 +function config_has() { + grep -qE "^(#define )?$1((_MODULE)? 1|=m|=y)$" "$CONFFILE" +} diff --git a/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/kcompat.h b/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/kcompat.h index d81b514a46..99edd6c7b5 100644 --- a/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/kcompat.h +++ b/drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/kcompat.h @@ -7089,6 +7089,14 @@ _kc_napi_busy_loop(unsigned int napi_id, #define HAVE_GRO_HEADER #endif /* >=5.12.0 */ +/*****************************************************************************/ +/* HAVE_PF_RING */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)) + +#define strlcpy(...) (void)(strscpy(__VA_ARGS__)) + +#endif + /*****************************************************************************/ /* * Load the implementations file which actually defines kcompat backports.