Lines Matching +full:tcs +full:- +full:wait

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2013 - 2019 Intel Corporation. */
102 /* per-queue ring statistics */
167 if (interface->hw.mac.type != fm10k_mac_vf) in fm10k_get_stat_strings()
170 for (i = 0; i < interface->hw.mac.max_queues; i++) { in fm10k_get_stat_strings()
200 struct fm10k_hw *hw = &interface->hw; in fm10k_get_sset_count()
207 stats_len += hw->mac.max_queues * 2 * FM10K_QUEUE_STATS_LEN; in fm10k_get_sset_count()
209 if (hw->mac.type != fm10k_mac_vf) in fm10k_get_sset_count()
216 return -EOPNOTSUPP; in fm10k_get_sset_count()
265 struct net_device_stats *net_stats = &netdev->stats; in fm10k_get_ethtool_stats()
274 fm10k_add_ethtool_stats(&data, &interface->hw.mbx, in fm10k_get_ethtool_stats()
277 if (interface->hw.mac.type != fm10k_mac_vf) { in fm10k_get_ethtool_stats()
282 for (i = 0; i < interface->hw.mac.max_queues; i++) { in fm10k_get_ethtool_stats()
285 ring = interface->tx_ring[i]; in fm10k_get_ethtool_stats()
289 ring = interface->rx_ring[i]; in fm10k_get_ethtool_stats()
355 struct fm10k_hw *hw = &interface->hw; in fm10k_get_regs()
359 regs->version = BIT(24) | (hw->revision_id << 16) | hw->device_id; in fm10k_get_regs()
361 switch (hw->mac.type) { in fm10k_get_regs()
411 if (i < hw->mac.max_queues) in fm10k_get_regs()
433 struct fm10k_hw *hw = &interface->hw; in fm10k_get_regs_len()
435 switch (hw->mac.type) { in fm10k_get_regs_len()
450 strncpy(info->driver, fm10k_driver_name, in fm10k_get_drvinfo()
451 sizeof(info->driver) - 1); in fm10k_get_drvinfo()
452 strncpy(info->bus_info, pci_name(interface->pdev), in fm10k_get_drvinfo()
453 sizeof(info->bus_info) - 1); in fm10k_get_drvinfo()
462 pause->autoneg = 0; in fm10k_get_pauseparam()
463 pause->tx_pause = 1; in fm10k_get_pauseparam()
465 pause->rx_pause = interface->rx_pause ? 1 : 0; in fm10k_get_pauseparam()
472 struct fm10k_hw *hw = &interface->hw; in fm10k_set_pauseparam()
474 if (pause->autoneg || !pause->tx_pause) in fm10k_set_pauseparam()
475 return -EINVAL; in fm10k_set_pauseparam()
477 /* we can only support pause on the PF to avoid head-of-line blocking */ in fm10k_set_pauseparam()
478 if (hw->mac.type == fm10k_mac_pf) in fm10k_set_pauseparam()
479 interface->rx_pause = pause->rx_pause ? ~0 : 0; in fm10k_set_pauseparam()
480 else if (pause->rx_pause) in fm10k_set_pauseparam()
481 return -EINVAL; in fm10k_set_pauseparam()
493 return interface->msg_enable; in fm10k_get_msglevel()
500 interface->msg_enable = data; in fm10k_set_msglevel()
508 ring->rx_max_pending = FM10K_MAX_RXD; in fm10k_get_ringparam()
509 ring->tx_max_pending = FM10K_MAX_TXD; in fm10k_get_ringparam()
510 ring->rx_mini_max_pending = 0; in fm10k_get_ringparam()
511 ring->rx_jumbo_max_pending = 0; in fm10k_get_ringparam()
512 ring->rx_pending = interface->rx_ring_count; in fm10k_get_ringparam()
513 ring->tx_pending = interface->tx_ring_count; in fm10k_get_ringparam()
514 ring->rx_mini_pending = 0; in fm10k_get_ringparam()
515 ring->rx_jumbo_pending = 0; in fm10k_get_ringparam()
526 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) in fm10k_set_ringparam()
527 return -EINVAL; in fm10k_set_ringparam()
529 new_tx_count = clamp_t(u32, ring->tx_pending, in fm10k_set_ringparam()
533 new_rx_count = clamp_t(u32, ring->rx_pending, in fm10k_set_ringparam()
537 if ((new_tx_count == interface->tx_ring_count) && in fm10k_set_ringparam()
538 (new_rx_count == interface->rx_ring_count)) { in fm10k_set_ringparam()
543 while (test_and_set_bit(__FM10K_RESETTING, interface->state)) in fm10k_set_ringparam()
546 if (!netif_running(interface->netdev)) { in fm10k_set_ringparam()
547 for (i = 0; i < interface->num_tx_queues; i++) in fm10k_set_ringparam()
548 interface->tx_ring[i]->count = new_tx_count; in fm10k_set_ringparam()
549 for (i = 0; i < interface->num_rx_queues; i++) in fm10k_set_ringparam()
550 interface->rx_ring[i]->count = new_rx_count; in fm10k_set_ringparam()
551 interface->tx_ring_count = new_tx_count; in fm10k_set_ringparam()
552 interface->rx_ring_count = new_rx_count; in fm10k_set_ringparam()
557 i = max_t(int, interface->num_tx_queues, interface->num_rx_queues); in fm10k_set_ringparam()
561 err = -ENOMEM; in fm10k_set_ringparam()
572 if (new_tx_count != interface->tx_ring_count) { in fm10k_set_ringparam()
573 for (i = 0; i < interface->num_tx_queues; i++) { in fm10k_set_ringparam()
574 memcpy(&temp_ring[i], interface->tx_ring[i], in fm10k_set_ringparam()
581 i--; in fm10k_set_ringparam()
588 for (i = 0; i < interface->num_tx_queues; i++) { in fm10k_set_ringparam()
589 fm10k_free_tx_resources(interface->tx_ring[i]); in fm10k_set_ringparam()
591 memcpy(interface->tx_ring[i], &temp_ring[i], in fm10k_set_ringparam()
595 interface->tx_ring_count = new_tx_count; in fm10k_set_ringparam()
599 if (new_rx_count != interface->rx_ring_count) { in fm10k_set_ringparam()
600 for (i = 0; i < interface->num_rx_queues; i++) { in fm10k_set_ringparam()
601 memcpy(&temp_ring[i], interface->rx_ring[i], in fm10k_set_ringparam()
608 i--; in fm10k_set_ringparam()
615 for (i = 0; i < interface->num_rx_queues; i++) { in fm10k_set_ringparam()
616 fm10k_free_rx_resources(interface->rx_ring[i]); in fm10k_set_ringparam()
618 memcpy(interface->rx_ring[i], &temp_ring[i], in fm10k_set_ringparam()
622 interface->rx_ring_count = new_rx_count; in fm10k_set_ringparam()
629 clear_bit(__FM10K_RESETTING, interface->state); in fm10k_set_ringparam()
638 ec->use_adaptive_tx_coalesce = ITR_IS_ADAPTIVE(interface->tx_itr); in fm10k_get_coalesce()
639 ec->tx_coalesce_usecs = interface->tx_itr & ~FM10K_ITR_ADAPTIVE; in fm10k_get_coalesce()
641 ec->use_adaptive_rx_coalesce = ITR_IS_ADAPTIVE(interface->rx_itr); in fm10k_get_coalesce()
642 ec->rx_coalesce_usecs = interface->rx_itr & ~FM10K_ITR_ADAPTIVE; in fm10k_get_coalesce()
655 if ((ec->rx_coalesce_usecs > FM10K_ITR_MAX) || in fm10k_set_coalesce()
656 (ec->tx_coalesce_usecs > FM10K_ITR_MAX)) in fm10k_set_coalesce()
657 return -EINVAL; in fm10k_set_coalesce()
660 tx_itr = ec->tx_coalesce_usecs; in fm10k_set_coalesce()
661 rx_itr = ec->rx_coalesce_usecs; in fm10k_set_coalesce()
664 if (ec->use_adaptive_tx_coalesce) in fm10k_set_coalesce()
667 if (ec->use_adaptive_rx_coalesce) in fm10k_set_coalesce()
671 interface->tx_itr = tx_itr; in fm10k_set_coalesce()
672 interface->rx_itr = rx_itr; in fm10k_set_coalesce()
675 for (i = 0; i < interface->num_q_vectors; i++) { in fm10k_set_coalesce()
676 struct fm10k_q_vector *qv = interface->q_vector[i]; in fm10k_set_coalesce()
678 qv->tx.itr = tx_itr; in fm10k_set_coalesce()
679 qv->rx.itr = rx_itr; in fm10k_set_coalesce()
688 cmd->data = 0; in fm10k_get_rss_hash_opts()
691 switch (cmd->flow_type) { in fm10k_get_rss_hash_opts()
694 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in fm10k_get_rss_hash_opts()
698 interface->flags)) in fm10k_get_rss_hash_opts()
699 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in fm10k_get_rss_hash_opts()
711 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in fm10k_get_rss_hash_opts()
715 interface->flags)) in fm10k_get_rss_hash_opts()
716 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in fm10k_get_rss_hash_opts()
717 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in fm10k_get_rss_hash_opts()
720 return -EINVAL; in fm10k_get_rss_hash_opts()
730 int ret = -EOPNOTSUPP; in fm10k_get_rxnfc()
732 switch (cmd->cmd) { in fm10k_get_rxnfc()
734 cmd->data = interface->num_rx_queues; in fm10k_get_rxnfc()
751 interface->flags); in fm10k_set_rss_hash_opt()
753 interface->flags); in fm10k_set_rss_hash_opt()
758 if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST | in fm10k_set_rss_hash_opt()
760 return -EINVAL; in fm10k_set_rss_hash_opt()
762 switch (nfc->flow_type) { in fm10k_set_rss_hash_opt()
765 if (!(nfc->data & RXH_IP_SRC) || in fm10k_set_rss_hash_opt()
766 !(nfc->data & RXH_IP_DST) || in fm10k_set_rss_hash_opt()
767 !(nfc->data & RXH_L4_B_0_1) || in fm10k_set_rss_hash_opt()
768 !(nfc->data & RXH_L4_B_2_3)) in fm10k_set_rss_hash_opt()
769 return -EINVAL; in fm10k_set_rss_hash_opt()
772 if (!(nfc->data & RXH_IP_SRC) || in fm10k_set_rss_hash_opt()
773 !(nfc->data & RXH_IP_DST)) in fm10k_set_rss_hash_opt()
774 return -EINVAL; in fm10k_set_rss_hash_opt()
775 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in fm10k_set_rss_hash_opt()
778 interface->flags); in fm10k_set_rss_hash_opt()
782 interface->flags); in fm10k_set_rss_hash_opt()
785 return -EINVAL; in fm10k_set_rss_hash_opt()
789 if (!(nfc->data & RXH_IP_SRC) || in fm10k_set_rss_hash_opt()
790 !(nfc->data & RXH_IP_DST)) in fm10k_set_rss_hash_opt()
791 return -EINVAL; in fm10k_set_rss_hash_opt()
792 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in fm10k_set_rss_hash_opt()
795 interface->flags); in fm10k_set_rss_hash_opt()
799 interface->flags); in fm10k_set_rss_hash_opt()
802 return -EINVAL; in fm10k_set_rss_hash_opt()
813 if (!(nfc->data & RXH_IP_SRC) || in fm10k_set_rss_hash_opt()
814 !(nfc->data & RXH_IP_DST) || in fm10k_set_rss_hash_opt()
815 (nfc->data & RXH_L4_B_0_1) || in fm10k_set_rss_hash_opt()
816 (nfc->data & RXH_L4_B_2_3)) in fm10k_set_rss_hash_opt()
817 return -EINVAL; in fm10k_set_rss_hash_opt()
820 return -EINVAL; in fm10k_set_rss_hash_opt()
828 interface->flags)) || in fm10k_set_rss_hash_opt()
830 interface->flags))) { in fm10k_set_rss_hash_opt()
831 struct fm10k_hw *hw = &interface->hw; in fm10k_set_rss_hash_opt()
842 interface->flags)) { in fm10k_set_rss_hash_opt()
847 interface->flags)) { in fm10k_set_rss_hash_opt()
856 netif_warn(interface, drv, interface->netdev, in fm10k_set_rss_hash_opt()
868 int ret = -EOPNOTSUPP; in fm10k_set_rxnfc()
870 switch (cmd->cmd) { in fm10k_set_rxnfc()
883 struct fm10k_hw *hw = &interface->hw; in fm10k_mbx_test()
884 struct fm10k_mbx_info *mbx = &hw->mbx; in fm10k_mbx_test()
887 int err = -EINVAL; in fm10k_mbx_test()
890 if (hw->mac.type != fm10k_mac_vf) in fm10k_mbx_test()
901 mbx->test_result = FM10K_NOT_IMPLEMENTED; in fm10k_mbx_test()
902 err = mbx->ops.enqueue_tx(hw, mbx, test_msg); in fm10k_mbx_test()
905 /* wait up to 1 second for response */ in fm10k_mbx_test()
914 mbx->ops.process(hw, mbx); in fm10k_mbx_test()
917 err = mbx->test_result; in fm10k_mbx_test()
936 struct fm10k_hw *hw = &interface->hw; in fm10k_self_test()
940 if (FM10K_REMOVED(hw->hw_addr)) { in fm10k_self_test()
942 "Interface removed - test blocked\n"); in fm10k_self_test()
943 eth_test->flags |= ETH_TEST_FL_FAILED; in fm10k_self_test()
948 eth_test->flags |= ETH_TEST_FL_FAILED; in fm10k_self_test()
959 return -EINVAL; in fm10k_set_priv_flags()
971 u16 rss_i = interface->ring_feature[RING_F_RSS].indices; in fm10k_write_reta()
972 struct fm10k_hw *hw = &interface->hw; in fm10k_write_reta()
996 if (interface->reta[i] == reta) in fm10k_write_reta()
999 interface->reta[i] = reta; in fm10k_write_reta()
1013 u32 reta = interface->reta[i]; in fm10k_get_reta()
1034 rss_i = interface->ring_feature[RING_F_RSS].indices; in fm10k_set_reta()
1035 for (i = fm10k_get_reta_size(netdev); i--;) { in fm10k_set_reta()
1038 return -EINVAL; in fm10k_set_reta()
1065 *(__le32 *)key = cpu_to_le32(interface->rssrk[i]); in fm10k_get_rssh()
1074 struct fm10k_hw *hw = &interface->hw; in fm10k_set_rssh()
1079 return -EOPNOTSUPP; in fm10k_set_rssh()
1088 if (interface->rssrk[i] == rssrk) in fm10k_set_rssh()
1091 interface->rssrk[i] = rssrk; in fm10k_set_rssh()
1101 unsigned int max_combined = interface->hw.mac.max_queues; in fm10k_max_channels()
1102 u8 tcs = netdev_get_num_tc(dev); in fm10k_max_channels() local
1105 if (tcs > 1) in fm10k_max_channels()
1106 max_combined = BIT((fls(max_combined / tcs) - 1)); in fm10k_max_channels()
1117 ch->max_combined = fm10k_max_channels(dev); in fm10k_get_channels()
1120 ch->max_other = NON_Q_VECTORS; in fm10k_get_channels()
1121 ch->other_count = ch->max_other; in fm10k_get_channels()
1124 ch->combined_count = interface->ring_feature[RING_F_RSS].indices; in fm10k_get_channels()
1131 unsigned int count = ch->combined_count; in fm10k_set_channels()
1134 if (!count || ch->rx_count || ch->tx_count) in fm10k_set_channels()
1135 return -EINVAL; in fm10k_set_channels()
1138 if (ch->other_count != NON_Q_VECTORS) in fm10k_set_channels()
1139 return -EINVAL; in fm10k_set_channels()
1143 return -EINVAL; in fm10k_set_channels()
1145 interface->ring_feature[RING_F_RSS].limit = count; in fm10k_set_channels()
1185 dev->ethtool_ops = &fm10k_ethtool_ops; in fm10k_set_ethtool_ops()