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 .get_priv_flags = efx_ethtool_get_priv_flags, 47 .set_priv_flags = efx_ethtool_set_priv_flags, 48 .self_test = efx_ethtool_self_test, 49 .get_strings = efx_ethtool_get_strings, 50 .get_link_ksettings = efx_ethtool_get_link_ksettings, 51 .set_link_ksettings = efx_ethtool_set_link_ksettings, 52 .get_link = ethtool_op_get_link, 53 .get_ringparam = ef100_ethtool_get_ringparam, 54 .get_fecparam = efx_ethtool_get_fecparam, 55 .set_fecparam = efx_ethtool_set_fecparam, 56 .get_ethtool_stats = efx_ethtool_get_stats, 57 .get_rxnfc = efx_ethtool_get_rxnfc, 58 .set_rxnfc = efx_ethtool_set_rxnfc, 59 .reset = efx_ethtool_reset, 60 61 .get_rxfh_indir_size = efx_ethtool_get_rxfh_indir_size, 62 .get_rxfh_key_size = efx_ethtool_get_rxfh_key_size, 63 .get_rxfh = efx_ethtool_get_rxfh, 64 .set_rxfh = efx_ethtool_set_rxfh, 65 .get_rxfh_context = efx_ethtool_get_rxfh_context, 66 .set_rxfh_context = efx_ethtool_set_rxfh_context, 67 68 .get_module_info = efx_ethtool_get_module_info, 69 .get_module_eeprom = efx_ethtool_get_module_eeprom, 70 }; 71