Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Driver for Solarflare network controllers and boards
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright 2005-2006 Fen Systems Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright 2006-2013 Solarflare Communications Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/netdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/ethtool.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/rtnetlink.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/in.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include "net_driver.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include "workarounds.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include "selftest.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include "efx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include "efx_channels.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include "rx_common.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include "tx_common.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include "ethtool_common.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include "filter.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include "nic.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define EFX_ETHTOOL_EEPROM_MAGIC 0xEFAB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) /**************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * Ethtool operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  **************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) /* Identify device by flashing LEDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) static int efx_ethtool_phys_id(struct net_device *net_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 			       enum ethtool_phys_id_state state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	struct efx_nic *efx = netdev_priv(net_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	enum efx_led_mode mode = EFX_LED_DEFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	switch (state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	case ETHTOOL_ID_ON:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 		mode = EFX_LED_ON;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	case ETHTOOL_ID_OFF:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 		mode = EFX_LED_OFF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	case ETHTOOL_ID_INACTIVE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		mode = EFX_LED_DEFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	case ETHTOOL_ID_ACTIVE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		return 1;	/* cycle on/off once per second */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	return efx_mcdi_set_id_led(efx, mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) static int efx_ethtool_get_regs_len(struct net_device *net_dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	return efx_nic_get_regs_len(netdev_priv(net_dev));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) static void efx_ethtool_get_regs(struct net_device *net_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 				 struct ethtool_regs *regs, void *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	struct efx_nic *efx = netdev_priv(net_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	regs->version = efx->type->revision;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	efx_nic_get_regs(efx, buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  * Each channel has a single IRQ and moderation timer, started by any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  * completion (or other event).  Unless the module parameter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  * separate_tx_channels is set, IRQs and moderation are therefore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  * shared between RX and TX completions.  In this case, when RX IRQ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)  * moderation is explicitly changed then TX IRQ moderation is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)  * automatically changed too, but otherwise we fail if the two values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)  * are requested to be different.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)  * The hardware does not support a limit on the number of completions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  * before an IRQ, so we do not use the max_frames fields.  We should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  * report and require that max_frames == (usecs != 0), but this would
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)  * invalidate existing user documentation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)  * The hardware does not have distinct settings for interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  * moderation while the previous IRQ is being handled, so we should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  * not use the 'irq' fields.  However, an earlier developer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  * misunderstood the meaning of the 'irq' fields and the driver did
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  * not support the standard fields.  To avoid invalidating existing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  * user documentation, we report and accept changes through either the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  * standard or 'irq' fields.  If both are changed at the same time, we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  * prefer the standard field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  * We implement adaptive IRQ moderation, but use a different algorithm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  * from that assumed in the definition of struct ethtool_coalesce.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)  * Therefore we do not use any of the adaptive moderation parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)  * in it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) static int efx_ethtool_get_coalesce(struct net_device *net_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 				    struct ethtool_coalesce *coalesce)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	struct efx_nic *efx = netdev_priv(net_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	unsigned int tx_usecs, rx_usecs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	bool rx_adaptive;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	efx_get_irq_moderation(efx, &tx_usecs, &rx_usecs, &rx_adaptive);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	coalesce->tx_coalesce_usecs = tx_usecs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	coalesce->tx_coalesce_usecs_irq = tx_usecs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	coalesce->rx_coalesce_usecs = rx_usecs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	coalesce->rx_coalesce_usecs_irq = rx_usecs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	coalesce->use_adaptive_rx_coalesce = rx_adaptive;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) static int efx_ethtool_set_coalesce(struct net_device *net_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 				    struct ethtool_coalesce *coalesce)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	struct efx_nic *efx = netdev_priv(net_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	struct efx_channel *channel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	unsigned int tx_usecs, rx_usecs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	bool adaptive, rx_may_override_tx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	efx_get_irq_moderation(efx, &tx_usecs, &rx_usecs, &adaptive);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	if (coalesce->rx_coalesce_usecs != rx_usecs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		rx_usecs = coalesce->rx_coalesce_usecs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		rx_usecs = coalesce->rx_coalesce_usecs_irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	adaptive = coalesce->use_adaptive_rx_coalesce;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	/* If channels are shared, TX IRQ moderation can be quietly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	 * overridden unless it is changed from its old value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	rx_may_override_tx = (coalesce->tx_coalesce_usecs == tx_usecs &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 			      coalesce->tx_coalesce_usecs_irq == tx_usecs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	if (coalesce->tx_coalesce_usecs != tx_usecs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		tx_usecs = coalesce->tx_coalesce_usecs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		tx_usecs = coalesce->tx_coalesce_usecs_irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	rc = efx_init_irq_moderation(efx, tx_usecs, rx_usecs, adaptive,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 				     rx_may_override_tx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	if (rc != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 		return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	efx_for_each_channel(channel, efx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 		efx->type->push_irq_moderation(channel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) static void efx_ethtool_get_ringparam(struct net_device *net_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 				      struct ethtool_ringparam *ring)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	struct efx_nic *efx = netdev_priv(net_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	ring->rx_max_pending = EFX_MAX_DMAQ_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	ring->tx_max_pending = EFX_TXQ_MAX_ENT(efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	ring->rx_pending = efx->rxq_entries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	ring->tx_pending = efx->txq_entries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) static int efx_ethtool_set_ringparam(struct net_device *net_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 				     struct ethtool_ringparam *ring)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	struct efx_nic *efx = netdev_priv(net_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	u32 txq_entries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	if (ring->rx_mini_pending || ring->rx_jumbo_pending ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	    ring->rx_pending > EFX_MAX_DMAQ_SIZE ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	    ring->tx_pending > EFX_TXQ_MAX_ENT(efx))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	if (ring->rx_pending < EFX_RXQ_MIN_ENT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		netif_err(efx, drv, efx->net_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 			  "RX queues cannot be smaller than %u\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 			  EFX_RXQ_MIN_ENT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	txq_entries = max(ring->tx_pending, EFX_TXQ_MIN_ENT(efx));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	if (txq_entries != ring->tx_pending)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 		netif_warn(efx, drv, efx->net_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 			   "increasing TX queue size to minimum of %u\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 			   txq_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	return efx_realloc_channels(efx, ring->rx_pending, txq_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) static void efx_ethtool_get_wol(struct net_device *net_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 				struct ethtool_wolinfo *wol)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	struct efx_nic *efx = netdev_priv(net_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	return efx->type->get_wol(efx, wol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) static int efx_ethtool_set_wol(struct net_device *net_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 			       struct ethtool_wolinfo *wol)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	struct efx_nic *efx = netdev_priv(net_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	return efx->type->set_wol(efx, wol->wolopts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) static int efx_ethtool_get_ts_info(struct net_device *net_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 				   struct ethtool_ts_info *ts_info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	struct efx_nic *efx = netdev_priv(net_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	/* Software capabilities */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	ts_info->so_timestamping = (SOF_TIMESTAMPING_RX_SOFTWARE |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 				    SOF_TIMESTAMPING_SOFTWARE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	ts_info->phc_index = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	efx_ptp_get_ts_info(efx, ts_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) const struct ethtool_ops efx_ethtool_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 				     ETHTOOL_COALESCE_USECS_IRQ |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 				     ETHTOOL_COALESCE_USE_ADAPTIVE_RX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	.get_drvinfo		= efx_ethtool_get_drvinfo,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	.get_regs_len		= efx_ethtool_get_regs_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	.get_regs		= efx_ethtool_get_regs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	.get_msglevel		= efx_ethtool_get_msglevel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	.set_msglevel		= efx_ethtool_set_msglevel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	.get_link		= ethtool_op_get_link,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	.get_coalesce		= efx_ethtool_get_coalesce,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	.set_coalesce		= efx_ethtool_set_coalesce,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	.get_ringparam		= efx_ethtool_get_ringparam,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	.set_ringparam		= efx_ethtool_set_ringparam,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	.get_pauseparam         = efx_ethtool_get_pauseparam,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	.set_pauseparam         = efx_ethtool_set_pauseparam,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	.get_sset_count		= efx_ethtool_get_sset_count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	.self_test		= efx_ethtool_self_test,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	.get_strings		= efx_ethtool_get_strings,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	.set_phys_id		= efx_ethtool_phys_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	.get_ethtool_stats	= efx_ethtool_get_stats,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	.get_wol                = efx_ethtool_get_wol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	.set_wol                = efx_ethtool_set_wol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	.reset			= efx_ethtool_reset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	.get_rxnfc		= efx_ethtool_get_rxnfc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	.set_rxnfc		= efx_ethtool_set_rxnfc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	.get_rxfh_indir_size	= efx_ethtool_get_rxfh_indir_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	.get_rxfh_key_size	= efx_ethtool_get_rxfh_key_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	.get_rxfh		= efx_ethtool_get_rxfh,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	.set_rxfh		= efx_ethtool_set_rxfh,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	.get_rxfh_context	= efx_ethtool_get_rxfh_context,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	.set_rxfh_context	= efx_ethtool_set_rxfh_context,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	.get_ts_info		= efx_ethtool_get_ts_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	.get_module_info	= efx_ethtool_get_module_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	.get_module_eeprom	= efx_ethtool_get_module_eeprom,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	.get_link_ksettings	= efx_ethtool_get_link_ksettings,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	.set_link_ksettings	= efx_ethtool_set_link_ksettings,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	.get_fecparam		= efx_ethtool_get_fecparam,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	.set_fecparam		= efx_ethtool_set_fecparam,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) };