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) ? \
109 strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); in efx_ethtool_get_drvinfo()
110 efx_mcdi_print_fwver(efx, info->fw_version, in efx_ethtool_get_drvinfo()
111 sizeof(info->fw_version)); in efx_ethtool_get_drvinfo()
112 strscpy(info->bus_info, pci_name(efx->pci_dev), sizeof(info->bus_info)); in efx_ethtool_get_drvinfo()
119 return efx->msg_enable; in efx_ethtool_get_msglevel()
126 efx->msg_enable = msg_enable; in efx_ethtool_set_msglevel()
130 struct ethtool_test *test, u64 *data) in efx_ethtool_self_test() argument
135 int rc = -ENOMEM; in efx_ethtool_self_test()
141 if (!efx_net_active(efx->state)) { in efx_ethtool_self_test()
142 rc = -EBUSY; in efx_ethtool_self_test()
146 netif_info(efx, drv, efx->net_dev, "starting %sline testing\n", in efx_ethtool_self_test()
147 (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); in efx_ethtool_self_test()
150 already_up = (efx->net_dev->flags & IFF_UP); in efx_ethtool_self_test()
152 rc = dev_open(efx->net_dev, NULL); in efx_ethtool_self_test()
154 netif_err(efx, drv, efx->net_dev, in efx_ethtool_self_test()
160 rc = efx_selftest(efx, efx_tests, test->flags); in efx_ethtool_self_test()
163 dev_close(efx->net_dev); in efx_ethtool_self_test()
165 netif_info(efx, drv, efx->net_dev, "%s %sline self-tests\n", in efx_ethtool_self_test()
167 (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); in efx_ethtool_self_test()
174 test->flags |= ETH_TEST_FL_FAILED; in efx_ethtool_self_test()
182 pause->rx_pause = !!(efx->wanted_fc & EFX_FC_RX); in efx_ethtool_get_pauseparam()
183 pause->tx_pause = !!(efx->wanted_fc & EFX_FC_TX); in efx_ethtool_get_pauseparam()
184 pause->autoneg = !!(efx->wanted_fc & EFX_FC_AUTO); in efx_ethtool_get_pauseparam()
195 mutex_lock(&efx->mac_lock); in efx_ethtool_set_pauseparam()
197 wanted_fc = ((pause->rx_pause ? EFX_FC_RX : 0) | in efx_ethtool_set_pauseparam()
198 (pause->tx_pause ? EFX_FC_TX : 0) | in efx_ethtool_set_pauseparam()
199 (pause->autoneg ? EFX_FC_AUTO : 0)); in efx_ethtool_set_pauseparam()
202 netif_dbg(efx, drv, efx->net_dev, in efx_ethtool_set_pauseparam()
204 rc = -EINVAL; in efx_ethtool_set_pauseparam()
208 if ((wanted_fc & EFX_FC_AUTO) && !efx->link_advertising[0]) { in efx_ethtool_set_pauseparam()
209 netif_dbg(efx, drv, efx->net_dev, in efx_ethtool_set_pauseparam()
211 rc = -EINVAL; in efx_ethtool_set_pauseparam()
216 if (efx->type->prepare_enable_fc_tx && in efx_ethtool_set_pauseparam()
217 (wanted_fc & EFX_FC_TX) && !(efx->wanted_fc & EFX_FC_TX)) in efx_ethtool_set_pauseparam()
218 efx->type->prepare_enable_fc_tx(efx); in efx_ethtool_set_pauseparam()
220 old_adv = efx->link_advertising[0]; in efx_ethtool_set_pauseparam()
221 old_fc = efx->wanted_fc; in efx_ethtool_set_pauseparam()
223 if (efx->link_advertising[0] != old_adv || in efx_ethtool_set_pauseparam()
224 (efx->wanted_fc ^ old_fc) & EFX_FC_AUTO) { in efx_ethtool_set_pauseparam()
227 netif_err(efx, drv, efx->net_dev, in efx_ethtool_set_pauseparam()
235 * if the user just changed the advertised capabilities, but there's no in efx_ethtool_set_pauseparam()
240 mutex_unlock(&efx->mac_lock); in efx_ethtool_set_pauseparam()
246 * efx_fill_test - fill in an individual self-test entry
247 * @test_index: Index of the test
249 * @data: Ethtool test results, or %NULL
250 * @test: Pointer to test result (used only if data != %NULL)
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.
259 int *test, const char *unit_format, int unit_id, in efx_fill_test() argument
266 data[test_index] = *test; in efx_fill_test()
278 "%-6s %-24s", unit_str, test_str); in efx_fill_test()
282 #define EFX_CHANNEL_NAME(_channel) "chan%d", _channel->channel
283 #define EFX_TX_QUEUE_NAME(_tx_queue) "txq%d", _tx_queue->label
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
294 * @data: Ethtool test results, or %NULL
296 * Fill in a block of loopback self-test entries. Return new test
306 efx_get_channel(efx, efx->tx_channel_offset); in efx_fill_loopback_test()
311 &lb_tests->tx_sent[tx_queue->label], in efx_fill_loopback_test()
315 &lb_tests->tx_done[tx_queue->label], in efx_fill_loopback_test()
320 &lb_tests->rx_good, in efx_fill_loopback_test()
324 &lb_tests->rx_bad, in efx_fill_loopback_test()
332 * efx_ethtool_fill_self_tests - get self-test details
334 * @tests: Efx self-test results structure, 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).
352 efx_fill_test(n++, strings, data, &tests->phy_alive, in efx_ethtool_fill_self_tests()
354 efx_fill_test(n++, strings, data, &tests->nvram, in efx_ethtool_fill_self_tests()
356 efx_fill_test(n++, strings, data, &tests->interrupt, in efx_ethtool_fill_self_tests()
362 &tests->eventq_dma[channel->channel], in efx_ethtool_fill_self_tests()
366 &tests->eventq_int[channel->channel], in efx_ethtool_fill_self_tests()
371 efx_fill_test(n++, strings, data, &tests->memory, in efx_ethtool_fill_self_tests()
373 efx_fill_test(n++, strings, data, &tests->registers, in efx_ethtool_fill_self_tests()
384 efx_fill_test(n++, strings, data, &tests->phy_ext[i], "phy", 0, name, NULL); in efx_ethtool_fill_self_tests()
387 /* Loopback tests */ in efx_ethtool_fill_self_tests()
389 if (!(efx->loopback_modes & (1 << mode))) in efx_ethtool_fill_self_tests()
392 &tests->loopback[mode], mode, n, in efx_ethtool_fill_self_tests()
409 "tx-%u.tx_packets", in efx_describe_per_queue_stats()
410 channel->tx_queue[0].queue / in efx_describe_per_queue_stats()
422 "rx-%d.rx_packets", channel->channel); in efx_describe_per_queue_stats()
427 if (efx->xdp_tx_queue_count && efx->xdp_tx_queues) { in efx_describe_per_queue_stats()
430 for (xdp = 0; xdp < efx->xdp_tx_queue_count; xdp++) { in efx_describe_per_queue_stats()
434 "tx-xdp-cpu-%hu.tx_packets", xdp); in efx_describe_per_queue_stats()
449 return efx->type->describe_stats(efx, NULL) + in efx_ethtool_get_sset_count()
456 return -EINVAL; in efx_ethtool_get_sset_count()
468 strings += (efx->type->describe_stats(efx, strings) * in efx_ethtool_get_strings()
482 /* No other string sets */ in efx_ethtool_get_strings()
498 spin_lock_bh(&efx->stats_lock); in efx_ethtool_get_stats()
501 data += efx->type->update_stats(efx, data, NULL); in efx_ethtool_get_stats()
506 switch (stat->source) { in efx_ethtool_get_stats()
508 data[i] = stat->get_stat((void *)efx + stat->offset); in efx_ethtool_get_stats()
513 data[i] += stat->get_stat((void *)channel + in efx_ethtool_get_stats()
514 stat->offset); in efx_ethtool_get_stats()
521 stat->get_stat((void *)tx_queue in efx_ethtool_get_stats()
522 + stat->offset); in efx_ethtool_get_stats()
529 spin_unlock_bh(&efx->stats_lock); in efx_ethtool_get_stats()
535 *data += tx_queue->tx_packets; in efx_ethtool_get_stats()
544 *data += rx_queue->rx_packets; in efx_ethtool_get_stats()
549 if (efx->xdp_tx_queue_count && efx->xdp_tx_queues) { in efx_ethtool_get_stats()
552 for (xdp = 0; xdp < efx->xdp_tx_queue_count; xdp++) { in efx_ethtool_get_stats()
553 data[0] = efx->xdp_tx_queues[xdp]->tx_packets; in efx_ethtool_get_stats()
566 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()
577 cmd->base.speed = link_state->speed; in efx_ethtool_get_link_ksettings()
578 cmd->base.duplex = link_state->fd ? DUPLEX_FULL : DUPLEX_HALF; in efx_ethtool_get_link_ksettings()
592 if ((cmd->base.speed == SPEED_1000) && in efx_ethtool_set_link_ksettings()
593 (cmd->base.duplex != DUPLEX_FULL)) { in efx_ethtool_set_link_ksettings()
594 netif_dbg(efx, drv, efx->net_dev, in efx_ethtool_set_link_ksettings()
596 return -EINVAL; in efx_ethtool_set_link_ksettings()
599 mutex_lock(&efx->mac_lock); in efx_ethtool_set_link_ksettings()
601 mutex_unlock(&efx->mac_lock); in efx_ethtool_set_link_ksettings()
611 mutex_lock(&efx->mac_lock); in efx_ethtool_get_fecparam()
613 mutex_unlock(&efx->mac_lock); in efx_ethtool_get_fecparam()
624 mutex_lock(&efx->mac_lock); in efx_ethtool_set_fecparam()
626 mutex_unlock(&efx->mac_lock); in efx_ethtool_set_fecparam()
648 struct ethtool_tcpip4_spec *ip_entry = &rule->h_u.tcp_ip4_spec; in efx_ethtool_get_class_rule()
649 struct ethtool_tcpip4_spec *ip_mask = &rule->m_u.tcp_ip4_spec; in efx_ethtool_get_class_rule()
650 struct ethtool_usrip4_spec *uip_entry = &rule->h_u.usr_ip4_spec; in efx_ethtool_get_class_rule()
651 struct ethtool_usrip4_spec *uip_mask = &rule->m_u.usr_ip4_spec; in efx_ethtool_get_class_rule()
652 struct ethtool_tcpip6_spec *ip6_entry = &rule->h_u.tcp_ip6_spec; in efx_ethtool_get_class_rule()
653 struct ethtool_tcpip6_spec *ip6_mask = &rule->m_u.tcp_ip6_spec; in efx_ethtool_get_class_rule()
654 struct ethtool_usrip6_spec *uip6_entry = &rule->h_u.usr_ip6_spec; in efx_ethtool_get_class_rule()
655 struct ethtool_usrip6_spec *uip6_mask = &rule->m_u.usr_ip6_spec; in efx_ethtool_get_class_rule()
656 struct ethhdr *mac_entry = &rule->h_u.ether_spec; in efx_ethtool_get_class_rule()
657 struct ethhdr *mac_mask = &rule->m_u.ether_spec; in efx_ethtool_get_class_rule()
662 rule->location, &spec); in efx_ethtool_get_class_rule()
667 rule->ring_cookie = RX_CLS_FLOW_DISC; in efx_ethtool_get_class_rule()
669 rule->ring_cookie = spec.dmaq_id; in efx_ethtool_get_class_rule()
680 rule->flow_type = ((spec.ip_proto == IPPROTO_TCP) ? in efx_ethtool_get_class_rule()
683 ip_entry->ip4dst = spec.loc_host[0]; in efx_ethtool_get_class_rule()
684 ip_mask->ip4dst = IP4_ADDR_FULL_MASK; in efx_ethtool_get_class_rule()
687 ip_entry->ip4src = spec.rem_host[0]; in efx_ethtool_get_class_rule()
688 ip_mask->ip4src = IP4_ADDR_FULL_MASK; in efx_ethtool_get_class_rule()
691 ip_entry->pdst = spec.loc_port; in efx_ethtool_get_class_rule()
692 ip_mask->pdst = PORT_FULL_MASK; in efx_ethtool_get_class_rule()
695 ip_entry->psrc = spec.rem_port; in efx_ethtool_get_class_rule()
696 ip_mask->psrc = PORT_FULL_MASK; in efx_ethtool_get_class_rule()
707 rule->flow_type = ((spec.ip_proto == IPPROTO_TCP) ? in efx_ethtool_get_class_rule()
710 memcpy(ip6_entry->ip6dst, spec.loc_host, in efx_ethtool_get_class_rule()
711 sizeof(ip6_entry->ip6dst)); in efx_ethtool_get_class_rule()
712 ip6_fill_mask(ip6_mask->ip6dst); in efx_ethtool_get_class_rule()
715 memcpy(ip6_entry->ip6src, spec.rem_host, in efx_ethtool_get_class_rule()
716 sizeof(ip6_entry->ip6src)); in efx_ethtool_get_class_rule()
717 ip6_fill_mask(ip6_mask->ip6src); in efx_ethtool_get_class_rule()
720 ip6_entry->pdst = spec.loc_port; in efx_ethtool_get_class_rule()
721 ip6_mask->pdst = PORT_FULL_MASK; in efx_ethtool_get_class_rule()
724 ip6_entry->psrc = spec.rem_port; in efx_ethtool_get_class_rule()
725 ip6_mask->psrc = PORT_FULL_MASK; in efx_ethtool_get_class_rule()
731 rule->flow_type = ETHER_FLOW; in efx_ethtool_get_class_rule()
734 ether_addr_copy(mac_entry->h_dest, spec.loc_mac); in efx_ethtool_get_class_rule()
736 eth_broadcast_addr(mac_mask->h_dest); in efx_ethtool_get_class_rule()
738 ether_addr_copy(mac_mask->h_dest, in efx_ethtool_get_class_rule()
742 ether_addr_copy(mac_entry->h_source, spec.rem_mac); in efx_ethtool_get_class_rule()
743 eth_broadcast_addr(mac_mask->h_source); in efx_ethtool_get_class_rule()
746 mac_entry->h_proto = spec.ether_type; in efx_ethtool_get_class_rule()
747 mac_mask->h_proto = ETHER_TYPE_FULL_MASK; in efx_ethtool_get_class_rule()
755 rule->flow_type = IPV4_USER_FLOW; in efx_ethtool_get_class_rule()
756 uip_entry->ip_ver = ETH_RX_NFC_IP4; in efx_ethtool_get_class_rule()
758 uip_mask->proto = IP_PROTO_FULL_MASK; in efx_ethtool_get_class_rule()
759 uip_entry->proto = spec.ip_proto; in efx_ethtool_get_class_rule()
762 uip_entry->ip4dst = spec.loc_host[0]; in efx_ethtool_get_class_rule()
763 uip_mask->ip4dst = IP4_ADDR_FULL_MASK; in efx_ethtool_get_class_rule()
766 uip_entry->ip4src = spec.rem_host[0]; in efx_ethtool_get_class_rule()
767 uip_mask->ip4src = IP4_ADDR_FULL_MASK; in efx_ethtool_get_class_rule()
775 rule->flow_type = IPV6_USER_FLOW; in efx_ethtool_get_class_rule()
777 uip6_mask->l4_proto = IP_PROTO_FULL_MASK; in efx_ethtool_get_class_rule()
778 uip6_entry->l4_proto = spec.ip_proto; in efx_ethtool_get_class_rule()
781 memcpy(uip6_entry->ip6dst, spec.loc_host, in efx_ethtool_get_class_rule()
782 sizeof(uip6_entry->ip6dst)); in efx_ethtool_get_class_rule()
783 ip6_fill_mask(uip6_mask->ip6dst); in efx_ethtool_get_class_rule()
786 memcpy(uip6_entry->ip6src, spec.rem_host, in efx_ethtool_get_class_rule()
787 sizeof(uip6_entry->ip6src)); in efx_ethtool_get_class_rule()
788 ip6_fill_mask(uip6_mask->ip6src); in efx_ethtool_get_class_rule()
793 return -EINVAL; in efx_ethtool_get_class_rule()
797 rule->flow_type |= FLOW_EXT; in efx_ethtool_get_class_rule()
798 rule->h_ext.vlan_tci = spec.outer_vid; in efx_ethtool_get_class_rule()
799 rule->m_ext.vlan_tci = htons(0xfff); in efx_ethtool_get_class_rule()
803 rule->flow_type |= FLOW_RSS; in efx_ethtool_get_class_rule()
817 switch (info->cmd) { in efx_ethtool_get_rxnfc()
819 info->data = efx->n_rx_channels; in efx_ethtool_get_rxnfc()
823 struct efx_rss_context_priv *ctx = &efx->rss_context.priv; in efx_ethtool_get_rxnfc()
826 mutex_lock(&net_dev->ethtool->rss_lock); in efx_ethtool_get_rxnfc()
827 if (info->flow_type & FLOW_RSS && info->rss_context) { in efx_ethtool_get_rxnfc()
828 ctx = efx_find_rss_context_entry(efx, info->rss_context); in efx_ethtool_get_rxnfc()
830 rc = -ENOENT; in efx_ethtool_get_rxnfc()
836 if (!efx_rss_active(ctx)) /* No RSS */ in efx_ethtool_get_rxnfc()
839 switch (info->flow_type & ~FLOW_RSS) { in efx_ethtool_get_rxnfc()
842 if (ctx->rx_hash_udp_4tuple) in efx_ethtool_get_rxnfc()
865 info->data = data; in efx_ethtool_get_rxnfc()
867 mutex_unlock(&net_dev->ethtool->rss_lock); in efx_ethtool_get_rxnfc()
872 info->data = efx_filter_get_rx_id_limit(efx); in efx_ethtool_get_rxnfc()
873 if (info->data == 0) in efx_ethtool_get_rxnfc()
874 return -EOPNOTSUPP; in efx_ethtool_get_rxnfc()
875 info->data |= RX_CLS_LOC_SPECIAL; in efx_ethtool_get_rxnfc()
876 info->rule_cnt = in efx_ethtool_get_rxnfc()
882 return -EOPNOTSUPP; in efx_ethtool_get_rxnfc()
883 rc = efx_ethtool_get_class_rule(efx, &info->fs, &rss_context); in efx_ethtool_get_rxnfc()
886 if (info->fs.flow_type & FLOW_RSS) in efx_ethtool_get_rxnfc()
887 info->rss_context = rss_context; in efx_ethtool_get_rxnfc()
891 info->data = efx_filter_get_rx_id_limit(efx); in efx_ethtool_get_rxnfc()
892 if (info->data == 0) in efx_ethtool_get_rxnfc()
893 return -EOPNOTSUPP; in efx_ethtool_get_rxnfc()
895 rule_locs, info->rule_cnt); in efx_ethtool_get_rxnfc()
898 info->rule_cnt = rc; in efx_ethtool_get_rxnfc()
902 return -EOPNOTSUPP; in efx_ethtool_get_rxnfc()
920 struct ethtool_tcpip4_spec *ip_entry = &rule->h_u.tcp_ip4_spec; in efx_ethtool_set_class_rule()
921 struct ethtool_tcpip4_spec *ip_mask = &rule->m_u.tcp_ip4_spec; in efx_ethtool_set_class_rule()
922 struct ethtool_usrip4_spec *uip_entry = &rule->h_u.usr_ip4_spec; in efx_ethtool_set_class_rule()
923 struct ethtool_usrip4_spec *uip_mask = &rule->m_u.usr_ip4_spec; in efx_ethtool_set_class_rule()
924 struct ethtool_tcpip6_spec *ip6_entry = &rule->h_u.tcp_ip6_spec; in efx_ethtool_set_class_rule()
925 struct ethtool_tcpip6_spec *ip6_mask = &rule->m_u.tcp_ip6_spec; in efx_ethtool_set_class_rule()
926 struct ethtool_usrip6_spec *uip6_entry = &rule->h_u.usr_ip6_spec; in efx_ethtool_set_class_rule()
927 struct ethtool_usrip6_spec *uip6_mask = &rule->m_u.usr_ip6_spec; in efx_ethtool_set_class_rule()
928 u32 flow_type = rule->flow_type & ~(FLOW_EXT | FLOW_RSS); in efx_ethtool_set_class_rule()
929 struct ethhdr *mac_entry = &rule->h_u.ether_spec; in efx_ethtool_set_class_rule()
930 struct ethhdr *mac_mask = &rule->m_u.ether_spec; in efx_ethtool_set_class_rule()
936 if (rule->location != RX_CLS_LOC_ANY) in efx_ethtool_set_class_rule()
937 return -EINVAL; in efx_ethtool_set_class_rule()
939 /* Range-check ring_cookie */ in efx_ethtool_set_class_rule()
940 if (rule->ring_cookie >= efx->n_rx_channels && in efx_ethtool_set_class_rule()
941 rule->ring_cookie != RX_CLS_FLOW_DISC) in efx_ethtool_set_class_rule()
942 return -EINVAL; in efx_ethtool_set_class_rule()
945 if ((rule->flow_type & FLOW_EXT) && in efx_ethtool_set_class_rule()
946 (rule->m_ext.vlan_etype || rule->m_ext.data[0] || in efx_ethtool_set_class_rule()
947 rule->m_ext.data[1])) in efx_ethtool_set_class_rule()
948 return -EINVAL; in efx_ethtool_set_class_rule()
950 if (efx->rx_scatter) in efx_ethtool_set_class_rule()
952 if (rule->flow_type & FLOW_RSS) in efx_ethtool_set_class_rule()
956 (rule->ring_cookie == RX_CLS_FLOW_DISC) ? in efx_ethtool_set_class_rule()
957 EFX_FILTER_RX_DMAQ_ID_DROP : rule->ring_cookie); in efx_ethtool_set_class_rule()
959 if (rule->flow_type & FLOW_RSS) in efx_ethtool_set_class_rule()
970 if (ip_mask->ip4dst) { in efx_ethtool_set_class_rule()
971 if (ip_mask->ip4dst != IP4_ADDR_FULL_MASK) in efx_ethtool_set_class_rule()
972 return -EINVAL; in efx_ethtool_set_class_rule()
974 spec.loc_host[0] = ip_entry->ip4dst; in efx_ethtool_set_class_rule()
976 if (ip_mask->ip4src) { in efx_ethtool_set_class_rule()
977 if (ip_mask->ip4src != IP4_ADDR_FULL_MASK) in efx_ethtool_set_class_rule()
978 return -EINVAL; in efx_ethtool_set_class_rule()
980 spec.rem_host[0] = ip_entry->ip4src; in efx_ethtool_set_class_rule()
982 if (ip_mask->pdst) { in efx_ethtool_set_class_rule()
983 if (ip_mask->pdst != PORT_FULL_MASK) in efx_ethtool_set_class_rule()
984 return -EINVAL; in efx_ethtool_set_class_rule()
986 spec.loc_port = ip_entry->pdst; in efx_ethtool_set_class_rule()
988 if (ip_mask->psrc) { in efx_ethtool_set_class_rule()
989 if (ip_mask->psrc != PORT_FULL_MASK) in efx_ethtool_set_class_rule()
990 return -EINVAL; in efx_ethtool_set_class_rule()
992 spec.rem_port = ip_entry->psrc; in efx_ethtool_set_class_rule()
994 if (ip_mask->tos) in efx_ethtool_set_class_rule()
995 return -EINVAL; in efx_ethtool_set_class_rule()
1005 if (!ip6_mask_is_empty(ip6_mask->ip6dst)) { in efx_ethtool_set_class_rule()
1006 if (!ip6_mask_is_full(ip6_mask->ip6dst)) in efx_ethtool_set_class_rule()
1007 return -EINVAL; in efx_ethtool_set_class_rule()
1009 memcpy(spec.loc_host, ip6_entry->ip6dst, sizeof(spec.loc_host)); in efx_ethtool_set_class_rule()
1011 if (!ip6_mask_is_empty(ip6_mask->ip6src)) { in efx_ethtool_set_class_rule()
1012 if (!ip6_mask_is_full(ip6_mask->ip6src)) in efx_ethtool_set_class_rule()
1013 return -EINVAL; in efx_ethtool_set_class_rule()
1015 memcpy(spec.rem_host, ip6_entry->ip6src, sizeof(spec.rem_host)); in efx_ethtool_set_class_rule()
1017 if (ip6_mask->pdst) { in efx_ethtool_set_class_rule()
1018 if (ip6_mask->pdst != PORT_FULL_MASK) in efx_ethtool_set_class_rule()
1019 return -EINVAL; in efx_ethtool_set_class_rule()
1021 spec.loc_port = ip6_entry->pdst; in efx_ethtool_set_class_rule()
1023 if (ip6_mask->psrc) { in efx_ethtool_set_class_rule()
1024 if (ip6_mask->psrc != PORT_FULL_MASK) in efx_ethtool_set_class_rule()
1025 return -EINVAL; in efx_ethtool_set_class_rule()
1027 spec.rem_port = ip6_entry->psrc; in efx_ethtool_set_class_rule()
1029 if (ip6_mask->tclass) in efx_ethtool_set_class_rule()
1030 return -EINVAL; in efx_ethtool_set_class_rule()
1034 if (uip_mask->l4_4_bytes || uip_mask->tos || uip_mask->ip_ver || in efx_ethtool_set_class_rule()
1035 uip_entry->ip_ver != ETH_RX_NFC_IP4) in efx_ethtool_set_class_rule()
1036 return -EINVAL; in efx_ethtool_set_class_rule()
1039 if (uip_mask->ip4dst) { in efx_ethtool_set_class_rule()
1040 if (uip_mask->ip4dst != IP4_ADDR_FULL_MASK) in efx_ethtool_set_class_rule()
1041 return -EINVAL; in efx_ethtool_set_class_rule()
1043 spec.loc_host[0] = uip_entry->ip4dst; in efx_ethtool_set_class_rule()
1045 if (uip_mask->ip4src) { in efx_ethtool_set_class_rule()
1046 if (uip_mask->ip4src != IP4_ADDR_FULL_MASK) in efx_ethtool_set_class_rule()
1047 return -EINVAL; in efx_ethtool_set_class_rule()
1049 spec.rem_host[0] = uip_entry->ip4src; in efx_ethtool_set_class_rule()
1051 if (uip_mask->proto) { in efx_ethtool_set_class_rule()
1052 if (uip_mask->proto != IP_PROTO_FULL_MASK) in efx_ethtool_set_class_rule()
1053 return -EINVAL; in efx_ethtool_set_class_rule()
1055 spec.ip_proto = uip_entry->proto; in efx_ethtool_set_class_rule()
1060 if (uip6_mask->l4_4_bytes || uip6_mask->tclass) in efx_ethtool_set_class_rule()
1061 return -EINVAL; in efx_ethtool_set_class_rule()
1064 if (!ip6_mask_is_empty(uip6_mask->ip6dst)) { in efx_ethtool_set_class_rule()
1065 if (!ip6_mask_is_full(uip6_mask->ip6dst)) in efx_ethtool_set_class_rule()
1066 return -EINVAL; in efx_ethtool_set_class_rule()
1068 memcpy(spec.loc_host, uip6_entry->ip6dst, sizeof(spec.loc_host)); in efx_ethtool_set_class_rule()
1070 if (!ip6_mask_is_empty(uip6_mask->ip6src)) { in efx_ethtool_set_class_rule()
1071 if (!ip6_mask_is_full(uip6_mask->ip6src)) in efx_ethtool_set_class_rule()
1072 return -EINVAL; in efx_ethtool_set_class_rule()
1074 memcpy(spec.rem_host, uip6_entry->ip6src, sizeof(spec.rem_host)); in efx_ethtool_set_class_rule()
1076 if (uip6_mask->l4_proto) { in efx_ethtool_set_class_rule()
1077 if (uip6_mask->l4_proto != IP_PROTO_FULL_MASK) in efx_ethtool_set_class_rule()
1078 return -EINVAL; in efx_ethtool_set_class_rule()
1080 spec.ip_proto = uip6_entry->l4_proto; in efx_ethtool_set_class_rule()
1085 if (!is_zero_ether_addr(mac_mask->h_dest)) { in efx_ethtool_set_class_rule()
1086 if (ether_addr_equal(mac_mask->h_dest, in efx_ethtool_set_class_rule()
1089 else if (is_broadcast_ether_addr(mac_mask->h_dest)) in efx_ethtool_set_class_rule()
1092 return -EINVAL; in efx_ethtool_set_class_rule()
1093 ether_addr_copy(spec.loc_mac, mac_entry->h_dest); in efx_ethtool_set_class_rule()
1095 if (!is_zero_ether_addr(mac_mask->h_source)) { in efx_ethtool_set_class_rule()
1096 if (!is_broadcast_ether_addr(mac_mask->h_source)) in efx_ethtool_set_class_rule()
1097 return -EINVAL; in efx_ethtool_set_class_rule()
1099 ether_addr_copy(spec.rem_mac, mac_entry->h_source); in efx_ethtool_set_class_rule()
1101 if (mac_mask->h_proto) { in efx_ethtool_set_class_rule()
1102 if (mac_mask->h_proto != ETHER_TYPE_FULL_MASK) in efx_ethtool_set_class_rule()
1103 return -EINVAL; in efx_ethtool_set_class_rule()
1105 spec.ether_type = mac_entry->h_proto; in efx_ethtool_set_class_rule()
1110 return -EINVAL; in efx_ethtool_set_class_rule()
1113 if ((rule->flow_type & FLOW_EXT) && rule->m_ext.vlan_tci) { in efx_ethtool_set_class_rule()
1114 if (rule->m_ext.vlan_tci != htons(0xfff)) in efx_ethtool_set_class_rule()
1115 return -EINVAL; in efx_ethtool_set_class_rule()
1117 spec.outer_vid = rule->h_ext.vlan_tci; in efx_ethtool_set_class_rule()
1124 rule->location = rc; in efx_ethtool_set_class_rule()
1134 return -EOPNOTSUPP; in efx_ethtool_set_rxnfc()
1136 switch (info->cmd) { in efx_ethtool_set_rxnfc()
1138 return efx_ethtool_set_class_rule(efx, &info->fs, in efx_ethtool_set_rxnfc()
1139 info->rss_context); in efx_ethtool_set_rxnfc()
1143 info->fs.location); in efx_ethtool_set_rxnfc()
1146 return -EOPNOTSUPP; in efx_ethtool_set_rxnfc()
1154 if (efx->n_rx_channels == 1) in efx_ethtool_get_rxfh_indir_size()
1156 return ARRAY_SIZE(efx->rss_context.rx_indir_table); in efx_ethtool_get_rxfh_indir_size()
1163 return efx->type->rx_hash_key_size; in efx_ethtool_get_rxfh_key_size()
1172 if (rxfh->rss_context) /* core should never call us for these */ in efx_ethtool_get_rxfh()
1173 return -EINVAL; in efx_ethtool_get_rxfh()
1175 rc = efx->type->rx_pull_rss_config(efx); in efx_ethtool_get_rxfh()
1179 rxfh->hfunc = ETH_RSS_HASH_TOP; in efx_ethtool_get_rxfh()
1180 if (rxfh->indir) in efx_ethtool_get_rxfh()
1181 memcpy(rxfh->indir, efx->rss_context.rx_indir_table, in efx_ethtool_get_rxfh()
1182 sizeof(efx->rss_context.rx_indir_table)); in efx_ethtool_get_rxfh()
1183 if (rxfh->key) in efx_ethtool_get_rxfh()
1184 memcpy(rxfh->key, efx->rss_context.rx_hash_key, in efx_ethtool_get_rxfh()
1185 efx->type->rx_hash_key_size); in efx_ethtool_get_rxfh()
1196 const u32 *indir = rxfh->indir; in efx_ethtool_modify_rxfh_context()
1197 const u8 *key = rxfh->key; in efx_ethtool_modify_rxfh_context()
1199 if (!efx->type->rx_push_rss_context_config) { in efx_ethtool_modify_rxfh_context()
1202 return -EOPNOTSUPP; in efx_ethtool_modify_rxfh_context()
1205 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in efx_ethtool_modify_rxfh_context()
1206 rxfh->hfunc != ETH_RSS_HASH_TOP) { in efx_ethtool_modify_rxfh_context()
1208 return -EOPNOTSUPP; in efx_ethtool_modify_rxfh_context()
1218 return efx->type->rx_push_rss_context_config(efx, priv, indir, key, in efx_ethtool_modify_rxfh_context()
1232 priv->context_id = EFX_MCDI_RSS_CONTEXT_INVALID; in efx_ethtool_create_rxfh_context()
1233 priv->rx_hash_udp_4tuple = false; in efx_ethtool_create_rxfh_context()
1239 if (!rxfh->indir) in efx_ethtool_create_rxfh_context()
1241 if (!rxfh->key) in efx_ethtool_create_rxfh_context()
1243 ctx->key_size); in efx_ethtool_create_rxfh_context()
1244 if (rxfh->hfunc == ETH_RSS_HASH_NO_CHANGE) in efx_ethtool_create_rxfh_context()
1245 ctx->hfunc = ETH_RSS_HASH_TOP; in efx_ethtool_create_rxfh_context()
1246 if (rxfh->input_xfrm == RXH_XFRM_NO_CHANGE) in efx_ethtool_create_rxfh_context()
1247 ctx->input_xfrm = 0; in efx_ethtool_create_rxfh_context()
1259 if (!efx->type->rx_push_rss_context_config) { in efx_ethtool_remove_rxfh_context()
1262 return -EOPNOTSUPP; in efx_ethtool_remove_rxfh_context()
1266 return efx->type->rx_push_rss_context_config(efx, priv, NULL, NULL, in efx_ethtool_remove_rxfh_context()
1275 u32 *indir = rxfh->indir; in efx_ethtool_set_rxfh()
1276 u8 *key = rxfh->key; in efx_ethtool_set_rxfh()
1279 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in efx_ethtool_set_rxfh()
1280 rxfh->hfunc != ETH_RSS_HASH_TOP) in efx_ethtool_set_rxfh()
1281 return -EOPNOTSUPP; in efx_ethtool_set_rxfh()
1284 if (WARN_ON_ONCE(rxfh->rss_context)) in efx_ethtool_set_rxfh()
1285 return -EIO; in efx_ethtool_set_rxfh()
1291 key = efx->rss_context.rx_hash_key; in efx_ethtool_set_rxfh()
1293 indir = efx->rss_context.rx_indir_table; in efx_ethtool_set_rxfh()
1295 return efx->type->rx_push_rss_config(efx, true, indir, key); in efx_ethtool_set_rxfh()
1303 rc = efx->type->map_reset_flags(flags); in efx_ethtool_reset()
1317 mutex_lock(&efx->mac_lock); in efx_ethtool_get_module_eeprom()
1319 mutex_unlock(&efx->mac_lock); in efx_ethtool_get_module_eeprom()
1330 mutex_lock(&efx->mac_lock); in efx_ethtool_get_module_info()
1332 mutex_unlock(&efx->mac_lock); in efx_ethtool_get_module_info()