1 // SPDX-License-Identifier: GPL-2.0-only
2 /****************************************************************************
3  * Driver for Solarflare network controllers and boards
4  * Copyright 2018 Solarflare Communications Inc.
5  * Copyright 2019-2020 Xilinx Inc.
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License version 2 as published
9  * by the Free Software Foundation, incorporated herein by reference.
10  */
11 #include <linux/module.h>
12 #include <linux/netdevice.h>
13 #include "net_driver.h"
14 #include "efx.h"
15 #include "mcdi_port_common.h"
16 #include "ethtool_common.h"
17 #include "ef100_ethtool.h"
18 #include "mcdi_functions.h"
19 
20 /* This is the maximum number of descriptor rings supported by the QDMA */
21 #define EFX_EF100_MAX_DMAQ_SIZE 16384UL
22 
23 static void
24 ef100_ethtool_get_ringparam(struct net_device *net_dev,
25 			    struct ethtool_ringparam *ring,
26 			    struct kernel_ethtool_ringparam *kernel_ring,
27 			    struct netlink_ext_ack *extack)
28 {
29 	struct efx_nic *efx = efx_netdev_priv(net_dev);
30 
31 	ring->rx_max_pending = EFX_EF100_MAX_DMAQ_SIZE;
32 	ring->tx_max_pending = EFX_EF100_MAX_DMAQ_SIZE;
33 	ring->rx_pending = efx->rxq_entries;
34 	ring->tx_pending = efx->txq_entries;
35 }
36 
37 /*	Ethtool options available
38  */
39 const struct ethtool_ops ef100_ethtool_ops = {
40 	.get_drvinfo		= efx_ethtool_get_drvinfo,
41 	.get_msglevel		= efx_ethtool_get_msglevel,
42 	.set_msglevel		= efx_ethtool_set_msglevel,
43 	.get_pauseparam         = efx_ethtool_get_pauseparam,
44 	.set_pauseparam         = efx_ethtool_set_pauseparam,
45 	.get_sset_count		= efx_ethtool_get_sset_count,
46 	.self_test		= efx_ethtool_self_test,
47 	.get_strings		= efx_ethtool_get_strings,
48 	.get_link_ksettings	= efx_ethtool_get_link_ksettings,
49 	.set_link_ksettings	= efx_ethtool_set_link_ksettings,
50 	.get_link		= ethtool_op_get_link,
51 	.get_ringparam		= ef100_ethtool_get_ringparam,
52 	.get_fecparam		= efx_ethtool_get_fecparam,
53 	.set_fecparam		= efx_ethtool_set_fecparam,
54 	.get_ethtool_stats	= efx_ethtool_get_stats,
55 	.get_rxnfc              = efx_ethtool_get_rxnfc,
56 	.set_rxnfc              = efx_ethtool_set_rxnfc,
57 	.reset                  = efx_ethtool_reset,
58 
59 	.get_rxfh_indir_size	= efx_ethtool_get_rxfh_indir_size,
60 	.get_rxfh_key_size	= efx_ethtool_get_rxfh_key_size,
61 	.get_rxfh		= efx_ethtool_get_rxfh,
62 	.set_rxfh		= efx_ethtool_set_rxfh,
63 	.get_rxfh_context	= efx_ethtool_get_rxfh_context,
64 	.set_rxfh_context	= efx_ethtool_set_rxfh_context,
65 
66 	.get_module_info	= efx_ethtool_get_module_info,
67 	.get_module_eeprom	= efx_ethtool_get_module_eeprom,
68 };
69