linux/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c

/* bnx2x_ethtool.c: QLogic Everest network driver.
 *
 * Copyright (c) 2007-2013 Broadcom Corporation
 * Copyright (c) 2014 QLogic Corporation
 * All rights reserved
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation.
 *
 * Maintained by: Ariel Elior <[email protected]>
 * Written by: Eliezer Tamir
 * Based on code from Michael Chan's bnx2 driver
 * UDP CSUM errata workaround by Arik Gendelman
 * Slowpath and fastpath rework by Vladislav Zolotarov
 * Statistics and Link management by Yitchak Gertner
 *
 */

#define pr_fmt(fmt)

#include <linux/ethtool.h>
#include <linux/netdevice.h>
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/crc32.h>
#include "bnx2x.h"
#include "bnx2x_cmn.h"
#include "bnx2x_dump.h"
#include "bnx2x_init.h"

/* Note: in the format strings below %s is replaced by the queue-name which is
 * either its index or 'fcoe' for the fcoe queue. Make sure the format string
 * length does not exceed ETH_GSTRING_LEN - MAX_QUEUE_NAME_LEN + 2
 */
#define MAX_QUEUE_NAME_LEN
static const struct {} bnx2x_q_stats_arr[] =;

#define BNX2X_NUM_Q_STATS

static const struct {} bnx2x_stats_arr[] =;

#define BNX2X_NUM_STATS

static int bnx2x_get_port_type(struct bnx2x *bp)
{}

static int bnx2x_get_vf_link_ksettings(struct net_device *dev,
				       struct ethtool_link_ksettings *cmd)
{}

static int bnx2x_get_link_ksettings(struct net_device *dev,
				    struct ethtool_link_ksettings *cmd)
{}

static int bnx2x_set_link_ksettings(struct net_device *dev,
				    const struct ethtool_link_ksettings *cmd)
{}

#define DUMP_ALL_PRESETS
#define DUMP_MAX_PRESETS

static int __bnx2x_get_preset_regs_len(struct bnx2x *bp, u32 preset)
{}

static int __bnx2x_get_regs_len(struct bnx2x *bp)
{}

static int bnx2x_get_regs_len(struct net_device *dev)
{}

#define IS_E1_REG(chips)
#define IS_E1H_REG(chips)
#define IS_E2_REG(chips)
#define IS_E3A0_REG(chips)
#define IS_E3B0_REG(chips)

#define IS_REG_IN_PRESET(presets, idx)

/******* Paged registers info selectors ********/
static const u32 *__bnx2x_get_page_addr_ar(struct bnx2x *bp)
{}

static u32 __bnx2x_get_page_reg_num(struct bnx2x *bp)
{}

static const u32 *__bnx2x_get_page_write_ar(struct bnx2x *bp)
{}

static u32 __bnx2x_get_page_write_num(struct bnx2x *bp)
{}

static const struct reg_addr *__bnx2x_get_page_read_ar(struct bnx2x *bp)
{}

static u32 __bnx2x_get_page_read_num(struct bnx2x *bp)
{}

static bool bnx2x_is_reg_in_chip(struct bnx2x *bp,
				       const struct reg_addr *reg_info)
{}

static bool bnx2x_is_wreg_in_chip(struct bnx2x *bp,
	const struct wreg_addr *wreg_info)
{}

/**
 * bnx2x_read_pages_regs - read "paged" registers
 *
 * @bp:		device handle
 * @p:		output buffer
 * @preset:	the preset value
 *
 * Reads "paged" memories: memories that may only be read by first writing to a
 * specific address ("write address") and then reading from a specific address
 * ("read address"). There may be more than one write address per "page" and
 * more than one read address per write address.
 */
static void bnx2x_read_pages_regs(struct bnx2x *bp, u32 *p, u32 preset)
{}

static int __bnx2x_get_preset_regs(struct bnx2x *bp, u32 *p, u32 preset)
{}

static void __bnx2x_get_regs(struct bnx2x *bp, u32 *p)
{}

static void bnx2x_get_regs(struct net_device *dev,
			   struct ethtool_regs *regs, void *_p)
{}

static int bnx2x_get_preset_regs_len(struct net_device *dev, u32 preset)
{}

static int bnx2x_set_dump(struct net_device *dev, struct ethtool_dump *val)
{}

static int bnx2x_get_dump_flag(struct net_device *dev,
			       struct ethtool_dump *dump)
{}

static int bnx2x_get_dump_data(struct net_device *dev,
			       struct ethtool_dump *dump,
			       void *buffer)
{}

static void bnx2x_get_drvinfo(struct net_device *dev,
			      struct ethtool_drvinfo *info)
{}

static void bnx2x_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{}

static int bnx2x_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{}

static u32 bnx2x_get_msglevel(struct net_device *dev)
{}

