Skip to content

Commit

Permalink
modules/mqnic: Update ethtool rxfh APIs for kernel 6.8
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Forencich <alex@alexforencich.com>
  • Loading branch information
alexforencich committed May 16, 2024
1 parent 417e241 commit df7829e
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions modules/mqnic/mqnic_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,48 @@ static u32 mqnic_get_rxfh_indir_size(struct net_device *ndev)
return priv->rx_queue_map_indir_table_size;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
static int mqnic_get_rxfh(struct net_device *ndev, struct ethtool_rxfh_param *rxfh)
{
struct mqnic_priv *priv = netdev_priv(ndev);
int k;

if (rxfh->hfunc)
rxfh->hfunc = ETH_RSS_HASH_TOP;

rxfh->indir_size = priv->rx_queue_map_indir_table_size;
if (rxfh->indir)
for (k = 0; k < priv->rx_queue_map_indir_table_size; k++)
rxfh->indir[k] = priv->rx_queue_map_indir_table[k];

return 0;
}

static int mqnic_set_rxfh(struct net_device *ndev, struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{
struct mqnic_priv *priv = netdev_priv(ndev);
int k;

if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP;

if (!rxfh->indir)
return 0;

if (rxfh->indir) {
for (k = 0; k < priv->rx_queue_map_indir_table_size; k++) {
if (rxfh->indir[k] >= priv->rxq_count)
return -EINVAL;
}

for (k = 0; k < priv->rx_queue_map_indir_table_size; k++)
priv->rx_queue_map_indir_table[k] = rxfh->indir[k];
}

return mqnic_update_indir_table(ndev);
}
#else
static int mqnic_get_rxfh(struct net_device *ndev, u32 *indir, u8 *key,
u8 *hfunc)
{
Expand Down Expand Up @@ -241,6 +283,7 @@ static int mqnic_set_rxfh(struct net_device *ndev, const u32 *indir,

return mqnic_update_indir_table(ndev);
}
#endif

static void mqnic_get_channels(struct net_device *ndev,
struct ethtool_channels *channel)
Expand Down

0 comments on commit df7829e

Please sign in to comment.