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
ef100_ethtool_get_ringparam(struct net_device * net_dev,struct ethtool_ringparam * ring)23 static void ef100_ethtool_get_ringparam(struct net_device *net_dev,
24 struct ethtool_ringparam *ring)
25 {
26 struct efx_nic *efx = netdev_priv(net_dev);
27
28 ring->rx_max_pending = EFX_EF100_MAX_DMAQ_SIZE;
29 ring->tx_max_pending = EFX_EF100_MAX_DMAQ_SIZE;
30 ring->rx_pending = efx->rxq_entries;
31 ring->tx_pending = efx->txq_entries;
32 }
33
34 /* Ethtool options available
35 */
36 const struct ethtool_ops ef100_ethtool_ops = {
37 .get_drvinfo = efx_ethtool_get_drvinfo,
38 .get_msglevel = efx_ethtool_get_msglevel,
39 .set_msglevel = efx_ethtool_set_msglevel,
40 .get_pauseparam = efx_ethtool_get_pauseparam,
41 .set_pauseparam = efx_ethtool_set_pauseparam,
42 .get_sset_count = efx_ethtool_get_sset_count,
43 .self_test = efx_ethtool_self_test,
44 .get_strings = efx_ethtool_get_strings,
45 .get_link_ksettings = efx_ethtool_get_link_ksettings,
46 .set_link_ksettings = efx_ethtool_set_link_ksettings,
47 .get_link = ethtool_op_get_link,
48 .get_ringparam = ef100_ethtool_get_ringparam,
49 .get_fecparam = efx_ethtool_get_fecparam,
50 .set_fecparam = efx_ethtool_set_fecparam,
51 .get_ethtool_stats = efx_ethtool_get_stats,
52 .get_rxnfc = efx_ethtool_get_rxnfc,
53 .set_rxnfc = efx_ethtool_set_rxnfc,
54 .reset = efx_ethtool_reset,
55
56 .get_rxfh_indir_size = efx_ethtool_get_rxfh_indir_size,
57 .get_rxfh_key_size = efx_ethtool_get_rxfh_key_size,
58 .get_rxfh = efx_ethtool_get_rxfh,
59 .set_rxfh = efx_ethtool_set_rxfh,
60 .get_rxfh_context = efx_ethtool_get_rxfh_context,
61 .set_rxfh_context = efx_ethtool_set_rxfh_context,
62
63 .get_module_info = efx_ethtool_get_module_info,
64 .get_module_eeprom = efx_ethtool_get_module_eeprom,
65 };
66