static void bnx2x_set_msglevel(struct net_device *dev, u32 level)
{}

static int bnx2x_nway_reset(struct net_device *dev)
{}

static u32 bnx2x_get_link(struct net_device *dev)
{}

static int bnx2x_get_eeprom_len(struct net_device *dev)
{}

/* Per pf misc lock must be acquired before the per port mcp lock. Otherwise,
 * had we done things the other way around, if two pfs from the same port would
 * attempt to access nvram at the same time, we could run into a scenario such
 * as:
 * pf A takes the port lock.
 * pf B succeeds in taking the same lock since they are from the same port.
 * pf A takes the per pf misc lock. Performs eeprom access.
 * pf A finishes. Unlocks the per pf misc lock.
 * Pf B takes the lock and proceeds to perform it's own access.
 * pf A unlocks the per port lock, while pf B is still working (!).
 * mcp takes the per port lock and corrupts pf B's access (and/or has it's own
 * access corrupted by pf B)
 */
static int bnx2x_acquire_nvram_lock(struct bnx2x *bp)
{}

static int bnx2x_release_nvram_lock(struct bnx2x *bp)
{}

static void bnx2x_enable_nvram_access(struct bnx2x *bp)
{}

static void bnx2x_disable_nvram_access(struct bnx2x *bp)
{}

static int bnx2x_nvram_read_dword(struct bnx2x *bp, u32 offset, __be32 *ret_val,
				  u32 cmd_flags)
{}

int bnx2x_nvram_read(struct bnx2x *bp, u32 offset, u8 *ret_buf,
		     int buf_size)
{}

static int bnx2x_nvram_read32(struct bnx2x *bp, u32 offset, u32 *buf,
			      int buf_size)
{}

static bool bnx2x_is_nvm_accessible(struct bnx2x *bp)
{}

static int bnx2x_get_eeprom(struct net_device *dev,
			    struct ethtool_eeprom *eeprom, u8 *eebuf)
{}

static int bnx2x_get_module_eeprom(struct net_device *dev,
				   struct ethtool_eeprom *ee,
				   u8 *data)
{}

static int bnx2x_get_module_info(struct net_device *dev,
				 struct ethtool_modinfo *modinfo)
{}

static int bnx2x_nvram_write_dword(struct bnx2x *bp, u32 offset, u32 val,
				   u32 cmd_flags)
{}

#define BYTE_OFFSET(offset)

static int bnx2x_nvram_write1(struct bnx2x *bp, u32 offset, u8 *data_buf,
			      int buf_size)
{}

static int bnx2x_nvram_write(struct bnx2x *bp, u32 offset, u8 *data_buf,
			     int buf_size)
{}

static int bnx2x_set_eeprom(struct net_device *dev,
			    struct ethtool_eeprom *eeprom, u8 *eebuf)
{}

static int bnx2x_get_coalesce(struct net_device *dev,
			      struct ethtool_coalesce *coal,
			      struct kernel_ethtool_coalesce *kernel_coal,
			      struct netlink_ext_ack *extack)
{}

static int bnx2x_set_coalesce(struct net_device *dev,
			      struct ethtool_coalesce *coal,
			      struct kernel_ethtool_coalesce *kernel_coal,
			      struct netlink_ext_ack *extack)
{}

static void bnx2x_get_ringparam(struct net_device *dev,
				struct ethtool_ringparam *ering,
				struct kernel_ethtool_ringparam *kernel_ering,
				struct netlink_ext_ack *extack)
{}

static int bnx2x_set_ringparam(struct net_device *dev,
			       struct ethtool_ringparam *ering,
			       struct kernel_ethtool_ringparam *kernel_ering,
			       struct netlink_ext_ack *extack)
{}

static void bnx2x_get_pauseparam(struct net_device *dev,
				 struct ethtool_pauseparam *epause)
{}

static int bnx2x_set_pauseparam(struct net_device *dev,
				struct ethtool_pauseparam *epause)
{}

static const char bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF][ETH_GSTRING_LEN] =;

enum {};

static const char bnx2x_private_arr[BNX2X_PRI_FLAG_LEN][ETH_GSTRING_LEN] =;

static void bnx2x_eee_to_linkmode(unsigned long *mode, u32 eee_adv)
{}

static u32 bnx2x_linkmode_to_eee(const unsigned long *mode, u32 shift)
{}

static int bnx2x_get_eee(struct net_device *dev, struct ethtool_keee *edata)
{}

static int bnx2x_set_eee(struct net_device *dev, struct ethtool_keee *edata)
{}

enum {};

#define BNX2X_CHIP_MASK_E1
#define BNX2X_CHIP_MASK_E1H
#define BNX2X_CHIP_MASK_E2
#define BNX2X_CHIP_MASK_E3
#define BNX2X_CHIP_MASK_E3B0

