Lines Matching +full:tcs +full:- +full:wait
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2013 - 2019 Intel Corporation. */
103 /* per-queue ring statistics */
168 if (interface->hw.mac.type != fm10k_mac_vf) in fm10k_get_stat_strings()
171 for (i = 0; i < interface->hw.mac.max_queues; i++) { in fm10k_get_stat_strings()
201 struct fm10k_hw *hw = &interface->hw; in fm10k_get_sset_count()
208 stats_len += hw->mac.max_queues * 2 * FM10K_QUEUE_STATS_LEN; in fm10k_get_sset_count()
210 if (hw->mac.type != fm10k_mac_vf) in fm10k_get_sset_count()
217 return -EOPNOTSUPP; in fm10k_get_sset_count()
266 struct net_device_stats *net_stats = &netdev->stats; in fm10k_get_ethtool_stats()
275 fm10k_add_ethtool_stats(&data, &interface->hw.mbx, in fm10k_get_ethtool_stats()
278 if (interface->hw.mac.type != fm10k_mac_vf) { in fm10k_get_ethtool_stats()
283 for (i = 0; i < interface->hw.mac.max_queues; i++) { in fm10k_get_ethtool_stats()
286 ring = interface->tx_ring[i]; in fm10k_get_ethtool_stats()
290 ring = interface->rx_ring[i]; in fm10k_get_ethtool_stats()
356 struct fm10k_hw *hw = &interface->hw; in fm10k_get_regs()
360 regs->version = BIT(24) | (hw->revision_id << 16) | hw->device_id; in fm10k_get_regs()
362 switch (hw->mac.type) { in fm10k_get_regs()
412 if (i < hw->mac.max_queues) in fm10k_get_regs()
434 struct fm10k_hw *hw = &interface->hw; in fm10k_get_regs_len()
436 switch (hw->mac.type) { in fm10k_get_regs_len()
451 strncpy(info->driver, fm10k_driver_name, in fm10k_get_drvinfo()
452 sizeof(info->driver) - 1); in fm10k_get_drvinfo()
453 strncpy(info->bus_info, pci_name(interface->pdev), in fm10k_get_drvinfo()
454 sizeof(info->bus_info) - 1); in fm10k_get_drvinfo()
463 pause->autoneg = 0; in fm10k_get_pauseparam()
464 pause->tx_pause = 1; in fm10k_get_pauseparam()
466 pause->rx_pause = interface->rx_pause ? 1 : 0; in fm10k_get_pauseparam()
473 struct fm10k_hw *hw = &interface->hw; in fm10k_set_pauseparam()
475 if (pause->autoneg || !pause->tx_pause) in fm10k_set_pauseparam()
476 return -EINVAL; in fm10k_set_pauseparam()
478 /* we can only support pause on the PF to avoid head-of-line blocking */ in fm10k_set_pauseparam()
479 if (hw->mac.type == fm10k_mac_pf) in fm10k_set_pauseparam()
480 interface->rx_pause = pause->rx_pause ? ~0 : 0; in fm10k_set_pauseparam()
481 else if (pause->rx_pause) in fm10k_set_pauseparam()
482 return -EINVAL; in fm10k_set_pauseparam()
494 return interface->msg_enable; in fm10k_get_msglevel()
501 interface->msg_enable = data; in fm10k_set_msglevel()
511 ring->rx_max_pending = FM10K_MAX_RXD; in fm10k_get_ringparam()
512 ring->tx_max_pending = FM10K_MAX_TXD; in fm10k_get_ringparam()
513 ring->rx_mini_max_pending = 0; in fm10k_get_ringparam()
514 ring->rx_jumbo_max_pending = 0; in fm10k_get_ringparam()
515 ring->rx_pending = interface->rx_ring_count; in fm10k_get_ringparam()
516 ring->tx_pending = interface->tx_ring_count; in fm10k_get_ringparam()
517 ring->rx_mini_pending = 0; in fm10k_get_ringparam()
518 ring->rx_jumbo_pending = 0; in fm10k_get_ringparam()
531 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) in fm10k_set_ringparam()
532 return -EINVAL; in fm10k_set_ringparam()
534 new_tx_count = clamp_t(u32, ring->tx_pending, in fm10k_set_ringparam()
538 new_rx_count = clamp_t(u32, ring->rx_pending, in fm10k_set_ringparam()
542 if ((new_tx_count == interface->tx_ring_count) && in fm10k_set_ringparam()
543 (new_rx_count == interface->rx_ring_count)) { in fm10k_set_ringparam()
548 while (test_and_set_bit(__FM10K_RESETTING, interface->state)) in fm10k_set_ringparam()
551 if (!netif_running(interface->netdev)) { in fm10k_set_ringparam()
552 for (i = 0; i < interface->num_tx_queues; i++) in fm10k_set_ringparam()
553 interface->tx_ring[i]->count = new_tx_count; in fm10k_set_ringparam()
554 for (i = 0; i < interface->num_rx_queues; i++) in fm10k_set_ringparam()
555 interface->rx_ring[i]->count = new_rx_count; in fm10k_set_ringparam()
556 interface->tx_ring_count = new_tx_count; in fm10k_set_ringparam()
557 interface->rx_ring_count = new_rx_count; in fm10k_set_ringparam()
562 i = max_t(int, interface->num_tx_queues, interface->num_rx_queues); in fm10k_set_ringparam()
566 err = -ENOMEM; in fm10k_set_ringparam()
577 if (new_tx_count != interface->tx_ring_count) { in fm10k_set_ringparam()
578 for (i = 0; i < interface->num_tx_queues; i++) { in fm10k_set_ringparam()
579 memcpy(&temp_ring[i], interface->tx_ring[i], in fm10k_set_ringparam()
586 i--; in fm10k_set_ringparam()
593 for (i = 0; i < interface->num_tx_queues; i++) { in fm10k_set_ringparam()
594 fm10k_free_tx_resources(interface->tx_ring[i]); in fm10k_set_ringparam()
596 memcpy(interface->tx_ring[i], &temp_ring[i], in fm10k_set_ringparam()
600 interface->tx_ring_count = new_tx_count; in fm10k_set_ringparam()
604 if (new_rx_count != interface->rx_ring_count) { in fm10k_set_ringparam()
605 for (i = 0; i < interface->num_rx_queues; i++) { in fm10k_set_ringparam()
606 memcpy(&temp_ring[i], interface->rx_ring[i], in fm10k_set_ringparam()
613 i--; in fm10k_set_ringparam()
620 for (i = 0; i < interface->num_rx_queues; i++) { in fm10k_set_ringparam()
621 fm10k_free_rx_resources(interface->rx_ring[i]); in fm10k_set_ringparam()
623 memcpy(interface->rx_ring[i], &temp_ring[i], in fm10k_set_ringparam()
627 interface->rx_ring_count = new_rx_count; in fm10k_set_ringparam()
634 clear_bit(__FM10K_RESETTING, interface->state); in fm10k_set_ringparam()
645 ec->use_adaptive_tx_coalesce = ITR_IS_ADAPTIVE(interface->tx_itr); in fm10k_get_coalesce()
646 ec->tx_coalesce_usecs = interface->tx_itr & ~FM10K_ITR_ADAPTIVE; in fm10k_get_coalesce()
648 ec->use_adaptive_rx_coalesce = ITR_IS_ADAPTIVE(interface->rx_itr); in fm10k_get_coalesce()
649 ec->rx_coalesce_usecs = interface->rx_itr & ~FM10K_ITR_ADAPTIVE; in fm10k_get_coalesce()
664 if ((ec->rx_coalesce_usecs > FM10K_ITR_MAX) || in fm10k_set_coalesce()
665 (ec->tx_coalesce_usecs > FM10K_ITR_MAX)) in fm10k_set_coalesce()
666 return -EINVAL; in fm10k_set_coalesce()
669 tx_itr = ec->tx_coalesce_usecs; in fm10k_set_coalesce()
670 rx_itr = ec->rx_coalesce_usecs; in fm10k_set_coalesce()
673 if (ec->use_adaptive_tx_coalesce) in fm10k_set_coalesce()
676 if (ec->use_adaptive_rx_coalesce) in fm10k_set_coalesce()
680 interface->tx_itr = tx_itr; in fm10k_set_coalesce()
681 interface->rx_itr = rx_itr; in fm10k_set_coalesce()
684 for (i = 0; i < interface->num_q_vectors; i++) { in fm10k_set_coalesce()
685 struct fm10k_q_vector *qv = interface->q_vector[i]; in fm10k_set_coalesce()
687 qv->tx.itr = tx_itr; in fm10k_set_coalesce()
688 qv->rx.itr = rx_itr; in fm10k_set_coalesce()
697 cmd->data = 0; in fm10k_get_rss_hash_opts()
700 switch (cmd->flow_type) { in fm10k_get_rss_hash_opts()
703 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in fm10k_get_rss_hash_opts()
707 interface->flags)) in fm10k_get_rss_hash_opts()
708 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in fm10k_get_rss_hash_opts()
720 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in fm10k_get_rss_hash_opts()
724 interface->flags)) in fm10k_get_rss_hash_opts()
725 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in fm10k_get_rss_hash_opts()
726 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in fm10k_get_rss_hash_opts()
729 return -EINVAL; in fm10k_get_rss_hash_opts()
739 int ret = -EOPNOTSUPP; in fm10k_get_rxnfc()
741 switch (cmd->cmd) { in fm10k_get_rxnfc()
743 cmd->data = interface->num_rx_queues; in fm10k_get_rxnfc()
760 interface->flags); in fm10k_set_rss_hash_opt()
762 interface->flags); in fm10k_set_rss_hash_opt()
767 if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST | in fm10k_set_rss_hash_opt()
769 return -EINVAL; in fm10k_set_rss_hash_opt()
771 switch (nfc->flow_type) { in fm10k_set_rss_hash_opt()
774 if (!(nfc->data & RXH_IP_SRC) || in fm10k_set_rss_hash_opt()
775 !(nfc->data & RXH_IP_DST) || in fm10k_set_rss_hash_opt()
776 !(nfc->data & RXH_L4_B_0_1) || in fm10k_set_rss_hash_opt()
777 !(nfc->data & RXH_L4_B_2_3)) in fm10k_set_rss_hash_opt()
778 return -EINVAL; in fm10k_set_rss_hash_opt()
781 if (!(nfc->data & RXH_IP_SRC) || in fm10k_set_rss_hash_opt()
782 !(nfc->data & RXH_IP_DST)) in fm10k_set_rss_hash_opt()
783 return -EINVAL; in fm10k_set_rss_hash_opt()
784 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in fm10k_set_rss_hash_opt()
787 interface->flags); in fm10k_set_rss_hash_opt()
791 interface->flags); in fm10k_set_rss_hash_opt()
794 return -EINVAL; in fm10k_set_rss_hash_opt()
798 if (!(nfc->data & RXH_IP_SRC) || in fm10k_set_rss_hash_opt()
799 !(nfc->data & RXH_IP_DST)) in fm10k_set_rss_hash_opt()
800 return -EINVAL; in fm10k_set_rss_hash_opt()
801 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in fm10k_set_rss_hash_opt()
804 interface->flags); in fm10k_set_rss_hash_opt()
808 interface->flags); in fm10k_set_rss_hash_opt()
811 return -EINVAL; in fm10k_set_rss_hash_opt()
822 if (!(nfc->data & RXH_IP_SRC) || in fm10k_set_rss_hash_opt()
823 !(nfc->data & RXH_IP_DST) || in fm10k_set_rss_hash_opt()
824 (nfc->data & RXH_L4_B_0_1) || in fm10k_set_rss_hash_opt()
825 (nfc->data & RXH_L4_B_2_3)) in fm10k_set_rss_hash_opt()
826 return -EINVAL; in fm10k_set_rss_hash_opt()
829 return -EINVAL; in fm10k_set_rss_hash_opt()
837 interface->flags)) || in fm10k_set_rss_hash_opt()
839 interface->flags))) { in fm10k_set_rss_hash_opt()
840 struct fm10k_hw *hw = &interface->hw; in fm10k_set_rss_hash_opt()
851 interface->flags)) { in fm10k_set_rss_hash_opt()
856 interface->flags)) { in fm10k_set_rss_hash_opt()
865 netif_warn(interface, drv, interface->netdev, in fm10k_set_rss_hash_opt()
877 int ret = -EOPNOTSUPP; in fm10k_set_rxnfc()
879 switch (cmd->cmd) { in fm10k_set_rxnfc()
892 struct fm10k_hw *hw = &interface->hw; in fm10k_mbx_test()
893 struct fm10k_mbx_info *mbx = &hw->mbx; in fm10k_mbx_test()
896 int err = -EINVAL; in fm10k_mbx_test()
899 if (hw->mac.type != fm10k_mac_vf) in fm10k_mbx_test()
910 mbx->test_result = FM10K_NOT_IMPLEMENTED; in fm10k_mbx_test()
911 err = mbx->ops.enqueue_tx(hw, mbx, test_msg); in fm10k_mbx_test()
914 /* wait up to 1 second for response */ in fm10k_mbx_test()
923 mbx->ops.process(hw, mbx); in fm10k_mbx_test()
926 err = mbx->test_result; in fm10k_mbx_test()
945 struct fm10k_hw *hw = &interface->hw; in fm10k_self_test()
949 if (FM10K_REMOVED(hw->hw_addr)) { in fm10k_self_test()
951 "Interface removed - test blocked\n"); in fm10k_self_test()
952 eth_test->flags |= ETH_TEST_FL_FAILED; in fm10k_self_test()
957 eth_test->flags |= ETH_TEST_FL_FAILED; in fm10k_self_test()
968 return -EINVAL; in fm10k_set_priv_flags()
980 u16 rss_i = interface->ring_feature[RING_F_RSS].indices; in fm10k_write_reta()
981 struct fm10k_hw *hw = &interface->hw; in fm10k_write_reta()
1005 if (interface->reta[i] == reta) in fm10k_write_reta()
1008 interface->reta[i] = reta; in fm10k_write_reta()
1022 u32 reta = interface->reta[i]; in fm10k_get_reta()
1043 rss_i = interface->ring_feature[RING_F_RSS].indices; in fm10k_set_reta()
1044 for (i = fm10k_get_reta_size(netdev); i--;) { in fm10k_set_reta()
1047 return -EINVAL; in fm10k_set_reta()
1074 *(__le32 *)key = cpu_to_le32(interface->rssrk[i]); in fm10k_get_rssh()
1083 struct fm10k_hw *hw = &interface->hw; in fm10k_set_rssh()
1088 return -EOPNOTSUPP; in fm10k_set_rssh()
1097 if (interface->rssrk[i] == rssrk) in fm10k_set_rssh()
1100 interface->rssrk[i] = rssrk; in fm10k_set_rssh()
1110 unsigned int max_combined = interface->hw.mac.max_queues; in fm10k_max_channels()
1111 u8 tcs = netdev_get_num_tc(dev); in fm10k_max_channels() local
1114 if (tcs > 1) in fm10k_max_channels()
1115 max_combined = BIT((fls(max_combined / tcs) - 1)); in fm10k_max_channels()
1126 ch->max_combined = fm10k_max_channels(dev); in fm10k_get_channels()
1129 ch->max_other = NON_Q_VECTORS; in fm10k_get_channels()
1130 ch->other_count = ch->max_other; in fm10k_get_channels()
1133 ch->combined_count = interface->ring_feature[RING_F_RSS].indices; in fm10k_get_channels()
1140 unsigned int count = ch->combined_count; in fm10k_set_channels()
1143 if (!count || ch->rx_count || ch->tx_count) in fm10k_set_channels()
1144 return -EINVAL; in fm10k_set_channels()
1147 if (ch->other_count != NON_Q_VECTORS) in fm10k_set_channels()
1148 return -EINVAL; in fm10k_set_channels()
1152 return -EINVAL; in fm10k_set_channels()
1154 interface->ring_feature[RING_F_RSS].limit = count; in fm10k_set_channels()
1194 dev->ethtool_ops = &fm10k_ethtool_ops; in fm10k_set_ethtool_ops()