Lines Matching +full:flow +full:- +full:controlled
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2013 - 2018 Intel Corporation. */
13 * struct iavf_stats - definition for an ethtool statistic
14 * @stat_string: statistic name to display in ethtool -S output
56 IAVF_QUEUE_STAT("%s-%u.packets", stats.packets),
57 IAVF_QUEUE_STAT("%s-%u.bytes", stats.bytes),
61 * iavf_add_one_ethtool_stat - copy the stat into the supplied buffer
84 p = (char *)pointer + stat->stat_offset; in iavf_add_one_ethtool_stat()
85 switch (stat->sizeof_stat) { in iavf_add_one_ethtool_stat()
100 stat->stat_string); in iavf_add_one_ethtool_stat()
106 * __iavf_add_ethtool_stats - copy stats into the ethtool supplied buffer
130 * iavf_add_ethtool_stats - copy stats into ethtool supplied buffer
146 * iavf_add_queue_stats - copy queue statistics into supplied buffer
170 * non-null before attempting to access its syncp. in iavf_add_queue_stats()
173 start = !ring ? 0 : u64_stats_fetch_begin(&ring->syncp); in iavf_add_queue_stats()
176 } while (ring && u64_stats_fetch_retry(&ring->syncp, start)); in iavf_add_queue_stats()
183 * __iavf_add_stat_strings - copy stat strings into ethtool buffer
207 * iavf_add_stat_strings - copy stat strings into ethtool buffer
244 * iavf_get_link_ksettings - Get Link Speed and Duplex settings
257 cmd->base.autoneg = AUTONEG_DISABLE; in iavf_get_link_ksettings()
258 cmd->base.port = PORT_NONE; in iavf_get_link_ksettings()
259 cmd->base.duplex = DUPLEX_FULL; in iavf_get_link_ksettings()
262 if (adapter->link_speed_mbps && in iavf_get_link_ksettings()
263 adapter->link_speed_mbps < U32_MAX) in iavf_get_link_ksettings()
264 cmd->base.speed = adapter->link_speed_mbps; in iavf_get_link_ksettings()
266 cmd->base.speed = SPEED_UNKNOWN; in iavf_get_link_ksettings()
271 switch (adapter->link_speed) { in iavf_get_link_ksettings()
273 cmd->base.speed = SPEED_40000; in iavf_get_link_ksettings()
276 cmd->base.speed = SPEED_25000; in iavf_get_link_ksettings()
279 cmd->base.speed = SPEED_20000; in iavf_get_link_ksettings()
282 cmd->base.speed = SPEED_10000; in iavf_get_link_ksettings()
285 cmd->base.speed = SPEED_5000; in iavf_get_link_ksettings()
288 cmd->base.speed = SPEED_2500; in iavf_get_link_ksettings()
291 cmd->base.speed = SPEED_1000; in iavf_get_link_ksettings()
294 cmd->base.speed = SPEED_100; in iavf_get_link_ksettings()
304 * iavf_get_sset_count - Get length of string set
314 * use netdev->real_num_tx_queues * 2. The real_num_tx_queues is set in iavf_get_sset_count()
321 netdev->real_num_tx_queues); in iavf_get_sset_count()
323 return -EINVAL; in iavf_get_sset_count()
327 * iavf_get_ethtool_stats - report device statistics
349 for (i = 0; i < adapter->num_active_queues; i++) { in iavf_get_ethtool_stats()
353 ring = &adapter->tx_rings[i]; in iavf_get_ethtool_stats()
357 ring = &adapter->rx_rings[i]; in iavf_get_ethtool_stats()
364 * iavf_get_stat_strings - Get stat strings
379 for (i = 0; i < netdev->real_num_tx_queues; i++) { in iavf_get_stat_strings()
388 * iavf_get_strings - Get string set
407 * iavf_get_msglevel - Get debug message level
416 return adapter->msg_enable; in iavf_get_msglevel()
420 * iavf_set_msglevel - Set debug message level
432 adapter->hw.debug_mask = data; in iavf_set_msglevel()
433 adapter->msg_enable = data; in iavf_set_msglevel()
437 * iavf_get_drvinfo - Get driver info
448 strscpy(drvinfo->driver, iavf_driver_name, 32); in iavf_get_drvinfo()
449 strscpy(drvinfo->fw_version, "N/A", 4); in iavf_get_drvinfo()
450 strscpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); in iavf_get_drvinfo()
454 * iavf_get_ringparam - Get ring parameters
470 ring->rx_max_pending = IAVF_MAX_RXD; in iavf_get_ringparam()
471 ring->tx_max_pending = IAVF_MAX_TXD; in iavf_get_ringparam()
472 ring->rx_pending = adapter->rx_desc_count; in iavf_get_ringparam()
473 ring->tx_pending = adapter->tx_desc_count; in iavf_get_ringparam()
477 * iavf_set_ringparam - Set ring parameters
483 * Sets ring parameters. TX and RX rings are controlled separately, but the
495 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) in iavf_set_ringparam()
496 return -EINVAL; in iavf_set_ringparam()
498 if (ring->tx_pending > IAVF_MAX_TXD || in iavf_set_ringparam()
499 ring->tx_pending < IAVF_MIN_TXD || in iavf_set_ringparam()
500 ring->rx_pending > IAVF_MAX_RXD || in iavf_set_ringparam()
501 ring->rx_pending < IAVF_MIN_RXD) { in iavf_set_ringparam()
502 …netdev_err(netdev, "Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d] (increment %d)\n", in iavf_set_ringparam()
503 ring->tx_pending, ring->rx_pending, IAVF_MIN_TXD, in iavf_set_ringparam()
505 return -EINVAL; in iavf_set_ringparam()
508 new_tx_count = ALIGN(ring->tx_pending, IAVF_REQ_DESCRIPTOR_MULTIPLE); in iavf_set_ringparam()
509 if (new_tx_count != ring->tx_pending) in iavf_set_ringparam()
513 new_rx_count = ALIGN(ring->rx_pending, IAVF_REQ_DESCRIPTOR_MULTIPLE); in iavf_set_ringparam()
514 if (new_rx_count != ring->rx_pending) in iavf_set_ringparam()
519 if ((new_tx_count == adapter->tx_desc_count) && in iavf_set_ringparam()
520 (new_rx_count == adapter->rx_desc_count)) { in iavf_set_ringparam()
525 if (new_tx_count != adapter->tx_desc_count) { in iavf_set_ringparam()
527 adapter->tx_desc_count, new_tx_count); in iavf_set_ringparam()
528 adapter->tx_desc_count = new_tx_count; in iavf_set_ringparam()
531 if (new_rx_count != adapter->rx_desc_count) { in iavf_set_ringparam()
533 adapter->rx_desc_count, new_rx_count); in iavf_set_ringparam()
534 adapter->rx_desc_count = new_rx_count; in iavf_set_ringparam()
548 * __iavf_get_coalesce - get per-queue coalesce settings
553 * Gets the per-queue settings for coalescence. Specifically Rx and Tx usecs
568 else if (queue >= adapter->num_active_queues) in __iavf_get_coalesce()
569 return -EINVAL; in __iavf_get_coalesce()
571 rx_ring = &adapter->rx_rings[queue]; in __iavf_get_coalesce()
572 tx_ring = &adapter->tx_rings[queue]; in __iavf_get_coalesce()
574 if (ITR_IS_DYNAMIC(rx_ring->itr_setting)) in __iavf_get_coalesce()
575 ec->use_adaptive_rx_coalesce = 1; in __iavf_get_coalesce()
577 if (ITR_IS_DYNAMIC(tx_ring->itr_setting)) in __iavf_get_coalesce()
578 ec->use_adaptive_tx_coalesce = 1; in __iavf_get_coalesce()
580 ec->rx_coalesce_usecs = rx_ring->itr_setting & ~IAVF_ITR_DYNAMIC; in __iavf_get_coalesce()
581 ec->tx_coalesce_usecs = tx_ring->itr_setting & ~IAVF_ITR_DYNAMIC; in __iavf_get_coalesce()
587 * iavf_get_coalesce - Get interrupt coalescing settings
595 * this functionality. Note that if per-queue settings have been modified this
603 return __iavf_get_coalesce(netdev, ec, -1); in iavf_get_coalesce()
607 * iavf_get_per_queue_coalesce - get coalesce values for specific queue
621 * iavf_set_itr_per_queue - set ITR values for specific queue
631 struct iavf_ring *rx_ring = &adapter->rx_rings[queue]; in iavf_set_itr_per_queue()
632 struct iavf_ring *tx_ring = &adapter->tx_rings[queue]; in iavf_set_itr_per_queue()
636 itr_setting = rx_ring->itr_setting & ~IAVF_ITR_DYNAMIC; in iavf_set_itr_per_queue()
638 if (ec->rx_coalesce_usecs != itr_setting && in iavf_set_itr_per_queue()
639 ec->use_adaptive_rx_coalesce) { in iavf_set_itr_per_queue()
640 netif_info(adapter, drv, adapter->netdev, in iavf_set_itr_per_queue()
641 "Rx interrupt throttling cannot be changed if adaptive-rx is enabled\n"); in iavf_set_itr_per_queue()
642 return -EINVAL; in iavf_set_itr_per_queue()
645 itr_setting = tx_ring->itr_setting & ~IAVF_ITR_DYNAMIC; in iavf_set_itr_per_queue()
647 if (ec->tx_coalesce_usecs != itr_setting && in iavf_set_itr_per_queue()
648 ec->use_adaptive_tx_coalesce) { in iavf_set_itr_per_queue()
649 netif_info(adapter, drv, adapter->netdev, in iavf_set_itr_per_queue()
650 "Tx interrupt throttling cannot be changed if adaptive-tx is enabled\n"); in iavf_set_itr_per_queue()
651 return -EINVAL; in iavf_set_itr_per_queue()
654 rx_ring->itr_setting = ITR_REG_ALIGN(ec->rx_coalesce_usecs); in iavf_set_itr_per_queue()
655 tx_ring->itr_setting = ITR_REG_ALIGN(ec->tx_coalesce_usecs); in iavf_set_itr_per_queue()
657 rx_ring->itr_setting |= IAVF_ITR_DYNAMIC; in iavf_set_itr_per_queue()
658 if (!ec->use_adaptive_rx_coalesce) in iavf_set_itr_per_queue()
659 rx_ring->itr_setting ^= IAVF_ITR_DYNAMIC; in iavf_set_itr_per_queue()
661 tx_ring->itr_setting |= IAVF_ITR_DYNAMIC; in iavf_set_itr_per_queue()
662 if (!ec->use_adaptive_tx_coalesce) in iavf_set_itr_per_queue()
663 tx_ring->itr_setting ^= IAVF_ITR_DYNAMIC; in iavf_set_itr_per_queue()
665 q_vector = rx_ring->q_vector; in iavf_set_itr_per_queue()
666 q_vector->rx.target_itr = ITR_TO_REG(rx_ring->itr_setting); in iavf_set_itr_per_queue()
668 q_vector = tx_ring->q_vector; in iavf_set_itr_per_queue()
669 q_vector->tx.target_itr = ITR_TO_REG(tx_ring->itr_setting); in iavf_set_itr_per_queue()
679 * __iavf_set_coalesce - set coalesce settings for particular queue
692 if (ec->rx_coalesce_usecs > IAVF_MAX_ITR) { in __iavf_set_coalesce()
693 netif_info(adapter, drv, netdev, "Invalid value, rx-usecs range is 0-8160\n"); in __iavf_set_coalesce()
694 return -EINVAL; in __iavf_set_coalesce()
695 } else if (ec->tx_coalesce_usecs > IAVF_MAX_ITR) { in __iavf_set_coalesce()
696 netif_info(adapter, drv, netdev, "Invalid value, tx-usecs range is 0-8160\n"); in __iavf_set_coalesce()
697 return -EINVAL; in __iavf_set_coalesce()
704 for (i = 0; i < adapter->num_active_queues; i++) in __iavf_set_coalesce()
706 return -EINVAL; in __iavf_set_coalesce()
707 } else if (queue < adapter->num_active_queues) { in __iavf_set_coalesce()
709 return -EINVAL; in __iavf_set_coalesce()
711 netif_info(adapter, drv, netdev, "Invalid queue value, queue range is 0 - %d\n", in __iavf_set_coalesce()
712 adapter->num_active_queues - 1); in __iavf_set_coalesce()
713 return -EINVAL; in __iavf_set_coalesce()
720 * iavf_set_coalesce - Set interrupt coalescing settings
733 return __iavf_set_coalesce(netdev, ec, -1); in iavf_set_coalesce()
737 * iavf_set_per_queue_coalesce - set specific queue's coalesce settings
751 * iavf_fltr_to_ethtool_flow - convert filter type values to ethtool
752 * flow type values
753 * @flow: filter type to be converted
755 * Returns the corresponding ethtool flow type.
757 static int iavf_fltr_to_ethtool_flow(enum iavf_fdir_flow_type flow) in iavf_fltr_to_ethtool_flow() argument
759 switch (flow) { in iavf_fltr_to_ethtool_flow()
787 /* 0 is undefined ethtool flow */ in iavf_fltr_to_ethtool_flow()
793 * iavf_ethtool_flow_to_fltr - convert ethtool flow type to filter enum
794 * @eth: Ethtool flow type to be converted
796 * Returns flow enum
833 * iavf_is_mask_valid - check mask field set
846 * iavf_parse_rx_flow_user_data - deconstruct user-defined data
847 * @fsp: pointer to ethtool Rx flow specification
848 * @fltr: pointer to Flow Director filter for userdef data storage
859 if (!(fsp->flow_type & FLOW_EXT)) in iavf_parse_rx_flow_user_data()
867 u32 value = be32_to_cpu(fsp->h_ext.data[i]); in iavf_parse_rx_flow_user_data()
868 u32 mask = be32_to_cpu(fsp->m_ext.data[i]); in iavf_parse_rx_flow_user_data()
874 return -EINVAL; in iavf_parse_rx_flow_user_data()
880 flex = &fltr->flex_words[cnt++]; in iavf_parse_rx_flow_user_data()
881 flex->word = value & IAVF_USERDEF_FLEX_WORD_M; in iavf_parse_rx_flow_user_data()
882 flex->offset = FIELD_GET(IAVF_USERDEF_FLEX_OFFS_M, value); in iavf_parse_rx_flow_user_data()
883 if (flex->offset > IAVF_USERDEF_FLEX_MAX_OFFS_VAL) in iavf_parse_rx_flow_user_data()
884 return -EINVAL; in iavf_parse_rx_flow_user_data()
887 fltr->flex_cnt = cnt; in iavf_parse_rx_flow_user_data()
893 * iavf_fill_rx_flow_ext_data - fill the additional data
894 * @fsp: pointer to ethtool Rx flow specification
895 * @fltr: pointer to Flow Director filter to get additional data
901 if (!fltr->ext_mask.usr_def[0] && !fltr->ext_mask.usr_def[1]) in iavf_fill_rx_flow_ext_data()
904 fsp->flow_type |= FLOW_EXT; in iavf_fill_rx_flow_ext_data()
906 memcpy(fsp->h_ext.data, fltr->ext_data.usr_def, sizeof(fsp->h_ext.data)); in iavf_fill_rx_flow_ext_data()
907 memcpy(fsp->m_ext.data, fltr->ext_mask.usr_def, sizeof(fsp->m_ext.data)); in iavf_fill_rx_flow_ext_data()
911 * iavf_get_ethtool_fdir_entry - fill ethtool structure with Flow Director filter data
921 struct ethtool_rx_flow_spec *fsp = (struct ethtool_rx_flow_spec *)&cmd->fs; in iavf_get_ethtool_fdir_entry()
925 if (!(adapter->flags & IAVF_FLAG_FDIR_ENABLED)) in iavf_get_ethtool_fdir_entry()
926 return -EOPNOTSUPP; in iavf_get_ethtool_fdir_entry()
928 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_get_ethtool_fdir_entry()
930 rule = iavf_find_fdir_fltr(adapter, false, fsp->location); in iavf_get_ethtool_fdir_entry()
932 ret = -EINVAL; in iavf_get_ethtool_fdir_entry()
936 fsp->flow_type = iavf_fltr_to_ethtool_flow(rule->flow_type); in iavf_get_ethtool_fdir_entry()
938 memset(&fsp->m_u, 0, sizeof(fsp->m_u)); in iavf_get_ethtool_fdir_entry()
939 memset(&fsp->m_ext, 0, sizeof(fsp->m_ext)); in iavf_get_ethtool_fdir_entry()
941 switch (fsp->flow_type) { in iavf_get_ethtool_fdir_entry()
945 fsp->h_u.tcp_ip4_spec.ip4src = rule->ip_data.v4_addrs.src_ip; in iavf_get_ethtool_fdir_entry()
946 fsp->h_u.tcp_ip4_spec.ip4dst = rule->ip_data.v4_addrs.dst_ip; in iavf_get_ethtool_fdir_entry()
947 fsp->h_u.tcp_ip4_spec.psrc = rule->ip_data.src_port; in iavf_get_ethtool_fdir_entry()
948 fsp->h_u.tcp_ip4_spec.pdst = rule->ip_data.dst_port; in iavf_get_ethtool_fdir_entry()
949 fsp->h_u.tcp_ip4_spec.tos = rule->ip_data.tos; in iavf_get_ethtool_fdir_entry()
950 fsp->m_u.tcp_ip4_spec.ip4src = rule->ip_mask.v4_addrs.src_ip; in iavf_get_ethtool_fdir_entry()
951 fsp->m_u.tcp_ip4_spec.ip4dst = rule->ip_mask.v4_addrs.dst_ip; in iavf_get_ethtool_fdir_entry()
952 fsp->m_u.tcp_ip4_spec.psrc = rule->ip_mask.src_port; in iavf_get_ethtool_fdir_entry()
953 fsp->m_u.tcp_ip4_spec.pdst = rule->ip_mask.dst_port; in iavf_get_ethtool_fdir_entry()
954 fsp->m_u.tcp_ip4_spec.tos = rule->ip_mask.tos; in iavf_get_ethtool_fdir_entry()
958 fsp->h_u.ah_ip4_spec.ip4src = rule->ip_data.v4_addrs.src_ip; in iavf_get_ethtool_fdir_entry()
959 fsp->h_u.ah_ip4_spec.ip4dst = rule->ip_data.v4_addrs.dst_ip; in iavf_get_ethtool_fdir_entry()
960 fsp->h_u.ah_ip4_spec.spi = rule->ip_data.spi; in iavf_get_ethtool_fdir_entry()
961 fsp->h_u.ah_ip4_spec.tos = rule->ip_data.tos; in iavf_get_ethtool_fdir_entry()
962 fsp->m_u.ah_ip4_spec.ip4src = rule->ip_mask.v4_addrs.src_ip; in iavf_get_ethtool_fdir_entry()
963 fsp->m_u.ah_ip4_spec.ip4dst = rule->ip_mask.v4_addrs.dst_ip; in iavf_get_ethtool_fdir_entry()
964 fsp->m_u.ah_ip4_spec.spi = rule->ip_mask.spi; in iavf_get_ethtool_fdir_entry()
965 fsp->m_u.ah_ip4_spec.tos = rule->ip_mask.tos; in iavf_get_ethtool_fdir_entry()
968 fsp->h_u.usr_ip4_spec.ip4src = rule->ip_data.v4_addrs.src_ip; in iavf_get_ethtool_fdir_entry()
969 fsp->h_u.usr_ip4_spec.ip4dst = rule->ip_data.v4_addrs.dst_ip; in iavf_get_ethtool_fdir_entry()
970 fsp->h_u.usr_ip4_spec.l4_4_bytes = rule->ip_data.l4_header; in iavf_get_ethtool_fdir_entry()
971 fsp->h_u.usr_ip4_spec.tos = rule->ip_data.tos; in iavf_get_ethtool_fdir_entry()
972 fsp->h_u.usr_ip4_spec.ip_ver = ETH_RX_NFC_IP4; in iavf_get_ethtool_fdir_entry()
973 fsp->h_u.usr_ip4_spec.proto = rule->ip_data.proto; in iavf_get_ethtool_fdir_entry()
974 fsp->m_u.usr_ip4_spec.ip4src = rule->ip_mask.v4_addrs.src_ip; in iavf_get_ethtool_fdir_entry()
975 fsp->m_u.usr_ip4_spec.ip4dst = rule->ip_mask.v4_addrs.dst_ip; in iavf_get_ethtool_fdir_entry()
976 fsp->m_u.usr_ip4_spec.l4_4_bytes = rule->ip_mask.l4_header; in iavf_get_ethtool_fdir_entry()
977 fsp->m_u.usr_ip4_spec.tos = rule->ip_mask.tos; in iavf_get_ethtool_fdir_entry()
978 fsp->m_u.usr_ip4_spec.ip_ver = 0xFF; in iavf_get_ethtool_fdir_entry()
979 fsp->m_u.usr_ip4_spec.proto = rule->ip_mask.proto; in iavf_get_ethtool_fdir_entry()
984 memcpy(fsp->h_u.usr_ip6_spec.ip6src, &rule->ip_data.v6_addrs.src_ip, in iavf_get_ethtool_fdir_entry()
986 memcpy(fsp->h_u.usr_ip6_spec.ip6dst, &rule->ip_data.v6_addrs.dst_ip, in iavf_get_ethtool_fdir_entry()
988 fsp->h_u.tcp_ip6_spec.psrc = rule->ip_data.src_port; in iavf_get_ethtool_fdir_entry()
989 fsp->h_u.tcp_ip6_spec.pdst = rule->ip_data.dst_port; in iavf_get_ethtool_fdir_entry()
990 fsp->h_u.tcp_ip6_spec.tclass = rule->ip_data.tclass; in iavf_get_ethtool_fdir_entry()
991 memcpy(fsp->m_u.usr_ip6_spec.ip6src, &rule->ip_mask.v6_addrs.src_ip, in iavf_get_ethtool_fdir_entry()
993 memcpy(fsp->m_u.usr_ip6_spec.ip6dst, &rule->ip_mask.v6_addrs.dst_ip, in iavf_get_ethtool_fdir_entry()
995 fsp->m_u.tcp_ip6_spec.psrc = rule->ip_mask.src_port; in iavf_get_ethtool_fdir_entry()
996 fsp->m_u.tcp_ip6_spec.pdst = rule->ip_mask.dst_port; in iavf_get_ethtool_fdir_entry()
997 fsp->m_u.tcp_ip6_spec.tclass = rule->ip_mask.tclass; in iavf_get_ethtool_fdir_entry()
1001 memcpy(fsp->h_u.ah_ip6_spec.ip6src, &rule->ip_data.v6_addrs.src_ip, in iavf_get_ethtool_fdir_entry()
1003 memcpy(fsp->h_u.ah_ip6_spec.ip6dst, &rule->ip_data.v6_addrs.dst_ip, in iavf_get_ethtool_fdir_entry()
1005 fsp->h_u.ah_ip6_spec.spi = rule->ip_data.spi; in iavf_get_ethtool_fdir_entry()
1006 fsp->h_u.ah_ip6_spec.tclass = rule->ip_data.tclass; in iavf_get_ethtool_fdir_entry()
1007 memcpy(fsp->m_u.ah_ip6_spec.ip6src, &rule->ip_mask.v6_addrs.src_ip, in iavf_get_ethtool_fdir_entry()
1009 memcpy(fsp->m_u.ah_ip6_spec.ip6dst, &rule->ip_mask.v6_addrs.dst_ip, in iavf_get_ethtool_fdir_entry()
1011 fsp->m_u.ah_ip6_spec.spi = rule->ip_mask.spi; in iavf_get_ethtool_fdir_entry()
1012 fsp->m_u.ah_ip6_spec.tclass = rule->ip_mask.tclass; in iavf_get_ethtool_fdir_entry()
1015 memcpy(fsp->h_u.usr_ip6_spec.ip6src, &rule->ip_data.v6_addrs.src_ip, in iavf_get_ethtool_fdir_entry()
1017 memcpy(fsp->h_u.usr_ip6_spec.ip6dst, &rule->ip_data.v6_addrs.dst_ip, in iavf_get_ethtool_fdir_entry()
1019 fsp->h_u.usr_ip6_spec.l4_4_bytes = rule->ip_data.l4_header; in iavf_get_ethtool_fdir_entry()
1020 fsp->h_u.usr_ip6_spec.tclass = rule->ip_data.tclass; in iavf_get_ethtool_fdir_entry()
1021 fsp->h_u.usr_ip6_spec.l4_proto = rule->ip_data.proto; in iavf_get_ethtool_fdir_entry()
1022 memcpy(fsp->m_u.usr_ip6_spec.ip6src, &rule->ip_mask.v6_addrs.src_ip, in iavf_get_ethtool_fdir_entry()
1024 memcpy(fsp->m_u.usr_ip6_spec.ip6dst, &rule->ip_mask.v6_addrs.dst_ip, in iavf_get_ethtool_fdir_entry()
1026 fsp->m_u.usr_ip6_spec.l4_4_bytes = rule->ip_mask.l4_header; in iavf_get_ethtool_fdir_entry()
1027 fsp->m_u.usr_ip6_spec.tclass = rule->ip_mask.tclass; in iavf_get_ethtool_fdir_entry()
1028 fsp->m_u.usr_ip6_spec.l4_proto = rule->ip_mask.proto; in iavf_get_ethtool_fdir_entry()
1031 fsp->h_u.ether_spec.h_proto = rule->eth_data.etype; in iavf_get_ethtool_fdir_entry()
1032 fsp->m_u.ether_spec.h_proto = rule->eth_mask.etype; in iavf_get_ethtool_fdir_entry()
1035 ret = -EINVAL; in iavf_get_ethtool_fdir_entry()
1041 if (rule->action == VIRTCHNL_ACTION_DROP) in iavf_get_ethtool_fdir_entry()
1042 fsp->ring_cookie = RX_CLS_FLOW_DISC; in iavf_get_ethtool_fdir_entry()
1044 fsp->ring_cookie = rule->q_index; in iavf_get_ethtool_fdir_entry()
1047 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_get_ethtool_fdir_entry()
1052 * iavf_get_fdir_fltr_ids - fill buffer with filter IDs of active filters
1067 if (!(adapter->flags & IAVF_FLAG_FDIR_ENABLED)) in iavf_get_fdir_fltr_ids()
1068 return -EOPNOTSUPP; in iavf_get_fdir_fltr_ids()
1070 cmd->data = IAVF_MAX_FDIR_FILTERS; in iavf_get_fdir_fltr_ids()
1072 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_get_fdir_fltr_ids()
1074 list_for_each_entry(fltr, &adapter->fdir_list_head, list) { in iavf_get_fdir_fltr_ids()
1078 if (cnt == cmd->rule_cnt) { in iavf_get_fdir_fltr_ids()
1079 val = -EMSGSIZE; in iavf_get_fdir_fltr_ids()
1082 rule_locs[cnt] = fltr->loc; in iavf_get_fdir_fltr_ids()
1087 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_get_fdir_fltr_ids()
1089 cmd->rule_cnt = cnt; in iavf_get_fdir_fltr_ids()
1095 * iavf_add_fdir_fltr_info - Set the input set for Flow Director filter
1097 * @fsp: pointer to ethtool Rx flow specification
1108 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) { in iavf_add_fdir_fltr_info()
1111 q_index = fsp->ring_cookie; in iavf_add_fdir_fltr_info()
1112 if (q_index >= adapter->num_active_queues) in iavf_add_fdir_fltr_info()
1113 return -EINVAL; in iavf_add_fdir_fltr_info()
1118 fltr->action = act; in iavf_add_fdir_fltr_info()
1119 fltr->loc = fsp->location; in iavf_add_fdir_fltr_info()
1120 fltr->q_index = q_index; in iavf_add_fdir_fltr_info()
1122 if (fsp->flow_type & FLOW_EXT) { in iavf_add_fdir_fltr_info()
1123 memcpy(fltr->ext_data.usr_def, fsp->h_ext.data, in iavf_add_fdir_fltr_info()
1124 sizeof(fltr->ext_data.usr_def)); in iavf_add_fdir_fltr_info()
1125 memcpy(fltr->ext_mask.usr_def, fsp->m_ext.data, in iavf_add_fdir_fltr_info()
1126 sizeof(fltr->ext_mask.usr_def)); in iavf_add_fdir_fltr_info()
1129 flow_type = fsp->flow_type & ~(FLOW_EXT | FLOW_MAC_EXT | FLOW_RSS); in iavf_add_fdir_fltr_info()
1130 fltr->flow_type = iavf_ethtool_flow_to_fltr(flow_type); in iavf_add_fdir_fltr_info()
1136 fltr->ip_data.v4_addrs.src_ip = fsp->h_u.tcp_ip4_spec.ip4src; in iavf_add_fdir_fltr_info()
1137 fltr->ip_data.v4_addrs.dst_ip = fsp->h_u.tcp_ip4_spec.ip4dst; in iavf_add_fdir_fltr_info()
1138 fltr->ip_data.src_port = fsp->h_u.tcp_ip4_spec.psrc; in iavf_add_fdir_fltr_info()
1139 fltr->ip_data.dst_port = fsp->h_u.tcp_ip4_spec.pdst; in iavf_add_fdir_fltr_info()
1140 fltr->ip_data.tos = fsp->h_u.tcp_ip4_spec.tos; in iavf_add_fdir_fltr_info()
1141 fltr->ip_mask.v4_addrs.src_ip = fsp->m_u.tcp_ip4_spec.ip4src; in iavf_add_fdir_fltr_info()
1142 fltr->ip_mask.v4_addrs.dst_ip = fsp->m_u.tcp_ip4_spec.ip4dst; in iavf_add_fdir_fltr_info()
1143 fltr->ip_mask.src_port = fsp->m_u.tcp_ip4_spec.psrc; in iavf_add_fdir_fltr_info()
1144 fltr->ip_mask.dst_port = fsp->m_u.tcp_ip4_spec.pdst; in iavf_add_fdir_fltr_info()
1145 fltr->ip_mask.tos = fsp->m_u.tcp_ip4_spec.tos; in iavf_add_fdir_fltr_info()
1146 fltr->ip_ver = 4; in iavf_add_fdir_fltr_info()
1150 fltr->ip_data.v4_addrs.src_ip = fsp->h_u.ah_ip4_spec.ip4src; in iavf_add_fdir_fltr_info()
1151 fltr->ip_data.v4_addrs.dst_ip = fsp->h_u.ah_ip4_spec.ip4dst; in iavf_add_fdir_fltr_info()
1152 fltr->ip_data.spi = fsp->h_u.ah_ip4_spec.spi; in iavf_add_fdir_fltr_info()
1153 fltr->ip_data.tos = fsp->h_u.ah_ip4_spec.tos; in iavf_add_fdir_fltr_info()
1154 fltr->ip_mask.v4_addrs.src_ip = fsp->m_u.ah_ip4_spec.ip4src; in iavf_add_fdir_fltr_info()
1155 fltr->ip_mask.v4_addrs.dst_ip = fsp->m_u.ah_ip4_spec.ip4dst; in iavf_add_fdir_fltr_info()
1156 fltr->ip_mask.spi = fsp->m_u.ah_ip4_spec.spi; in iavf_add_fdir_fltr_info()
1157 fltr->ip_mask.tos = fsp->m_u.ah_ip4_spec.tos; in iavf_add_fdir_fltr_info()
1158 fltr->ip_ver = 4; in iavf_add_fdir_fltr_info()
1161 fltr->ip_data.v4_addrs.src_ip = fsp->h_u.usr_ip4_spec.ip4src; in iavf_add_fdir_fltr_info()
1162 fltr->ip_data.v4_addrs.dst_ip = fsp->h_u.usr_ip4_spec.ip4dst; in iavf_add_fdir_fltr_info()
1163 fltr->ip_data.l4_header = fsp->h_u.usr_ip4_spec.l4_4_bytes; in iavf_add_fdir_fltr_info()
1164 fltr->ip_data.tos = fsp->h_u.usr_ip4_spec.tos; in iavf_add_fdir_fltr_info()
1165 fltr->ip_data.proto = fsp->h_u.usr_ip4_spec.proto; in iavf_add_fdir_fltr_info()
1166 fltr->ip_mask.v4_addrs.src_ip = fsp->m_u.usr_ip4_spec.ip4src; in iavf_add_fdir_fltr_info()
1167 fltr->ip_mask.v4_addrs.dst_ip = fsp->m_u.usr_ip4_spec.ip4dst; in iavf_add_fdir_fltr_info()
1168 fltr->ip_mask.l4_header = fsp->m_u.usr_ip4_spec.l4_4_bytes; in iavf_add_fdir_fltr_info()
1169 fltr->ip_mask.tos = fsp->m_u.usr_ip4_spec.tos; in iavf_add_fdir_fltr_info()
1170 fltr->ip_mask.proto = fsp->m_u.usr_ip4_spec.proto; in iavf_add_fdir_fltr_info()
1171 fltr->ip_ver = 4; in iavf_add_fdir_fltr_info()
1176 memcpy(&fltr->ip_data.v6_addrs.src_ip, fsp->h_u.usr_ip6_spec.ip6src, in iavf_add_fdir_fltr_info()
1178 memcpy(&fltr->ip_data.v6_addrs.dst_ip, fsp->h_u.usr_ip6_spec.ip6dst, in iavf_add_fdir_fltr_info()
1180 fltr->ip_data.src_port = fsp->h_u.tcp_ip6_spec.psrc; in iavf_add_fdir_fltr_info()
1181 fltr->ip_data.dst_port = fsp->h_u.tcp_ip6_spec.pdst; in iavf_add_fdir_fltr_info()
1182 fltr->ip_data.tclass = fsp->h_u.tcp_ip6_spec.tclass; in iavf_add_fdir_fltr_info()
1183 memcpy(&fltr->ip_mask.v6_addrs.src_ip, fsp->m_u.usr_ip6_spec.ip6src, in iavf_add_fdir_fltr_info()
1185 memcpy(&fltr->ip_mask.v6_addrs.dst_ip, fsp->m_u.usr_ip6_spec.ip6dst, in iavf_add_fdir_fltr_info()
1187 fltr->ip_mask.src_port = fsp->m_u.tcp_ip6_spec.psrc; in iavf_add_fdir_fltr_info()
1188 fltr->ip_mask.dst_port = fsp->m_u.tcp_ip6_spec.pdst; in iavf_add_fdir_fltr_info()
1189 fltr->ip_mask.tclass = fsp->m_u.tcp_ip6_spec.tclass; in iavf_add_fdir_fltr_info()
1190 fltr->ip_ver = 6; in iavf_add_fdir_fltr_info()
1194 memcpy(&fltr->ip_data.v6_addrs.src_ip, fsp->h_u.ah_ip6_spec.ip6src, in iavf_add_fdir_fltr_info()
1196 memcpy(&fltr->ip_data.v6_addrs.dst_ip, fsp->h_u.ah_ip6_spec.ip6dst, in iavf_add_fdir_fltr_info()
1198 fltr->ip_data.spi = fsp->h_u.ah_ip6_spec.spi; in iavf_add_fdir_fltr_info()
1199 fltr->ip_data.tclass = fsp->h_u.ah_ip6_spec.tclass; in iavf_add_fdir_fltr_info()
1200 memcpy(&fltr->ip_mask.v6_addrs.src_ip, fsp->m_u.ah_ip6_spec.ip6src, in iavf_add_fdir_fltr_info()
1202 memcpy(&fltr->ip_mask.v6_addrs.dst_ip, fsp->m_u.ah_ip6_spec.ip6dst, in iavf_add_fdir_fltr_info()
1204 fltr->ip_mask.spi = fsp->m_u.ah_ip6_spec.spi; in iavf_add_fdir_fltr_info()
1205 fltr->ip_mask.tclass = fsp->m_u.ah_ip6_spec.tclass; in iavf_add_fdir_fltr_info()
1206 fltr->ip_ver = 6; in iavf_add_fdir_fltr_info()
1209 memcpy(&fltr->ip_data.v6_addrs.src_ip, fsp->h_u.usr_ip6_spec.ip6src, in iavf_add_fdir_fltr_info()
1211 memcpy(&fltr->ip_data.v6_addrs.dst_ip, fsp->h_u.usr_ip6_spec.ip6dst, in iavf_add_fdir_fltr_info()
1213 fltr->ip_data.l4_header = fsp->h_u.usr_ip6_spec.l4_4_bytes; in iavf_add_fdir_fltr_info()
1214 fltr->ip_data.tclass = fsp->h_u.usr_ip6_spec.tclass; in iavf_add_fdir_fltr_info()
1215 fltr->ip_data.proto = fsp->h_u.usr_ip6_spec.l4_proto; in iavf_add_fdir_fltr_info()
1216 memcpy(&fltr->ip_mask.v6_addrs.src_ip, fsp->m_u.usr_ip6_spec.ip6src, in iavf_add_fdir_fltr_info()
1218 memcpy(&fltr->ip_mask.v6_addrs.dst_ip, fsp->m_u.usr_ip6_spec.ip6dst, in iavf_add_fdir_fltr_info()
1220 fltr->ip_mask.l4_header = fsp->m_u.usr_ip6_spec.l4_4_bytes; in iavf_add_fdir_fltr_info()
1221 fltr->ip_mask.tclass = fsp->m_u.usr_ip6_spec.tclass; in iavf_add_fdir_fltr_info()
1222 fltr->ip_mask.proto = fsp->m_u.usr_ip6_spec.l4_proto; in iavf_add_fdir_fltr_info()
1223 fltr->ip_ver = 6; in iavf_add_fdir_fltr_info()
1226 fltr->eth_data.etype = fsp->h_u.ether_spec.h_proto; in iavf_add_fdir_fltr_info()
1227 fltr->eth_mask.etype = fsp->m_u.ether_spec.h_proto; in iavf_add_fdir_fltr_info()
1230 /* not doing un-parsed flow types */ in iavf_add_fdir_fltr_info()
1231 return -EINVAL; in iavf_add_fdir_fltr_info()
1239 return -EEXIST; in iavf_add_fdir_fltr_info()
1249 * iavf_add_fdir_ethtool - add Flow Director filter
1251 * @cmd: command to add Flow Director filter
1257 struct ethtool_rx_flow_spec *fsp = &cmd->fs; in iavf_add_fdir_ethtool()
1262 if (!(adapter->flags & IAVF_FLAG_FDIR_ENABLED)) in iavf_add_fdir_ethtool()
1263 return -EOPNOTSUPP; in iavf_add_fdir_ethtool()
1265 if (fsp->flow_type & FLOW_MAC_EXT) in iavf_add_fdir_ethtool()
1266 return -EINVAL; in iavf_add_fdir_ethtool()
1268 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_add_fdir_ethtool()
1269 if (iavf_find_fdir_fltr(adapter, false, fsp->location)) { in iavf_add_fdir_ethtool()
1270 dev_err(&adapter->pdev->dev, "Failed to add Flow Director filter, it already exists\n"); in iavf_add_fdir_ethtool()
1271 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_add_fdir_ethtool()
1272 return -EEXIST; in iavf_add_fdir_ethtool()
1274 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_add_fdir_ethtool()
1278 return -ENOMEM; in iavf_add_fdir_ethtool()
1280 while (!mutex_trylock(&adapter->crit_lock)) { in iavf_add_fdir_ethtool()
1281 if (--count == 0) { in iavf_add_fdir_ethtool()
1283 return -EINVAL; in iavf_add_fdir_ethtool()
1295 mutex_unlock(&adapter->crit_lock); in iavf_add_fdir_ethtool()
1300 * iavf_del_fdir_ethtool - delete Flow Director filter
1302 * @cmd: command to delete Flow Director filter
1308 struct ethtool_rx_flow_spec *fsp = (struct ethtool_rx_flow_spec *)&cmd->fs; in iavf_del_fdir_ethtool()
1310 if (!(adapter->flags & IAVF_FLAG_FDIR_ENABLED)) in iavf_del_fdir_ethtool()
1311 return -EOPNOTSUPP; in iavf_del_fdir_ethtool()
1313 return iavf_fdir_del_fltr(adapter, false, fsp->location); in iavf_del_fdir_ethtool()
1317 * iavf_adv_rss_parse_hdrs - parses headers from RSS hash input
1327 switch (cmd->flow_type) { in iavf_adv_rss_parse_hdrs()
1360 * iavf_adv_rss_parse_hash_flds - parses hash fields from RSS hash input
1371 if (cmd->data & RXH_IP_SRC || cmd->data & RXH_IP_DST) { in iavf_adv_rss_parse_hash_flds()
1372 switch (cmd->flow_type) { in iavf_adv_rss_parse_hash_flds()
1376 if (cmd->data & RXH_IP_SRC) in iavf_adv_rss_parse_hash_flds()
1378 if (cmd->data & RXH_IP_DST) in iavf_adv_rss_parse_hash_flds()
1384 if (cmd->data & RXH_IP_SRC) in iavf_adv_rss_parse_hash_flds()
1386 if (cmd->data & RXH_IP_DST) in iavf_adv_rss_parse_hash_flds()
1394 if (cmd->data & RXH_L4_B_0_1 || cmd->data & RXH_L4_B_2_3) { in iavf_adv_rss_parse_hash_flds()
1395 switch (cmd->flow_type) { in iavf_adv_rss_parse_hash_flds()
1398 if (cmd->data & RXH_L4_B_0_1) in iavf_adv_rss_parse_hash_flds()
1400 if (cmd->data & RXH_L4_B_2_3) in iavf_adv_rss_parse_hash_flds()
1405 if (cmd->data & RXH_L4_B_0_1) in iavf_adv_rss_parse_hash_flds()
1407 if (cmd->data & RXH_L4_B_2_3) in iavf_adv_rss_parse_hash_flds()
1412 if (cmd->data & RXH_L4_B_0_1) in iavf_adv_rss_parse_hash_flds()
1414 if (cmd->data & RXH_L4_B_2_3) in iavf_adv_rss_parse_hash_flds()
1426 * iavf_set_adv_rss_hash_opt - Enable/Disable flow types for RSS hash
1430 * Returns Success if the flow input set is supported.
1444 return -EOPNOTSUPP; in iavf_set_adv_rss_hash_opt()
1446 symm = !!(adapter->hfunc == VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC); in iavf_set_adv_rss_hash_opt()
1450 return -EINVAL; in iavf_set_adv_rss_hash_opt()
1454 return -EINVAL; in iavf_set_adv_rss_hash_opt()
1458 return -ENOMEM; in iavf_set_adv_rss_hash_opt()
1460 if (iavf_fill_adv_rss_cfg_msg(&rss_new->cfg_msg, hdrs, hash_flds, in iavf_set_adv_rss_hash_opt()
1463 return -EINVAL; in iavf_set_adv_rss_hash_opt()
1466 while (!mutex_trylock(&adapter->crit_lock)) { in iavf_set_adv_rss_hash_opt()
1467 if (--count == 0) { in iavf_set_adv_rss_hash_opt()
1469 return -EINVAL; in iavf_set_adv_rss_hash_opt()
1475 spin_lock_bh(&adapter->adv_rss_lock); in iavf_set_adv_rss_hash_opt()
1478 if (rss_old->state != IAVF_ADV_RSS_ACTIVE) { in iavf_set_adv_rss_hash_opt()
1479 err = -EBUSY; in iavf_set_adv_rss_hash_opt()
1480 } else if (rss_old->hash_flds != hash_flds || in iavf_set_adv_rss_hash_opt()
1481 rss_old->symm != symm) { in iavf_set_adv_rss_hash_opt()
1482 rss_old->state = IAVF_ADV_RSS_ADD_REQUEST; in iavf_set_adv_rss_hash_opt()
1483 rss_old->hash_flds = hash_flds; in iavf_set_adv_rss_hash_opt()
1484 rss_old->symm = symm; in iavf_set_adv_rss_hash_opt()
1485 memcpy(&rss_old->cfg_msg, &rss_new->cfg_msg, in iavf_set_adv_rss_hash_opt()
1486 sizeof(rss_new->cfg_msg)); in iavf_set_adv_rss_hash_opt()
1488 err = -EEXIST; in iavf_set_adv_rss_hash_opt()
1492 rss_new->state = IAVF_ADV_RSS_ADD_REQUEST; in iavf_set_adv_rss_hash_opt()
1493 rss_new->packet_hdrs = hdrs; in iavf_set_adv_rss_hash_opt()
1494 rss_new->hash_flds = hash_flds; in iavf_set_adv_rss_hash_opt()
1495 rss_new->symm = symm; in iavf_set_adv_rss_hash_opt()
1496 list_add_tail(&rss_new->list, &adapter->adv_rss_list_head); in iavf_set_adv_rss_hash_opt()
1498 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_set_adv_rss_hash_opt()
1503 mutex_unlock(&adapter->crit_lock); in iavf_set_adv_rss_hash_opt()
1512 * iavf_get_adv_rss_hash_opt - Retrieve hash fields for a given flow-type
1516 * Returns Success if the flow input set is supported.
1527 return -EOPNOTSUPP; in iavf_get_adv_rss_hash_opt()
1529 cmd->data = 0; in iavf_get_adv_rss_hash_opt()
1533 return -EINVAL; in iavf_get_adv_rss_hash_opt()
1535 spin_lock_bh(&adapter->adv_rss_lock); in iavf_get_adv_rss_hash_opt()
1538 hash_flds = rss->hash_flds; in iavf_get_adv_rss_hash_opt()
1541 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_get_adv_rss_hash_opt()
1544 return -EINVAL; in iavf_get_adv_rss_hash_opt()
1548 cmd->data |= (u64)RXH_IP_SRC; in iavf_get_adv_rss_hash_opt()
1552 cmd->data |= (u64)RXH_IP_DST; in iavf_get_adv_rss_hash_opt()
1557 cmd->data |= (u64)RXH_L4_B_0_1; in iavf_get_adv_rss_hash_opt()
1562 cmd->data |= (u64)RXH_L4_B_2_3; in iavf_get_adv_rss_hash_opt()
1568 * iavf_set_rxnfc - command to set Rx flow rules.
1577 int ret = -EOPNOTSUPP; in iavf_set_rxnfc()
1579 switch (cmd->cmd) { in iavf_set_rxnfc()
1597 * iavf_get_rxnfc - command to get RX flow classification rules
1608 int ret = -EOPNOTSUPP; in iavf_get_rxnfc()
1610 switch (cmd->cmd) { in iavf_get_rxnfc()
1612 cmd->data = adapter->num_active_queues; in iavf_get_rxnfc()
1616 if (!(adapter->flags & IAVF_FLAG_FDIR_ENABLED)) in iavf_get_rxnfc()
1618 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_get_rxnfc()
1619 cmd->rule_cnt = adapter->fdir_active_fltr; in iavf_get_rxnfc()
1620 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_get_rxnfc()
1621 cmd->data = IAVF_MAX_FDIR_FILTERS; in iavf_get_rxnfc()
1645 * queue pair. Report one extra channel to match our "other" MSI-X vector.
1653 ch->max_combined = adapter->vsi_res->num_queue_pairs; in iavf_get_channels()
1655 ch->max_other = NONQ_VECS; in iavf_get_channels()
1656 ch->other_count = NONQ_VECS; in iavf_get_channels()
1658 ch->combined_count = adapter->num_active_queues; in iavf_get_channels()
1674 u32 num_req = ch->combined_count; in iavf_set_channels()
1677 if ((adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADQ) && in iavf_set_channels()
1678 adapter->num_tc) { in iavf_set_channels()
1679 dev_info(&adapter->pdev->dev, "Cannot set channels since ADq is enabled.\n"); in iavf_set_channels()
1680 return -EINVAL; in iavf_set_channels()
1686 if (num_req == 0 || num_req > adapter->vsi_res->num_queue_pairs) in iavf_set_channels()
1687 return -EINVAL; in iavf_set_channels()
1689 if (num_req == adapter->num_active_queues) in iavf_set_channels()
1692 if (ch->rx_count || ch->tx_count || ch->other_count != NONQ_VECS) in iavf_set_channels()
1693 return -EINVAL; in iavf_set_channels()
1695 adapter->num_req_queues = num_req; in iavf_set_channels()
1696 adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_set_channels()
1707 * iavf_get_rxfh_key_size - get the RSS hash key size
1716 return adapter->rss_key_size; in iavf_get_rxfh_key_size()
1720 * iavf_get_rxfh_indir_size - get the rx flow hash indirection table size
1729 return adapter->rss_lut_size; in iavf_get_rxfh_indir_size()
1733 * iavf_get_rxfh - get the rx flow hash indirection table
1745 rxfh->hfunc = ETH_RSS_HASH_TOP; in iavf_get_rxfh()
1746 if (adapter->hfunc == VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC) in iavf_get_rxfh()
1747 rxfh->input_xfrm |= RXH_XFRM_SYM_XOR; in iavf_get_rxfh()
1749 if (rxfh->key) in iavf_get_rxfh()
1750 memcpy(rxfh->key, adapter->rss_key, adapter->rss_key_size); in iavf_get_rxfh()
1752 if (rxfh->indir) in iavf_get_rxfh()
1754 for (i = 0; i < adapter->rss_lut_size; i++) in iavf_get_rxfh()
1755 rxfh->indir[i] = (u32)adapter->rss_lut[i]; in iavf_get_rxfh()
1761 * iavf_set_rxfh - set the rx flow hash indirection table
1766 * Returns -EINVAL if the table specifies an invalid queue id, otherwise
1777 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in iavf_set_rxfh()
1778 rxfh->hfunc != ETH_RSS_HASH_TOP) in iavf_set_rxfh()
1779 return -EOPNOTSUPP; in iavf_set_rxfh()
1781 if ((rxfh->input_xfrm & RXH_XFRM_SYM_XOR) && in iavf_set_rxfh()
1782 adapter->hfunc != VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC) { in iavf_set_rxfh()
1784 return -EOPNOTSUPP; in iavf_set_rxfh()
1785 adapter->hfunc = VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC; in iavf_set_rxfh()
1786 adapter->aq_required |= IAVF_FLAG_AQ_SET_RSS_HFUNC; in iavf_set_rxfh()
1787 } else if (!(rxfh->input_xfrm & RXH_XFRM_SYM_XOR) && in iavf_set_rxfh()
1788 adapter->hfunc != VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC) { in iavf_set_rxfh()
1789 adapter->hfunc = VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC; in iavf_set_rxfh()
1790 adapter->aq_required |= IAVF_FLAG_AQ_SET_RSS_HFUNC; in iavf_set_rxfh()
1793 if (!rxfh->key && !rxfh->indir) in iavf_set_rxfh()
1796 if (rxfh->key) in iavf_set_rxfh()
1797 memcpy(adapter->rss_key, rxfh->key, adapter->rss_key_size); in iavf_set_rxfh()
1799 if (rxfh->indir) { in iavf_set_rxfh()
1801 for (i = 0; i < adapter->rss_lut_size; i++) in iavf_set_rxfh()
1802 adapter->rss_lut[i] = (u8)(rxfh->indir[i]); in iavf_set_rxfh()
1837 * iavf_set_ethtool_ops - Initialize ethtool ops struct
1845 netdev->ethtool_ops = &iavf_ethtool_ops; in iavf_set_ethtool_ops()