Skip to content

Commit

Permalink
Fix ice zc compilation on ubuntu 24
Browse files Browse the repository at this point in the history
  • Loading branch information
cardigliano committed May 23, 2024
1 parent d958573 commit 19c0028
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 33 deletions.
35 changes: 10 additions & 25 deletions drivers/intel/ice/ice-1.12.7-zc/src/ice_devlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -2005,8 +2005,10 @@ static const struct devlink_ops ice_devlink_ops = {
.reload_up = ice_devlink_reload_up,
#endif /* HAVE_DEVLINK_RELOAD_ACTION_AND_LIMIT */
#ifdef HAVE_DEVLINK_PORT_SPLIT
#ifdef HAVE_DEVLINK_PORT_SPLIT_IN_OPS
.port_split = ice_devlink_port_split,
.port_unsplit = ice_devlink_port_unsplit,
#endif
#endif /* HAVE_DEVLINK_PORT_SPLIT */
.eswitch_mode_get = ice_eswitch_mode_get,
.eswitch_mode_set = ice_eswitch_mode_set,
Expand Down Expand Up @@ -2668,49 +2670,32 @@ ice_mdd_reporter_dump(struct devlink_health_reporter *reporter,
struct ice_pf *pf = devlink_health_reporter_priv(reporter);
struct ice_mdd_reporter *mdd_reporter = &pf->mdd_reporter;
struct ice_mdd_event *mdd_event;
int err;

err = devlink_fmsg_u32_pair_put(fmsg, "count",
devlink_fmsg_u32_pair_put(fmsg, "count",
mdd_reporter->count);
if (err)
return err;

list_for_each_entry(mdd_event, &mdd_reporter->event_list, list) {
char *src;

err = devlink_fmsg_obj_nest_start(fmsg);
if (err)
return err;
devlink_fmsg_obj_nest_start(fmsg);

src = ICE_MDD_SRC_TO_STR(mdd_event->src);

err = devlink_fmsg_string_pair_put(fmsg, "src", src);
if (err)
return err;
devlink_fmsg_string_pair_put(fmsg, "src", src);

err = devlink_fmsg_u8_pair_put(fmsg, "pf_num",
devlink_fmsg_u8_pair_put(fmsg, "pf_num",
mdd_event->pf_num);
if (err)
return err;

err = devlink_fmsg_u32_pair_put(fmsg, "mdd_vf_num",
devlink_fmsg_u32_pair_put(fmsg, "mdd_vf_num",
mdd_event->vf_num);
if (err)
return err;

err = devlink_fmsg_u8_pair_put(fmsg, "mdd_event",
devlink_fmsg_u8_pair_put(fmsg, "mdd_event",
mdd_event->event);
if (err)
return err;

err = devlink_fmsg_u32_pair_put(fmsg, "mdd_queue",
devlink_fmsg_u32_pair_put(fmsg, "mdd_queue",
mdd_event->queue);
if (err)
return err;

err = devlink_fmsg_obj_nest_end(fmsg);
if (err)
return err;
devlink_fmsg_obj_nest_end(fmsg);
}

return 0;
Expand Down
64 changes: 61 additions & 3 deletions drivers/intel/ice/ice-1.12.7-zc/src/ice_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -4740,8 +4740,13 @@ static u32 ice_get_rxfh_indir_size(struct net_device *netdev)
*
* Reads the indirection table directly from the hardware.
*/
#ifdef HAVE_ETHTOOL_RXFH_PARAM
static int
ice_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh)
#else
static int
ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
#endif /* HAVE_ETHTOOL_RXFH_PARAM */
#else
static int ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
#endif
Expand All @@ -4753,11 +4758,19 @@ static int ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
u8 *lut;

#ifdef HAVE_RXFH_HASHFUNC
#ifdef HAVE_ETHTOOL_RXFH_PARAM
rxfh->hfunc = ETH_RSS_HASH_TOP;
#else
if (hfunc)
*hfunc = ETH_RSS_HASH_TOP;
#endif
#endif

#ifdef HAVE_ETHTOOL_RXFH_PARAM
if (!rxfh->indir)
#else
if (!indir)
#endif
return 0;

if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
Expand All @@ -4770,7 +4783,11 @@ static int ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
if (!lut)
return -ENOMEM;

#ifdef HAVE_ETHTOOL_RXFH_PARAM
err = ice_get_rss_key(vsi, rxfh->key);
#else
err = ice_get_rss_key(vsi, key);
#endif
if (err)
goto out;

Expand All @@ -4779,7 +4796,11 @@ static int ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
goto out;

for (i = 0; i < vsi->rss_table_size; i++)
#ifdef HAVE_ETHTOOL_RXFH_PARAM
rxfh->indir[i] = (u32)(lut[i]);
#else
indir[i] = (u32)(lut[i]);
#endif

out:
kfree(lut);
Expand All @@ -4797,9 +4818,15 @@ static int ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
* Returns -EINVAL if the table specifies an invalid queue ID, otherwise
* returns 0 after programming the table.
*/
#ifdef HAVE_ETHTOOL_RXFH_PARAM
static int
ice_set_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
#else
static int
ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key,
const u8 hfunc)
#endif /* HAVE_ETHTOOL_RXFH_PARAM */
#elif defined(HAVE_RXFH_NONCONST)
static int ice_set_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
#else
Expand All @@ -4815,7 +4842,11 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key)

dev = ice_pf_to_dev(pf);
#ifdef HAVE_RXFH_HASHFUNC
#ifdef HAVE_ETHTOOL_RXFH_PARAM
if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && rxfh->hfunc != ETH_RSS_HASH_TOP)
#else
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
#endif
return -EOPNOTSUPP;
#endif

Expand All @@ -4826,11 +4857,20 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key)
}

/* Verify user input. */
if (indir) {
#ifdef HAVE_ETHTOOL_RXFH_PARAM
if (rxfh->indir)
#else
if (indir)
#endif
{
int i;

for (i = 0; i < vsi->rss_table_size; i++)
#ifdef HAVE_ETHTOOL_RXFH_PARAM
if (rxfh->indir[i] >= vsi->rss_size)
#else
if (indir[i] >= vsi->rss_size)
#endif
return -EINVAL;
}

Expand All @@ -4841,15 +4881,24 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key)
}

