Skip to content

Commit

Permalink
Fix ixgbe zc compilation on ubuntu 24
Browse files Browse the repository at this point in the history
  • Loading branch information
cardigliano committed May 24, 2024
1 parent 568d9e3 commit 42b40dc
Show file tree
Hide file tree
Showing 5 changed files with 226 additions and 31 deletions.
44 changes: 44 additions & 0 deletions drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/ixgbe_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -4375,31 +4375,54 @@ 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
{
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)
Expand All @@ -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));

Expand All @@ -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);
}

Expand Down
4 changes: 4 additions & 0 deletions drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/ixgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
118 changes: 100 additions & 18 deletions drivers/intel/ixgbe/ixgbe-5.19.6-zc/src/kcompat-generator.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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 <list-of-files>

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'
Expand All @@ -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
Expand All @@ -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() {
Expand All @@ -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() {
Expand All @@ -140,45 +187,77 @@ 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
# code above is covered by unit_tests/test_gold.sh
if [ -n "${JUST_UNIT_TESTING-}" ]; then
return
fi
gen-aux
gen-bitfield
gen-device
gen-ethtool
gen-filter
Expand Down Expand Up @@ -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"
Expand Down
Loading

0 comments on commit 42b40dc

Please sign in to comment.