18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/****************************************************************************
38c2ecf20Sopenharmony_ci * Driver for Solarflare network controllers and boards
48c2ecf20Sopenharmony_ci * Copyright 2018 Solarflare Communications Inc.
58c2ecf20Sopenharmony_ci * Copyright 2019-2020 Xilinx Inc.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it
88c2ecf20Sopenharmony_ci * under the terms of the GNU General Public License version 2 as published
98c2ecf20Sopenharmony_ci * by the Free Software Foundation, incorporated herein by reference.
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci#include <linux/module.h>
128c2ecf20Sopenharmony_ci#include <linux/netdevice.h>
138c2ecf20Sopenharmony_ci#include "net_driver.h"
148c2ecf20Sopenharmony_ci#include "efx.h"
158c2ecf20Sopenharmony_ci#include "mcdi_port_common.h"
168c2ecf20Sopenharmony_ci#include "ethtool_common.h"
178c2ecf20Sopenharmony_ci#include "ef100_ethtool.h"
188c2ecf20Sopenharmony_ci#include "mcdi_functions.h"
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci/* This is the maximum number of descriptor rings supported by the QDMA */
218c2ecf20Sopenharmony_ci#define EFX_EF100_MAX_DMAQ_SIZE 16384UL
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cistatic void ef100_ethtool_get_ringparam(struct net_device *net_dev,
248c2ecf20Sopenharmony_ci					struct ethtool_ringparam *ring)
258c2ecf20Sopenharmony_ci{
268c2ecf20Sopenharmony_ci	struct efx_nic *efx = netdev_priv(net_dev);
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci	ring->rx_max_pending = EFX_EF100_MAX_DMAQ_SIZE;
298c2ecf20Sopenharmony_ci	ring->tx_max_pending = EFX_EF100_MAX_DMAQ_SIZE;
308c2ecf20Sopenharmony_ci	ring->rx_pending = efx->rxq_entries;
318c2ecf20Sopenharmony_ci	ring->tx_pending = efx->txq_entries;
328c2ecf20Sopenharmony_ci}
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/*	Ethtool options available
358c2ecf20Sopenharmony_ci */
368c2ecf20Sopenharmony_ciconst struct ethtool_ops ef100_ethtool_ops = {
378c2ecf20Sopenharmony_ci	.get_drvinfo		= efx_ethtool_get_drvinfo,
388c2ecf20Sopenharmony_ci	.get_msglevel		= efx_ethtool_get_msglevel,
398c2ecf20Sopenharmony_ci	.set_msglevel		= efx_ethtool_set_msglevel,
408c2ecf20Sopenharmony_ci	.get_pauseparam         = efx_ethtool_get_pauseparam,
418c2ecf20Sopenharmony_ci	.set_pauseparam         = efx_ethtool_set_pauseparam,
428c2ecf20Sopenharmony_ci	.get_sset_count		= efx_ethtool_get_sset_count,
438c2ecf20Sopenharmony_ci	.self_test		= efx_ethtool_self_test,
448c2ecf20Sopenharmony_ci	.get_strings		= efx_ethtool_get_strings,
458c2ecf20Sopenharmony_ci	.get_link_ksettings	= efx_ethtool_get_link_ksettings,
468c2ecf20Sopenharmony_ci	.set_link_ksettings	= efx_ethtool_set_link_ksettings,
478c2ecf20Sopenharmony_ci	.get_link		= ethtool_op_get_link,
488c2ecf20Sopenharmony_ci	.get_ringparam		= ef100_ethtool_get_ringparam,
498c2ecf20Sopenharmony_ci	.get_fecparam		= efx_ethtool_get_fecparam,
508c2ecf20Sopenharmony_ci	.set_fecparam		= efx_ethtool_set_fecparam,
518c2ecf20Sopenharmony_ci	.get_ethtool_stats	= efx_ethtool_get_stats,
528c2ecf20Sopenharmony_ci	.get_rxnfc              = efx_ethtool_get_rxnfc,
538c2ecf20Sopenharmony_ci	.set_rxnfc              = efx_ethtool_set_rxnfc,
548c2ecf20Sopenharmony_ci	.reset                  = efx_ethtool_reset,
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci	.get_rxfh_indir_size	= efx_ethtool_get_rxfh_indir_size,
578c2ecf20Sopenharmony_ci	.get_rxfh_key_size	= efx_ethtool_get_rxfh_key_size,
588c2ecf20Sopenharmony_ci	.get_rxfh		= efx_ethtool_get_rxfh,
598c2ecf20Sopenharmony_ci	.set_rxfh		= efx_ethtool_set_rxfh,
608c2ecf20Sopenharmony_ci	.get_rxfh_context	= efx_ethtool_get_rxfh_context,
618c2ecf20Sopenharmony_ci	.set_rxfh_context	= efx_ethtool_set_rxfh_context,
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci	.get_module_info	= efx_ethtool_get_module_info,
648c2ecf20Sopenharmony_ci	.get_module_eeprom	= efx_ethtool_get_module_eeprom,
658c2ecf20Sopenharmony_ci};
66