#include <linux/bitfield.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/ethtool.h>
#include <linux/firmware.h>
#include <linux/sfp.h>
#include "nfpcore/nfp.h"
#include "nfpcore/nfp_dev.h"
#include "nfpcore/nfp_nsp.h"
#include "nfp_app.h"
#include "nfp_main.h"
#include "nfp_net_ctrl.h"
#include "nfp_net_dp.h"
#include "nfp_net.h"
#include "nfp_port.h"
#include "nfpcore/nfp_cpp.h"
struct nfp_et_stat { … };
static const struct nfp_et_stat nfp_net_et_stats[] = …;
static const struct nfp_et_stat nfp_mac_et_stats[] = …;
static const char nfp_tlv_stat_names[][ETH_GSTRING_LEN] = …;
#define NN_ET_GLOBAL_STATS_LEN …
#define NN_ET_SWITCH_STATS_LEN …
#define NN_RVEC_GATHER_STATS …
#define NN_RVEC_PER_Q_STATS …
#define NN_CTRL_PATH_STATS …
#define SFP_SFF_REV_COMPLIANCE …
static void nfp_net_get_nspinfo(struct nfp_app *app, char *version)
{ … }
static void
nfp_get_drvinfo(struct nfp_app *app, struct pci_dev *pdev,
const char *vnic_version, struct ethtool_drvinfo *drvinfo)
{ … }
static void
nfp_net_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
{ … }
static int
nfp_net_nway_reset(struct net_device *netdev)
{ … }
static void
nfp_app_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
{ … }
static void
nfp_net_set_fec_link_mode(struct nfp_eth_table_port *eth_port,
struct ethtool_link_ksettings *c)
{ … }
static const struct nfp_eth_media_link_mode { … } nfp_eth_media_table[NFP_MEDIA_LINK_MODES_NUMBER] = …;
static const unsigned int nfp_eth_speed_map[NFP_SUP_SPEED_NUMBER] = …;
static void nfp_add_media_link_mode(struct nfp_port *port,
struct nfp_eth_table_port *eth_port,
struct ethtool_link_ksettings *cmd)
{ … }
static int
nfp_net_get_link_ksettings(struct net_device *netdev,
struct ethtool_link_ksettings *cmd)
{ … }
static int
nfp_net_set_link_ksettings(struct net_device *netdev,
const struct ethtool_link_ksettings *cmd)
{ … }
static void nfp_net_get_ringparam(struct net_device *netdev,
struct ethtool_ringparam *ring,
struct kernel_ethtool_ringparam *kernel_ring,
struct netlink_ext_ack *extack)
{ … }
static int nfp_net_set_ring_size(struct nfp_net *nn, u32 rxd_cnt, u32 txd_cnt,
struct netlink_ext_ack *extack)
{ … }
static int nfp_net_set_ringparam(struct net_device *netdev,
struct ethtool_ringparam *ring,
struct kernel_ethtool_ringparam *kernel_ring,
struct netlink_ext_ack *extack)
{ … }
static int nfp_test_link(struct net_device *netdev)
{ … }
static int nfp_test_nsp(struct net_device *netdev)
{ … }
static int nfp_test_fw(struct net_device *netdev)
{ … }
static int nfp_test_reg(struct net_device *netdev)
{ … }
static bool link_test_supported(struct net_device *netdev)
{ … }
static bool nsp_test_supported(struct net_device *netdev)
{ … }
static bool fw_test_supported(struct net_device *netdev)
{ … }
static bool reg_test_supported(struct net_device *netdev)
{ … }
static struct nfp_self_test_item { … } nfp_self_test[] = …;
#define NFP_TEST_TOTAL_NUM …
static void nfp_get_self_test_strings(struct net_device *netdev, u8 *data)
{ … }
static int nfp_get_self_test_count(struct net_device *netdev)
{ … }
static void nfp_net_self_test(struct net_device *netdev, struct ethtool_test *eth_test,
u64 *data)
{ … }
static unsigned int nfp_vnic_get_sw_stats_count(struct net_device *netdev)
{ … }
static u8 *nfp_vnic_get_sw_stats_strings(struct net_device *netdev, u8 *data)
{ … }
static u64 *nfp_vnic_get_sw_stats(struct net_device *netdev, u64 *data)
{ … }
static unsigned int nfp_vnic_get_hw_stats_count(unsigned int num_vecs)
{ … }
static u8 *
nfp_vnic_get_hw_stats_strings(u8 *data, unsigned int num_vecs, bool repr)
{ … }
static u64 *
nfp_vnic_get_hw_stats(u64 *data, u8 __iomem *mem, unsigned int num_vecs)
{ … }
static unsigned int nfp_vnic_get_tlv_stats_count(struct nfp_net *nn)
{ … }
static u8 *nfp_vnic_get_tlv_stats_strings(struct nfp_net *nn, u8 *data)
{ … }
static u64 *nfp_vnic_get_tlv_stats(struct nfp_net *nn, u64 *data)
{ … }
static unsigned int nfp_mac_get_stats_count(struct net_device *netdev)
{ … }
static u8 *nfp_mac_get_stats_strings(struct net_device *netdev, u8 *data)
{ … }
static u64 *nfp_mac_get_stats(struct net_device *netdev, u64 *data)
{ … }
static void nfp_net_get_strings(struct net_device *netdev,
u32 stringset, u8 *data)
{ … }
static void
nfp_net_get_stats(struct net_device *netdev, struct ethtool_stats *stats,
u64 *data)
{ … }
static int nfp_net_get_sset_count(struct net_device *netdev, int sset)
{ … }
static void nfp_port_get_strings(struct net_device *netdev,
u32 stringset, u8 *data)
{ … }
static void
nfp_port_get_stats(struct net_device *netdev, struct ethtool_stats *stats,
u64 *data)
{ … }
static int nfp_port_get_sset_count(struct net_device *netdev, int sset)
{ … }
static int nfp_port_fec_ethtool_to_nsp(u32 fec)
{ … }
static u32 nfp_port_fec_nsp_to_ethtool(u32 fec)
{ … }
static int
nfp_port_get_fecparam(struct net_device *netdev,
struct ethtool_fecparam *param)
{ … }
static int
nfp_port_set_fecparam(struct net_device *netdev,
struct ethtool_fecparam *param)
{ … }
static u32 ethtool_flow_to_nfp_flag(u32 flow_type)
{ … }
static int nfp_net_get_rss_hash_opts(struct nfp_net *nn,
struct ethtool_rxnfc *cmd)
{ … }
#define NFP_FS_MAX_ENTRY …
static int nfp_net_fs_to_ethtool(struct nfp_fs_entry *entry, struct ethtool_rxnfc *cmd)
{ … }
static int nfp_net_get_fs_rule(struct nfp_net *nn, struct ethtool_rxnfc *cmd)
{ … }
static int nfp_net_get_fs_loc(struct nfp_net *nn, u32 *rule_locs)
{ … }
static int nfp_net_get_rxnfc(struct net_device *netdev,
struct ethtool_rxnfc *cmd, u32 *rule_locs)
{ … }
static int nfp_net_set_rss_hash_opt(struct nfp_net *nn,
struct ethtool_rxnfc *nfc)
{ … }
static int nfp_net_fs_from_ethtool(struct nfp_fs_entry *entry, struct ethtool_rx_flow_spec *fs)
{ … }
static int nfp_net_fs_check_existing(struct nfp_net *nn, struct nfp_fs_entry *new)
{ … }
static int nfp_net_fs_add(struct nfp_net *nn, struct ethtool_rxnfc *cmd)
{ … }
static int nfp_net_fs_del(struct nfp_net *nn, struct ethtool_rxnfc *cmd)
{ … }
static int nfp_net_set_rxnfc(struct net_device *netdev,
struct ethtool_rxnfc *cmd)
{ … }
static u32 nfp_net_get_rxfh_indir_size(struct net_device *netdev)
{ … }
static u32 nfp_net_get_rxfh_key_size(struct net_device *netdev)
{ … }
static int nfp_net_get_rxfh(struct net_device *netdev,
struct ethtool_rxfh_param *rxfh)
{ … }
static int nfp_net_set_rxfh(struct net_device *netdev,
struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ … }
static int nfp_net_get_regs_len(struct net_device *netdev)
{ … }
static void nfp_net_get_regs(struct net_device *netdev,
struct ethtool_regs *regs, void *p)
{ … }
static int nfp_net_get_coalesce(struct net_device *netdev,
struct ethtool_coalesce *ec,
struct kernel_ethtool_coalesce *kernel_coal,
struct netlink_ext_ack *extack)
{ … }
static int
nfp_dump_nsp_diag(struct nfp_app *app, struct ethtool_dump *dump, void *buffer)
{ … }
static int nfp_app_set_dump(struct net_device *netdev, struct ethtool_dump *val)
{ … }
static int
nfp_app_get_dump_flag(struct net_device *netdev, struct ethtool_dump *dump)
{ … }
static int
nfp_app_get_dump_data(struct net_device *netdev, struct ethtool_dump *dump,
void *buffer)
{ … }
static int
nfp_port_get_module_info(struct net_device *netdev,
struct ethtool_modinfo *modinfo)
{ … }
static int
nfp_port_get_module_eeprom(struct net_device *netdev,
struct ethtool_eeprom *eeprom, u8 *data)
{ … }
static int nfp_net_set_coalesce(struct net_device *netdev,
struct ethtool_coalesce *ec,
struct kernel_ethtool_coalesce *kernel_coal,
struct netlink_ext_ack *extack)
{ … }
static void nfp_net_get_channels(struct net_device *netdev,
struct ethtool_channels *channel)
{ … }
static int nfp_net_set_num_rings(struct nfp_net *nn, unsigned int total_rx,
unsigned int total_tx)
{ … }
static int nfp_net_set_channels(struct net_device *netdev,
struct ethtool_channels *channel)
{ … }
static int nfp_port_set_pauseparam(struct net_device *netdev,
struct ethtool_pauseparam *pause)
{ … }
static void nfp_port_get_pauseparam(struct net_device *netdev,
struct ethtool_pauseparam *pause)
{ … }
static int nfp_net_set_phys_id(struct net_device *netdev,
enum ethtool_phys_id_state state)
{ … }
#define NFP_EEPROM_LEN …
static int
nfp_net_get_eeprom_len(struct net_device *netdev)
{ … }
static int
nfp_net_get_nsp_hwindex(struct net_device *netdev,
struct nfp_nsp **nspptr,
u32 *index)
{ … }
static int
nfp_net_get_port_mac_by_hwinfo(struct net_device *netdev,
u8 *mac_addr)
{ … }
static int
nfp_net_set_port_mac_by_hwinfo(struct net_device *netdev,
u8 *mac_addr)
{ … }
static int
nfp_net_get_eeprom(struct net_device *netdev,
struct ethtool_eeprom *eeprom, u8 *bytes)
{ … }
static int
nfp_net_set_eeprom(struct net_device *netdev,
struct ethtool_eeprom *eeprom, u8 *bytes)
{ … }
static const struct ethtool_ops nfp_net_ethtool_ops = …;
const struct ethtool_ops nfp_port_ethtool_ops = …;
void nfp_net_set_ethtool_ops(struct net_device *netdev)
{ … }