#endif /* NETIF_F_HW_TC */
if (key) {
#ifdef HAVE_ETHTOOL_RXFH_PARAM
if (rxfh->key)
#else
if (key)
#endif
{
if (!vsi->rss_hkey_user) {
vsi->rss_hkey_user = devm_kzalloc(dev,
ICE_VSIQF_HKEY_ARRAY_SIZE,
GFP_KERNEL);
if (!vsi->rss_hkey_user)
return -ENOMEM;
}
#ifdef HAVE_ETHTOOL_RXFH_PARAM
memcpy(vsi->rss_hkey_user, rxfh->key, ICE_VSIQF_HKEY_ARRAY_SIZE);
#else
memcpy(vsi->rss_hkey_user, key, ICE_VSIQF_HKEY_ARRAY_SIZE);
#endif

err = ice_set_rss_key(vsi, vsi->rss_hkey_user);
if (err)
Expand All @@ -4864,11 +4913,20 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key)
}

/* Each 32 bits pointed by 'indir' is stored with a lut entry */
if (indir) {
#ifdef HAVE_ETHTOOL_RXFH_PARAM
if (rxfh->indir)
#else
if (indir)
#endif
{
int i;

for (i = 0; i < vsi->rss_table_size; i++)
#ifdef HAVE_ETHTOOL_RXFH_PARAM
vsi->rss_lut_user[i] = (u8)(rxfh->indir[i]);
#else
vsi->rss_lut_user[i] = (u8)(indir[i]);
#endif
} else {
ice_fill_rss_lut(vsi->rss_lut_user, vsi->rss_table_size,
vsi->rss_size);
Expand Down
8 changes: 8 additions & 0 deletions drivers/intel/ice/ice-1.12.7-zc/src/ice_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,9 @@ static void ice_remove_recovery_mode(struct ice_pf *pf)

ice_reset(&pf->hw, ICE_RESET_PFR);
ice_unmap_all_hw_addr(pf);
#ifdef HAVE_PCI_ENABLE_PCIE_ERROR_REPORTING
pci_disable_pcie_error_reporting(pf->pdev);
#endif /* HAVE_PCI_ENABLE_PCIE_ERROR_REPORTING */
}

/**
Expand Down Expand Up @@ -7072,7 +7074,9 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
goto err_dma;
}

#ifdef HAVE_PCI_ENABLE_PCIE_ERROR_REPORTING
pci_enable_pcie_error_reporting(pdev);
#endif /* HAVE_PCI_ENABLE_PCIE_ERROR_REPORTING */
pci_set_master(pdev);

pf->pdev = pdev;
Expand Down Expand Up @@ -7156,7 +7160,9 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
ice_clear_interrupt_scheme(pf);
err_init:
ice_unmap_all_hw_addr(pf);
#ifdef HAVE_PCI_ENABLE_PCIE_ERROR_REPORTING
pci_disable_pcie_error_reporting(pdev);
#endif /* HAVE_PCI_ENABLE_PCIE_ERROR_REPORTING */
pci_disable_device(pdev);
err_dma:
return err;
Expand Down Expand Up @@ -7282,7 +7288,9 @@ static void ice_remove(struct pci_dev *pdev)
pci_wait_for_pending_transaction(pdev);
ice_unmap_all_hw_addr(pf);
ice_clear_interrupt_scheme(pf);
#ifdef HAVE_PCI_ENABLE_PCIE_ERROR_REPORTING
pci_disable_pcie_error_reporting(pdev);
#endif /* HAVE_PCI_ENABLE_PCIE_ERROR_REPORTING */
pci_disable_device(pdev);

}
Expand Down
20 changes: 16 additions & 4 deletions drivers/intel/ice/ice-1.12.7-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) 2018-2023 Intel Corporation
# Copyright (C) 2013-2024 Intel Corporation

set -Eeuo pipefail

Expand Down Expand Up @@ -88,8 +88,13 @@ function gen-devlink() {
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 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 @@ -102,7 +107,9 @@ 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_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"
Expand All @@ -116,6 +123,8 @@ function gen-ethtool() {
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"
}
Expand Down Expand Up @@ -161,8 +170,7 @@ function gen-netdevice() {
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 extack in "$ndh"
# PF_RING Note: the below is commented out as gen() is also matching __rh_deprecated_ndo_get_devlink_port which is wrong
#gen HAVE_NDO_GET_DEVLINK_PORT if method ndo_get_devlink_port of net_device_ops 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"
Expand All @@ -189,18 +197,20 @@ function gen-pci() {
function gen-other() {
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_PCI_ENABLE_PCIE_ERROR_REPORTING if fun pci_enable_pcie_error_reporting 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
Expand All @@ -210,9 +220,11 @@ function gen-other() {
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
Expand Down
2 changes: 1 addition & 1 deletion drivers/intel/ice/ice-1.12.7-zc/src/kcompat-lib.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) 2018-2023 Intel Corporation
# Copyright (C) 2013-2024 Intel Corporation

# to be sourced

Expand Down

0 comments on commit 19c0028

Please sign in to comment.