// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (C) 2023 Intel Corporation */
#include "idpf.h"
/**
* idpf_get_rxnfc - command to get RX flow classification rules
* @netdev: network interface device structure
* @cmd: ethtool rxnfc command
* @rule_locs: pointer to store rule locations
*
* Returns Success if the command is supported.
*/
static int idpf_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
u32 __always_unused *rule_locs)
{
struct idpf_vport *vport;
idpf_vport_ctrl_lock(netdev);
vport = idpf_netdev_to_vport(netdev);
switch (cmd->cmd) {
case ETHTOOL_GRXRINGS:
cmd->data = vport->num_rxq;
idpf_vport_ctrl_unlock(netdev);
return 0;
default:
break;
}
idpf_vport_ctrl_unlock(netdev);
return -EOPNOTSUPP;
}
/**
* idpf_get_rxfh_key_size - get the RSS hash key size
* @netdev: network interface device structure
*
* Returns the key size on success, error value on failure.
*/
static u32 idpf_get_rxfh_key_size(struct net_device *netdev)
{
struct idpf_netdev_priv *np = netdev_priv(netdev);
struct idpf_vport_user_config_data *user_config;
if (!idpf_is_cap_ena_all(np->adapter, IDPF_RSS_CAPS, IDPF_CAP_RSS))
return -EOPNOTSUPP;
user_config = &np->adapter->vport_config[np->vport_idx]->user_config;
return user_config->rss_data.rss_key_size;
}
/**
* idpf_get_rxfh_indir_size - get the rx flow hash indirection table size
* @netdev: network interface device structure
*
* Returns the table size on success, error value on failure.
*/
static u32 idpf_get_rxfh_indir_size(struct net_device *netdev)
{
struct idpf_netdev_priv *np = netdev_priv(netdev);
struct idpf_vport_user_config_data *user_config;
if (!idpf_is_cap_ena_all(np->adapter, IDPF_RSS_CAPS, IDPF_CAP_RSS))
return -EOPNOTSUPP;
user_config = &np->adapter->vport_config[np->vport_idx]->user_config;
return user_config->rss_data.rss_lut_size;
}
/**
* idpf_get_rxfh - get the rx flow hash indirection table
* @netdev: network interface device structure
* @indir: indirection table
* @key: hash key
* @hfunc: hash function in use
*
* Reads the indirection table directly from the hardware. Always returns 0.
*/
static int idpf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
u8 *hfunc)
{
struct idpf_netdev_priv *np = netdev_priv(netdev);