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 
2374624944SHao Chen static void
ef100_ethtool_get_ringparam(struct net_device * net_dev,struct ethtool_ringparam * ring,struct kernel_ethtool_ringparam * kernel_ring,struct netlink_ext_ack * extack)2474624944SHao Chen ef100_ethtool_get_ringparam(struct net_device *net_dev,
2574624944SHao Chen 			    struct ethtool_ringparam *ring,
2674624944SHao Chen 			    struct kernel_ethtool_ringparam *kernel_ring,
2774624944SHao Chen 			    struct netlink_ext_ack *extack)
284404c089SEdward Cree {
29*8cb03f4eSJonathan Cooper 	struct efx_nic *efx = efx_netdev_priv(net_dev);
304404c089SEdward Cree 
314404c089SEdward Cree 	ring->rx_max_pending = EFX_EF100_MAX_DMAQ_SIZE;
324404c089SEdward Cree 	ring->tx_max_pending = EFX_EF100_MAX_DMAQ_SIZE;
334404c089SEdward Cree 	ring->rx_pending = efx->rxq_entries;
344404c089SEdward Cree 	ring->tx_pending = efx->txq_entries;
354404c089SEdward Cree }
364404c089SEdward Cree 
3751b35a45SEdward Cree /*	Ethtool options available
3851b35a45SEdward Cree  */
3951b35a45SEdward Cree const struct ethtool_ops ef100_ethtool_ops = {
4051b35a45SEdward Cree 	.get_drvinfo		= efx_ethtool_get_drvinfo,
414404c089SEdward Cree 	.get_msglevel		= efx_ethtool_get_msglevel,
424404c089SEdward Cree 	.set_msglevel		= efx_ethtool_set_msglevel,
434404c089SEdward Cree 	.get_pauseparam         = efx_ethtool_get_pauseparam,
444404c089SEdward Cree 	.set_pauseparam         = efx_ethtool_set_pauseparam,
454404c089SEdward Cree 	.get_sset_count		= efx_ethtool_get_sset_count,
464404c089SEdward Cree 	.self_test		= efx_ethtool_self_test,
474404c089SEdward Cree 	.get_strings		= efx_ethtool_get_strings,
484404c089SEdward Cree 	.get_link_ksettings	= efx_ethtool_get_link_ksettings,
494404c089SEdward Cree 	.set_link_ksettings	= efx_ethtool_set_link_ksettings,
504404c089SEdward Cree 	.get_link		= ethtool_op_get_link,
514404c089SEdward Cree 	.get_ringparam		= ef100_ethtool_get_ringparam,
524404c089SEdward Cree 	.get_fecparam		= efx_ethtool_get_fecparam,
534404c089SEdward Cree 	.set_fecparam		= efx_ethtool_set_fecparam,
544404c089SEdward Cree 	.get_ethtool_stats	= efx_ethtool_get_stats,
554404c089SEdward Cree 	.get_rxnfc              = efx_ethtool_get_rxnfc,
564404c089SEdward Cree 	.set_rxnfc              = efx_ethtool_set_rxnfc,
574404c089SEdward Cree 	.reset                  = efx_ethtool_reset,
584404c089SEdward Cree 
594404c089SEdward Cree 	.get_rxfh_indir_size	= efx_ethtool_get_rxfh_indir_size,
604404c089SEdward Cree 	.get_rxfh_key_size	= efx_ethtool_get_rxfh_key_size,
614404c089SEdward Cree 	.get_rxfh		= efx_ethtool_get_rxfh,
624404c089SEdward Cree 	.set_rxfh		= efx_ethtool_set_rxfh,
634404c089SEdward Cree 	.get_rxfh_context	= efx_ethtool_get_rxfh_context,
644404c089SEdward Cree 	.set_rxfh_context	= efx_ethtool_set_rxfh_context,
654404c089SEdward Cree 
664404c089SEdward Cree 	.get_module_info	= efx_ethtool_get_module_info,
674404c089SEdward Cree 	.get_module_eeprom	= efx_ethtool_get_module_eeprom,
6851b35a45SEdward Cree };
69