Lines Matching +full:no +full:- +full:loopback +full:- +full:test

1 // SPDX-License-Identifier: GPL-2.0-only
31 /* Initialiser for a struct efx_sw_stat_desc with type-checking */
37 &((struct efx_##source_name *)0)->field) ? \
108 strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); in efx_ethtool_get_drvinfo()
109 efx_mcdi_print_fwver(efx, info->fw_version, in efx_ethtool_get_drvinfo()
110 sizeof(info->fw_version)); in efx_ethtool_get_drvinfo()
111 strlcpy(info->bus_info, pci_name(efx->pci_dev), sizeof(info->bus_info)); in efx_ethtool_get_drvinfo()
118 return efx->msg_enable; in efx_ethtool_get_msglevel()
125 efx->msg_enable = msg_enable; in efx_ethtool_set_msglevel()
129 struct ethtool_test *test, u64 *data) in efx_ethtool_self_test() argument
134 int rc = -ENOMEM; in efx_ethtool_self_test()
140 if (efx->state != STATE_READY) { in efx_ethtool_self_test()
141 rc = -EBUSY; in efx_ethtool_self_test()
145 netif_info(efx, drv, efx->net_dev, "starting %sline testing\n", in efx_ethtool_self_test()
146 (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); in efx_ethtool_self_test()
149 already_up = (efx->net_dev->flags & IFF_UP); in efx_ethtool_self_test()
151 rc = dev_open(efx->net_dev, NULL); in efx_ethtool_self_test()
153 netif_err(efx, drv, efx->net_dev, in efx_ethtool_self_test()
159 rc = efx_selftest(efx, efx_tests, test->flags); in efx_ethtool_self_test()
162 dev_close(efx->net_dev); in efx_ethtool_self_test()
164 netif_info(efx, drv, efx->net_dev, "%s %sline self-tests\n", in efx_ethtool_self_test()
166 (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); in efx_ethtool_self_test()
173 test->flags |= ETH_TEST_FL_FAILED; in efx_ethtool_self_test()
181 pause->rx_pause = !!(efx->wanted_fc & EFX_FC_RX); in efx_ethtool_get_pauseparam()
182 pause->tx_pause = !!(efx->wanted_fc & EFX_FC_TX); in efx_ethtool_get_pauseparam()
183 pause->autoneg = !!(efx->wanted_fc & EFX_FC_AUTO); in efx_ethtool_get_pauseparam()
194 mutex_lock(&efx->mac_lock); in efx_ethtool_set_pauseparam()
196 wanted_fc = ((pause->rx_pause ? EFX_FC_RX : 0) | in efx_ethtool_set_pauseparam()
197 (pause->tx_pause ? EFX_FC_TX : 0) | in efx_ethtool_set_pauseparam()
198 (pause->autoneg ? EFX_FC_AUTO : 0)); in efx_ethtool_set_pauseparam()
201 netif_dbg(efx, drv, efx->net_dev, in efx_ethtool_set_pauseparam()
203 rc = -EINVAL; in efx_ethtool_set_pauseparam()
207 if ((wanted_fc & EFX_FC_AUTO) && !efx->link_advertising[0]) { in efx_ethtool_set_pauseparam()
208 netif_dbg(efx, drv, efx->net_dev, in efx_ethtool_set_pauseparam()
210 rc = -EINVAL; in efx_ethtool_set_pauseparam()
215 if (efx->type->prepare_enable_fc_tx && in efx_ethtool_set_pauseparam()
216 (wanted_fc & EFX_FC_TX) && !(efx->wanted_fc & EFX_FC_TX)) in efx_ethtool_set_pauseparam()
217 efx->type->prepare_enable_fc_tx(efx); in efx_ethtool_set_pauseparam()
219 old_adv = efx->link_advertising[0]; in efx_ethtool_set_pauseparam()
220 old_fc = efx->wanted_fc; in efx_ethtool_set_pauseparam()
222 if (efx->link_advertising[0] != old_adv || in efx_ethtool_set_pauseparam()
223 (efx->wanted_fc ^ old_fc) & EFX_FC_AUTO) { in efx_ethtool_set_pauseparam()
226 netif_err(efx, drv, efx->net_dev, in efx_ethtool_set_pauseparam()
234 * if the user just changed the advertised capabilities, but there's no in efx_ethtool_set_pauseparam()
239 mutex_unlock(&efx->mac_lock); in efx_ethtool_set_pauseparam()
245 * efx_fill_test - fill in an individual self-test entry
246 * @test_index: Index of the test
248 * @data: Ethtool test results, or %NULL
249 * @test: Pointer to test result (used only if data != %NULL)
252 * @test_format: Test name format (e.g. "loopback.\%s.tx.sent")
253 * @test_id: Test id (e.g. "PHYXS" for "loopback.PHYXS.tx_sent")
255 * Fill in an individual self-test entry.
258 int *test, const char *unit_format, int unit_id, in efx_fill_test() argument
265 data[test_index] = *test; in efx_fill_test()
277 "%-6s %-24s", unit_str, test_str); in efx_fill_test()
281 #define EFX_CHANNEL_NAME(_channel) "chan%d", _channel->channel
282 #define EFX_TX_QUEUE_NAME(_tx_queue) "txq%d", _tx_queue->label
284 "loopback.%s." _counter, STRING_TABLE_LOOKUP(_mode, efx_loopback_mode)
287 * efx_fill_loopback_test - fill in a block of loopback self-test entries
289 * @lb_tests: Efx loopback self-test results structure
290 * @mode: Loopback test mode
291 * @test_index: Starting index of the test
293 * @data: Ethtool test results, or %NULL
295 * Fill in a block of loopback self-test entries. Return new test
305 efx_get_channel(efx, efx->tx_channel_offset); in efx_fill_loopback_test()
310 &lb_tests->tx_sent[tx_queue->label], in efx_fill_loopback_test()
314 &lb_tests->tx_done[tx_queue->label], in efx_fill_loopback_test()
319 &lb_tests->rx_good, in efx_fill_loopback_test()
323 &lb_tests->rx_bad, in efx_fill_loopback_test()
331 * efx_ethtool_fill_self_tests - get self-test details
333 * @tests: Efx self-test results structure, or %NULL
335 * @data: Ethtool test results, or %NULL
337 * Get self-test number of strings, strings, and/or test results.
338 * Return number of strings (== number of test results).
351 efx_fill_test(n++, strings, data, &tests->phy_alive, in efx_ethtool_fill_self_tests()
353 efx_fill_test(n++, strings, data, &tests->nvram, in efx_ethtool_fill_self_tests()
355 efx_fill_test(n++, strings, data, &tests->interrupt, in efx_ethtool_fill_self_tests()
361 &tests->eventq_dma[channel->channel], in efx_ethtool_fill_self_tests()
365 &tests->eventq_int[channel->channel], in efx_ethtool_fill_self_tests()
370 efx_fill_test(n++, strings, data, &tests->memory, in efx_ethtool_fill_self_tests()
372 efx_fill_test(n++, strings, data, &tests->registers, in efx_ethtool_fill_self_tests()
383 efx_fill_test(n++, strings, data, &tests->phy_ext[i], "phy", 0, name, NULL); in efx_ethtool_fill_self_tests()
386 /* Loopback tests */ in efx_ethtool_fill_self_tests()
388 if (!(efx->loopback_modes & (1 << mode))) in efx_ethtool_fill_self_tests()
391 &tests->loopback[mode], mode, n, in efx_ethtool_fill_self_tests()
408 "tx-%u.tx_packets", in efx_describe_per_queue_stats()
409 channel->tx_queue[0].queue / in efx_describe_per_queue_stats()
421 "rx-%d.rx_packets", channel->channel); in efx_describe_per_queue_stats()
426 if (efx->xdp_tx_queue_count && efx->xdp_tx_queues) { in efx_describe_per_queue_stats()
429 for (xdp = 0; xdp < efx->xdp_tx_queue_count; xdp++) { in efx_describe_per_queue_stats()
433 "tx-xdp-cpu-%hu.tx_packets", xdp); in efx_describe_per_queue_stats()
448 return efx->type->describe_stats(efx, NULL) + in efx_ethtool_get_sset_count()
455 return -EINVAL; in efx_ethtool_get_sset_count()
467 strings += (efx->type->describe_stats(efx, strings) * in efx_ethtool_get_strings()
481 /* No other string sets */ in efx_ethtool_get_strings()
497 spin_lock_bh(&efx->stats_lock); in efx_ethtool_get_stats()
500 data += efx->type->update_stats(efx, data, NULL); in efx_ethtool_get_stats()
505 switch (stat->source) { in efx_ethtool_get_stats()
507 data[i] = stat->get_stat((void *)efx + stat->offset); in efx_ethtool_get_stats()
512 data[i] += stat->get_stat((void *)channel + in efx_ethtool_get_stats()
513 stat->offset); in efx_ethtool_get_stats()
520 stat->get_stat((void *)tx_queue in efx_ethtool_get_stats()
521 + stat->offset); in efx_ethtool_get_stats()
528 spin_unlock_bh(&efx->stats_lock); in efx_ethtool_get_stats()
534 *data += tx_queue->tx_packets; in efx_ethtool_get_stats()
543 *data += rx_queue->rx_packets; in efx_ethtool_get_stats()
548 if (efx->xdp_tx_queue_count && efx->xdp_tx_queues) { in efx_ethtool_get_stats()
551 for (xdp = 0; xdp < efx->xdp_tx_queue_count; xdp++) { in efx_ethtool_get_stats()
552 data[0] = efx->xdp_tx_queues[xdp]->tx_packets; in efx_ethtool_get_stats()
565 struct efx_link_state *link_state = &efx->link_state; in efx_ethtool_get_link_ksettings()
568 mutex_lock(&efx->mac_lock); in efx_ethtool_get_link_ksettings()
570 mutex_unlock(&efx->mac_lock); in efx_ethtool_get_link_ksettings()
572 /* Both MACs support pause frames (bidirectional and respond-only) */ in efx_ethtool_get_link_ksettings()
574 cmd->link_modes.supported); in efx_ethtool_get_link_ksettings()
578 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, in efx_ethtool_get_link_ksettings()
582 cmd->base.speed = link_state->speed; in efx_ethtool_get_link_ksettings()
583 cmd->base.duplex = link_state->fd ? DUPLEX_FULL : DUPLEX_HALF; in efx_ethtool_get_link_ksettings()
597 if ((cmd->base.speed == SPEED_1000) && in efx_ethtool_set_link_ksettings()
598 (cmd->base.duplex != DUPLEX_FULL)) { in efx_ethtool_set_link_ksettings()
599 netif_dbg(efx, drv, efx->net_dev, in efx_ethtool_set_link_ksettings()
601 return -EINVAL; in efx_ethtool_set_link_ksettings()
604 mutex_lock(&efx->mac_lock); in efx_ethtool_set_link_ksettings()
606 mutex_unlock(&efx->mac_lock); in efx_ethtool_set_link_ksettings()
616 mutex_lock(&efx->mac_lock); in efx_ethtool_get_fecparam()
618 mutex_unlock(&efx->mac_lock); in efx_ethtool_get_fecparam()
629 mutex_lock(&efx->mac_lock); in efx_ethtool_set_fecparam()
631 mutex_unlock(&efx->mac_lock); in efx_ethtool_set_fecparam()
653 struct ethtool_tcpip4_spec *ip_entry = &rule->h_u.tcp_ip4_spec; in efx_ethtool_get_class_rule()
654 struct ethtool_tcpip4_spec *ip_mask = &rule->m_u.tcp_ip4_spec; in efx_ethtool_get_class_rule()
655 struct ethtool_usrip4_spec *uip_entry = &rule->h_u.usr_ip4_spec; in efx_ethtool_get_class_rule()
656 struct ethtool_usrip4_spec *uip_mask = &rule->m_u.usr_ip4_spec; in efx_ethtool_get_class_rule()
657 struct ethtool_tcpip6_spec *ip6_entry = &rule->h_u.tcp_ip6_spec; in efx_ethtool_get_class_rule()
658 struct ethtool_tcpip6_spec *ip6_mask = &rule->m_u.tcp_ip6_spec; in efx_ethtool_get_class_rule()
659 struct ethtool_usrip6_spec *uip6_entry = &rule->h_u.usr_ip6_spec; in efx_ethtool_get_class_rule()
660 struct ethtool_usrip6_spec *uip6_mask = &rule->m_u.usr_ip6_spec; in efx_ethtool_get_class_rule()
661 struct ethhdr *mac_entry = &rule->h_u.ether_spec; in efx_ethtool_get_class_rule()
662 struct ethhdr *mac_mask = &rule->m_u.ether_spec; in efx_ethtool_get_class_rule()
667 rule->location, &spec); in efx_ethtool_get_class_rule()
672 rule->ring_cookie = RX_CLS_FLOW_DISC; in efx_ethtool_get_class_rule()
674 rule->ring_cookie = spec.dmaq_id; in efx_ethtool_get_class_rule()
685 rule->flow_type = ((spec.ip_proto == IPPROTO_TCP) ? in efx_ethtool_get_class_rule()
688 ip_entry->ip4dst = spec.loc_host[0]; in efx_ethtool_get_class_rule()
689 ip_mask->ip4dst = IP4_ADDR_FULL_MASK; in efx_ethtool_get_class_rule()
692 ip_entry->ip4src = spec.rem_host[0]; in efx_ethtool_get_class_rule()
693 ip_mask->ip4src = IP4_ADDR_FULL_MASK; in efx_ethtool_get_class_rule()
696 ip_entry->pdst = spec.loc_port; in efx_ethtool_get_class_rule()
697 ip_mask->pdst = PORT_FULL_MASK; in efx_ethtool_get_class_rule()
700 ip_entry->psrc = spec.rem_port; in efx_ethtool_get_class_rule()
701 ip_mask->psrc = PORT_FULL_MASK; in efx_ethtool_get_class_rule()
712 rule->flow_type = ((spec.ip_proto == IPPROTO_TCP) ? in efx_ethtool_get_class_rule()
715 memcpy(ip6_entry->ip6dst, spec.loc_host, in efx_ethtool_get_class_rule()
716 sizeof(ip6_entry->ip6dst)); in efx_ethtool_get_class_rule()
717 ip6_fill_mask(ip6_mask->ip6dst); in efx_ethtool_get_class_rule()
720 memcpy(ip6_entry->ip6src, spec.rem_host, in efx_ethtool_get_class_rule()
721 sizeof(ip6_entry->ip6src)); in efx_ethtool_get_class_rule()
722 ip6_fill_mask(ip6_mask->ip6src); in efx_ethtool_get_class_rule()
725 ip6_entry->pdst = spec.loc_port; in efx_ethtool_get_class_rule()
726 ip6_mask->pdst = PORT_FULL_MASK; in efx_ethtool_get_class_rule()
729 ip6_entry->psrc = spec.rem_port; in efx_ethtool_get_class_rule()
730 ip6_mask->psrc = PORT_FULL_MASK; in efx_ethtool_get_class_rule()
736 rule->flow_type = ETHER_FLOW; in efx_ethtool_get_class_rule()
739 ether_addr_copy(mac_entry->h_dest, spec.loc_mac); in efx_ethtool_get_class_rule()
741 eth_broadcast_addr(mac_mask->h_dest); in efx_ethtool_get_class_rule()
743 ether_addr_copy(mac_mask->h_dest, in efx_ethtool_get_class_rule()
747 ether_addr_copy(mac_entry->h_source, spec.rem_mac); in efx_ethtool_get_class_rule()
748 eth_broadcast_addr(mac_mask->h_source); in efx_ethtool_get_class_rule()
751 mac_entry->h_proto = spec.ether_type; in efx_ethtool_get_class_rule()
752 mac_mask->h_proto = ETHER_TYPE_FULL_MASK; in efx_ethtool_get_class_rule()
760 rule->flow_type = IPV4_USER_FLOW; in efx_ethtool_get_class_rule()
761 uip_entry->ip_ver = ETH_RX_NFC_IP4; in efx_ethtool_get_class_rule()
763 uip_mask->proto = IP_PROTO_FULL_MASK; in efx_ethtool_get_class_rule()
764 uip_entry->proto = spec.ip_proto; in efx_ethtool_get_class_rule()
767 uip_entry->ip4dst = spec.loc_host[0]; in efx_ethtool_get_class_rule()
768 uip_mask->ip4dst = IP4_ADDR_FULL_MASK; in efx_ethtool_get_class_rule()
771 uip_entry->ip4src = spec.rem_host[0]; in efx_ethtool_get_class_rule()
772 uip_mask->ip4src = IP4_ADDR_FULL_MASK; in efx_ethtool_get_class_rule()
780 rule->flow_type = IPV6_USER_FLOW; in efx_ethtool_get_class_rule()
782 uip6_mask->l4_proto = IP_PROTO_FULL_MASK; in efx_ethtool_get_class_rule()
783 uip6_entry->l4_proto = spec.ip_proto; in efx_ethtool_get_class_rule()
786 memcpy(uip6_entry->ip6dst, spec.loc_host, in efx_ethtool_get_class_rule()
787 sizeof(uip6_entry->ip6dst)); in efx_ethtool_get_class_rule()
788 ip6_fill_mask(uip6_mask->ip6dst); in efx_ethtool_get_class_rule()
791 memcpy(uip6_entry->ip6src, spec.rem_host, in efx_ethtool_get_class_rule()
792 sizeof(uip6_entry->ip6src)); in efx_ethtool_get_class_rule()
793 ip6_fill_mask(uip6_mask->ip6src); in efx_ethtool_get_class_rule()
798 return -EINVAL; in efx_ethtool_get_class_rule()
802 rule->flow_type |= FLOW_EXT; in efx_ethtool_get_class_rule()
803 rule->h_ext.vlan_tci = spec.outer_vid; in efx_ethtool_get_class_rule()
804 rule->m_ext.vlan_tci = htons(0xfff); in efx_ethtool_get_class_rule()
808 rule->flow_type |= FLOW_RSS; in efx_ethtool_get_class_rule()
822 switch (info->cmd) { in efx_ethtool_get_rxnfc()
824 info->data = efx->n_rx_channels; in efx_ethtool_get_rxnfc()
828 struct efx_rss_context *ctx = &efx->rss_context; in efx_ethtool_get_rxnfc()
831 mutex_lock(&efx->rss_lock); in efx_ethtool_get_rxnfc()
832 if (info->flow_type & FLOW_RSS && info->rss_context) { in efx_ethtool_get_rxnfc()
833 ctx = efx_find_rss_context_entry(efx, info->rss_context); in efx_ethtool_get_rxnfc()
835 rc = -ENOENT; in efx_ethtool_get_rxnfc()
841 if (!efx_rss_active(ctx)) /* No RSS */ in efx_ethtool_get_rxnfc()
844 switch (info->flow_type & ~FLOW_RSS) { in efx_ethtool_get_rxnfc()
847 if (ctx->rx_hash_udp_4tuple) in efx_ethtool_get_rxnfc()
870 info->data = data; in efx_ethtool_get_rxnfc()
872 mutex_unlock(&efx->rss_lock); in efx_ethtool_get_rxnfc()
877 info->data = efx_filter_get_rx_id_limit(efx); in efx_ethtool_get_rxnfc()
878 if (info->data == 0) in efx_ethtool_get_rxnfc()
879 return -EOPNOTSUPP; in efx_ethtool_get_rxnfc()
880 info->data |= RX_CLS_LOC_SPECIAL; in efx_ethtool_get_rxnfc()
881 info->rule_cnt = in efx_ethtool_get_rxnfc()
887 return -EOPNOTSUPP; in efx_ethtool_get_rxnfc()
888 rc = efx_ethtool_get_class_rule(efx, &info->fs, &rss_context); in efx_ethtool_get_rxnfc()
891 if (info->fs.flow_type & FLOW_RSS) in efx_ethtool_get_rxnfc()
892 info->rss_context = rss_context; in efx_ethtool_get_rxnfc()
896 info->data = efx_filter_get_rx_id_limit(efx); in efx_ethtool_get_rxnfc()
897 if (info->data == 0) in efx_ethtool_get_rxnfc()
898 return -EOPNOTSUPP; in efx_ethtool_get_rxnfc()
900 rule_locs, info->rule_cnt); in efx_ethtool_get_rxnfc()
903 info->rule_cnt = rc; in efx_ethtool_get_rxnfc()
907 return -EOPNOTSUPP; in efx_ethtool_get_rxnfc()
925 struct ethtool_tcpip4_spec *ip_entry = &rule->h_u.tcp_ip4_spec; in efx_ethtool_set_class_rule()
926 struct ethtool_tcpip4_spec *ip_mask = &rule->m_u.tcp_ip4_spec; in efx_ethtool_set_class_rule()
927 struct ethtool_usrip4_spec *uip_entry = &rule->h_u.usr_ip4_spec; in efx_ethtool_set_class_rule()
928 struct ethtool_usrip4_spec *uip_mask = &rule->m_u.usr_ip4_spec; in efx_ethtool_set_class_rule()
929 struct ethtool_tcpip6_spec *ip6_entry = &rule->h_u.tcp_ip6_spec; in efx_ethtool_set_class_rule()
930 struct ethtool_tcpip6_spec *ip6_mask = &rule->m_u.tcp_ip6_spec; in efx_ethtool_set_class_rule()
931 struct ethtool_usrip6_spec *uip6_entry = &rule->h_u.usr_ip6_spec; in efx_ethtool_set_class_rule()
932 struct ethtool_usrip6_spec *uip6_mask = &rule->m_u.usr_ip6_spec; in efx_ethtool_set_class_rule()
933 u32 flow_type = rule->flow_type & ~(FLOW_EXT | FLOW_RSS); in efx_ethtool_set_class_rule()
934 struct ethhdr *mac_entry = &rule->h_u.ether_spec; in efx_ethtool_set_class_rule()
935 struct ethhdr *mac_mask = &rule->m_u.ether_spec; in efx_ethtool_set_class_rule()
941 if (rule->location != RX_CLS_LOC_ANY) in efx_ethtool_set_class_rule()
942 return -EINVAL; in efx_ethtool_set_class_rule()
944 /* Range-check ring_cookie */ in efx_ethtool_set_class_rule()
945 if (rule->ring_cookie >= efx->n_rx_channels && in efx_ethtool_set_class_rule()
946 rule->ring_cookie != RX_CLS_FLOW_DISC) in efx_ethtool_set_class_rule()
947 return -EINVAL; in efx_ethtool_set_class_rule()
950 if ((rule->flow_type & FLOW_EXT) && in efx_ethtool_set_class_rule()
951 (rule->m_ext.vlan_etype || rule->m_ext.data[0] || in efx_ethtool_set_class_rule()
952 rule->m_ext.data[1])) in efx_ethtool_set_class_rule()
953 return -EINVAL; in efx_ethtool_set_class_rule()
955 if (efx->rx_scatter) in efx_ethtool_set_class_rule()
957 if (rule->flow_type & FLOW_RSS) in efx_ethtool_set_class_rule()
961 (rule->ring_cookie == RX_CLS_FLOW_DISC) ? in efx_ethtool_set_class_rule()
962 EFX_FILTER_RX_DMAQ_ID_DROP : rule->ring_cookie); in efx_ethtool_set_class_rule()
964 if (rule->flow_type & FLOW_RSS) in efx_ethtool_set_class_rule()
975 if (ip_mask->ip4dst) { in efx_ethtool_set_class_rule()
976 if (ip_mask->ip4dst != IP4_ADDR_FULL_MASK) in efx_ethtool_set_class_rule()
977 return -EINVAL; in efx_ethtool_set_class_rule()
979 spec.loc_host[0] = ip_entry->ip4dst; in efx_ethtool_set_class_rule()
981 if (ip_mask->ip4src) { in efx_ethtool_set_class_rule()
982 if (ip_mask->ip4src != IP4_ADDR_FULL_MASK) in efx_ethtool_set_class_rule()
983 return -EINVAL; in efx_ethtool_set_class_rule()
985 spec.rem_host[0] = ip_entry->ip4src; in efx_ethtool_set_class_rule()
987 if (ip_mask->pdst) { in efx_ethtool_set_class_rule()
988 if (ip_mask->pdst != PORT_FULL_MASK) in efx_ethtool_set_class_rule()
989 return -EINVAL; in efx_ethtool_set_class_rule()
991 spec.loc_port = ip_entry->pdst; in efx_ethtool_set_class_rule()
993 if (ip_mask->psrc) { in efx_ethtool_set_class_rule()
994 if (ip_mask->psrc != PORT_FULL_MASK) in efx_ethtool_set_class_rule()
995 return -EINVAL; in efx_ethtool_set_class_rule()
997 spec.rem_port = ip_entry->psrc; in efx_ethtool_set_class_rule()
999 if (ip_mask->tos) in efx_ethtool_set_class_rule()
1000 return -EINVAL; in efx_ethtool_set_class_rule()
1010 if (!ip6_mask_is_empty(ip6_mask->ip6dst)) { in efx_ethtool_set_class_rule()
1011 if (!ip6_mask_is_full(ip6_mask->ip6dst)) in efx_ethtool_set_class_rule()
1012 return -EINVAL; in efx_ethtool_set_class_rule()
1014 memcpy(spec.loc_host, ip6_entry->ip6dst, sizeof(spec.loc_host)); in efx_ethtool_set_class_rule()
1016 if (!ip6_mask_is_empty(ip6_mask->ip6src)) { in efx_ethtool_set_class_rule()
1017 if (!ip6_mask_is_full(ip6_mask->ip6src)) in efx_ethtool_set_class_rule()
1018 return -EINVAL; in efx_ethtool_set_class_rule()
1020 memcpy(spec.rem_host, ip6_entry->ip6src, sizeof(spec.rem_host)); in efx_ethtool_set_class_rule()
1022 if (ip6_mask->pdst) { in efx_ethtool_set_class_rule()
1023 if (ip6_mask->pdst != PORT_FULL_MASK) in efx_ethtool_set_class_rule()
1024 return -EINVAL; in efx_ethtool_set_class_rule()
1026 spec.loc_port = ip6_entry->pdst; in efx_ethtool_set_class_rule()
1028 if (ip6_mask->psrc) { in efx_ethtool_set_class_rule()
1029 if (ip6_mask->psrc != PORT_FULL_MASK) in efx_ethtool_set_class_rule()
1030 return -EINVAL; in efx_ethtool_set_class_rule()
1032 spec.rem_port = ip6_entry->psrc; in efx_ethtool_set_class_rule()
1034 if (ip6_mask->tclass) in efx_ethtool_set_class_rule()
1035 return -EINVAL; in efx_ethtool_set_class_rule()
1039 if (uip_mask->l4_4_bytes || uip_mask->tos || uip_mask->ip_ver || in efx_ethtool_set_class_rule()
1040 uip_entry->ip_ver != ETH_RX_NFC_IP4) in efx_ethtool_set_class_rule()
1041 return -EINVAL; in efx_ethtool_set_class_rule()
1044 if (uip_mask->ip4dst) { in efx_ethtool_set_class_rule()
1045 if (uip_mask->ip4dst != IP4_ADDR_FULL_MASK) in efx_ethtool_set_class_rule()
1046 return -EINVAL; in efx_ethtool_set_class_rule()
1048 spec.loc_host[0] = uip_entry->ip4dst; in efx_ethtool_set_class_rule()
1050 if (uip_mask->ip4src) { in efx_ethtool_set_class_rule()
1051 if (uip_mask->ip4src != IP4_ADDR_FULL_MASK) in efx_ethtool_set_class_rule()
1052 return -EINVAL; in efx_ethtool_set_class_rule()
1054 spec.rem_host[0] = uip_entry->ip4src; in efx_ethtool_set_class_rule()
1056 if (uip_mask->proto) { in efx_ethtool_set_class_rule()
1057 if (uip_mask->proto != IP_PROTO_FULL_MASK) in efx_ethtool_set_class_rule()
1058 return -EINVAL; in efx_ethtool_set_class_rule()
1060 spec.ip_proto = uip_entry->proto; in efx_ethtool_set_class_rule()
1065 if (uip6_mask->l4_4_bytes || uip6_mask->tclass) in efx_ethtool_set_class_rule()
1066 return -EINVAL; in efx_ethtool_set_class_rule()
1069 if (!ip6_mask_is_empty(uip6_mask->ip6dst)) { in efx_ethtool_set_class_rule()
1070 if (!ip6_mask_is_full(uip6_mask->ip6dst)) in efx_ethtool_set_class_rule()
1071 return -EINVAL; in efx_ethtool_set_class_rule()
1073 memcpy(spec.loc_host, uip6_entry->ip6dst, sizeof(spec.loc_host)); in efx_ethtool_set_class_rule()
1075 if (!ip6_mask_is_empty(uip6_mask->ip6src)) { in efx_ethtool_set_class_rule()
1076 if (!ip6_mask_is_full(uip6_mask->ip6src)) in efx_ethtool_set_class_rule()
1077 return -EINVAL; in efx_ethtool_set_class_rule()
1079 memcpy(spec.rem_host, uip6_entry->ip6src, sizeof(spec.rem_host)); in efx_ethtool_set_class_rule()
1081 if (uip6_mask->l4_proto) { in efx_ethtool_set_class_rule()
1082 if (uip6_mask->l4_proto != IP_PROTO_FULL_MASK) in efx_ethtool_set_class_rule()
1083 return -EINVAL; in efx_ethtool_set_class_rule()
1085 spec.ip_proto = uip6_entry->l4_proto; in efx_ethtool_set_class_rule()
1090 if (!is_zero_ether_addr(mac_mask->h_dest)) { in efx_ethtool_set_class_rule()
1091 if (ether_addr_equal(mac_mask->h_dest, in efx_ethtool_set_class_rule()
1094 else if (is_broadcast_ether_addr(mac_mask->h_dest)) in efx_ethtool_set_class_rule()
1097 return -EINVAL; in efx_ethtool_set_class_rule()
1098 ether_addr_copy(spec.loc_mac, mac_entry->h_dest); in efx_ethtool_set_class_rule()
1100 if (!is_zero_ether_addr(mac_mask->h_source)) { in efx_ethtool_set_class_rule()
1101 if (!is_broadcast_ether_addr(mac_mask->h_source)) in efx_ethtool_set_class_rule()
1102 return -EINVAL; in efx_ethtool_set_class_rule()
1104 ether_addr_copy(spec.rem_mac, mac_entry->h_source); in efx_ethtool_set_class_rule()
1106 if (mac_mask->h_proto) { in efx_ethtool_set_class_rule()
1107 if (mac_mask->h_proto != ETHER_TYPE_FULL_MASK) in efx_ethtool_set_class_rule()
1108 return -EINVAL; in efx_ethtool_set_class_rule()
1110 spec.ether_type = mac_entry->h_proto; in efx_ethtool_set_class_rule()
1115 return -EINVAL; in efx_ethtool_set_class_rule()
1118 if ((rule->flow_type & FLOW_EXT) && rule->m_ext.vlan_tci) { in efx_ethtool_set_class_rule()
1119 if (rule->m_ext.vlan_tci != htons(0xfff)) in efx_ethtool_set_class_rule()
1120 return -EINVAL; in efx_ethtool_set_class_rule()
1122 spec.outer_vid = rule->h_ext.vlan_tci; in efx_ethtool_set_class_rule()
1129 rule->location = rc; in efx_ethtool_set_class_rule()
1139 return -EOPNOTSUPP; in efx_ethtool_set_rxnfc()
1141 switch (info->cmd) { in efx_ethtool_set_rxnfc()
1143 return efx_ethtool_set_class_rule(efx, &info->fs, in efx_ethtool_set_rxnfc()
1144 info->rss_context); in efx_ethtool_set_rxnfc()
1148 info->fs.location); in efx_ethtool_set_rxnfc()
1151 return -EOPNOTSUPP; in efx_ethtool_set_rxnfc()
1159 if (efx->n_rx_channels == 1) in efx_ethtool_get_rxfh_indir_size()
1161 return ARRAY_SIZE(efx->rss_context.rx_indir_table); in efx_ethtool_get_rxfh_indir_size()
1168 return efx->type->rx_hash_key_size; in efx_ethtool_get_rxfh_key_size()
1177 rc = efx->type->rx_pull_rss_config(efx); in efx_ethtool_get_rxfh()
1184 memcpy(indir, efx->rss_context.rx_indir_table, in efx_ethtool_get_rxfh()
1185 sizeof(efx->rss_context.rx_indir_table)); in efx_ethtool_get_rxfh()
1187 memcpy(key, efx->rss_context.rx_hash_key, in efx_ethtool_get_rxfh()
1188 efx->type->rx_hash_key_size); in efx_ethtool_get_rxfh()
1199 return -EOPNOTSUPP; in efx_ethtool_set_rxfh()
1204 key = efx->rss_context.rx_hash_key; in efx_ethtool_set_rxfh()
1206 indir = efx->rss_context.rx_indir_table; in efx_ethtool_set_rxfh()
1208 return efx->type->rx_push_rss_config(efx, true, indir, key); in efx_ethtool_set_rxfh()
1218 if (!efx->type->rx_pull_rss_context_config) in efx_ethtool_get_rxfh_context()
1219 return -EOPNOTSUPP; in efx_ethtool_get_rxfh_context()
1221 mutex_lock(&efx->rss_lock); in efx_ethtool_get_rxfh_context()
1224 rc = -ENOENT; in efx_ethtool_get_rxfh_context()
1227 rc = efx->type->rx_pull_rss_context_config(efx, ctx); in efx_ethtool_get_rxfh_context()
1234 memcpy(indir, ctx->rx_indir_table, sizeof(ctx->rx_indir_table)); in efx_ethtool_get_rxfh_context()
1236 memcpy(key, ctx->rx_hash_key, efx->type->rx_hash_key_size); in efx_ethtool_get_rxfh_context()
1238 mutex_unlock(&efx->rss_lock); in efx_ethtool_get_rxfh_context()
1252 if (!efx->type->rx_push_rss_context_config) in efx_ethtool_set_rxfh_context()
1253 return -EOPNOTSUPP; in efx_ethtool_set_rxfh_context()
1256 return -EOPNOTSUPP; in efx_ethtool_set_rxfh_context()
1258 mutex_lock(&efx->rss_lock); in efx_ethtool_set_rxfh_context()
1263 rc = -EINVAL; in efx_ethtool_set_rxfh_context()
1268 rc = -ENOMEM; in efx_ethtool_set_rxfh_context()
1271 ctx->context_id = EFX_MCDI_RSS_CONTEXT_INVALID; in efx_ethtool_set_rxfh_context()
1274 netdev_rss_key_fill(ctx->rx_hash_key, sizeof(ctx->rx_hash_key)); in efx_ethtool_set_rxfh_context()
1279 rc = -ENOENT; in efx_ethtool_set_rxfh_context()
1286 rc = efx->type->rx_push_rss_context_config(efx, ctx, NULL, NULL); in efx_ethtool_set_rxfh_context()
1293 key = ctx->rx_hash_key; in efx_ethtool_set_rxfh_context()
1295 indir = ctx->rx_indir_table; in efx_ethtool_set_rxfh_context()
1297 rc = efx->type->rx_push_rss_context_config(efx, ctx, indir, key); in efx_ethtool_set_rxfh_context()
1301 *rss_context = ctx->user_id; in efx_ethtool_set_rxfh_context()
1303 mutex_unlock(&efx->rss_lock); in efx_ethtool_set_rxfh_context()
1312 rc = efx->type->map_reset_flags(flags); in efx_ethtool_reset()
1326 mutex_lock(&efx->mac_lock); in efx_ethtool_get_module_eeprom()
1328 mutex_unlock(&efx->mac_lock); in efx_ethtool_get_module_eeprom()
1339 mutex_lock(&efx->mac_lock); in efx_ethtool_get_module_info()
1341 mutex_unlock(&efx->mac_lock); in efx_ethtool_get_module_info()