Lines Matching +full:per +full:- +full:string
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2013 - 2018 Intel Corporation. */
12 * struct iavf_stats - definition for an ethtool statistic
13 * @stat_string: statistic name to display in ethtool -S output
27 * The @stat_string is interpreted as a format string, allowing formatted
29 * statistics array. Thus, every statistic string in an array should have the
55 IAVF_QUEUE_STAT("%s-%u.packets", stats.packets),
56 IAVF_QUEUE_STAT("%s-%u.bytes", stats.bytes),
60 * iavf_add_one_ethtool_stat - copy the stat into the supplied buffer
83 p = (char *)pointer + stat->stat_offset; in iavf_add_one_ethtool_stat()
84 switch (stat->sizeof_stat) { in iavf_add_one_ethtool_stat()
99 stat->stat_string); in iavf_add_one_ethtool_stat()
105 * __iavf_add_ethtool_stats - copy stats into the ethtool supplied buffer
129 * iavf_add_ethtool_stats - copy stats into ethtool supplied buffer
145 * iavf_add_queue_stats - copy queue statistics into supplied buffer
169 * non-null before attempting to access its syncp. in iavf_add_queue_stats()
172 start = !ring ? 0 : u64_stats_fetch_begin_irq(&ring->syncp); in iavf_add_queue_stats()
175 } while (ring && u64_stats_fetch_retry_irq(&ring->syncp, start)); in iavf_add_queue_stats()
182 * __iavf_add_stat_strings - copy stat strings into ethtool buffer
206 * iavf_add_stat_strings - copy stat strings into ethtool buffer
260 IAVF_PRIV_FLAG("legacy-rx", IAVF_FLAG_LEGACY_RX, 0),
266 * iavf_get_link_ksettings - Get Link Speed and Duplex settings
279 cmd->base.autoneg = AUTONEG_DISABLE; in iavf_get_link_ksettings()
280 cmd->base.port = PORT_NONE; in iavf_get_link_ksettings()
281 cmd->base.duplex = DUPLEX_FULL; in iavf_get_link_ksettings()
284 if (adapter->link_speed_mbps && in iavf_get_link_ksettings()
285 adapter->link_speed_mbps < U32_MAX) in iavf_get_link_ksettings()
286 cmd->base.speed = adapter->link_speed_mbps; in iavf_get_link_ksettings()
288 cmd->base.speed = SPEED_UNKNOWN; in iavf_get_link_ksettings()
293 switch (adapter->link_speed) { in iavf_get_link_ksettings()
295 cmd->base.speed = SPEED_40000; in iavf_get_link_ksettings()
298 cmd->base.speed = SPEED_25000; in iavf_get_link_ksettings()
301 cmd->base.speed = SPEED_20000; in iavf_get_link_ksettings()
304 cmd->base.speed = SPEED_10000; in iavf_get_link_ksettings()
307 cmd->base.speed = SPEED_5000; in iavf_get_link_ksettings()
310 cmd->base.speed = SPEED_2500; in iavf_get_link_ksettings()
313 cmd->base.speed = SPEED_1000; in iavf_get_link_ksettings()
316 cmd->base.speed = SPEED_100; in iavf_get_link_ksettings()
326 * iavf_get_sset_count - Get length of string set
328 * @sset: id of string set
330 * Reports size of various string tables.
340 return -EINVAL; in iavf_get_sset_count()
344 * iavf_get_ethtool_stats - report device statistics
363 /* Avoid accessing un-allocated queues */ in iavf_get_ethtool_stats()
364 ring = (i < adapter->num_active_queues ? in iavf_get_ethtool_stats()
365 &adapter->tx_rings[i] : NULL); in iavf_get_ethtool_stats()
368 /* Avoid accessing un-allocated queues */ in iavf_get_ethtool_stats()
369 ring = (i < adapter->num_active_queues ? in iavf_get_ethtool_stats()
370 &adapter->rx_rings[i] : NULL); in iavf_get_ethtool_stats()
377 * iavf_get_priv_flag_strings - Get private flag strings
379 * @data: buffer for string data
381 * Builds the private flags string table
395 * iavf_get_stat_strings - Get stat strings
397 * @data: buffer for string data
399 * Builds the statistics string table
410 for (i = 0; i < netdev->num_tx_queues; i++) { in iavf_get_stat_strings()
419 * iavf_get_strings - Get string set
421 * @sset: id of string set
422 * @data: buffer for string data
424 * Builds string tables for various string sets
441 * iavf_get_priv_flags - report device private flags
444 * The get string set count and the string set should be matched for each
460 if (priv_flags->flag & adapter->flags) in iavf_get_priv_flags()
468 * iavf_set_priv_flags - set private flags
478 orig_flags = READ_ONCE(adapter->flags); in iavf_set_priv_flags()
487 new_flags |= priv_flags->flag; in iavf_set_priv_flags()
489 new_flags &= ~(priv_flags->flag); in iavf_set_priv_flags()
491 if (priv_flags->read_only && in iavf_set_priv_flags()
493 return -EOPNOTSUPP; in iavf_set_priv_flags()
507 if (cmpxchg(&adapter->flags, orig_flags, new_flags) != orig_flags) { in iavf_set_priv_flags()
508 dev_warn(&adapter->pdev->dev, in iavf_set_priv_flags()
509 "Unable to update adapter->flags as it was modified by another thread...\n"); in iavf_set_priv_flags()
510 return -EAGAIN; in iavf_set_priv_flags()
520 /* issue a reset to force legacy-rx change to take effect */ in iavf_set_priv_flags()
523 adapter->flags |= IAVF_FLAG_RESET_NEEDED; in iavf_set_priv_flags()
524 queue_work(iavf_wq, &adapter->reset_task); in iavf_set_priv_flags()
532 * iavf_get_msglevel - Get debug message level
541 return adapter->msg_enable; in iavf_get_msglevel()
545 * iavf_set_msglevel - Set debug message level
557 adapter->hw.debug_mask = data; in iavf_set_msglevel()
558 adapter->msg_enable = data; in iavf_set_msglevel()
562 * iavf_get_drvinfo - Get driver info
573 strlcpy(drvinfo->driver, iavf_driver_name, 32); in iavf_get_drvinfo()
574 strlcpy(drvinfo->fw_version, "N/A", 4); in iavf_get_drvinfo()
575 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); in iavf_get_drvinfo()
576 drvinfo->n_priv_flags = IAVF_PRIV_FLAGS_STR_LEN; in iavf_get_drvinfo()
580 * iavf_get_ringparam - Get ring parameters
592 ring->rx_max_pending = IAVF_MAX_RXD; in iavf_get_ringparam()
593 ring->tx_max_pending = IAVF_MAX_TXD; in iavf_get_ringparam()
594 ring->rx_pending = adapter->rx_desc_count; in iavf_get_ringparam()
595 ring->tx_pending = adapter->tx_desc_count; in iavf_get_ringparam()
599 * iavf_set_ringparam - Set ring parameters
612 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) in iavf_set_ringparam()
613 return -EINVAL; in iavf_set_ringparam()
615 new_tx_count = clamp_t(u32, ring->tx_pending, in iavf_set_ringparam()
620 new_rx_count = clamp_t(u32, ring->rx_pending, in iavf_set_ringparam()
626 if ((new_tx_count == adapter->tx_desc_count) && in iavf_set_ringparam()
627 (new_rx_count == adapter->rx_desc_count)) in iavf_set_ringparam()
630 adapter->tx_desc_count = new_tx_count; in iavf_set_ringparam()
631 adapter->rx_desc_count = new_rx_count; in iavf_set_ringparam()
634 adapter->flags |= IAVF_FLAG_RESET_NEEDED; in iavf_set_ringparam()
635 queue_work(iavf_wq, &adapter->reset_task); in iavf_set_ringparam()
642 * __iavf_get_coalesce - get per-queue coalesce settings
647 * Gets the per-queue settings for coalescence. Specifically Rx and Tx usecs
648 * are per queue. If queue is <0 then we default to queue 0 as the
655 struct iavf_vsi *vsi = &adapter->vsi; in __iavf_get_coalesce()
658 ec->tx_max_coalesced_frames = vsi->work_limit; in __iavf_get_coalesce()
659 ec->rx_max_coalesced_frames = vsi->work_limit; in __iavf_get_coalesce()
661 /* Rx and Tx usecs per queue value. If user doesn't specify the in __iavf_get_coalesce()
666 else if (queue >= adapter->num_active_queues) in __iavf_get_coalesce()
667 return -EINVAL; in __iavf_get_coalesce()
669 rx_ring = &adapter->rx_rings[queue]; in __iavf_get_coalesce()
670 tx_ring = &adapter->tx_rings[queue]; in __iavf_get_coalesce()
672 if (ITR_IS_DYNAMIC(rx_ring->itr_setting)) in __iavf_get_coalesce()
673 ec->use_adaptive_rx_coalesce = 1; in __iavf_get_coalesce()
675 if (ITR_IS_DYNAMIC(tx_ring->itr_setting)) in __iavf_get_coalesce()
676 ec->use_adaptive_tx_coalesce = 1; in __iavf_get_coalesce()
678 ec->rx_coalesce_usecs = rx_ring->itr_setting & ~IAVF_ITR_DYNAMIC; in __iavf_get_coalesce()
679 ec->tx_coalesce_usecs = tx_ring->itr_setting & ~IAVF_ITR_DYNAMIC; in __iavf_get_coalesce()
685 * iavf_get_coalesce - Get interrupt coalescing settings
691 * this functionality. Note that if per-queue settings have been modified this
697 return __iavf_get_coalesce(netdev, ec, -1); in iavf_get_coalesce()
701 * iavf_get_per_queue_coalesce - get coalesce values for specific queue
715 * iavf_set_itr_per_queue - set ITR values for specific queue
725 struct iavf_ring *rx_ring = &adapter->rx_rings[queue]; in iavf_set_itr_per_queue()
726 struct iavf_ring *tx_ring = &adapter->tx_rings[queue]; in iavf_set_itr_per_queue()
729 rx_ring->itr_setting = ITR_REG_ALIGN(ec->rx_coalesce_usecs); in iavf_set_itr_per_queue()
730 tx_ring->itr_setting = ITR_REG_ALIGN(ec->tx_coalesce_usecs); in iavf_set_itr_per_queue()
732 rx_ring->itr_setting |= IAVF_ITR_DYNAMIC; in iavf_set_itr_per_queue()
733 if (!ec->use_adaptive_rx_coalesce) in iavf_set_itr_per_queue()
734 rx_ring->itr_setting ^= IAVF_ITR_DYNAMIC; in iavf_set_itr_per_queue()
736 tx_ring->itr_setting |= IAVF_ITR_DYNAMIC; in iavf_set_itr_per_queue()
737 if (!ec->use_adaptive_tx_coalesce) in iavf_set_itr_per_queue()
738 tx_ring->itr_setting ^= IAVF_ITR_DYNAMIC; in iavf_set_itr_per_queue()
740 q_vector = rx_ring->q_vector; in iavf_set_itr_per_queue()
741 q_vector->rx.target_itr = ITR_TO_REG(rx_ring->itr_setting); in iavf_set_itr_per_queue()
743 q_vector = tx_ring->q_vector; in iavf_set_itr_per_queue()
744 q_vector->tx.target_itr = ITR_TO_REG(tx_ring->itr_setting); in iavf_set_itr_per_queue()
753 * __iavf_set_coalesce - set coalesce settings for particular queue
764 struct iavf_vsi *vsi = &adapter->vsi; in __iavf_set_coalesce()
767 if (ec->tx_max_coalesced_frames_irq || ec->rx_max_coalesced_frames_irq) in __iavf_set_coalesce()
768 vsi->work_limit = ec->tx_max_coalesced_frames_irq; in __iavf_set_coalesce()
770 if (ec->rx_coalesce_usecs == 0) { in __iavf_set_coalesce()
771 if (ec->use_adaptive_rx_coalesce) in __iavf_set_coalesce()
772 …netif_info(adapter, drv, netdev, "rx-usecs=0, need to disable adaptive-rx for a complete disable\n… in __iavf_set_coalesce()
773 } else if ((ec->rx_coalesce_usecs < IAVF_MIN_ITR) || in __iavf_set_coalesce()
774 (ec->rx_coalesce_usecs > IAVF_MAX_ITR)) { in __iavf_set_coalesce()
775 netif_info(adapter, drv, netdev, "Invalid value, rx-usecs range is 0-8160\n"); in __iavf_set_coalesce()
776 return -EINVAL; in __iavf_set_coalesce()
777 } else if (ec->tx_coalesce_usecs == 0) { in __iavf_set_coalesce()
778 if (ec->use_adaptive_tx_coalesce) in __iavf_set_coalesce()
779 …netif_info(adapter, drv, netdev, "tx-usecs=0, need to disable adaptive-tx for a complete disable\n… in __iavf_set_coalesce()
780 } else if ((ec->tx_coalesce_usecs < IAVF_MIN_ITR) || in __iavf_set_coalesce()
781 (ec->tx_coalesce_usecs > IAVF_MAX_ITR)) { in __iavf_set_coalesce()
782 netif_info(adapter, drv, netdev, "Invalid value, tx-usecs range is 0-8160\n"); in __iavf_set_coalesce()
783 return -EINVAL; in __iavf_set_coalesce()
786 /* Rx and Tx usecs has per queue value. If user doesn't specify the in __iavf_set_coalesce()
790 for (i = 0; i < adapter->num_active_queues; i++) in __iavf_set_coalesce()
792 } else if (queue < adapter->num_active_queues) { in __iavf_set_coalesce()
795 netif_info(adapter, drv, netdev, "Invalid queue value, queue range is 0 - %d\n", in __iavf_set_coalesce()
796 adapter->num_active_queues - 1); in __iavf_set_coalesce()
797 return -EINVAL; in __iavf_set_coalesce()
804 * iavf_set_coalesce - Set interrupt coalescing settings
813 return __iavf_set_coalesce(netdev, ec, -1); in iavf_set_coalesce()
817 * iavf_set_per_queue_coalesce - set specific queue's coalesce settings
831 * iavf_get_rxnfc - command to get RX flow classification rules
842 int ret = -EOPNOTSUPP; in iavf_get_rxnfc()
844 switch (cmd->cmd) { in iavf_get_rxnfc()
846 cmd->data = adapter->num_active_queues; in iavf_get_rxnfc()
865 * queue pair. Report one extra channel to match our "other" MSI-X vector.
873 ch->max_combined = adapter->vsi_res->num_queue_pairs; in iavf_get_channels()
875 ch->max_other = NONQ_VECS; in iavf_get_channels()
876 ch->other_count = NONQ_VECS; in iavf_get_channels()
878 ch->combined_count = adapter->num_active_queues; in iavf_get_channels()
894 u32 num_req = ch->combined_count; in iavf_set_channels()
896 if ((adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADQ) && in iavf_set_channels()
897 adapter->num_tc) { in iavf_set_channels()
898 dev_info(&adapter->pdev->dev, "Cannot set channels since ADq is enabled.\n"); in iavf_set_channels()
899 return -EINVAL; in iavf_set_channels()
905 if (num_req > adapter->vsi_res->num_queue_pairs) in iavf_set_channels()
906 return -EINVAL; in iavf_set_channels()
908 if (num_req == adapter->num_active_queues) in iavf_set_channels()
911 if (ch->rx_count || ch->tx_count || ch->other_count != NONQ_VECS) in iavf_set_channels()
912 return -EINVAL; in iavf_set_channels()
914 adapter->num_req_queues = num_req; in iavf_set_channels()
915 adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_set_channels()
921 * iavf_get_rxfh_key_size - get the RSS hash key size
930 return adapter->rss_key_size; in iavf_get_rxfh_key_size()
934 * iavf_get_rxfh_indir_size - get the rx flow hash indirection table size
943 return adapter->rss_lut_size; in iavf_get_rxfh_indir_size()
947 * iavf_get_rxfh - get the rx flow hash indirection table
966 memcpy(key, adapter->rss_key, adapter->rss_key_size); in iavf_get_rxfh()
969 for (i = 0; i < adapter->rss_lut_size; i++) in iavf_get_rxfh()
970 indir[i] = (u32)adapter->rss_lut[i]; in iavf_get_rxfh()
976 * iavf_set_rxfh - set the rx flow hash indirection table
982 * Returns -EINVAL if the table specifies an inavlid queue id, otherwise
994 return -EOPNOTSUPP; in iavf_set_rxfh()
999 memcpy(adapter->rss_key, key, adapter->rss_key_size); in iavf_set_rxfh()
1002 for (i = 0; i < adapter->rss_lut_size; i++) in iavf_set_rxfh()
1003 adapter->rss_lut[i] = (u8)(indir[i]); in iavf_set_rxfh()
1039 * iavf_set_ethtool_ops - Initialize ethtool ops struct
1047 netdev->ethtool_ops = &iavf_ethtool_ops; in iavf_set_ethtool_ops()