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 .cap_rss_ctx_supported = true, 41 .get_drvinfo = efx_ethtool_get_drvinfo, 42 .get_msglevel = efx_ethtool_get_msglevel, 43 .set_msglevel = efx_ethtool_set_msglevel, 44 .get_pauseparam = efx_ethtool_get_pauseparam, 45 .set_pauseparam = efx_ethtool_set_pauseparam, 46 .get_sset_count = efx_ethtool_get_sset_count, 47 .self_test = efx_ethtool_self_test, 48 .get_strings = efx_ethtool_get_strings, 49 .get_link_ksettings = efx_ethtool_get_link_ksettings, 50 .set_link_ksettings = efx_ethtool_set_link_ksettings, 51 .get_link = ethtool_op_get_link, 52 .get_ringparam = ef100_ethtool_get_ringparam, 53 .get_fecparam = efx_ethtool_get_fecparam, 54 .set_fecparam = efx_ethtool_set_fecparam, 55 .get_ethtool_stats = efx_ethtool_get_stats, 56 .get_rxnfc = efx_ethtool_get_rxnfc, 57 .set_rxnfc = efx_ethtool_set_rxnfc, 58 .reset = efx_ethtool_reset, 59 60 .get_rxfh_indir_size = efx_ethtool_get_rxfh_indir_size, 61 .get_rxfh_key_size = efx_ethtool_get_rxfh_key_size, 62 .get_rxfh = efx_ethtool_get_rxfh, 63 .set_rxfh = efx_ethtool_set_rxfh, 64 65 .get_module_info = efx_ethtool_get_module_info, 66 .get_module_eeprom = efx_ethtool_get_module_eeprom, 67 }; 68