Lines Matching +full:spec +full:-

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 strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); in efx_siena_ethtool_get_drvinfo()
109 efx_siena_mcdi_print_fwver(efx, info->fw_version, in efx_siena_ethtool_get_drvinfo()
110 sizeof(info->fw_version)); in efx_siena_ethtool_get_drvinfo()
111 strscpy(info->bus_info, pci_name(efx->pci_dev), sizeof(info->bus_info)); in efx_siena_ethtool_get_drvinfo()
118 return efx->msg_enable; in efx_siena_ethtool_get_msglevel()
125 efx->msg_enable = msg_enable; in efx_siena_ethtool_set_msglevel()
133 pause->rx_pause = !!(efx->wanted_fc & EFX_FC_RX); in efx_siena_ethtool_get_pauseparam()
134 pause->tx_pause = !!(efx->wanted_fc & EFX_FC_TX); in efx_siena_ethtool_get_pauseparam()
135 pause->autoneg = !!(efx->wanted_fc & EFX_FC_AUTO); in efx_siena_ethtool_get_pauseparam()
146 mutex_lock(&efx->mac_lock); in efx_siena_ethtool_set_pauseparam()
148 wanted_fc = ((pause->rx_pause ? EFX_FC_RX : 0) | in efx_siena_ethtool_set_pauseparam()
149 (pause->tx_pause ? EFX_FC_TX : 0) | in efx_siena_ethtool_set_pauseparam()
150 (pause->autoneg ? EFX_FC_AUTO : 0)); in efx_siena_ethtool_set_pauseparam()
153 netif_dbg(efx, drv, efx->net_dev, in efx_siena_ethtool_set_pauseparam()
155 rc = -EINVAL; in efx_siena_ethtool_set_pauseparam()
159 if ((wanted_fc & EFX_FC_AUTO) && !efx->link_advertising[0]) { in efx_siena_ethtool_set_pauseparam()
160 netif_dbg(efx, drv, efx->net_dev, in efx_siena_ethtool_set_pauseparam()
162 rc = -EINVAL; in efx_siena_ethtool_set_pauseparam()
167 if (efx->type->prepare_enable_fc_tx && in efx_siena_ethtool_set_pauseparam()
168 (wanted_fc & EFX_FC_TX) && !(efx->wanted_fc & EFX_FC_TX)) in efx_siena_ethtool_set_pauseparam()
169 efx->type->prepare_enable_fc_tx(efx); in efx_siena_ethtool_set_pauseparam()
171 old_adv = efx->link_advertising[0]; in efx_siena_ethtool_set_pauseparam()
172 old_fc = efx->wanted_fc; in efx_siena_ethtool_set_pauseparam()
174 if (efx->link_advertising[0] != old_adv || in efx_siena_ethtool_set_pauseparam()
175 (efx->wanted_fc ^ old_fc) & EFX_FC_AUTO) { in efx_siena_ethtool_set_pauseparam()
178 netif_err(efx, drv, efx->net_dev, in efx_siena_ethtool_set_pauseparam()
191 mutex_unlock(&efx->mac_lock); in efx_siena_ethtool_set_pauseparam()
197 * efx_fill_test - fill in an individual self-test entry
207 * Fill in an individual self-test entry.
229 "%-6s %-24s", unit_str, test_str); in efx_fill_test()
233 #define EFX_CHANNEL_NAME(_channel) "chan%d", _channel->channel
234 #define EFX_TX_QUEUE_NAME(_tx_queue) "txq%d", _tx_queue->label
239 * efx_fill_loopback_test - fill in a block of loopback self-test entries
241 * @lb_tests: Efx loopback self-test results structure
247 * Fill in a block of loopback self-test entries. Return new test
257 efx_get_channel(efx, efx->tx_channel_offset); in efx_fill_loopback_test()
262 &lb_tests->tx_sent[tx_queue->label], in efx_fill_loopback_test()
266 &lb_tests->tx_done[tx_queue->label], in efx_fill_loopback_test()
271 &lb_tests->rx_good, in efx_fill_loopback_test()
275 &lb_tests->rx_bad, in efx_fill_loopback_test()
283 * efx_ethtool_fill_self_tests - get self-test details
285 * @tests: Efx self-test results structure, or %NULL
289 * Get self-test number of strings, strings, and/or test results.
303 efx_fill_test(n++, strings, data, &tests->phy_alive, in efx_ethtool_fill_self_tests()
305 efx_fill_test(n++, strings, data, &tests->nvram, in efx_ethtool_fill_self_tests()
307 efx_fill_test(n++, strings, data, &tests->interrupt, in efx_ethtool_fill_self_tests()
313 &tests->eventq_dma[channel->channel], in efx_ethtool_fill_self_tests()
317 &tests->eventq_int[channel->channel], in efx_ethtool_fill_self_tests()
322 efx_fill_test(n++, strings, data, &tests->memory, in efx_ethtool_fill_self_tests()
324 efx_fill_test(n++, strings, data, &tests->registers, in efx_ethtool_fill_self_tests()
335 efx_fill_test(n++, strings, data, &tests->phy_ext[i], "phy", 0, name, NULL); in efx_ethtool_fill_self_tests()
340 if (!(efx->loopback_modes & (1 << mode))) in efx_ethtool_fill_self_tests()
343 &tests->loopback[mode], mode, n, in efx_ethtool_fill_self_tests()
356 int rc = -ENOMEM; in efx_siena_ethtool_self_test()
362 if (efx->state != STATE_READY) { in efx_siena_ethtool_self_test()
363 rc = -EBUSY; in efx_siena_ethtool_self_test()
367 netif_info(efx, drv, efx->net_dev, "starting %sline testing\n", in efx_siena_ethtool_self_test()
368 (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); in efx_siena_ethtool_self_test()
371 already_up = (efx->net_dev->flags & IFF_UP); in efx_siena_ethtool_self_test()
373 rc = dev_open(efx->net_dev, NULL); in efx_siena_ethtool_self_test()
375 netif_err(efx, drv, efx->net_dev, in efx_siena_ethtool_self_test()
381 rc = efx_siena_selftest(efx, efx_tests, test->flags); in efx_siena_ethtool_self_test()
384 dev_close(efx->net_dev); in efx_siena_ethtool_self_test()
386 netif_info(efx, drv, efx->net_dev, "%s %sline self-tests\n", in efx_siena_ethtool_self_test()
388 (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); in efx_siena_ethtool_self_test()
395 test->flags |= ETH_TEST_FL_FAILED; in efx_siena_ethtool_self_test()
409 ethtool_sprintf(strings, "tx-%u.tx_packets", in efx_describe_per_queue_stats()
410 channel->tx_queue[0].queue / in efx_describe_per_queue_stats()
420 ethtool_sprintf(strings, "rx-%d.rx_packets", in efx_describe_per_queue_stats()
421 channel->channel); in efx_describe_per_queue_stats()
424 if (efx->xdp_tx_queue_count && efx->xdp_tx_queues) { in efx_describe_per_queue_stats()
427 for (xdp = 0; xdp < efx->xdp_tx_queue_count; xdp++) { in efx_describe_per_queue_stats()
432 ethtool_sprintf(strings, "tx-xdp-cpu-%hu.tx_packets", in efx_describe_per_queue_stats()
446 return efx->type->describe_stats(efx, NULL) + in efx_siena_ethtool_get_sset_count()
453 return -EINVAL; in efx_siena_ethtool_get_sset_count()
465 efx->type->describe_stats(efx, &strings); in efx_siena_ethtool_get_strings()
491 spin_lock_bh(&efx->stats_lock); in efx_siena_ethtool_get_stats()
494 data += efx->type->update_stats(efx, data, NULL); in efx_siena_ethtool_get_stats()
499 switch (stat->source) { in efx_siena_ethtool_get_stats()
501 data[i] = stat->get_stat((void *)efx + stat->offset); in efx_siena_ethtool_get_stats()
506 data[i] += stat->get_stat((void *)channel + in efx_siena_ethtool_get_stats()
507 stat->offset); in efx_siena_ethtool_get_stats()
514 stat->get_stat((void *)tx_queue in efx_siena_ethtool_get_stats()
515 + stat->offset); in efx_siena_ethtool_get_stats()
522 spin_unlock_bh(&efx->stats_lock); in efx_siena_ethtool_get_stats()
528 *data += tx_queue->tx_packets; in efx_siena_ethtool_get_stats()
537 *data += rx_queue->rx_packets; in efx_siena_ethtool_get_stats()
542 if (efx->xdp_tx_queue_count && efx->xdp_tx_queues) { in efx_siena_ethtool_get_stats()
545 for (xdp = 0; xdp < efx->xdp_tx_queue_count; xdp++) { in efx_siena_ethtool_get_stats()
546 data[0] = efx->xdp_tx_queues[xdp]->tx_packets; in efx_siena_ethtool_get_stats()
559 struct efx_link_state *link_state = &efx->link_state; in efx_siena_ethtool_get_link_ksettings()
561 mutex_lock(&efx->mac_lock); in efx_siena_ethtool_get_link_ksettings()
563 mutex_unlock(&efx->mac_lock); in efx_siena_ethtool_get_link_ksettings()
565 /* Both MACs support pause frames (bidirectional and respond-only) */ in efx_siena_ethtool_get_link_ksettings()
570 cmd->base.speed = link_state->speed; in efx_siena_ethtool_get_link_ksettings()
571 cmd->base.duplex = link_state->fd ? DUPLEX_FULL : DUPLEX_HALF; in efx_siena_ethtool_get_link_ksettings()
586 if ((cmd->base.speed == SPEED_1000) && in efx_siena_ethtool_set_link_ksettings()
587 (cmd->base.duplex != DUPLEX_FULL)) { in efx_siena_ethtool_set_link_ksettings()
588 netif_dbg(efx, drv, efx->net_dev, in efx_siena_ethtool_set_link_ksettings()
590 return -EINVAL; in efx_siena_ethtool_set_link_ksettings()
593 mutex_lock(&efx->mac_lock); in efx_siena_ethtool_set_link_ksettings()
595 mutex_unlock(&efx->mac_lock); in efx_siena_ethtool_set_link_ksettings()
605 mutex_lock(&efx->mac_lock); in efx_siena_ethtool_get_fecparam()
607 mutex_unlock(&efx->mac_lock); in efx_siena_ethtool_get_fecparam()
618 mutex_lock(&efx->mac_lock); in efx_siena_ethtool_set_fecparam()
620 mutex_unlock(&efx->mac_lock); in efx_siena_ethtool_set_fecparam()
642 struct ethtool_tcpip4_spec *ip_entry = &rule->h_u.tcp_ip4_spec; in efx_ethtool_get_class_rule()
643 struct ethtool_tcpip4_spec *ip_mask = &rule->m_u.tcp_ip4_spec; in efx_ethtool_get_class_rule()
644 struct ethtool_usrip4_spec *uip_entry = &rule->h_u.usr_ip4_spec; in efx_ethtool_get_class_rule()
645 struct ethtool_usrip4_spec *uip_mask = &rule->m_u.usr_ip4_spec; in efx_ethtool_get_class_rule()
646 struct ethtool_tcpip6_spec *ip6_entry = &rule->h_u.tcp_ip6_spec; in efx_ethtool_get_class_rule()
647 struct ethtool_tcpip6_spec *ip6_mask = &rule->m_u.tcp_ip6_spec; in efx_ethtool_get_class_rule()
648 struct ethtool_usrip6_spec *uip6_entry = &rule->h_u.usr_ip6_spec; in efx_ethtool_get_class_rule()
649 struct ethtool_usrip6_spec *uip6_mask = &rule->m_u.usr_ip6_spec; in efx_ethtool_get_class_rule()
650 struct ethhdr *mac_entry = &rule->h_u.ether_spec; in efx_ethtool_get_class_rule()
651 struct ethhdr *mac_mask = &rule->m_u.ether_spec; in efx_ethtool_get_class_rule()
652 struct efx_filter_spec spec; in efx_ethtool_get_class_rule() local
656 rule->location, &spec); in efx_ethtool_get_class_rule()
660 if (spec.dmaq_id == EFX_FILTER_RX_DMAQ_ID_DROP) in efx_ethtool_get_class_rule()
661 rule->ring_cookie = RX_CLS_FLOW_DISC; in efx_ethtool_get_class_rule()
663 rule->ring_cookie = spec.dmaq_id; in efx_ethtool_get_class_rule()
665 if ((spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE) && in efx_ethtool_get_class_rule()
666 spec.ether_type == htons(ETH_P_IP) && in efx_ethtool_get_class_rule()
667 (spec.match_flags & EFX_FILTER_MATCH_IP_PROTO) && in efx_ethtool_get_class_rule()
668 (spec.ip_proto == IPPROTO_TCP || spec.ip_proto == IPPROTO_UDP) && in efx_ethtool_get_class_rule()
669 !(spec.match_flags & in efx_ethtool_get_class_rule()
674 rule->flow_type = ((spec.ip_proto == IPPROTO_TCP) ? in efx_ethtool_get_class_rule()
676 if (spec.match_flags & EFX_FILTER_MATCH_LOC_HOST) { in efx_ethtool_get_class_rule()
677 ip_entry->ip4dst = spec.loc_host[0]; in efx_ethtool_get_class_rule()
678 ip_mask->ip4dst = IP4_ADDR_FULL_MASK; in efx_ethtool_get_class_rule()
680 if (spec.match_flags & EFX_FILTER_MATCH_REM_HOST) { in efx_ethtool_get_class_rule()
681 ip_entry->ip4src = spec.rem_host[0]; in efx_ethtool_get_class_rule()
682 ip_mask->ip4src = IP4_ADDR_FULL_MASK; in efx_ethtool_get_class_rule()
684 if (spec.match_flags & EFX_FILTER_MATCH_LOC_PORT) { in efx_ethtool_get_class_rule()
685 ip_entry->pdst = spec.loc_port; in efx_ethtool_get_class_rule()
686 ip_mask->pdst = PORT_FULL_MASK; in efx_ethtool_get_class_rule()
688 if (spec.match_flags & EFX_FILTER_MATCH_REM_PORT) { in efx_ethtool_get_class_rule()
689 ip_entry->psrc = spec.rem_port; in efx_ethtool_get_class_rule()
690 ip_mask->psrc = PORT_FULL_MASK; in efx_ethtool_get_class_rule()
692 } else if ((spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE) && in efx_ethtool_get_class_rule()
693 spec.ether_type == htons(ETH_P_IPV6) && in efx_ethtool_get_class_rule()
694 (spec.match_flags & EFX_FILTER_MATCH_IP_PROTO) && in efx_ethtool_get_class_rule()
695 (spec.ip_proto == IPPROTO_TCP || spec.ip_proto == IPPROTO_UDP) && in efx_ethtool_get_class_rule()
696 !(spec.match_flags & in efx_ethtool_get_class_rule()
701 rule->flow_type = ((spec.ip_proto == IPPROTO_TCP) ? in efx_ethtool_get_class_rule()
703 if (spec.match_flags & EFX_FILTER_MATCH_LOC_HOST) { in efx_ethtool_get_class_rule()
704 memcpy(ip6_entry->ip6dst, spec.loc_host, in efx_ethtool_get_class_rule()
705 sizeof(ip6_entry->ip6dst)); in efx_ethtool_get_class_rule()
706 ip6_fill_mask(ip6_mask->ip6dst); in efx_ethtool_get_class_rule()
708 if (spec.match_flags & EFX_FILTER_MATCH_REM_HOST) { in efx_ethtool_get_class_rule()
709 memcpy(ip6_entry->ip6src, spec.rem_host, in efx_ethtool_get_class_rule()
710 sizeof(ip6_entry->ip6src)); in efx_ethtool_get_class_rule()
711 ip6_fill_mask(ip6_mask->ip6src); in efx_ethtool_get_class_rule()
713 if (spec.match_flags & EFX_FILTER_MATCH_LOC_PORT) { in efx_ethtool_get_class_rule()
714 ip6_entry->pdst = spec.loc_port; in efx_ethtool_get_class_rule()
715 ip6_mask->pdst = PORT_FULL_MASK; in efx_ethtool_get_class_rule()
717 if (spec.match_flags & EFX_FILTER_MATCH_REM_PORT) { in efx_ethtool_get_class_rule()
718 ip6_entry->psrc = spec.rem_port; in efx_ethtool_get_class_rule()
719 ip6_mask->psrc = PORT_FULL_MASK; in efx_ethtool_get_class_rule()
721 } else if (!(spec.match_flags & in efx_ethtool_get_class_rule()
725 rule->flow_type = ETHER_FLOW; in efx_ethtool_get_class_rule()
726 if (spec.match_flags & in efx_ethtool_get_class_rule()
728 ether_addr_copy(mac_entry->h_dest, spec.loc_mac); in efx_ethtool_get_class_rule()
729 if (spec.match_flags & EFX_FILTER_MATCH_LOC_MAC) in efx_ethtool_get_class_rule()
730 eth_broadcast_addr(mac_mask->h_dest); in efx_ethtool_get_class_rule()
732 ether_addr_copy(mac_mask->h_dest, in efx_ethtool_get_class_rule()
735 if (spec.match_flags & EFX_FILTER_MATCH_REM_MAC) { in efx_ethtool_get_class_rule()
736 ether_addr_copy(mac_entry->h_source, spec.rem_mac); in efx_ethtool_get_class_rule()
737 eth_broadcast_addr(mac_mask->h_source); in efx_ethtool_get_class_rule()
739 if (spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE) { in efx_ethtool_get_class_rule()
740 mac_entry->h_proto = spec.ether_type; in efx_ethtool_get_class_rule()
741 mac_mask->h_proto = ETHER_TYPE_FULL_MASK; in efx_ethtool_get_class_rule()
743 } else if (spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE && in efx_ethtool_get_class_rule()
744 spec.ether_type == htons(ETH_P_IP) && in efx_ethtool_get_class_rule()
745 !(spec.match_flags & in efx_ethtool_get_class_rule()
749 rule->flow_type = IPV4_USER_FLOW; in efx_ethtool_get_class_rule()
750 uip_entry->ip_ver = ETH_RX_NFC_IP4; in efx_ethtool_get_class_rule()
751 if (spec.match_flags & EFX_FILTER_MATCH_IP_PROTO) { in efx_ethtool_get_class_rule()
752 uip_mask->proto = IP_PROTO_FULL_MASK; in efx_ethtool_get_class_rule()
753 uip_entry->proto = spec.ip_proto; in efx_ethtool_get_class_rule()
755 if (spec.match_flags & EFX_FILTER_MATCH_LOC_HOST) { in efx_ethtool_get_class_rule()
756 uip_entry->ip4dst = spec.loc_host[0]; in efx_ethtool_get_class_rule()
757 uip_mask->ip4dst = IP4_ADDR_FULL_MASK; in efx_ethtool_get_class_rule()
759 if (spec.match_flags & EFX_FILTER_MATCH_REM_HOST) { in efx_ethtool_get_class_rule()
760 uip_entry->ip4src = spec.rem_host[0]; in efx_ethtool_get_class_rule()
761 uip_mask->ip4src = IP4_ADDR_FULL_MASK; in efx_ethtool_get_class_rule()
763 } else if (spec.match_flags & EFX_FILTER_MATCH_ETHER_TYPE && in efx_ethtool_get_class_rule()
764 spec.ether_type == htons(ETH_P_IPV6) && in efx_ethtool_get_class_rule()
765 !(spec.match_flags & in efx_ethtool_get_class_rule()
769 rule->flow_type = IPV6_USER_FLOW; in efx_ethtool_get_class_rule()
770 if (spec.match_flags & EFX_FILTER_MATCH_IP_PROTO) { in efx_ethtool_get_class_rule()
771 uip6_mask->l4_proto = IP_PROTO_FULL_MASK; in efx_ethtool_get_class_rule()
772 uip6_entry->l4_proto = spec.ip_proto; in efx_ethtool_get_class_rule()
774 if (spec.match_flags & EFX_FILTER_MATCH_LOC_HOST) { in efx_ethtool_get_class_rule()
775 memcpy(uip6_entry->ip6dst, spec.loc_host, in efx_ethtool_get_class_rule()
776 sizeof(uip6_entry->ip6dst)); in efx_ethtool_get_class_rule()
777 ip6_fill_mask(uip6_mask->ip6dst); in efx_ethtool_get_class_rule()
779 if (spec.match_flags & EFX_FILTER_MATCH_REM_HOST) { in efx_ethtool_get_class_rule()
780 memcpy(uip6_entry->ip6src, spec.rem_host, in efx_ethtool_get_class_rule()
781 sizeof(uip6_entry->ip6src)); in efx_ethtool_get_class_rule()
782 ip6_fill_mask(uip6_mask->ip6src); in efx_ethtool_get_class_rule()
787 return -EINVAL; in efx_ethtool_get_class_rule()
790 if (spec.match_flags & EFX_FILTER_MATCH_OUTER_VID) { in efx_ethtool_get_class_rule()
791 rule->flow_type |= FLOW_EXT; in efx_ethtool_get_class_rule()
792 rule->h_ext.vlan_tci = spec.outer_vid; in efx_ethtool_get_class_rule()
793 rule->m_ext.vlan_tci = htons(0xfff); in efx_ethtool_get_class_rule()
796 if (spec.flags & EFX_FILTER_FLAG_RX_RSS) { in efx_ethtool_get_class_rule()
797 rule->flow_type |= FLOW_RSS; in efx_ethtool_get_class_rule()
798 *rss_context = spec.rss_context; in efx_ethtool_get_class_rule()
811 switch (info->cmd) { in efx_siena_ethtool_get_rxnfc()
813 info->data = efx->n_rx_channels; in efx_siena_ethtool_get_rxnfc()
820 if (!efx_rss_active(&efx->rss_context)) /* No RSS */ in efx_siena_ethtool_get_rxnfc()
823 switch (info->flow_type) { in efx_siena_ethtool_get_rxnfc()
826 if (efx->rss_context.rx_hash_udp_4tuple) in efx_siena_ethtool_get_rxnfc()
849 info->data = data; in efx_siena_ethtool_get_rxnfc()
854 info->data = efx_filter_get_rx_id_limit(efx); in efx_siena_ethtool_get_rxnfc()
855 if (info->data == 0) in efx_siena_ethtool_get_rxnfc()
856 return -EOPNOTSUPP; in efx_siena_ethtool_get_rxnfc()
857 info->data |= RX_CLS_LOC_SPECIAL; in efx_siena_ethtool_get_rxnfc()
858 info->rule_cnt = in efx_siena_ethtool_get_rxnfc()
864 return -EOPNOTSUPP; in efx_siena_ethtool_get_rxnfc()
865 rc = efx_ethtool_get_class_rule(efx, &info->fs, &rss_context); in efx_siena_ethtool_get_rxnfc()
868 if (info->fs.flow_type & FLOW_RSS) in efx_siena_ethtool_get_rxnfc()
869 info->rss_context = rss_context; in efx_siena_ethtool_get_rxnfc()
873 info->data = efx_filter_get_rx_id_limit(efx); in efx_siena_ethtool_get_rxnfc()
874 if (info->data == 0) in efx_siena_ethtool_get_rxnfc()
875 return -EOPNOTSUPP; in efx_siena_ethtool_get_rxnfc()
877 rule_locs, info->rule_cnt); in efx_siena_ethtool_get_rxnfc()
880 info->rule_cnt = rc; in efx_siena_ethtool_get_rxnfc()
884 return -EOPNOTSUPP; in efx_siena_ethtool_get_rxnfc()
902 struct ethtool_tcpip4_spec *ip_entry = &rule->h_u.tcp_ip4_spec; in efx_ethtool_set_class_rule()
903 struct ethtool_tcpip4_spec *ip_mask = &rule->m_u.tcp_ip4_spec; in efx_ethtool_set_class_rule()
904 struct ethtool_usrip4_spec *uip_entry = &rule->h_u.usr_ip4_spec; in efx_ethtool_set_class_rule()
905 struct ethtool_usrip4_spec *uip_mask = &rule->m_u.usr_ip4_spec; in efx_ethtool_set_class_rule()
906 struct ethtool_tcpip6_spec *ip6_entry = &rule->h_u.tcp_ip6_spec; in efx_ethtool_set_class_rule()
907 struct ethtool_tcpip6_spec *ip6_mask = &rule->m_u.tcp_ip6_spec; in efx_ethtool_set_class_rule()
908 struct ethtool_usrip6_spec *uip6_entry = &rule->h_u.usr_ip6_spec; in efx_ethtool_set_class_rule()
909 struct ethtool_usrip6_spec *uip6_mask = &rule->m_u.usr_ip6_spec; in efx_ethtool_set_class_rule()
910 u32 flow_type = rule->flow_type & ~(FLOW_EXT | FLOW_RSS); in efx_ethtool_set_class_rule()
911 struct ethhdr *mac_entry = &rule->h_u.ether_spec; in efx_ethtool_set_class_rule()
912 struct ethhdr *mac_mask = &rule->m_u.ether_spec; in efx_ethtool_set_class_rule()
914 struct efx_filter_spec spec; in efx_ethtool_set_class_rule() local
918 if (rule->location != RX_CLS_LOC_ANY) in efx_ethtool_set_class_rule()
919 return -EINVAL; in efx_ethtool_set_class_rule()
921 /* Range-check ring_cookie */ in efx_ethtool_set_class_rule()
922 if (rule->ring_cookie >= efx->n_rx_channels && in efx_ethtool_set_class_rule()
923 rule->ring_cookie != RX_CLS_FLOW_DISC) in efx_ethtool_set_class_rule()
924 return -EINVAL; in efx_ethtool_set_class_rule()
927 if ((rule->flow_type & FLOW_EXT) && in efx_ethtool_set_class_rule()
928 (rule->m_ext.vlan_etype || rule->m_ext.data[0] || in efx_ethtool_set_class_rule()
929 rule->m_ext.data[1])) in efx_ethtool_set_class_rule()
930 return -EINVAL; in efx_ethtool_set_class_rule()
932 if (efx->rx_scatter) in efx_ethtool_set_class_rule()
934 if (rule->flow_type & FLOW_RSS) in efx_ethtool_set_class_rule()
937 efx_filter_init_rx(&spec, EFX_FILTER_PRI_MANUAL, flags, in efx_ethtool_set_class_rule()
938 (rule->ring_cookie == RX_CLS_FLOW_DISC) ? in efx_ethtool_set_class_rule()
939 EFX_FILTER_RX_DMAQ_ID_DROP : rule->ring_cookie); in efx_ethtool_set_class_rule()
941 if (rule->flow_type & FLOW_RSS) in efx_ethtool_set_class_rule()
942 spec.rss_context = rss_context; in efx_ethtool_set_class_rule()
947 spec.match_flags = (EFX_FILTER_MATCH_ETHER_TYPE | in efx_ethtool_set_class_rule()
949 spec.ether_type = htons(ETH_P_IP); in efx_ethtool_set_class_rule()
950 spec.ip_proto = flow_type == TCP_V4_FLOW ? IPPROTO_TCP in efx_ethtool_set_class_rule()
952 if (ip_mask->ip4dst) { in efx_ethtool_set_class_rule()
953 if (ip_mask->ip4dst != IP4_ADDR_FULL_MASK) in efx_ethtool_set_class_rule()
954 return -EINVAL; in efx_ethtool_set_class_rule()
955 spec.match_flags |= EFX_FILTER_MATCH_LOC_HOST; in efx_ethtool_set_class_rule()
956 spec.loc_host[0] = ip_entry->ip4dst; in efx_ethtool_set_class_rule()
958 if (ip_mask->ip4src) { in efx_ethtool_set_class_rule()
959 if (ip_mask->ip4src != IP4_ADDR_FULL_MASK) in efx_ethtool_set_class_rule()
960 return -EINVAL; in efx_ethtool_set_class_rule()
961 spec.match_flags |= EFX_FILTER_MATCH_REM_HOST; in efx_ethtool_set_class_rule()
962 spec.rem_host[0] = ip_entry->ip4src; in efx_ethtool_set_class_rule()
964 if (ip_mask->pdst) { in efx_ethtool_set_class_rule()
965 if (ip_mask->pdst != PORT_FULL_MASK) in efx_ethtool_set_class_rule()
966 return -EINVAL; in efx_ethtool_set_class_rule()
967 spec.match_flags |= EFX_FILTER_MATCH_LOC_PORT; in efx_ethtool_set_class_rule()
968 spec.loc_port = ip_entry->pdst; in efx_ethtool_set_class_rule()
970 if (ip_mask->psrc) { in efx_ethtool_set_class_rule()
971 if (ip_mask->psrc != PORT_FULL_MASK) in efx_ethtool_set_class_rule()
972 return -EINVAL; in efx_ethtool_set_class_rule()
973 spec.match_flags |= EFX_FILTER_MATCH_REM_PORT; in efx_ethtool_set_class_rule()
974 spec.rem_port = ip_entry->psrc; in efx_ethtool_set_class_rule()
976 if (ip_mask->tos) in efx_ethtool_set_class_rule()
977 return -EINVAL; in efx_ethtool_set_class_rule()
982 spec.match_flags = (EFX_FILTER_MATCH_ETHER_TYPE | in efx_ethtool_set_class_rule()
984 spec.ether_type = htons(ETH_P_IPV6); in efx_ethtool_set_class_rule()
985 spec.ip_proto = flow_type == TCP_V6_FLOW ? IPPROTO_TCP in efx_ethtool_set_class_rule()
987 if (!ip6_mask_is_empty(ip6_mask->ip6dst)) { in efx_ethtool_set_class_rule()
988 if (!ip6_mask_is_full(ip6_mask->ip6dst)) in efx_ethtool_set_class_rule()
989 return -EINVAL; in efx_ethtool_set_class_rule()
990 spec.match_flags |= EFX_FILTER_MATCH_LOC_HOST; in efx_ethtool_set_class_rule()
991 memcpy(spec.loc_host, ip6_entry->ip6dst, sizeof(spec.loc_host)); in efx_ethtool_set_class_rule()
993 if (!ip6_mask_is_empty(ip6_mask->ip6src)) { in efx_ethtool_set_class_rule()
994 if (!ip6_mask_is_full(ip6_mask->ip6src)) in efx_ethtool_set_class_rule()
995 return -EINVAL; in efx_ethtool_set_class_rule()
996 spec.match_flags |= EFX_FILTER_MATCH_REM_HOST; in efx_ethtool_set_class_rule()
997 memcpy(spec.rem_host, ip6_entry->ip6src, sizeof(spec.rem_host)); in efx_ethtool_set_class_rule()
999 if (ip6_mask->pdst) { in efx_ethtool_set_class_rule()
1000 if (ip6_mask->pdst != PORT_FULL_MASK) in efx_ethtool_set_class_rule()
1001 return -EINVAL; in efx_ethtool_set_class_rule()
1002 spec.match_flags |= EFX_FILTER_MATCH_LOC_PORT; in efx_ethtool_set_class_rule()
1003 spec.loc_port = ip6_entry->pdst; in efx_ethtool_set_class_rule()
1005 if (ip6_mask->psrc) { in efx_ethtool_set_class_rule()
1006 if (ip6_mask->psrc != PORT_FULL_MASK) in efx_ethtool_set_class_rule()
1007 return -EINVAL; in efx_ethtool_set_class_rule()
1008 spec.match_flags |= EFX_FILTER_MATCH_REM_PORT; in efx_ethtool_set_class_rule()
1009 spec.rem_port = ip6_entry->psrc; in efx_ethtool_set_class_rule()
1011 if (ip6_mask->tclass) in efx_ethtool_set_class_rule()
1012 return -EINVAL; in efx_ethtool_set_class_rule()
1016 if (uip_mask->l4_4_bytes || uip_mask->tos || uip_mask->ip_ver || in efx_ethtool_set_class_rule()
1017 uip_entry->ip_ver != ETH_RX_NFC_IP4) in efx_ethtool_set_class_rule()
1018 return -EINVAL; in efx_ethtool_set_class_rule()
1019 spec.match_flags = EFX_FILTER_MATCH_ETHER_TYPE; in efx_ethtool_set_class_rule()
1020 spec.ether_type = htons(ETH_P_IP); in efx_ethtool_set_class_rule()
1021 if (uip_mask->ip4dst) { in efx_ethtool_set_class_rule()
1022 if (uip_mask->ip4dst != IP4_ADDR_FULL_MASK) in efx_ethtool_set_class_rule()
1023 return -EINVAL; in efx_ethtool_set_class_rule()
1024 spec.match_flags |= EFX_FILTER_MATCH_LOC_HOST; in efx_ethtool_set_class_rule()
1025 spec.loc_host[0] = uip_entry->ip4dst; in efx_ethtool_set_class_rule()
1027 if (uip_mask->ip4src) { in efx_ethtool_set_class_rule()
1028 if (uip_mask->ip4src != IP4_ADDR_FULL_MASK) in efx_ethtool_set_class_rule()
1029 return -EINVAL; in efx_ethtool_set_class_rule()
1030 spec.match_flags |= EFX_FILTER_MATCH_REM_HOST; in efx_ethtool_set_class_rule()
1031 spec.rem_host[0] = uip_entry->ip4src; in efx_ethtool_set_class_rule()
1033 if (uip_mask->proto) { in efx_ethtool_set_class_rule()
1034 if (uip_mask->proto != IP_PROTO_FULL_MASK) in efx_ethtool_set_class_rule()
1035 return -EINVAL; in efx_ethtool_set_class_rule()
1036 spec.match_flags |= EFX_FILTER_MATCH_IP_PROTO; in efx_ethtool_set_class_rule()
1037 spec.ip_proto = uip_entry->proto; in efx_ethtool_set_class_rule()
1042 if (uip6_mask->l4_4_bytes || uip6_mask->tclass) in efx_ethtool_set_class_rule()
1043 return -EINVAL; in efx_ethtool_set_class_rule()
1044 spec.match_flags = EFX_FILTER_MATCH_ETHER_TYPE; in efx_ethtool_set_class_rule()
1045 spec.ether_type = htons(ETH_P_IPV6); in efx_ethtool_set_class_rule()
1046 if (!ip6_mask_is_empty(uip6_mask->ip6dst)) { in efx_ethtool_set_class_rule()
1047 if (!ip6_mask_is_full(uip6_mask->ip6dst)) in efx_ethtool_set_class_rule()
1048 return -EINVAL; in efx_ethtool_set_class_rule()
1049 spec.match_flags |= EFX_FILTER_MATCH_LOC_HOST; in efx_ethtool_set_class_rule()
1050 memcpy(spec.loc_host, uip6_entry->ip6dst, sizeof(spec.loc_host)); in efx_ethtool_set_class_rule()
1052 if (!ip6_mask_is_empty(uip6_mask->ip6src)) { in efx_ethtool_set_class_rule()
1053 if (!ip6_mask_is_full(uip6_mask->ip6src)) in efx_ethtool_set_class_rule()
1054 return -EINVAL; in efx_ethtool_set_class_rule()
1055 spec.match_flags |= EFX_FILTER_MATCH_REM_HOST; in efx_ethtool_set_class_rule()
1056 memcpy(spec.rem_host, uip6_entry->ip6src, sizeof(spec.rem_host)); in efx_ethtool_set_class_rule()
1058 if (uip6_mask->l4_proto) { in efx_ethtool_set_class_rule()
1059 if (uip6_mask->l4_proto != IP_PROTO_FULL_MASK) in efx_ethtool_set_class_rule()
1060 return -EINVAL; in efx_ethtool_set_class_rule()
1061 spec.match_flags |= EFX_FILTER_MATCH_IP_PROTO; in efx_ethtool_set_class_rule()
1062 spec.ip_proto = uip6_entry->l4_proto; in efx_ethtool_set_class_rule()
1067 if (!is_zero_ether_addr(mac_mask->h_dest)) { in efx_ethtool_set_class_rule()
1068 if (ether_addr_equal(mac_mask->h_dest, in efx_ethtool_set_class_rule()
1070 spec.match_flags |= EFX_FILTER_MATCH_LOC_MAC_IG; in efx_ethtool_set_class_rule()
1071 else if (is_broadcast_ether_addr(mac_mask->h_dest)) in efx_ethtool_set_class_rule()
1072 spec.match_flags |= EFX_FILTER_MATCH_LOC_MAC; in efx_ethtool_set_class_rule()
1074 return -EINVAL; in efx_ethtool_set_class_rule()
1075 ether_addr_copy(spec.loc_mac, mac_entry->h_dest); in efx_ethtool_set_class_rule()
1077 if (!is_zero_ether_addr(mac_mask->h_source)) { in efx_ethtool_set_class_rule()
1078 if (!is_broadcast_ether_addr(mac_mask->h_source)) in efx_ethtool_set_class_rule()
1079 return -EINVAL; in efx_ethtool_set_class_rule()
1080 spec.match_flags |= EFX_FILTER_MATCH_REM_MAC; in efx_ethtool_set_class_rule()
1081 ether_addr_copy(spec.rem_mac, mac_entry->h_source); in efx_ethtool_set_class_rule()
1083 if (mac_mask->h_proto) { in efx_ethtool_set_class_rule()
1084 if (mac_mask->h_proto != ETHER_TYPE_FULL_MASK) in efx_ethtool_set_class_rule()
1085 return -EINVAL; in efx_ethtool_set_class_rule()
1086 spec.match_flags |= EFX_FILTER_MATCH_ETHER_TYPE; in efx_ethtool_set_class_rule()
1087 spec.ether_type = mac_entry->h_proto; in efx_ethtool_set_class_rule()
1092 return -EINVAL; in efx_ethtool_set_class_rule()
1095 if ((rule->flow_type & FLOW_EXT) && rule->m_ext.vlan_tci) { in efx_ethtool_set_class_rule()
1096 if (rule->m_ext.vlan_tci != htons(0xfff)) in efx_ethtool_set_class_rule()
1097 return -EINVAL; in efx_ethtool_set_class_rule()
1098 spec.match_flags |= EFX_FILTER_MATCH_OUTER_VID; in efx_ethtool_set_class_rule()
1099 spec.outer_vid = rule->h_ext.vlan_tci; in efx_ethtool_set_class_rule()
1102 rc = efx_filter_insert_filter(efx, &spec, true); in efx_ethtool_set_class_rule()
1106 rule->location = rc; in efx_ethtool_set_class_rule()
1116 return -EOPNOTSUPP; in efx_siena_ethtool_set_rxnfc()
1118 switch (info->cmd) { in efx_siena_ethtool_set_rxnfc()
1120 return efx_ethtool_set_class_rule(efx, &info->fs, in efx_siena_ethtool_set_rxnfc()
1121 info->rss_context); in efx_siena_ethtool_set_rxnfc()
1125 info->fs.location); in efx_siena_ethtool_set_rxnfc()
1128 return -EOPNOTSUPP; in efx_siena_ethtool_set_rxnfc()
1136 if (efx->n_rx_channels == 1) in efx_siena_ethtool_get_rxfh_indir_size()
1138 return ARRAY_SIZE(efx->rss_context.rx_indir_table); in efx_siena_ethtool_get_rxfh_indir_size()
1145 return efx->type->rx_hash_key_size; in efx_siena_ethtool_get_rxfh_key_size()
1154 rc = efx->type->rx_pull_rss_config(efx); in efx_siena_ethtool_get_rxfh()
1158 rxfh->hfunc = ETH_RSS_HASH_TOP; in efx_siena_ethtool_get_rxfh()
1159 if (rxfh->indir) in efx_siena_ethtool_get_rxfh()
1160 memcpy(rxfh->indir, efx->rss_context.rx_indir_table, in efx_siena_ethtool_get_rxfh()
1161 sizeof(efx->rss_context.rx_indir_table)); in efx_siena_ethtool_get_rxfh()
1162 if (rxfh->key) in efx_siena_ethtool_get_rxfh()
1163 memcpy(rxfh->key, efx->rss_context.rx_hash_key, in efx_siena_ethtool_get_rxfh()
1164 efx->type->rx_hash_key_size); in efx_siena_ethtool_get_rxfh()
1173 u32 *indir = rxfh->indir; in efx_siena_ethtool_set_rxfh()
1174 u8 *key = rxfh->key; in efx_siena_ethtool_set_rxfh()
1177 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in efx_siena_ethtool_set_rxfh()
1178 rxfh->hfunc != ETH_RSS_HASH_TOP) in efx_siena_ethtool_set_rxfh()
1179 return -EOPNOTSUPP; in efx_siena_ethtool_set_rxfh()
1185 key = efx->rss_context.rx_hash_key; in efx_siena_ethtool_set_rxfh()
1187 indir = efx->rss_context.rx_indir_table; in efx_siena_ethtool_set_rxfh()
1189 return efx->type->rx_push_rss_config(efx, true, indir, key); in efx_siena_ethtool_set_rxfh()
1197 rc = efx->type->map_reset_flags(flags); in efx_siena_ethtool_reset()
1211 mutex_lock(&efx->mac_lock); in efx_siena_ethtool_get_module_eeprom()
1213 mutex_unlock(&efx->mac_lock); in efx_siena_ethtool_get_module_eeprom()
1224 mutex_lock(&efx->mac_lock); in efx_siena_ethtool_get_module_info()
1226 mutex_unlock(&efx->mac_lock); in efx_siena_ethtool_get_module_info()