1 // SPDX-License-Identifier: GPL-2.0-only
2 /****************************************************************************
3 * Driver for Solarflare network controllers and boards
4 * Copyright 2019 Solarflare Communications Inc.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation, incorporated herein by reference.
10 #include <linux/module.h>
11 #include <linux/netdevice.h>
12 #include "net_driver.h"
16 #include "rx_common.h"
17 #include "ethtool_common.h"
18 #include "mcdi_port_common.h"
20 struct efx_sw_stat_desc {
23 EFX_ETHTOOL_STAT_SOURCE_nic,
24 EFX_ETHTOOL_STAT_SOURCE_channel,
25 EFX_ETHTOOL_STAT_SOURCE_tx_queue
28 u64 (*get_stat)(void *field); /* Reader function */
31 /* Initialiser for a struct efx_sw_stat_desc with type-checking */
32 #define EFX_ETHTOOL_STAT(stat_name, source_name, field, field_type, \
33 get_stat_function) { \
35 .source = EFX_ETHTOOL_STAT_SOURCE_##source_name, \
36 .offset = ((((field_type *) 0) == \
37 &((struct efx_##source_name *)0)->field) ? \
38 offsetof(struct efx_##source_name, field) : \
39 offsetof(struct efx_##source_name, field)), \
40 .get_stat = get_stat_function, \
43 static u64 efx_get_uint_stat(void *field)
45 return *(unsigned int *)field;
48 static u64 efx_get_atomic_stat(void *field)
50 return atomic_read((atomic_t *) field);
53 #define EFX_ETHTOOL_ATOMIC_NIC_ERROR_STAT(field) \
54 EFX_ETHTOOL_STAT(field, nic, field, \
55 atomic_t, efx_get_atomic_stat)
57 #define EFX_ETHTOOL_UINT_CHANNEL_STAT(field) \
58 EFX_ETHTOOL_STAT(field, channel, n_##field, \
59 unsigned int, efx_get_uint_stat)
60 #define EFX_ETHTOOL_UINT_CHANNEL_STAT_NO_N(field) \
61 EFX_ETHTOOL_STAT(field, channel, field, \
62 unsigned int, efx_get_uint_stat)
64 #define EFX_ETHTOOL_UINT_TXQ_STAT(field) \
65 EFX_ETHTOOL_STAT(tx_##field, tx_queue, field, \
66 unsigned int, efx_get_uint_stat)
68 static const struct efx_sw_stat_desc efx_sw_stat_desc[] = {
69 EFX_ETHTOOL_UINT_TXQ_STAT(merge_events),
70 EFX_ETHTOOL_UINT_TXQ_STAT(tso_bursts),
71 EFX_ETHTOOL_UINT_TXQ_STAT(tso_long_headers),
72 EFX_ETHTOOL_UINT_TXQ_STAT(tso_packets),
73 EFX_ETHTOOL_UINT_TXQ_STAT(tso_fallbacks),
74 EFX_ETHTOOL_UINT_TXQ_STAT(pushes),
75 EFX_ETHTOOL_UINT_TXQ_STAT(pio_packets),
76 EFX_ETHTOOL_UINT_TXQ_STAT(cb_packets),
77 EFX_ETHTOOL_ATOMIC_NIC_ERROR_STAT(rx_reset),
78 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_tobe_disc),
79 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_ip_hdr_chksum_err),
80 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_tcp_udp_chksum_err),
81 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_inner_ip_hdr_chksum_err),
82 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_inner_tcp_udp_chksum_err),
83 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_outer_ip_hdr_chksum_err),
84 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_outer_tcp_udp_chksum_err),
85 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_eth_crc_err),
86 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_mcast_mismatch),
87 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_frm_trunc),
88 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_merge_events),
89 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_merge_packets),
90 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_xdp_drops),
91 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_xdp_bad_drops),
92 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_xdp_tx),
93 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_xdp_redirect),
94 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_mport_bad),
95 #ifdef CONFIG_RFS_ACCEL
96 EFX_ETHTOOL_UINT_CHANNEL_STAT_NO_N(rfs_filter_count),
97 EFX_ETHTOOL_UINT_CHANNEL_STAT(rfs_succeeded),
98 EFX_ETHTOOL_UINT_CHANNEL_STAT(rfs_failed),
102 #define EFX_ETHTOOL_SW_STAT_COUNT ARRAY_SIZE(efx_sw_stat_desc)
104 void efx_ethtool_get_drvinfo(struct net_device *net_dev,
105 struct ethtool_drvinfo *info)
107 struct efx_nic *efx = efx_netdev_priv(net_dev);
109 strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
110 efx_mcdi_print_fwver(efx, info->fw_version,
111 sizeof(info->fw_version));
112 strscpy(info->bus_info, pci_name(efx->pci_dev), sizeof(info->bus_info));
115 u32 efx_ethtool_get_msglevel(struct net_device *net_dev)
117 struct efx_nic *efx = efx_netdev_priv(net_dev);
119 return efx->msg_enable;
122 void efx_ethtool_set_msglevel(struct net_device *net_dev, u32 msg_enable)
124 struct efx_nic *efx = efx_netdev_priv(net_dev);
126 efx->msg_enable = msg_enable;
129 void efx_ethtool_self_test(struct net_device *net_dev,
130 struct ethtool_test *test, u64 *data)
132 struct efx_nic *efx = efx_netdev_priv(net_dev);
133 struct efx_self_tests *efx_tests;
137 efx_tests = kzalloc(sizeof(*efx_tests), GFP_KERNEL);
141 if (!efx_net_active(efx->state)) {
146 netif_info(efx, drv, efx->net_dev, "starting %sline testing\n",
147 (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on");
149 /* We need rx buffers and interrupts. */
150 already_up = (efx->net_dev->flags & IFF_UP);
152 rc = dev_open(efx->net_dev, NULL);
154 netif_err(efx, drv, efx->net_dev,
155 "failed opening device.\n");
160 rc = efx_selftest(efx, efx_tests, test->flags);
163 dev_close(efx->net_dev);
165 netif_info(efx, drv, efx->net_dev, "%s %sline self-tests\n",
166 rc == 0 ? "passed" : "failed",
167 (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on");
170 efx_ethtool_fill_self_tests(efx, efx_tests, NULL, data);
174 test->flags |= ETH_TEST_FL_FAILED;
177 void efx_ethtool_get_pauseparam(struct net_device *net_dev,
178 struct ethtool_pauseparam *pause)
180 struct efx_nic *efx = efx_netdev_priv(net_dev);
182 pause->rx_pause = !!(efx->wanted_fc & EFX_FC_RX);
183 pause->tx_pause = !!(efx->wanted_fc & EFX_FC_TX);
184 pause->autoneg = !!(efx->wanted_fc & EFX_FC_AUTO);
187 int efx_ethtool_set_pauseparam(struct net_device *net_dev,
188 struct ethtool_pauseparam *pause)
190 struct efx_nic *efx = efx_netdev_priv(net_dev);
191 u8 wanted_fc, old_fc;
195 mutex_lock(&efx->mac_lock);
197 wanted_fc = ((pause->rx_pause ? EFX_FC_RX : 0) |
198 (pause->tx_pause ? EFX_FC_TX : 0) |
199 (pause->autoneg ? EFX_FC_AUTO : 0));
201 if ((wanted_fc & EFX_FC_TX) && !(wanted_fc & EFX_FC_RX)) {
202 netif_dbg(efx, drv, efx->net_dev,
203 "Flow control unsupported: tx ON rx OFF\n");
208 if ((wanted_fc & EFX_FC_AUTO) && !efx->link_advertising[0]) {
209 netif_dbg(efx, drv, efx->net_dev,
210 "Autonegotiation is disabled\n");
215 /* Hook for Falcon bug 11482 workaround */
216 if (efx->type->prepare_enable_fc_tx &&
217 (wanted_fc & EFX_FC_TX) && !(efx->wanted_fc & EFX_FC_TX))
218 efx->type->prepare_enable_fc_tx(efx);
220 old_adv = efx->link_advertising[0];
221 old_fc = efx->wanted_fc;
222 efx_link_set_wanted_fc(efx, wanted_fc);
223 if (efx->link_advertising[0] != old_adv ||
224 (efx->wanted_fc ^ old_fc) & EFX_FC_AUTO) {
225 rc = efx_mcdi_port_reconfigure(efx);
227 netif_err(efx, drv, efx->net_dev,
228 "Unable to advertise requested flow "
229 "control setting\n");
234 /* Reconfigure the MAC. The PHY *may* generate a link state change event
235 * if the user just changed the advertised capabilities, but there's no
236 * harm doing this twice */
237 efx_mac_reconfigure(efx, false);
240 mutex_unlock(&efx->mac_lock);
246 * efx_fill_test - fill in an individual self-test entry
247 * @test_index: Index of the test
248 * @strings: Ethtool strings, or %NULL
249 * @data: Ethtool test results, or %NULL
250 * @test: Pointer to test result (used only if data != %NULL)
251 * @unit_format: Unit name format (e.g. "chan\%d")
252 * @unit_id: Unit id (e.g. 0 for "chan0")
253 * @test_format: Test name format (e.g. "loopback.\%s.tx.sent")
254 * @test_id: Test id (e.g. "PHYXS" for "loopback.PHYXS.tx_sent")
256 * Fill in an individual self-test entry.
258 static void efx_fill_test(unsigned int test_index, u8 *strings, u64 *data,
259 int *test, const char *unit_format, int unit_id,
260 const char *test_format, const char *test_id)
262 char unit_str[ETH_GSTRING_LEN], test_str[ETH_GSTRING_LEN];
264 /* Fill data value, if applicable */
266 data[test_index] = *test;
268 /* Fill string, if applicable */
270 if (strchr(unit_format, '%'))
271 snprintf(unit_str, sizeof(unit_str),
272 unit_format, unit_id);
274 strcpy(unit_str, unit_format);
275 snprintf(test_str, sizeof(test_str), test_format, test_id);
276 snprintf(strings + test_index * ETH_GSTRING_LEN,
278 "%-6s %-24s", unit_str, test_str);
282 #define EFX_CHANNEL_NAME(_channel) "chan%d", _channel->channel
283 #define EFX_TX_QUEUE_NAME(_tx_queue) "txq%d", _tx_queue->label
284 #define EFX_LOOPBACK_NAME(_mode, _counter) \
285 "loopback.%s." _counter, STRING_TABLE_LOOKUP(_mode, efx_loopback_mode)
288 * efx_fill_loopback_test - fill in a block of loopback self-test entries
290 * @lb_tests: Efx loopback self-test results structure
291 * @mode: Loopback test mode
292 * @test_index: Starting index of the test
293 * @strings: Ethtool strings, or %NULL
294 * @data: Ethtool test results, or %NULL
296 * Fill in a block of loopback self-test entries. Return new test
299 static int efx_fill_loopback_test(struct efx_nic *efx,
300 struct efx_loopback_self_tests *lb_tests,
301 enum efx_loopback_mode mode,
302 unsigned int test_index,
303 u8 *strings, u64 *data)
305 struct efx_channel *channel =
306 efx_get_channel(efx, efx->tx_channel_offset);
307 struct efx_tx_queue *tx_queue;
309 efx_for_each_channel_tx_queue(tx_queue, channel) {
310 efx_fill_test(test_index++, strings, data,
311 &lb_tests->tx_sent[tx_queue->label],
312 EFX_TX_QUEUE_NAME(tx_queue),
313 EFX_LOOPBACK_NAME(mode, "tx_sent"));
314 efx_fill_test(test_index++, strings, data,
315 &lb_tests->tx_done[tx_queue->label],
316 EFX_TX_QUEUE_NAME(tx_queue),
317 EFX_LOOPBACK_NAME(mode, "tx_done"));
319 efx_fill_test(test_index++, strings, data,
322 EFX_LOOPBACK_NAME(mode, "rx_good"));
323 efx_fill_test(test_index++, strings, data,
326 EFX_LOOPBACK_NAME(mode, "rx_bad"));
332 * efx_ethtool_fill_self_tests - get self-test details
334 * @tests: Efx self-test results structure, or %NULL
335 * @strings: Ethtool strings, or %NULL
336 * @data: Ethtool test results, or %NULL
338 * Get self-test number of strings, strings, and/or test results.
339 * Return number of strings (== number of test results).
341 * The reason for merging these three functions is to make sure that
342 * they can never be inconsistent.
344 int efx_ethtool_fill_self_tests(struct efx_nic *efx,
345 struct efx_self_tests *tests,
346 u8 *strings, u64 *data)
348 struct efx_channel *channel;
349 unsigned int n = 0, i;
350 enum efx_loopback_mode mode;
352 efx_fill_test(n++, strings, data, &tests->phy_alive,
353 "phy", 0, "alive", NULL);
354 efx_fill_test(n++, strings, data, &tests->nvram,
355 "core", 0, "nvram", NULL);
356 efx_fill_test(n++, strings, data, &tests->interrupt,
357 "core", 0, "interrupt", NULL);
360 efx_for_each_channel(channel, efx) {
361 efx_fill_test(n++, strings, data,
362 &tests->eventq_dma[channel->channel],
363 EFX_CHANNEL_NAME(channel),
365 efx_fill_test(n++, strings, data,
366 &tests->eventq_int[channel->channel],
367 EFX_CHANNEL_NAME(channel),
371 efx_fill_test(n++, strings, data, &tests->memory,
372 "core", 0, "memory", NULL);
373 efx_fill_test(n++, strings, data, &tests->registers,
374 "core", 0, "registers", NULL);
376 for (i = 0; true; ++i) {
379 EFX_WARN_ON_PARANOID(i >= EFX_MAX_PHY_TESTS);
380 name = efx_mcdi_phy_test_name(efx, i);
384 efx_fill_test(n++, strings, data, &tests->phy_ext[i], "phy", 0, name, NULL);
388 for (mode = LOOPBACK_NONE; mode <= LOOPBACK_TEST_MAX; mode++) {
389 if (!(efx->loopback_modes & (1 << mode)))
391 n = efx_fill_loopback_test(efx,
392 &tests->loopback[mode], mode, n,
399 static size_t efx_describe_per_queue_stats(struct efx_nic *efx, u8 *strings)
402 struct efx_channel *channel;
404 efx_for_each_channel(channel, efx) {
405 if (efx_channel_has_tx_queues(channel)) {
407 if (strings != NULL) {
408 snprintf(strings, ETH_GSTRING_LEN,
410 channel->tx_queue[0].queue /
411 EFX_MAX_TXQ_PER_CHANNEL);
413 strings += ETH_GSTRING_LEN;
417 efx_for_each_channel(channel, efx) {
418 if (efx_channel_has_rx_queue(channel)) {
420 if (strings != NULL) {
421 snprintf(strings, ETH_GSTRING_LEN,
422 "rx-%d.rx_packets", channel->channel);
423 strings += ETH_GSTRING_LEN;
427 if (efx->xdp_tx_queue_count && efx->xdp_tx_queues) {
430 for (xdp = 0; xdp < efx->xdp_tx_queue_count; xdp++) {
433 snprintf(strings, ETH_GSTRING_LEN,
434 "tx-xdp-cpu-%hu.tx_packets", xdp);
435 strings += ETH_GSTRING_LEN;
443 int efx_ethtool_get_sset_count(struct net_device *net_dev, int string_set)
445 struct efx_nic *efx = efx_netdev_priv(net_dev);
447 switch (string_set) {
449 return efx->type->describe_stats(efx, NULL) +
450 EFX_ETHTOOL_SW_STAT_COUNT +
451 efx_describe_per_queue_stats(efx, NULL) +
452 efx_ptp_describe_stats(efx, NULL);
454 return efx_ethtool_fill_self_tests(efx, NULL, NULL, NULL);
460 void efx_ethtool_get_strings(struct net_device *net_dev,
461 u32 string_set, u8 *strings)
463 struct efx_nic *efx = efx_netdev_priv(net_dev);
466 switch (string_set) {
468 strings += (efx->type->describe_stats(efx, strings) *
470 for (i = 0; i < EFX_ETHTOOL_SW_STAT_COUNT; i++)
471 strscpy(strings + i * ETH_GSTRING_LEN,
472 efx_sw_stat_desc[i].name, ETH_GSTRING_LEN);
473 strings += EFX_ETHTOOL_SW_STAT_COUNT * ETH_GSTRING_LEN;
474 strings += (efx_describe_per_queue_stats(efx, strings) *
476 efx_ptp_describe_stats(efx, strings);
479 efx_ethtool_fill_self_tests(efx, NULL, strings, NULL);
482 /* No other string sets */
487 void efx_ethtool_get_stats(struct net_device *net_dev,
488 struct ethtool_stats *stats,
491 struct efx_nic *efx = efx_netdev_priv(net_dev);
492 const struct efx_sw_stat_desc *stat;
493 struct efx_channel *channel;
494 struct efx_tx_queue *tx_queue;
495 struct efx_rx_queue *rx_queue;
498 spin_lock_bh(&efx->stats_lock);
500 /* Get NIC statistics */
501 data += efx->type->update_stats(efx, data, NULL);
503 /* Get software statistics */
504 for (i = 0; i < EFX_ETHTOOL_SW_STAT_COUNT; i++) {
505 stat = &efx_sw_stat_desc[i];
506 switch (stat->source) {
507 case EFX_ETHTOOL_STAT_SOURCE_nic:
508 data[i] = stat->get_stat((void *)efx + stat->offset);
510 case EFX_ETHTOOL_STAT_SOURCE_channel:
512 efx_for_each_channel(channel, efx)
513 data[i] += stat->get_stat((void *)channel +
516 case EFX_ETHTOOL_STAT_SOURCE_tx_queue:
518 efx_for_each_channel(channel, efx) {
519 efx_for_each_channel_tx_queue(tx_queue, channel)
521 stat->get_stat((void *)tx_queue
527 data += EFX_ETHTOOL_SW_STAT_COUNT;
529 spin_unlock_bh(&efx->stats_lock);
531 efx_for_each_channel(channel, efx) {
532 if (efx_channel_has_tx_queues(channel)) {
534 efx_for_each_channel_tx_queue(tx_queue, channel) {
535 *data += tx_queue->tx_packets;
540 efx_for_each_channel(channel, efx) {
541 if (efx_channel_has_rx_queue(channel)) {
543 efx_for_each_channel_rx_queue(rx_queue, channel) {
544 *data += rx_queue->rx_packets;
549 if (efx->xdp_tx_queue_count && efx->xdp_tx_queues) {
552 for (xdp = 0; xdp < efx->xdp_tx_queue_count; xdp++) {
553 data[0] = efx->xdp_tx_queues[xdp]->tx_packets;
558 efx_ptp_update_stats(efx, data);
561 /* This must be called with rtnl_lock held. */
562 int efx_ethtool_get_link_ksettings(struct net_device *net_dev,
563 struct ethtool_link_ksettings *cmd)
565 struct efx_nic *efx = efx_netdev_priv(net_dev);
566 struct efx_link_state *link_state = &efx->link_state;
568 mutex_lock(&efx->mac_lock);
569 efx_mcdi_phy_get_link_ksettings(efx, cmd);
570 mutex_unlock(&efx->mac_lock);
572 /* Both MACs support pause frames (bidirectional and respond-only) */
573 ethtool_link_ksettings_add_link_mode(cmd, supported, Pause);
574 ethtool_link_ksettings_add_link_mode(cmd, supported, Asym_Pause);
576 if (LOOPBACK_INTERNAL(efx)) {
577 cmd->base.speed = link_state->speed;
578 cmd->base.duplex = link_state->fd ? DUPLEX_FULL : DUPLEX_HALF;
584 /* This must be called with rtnl_lock held. */
585 int efx_ethtool_set_link_ksettings(struct net_device *net_dev,
586 const struct ethtool_link_ksettings *cmd)
588 struct efx_nic *efx = efx_netdev_priv(net_dev);
591 /* GMAC does not support 1000Mbps HD */
592 if ((cmd->base.speed == SPEED_1000) &&
593 (cmd->base.duplex != DUPLEX_FULL)) {
594 netif_dbg(efx, drv, efx->net_dev,
595 "rejecting unsupported 1000Mbps HD setting\n");
599 mutex_lock(&efx->mac_lock);
600 rc = efx_mcdi_phy_set_link_ksettings(efx, cmd);
601 mutex_unlock(&efx->mac_lock);
605 int efx_ethtool_get_fecparam(struct net_device *net_dev,
606 struct ethtool_fecparam *fecparam)
608 struct efx_nic *efx = efx_netdev_priv(net_dev);
611 mutex_lock(&efx->mac_lock);
612 rc = efx_mcdi_phy_get_fecparam(efx, fecparam);
613 mutex_unlock(&efx->mac_lock);
618 int efx_ethtool_set_fecparam(struct net_device *net_dev,
619 struct ethtool_fecparam *fecparam)
621 struct efx_nic *efx = efx_netdev_priv(net_dev);
624 mutex_lock(&efx->mac_lock);
625 rc = efx_mcdi_phy_set_fecparam(efx, fecparam);
626 mutex_unlock(&efx->mac_lock);
631 /* MAC address mask including only I/G bit */
632 static const u8 mac_addr_ig_mask[ETH_ALEN] __aligned(2) = {0x01, 0, 0, 0, 0, 0};
634 #define IP4_ADDR_FULL_MASK ((__force __be32)~0)
635 #define IP_PROTO_FULL_MASK 0xFF
636 #define PORT_FULL_MASK ((__force __be16)~0)
637 #define ETHER_TYPE_FULL_MASK ((__force __be16)~0)
639 static inline void ip6_fill_mask(__be32 *mask)
641 mask[0] = mask[1] = mask[2] = mask[3] = ~(__be32)0;
644 static int efx_ethtool_get_class_rule(struct efx_nic *efx,
645 struct ethtool_rx_flow_spec *rule,
648 struct ethtool_tcpip4_spec *ip_entry = &rule->h_u.tcp_ip4_spec;
649 struct ethtool_tcpip4_spec *ip_mask = &rule->m_u.tcp_ip4_spec;
650 struct ethtool_usrip4_spec *uip_entry = &rule->h_u.usr_ip4_spec;
651 struct ethtool_usrip4_spec *uip_mask = &rule->m_u.usr_ip4_spec;
652 struct ethtool_tcpip6_spec *ip6_entry = &rule->h_u.tcp_ip6_spec;
653 struct ethtool_tcpip6_spec *ip6_mask = &rule->m_u.tcp_ip6_spec;
654 struct ethtool_usrip6_spec *uip6_entry = &rule->h_u.usr_ip6_spec;
655 struct ethtool_usrip6_spec *uip6_mask = &rule->m_u.usr_ip6_spec;
656 struct ethhdr *mac_entry = &rule->h_u.ether_spec;
657 struct ethhdr *mac_mask = &rule->m_u.ether_spec;
658 struct efx_filter_spec spec;
661 rc = efx_filter_get_filter_safe(efx, EFX_FILTER_PRI_MANUAL,
662 rule->location, &spec);
666 if (spec.dmaq_id == EFX_FILTER_RX_DMAQ_ID_DROP)
667 rule->ring_cookie = RX_CLS_FLOW_DISC;
669 rule->ring_cookie = spec.dmaq_id;
671 if ((spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE) &&
672 spec.ether_type == htons(ETH_P_IP) &&
673 (spec.match_flags & EFX_FILTER_MATCH_IP_PROTO) &&
674 (spec.ip_proto == IPPROTO_TCP || spec.ip_proto == IPPROTO_UDP) &&
676 ~(EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_OUTER_VID |
677 EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_REM_HOST |
678 EFX_FILTER_MATCH_IP_PROTO |
679 EFX_FILTER_MATCH_LOC_PORT | EFX_FILTER_MATCH_REM_PORT))) {
680 rule->flow_type = ((spec.ip_proto == IPPROTO_TCP) ?
681 TCP_V4_FLOW : UDP_V4_FLOW);
682 if (spec.match_flags & EFX_FILTER_MATCH_LOC_HOST) {
683 ip_entry->ip4dst = spec.loc_host[0];
684 ip_mask->ip4dst = IP4_ADDR_FULL_MASK;
686 if (spec.match_flags & EFX_FILTER_MATCH_REM_HOST) {
687 ip_entry->ip4src = spec.rem_host[0];
688 ip_mask->ip4src = IP4_ADDR_FULL_MASK;
690 if (spec.match_flags & EFX_FILTER_MATCH_LOC_PORT) {
691 ip_entry->pdst = spec.loc_port;
692 ip_mask->pdst = PORT_FULL_MASK;
694 if (spec.match_flags & EFX_FILTER_MATCH_REM_PORT) {
695 ip_entry->psrc = spec.rem_port;
696 ip_mask->psrc = PORT_FULL_MASK;
698 } else if ((spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE) &&
699 spec.ether_type == htons(ETH_P_IPV6) &&
700 (spec.match_flags & EFX_FILTER_MATCH_IP_PROTO) &&
701 (spec.ip_proto == IPPROTO_TCP || spec.ip_proto == IPPROTO_UDP) &&
703 ~(EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_OUTER_VID |
704 EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_REM_HOST |
705 EFX_FILTER_MATCH_IP_PROTO |
706 EFX_FILTER_MATCH_LOC_PORT | EFX_FILTER_MATCH_REM_PORT))) {
707 rule->flow_type = ((spec.ip_proto == IPPROTO_TCP) ?
708 TCP_V6_FLOW : UDP_V6_FLOW);
709 if (spec.match_flags & EFX_FILTER_MATCH_LOC_HOST) {
710 memcpy(ip6_entry->ip6dst, spec.loc_host,
711 sizeof(ip6_entry->ip6dst));
712 ip6_fill_mask(ip6_mask->ip6dst);
714 if (spec.match_flags & EFX_FILTER_MATCH_REM_HOST) {
715 memcpy(ip6_entry->ip6src, spec.rem_host,
716 sizeof(ip6_entry->ip6src));
717 ip6_fill_mask(ip6_mask->ip6src);
719 if (spec.match_flags & EFX_FILTER_MATCH_LOC_PORT) {
720 ip6_entry->pdst = spec.loc_port;
721 ip6_mask->pdst = PORT_FULL_MASK;
723 if (spec.match_flags & EFX_FILTER_MATCH_REM_PORT) {
724 ip6_entry->psrc = spec.rem_port;
725 ip6_mask->psrc = PORT_FULL_MASK;
727 } else if (!(spec.match_flags &
728 ~(EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_LOC_MAC_IG |
729 EFX_FILTER_MATCH_REM_MAC | EFX_FILTER_MATCH_ETHER_TYPE |
730 EFX_FILTER_MATCH_OUTER_VID))) {
731 rule->flow_type = ETHER_FLOW;
732 if (spec.match_flags &
733 (EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_LOC_MAC_IG)) {
734 ether_addr_copy(mac_entry->h_dest, spec.loc_mac);
735 if (spec.match_flags & EFX_FILTER_MATCH_LOC_MAC)
736 eth_broadcast_addr(mac_mask->h_dest);
738 ether_addr_copy(mac_mask->h_dest,
741 if (spec.match_flags & EFX_FILTER_MATCH_REM_MAC) {
742 ether_addr_copy(mac_entry->h_source, spec.rem_mac);
743 eth_broadcast_addr(mac_mask->h_source);
745 if (spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE) {
746 mac_entry->h_proto = spec.ether_type;
747 mac_mask->h_proto = ETHER_TYPE_FULL_MASK;
749 } else if (spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE &&
750 spec.ether_type == htons(ETH_P_IP) &&
752 ~(EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_OUTER_VID |
753 EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_REM_HOST |
754 EFX_FILTER_MATCH_IP_PROTO))) {
755 rule->flow_type = IPV4_USER_FLOW;
756 uip_entry->ip_ver = ETH_RX_NFC_IP4;
757 if (spec.match_flags & EFX_FILTER_MATCH_IP_PROTO) {
758 uip_mask->proto = IP_PROTO_FULL_MASK;
759 uip_entry->proto = spec.ip_proto;
761 if (spec.match_flags & EFX_FILTER_MATCH_LOC_HOST) {
762 uip_entry->ip4dst = spec.loc_host[0];
763 uip_mask->ip4dst = IP4_ADDR_FULL_MASK;
765 if (spec.match_flags & EFX_FILTER_MATCH_REM_HOST) {
766 uip_entry->ip4src = spec.rem_host[0];
767 uip_mask->ip4src = IP4_ADDR_FULL_MASK;
769 } else if (spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE &&
770 spec.ether_type == htons(ETH_P_IPV6) &&
772 ~(EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_OUTER_VID |
773 EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_REM_HOST |
774 EFX_FILTER_MATCH_IP_PROTO))) {
775 rule->flow_type = IPV6_USER_FLOW;
776 if (spec.match_flags & EFX_FILTER_MATCH_IP_PROTO) {
777 uip6_mask->l4_proto = IP_PROTO_FULL_MASK;
778 uip6_entry->l4_proto = spec.ip_proto;
780 if (spec.match_flags & EFX_FILTER_MATCH_LOC_HOST) {
781 memcpy(uip6_entry->ip6dst, spec.loc_host,
782 sizeof(uip6_entry->ip6dst));
783 ip6_fill_mask(uip6_mask->ip6dst);
785 if (spec.match_flags & EFX_FILTER_MATCH_REM_HOST) {
786 memcpy(uip6_entry->ip6src, spec.rem_host,
787 sizeof(uip6_entry->ip6src));
788 ip6_fill_mask(uip6_mask->ip6src);
791 /* The above should handle all filters that we insert */
796 if (spec.match_flags & EFX_FILTER_MATCH_OUTER_VID) {
797 rule->flow_type |= FLOW_EXT;
798 rule->h_ext.vlan_tci = spec.outer_vid;
799 rule->m_ext.vlan_tci = htons(0xfff);
802 if (spec.flags & EFX_FILTER_FLAG_RX_RSS) {
803 rule->flow_type |= FLOW_RSS;
804 *rss_context = spec.rss_context;
810 int efx_ethtool_get_rxnfc(struct net_device *net_dev,
811 struct ethtool_rxnfc *info, u32 *rule_locs)
813 struct efx_nic *efx = efx_netdev_priv(net_dev);
818 case ETHTOOL_GRXRINGS:
819 info->data = efx->n_rx_channels;
822 case ETHTOOL_GRXFH: {
823 struct efx_rss_context *ctx = &efx->rss_context;
826 mutex_lock(&efx->rss_lock);
827 if (info->flow_type & FLOW_RSS && info->rss_context) {
828 ctx = efx_find_rss_context_entry(efx, info->rss_context);
836 if (!efx_rss_active(ctx)) /* No RSS */
837 goto out_setdata_unlock;
839 switch (info->flow_type & ~FLOW_RSS) {
842 if (ctx->rx_hash_udp_4tuple)
843 data = (RXH_L4_B_0_1 | RXH_L4_B_2_3 |
844 RXH_IP_SRC | RXH_IP_DST);
846 data = RXH_IP_SRC | RXH_IP_DST;
850 data = (RXH_L4_B_0_1 | RXH_L4_B_2_3 |
851 RXH_IP_SRC | RXH_IP_DST);
859 data = RXH_IP_SRC | RXH_IP_DST;
867 mutex_unlock(&efx->rss_lock);
871 case ETHTOOL_GRXCLSRLCNT:
872 info->data = efx_filter_get_rx_id_limit(efx);
875 info->data |= RX_CLS_LOC_SPECIAL;
877 efx_filter_count_rx_used(efx, EFX_FILTER_PRI_MANUAL);
880 case ETHTOOL_GRXCLSRULE:
881 if (efx_filter_get_rx_id_limit(efx) == 0)
883 rc = efx_ethtool_get_class_rule(efx, &info->fs, &rss_context);
886 if (info->fs.flow_type & FLOW_RSS)
887 info->rss_context = rss_context;
890 case ETHTOOL_GRXCLSRLALL:
891 info->data = efx_filter_get_rx_id_limit(efx);
894 rc = efx_filter_get_rx_ids(efx, EFX_FILTER_PRI_MANUAL,
895 rule_locs, info->rule_cnt);
906 static inline bool ip6_mask_is_full(__be32 mask[4])
908 return !~(mask[0] & mask[1] & mask[2] & mask[3]);
911 static inline bool ip6_mask_is_empty(__be32 mask[4])
913 return !(mask[0] | mask[1] | mask[2] | mask[3]);
916 static int efx_ethtool_set_class_rule(struct efx_nic *efx,
917 struct ethtool_rx_flow_spec *rule,
920 struct ethtool_tcpip4_spec *ip_entry = &rule->h_u.tcp_ip4_spec;
921 struct ethtool_tcpip4_spec *ip_mask = &rule->m_u.tcp_ip4_spec;
922 struct ethtool_usrip4_spec *uip_entry = &rule->h_u.usr_ip4_spec;
923 struct ethtool_usrip4_spec *uip_mask = &rule->m_u.usr_ip4_spec;
924 struct ethtool_tcpip6_spec *ip6_entry = &rule->h_u.tcp_ip6_spec;
925 struct ethtool_tcpip6_spec *ip6_mask = &rule->m_u.tcp_ip6_spec;
926 struct ethtool_usrip6_spec *uip6_entry = &rule->h_u.usr_ip6_spec;
927 struct ethtool_usrip6_spec *uip6_mask = &rule->m_u.usr_ip6_spec;
928 u32 flow_type = rule->flow_type & ~(FLOW_EXT | FLOW_RSS);
929 struct ethhdr *mac_entry = &rule->h_u.ether_spec;
930 struct ethhdr *mac_mask = &rule->m_u.ether_spec;
931 enum efx_filter_flags flags = 0;
932 struct efx_filter_spec spec;
935 /* Check that user wants us to choose the location */
936 if (rule->location != RX_CLS_LOC_ANY)
939 /* Range-check ring_cookie */
940 if (rule->ring_cookie >= efx->n_rx_channels &&
941 rule->ring_cookie != RX_CLS_FLOW_DISC)
944 /* Check for unsupported extensions */
945 if ((rule->flow_type & FLOW_EXT) &&
946 (rule->m_ext.vlan_etype || rule->m_ext.data[0] ||
947 rule->m_ext.data[1]))
951 flags |= EFX_FILTER_FLAG_RX_SCATTER;
952 if (rule->flow_type & FLOW_RSS)
953 flags |= EFX_FILTER_FLAG_RX_RSS;
955 efx_filter_init_rx(&spec, EFX_FILTER_PRI_MANUAL, flags,
956 (rule->ring_cookie == RX_CLS_FLOW_DISC) ?
957 EFX_FILTER_RX_DMAQ_ID_DROP : rule->ring_cookie);
959 if (rule->flow_type & FLOW_RSS)
960 spec.rss_context = rss_context;
965 spec.match_flags = (EFX_FILTER_MATCH_ETHER_TYPE |
966 EFX_FILTER_MATCH_IP_PROTO);
967 spec.ether_type = htons(ETH_P_IP);
968 spec.ip_proto = flow_type == TCP_V4_FLOW ? IPPROTO_TCP
970 if (ip_mask->ip4dst) {
971 if (ip_mask->ip4dst != IP4_ADDR_FULL_MASK)
973 spec.match_flags |= EFX_FILTER_MATCH_LOC_HOST;
974 spec.loc_host[0] = ip_entry->ip4dst;
976 if (ip_mask->ip4src) {
977 if (ip_mask->ip4src != IP4_ADDR_FULL_MASK)
979 spec.match_flags |= EFX_FILTER_MATCH_REM_HOST;
980 spec.rem_host[0] = ip_entry->ip4src;
983 if (ip_mask->pdst != PORT_FULL_MASK)
985 spec.match_flags |= EFX_FILTER_MATCH_LOC_PORT;
986 spec.loc_port = ip_entry->pdst;
989 if (ip_mask->psrc != PORT_FULL_MASK)
991 spec.match_flags |= EFX_FILTER_MATCH_REM_PORT;
992 spec.rem_port = ip_entry->psrc;
1000 spec.match_flags = (EFX_FILTER_MATCH_ETHER_TYPE |
1001 EFX_FILTER_MATCH_IP_PROTO);
1002 spec.ether_type = htons(ETH_P_IPV6);
1003 spec.ip_proto = flow_type == TCP_V6_FLOW ? IPPROTO_TCP
1005 if (!ip6_mask_is_empty(ip6_mask->ip6dst)) {
1006 if (!ip6_mask_is_full(ip6_mask->ip6dst))
1008 spec.match_flags |= EFX_FILTER_MATCH_LOC_HOST;
1009 memcpy(spec.loc_host, ip6_entry->ip6dst, sizeof(spec.loc_host));
1011 if (!ip6_mask_is_empty(ip6_mask->ip6src)) {
1012 if (!ip6_mask_is_full(ip6_mask->ip6src))
1014 spec.match_flags |= EFX_FILTER_MATCH_REM_HOST;
1015 memcpy(spec.rem_host, ip6_entry->ip6src, sizeof(spec.rem_host));
1017 if (ip6_mask->pdst) {
1018 if (ip6_mask->pdst != PORT_FULL_MASK)
1020 spec.match_flags |= EFX_FILTER_MATCH_LOC_PORT;
1021 spec.loc_port = ip6_entry->pdst;
1023 if (ip6_mask->psrc) {
1024 if (ip6_mask->psrc != PORT_FULL_MASK)
1026 spec.match_flags |= EFX_FILTER_MATCH_REM_PORT;
1027 spec.rem_port = ip6_entry->psrc;
1029 if (ip6_mask->tclass)
1033 case IPV4_USER_FLOW:
1034 if (uip_mask->l4_4_bytes || uip_mask->tos || uip_mask->ip_ver ||
1035 uip_entry->ip_ver != ETH_RX_NFC_IP4)
1037 spec.match_flags = EFX_FILTER_MATCH_ETHER_TYPE;
1038 spec.ether_type = htons(ETH_P_IP);
1039 if (uip_mask->ip4dst) {
1040 if (uip_mask->ip4dst != IP4_ADDR_FULL_MASK)
1042 spec.match_flags |= EFX_FILTER_MATCH_LOC_HOST;
1043 spec.loc_host[0] = uip_entry->ip4dst;
1045 if (uip_mask->ip4src) {
1046 if (uip_mask->ip4src != IP4_ADDR_FULL_MASK)
1048 spec.match_flags |= EFX_FILTER_MATCH_REM_HOST;
1049 spec.rem_host[0] = uip_entry->ip4src;
1051 if (uip_mask->proto) {
1052 if (uip_mask->proto != IP_PROTO_FULL_MASK)
1054 spec.match_flags |= EFX_FILTER_MATCH_IP_PROTO;
1055 spec.ip_proto = uip_entry->proto;
1059 case IPV6_USER_FLOW:
1060 if (uip6_mask->l4_4_bytes || uip6_mask->tclass)
1062 spec.match_flags = EFX_FILTER_MATCH_ETHER_TYPE;
1063 spec.ether_type = htons(ETH_P_IPV6);
1064 if (!ip6_mask_is_empty(uip6_mask->ip6dst)) {
1065 if (!ip6_mask_is_full(uip6_mask->ip6dst))
1067 spec.match_flags |= EFX_FILTER_MATCH_LOC_HOST;
1068 memcpy(spec.loc_host, uip6_entry->ip6dst, sizeof(spec.loc_host));
1070 if (!ip6_mask_is_empty(uip6_mask->ip6src)) {
1071 if (!ip6_mask_is_full(uip6_mask->ip6src))
1073 spec.match_flags |= EFX_FILTER_MATCH_REM_HOST;
1074 memcpy(spec.rem_host, uip6_entry->ip6src, sizeof(spec.rem_host));
1076 if (uip6_mask->l4_proto) {
1077 if (uip6_mask->l4_proto != IP_PROTO_FULL_MASK)
1079 spec.match_flags |= EFX_FILTER_MATCH_IP_PROTO;
1080 spec.ip_proto = uip6_entry->l4_proto;
1085 if (!is_zero_ether_addr(mac_mask->h_dest)) {
1086 if (ether_addr_equal(mac_mask->h_dest,
1088 spec.match_flags |= EFX_FILTER_MATCH_LOC_MAC_IG;
1089 else if (is_broadcast_ether_addr(mac_mask->h_dest))
1090 spec.match_flags |= EFX_FILTER_MATCH_LOC_MAC;
1093 ether_addr_copy(spec.loc_mac, mac_entry->h_dest);
1095 if (!is_zero_ether_addr(mac_mask->h_source)) {
1096 if (!is_broadcast_ether_addr(mac_mask->h_source))
1098 spec.match_flags |= EFX_FILTER_MATCH_REM_MAC;
1099 ether_addr_copy(spec.rem_mac, mac_entry->h_source);
1101 if (mac_mask->h_proto) {
1102 if (mac_mask->h_proto != ETHER_TYPE_FULL_MASK)
1104 spec.match_flags |= EFX_FILTER_MATCH_ETHER_TYPE;
1105 spec.ether_type = mac_entry->h_proto;
1113 if ((rule->flow_type & FLOW_EXT) && rule->m_ext.vlan_tci) {
1114 if (rule->m_ext.vlan_tci != htons(0xfff))
1116 spec.match_flags |= EFX_FILTER_MATCH_OUTER_VID;
1117 spec.outer_vid = rule->h_ext.vlan_tci;
1120 rc = efx_filter_insert_filter(efx, &spec, true);
1124 rule->location = rc;
1128 int efx_ethtool_set_rxnfc(struct net_device *net_dev,
1129 struct ethtool_rxnfc *info)
1131 struct efx_nic *efx = efx_netdev_priv(net_dev);
1133 if (efx_filter_get_rx_id_limit(efx) == 0)
1136 switch (info->cmd) {
1137 case ETHTOOL_SRXCLSRLINS:
1138 return efx_ethtool_set_class_rule(efx, &info->fs,
1141 case ETHTOOL_SRXCLSRLDEL:
1142 return efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_MANUAL,
1150 u32 efx_ethtool_get_rxfh_indir_size(struct net_device *net_dev)
1152 struct efx_nic *efx = efx_netdev_priv(net_dev);
1154 if (efx->n_rx_channels == 1)
1156 return ARRAY_SIZE(efx->rss_context.rx_indir_table);
1159 u32 efx_ethtool_get_rxfh_key_size(struct net_device *net_dev)
1161 struct efx_nic *efx = efx_netdev_priv(net_dev);
1163 return efx->type->rx_hash_key_size;
1166 int efx_ethtool_get_rxfh(struct net_device *net_dev, u32 *indir, u8 *key,
1169 struct efx_nic *efx = efx_netdev_priv(net_dev);
1172 rc = efx->type->rx_pull_rss_config(efx);
1177 *hfunc = ETH_RSS_HASH_TOP;
1179 memcpy(indir, efx->rss_context.rx_indir_table,
1180 sizeof(efx->rss_context.rx_indir_table));
1182 memcpy(key, efx->rss_context.rx_hash_key,
1183 efx->type->rx_hash_key_size);
1187 int efx_ethtool_set_rxfh(struct net_device *net_dev, const u32 *indir,
1188 const u8 *key, const u8 hfunc)
1190 struct efx_nic *efx = efx_netdev_priv(net_dev);
1192 /* Hash function is Toeplitz, cannot be changed */
1193 if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
1199 key = efx->rss_context.rx_hash_key;
1201 indir = efx->rss_context.rx_indir_table;
1203 return efx->type->rx_push_rss_config(efx, true, indir, key);
1206 int efx_ethtool_get_rxfh_context(struct net_device *net_dev, u32 *indir,
1207 u8 *key, u8 *hfunc, u32 rss_context)
1209 struct efx_nic *efx = efx_netdev_priv(net_dev);
1210 struct efx_rss_context *ctx;
1213 if (!efx->type->rx_pull_rss_context_config)
1216 mutex_lock(&efx->rss_lock);
1217 ctx = efx_find_rss_context_entry(efx, rss_context);
1222 rc = efx->type->rx_pull_rss_context_config(efx, ctx);
1227 *hfunc = ETH_RSS_HASH_TOP;
1229 memcpy(indir, ctx->rx_indir_table, sizeof(ctx->rx_indir_table));
1231 memcpy(key, ctx->rx_hash_key, efx->type->rx_hash_key_size);
1233 mutex_unlock(&efx->rss_lock);
1237 int efx_ethtool_set_rxfh_context(struct net_device *net_dev,
1238 const u32 *indir, const u8 *key,
1239 const u8 hfunc, u32 *rss_context,
1242 struct efx_nic *efx = efx_netdev_priv(net_dev);
1243 struct efx_rss_context *ctx;
1244 bool allocated = false;
1247 if (!efx->type->rx_push_rss_context_config)
1249 /* Hash function is Toeplitz, cannot be changed */
1250 if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
1253 mutex_lock(&efx->rss_lock);
1255 if (*rss_context == ETH_RXFH_CONTEXT_ALLOC) {
1257 /* alloc + delete == Nothing to do */
1261 ctx = efx_alloc_rss_context_entry(efx);
1266 ctx->context_id = EFX_MCDI_RSS_CONTEXT_INVALID;
1267 /* Initialise indir table and key to defaults */
1268 efx_set_default_rx_indir_table(efx, ctx);
1269 netdev_rss_key_fill(ctx->rx_hash_key, sizeof(ctx->rx_hash_key));
1272 ctx = efx_find_rss_context_entry(efx, *rss_context);
1280 /* delete this context */
1281 rc = efx->type->rx_push_rss_context_config(efx, ctx, NULL, NULL);
1283 efx_free_rss_context_entry(ctx);
1288 key = ctx->rx_hash_key;
1290 indir = ctx->rx_indir_table;
1292 rc = efx->type->rx_push_rss_context_config(efx, ctx, indir, key);
1293 if (rc && allocated)
1294 efx_free_rss_context_entry(ctx);
1296 *rss_context = ctx->user_id;
1298 mutex_unlock(&efx->rss_lock);
1302 int efx_ethtool_reset(struct net_device *net_dev, u32 *flags)
1304 struct efx_nic *efx = efx_netdev_priv(net_dev);
1307 rc = efx->type->map_reset_flags(flags);
1311 return efx_reset(efx, rc);
1314 int efx_ethtool_get_module_eeprom(struct net_device *net_dev,
1315 struct ethtool_eeprom *ee,
1318 struct efx_nic *efx = efx_netdev_priv(net_dev);
1321 mutex_lock(&efx->mac_lock);
1322 ret = efx_mcdi_phy_get_module_eeprom(efx, ee, data);
1323 mutex_unlock(&efx->mac_lock);
1328 int efx_ethtool_get_module_info(struct net_device *net_dev,
1329 struct ethtool_modinfo *modinfo)
1331 struct efx_nic *efx = efx_netdev_priv(net_dev);
1334 mutex_lock(&efx->mac_lock);
1335 ret = efx_mcdi_phy_get_module_info(efx, modinfo);
1336 mutex_unlock(&efx->mac_lock);