#define BNX2X_CHIP_MASK_ALL
#define BNX2X_CHIP_MASK_E1X

static int bnx2x_test_registers(struct bnx2x *bp)
{}

static int bnx2x_test_memory(struct bnx2x *bp)
{}

static void bnx2x_wait_for_link(struct bnx2x *bp, u8 link_up, u8 is_serdes)
{}

static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode)
{}

static int bnx2x_test_loopback(struct bnx2x *bp)
{}

static int bnx2x_test_ext_loopback(struct bnx2x *bp)
{}

struct code_entry {};

#define CODE_ENTRY_MAX
#define CODE_ENTRY_EXTENDED_DIR_IDX
#define MAX_IMAGES_IN_EXTENDED_DIR
#define NVRAM_DIR_OFFSET

#define EXTENDED_DIR_EXISTS(code)

#define CRC32_RESIDUAL
#define CRC_BUFF_SIZE

static int bnx2x_nvram_crc(struct bnx2x *bp,
			   int offset,
			   int size,
			   u8 *buff)
{}

static int bnx2x_test_nvram_dir(struct bnx2x *bp,
				struct code_entry *entry,
				u8 *buff)
{}

static int bnx2x_test_dir_entry(struct bnx2x *bp, u32 addr, u8 *buff)
{}

static int bnx2x_test_nvram_ext_dirs(struct bnx2x *bp, u8 *buff)
{}

static int bnx2x_test_nvram_dirs(struct bnx2x *bp, u8 *buff)
{}

struct crc_pair {};

static int bnx2x_test_nvram_tbl(struct bnx2x *bp,
				const struct crc_pair *nvram_tbl, u8 *buf)
{}

static int bnx2x_test_nvram(struct bnx2x *bp)
{}

/* Send an EMPTY ramrod on the first queue */
static int bnx2x_test_intr(struct bnx2x *bp)
{}

static void bnx2x_self_test(struct net_device *dev,
			    struct ethtool_test *etest, u64 *buf)
{}

#define IS_PORT_STAT(i)
#define HIDE_PORT_STAT(bp)

/* ethtool statistics are displayed for all regular ethernet queues and the
 * fcoe L2 queue if not disabled
 */
static int bnx2x_num_stat_queues(struct bnx2x *bp)
{}

static int bnx2x_get_sset_count(struct net_device *dev, int stringset)
{}

static u32 bnx2x_get_private_flags(struct net_device *dev)
{}

static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
{}

static void bnx2x_get_ethtool_stats(struct net_device *dev,
				    struct ethtool_stats *stats, u64 *buf)
{}

static int bnx2x_set_phys_id(struct net_device *dev,
			     enum ethtool_phys_id_state state)
{}

static int bnx2x_get_rss_flags(struct bnx2x *bp, struct ethtool_rxnfc *info)
{}

static int bnx2x_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
			   u32 *rules __always_unused)
{}

static int bnx2x_set_rss_flags(struct bnx2x *bp, struct ethtool_rxnfc *info)
{}

static int bnx2x_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info)
{}

static u32 bnx2x_get_rxfh_indir_size(struct net_device *dev)
{}

static int bnx2x_get_rxfh(struct net_device *dev,
			  struct ethtool_rxfh_param *rxfh)
{}

static int bnx2x_set_rxfh(struct net_device *dev,
			  struct ethtool_rxfh_param *rxfh,
			  struct netlink_ext_ack *extack)
{}

/**
 * bnx2x_get_channels - gets the number of RSS queues.
 *
 * @dev:		net device
 * @channels:		returns the number of max / current queues
 */
static void bnx2x_get_channels(struct net_device *dev,
			       struct ethtool_channels *channels)
{}

/**
 * bnx2x_change_num_queues - change the number of RSS queues.
 *
 * @bp:			bnx2x private structure
 * @num_rss:		rss count
 *
 * Re-configure interrupt mode to get the new number of MSI-X
 * vectors and re-add NAPI objects.
 */
static void bnx2x_change_num_queues(struct bnx2x *bp, int num_rss)
{}

/**
 * bnx2x_set_channels - sets the number of RSS queues.
 *
 * @dev:		net device
 * @channels:		includes the number of queues requested
 */
static int bnx2x_set_channels(struct net_device *dev,
			      struct ethtool_channels *channels)
{}

static int bnx2x_get_ts_info(struct net_device *dev,
			     struct kernel_ethtool_ts_info *info)
{}

static const struct ethtool_ops bnx2x_ethtool_ops =;

static const struct ethtool_ops bnx2x_vf_ethtool_ops =;

void bnx2x_set_ethtool_ops(struct bnx2x *bp, struct net_device *netdev)
{}