Skip to content

Commit bc04347

Browse files
etantilovJeff Kirsher
authored andcommitted
ixgbevf: add ethtool private flag for legacy Rx
Introduce legacy-rx private flag that will allow switching between the old and new (build_skb based) Rx code paths. The implementation is the same as in commit e089129 ("igb: Add support for ethtool private flag to allow use of legacy Rx") This provides a means of validating the legacy Rx path in the event that we are forced to fall back. At some point in the future when we are convinced we don't need it anymore we might be able to drop the legacy-rx flag. Signed-off-by: Emil Tantilov <[email protected]> Tested-by: Krishneil Singh <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 9913db0 commit bc04347

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

drivers/net/ethernet/intel/ixgbevf/ethtool.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ static const char ixgbe_gstrings_test[][ETH_GSTRING_LEN] = {
9494

9595
#define IXGBEVF_TEST_LEN (sizeof(ixgbe_gstrings_test) / ETH_GSTRING_LEN)
9696

97+
static const char ixgbevf_priv_flags_strings[][ETH_GSTRING_LEN] = {
98+
#define IXGBEVF_PRIV_FLAGS_LEGACY_RX BIT(0)
99+
"legacy-rx",
100+
};
101+
102+
#define IXGBEVF_PRIV_FLAGS_STR_LEN ARRAY_SIZE(ixgbevf_priv_flags_strings)
103+
97104
static int ixgbevf_get_link_ksettings(struct net_device *netdev,
98105
struct ethtool_link_ksettings *cmd)
99106
{
@@ -241,6 +248,8 @@ static void ixgbevf_get_drvinfo(struct net_device *netdev,
241248
sizeof(drvinfo->version));
242249
strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
243250
sizeof(drvinfo->bus_info));
251+
252+
drvinfo->n_priv_flags = IXGBEVF_PRIV_FLAGS_STR_LEN;
244253
}
245254

246255
static void ixgbevf_get_ringparam(struct net_device *netdev,
@@ -392,6 +401,8 @@ static int ixgbevf_get_sset_count(struct net_device *netdev, int stringset)
392401
return IXGBEVF_TEST_LEN;
393402
case ETH_SS_STATS:
394403
return IXGBEVF_STATS_LEN;
404+
case ETH_SS_PRIV_FLAGS:
405+
return IXGBEVF_PRIV_FLAGS_STR_LEN;
395406
default:
396407
return -EINVAL;
397408
}
@@ -496,6 +507,10 @@ static void ixgbevf_get_strings(struct net_device *netdev, u32 stringset,
496507
p += ETH_GSTRING_LEN;
497508
}
498509
break;
510+
case ETH_SS_PRIV_FLAGS:
511+
memcpy(data, ixgbevf_priv_flags_strings,
512+
IXGBEVF_PRIV_FLAGS_STR_LEN * ETH_GSTRING_LEN);
513+
break;
499514
}
500515
}
501516

@@ -888,6 +903,37 @@ static int ixgbevf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
888903
return err;
889904
}
890905

906+
static u32 ixgbevf_get_priv_flags(struct net_device *netdev)
907+
{
908+
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
909+
u32 priv_flags = 0;
910+
911+
if (adapter->flags & IXGBEVF_FLAGS_LEGACY_RX)
912+
priv_flags |= IXGBEVF_PRIV_FLAGS_LEGACY_RX;
913+
914+
return priv_flags;
915+
}
916+
917+
static int ixgbevf_set_priv_flags(struct net_device *netdev, u32 priv_flags)
918+
{
919+
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
920+
unsigned int flags = adapter->flags;
921+
922+
flags &= ~IXGBEVF_FLAGS_LEGACY_RX;
923+
if (priv_flags & IXGBEVF_PRIV_FLAGS_LEGACY_RX)
924+
flags |= IXGBEVF_FLAGS_LEGACY_RX;
925+
926+
if (flags != adapter->flags) {
927+
adapter->flags = flags;
928+
929+
/* reset interface to repopulate queues */
930+
if (netif_running(netdev))
931+
ixgbevf_reinit_locked(adapter);
932+
}
933+
934+
return 0;
935+
}
936+
891937
static const struct ethtool_ops ixgbevf_ethtool_ops = {
892938
.get_drvinfo = ixgbevf_get_drvinfo,
893939
.get_regs_len = ixgbevf_get_regs_len,
@@ -909,6 +955,8 @@ static const struct ethtool_ops ixgbevf_ethtool_ops = {
909955
.get_rxfh_key_size = ixgbevf_get_rxfh_key_size,
910956
.get_rxfh = ixgbevf_get_rxfh,
911957
.get_link_ksettings = ixgbevf_get_link_ksettings,
958+
.get_priv_flags = ixgbevf_get_priv_flags,
959+
.set_priv_flags = ixgbevf_set_priv_flags,
912960
};
913961

914962
void ixgbevf_set_ethtool_ops(struct net_device *netdev)

drivers/net/ethernet/intel/ixgbevf/ixgbevf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ struct ixgbevf_adapter {
331331

332332
u32 *rss_key;
333333
u8 rss_indir_tbl[IXGBEVF_X550_VFRETA_SIZE];
334+
u32 flags;
335+
#define IXGBEVF_FLAGS_LEGACY_RX BIT(1)
334336
};
335337

336338
enum ixbgevf_state_t {

0 commit comments

Comments
 (0)