151b35a45SEdward Cree // SPDX-License-Identifier: GPL-2.0-only
251b35a45SEdward Cree /****************************************************************************
351b35a45SEdward Cree  * Driver for Solarflare network controllers and boards
451b35a45SEdward Cree  * Copyright 2018 Solarflare Communications Inc.
551b35a45SEdward Cree  * Copyright 2019-2020 Xilinx Inc.
651b35a45SEdward Cree  *
751b35a45SEdward Cree  * This program is free software; you can redistribute it and/or modify it
851b35a45SEdward Cree  * under the terms of the GNU General Public License version 2 as published
951b35a45SEdward Cree  * by the Free Software Foundation, incorporated herein by reference.
1051b35a45SEdward Cree  */
1151b35a45SEdward Cree #include <linux/module.h>
1251b35a45SEdward Cree #include <linux/netdevice.h>
1351b35a45SEdward Cree #include "net_driver.h"
1451b35a45SEdward Cree #include "efx.h"
1551b35a45SEdward Cree #include "mcdi_port_common.h"
1651b35a45SEdward Cree #include "ethtool_common.h"
1751b35a45SEdward Cree #include "ef100_ethtool.h"
1851b35a45SEdward Cree #include "mcdi_functions.h"
1951b35a45SEdward Cree 
204404c089SEdward Cree /* This is the maximum number of descriptor rings supported by the QDMA */
214404c089SEdward Cree #define EFX_EF100_MAX_DMAQ_SIZE 16384UL
224404c089SEdward Cree 
234404c089SEdward Cree static void ef100_ethtool_get_ringparam(struct net_device *net_dev,
244404c089SEdward Cree 					struct ethtool_ringparam *ring)
254404c089SEdward Cree {
264404c089SEdward Cree 	struct efx_nic *efx = netdev_priv(net_dev);
274404c089SEdward Cree 
284404c089SEdward Cree 	ring->rx_max_pending = EFX_EF100_MAX_DMAQ_SIZE;
294404c089SEdward Cree 	ring->tx_max_pending = EFX_EF100_MAX_DMAQ_SIZE;
304404c089SEdward Cree 	ring->rx_pending = efx->rxq_entries;
314404c089SEdward Cree 	ring->tx_pending = efx->txq_entries;
324404c089SEdward Cree }
334404c089SEdward Cree 
3451b35a45SEdward Cree /*	Ethtool options available
3551b35a45SEdward Cree  */
3651b35a45SEdward Cree const struct ethtool_ops ef100_ethtool_ops = {
3751b35a45SEdward Cree 	.get_drvinfo		= efx_ethtool_get_drvinfo,
384404c089SEdward Cree 	.get_msglevel		= efx_ethtool_get_msglevel,
394404c089SEdward Cree 	.set_msglevel		= efx_ethtool_set_msglevel,
404404c089SEdward Cree 	.get_pauseparam         = efx_ethtool_get_pauseparam,
414404c089SEdward Cree 	.set_pauseparam         = efx_ethtool_set_pauseparam,
424404c089SEdward Cree 	.get_sset_count		= efx_ethtool_get_sset_count,
434404c089SEdward Cree 	.self_test		= efx_ethtool_self_test,
444404c089SEdward Cree 	.get_strings		= efx_ethtool_get_strings,
454404c089SEdward Cree 	.get_link_ksettings	= efx_ethtool_get_link_ksettings,
464404c089SEdward Cree 	.set_link_ksettings	= efx_ethtool_set_link_ksettings,
474404c089SEdward Cree 	.get_link		= ethtool_op_get_link,
484404c089SEdward Cree 	.get_ringparam		= ef100_ethtool_get_ringparam,
494404c089SEdward Cree 	.get_fecparam		= efx_ethtool_get_fecparam,
504404c089SEdward Cree 	.set_fecparam		= efx_ethtool_set_fecparam,
514404c089SEdward Cree 	.get_ethtool_stats	= efx_ethtool_get_stats,
524404c089SEdward Cree 	.get_rxnfc              = efx_ethtool_get_rxnfc,
534404c089SEdward Cree 	.set_rxnfc              = efx_ethtool_set_rxnfc,
544404c089SEdward Cree 	.reset                  = efx_ethtool_reset,
554404c089SEdward Cree 
564404c089SEdward Cree 	.get_rxfh_indir_size	= efx_ethtool_get_rxfh_indir_size,
574404c089SEdward Cree 	.get_rxfh_key_size	= efx_ethtool_get_rxfh_key_size,
584404c089SEdward Cree 	.get_rxfh		= efx_ethtool_get_rxfh,
594404c089SEdward Cree 	.set_rxfh		= efx_ethtool_set_rxfh,
604404c089SEdward Cree 	.get_rxfh_context	= efx_ethtool_get_rxfh_context,
614404c089SEdward Cree 	.set_rxfh_context	= efx_ethtool_set_rxfh_context,
624404c089SEdward Cree 
634404c089SEdward Cree 	.get_module_info	= efx_ethtool_get_module_info,
644404c089SEdward Cree 	.get_module_eeprom	= efx_ethtool_get_module_eeprom,
6551b35a45SEdward Cree };
66