Lines Matching +full:no +full:- +full:loopback +full:- +full:test
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright 2005-2006 Fen Systems Ltd.
5 * Copyright 2006-2013 Solarflare Communications Inc.
30 /* Initialiser for a struct ef4_sw_stat_desc with type-checking */
36 &((struct ef4_##source_name *)0)->field) ? \
110 efx->type->set_id_led(efx, mode); in ef4_ethtool_phys_id()
120 struct ef4_link_state *link_state = &efx->link_state; in ef4_ethtool_get_link_ksettings()
122 mutex_lock(&efx->mac_lock); in ef4_ethtool_get_link_ksettings()
123 efx->phy_op->get_link_ksettings(efx, cmd); in ef4_ethtool_get_link_ksettings()
124 mutex_unlock(&efx->mac_lock); in ef4_ethtool_get_link_ksettings()
126 /* Both MACs support pause frames (bidirectional and respond-only) */ in ef4_ethtool_get_link_ksettings()
131 cmd->base.speed = link_state->speed; in ef4_ethtool_get_link_ksettings()
132 cmd->base.duplex = link_state->fd ? DUPLEX_FULL : DUPLEX_HALF; in ef4_ethtool_get_link_ksettings()
147 if ((cmd->base.speed == SPEED_1000) && in ef4_ethtool_set_link_ksettings()
148 (cmd->base.duplex != DUPLEX_FULL)) { in ef4_ethtool_set_link_ksettings()
149 netif_dbg(efx, drv, efx->net_dev, in ef4_ethtool_set_link_ksettings()
151 return -EINVAL; in ef4_ethtool_set_link_ksettings()
154 mutex_lock(&efx->mac_lock); in ef4_ethtool_set_link_ksettings()
155 rc = efx->phy_op->set_link_ksettings(efx, cmd); in ef4_ethtool_set_link_ksettings()
156 mutex_unlock(&efx->mac_lock); in ef4_ethtool_set_link_ksettings()
165 strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); in ef4_ethtool_get_drvinfo()
166 strscpy(info->version, EF4_DRIVER_VERSION, sizeof(info->version)); in ef4_ethtool_get_drvinfo()
167 strscpy(info->bus_info, pci_name(efx->pci_dev), sizeof(info->bus_info)); in ef4_ethtool_get_drvinfo()
180 regs->version = efx->type->revision; in ef4_ethtool_get_regs()
187 return efx->msg_enable; in ef4_ethtool_get_msglevel()
193 efx->msg_enable = msg_enable; in ef4_ethtool_set_msglevel()
197 * ef4_fill_test - fill in an individual self-test entry
198 * @test_index: Index of the test
200 * @data: Ethtool test results, or %NULL
201 * @test: Pointer to test result (used only if data != %NULL)
204 * @test_format: Test name format (e.g. "loopback.\%s.tx.sent")
205 * @test_id: Test id (e.g. "PHYXS" for "loopback.PHYXS.tx_sent")
207 * Fill in an individual self-test entry.
210 int *test, const char *unit_format, int unit_id, in ef4_fill_test() argument
217 data[test_index] = *test; in ef4_fill_test()
229 "%-6s %-24s", unit_str, test_str); in ef4_fill_test()
233 #define EF4_CHANNEL_NAME(_channel) "chan%d", _channel->channel
234 #define EF4_TX_QUEUE_NAME(_tx_queue) "txq%d", _tx_queue->queue
235 #define EF4_RX_QUEUE_NAME(_rx_queue) "rxq%d", _rx_queue->queue
237 "loopback.%s." _counter, STRING_TABLE_LOOKUP(_mode, ef4_loopback_mode)
240 * ef4_fill_loopback_test - fill in a block of loopback self-test entries
242 * @lb_tests: Efx loopback self-test results structure
243 * @mode: Loopback test mode
244 * @test_index: Starting index of the test
246 * @data: Ethtool test results, or %NULL
248 * Fill in a block of loopback self-test entries. Return new test
258 ef4_get_channel(efx, efx->tx_channel_offset); in ef4_fill_loopback_test()
263 &lb_tests->tx_sent[tx_queue->queue], in ef4_fill_loopback_test()
267 &lb_tests->tx_done[tx_queue->queue], in ef4_fill_loopback_test()
272 &lb_tests->rx_good, in ef4_fill_loopback_test()
276 &lb_tests->rx_bad, in ef4_fill_loopback_test()
284 * ef4_ethtool_fill_self_tests - get self-test details
286 * @tests: Efx self-test results structure, or %NULL
288 * @data: Ethtool test results, or %NULL
290 * Get self-test number of strings, strings, and/or test results.
291 * Return number of strings (== number of test results).
304 ef4_fill_test(n++, strings, data, &tests->phy_alive, in ef4_ethtool_fill_self_tests()
306 ef4_fill_test(n++, strings, data, &tests->nvram, in ef4_ethtool_fill_self_tests()
308 ef4_fill_test(n++, strings, data, &tests->interrupt, in ef4_ethtool_fill_self_tests()
314 &tests->eventq_dma[channel->channel], in ef4_ethtool_fill_self_tests()
318 &tests->eventq_int[channel->channel], in ef4_ethtool_fill_self_tests()
323 ef4_fill_test(n++, strings, data, &tests->memory, in ef4_ethtool_fill_self_tests()
325 ef4_fill_test(n++, strings, data, &tests->registers, in ef4_ethtool_fill_self_tests()
328 if (efx->phy_op->run_tests != NULL) { in ef4_ethtool_fill_self_tests()
329 EF4_BUG_ON_PARANOID(efx->phy_op->test_name == NULL); in ef4_ethtool_fill_self_tests()
335 name = efx->phy_op->test_name(efx, i); in ef4_ethtool_fill_self_tests()
339 ef4_fill_test(n++, strings, data, &tests->phy_ext[i], in ef4_ethtool_fill_self_tests()
344 /* Loopback tests */ in ef4_ethtool_fill_self_tests()
346 if (!(efx->loopback_modes & (1 << mode))) in ef4_ethtool_fill_self_tests()
349 &tests->loopback[mode], mode, n, in ef4_ethtool_fill_self_tests()
366 "tx-%u.tx_packets", in ef4_describe_per_queue_stats()
367 channel->tx_queue[0].queue / in ef4_describe_per_queue_stats()
379 "rx-%d.rx_packets", channel->channel); in ef4_describe_per_queue_stats()
394 return efx->type->describe_stats(efx, NULL) + in ef4_ethtool_get_sset_count()
400 return -EINVAL; in ef4_ethtool_get_sset_count()
412 strings += (efx->type->describe_stats(efx, strings) * in ef4_ethtool_get_strings()
425 /* No other string sets */ in ef4_ethtool_get_strings()
441 spin_lock_bh(&efx->stats_lock); in ef4_ethtool_get_stats()
444 data += efx->type->update_stats(efx, data, NULL); in ef4_ethtool_get_stats()
449 switch (stat->source) { in ef4_ethtool_get_stats()
451 data[i] = stat->get_stat((void *)efx + stat->offset); in ef4_ethtool_get_stats()
456 data[i] += stat->get_stat((void *)channel + in ef4_ethtool_get_stats()
457 stat->offset); in ef4_ethtool_get_stats()
464 stat->get_stat((void *)tx_queue in ef4_ethtool_get_stats()
465 + stat->offset); in ef4_ethtool_get_stats()
472 spin_unlock_bh(&efx->stats_lock); in ef4_ethtool_get_stats()
478 *data += tx_queue->tx_packets; in ef4_ethtool_get_stats()
487 *data += rx_queue->rx_packets; in ef4_ethtool_get_stats()
495 struct ethtool_test *test, u64 *data) in ef4_ethtool_self_test() argument
500 int rc = -ENOMEM; in ef4_ethtool_self_test()
506 if (efx->state != STATE_READY) { in ef4_ethtool_self_test()
507 rc = -EBUSY; in ef4_ethtool_self_test()
511 netif_info(efx, drv, efx->net_dev, "starting %sline testing\n", in ef4_ethtool_self_test()
512 (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); in ef4_ethtool_self_test()
515 already_up = (efx->net_dev->flags & IFF_UP); in ef4_ethtool_self_test()
517 rc = dev_open(efx->net_dev, NULL); in ef4_ethtool_self_test()
519 netif_err(efx, drv, efx->net_dev, in ef4_ethtool_self_test()
525 rc = ef4_selftest(efx, ef4_tests, test->flags); in ef4_ethtool_self_test()
528 dev_close(efx->net_dev); in ef4_ethtool_self_test()
530 netif_info(efx, drv, efx->net_dev, "%s %sline self-tests\n", in ef4_ethtool_self_test()
532 (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); in ef4_ethtool_self_test()
539 test->flags |= ETH_TEST_FL_FAILED; in ef4_ethtool_self_test()
547 return mdio45_nway_restart(&efx->mdio); in ef4_ethtool_nway_reset()
590 coalesce->tx_coalesce_usecs = tx_usecs; in ef4_ethtool_get_coalesce()
591 coalesce->tx_coalesce_usecs_irq = tx_usecs; in ef4_ethtool_get_coalesce()
592 coalesce->rx_coalesce_usecs = rx_usecs; in ef4_ethtool_get_coalesce()
593 coalesce->rx_coalesce_usecs_irq = rx_usecs; in ef4_ethtool_get_coalesce()
594 coalesce->use_adaptive_rx_coalesce = rx_adaptive; in ef4_ethtool_get_coalesce()
612 if (coalesce->rx_coalesce_usecs != rx_usecs) in ef4_ethtool_set_coalesce()
613 rx_usecs = coalesce->rx_coalesce_usecs; in ef4_ethtool_set_coalesce()
615 rx_usecs = coalesce->rx_coalesce_usecs_irq; in ef4_ethtool_set_coalesce()
617 adaptive = coalesce->use_adaptive_rx_coalesce; in ef4_ethtool_set_coalesce()
622 rx_may_override_tx = (coalesce->tx_coalesce_usecs == tx_usecs && in ef4_ethtool_set_coalesce()
623 coalesce->tx_coalesce_usecs_irq == tx_usecs); in ef4_ethtool_set_coalesce()
624 if (coalesce->tx_coalesce_usecs != tx_usecs) in ef4_ethtool_set_coalesce()
625 tx_usecs = coalesce->tx_coalesce_usecs; in ef4_ethtool_set_coalesce()
627 tx_usecs = coalesce->tx_coalesce_usecs_irq; in ef4_ethtool_set_coalesce()
635 efx->type->push_irq_moderation(channel); in ef4_ethtool_set_coalesce()
648 ring->rx_max_pending = EF4_MAX_DMAQ_SIZE; in ef4_ethtool_get_ringparam()
649 ring->tx_max_pending = EF4_MAX_DMAQ_SIZE; in ef4_ethtool_get_ringparam()
650 ring->rx_pending = efx->rxq_entries; in ef4_ethtool_get_ringparam()
651 ring->tx_pending = efx->txq_entries; in ef4_ethtool_get_ringparam()
663 if (ring->rx_mini_pending || ring->rx_jumbo_pending || in ef4_ethtool_set_ringparam()
664 ring->rx_pending > EF4_MAX_DMAQ_SIZE || in ef4_ethtool_set_ringparam()
665 ring->tx_pending > EF4_MAX_DMAQ_SIZE) in ef4_ethtool_set_ringparam()
666 return -EINVAL; in ef4_ethtool_set_ringparam()
668 if (ring->rx_pending < EF4_RXQ_MIN_ENT) { in ef4_ethtool_set_ringparam()
669 netif_err(efx, drv, efx->net_dev, in ef4_ethtool_set_ringparam()
672 return -EINVAL; in ef4_ethtool_set_ringparam()
675 txq_entries = max(ring->tx_pending, EF4_TXQ_MIN_ENT(efx)); in ef4_ethtool_set_ringparam()
676 if (txq_entries != ring->tx_pending) in ef4_ethtool_set_ringparam()
677 netif_warn(efx, drv, efx->net_dev, in ef4_ethtool_set_ringparam()
681 return ef4_realloc_channels(efx, ring->rx_pending, txq_entries); in ef4_ethtool_set_ringparam()
692 mutex_lock(&efx->mac_lock); in ef4_ethtool_set_pauseparam()
694 wanted_fc = ((pause->rx_pause ? EF4_FC_RX : 0) | in ef4_ethtool_set_pauseparam()
695 (pause->tx_pause ? EF4_FC_TX : 0) | in ef4_ethtool_set_pauseparam()
696 (pause->autoneg ? EF4_FC_AUTO : 0)); in ef4_ethtool_set_pauseparam()
699 netif_dbg(efx, drv, efx->net_dev, in ef4_ethtool_set_pauseparam()
701 rc = -EINVAL; in ef4_ethtool_set_pauseparam()
705 if ((wanted_fc & EF4_FC_AUTO) && !efx->link_advertising) { in ef4_ethtool_set_pauseparam()
706 netif_dbg(efx, drv, efx->net_dev, in ef4_ethtool_set_pauseparam()
708 rc = -EINVAL; in ef4_ethtool_set_pauseparam()
713 if (efx->type->prepare_enable_fc_tx && in ef4_ethtool_set_pauseparam()
714 (wanted_fc & EF4_FC_TX) && !(efx->wanted_fc & EF4_FC_TX)) in ef4_ethtool_set_pauseparam()
715 efx->type->prepare_enable_fc_tx(efx); in ef4_ethtool_set_pauseparam()
717 old_adv = efx->link_advertising; in ef4_ethtool_set_pauseparam()
718 old_fc = efx->wanted_fc; in ef4_ethtool_set_pauseparam()
720 if (efx->link_advertising != old_adv || in ef4_ethtool_set_pauseparam()
721 (efx->wanted_fc ^ old_fc) & EF4_FC_AUTO) { in ef4_ethtool_set_pauseparam()
722 rc = efx->phy_op->reconfigure(efx); in ef4_ethtool_set_pauseparam()
724 netif_err(efx, drv, efx->net_dev, in ef4_ethtool_set_pauseparam()
732 * if the user just changed the advertised capabilities, but there's no in ef4_ethtool_set_pauseparam()
737 mutex_unlock(&efx->mac_lock); in ef4_ethtool_set_pauseparam()
747 pause->rx_pause = !!(efx->wanted_fc & EF4_FC_RX); in ef4_ethtool_get_pauseparam()
748 pause->tx_pause = !!(efx->wanted_fc & EF4_FC_TX); in ef4_ethtool_get_pauseparam()
749 pause->autoneg = !!(efx->wanted_fc & EF4_FC_AUTO); in ef4_ethtool_get_pauseparam()
756 return efx->type->get_wol(efx, wol); in ef4_ethtool_get_wol()
764 return efx->type->set_wol(efx, wol->wolopts); in ef4_ethtool_set_wol()
772 rc = efx->type->map_reset_flags(flags); in ef4_ethtool_reset()
795 struct ethtool_tcpip4_spec *ip_entry = &rule->h_u.tcp_ip4_spec; in ef4_ethtool_get_class_rule()
796 struct ethtool_tcpip4_spec *ip_mask = &rule->m_u.tcp_ip4_spec; in ef4_ethtool_get_class_rule()
797 struct ethtool_usrip4_spec *uip_entry = &rule->h_u.usr_ip4_spec; in ef4_ethtool_get_class_rule()
798 struct ethtool_usrip4_spec *uip_mask = &rule->m_u.usr_ip4_spec; in ef4_ethtool_get_class_rule()
799 struct ethtool_tcpip6_spec *ip6_entry = &rule->h_u.tcp_ip6_spec; in ef4_ethtool_get_class_rule()
800 struct ethtool_tcpip6_spec *ip6_mask = &rule->m_u.tcp_ip6_spec; in ef4_ethtool_get_class_rule()
801 struct ethtool_usrip6_spec *uip6_entry = &rule->h_u.usr_ip6_spec; in ef4_ethtool_get_class_rule()
802 struct ethtool_usrip6_spec *uip6_mask = &rule->m_u.usr_ip6_spec; in ef4_ethtool_get_class_rule()
803 struct ethhdr *mac_entry = &rule->h_u.ether_spec; in ef4_ethtool_get_class_rule()
804 struct ethhdr *mac_mask = &rule->m_u.ether_spec; in ef4_ethtool_get_class_rule()
809 rule->location, &spec); in ef4_ethtool_get_class_rule()
814 rule->ring_cookie = RX_CLS_FLOW_DISC; in ef4_ethtool_get_class_rule()
816 rule->ring_cookie = spec.dmaq_id; in ef4_ethtool_get_class_rule()
827 rule->flow_type = ((spec.ip_proto == IPPROTO_TCP) ? in ef4_ethtool_get_class_rule()
830 ip_entry->ip4dst = spec.loc_host[0]; in ef4_ethtool_get_class_rule()
831 ip_mask->ip4dst = IP4_ADDR_FULL_MASK; in ef4_ethtool_get_class_rule()
834 ip_entry->ip4src = spec.rem_host[0]; in ef4_ethtool_get_class_rule()
835 ip_mask->ip4src = IP4_ADDR_FULL_MASK; in ef4_ethtool_get_class_rule()
838 ip_entry->pdst = spec.loc_port; in ef4_ethtool_get_class_rule()
839 ip_mask->pdst = PORT_FULL_MASK; in ef4_ethtool_get_class_rule()
842 ip_entry->psrc = spec.rem_port; in ef4_ethtool_get_class_rule()
843 ip_mask->psrc = PORT_FULL_MASK; in ef4_ethtool_get_class_rule()
854 rule->flow_type = ((spec.ip_proto == IPPROTO_TCP) ? in ef4_ethtool_get_class_rule()
857 memcpy(ip6_entry->ip6dst, spec.loc_host, in ef4_ethtool_get_class_rule()
858 sizeof(ip6_entry->ip6dst)); in ef4_ethtool_get_class_rule()
859 ip6_fill_mask(ip6_mask->ip6dst); in ef4_ethtool_get_class_rule()
862 memcpy(ip6_entry->ip6src, spec.rem_host, in ef4_ethtool_get_class_rule()
863 sizeof(ip6_entry->ip6src)); in ef4_ethtool_get_class_rule()
864 ip6_fill_mask(ip6_mask->ip6src); in ef4_ethtool_get_class_rule()
867 ip6_entry->pdst = spec.loc_port; in ef4_ethtool_get_class_rule()
868 ip6_mask->pdst = PORT_FULL_MASK; in ef4_ethtool_get_class_rule()
871 ip6_entry->psrc = spec.rem_port; in ef4_ethtool_get_class_rule()
872 ip6_mask->psrc = PORT_FULL_MASK; in ef4_ethtool_get_class_rule()
878 rule->flow_type = ETHER_FLOW; in ef4_ethtool_get_class_rule()
881 ether_addr_copy(mac_entry->h_dest, spec.loc_mac); in ef4_ethtool_get_class_rule()
883 eth_broadcast_addr(mac_mask->h_dest); in ef4_ethtool_get_class_rule()
885 ether_addr_copy(mac_mask->h_dest, in ef4_ethtool_get_class_rule()
889 ether_addr_copy(mac_entry->h_source, spec.rem_mac); in ef4_ethtool_get_class_rule()
890 eth_broadcast_addr(mac_mask->h_source); in ef4_ethtool_get_class_rule()
893 mac_entry->h_proto = spec.ether_type; in ef4_ethtool_get_class_rule()
894 mac_mask->h_proto = ETHER_TYPE_FULL_MASK; in ef4_ethtool_get_class_rule()
902 rule->flow_type = IPV4_USER_FLOW; in ef4_ethtool_get_class_rule()
903 uip_entry->ip_ver = ETH_RX_NFC_IP4; in ef4_ethtool_get_class_rule()
905 uip_mask->proto = IP_PROTO_FULL_MASK; in ef4_ethtool_get_class_rule()
906 uip_entry->proto = spec.ip_proto; in ef4_ethtool_get_class_rule()
909 uip_entry->ip4dst = spec.loc_host[0]; in ef4_ethtool_get_class_rule()
910 uip_mask->ip4dst = IP4_ADDR_FULL_MASK; in ef4_ethtool_get_class_rule()
913 uip_entry->ip4src = spec.rem_host[0]; in ef4_ethtool_get_class_rule()
914 uip_mask->ip4src = IP4_ADDR_FULL_MASK; in ef4_ethtool_get_class_rule()
922 rule->flow_type = IPV6_USER_FLOW; in ef4_ethtool_get_class_rule()
924 uip6_mask->l4_proto = IP_PROTO_FULL_MASK; in ef4_ethtool_get_class_rule()
925 uip6_entry->l4_proto = spec.ip_proto; in ef4_ethtool_get_class_rule()
928 memcpy(uip6_entry->ip6dst, spec.loc_host, in ef4_ethtool_get_class_rule()
929 sizeof(uip6_entry->ip6dst)); in ef4_ethtool_get_class_rule()
930 ip6_fill_mask(uip6_mask->ip6dst); in ef4_ethtool_get_class_rule()
933 memcpy(uip6_entry->ip6src, spec.rem_host, in ef4_ethtool_get_class_rule()
934 sizeof(uip6_entry->ip6src)); in ef4_ethtool_get_class_rule()
935 ip6_fill_mask(uip6_mask->ip6src); in ef4_ethtool_get_class_rule()
940 return -EINVAL; in ef4_ethtool_get_class_rule()
944 rule->flow_type |= FLOW_EXT; in ef4_ethtool_get_class_rule()
945 rule->h_ext.vlan_tci = spec.outer_vid; in ef4_ethtool_get_class_rule()
946 rule->m_ext.vlan_tci = htons(0xfff); in ef4_ethtool_get_class_rule()
958 switch (info->cmd) { in ef4_ethtool_get_rxnfc()
960 info->data = efx->n_rx_channels; in ef4_ethtool_get_rxnfc()
966 info->data = 0; in ef4_ethtool_get_rxnfc()
967 switch (info->flow_type) { in ef4_ethtool_get_rxnfc()
969 info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ef4_ethtool_get_rxnfc()
975 info->data |= RXH_IP_SRC | RXH_IP_DST; in ef4_ethtool_get_rxnfc()
982 info->data = 0; in ef4_ethtool_get_rxnfc()
987 info->data = ef4_filter_get_rx_id_limit(efx); in ef4_ethtool_get_rxnfc()
988 if (info->data == 0) in ef4_ethtool_get_rxnfc()
989 return -EOPNOTSUPP; in ef4_ethtool_get_rxnfc()
990 info->data |= RX_CLS_LOC_SPECIAL; in ef4_ethtool_get_rxnfc()
991 info->rule_cnt = in ef4_ethtool_get_rxnfc()
997 return -EOPNOTSUPP; in ef4_ethtool_get_rxnfc()
998 return ef4_ethtool_get_class_rule(efx, &info->fs); in ef4_ethtool_get_rxnfc()
1002 info->data = ef4_filter_get_rx_id_limit(efx); in ef4_ethtool_get_rxnfc()
1003 if (info->data == 0) in ef4_ethtool_get_rxnfc()
1004 return -EOPNOTSUPP; in ef4_ethtool_get_rxnfc()
1006 rule_locs, info->rule_cnt); in ef4_ethtool_get_rxnfc()
1009 info->rule_cnt = rc; in ef4_ethtool_get_rxnfc()
1014 return -EOPNOTSUPP; in ef4_ethtool_get_rxnfc()
1031 struct ethtool_tcpip4_spec *ip_entry = &rule->h_u.tcp_ip4_spec; in ef4_ethtool_set_class_rule()
1032 struct ethtool_tcpip4_spec *ip_mask = &rule->m_u.tcp_ip4_spec; in ef4_ethtool_set_class_rule()
1033 struct ethtool_usrip4_spec *uip_entry = &rule->h_u.usr_ip4_spec; in ef4_ethtool_set_class_rule()
1034 struct ethtool_usrip4_spec *uip_mask = &rule->m_u.usr_ip4_spec; in ef4_ethtool_set_class_rule()
1035 struct ethtool_tcpip6_spec *ip6_entry = &rule->h_u.tcp_ip6_spec; in ef4_ethtool_set_class_rule()
1036 struct ethtool_tcpip6_spec *ip6_mask = &rule->m_u.tcp_ip6_spec; in ef4_ethtool_set_class_rule()
1037 struct ethtool_usrip6_spec *uip6_entry = &rule->h_u.usr_ip6_spec; in ef4_ethtool_set_class_rule()
1038 struct ethtool_usrip6_spec *uip6_mask = &rule->m_u.usr_ip6_spec; in ef4_ethtool_set_class_rule()
1039 struct ethhdr *mac_entry = &rule->h_u.ether_spec; in ef4_ethtool_set_class_rule()
1040 struct ethhdr *mac_mask = &rule->m_u.ether_spec; in ef4_ethtool_set_class_rule()
1045 if (rule->location != RX_CLS_LOC_ANY) in ef4_ethtool_set_class_rule()
1046 return -EINVAL; in ef4_ethtool_set_class_rule()
1048 /* Range-check ring_cookie */ in ef4_ethtool_set_class_rule()
1049 if (rule->ring_cookie >= efx->n_rx_channels && in ef4_ethtool_set_class_rule()
1050 rule->ring_cookie != RX_CLS_FLOW_DISC) in ef4_ethtool_set_class_rule()
1051 return -EINVAL; in ef4_ethtool_set_class_rule()
1054 if ((rule->flow_type & FLOW_EXT) && in ef4_ethtool_set_class_rule()
1055 (rule->m_ext.vlan_etype || rule->m_ext.data[0] || in ef4_ethtool_set_class_rule()
1056 rule->m_ext.data[1])) in ef4_ethtool_set_class_rule()
1057 return -EINVAL; in ef4_ethtool_set_class_rule()
1060 efx->rx_scatter ? EF4_FILTER_FLAG_RX_SCATTER : 0, in ef4_ethtool_set_class_rule()
1061 (rule->ring_cookie == RX_CLS_FLOW_DISC) ? in ef4_ethtool_set_class_rule()
1062 EF4_FILTER_RX_DMAQ_ID_DROP : rule->ring_cookie); in ef4_ethtool_set_class_rule()
1064 switch (rule->flow_type & ~FLOW_EXT) { in ef4_ethtool_set_class_rule()
1070 spec.ip_proto = ((rule->flow_type & ~FLOW_EXT) == TCP_V4_FLOW ? in ef4_ethtool_set_class_rule()
1072 if (ip_mask->ip4dst) { in ef4_ethtool_set_class_rule()
1073 if (ip_mask->ip4dst != IP4_ADDR_FULL_MASK) in ef4_ethtool_set_class_rule()
1074 return -EINVAL; in ef4_ethtool_set_class_rule()
1076 spec.loc_host[0] = ip_entry->ip4dst; in ef4_ethtool_set_class_rule()
1078 if (ip_mask->ip4src) { in ef4_ethtool_set_class_rule()
1079 if (ip_mask->ip4src != IP4_ADDR_FULL_MASK) in ef4_ethtool_set_class_rule()
1080 return -EINVAL; in ef4_ethtool_set_class_rule()
1082 spec.rem_host[0] = ip_entry->ip4src; in ef4_ethtool_set_class_rule()
1084 if (ip_mask->pdst) { in ef4_ethtool_set_class_rule()
1085 if (ip_mask->pdst != PORT_FULL_MASK) in ef4_ethtool_set_class_rule()
1086 return -EINVAL; in ef4_ethtool_set_class_rule()
1088 spec.loc_port = ip_entry->pdst; in ef4_ethtool_set_class_rule()
1090 if (ip_mask->psrc) { in ef4_ethtool_set_class_rule()
1091 if (ip_mask->psrc != PORT_FULL_MASK) in ef4_ethtool_set_class_rule()
1092 return -EINVAL; in ef4_ethtool_set_class_rule()
1094 spec.rem_port = ip_entry->psrc; in ef4_ethtool_set_class_rule()
1096 if (ip_mask->tos) in ef4_ethtool_set_class_rule()
1097 return -EINVAL; in ef4_ethtool_set_class_rule()
1105 spec.ip_proto = ((rule->flow_type & ~FLOW_EXT) == TCP_V6_FLOW ? in ef4_ethtool_set_class_rule()
1107 if (!ip6_mask_is_empty(ip6_mask->ip6dst)) { in ef4_ethtool_set_class_rule()
1108 if (!ip6_mask_is_full(ip6_mask->ip6dst)) in ef4_ethtool_set_class_rule()
1109 return -EINVAL; in ef4_ethtool_set_class_rule()
1111 memcpy(spec.loc_host, ip6_entry->ip6dst, sizeof(spec.loc_host)); in ef4_ethtool_set_class_rule()
1113 if (!ip6_mask_is_empty(ip6_mask->ip6src)) { in ef4_ethtool_set_class_rule()
1114 if (!ip6_mask_is_full(ip6_mask->ip6src)) in ef4_ethtool_set_class_rule()
1115 return -EINVAL; in ef4_ethtool_set_class_rule()
1117 memcpy(spec.rem_host, ip6_entry->ip6src, sizeof(spec.rem_host)); in ef4_ethtool_set_class_rule()
1119 if (ip6_mask->pdst) { in ef4_ethtool_set_class_rule()
1120 if (ip6_mask->pdst != PORT_FULL_MASK) in ef4_ethtool_set_class_rule()
1121 return -EINVAL; in ef4_ethtool_set_class_rule()
1123 spec.loc_port = ip6_entry->pdst; in ef4_ethtool_set_class_rule()
1125 if (ip6_mask->psrc) { in ef4_ethtool_set_class_rule()
1126 if (ip6_mask->psrc != PORT_FULL_MASK) in ef4_ethtool_set_class_rule()
1127 return -EINVAL; in ef4_ethtool_set_class_rule()
1129 spec.rem_port = ip6_entry->psrc; in ef4_ethtool_set_class_rule()
1131 if (ip6_mask->tclass) in ef4_ethtool_set_class_rule()
1132 return -EINVAL; in ef4_ethtool_set_class_rule()
1136 if (uip_mask->l4_4_bytes || uip_mask->tos || uip_mask->ip_ver || in ef4_ethtool_set_class_rule()
1137 uip_entry->ip_ver != ETH_RX_NFC_IP4) in ef4_ethtool_set_class_rule()
1138 return -EINVAL; in ef4_ethtool_set_class_rule()
1141 if (uip_mask->ip4dst) { in ef4_ethtool_set_class_rule()
1142 if (uip_mask->ip4dst != IP4_ADDR_FULL_MASK) in ef4_ethtool_set_class_rule()
1143 return -EINVAL; in ef4_ethtool_set_class_rule()
1145 spec.loc_host[0] = uip_entry->ip4dst; in ef4_ethtool_set_class_rule()
1147 if (uip_mask->ip4src) { in ef4_ethtool_set_class_rule()
1148 if (uip_mask->ip4src != IP4_ADDR_FULL_MASK) in ef4_ethtool_set_class_rule()
1149 return -EINVAL; in ef4_ethtool_set_class_rule()
1151 spec.rem_host[0] = uip_entry->ip4src; in ef4_ethtool_set_class_rule()
1153 if (uip_mask->proto) { in ef4_ethtool_set_class_rule()
1154 if (uip_mask->proto != IP_PROTO_FULL_MASK) in ef4_ethtool_set_class_rule()
1155 return -EINVAL; in ef4_ethtool_set_class_rule()
1157 spec.ip_proto = uip_entry->proto; in ef4_ethtool_set_class_rule()
1162 if (uip6_mask->l4_4_bytes || uip6_mask->tclass) in ef4_ethtool_set_class_rule()
1163 return -EINVAL; in ef4_ethtool_set_class_rule()
1166 if (!ip6_mask_is_empty(uip6_mask->ip6dst)) { in ef4_ethtool_set_class_rule()
1167 if (!ip6_mask_is_full(uip6_mask->ip6dst)) in ef4_ethtool_set_class_rule()
1168 return -EINVAL; in ef4_ethtool_set_class_rule()
1170 memcpy(spec.loc_host, uip6_entry->ip6dst, sizeof(spec.loc_host)); in ef4_ethtool_set_class_rule()
1172 if (!ip6_mask_is_empty(uip6_mask->ip6src)) { in ef4_ethtool_set_class_rule()
1173 if (!ip6_mask_is_full(uip6_mask->ip6src)) in ef4_ethtool_set_class_rule()
1174 return -EINVAL; in ef4_ethtool_set_class_rule()
1176 memcpy(spec.rem_host, uip6_entry->ip6src, sizeof(spec.rem_host)); in ef4_ethtool_set_class_rule()
1178 if (uip6_mask->l4_proto) { in ef4_ethtool_set_class_rule()
1179 if (uip6_mask->l4_proto != IP_PROTO_FULL_MASK) in ef4_ethtool_set_class_rule()
1180 return -EINVAL; in ef4_ethtool_set_class_rule()
1182 spec.ip_proto = uip6_entry->l4_proto; in ef4_ethtool_set_class_rule()
1187 if (!is_zero_ether_addr(mac_mask->h_dest)) { in ef4_ethtool_set_class_rule()
1188 if (ether_addr_equal(mac_mask->h_dest, in ef4_ethtool_set_class_rule()
1191 else if (is_broadcast_ether_addr(mac_mask->h_dest)) in ef4_ethtool_set_class_rule()
1194 return -EINVAL; in ef4_ethtool_set_class_rule()
1195 ether_addr_copy(spec.loc_mac, mac_entry->h_dest); in ef4_ethtool_set_class_rule()
1197 if (!is_zero_ether_addr(mac_mask->h_source)) { in ef4_ethtool_set_class_rule()
1198 if (!is_broadcast_ether_addr(mac_mask->h_source)) in ef4_ethtool_set_class_rule()
1199 return -EINVAL; in ef4_ethtool_set_class_rule()
1201 ether_addr_copy(spec.rem_mac, mac_entry->h_source); in ef4_ethtool_set_class_rule()
1203 if (mac_mask->h_proto) { in ef4_ethtool_set_class_rule()
1204 if (mac_mask->h_proto != ETHER_TYPE_FULL_MASK) in ef4_ethtool_set_class_rule()
1205 return -EINVAL; in ef4_ethtool_set_class_rule()
1207 spec.ether_type = mac_entry->h_proto; in ef4_ethtool_set_class_rule()
1212 return -EINVAL; in ef4_ethtool_set_class_rule()
1215 if ((rule->flow_type & FLOW_EXT) && rule->m_ext.vlan_tci) { in ef4_ethtool_set_class_rule()
1216 if (rule->m_ext.vlan_tci != htons(0xfff)) in ef4_ethtool_set_class_rule()
1217 return -EINVAL; in ef4_ethtool_set_class_rule()
1219 spec.outer_vid = rule->h_ext.vlan_tci; in ef4_ethtool_set_class_rule()
1226 rule->location = rc; in ef4_ethtool_set_class_rule()
1236 return -EOPNOTSUPP; in ef4_ethtool_set_rxnfc()
1238 switch (info->cmd) { in ef4_ethtool_set_rxnfc()
1240 return ef4_ethtool_set_class_rule(efx, &info->fs); in ef4_ethtool_set_rxnfc()
1244 info->fs.location); in ef4_ethtool_set_rxnfc()
1247 return -EOPNOTSUPP; in ef4_ethtool_set_rxnfc()
1256 efx->n_rx_channels == 1) ? in ef4_ethtool_get_rxfh_indir_size()
1257 0 : ARRAY_SIZE(efx->rx_indir_table)); in ef4_ethtool_get_rxfh_indir_size()
1265 rxfh->hfunc = ETH_RSS_HASH_TOP; in ef4_ethtool_get_rxfh()
1266 if (rxfh->indir) in ef4_ethtool_get_rxfh()
1267 memcpy(rxfh->indir, efx->rx_indir_table, in ef4_ethtool_get_rxfh()
1268 sizeof(efx->rx_indir_table)); in ef4_ethtool_get_rxfh()
1279 if (rxfh->key || in ef4_ethtool_set_rxfh()
1280 (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in ef4_ethtool_set_rxfh()
1281 rxfh->hfunc != ETH_RSS_HASH_TOP)) in ef4_ethtool_set_rxfh()
1282 return -EOPNOTSUPP; in ef4_ethtool_set_rxfh()
1283 if (!rxfh->indir) in ef4_ethtool_set_rxfh()
1286 return efx->type->rx_push_rss_config(efx, true, rxfh->indir); in ef4_ethtool_set_rxfh()
1296 if (!efx->phy_op || !efx->phy_op->get_module_eeprom) in ef4_ethtool_get_module_eeprom()
1297 return -EOPNOTSUPP; in ef4_ethtool_get_module_eeprom()
1299 mutex_lock(&efx->mac_lock); in ef4_ethtool_get_module_eeprom()
1300 ret = efx->phy_op->get_module_eeprom(efx, ee, data); in ef4_ethtool_get_module_eeprom()
1301 mutex_unlock(&efx->mac_lock); in ef4_ethtool_get_module_eeprom()
1312 if (!efx->phy_op || !efx->phy_op->get_module_info) in ef4_ethtool_get_module_info()
1313 return -EOPNOTSUPP; in ef4_ethtool_get_module_info()
1315 mutex_lock(&efx->mac_lock); in ef4_ethtool_get_module_info()
1316 ret = efx->phy_op->get_module_info(efx, modinfo); in ef4_ethtool_get_module_info()
1317 mutex_unlock(&efx->mac_lock); in ef4_ethtool_get_module_info()