Lines Matching +full:asym +full:- +full:pause
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (C) 2014-2019 aQuantia Corporation
5 * Copyright (C) 2019-2020 Marvell International Ltd.
54 struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; in aq_nic_rss_init()
58 rss_params = &cfg->aq_rss; in aq_nic_rss_init()
60 rss_params->hash_secret_key_size = sizeof(rss_key); in aq_nic_rss_init()
61 memcpy(rss_params->hash_secret_key, rss_key, sizeof(rss_key)); in aq_nic_rss_init()
62 rss_params->indirection_table_size = AQ_CFG_RSS_INDIRECTION_TABLE_MAX; in aq_nic_rss_init()
64 for (i = rss_params->indirection_table_size; i--;) in aq_nic_rss_init()
65 rss_params->indirection_table[i] = i & (num_rss_queues - 1); in aq_nic_rss_init()
71 struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; in aq_nic_cfg_update_num_vecs()
73 cfg->vecs = min(cfg->aq_hw_caps->vecs, AQ_CFG_VECS_DEF); in aq_nic_cfg_update_num_vecs()
74 cfg->vecs = min(cfg->vecs, num_online_cpus()); in aq_nic_cfg_update_num_vecs()
75 if (self->irqvecs > AQ_HW_SERVICE_IRQS) in aq_nic_cfg_update_num_vecs()
76 cfg->vecs = min(cfg->vecs, self->irqvecs - AQ_HW_SERVICE_IRQS); in aq_nic_cfg_update_num_vecs()
77 /* cfg->vecs should be power of 2 for RSS */ in aq_nic_cfg_update_num_vecs()
78 cfg->vecs = rounddown_pow_of_two(cfg->vecs); in aq_nic_cfg_update_num_vecs()
80 if (ATL_HW_IS_CHIP_FEATURE(self->aq_hw, ANTIGUA)) { in aq_nic_cfg_update_num_vecs()
81 if (cfg->tcs > 2) in aq_nic_cfg_update_num_vecs()
82 cfg->vecs = min(cfg->vecs, 4U); in aq_nic_cfg_update_num_vecs()
85 if (cfg->vecs <= 4) in aq_nic_cfg_update_num_vecs()
86 cfg->tc_mode = AQ_TC_MODE_8TCS; in aq_nic_cfg_update_num_vecs()
88 cfg->tc_mode = AQ_TC_MODE_4TCS; in aq_nic_cfg_update_num_vecs()
91 cfg->num_rss_queues = min(cfg->vecs, AQ_CFG_NUM_RSS_QUEUES_DEF); in aq_nic_cfg_update_num_vecs()
92 aq_nic_rss_init(self, cfg->num_rss_queues); in aq_nic_cfg_update_num_vecs()
98 struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; in aq_nic_cfg_start()
101 cfg->tcs = AQ_CFG_TCS_DEF; in aq_nic_cfg_start()
103 cfg->is_polling = AQ_CFG_IS_POLLING_DEF; in aq_nic_cfg_start()
105 cfg->itr = aq_itr; in aq_nic_cfg_start()
106 cfg->tx_itr = aq_itr_tx; in aq_nic_cfg_start()
107 cfg->rx_itr = aq_itr_rx; in aq_nic_cfg_start()
109 cfg->rxpageorder = AQ_CFG_RX_PAGEORDER; in aq_nic_cfg_start()
110 cfg->is_rss = AQ_CFG_IS_RSS_DEF; in aq_nic_cfg_start()
111 cfg->aq_rss.base_cpu_number = AQ_CFG_RSS_BASE_CPU_NUM_DEF; in aq_nic_cfg_start()
112 cfg->fc.req = AQ_CFG_FC_MODE; in aq_nic_cfg_start()
113 cfg->wol = AQ_CFG_WOL_MODES; in aq_nic_cfg_start()
115 cfg->mtu = AQ_CFG_MTU_DEF; in aq_nic_cfg_start()
116 cfg->link_speed_msk = AQ_CFG_SPEED_MSK; in aq_nic_cfg_start()
117 cfg->is_autoneg = AQ_CFG_IS_AUTONEG_DEF; in aq_nic_cfg_start()
119 cfg->is_lro = AQ_CFG_IS_LRO_DEF; in aq_nic_cfg_start()
120 cfg->is_ptp = true; in aq_nic_cfg_start()
123 cfg->rxds = min(cfg->aq_hw_caps->rxds_max, AQ_CFG_RXDS_DEF); in aq_nic_cfg_start()
124 cfg->txds = min(cfg->aq_hw_caps->txds_max, AQ_CFG_TXDS_DEF); in aq_nic_cfg_start()
128 cfg->irq_type = aq_pci_func_get_irq_type(self); in aq_nic_cfg_start()
130 if ((cfg->irq_type == AQ_HW_IRQ_INTX) || in aq_nic_cfg_start()
131 (cfg->aq_hw_caps->vecs == 1U) || in aq_nic_cfg_start()
132 (cfg->vecs == 1U)) { in aq_nic_cfg_start()
133 cfg->is_rss = 0U; in aq_nic_cfg_start()
134 cfg->vecs = 1U; in aq_nic_cfg_start()
138 * link status IRQ. If no - we'll know link state from in aq_nic_cfg_start()
141 if (AQ_HW_SERVICE_IRQS > 0 && cfg->vecs + 1 <= self->irqvecs) in aq_nic_cfg_start()
142 cfg->link_irq_vec = cfg->vecs; in aq_nic_cfg_start()
144 cfg->link_irq_vec = 0; in aq_nic_cfg_start()
146 cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk; in aq_nic_cfg_start()
147 cfg->features = cfg->aq_hw_caps->hw_features; in aq_nic_cfg_start()
148 cfg->is_vlan_rx_strip = !!(cfg->features & NETIF_F_HW_VLAN_CTAG_RX); in aq_nic_cfg_start()
149 cfg->is_vlan_tx_insert = !!(cfg->features & NETIF_F_HW_VLAN_CTAG_TX); in aq_nic_cfg_start()
150 cfg->is_vlan_force_promisc = true; in aq_nic_cfg_start()
152 for (i = 0; i < sizeof(cfg->prio_tc_map); i++) in aq_nic_cfg_start()
153 cfg->prio_tc_map[i] = cfg->tcs * i / 8; in aq_nic_cfg_start()
158 int err = self->aq_fw_ops->update_link_status(self->aq_hw); in aq_nic_update_link_status()
164 if (self->aq_fw_ops->get_flow_control) in aq_nic_update_link_status()
165 self->aq_fw_ops->get_flow_control(self->aq_hw, &fc); in aq_nic_update_link_status()
166 self->aq_nic_cfg.fc.cur = fc; in aq_nic_update_link_status()
168 if (self->link_status.mbps != self->aq_hw->aq_link_status.mbps) { in aq_nic_update_link_status()
169 netdev_info(self->ndev, "%s: link change old %d new %d\n", in aq_nic_update_link_status()
170 AQ_CFG_DRV_NAME, self->link_status.mbps, in aq_nic_update_link_status()
171 self->aq_hw->aq_link_status.mbps); in aq_nic_update_link_status()
174 if (self->aq_ptp) { in aq_nic_update_link_status()
177 self->aq_hw->aq_link_status.mbps); in aq_nic_update_link_status()
185 if (self->aq_hw_ops->hw_set_fc) in aq_nic_update_link_status()
186 self->aq_hw_ops->hw_set_fc(self->aq_hw, fc, 0); in aq_nic_update_link_status()
189 self->link_status = self->aq_hw->aq_link_status; in aq_nic_update_link_status()
190 if (!netif_carrier_ok(self->ndev) && self->link_status.mbps) { in aq_nic_update_link_status()
191 aq_utils_obj_set(&self->flags, in aq_nic_update_link_status()
193 aq_utils_obj_clear(&self->flags, in aq_nic_update_link_status()
195 netif_carrier_on(self->ndev); in aq_nic_update_link_status()
199 if (self->aq_hw_ops->hw_tc_rate_limit_set) in aq_nic_update_link_status()
200 self->aq_hw_ops->hw_tc_rate_limit_set(self->aq_hw); in aq_nic_update_link_status()
202 netif_tx_wake_all_queues(self->ndev); in aq_nic_update_link_status()
204 if (netif_carrier_ok(self->ndev) && !self->link_status.mbps) { in aq_nic_update_link_status()
205 netif_carrier_off(self->ndev); in aq_nic_update_link_status()
206 netif_tx_disable(self->ndev); in aq_nic_update_link_status()
207 aq_utils_obj_set(&self->flags, AQ_NIC_LINK_DOWN); in aq_nic_update_link_status()
222 self->aq_hw_ops->hw_irq_enable(self->aq_hw, in aq_linkstate_threaded_isr()
223 BIT(self->aq_nic_cfg.link_irq_vec)); in aq_linkstate_threaded_isr()
236 if (aq_utils_obj_test(&self->flags, AQ_NIC_FLAGS_IS_NOT_READY)) in aq_nic_service_task()
247 mutex_lock(&self->fwreq_mutex); in aq_nic_service_task()
248 if (self->aq_fw_ops->update_stats) in aq_nic_service_task()
249 self->aq_fw_ops->update_stats(self->aq_hw); in aq_nic_service_task()
250 mutex_unlock(&self->fwreq_mutex); in aq_nic_service_task()
259 mod_timer(&self->service_timer, in aq_nic_service_timer_cb()
262 aq_ndev_schedule_work(&self->service_task); in aq_nic_service_timer_cb()
270 for (i = 0U; self->aq_vecs > i; ++i) in aq_nic_polling_timer_cb()
271 aq_vec_isr(i, (void *)self->aq_vec[i]); in aq_nic_polling_timer_cb()
273 mod_timer(&self->polling_timer, jiffies + in aq_nic_polling_timer_cb()
281 err = self->aq_hw_ops->hw_soft_reset(self->aq_hw); in aq_nic_hw_prepare()
285 err = self->aq_hw_ops->hw_prepare(self->aq_hw, &self->aq_fw_ops); in aq_nic_hw_prepare()
304 if (!self->ndev) { in aq_nic_ndev_register()
305 err = -EINVAL; in aq_nic_ndev_register()
317 if (platform_get_ethdev_address(&self->pdev->dev, self->ndev) != 0) { in aq_nic_ndev_register()
319 mutex_lock(&self->fwreq_mutex); in aq_nic_ndev_register()
320 err = self->aq_fw_ops->get_mac_permanent(self->aq_hw, addr); in aq_nic_ndev_register()
321 mutex_unlock(&self->fwreq_mutex); in aq_nic_ndev_register()
328 eth_hw_addr_set(self->ndev, addr); in aq_nic_ndev_register()
330 netdev_warn(self->ndev, "MAC is invalid, will use random."); in aq_nic_ndev_register()
331 eth_hw_addr_random(self->ndev); in aq_nic_ndev_register()
339 eth_hw_addr_set(self->ndev, mac_addr_permanent); in aq_nic_ndev_register()
343 for (self->aq_vecs = 0; self->aq_vecs < aq_nic_get_cfg(self)->vecs; in aq_nic_ndev_register()
344 self->aq_vecs++) { in aq_nic_ndev_register()
345 self->aq_vec[self->aq_vecs] = in aq_nic_ndev_register()
346 aq_vec_alloc(self, self->aq_vecs, aq_nic_get_cfg(self)); in aq_nic_ndev_register()
347 if (!self->aq_vec[self->aq_vecs]) { in aq_nic_ndev_register()
348 err = -ENOMEM; in aq_nic_ndev_register()
353 netif_carrier_off(self->ndev); in aq_nic_ndev_register()
355 netif_tx_disable(self->ndev); in aq_nic_ndev_register()
357 err = register_netdev(self->ndev); in aq_nic_ndev_register()
371 const struct aq_hw_caps_s *aq_hw_caps = self->aq_nic_cfg.aq_hw_caps; in aq_nic_ndev_init()
372 struct aq_nic_cfg_s *aq_nic_cfg = &self->aq_nic_cfg; in aq_nic_ndev_init()
374 self->ndev->hw_features |= aq_hw_caps->hw_features; in aq_nic_ndev_init()
375 self->ndev->features = aq_hw_caps->hw_features; in aq_nic_ndev_init()
376 self->ndev->vlan_features |= NETIF_F_HW_CSUM | NETIF_F_RXCSUM | in aq_nic_ndev_init()
379 self->ndev->gso_partial_features = NETIF_F_GSO_UDP_L4; in aq_nic_ndev_init()
380 self->ndev->priv_flags = aq_hw_caps->hw_priv_flags; in aq_nic_ndev_init()
381 self->ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE; in aq_nic_ndev_init()
383 self->msg_enable = NETIF_MSG_DRV | NETIF_MSG_LINK; in aq_nic_ndev_init()
384 self->ndev->mtu = aq_nic_cfg->mtu - ETH_HLEN; in aq_nic_ndev_init()
385 self->ndev->max_mtu = aq_hw_caps->mtu - ETH_FCS_LEN - ETH_HLEN; in aq_nic_ndev_init()
387 self->ndev->xdp_features = NETDEV_XDP_ACT_BASIC | in aq_nic_ndev_init()
397 self->aq_ring_tx[idx] = ring; in aq_nic_set_tx_ring()
402 return self->ndev; in aq_nic_get_ndev()
411 self->power_state = AQ_HW_POWER_STATE_D0; in aq_nic_init()
412 mutex_lock(&self->fwreq_mutex); in aq_nic_init()
413 err = self->aq_hw_ops->hw_reset(self->aq_hw); in aq_nic_init()
414 mutex_unlock(&self->fwreq_mutex); in aq_nic_init()
418 aq_nic_set_downshift(self, self->aq_nic_cfg.downshift_counter); in aq_nic_init()
419 aq_nic_set_media_detect(self, self->aq_nic_cfg.is_media_detect ? in aq_nic_init()
422 err = self->aq_hw_ops->hw_init(self->aq_hw, in aq_nic_init()
423 aq_nic_get_ndev(self)->dev_addr); in aq_nic_init()
427 if (ATL_HW_IS_CHIP_FEATURE(self->aq_hw, ATLANTIC) && in aq_nic_init()
428 self->aq_nic_cfg.aq_hw_caps->media_type == AQ_HW_MEDIA_TYPE_TP) { in aq_nic_init()
429 self->aq_hw->phy_id = HW_ATL_PHY_ID_MAX; in aq_nic_init()
430 err = aq_phy_init(self->aq_hw); in aq_nic_init()
437 if (self->aq_nic_cfg.aq_hw_caps->quirks & AQ_NIC_QUIRK_BAD_PTP) in aq_nic_init()
438 if (self->aq_hw->phy_id != HW_ATL_PHY_ID_MAX) in aq_nic_init()
439 aq_phy_disable_ptp(self->aq_hw); in aq_nic_init()
442 for (i = 0U; i < self->aq_vecs; i++) { in aq_nic_init()
443 aq_vec = self->aq_vec[i]; in aq_nic_init()
449 aq_vec_init(aq_vec, self->aq_hw_ops, self->aq_hw); in aq_nic_init()
452 if (aq_nic_get_cfg(self)->is_ptp) { in aq_nic_init()
453 err = aq_ptp_init(self, self->irqvecs - 1); in aq_nic_init()
466 netif_carrier_off(self->ndev); in aq_nic_init()
481 err = self->aq_hw_ops->hw_multicast_list_set(self->aq_hw, in aq_nic_start()
482 self->mc_list.ar, in aq_nic_start()
483 self->mc_list.count); in aq_nic_start()
487 err = self->aq_hw_ops->hw_packet_filter_set(self->aq_hw, in aq_nic_start()
488 self->packet_filter); in aq_nic_start()
492 for (i = 0U; self->aq_vecs > i; ++i) { in aq_nic_start()
493 aq_vec = self->aq_vec[i]; in aq_nic_start()
505 err = self->aq_hw_ops->hw_start(self->aq_hw); in aq_nic_start()
513 INIT_WORK(&self->service_task, aq_nic_service_task); in aq_nic_start()
515 timer_setup(&self->service_timer, aq_nic_service_timer_cb, 0); in aq_nic_start()
516 aq_nic_service_timer_cb(&self->service_timer); in aq_nic_start()
518 if (cfg->is_polling) { in aq_nic_start()
519 timer_setup(&self->polling_timer, aq_nic_polling_timer_cb, 0); in aq_nic_start()
520 mod_timer(&self->polling_timer, jiffies + in aq_nic_start()
523 for (i = 0U; self->aq_vecs > i; ++i) { in aq_nic_start()
524 aq_vec = self->aq_vec[i]; in aq_nic_start()
525 err = aq_pci_func_alloc_irq(self, i, self->ndev->name, in aq_nic_start()
536 if (cfg->link_irq_vec) { in aq_nic_start()
537 int irqvec = pci_irq_vector(self->pdev, in aq_nic_start()
538 cfg->link_irq_vec); in aq_nic_start()
542 self->ndev->name, self); in aq_nic_start()
545 self->msix_entry_mask |= (1 << cfg->link_irq_vec); in aq_nic_start()
548 err = self->aq_hw_ops->hw_irq_enable(self->aq_hw, in aq_nic_start()
554 err = netif_set_real_num_tx_queues(self->ndev, in aq_nic_start()
555 self->aq_vecs * cfg->tcs); in aq_nic_start()
559 err = netif_set_real_num_rx_queues(self->ndev, in aq_nic_start()
560 self->aq_vecs * cfg->tcs); in aq_nic_start()
564 for (i = 0; i < cfg->tcs; i++) { in aq_nic_start()
565 u16 offset = self->aq_vecs * i; in aq_nic_start()
567 netdev_set_tc_queue(self->ndev, i, self->aq_vecs, offset); in aq_nic_start()
569 netif_tx_start_all_queues(self->ndev); in aq_nic_start()
581 unsigned int dx = ring->sw_tail; in aq_nic_map_xdp()
589 dx_buff = &ring->buff_ring[dx]; in aq_nic_map_xdp()
590 dx_buff->flags = 0U; in aq_nic_map_xdp()
593 total_len = xdpf->len; in aq_nic_map_xdp()
594 dx_buff->len = total_len; in aq_nic_map_xdp()
596 nr_frags = sinfo->nr_frags; in aq_nic_map_xdp()
597 total_len += sinfo->xdp_frags_size; in aq_nic_map_xdp()
599 dx_buff->pa = dma_map_single(dev, xdpf->data, dx_buff->len, in aq_nic_map_xdp()
602 if (unlikely(dma_mapping_error(dev, dx_buff->pa))) in aq_nic_map_xdp()
606 dx_buff->len_pkt = total_len; in aq_nic_map_xdp()
607 dx_buff->is_sop = 1U; in aq_nic_map_xdp()
608 dx_buff->is_mapped = 1U; in aq_nic_map_xdp()
611 for (; nr_frags--; ++frag_count) { in aq_nic_map_xdp()
612 skb_frag_t *frag = &sinfo->frags[frag_count]; in aq_nic_map_xdp()
631 dx_buff = &ring->buff_ring[dx]; in aq_nic_map_xdp()
633 dx_buff->flags = 0U; in aq_nic_map_xdp()
634 dx_buff->len = buff_size; in aq_nic_map_xdp()
635 dx_buff->pa = frag_pa; in aq_nic_map_xdp()
636 dx_buff->is_mapped = 1U; in aq_nic_map_xdp()
637 dx_buff->eop_index = 0xffffU; in aq_nic_map_xdp()
639 frag_len -= buff_size; in aq_nic_map_xdp()
646 first->eop_index = dx; in aq_nic_map_xdp()
647 dx_buff->is_eop = 1U; in aq_nic_map_xdp()
648 dx_buff->skb = NULL; in aq_nic_map_xdp()
649 dx_buff->xdpf = xdpf; in aq_nic_map_xdp()
653 for (dx = ring->sw_tail; in aq_nic_map_xdp()
655 --ret, dx = aq_ring_next_dx(ring, dx)) { in aq_nic_map_xdp()
656 dx_buff = &ring->buff_ring[dx]; in aq_nic_map_xdp()
658 if (!dx_buff->pa) in aq_nic_map_xdp()
660 if (unlikely(dx_buff->is_sop)) in aq_nic_map_xdp()
661 dma_unmap_single(dev, dx_buff->pa, dx_buff->len, in aq_nic_map_xdp()
664 dma_unmap_page(dev, dx_buff->pa, dx_buff->len, in aq_nic_map_xdp()
675 unsigned int nr_frags = skb_shinfo(skb)->nr_frags; in aq_nic_map_skb()
679 u8 ipver = ip_hdr(skb)->version; in aq_nic_map_skb()
688 l4proto = ip_hdr(skb)->protocol; in aq_nic_map_skb()
690 l4proto = ipv6_hdr(skb)->nexthdr; in aq_nic_map_skb()
692 dx = ring->sw_tail; in aq_nic_map_skb()
693 dx_buff = &ring->buff_ring[dx]; in aq_nic_map_skb()
694 dx_buff->flags = 0U; in aq_nic_map_skb()
697 dx_buff->mss = skb_shinfo(skb)->gso_size; in aq_nic_map_skb()
699 dx_buff->is_gso_tcp = 1U; in aq_nic_map_skb()
700 dx_buff->len_l4 = tcp_hdrlen(skb); in aq_nic_map_skb()
702 dx_buff->is_gso_udp = 1U; in aq_nic_map_skb()
703 dx_buff->len_l4 = sizeof(struct udphdr); in aq_nic_map_skb()
705 udp_hdr(skb)->len = htons(dx_buff->mss + in aq_nic_map_skb()
706 dx_buff->len_l4); in aq_nic_map_skb()
711 dx_buff->len_pkt = skb->len; in aq_nic_map_skb()
712 dx_buff->len_l2 = ETH_HLEN; in aq_nic_map_skb()
713 dx_buff->len_l3 = skb_network_header_len(skb); in aq_nic_map_skb()
714 dx_buff->eop_index = 0xffffU; in aq_nic_map_skb()
715 dx_buff->is_ipv6 = (ipver == 6); in aq_nic_map_skb()
719 if (cfg->is_vlan_tx_insert && skb_vlan_tag_present(skb)) { in aq_nic_map_skb()
720 dx_buff->vlan_tx_tag = skb_vlan_tag_get(skb); in aq_nic_map_skb()
721 dx_buff->len_pkt = skb->len; in aq_nic_map_skb()
722 dx_buff->is_vlan = 1U; in aq_nic_map_skb()
728 dx_buff = &ring->buff_ring[dx]; in aq_nic_map_skb()
729 dx_buff->flags = 0U; in aq_nic_map_skb()
733 dx_buff->len = skb_headlen(skb); in aq_nic_map_skb()
734 dx_buff->pa = dma_map_single(dev, in aq_nic_map_skb()
735 skb->data, in aq_nic_map_skb()
736 dx_buff->len, in aq_nic_map_skb()
739 if (unlikely(dma_mapping_error(dev, dx_buff->pa))) { in aq_nic_map_skb()
745 dx_buff->len_pkt = skb->len; in aq_nic_map_skb()
746 dx_buff->is_sop = 1U; in aq_nic_map_skb()
747 dx_buff->is_mapped = 1U; in aq_nic_map_skb()
750 if (skb->ip_summed == CHECKSUM_PARTIAL) { in aq_nic_map_skb()
751 dx_buff->is_ip_cso = (htons(ETH_P_IP) == skb->protocol); in aq_nic_map_skb()
752 dx_buff->is_tcp_cso = (l4proto == IPPROTO_TCP); in aq_nic_map_skb()
753 dx_buff->is_udp_cso = (l4proto == IPPROTO_UDP); in aq_nic_map_skb()
756 for (; nr_frags--; ++frag_count) { in aq_nic_map_skb()
761 skb_frag_t *frag = &skb_shinfo(skb)->frags[frag_count]; in aq_nic_map_skb()
782 dx_buff = &ring->buff_ring[dx]; in aq_nic_map_skb()
784 dx_buff->flags = 0U; in aq_nic_map_skb()
785 dx_buff->len = buff_size; in aq_nic_map_skb()
786 dx_buff->pa = frag_pa; in aq_nic_map_skb()
787 dx_buff->is_mapped = 1U; in aq_nic_map_skb()
788 dx_buff->eop_index = 0xffffU; in aq_nic_map_skb()
790 frag_len -= buff_size; in aq_nic_map_skb()
797 first->eop_index = dx; in aq_nic_map_skb()
798 dx_buff->is_eop = 1U; in aq_nic_map_skb()
799 dx_buff->skb = skb; in aq_nic_map_skb()
800 dx_buff->xdpf = NULL; in aq_nic_map_skb()
804 for (dx = ring->sw_tail; in aq_nic_map_skb()
806 --ret, dx = aq_ring_next_dx(ring, dx)) { in aq_nic_map_skb()
807 dx_buff = &ring->buff_ring[dx]; in aq_nic_map_skb()
809 if (!(dx_buff->is_gso_tcp || dx_buff->is_gso_udp) && in aq_nic_map_skb()
810 !dx_buff->is_vlan && dx_buff->pa) { in aq_nic_map_skb()
811 if (unlikely(dx_buff->is_sop)) { in aq_nic_map_skb()
813 dx_buff->pa, in aq_nic_map_skb()
814 dx_buff->len, in aq_nic_map_skb()
818 dx_buff->pa, in aq_nic_map_skb()
819 dx_buff->len, in aq_nic_map_skb()
832 u16 queue_index = AQ_NIC_RING2QMAP(aq_nic, tx_ring->idx); in aq_nic_xmit_xdpf()
842 frags += sinfo->nr_frags; in aq_nic_xmit_xdpf()
848 nq = netdev_get_tx_queue(ndev, tx_ring->idx); in aq_nic_xmit_xdpf()
859 err = aq_nic->aq_hw_ops->hw_ring_tx_xmit(aq_nic->aq_hw, tx_ring, in aq_nic_xmit_xdpf()
870 unsigned int vec = skb->queue_mapping % cfg->vecs; in aq_nic_xmit()
871 unsigned int tc = skb->queue_mapping / cfg->vecs; in aq_nic_xmit()
876 frags = skb_shinfo(skb)->nr_frags + 1; in aq_nic_xmit()
878 ring = self->aq_ring_tx[AQ_NIC_CFG_TCVEC2RING(cfg, tc, vec)]; in aq_nic_xmit()
887 if (cfg->priv_flags & BIT(AQ_HW_LOOPBACK_DMA_NET)) { in aq_nic_xmit()
893 if (__netif_subqueue_stopped(self->ndev, in aq_nic_xmit()
894 AQ_NIC_RING2QMAP(self, ring->idx))) { in aq_nic_xmit()
902 err = self->aq_hw_ops->hw_ring_tx_xmit(self->aq_hw, in aq_nic_xmit()
914 return self->aq_hw_ops->hw_interrupt_moderation_set(self->aq_hw); in aq_nic_update_interrupt_moderation_settings()
921 err = self->aq_hw_ops->hw_packet_filter_set(self->aq_hw, flags); in aq_nic_set_packet_filter()
925 self->packet_filter = flags; in aq_nic_set_packet_filter()
933 const struct aq_hw_ops *hw_ops = self->aq_hw_ops; in aq_nic_set_multicast_list()
934 struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; in aq_nic_set_multicast_list()
935 unsigned int packet_filter = ndev->flags; in aq_nic_set_multicast_list()
940 self->mc_list.count = 0; in aq_nic_set_multicast_list()
945 ether_addr_copy(self->mc_list.ar[i++], ha->addr); in aq_nic_set_multicast_list()
949 cfg->is_mc_list_enabled = !!(packet_filter & IFF_MULTICAST); in aq_nic_set_multicast_list()
950 if (cfg->is_mc_list_enabled) { in aq_nic_set_multicast_list()
955 ether_addr_copy(self->mc_list.ar[i++], in aq_nic_set_multicast_list()
956 ha->addr); in aq_nic_set_multicast_list()
962 self->mc_list.count = i; in aq_nic_set_multicast_list()
963 err = hw_ops->hw_multicast_list_set(self->aq_hw, in aq_nic_set_multicast_list()
964 self->mc_list.ar, in aq_nic_set_multicast_list()
965 self->mc_list.count); in aq_nic_set_multicast_list()
975 self->aq_nic_cfg.mtu = new_mtu; in aq_nic_set_mtu()
982 return self->aq_hw_ops->hw_set_mac_address(self->aq_hw, ndev->dev_addr); in aq_nic_set_mac()
987 return self->link_status.mbps; in aq_nic_get_link_speed()
995 if (unlikely(!self->aq_hw_ops->hw_get_regs)) in aq_nic_get_regs()
996 return -EOPNOTSUPP; in aq_nic_get_regs()
998 regs->version = 1; in aq_nic_get_regs()
1000 err = self->aq_hw_ops->hw_get_regs(self->aq_hw, in aq_nic_get_regs()
1001 self->aq_nic_cfg.aq_hw_caps, in aq_nic_get_regs()
1012 if (unlikely(!self->aq_hw_ops->hw_get_regs)) in aq_nic_get_regs_count()
1015 return self->aq_nic_cfg.aq_hw_caps->mac_regs_count; in aq_nic_get_regs_count()
1025 if (self->aq_fw_ops->update_stats) { in aq_nic_get_stats()
1026 mutex_lock(&self->fwreq_mutex); in aq_nic_get_stats()
1027 self->aq_fw_ops->update_stats(self->aq_hw); in aq_nic_get_stats()
1028 mutex_unlock(&self->fwreq_mutex); in aq_nic_get_stats()
1030 stats = self->aq_hw_ops->hw_get_hw_stats(self->aq_hw); in aq_nic_get_stats()
1035 data[i] = stats->uprc + stats->mprc + stats->bprc; in aq_nic_get_stats()
1036 data[++i] = stats->uprc; in aq_nic_get_stats()
1037 data[++i] = stats->mprc; in aq_nic_get_stats()
1038 data[++i] = stats->bprc; in aq_nic_get_stats()
1039 data[++i] = stats->erpt; in aq_nic_get_stats()
1040 data[++i] = stats->uptc + stats->mptc + stats->bptc; in aq_nic_get_stats()
1041 data[++i] = stats->uptc; in aq_nic_get_stats()
1042 data[++i] = stats->mptc; in aq_nic_get_stats()
1043 data[++i] = stats->bptc; in aq_nic_get_stats()
1044 data[++i] = stats->ubrc; in aq_nic_get_stats()
1045 data[++i] = stats->ubtc; in aq_nic_get_stats()
1046 data[++i] = stats->mbrc; in aq_nic_get_stats()
1047 data[++i] = stats->mbtc; in aq_nic_get_stats()
1048 data[++i] = stats->bbrc; in aq_nic_get_stats()
1049 data[++i] = stats->bbtc; in aq_nic_get_stats()
1050 if (stats->brc) in aq_nic_get_stats()
1051 data[++i] = stats->brc; in aq_nic_get_stats()
1053 data[++i] = stats->ubrc + stats->mbrc + stats->bbrc; in aq_nic_get_stats()
1054 if (stats->btc) in aq_nic_get_stats()
1055 data[++i] = stats->btc; in aq_nic_get_stats()
1057 data[++i] = stats->ubtc + stats->mbtc + stats->bbtc; in aq_nic_get_stats()
1058 data[++i] = stats->dma_pkt_rc; in aq_nic_get_stats()
1059 data[++i] = stats->dma_pkt_tc; in aq_nic_get_stats()
1060 data[++i] = stats->dma_oct_rc; in aq_nic_get_stats()
1061 data[++i] = stats->dma_oct_tc; in aq_nic_get_stats()
1062 data[++i] = stats->dpc; in aq_nic_get_stats()
1068 for (tc = 0U; tc < self->aq_nic_cfg.tcs; tc++) { in aq_nic_get_stats()
1069 for (i = 0U; self->aq_vecs > i; ++i) { in aq_nic_get_stats()
1070 if (!self->aq_vec[i]) in aq_nic_get_stats()
1073 count = aq_vec_get_sw_stats(self->aq_vec[i], tc, data); in aq_nic_get_stats()
1085 struct aq_stats_s *stats = self->aq_hw_ops->hw_get_hw_stats(self->aq_hw); in aq_nic_update_ndev_stats()
1086 struct net_device *ndev = self->ndev; in aq_nic_update_ndev_stats()
1088 ndev->stats.rx_packets = stats->dma_pkt_rc; in aq_nic_update_ndev_stats()
1089 ndev->stats.rx_bytes = stats->dma_oct_rc; in aq_nic_update_ndev_stats()
1090 ndev->stats.rx_errors = stats->erpr; in aq_nic_update_ndev_stats()
1091 ndev->stats.rx_dropped = stats->dpc; in aq_nic_update_ndev_stats()
1092 ndev->stats.tx_packets = stats->dma_pkt_tc; in aq_nic_update_ndev_stats()
1093 ndev->stats.tx_bytes = stats->dma_oct_tc; in aq_nic_update_ndev_stats()
1094 ndev->stats.tx_errors = stats->erpt; in aq_nic_update_ndev_stats()
1095 ndev->stats.multicast = stats->mprc; in aq_nic_update_ndev_stats()
1103 if (self->aq_nic_cfg.aq_hw_caps->media_type == AQ_HW_MEDIA_TYPE_FIBRE) in aq_nic_get_link_ksettings()
1104 cmd->base.port = PORT_FIBRE; in aq_nic_get_link_ksettings()
1106 cmd->base.port = PORT_TP; in aq_nic_get_link_ksettings()
1108 cmd->base.duplex = DUPLEX_UNKNOWN; in aq_nic_get_link_ksettings()
1109 if (self->link_status.mbps) in aq_nic_get_link_ksettings()
1110 cmd->base.duplex = self->link_status.full_duplex ? in aq_nic_get_link_ksettings()
1112 cmd->base.autoneg = self->aq_nic_cfg.is_autoneg; in aq_nic_get_link_ksettings()
1116 if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk & AQ_NIC_RATE_10G) in aq_nic_get_link_ksettings()
1120 if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk & AQ_NIC_RATE_5G) in aq_nic_get_link_ksettings()
1124 if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk & AQ_NIC_RATE_2G5) in aq_nic_get_link_ksettings()
1128 if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk & AQ_NIC_RATE_1G) in aq_nic_get_link_ksettings()
1132 if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk & AQ_NIC_RATE_1G_HALF) in aq_nic_get_link_ksettings()
1136 if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk & AQ_NIC_RATE_100M) in aq_nic_get_link_ksettings()
1140 if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk & AQ_NIC_RATE_100M_HALF) in aq_nic_get_link_ksettings()
1144 if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk & AQ_NIC_RATE_10M) in aq_nic_get_link_ksettings()
1148 if (self->aq_nic_cfg.aq_hw_caps->link_speed_msk & AQ_NIC_RATE_10M_HALF) in aq_nic_get_link_ksettings()
1152 if (self->aq_nic_cfg.aq_hw_caps->flow_control) { in aq_nic_get_link_ksettings()
1154 Pause); in aq_nic_get_link_ksettings()
1161 if (self->aq_nic_cfg.aq_hw_caps->media_type == AQ_HW_MEDIA_TYPE_FIBRE) in aq_nic_get_link_ksettings()
1168 if (self->aq_nic_cfg.is_autoneg) in aq_nic_get_link_ksettings()
1171 if (self->aq_nic_cfg.link_speed_msk & AQ_NIC_RATE_10G) in aq_nic_get_link_ksettings()
1175 if (self->aq_nic_cfg.link_speed_msk & AQ_NIC_RATE_5G) in aq_nic_get_link_ksettings()
1179 if (self->aq_nic_cfg.link_speed_msk & AQ_NIC_RATE_2G5) in aq_nic_get_link_ksettings()
1183 if (self->aq_nic_cfg.link_speed_msk & AQ_NIC_RATE_1G) in aq_nic_get_link_ksettings()
1187 if (self->aq_nic_cfg.link_speed_msk & AQ_NIC_RATE_1G_HALF) in aq_nic_get_link_ksettings()
1191 if (self->aq_nic_cfg.link_speed_msk & AQ_NIC_RATE_100M) in aq_nic_get_link_ksettings()
1195 if (self->aq_nic_cfg.link_speed_msk & AQ_NIC_RATE_100M_HALF) in aq_nic_get_link_ksettings()
1199 if (self->aq_nic_cfg.link_speed_msk & AQ_NIC_RATE_10M) in aq_nic_get_link_ksettings()
1203 if (self->aq_nic_cfg.link_speed_msk & AQ_NIC_RATE_10M_HALF) in aq_nic_get_link_ksettings()
1207 if (self->aq_nic_cfg.fc.cur & AQ_NIC_FC_RX) in aq_nic_get_link_ksettings()
1209 Pause); in aq_nic_get_link_ksettings()
1211 /* Asym is when either RX or TX, but not both */ in aq_nic_get_link_ksettings()
1212 if (!!(self->aq_nic_cfg.fc.cur & AQ_NIC_FC_TX) ^ in aq_nic_get_link_ksettings()
1213 !!(self->aq_nic_cfg.fc.cur & AQ_NIC_FC_RX)) in aq_nic_get_link_ksettings()
1217 if (self->aq_nic_cfg.aq_hw_caps->media_type == AQ_HW_MEDIA_TYPE_FIBRE) in aq_nic_get_link_ksettings()
1223 lp_link_speed_msk = self->aq_hw->aq_link_status.lp_link_speed_msk; in aq_nic_get_link_ksettings()
1261 if (self->aq_hw->aq_link_status.lp_flow_control & AQ_NIC_FC_RX) in aq_nic_get_link_ksettings()
1263 Pause); in aq_nic_get_link_ksettings()
1264 if (!!(self->aq_hw->aq_link_status.lp_flow_control & AQ_NIC_FC_TX) ^ in aq_nic_get_link_ksettings()
1265 !!(self->aq_hw->aq_link_status.lp_flow_control & AQ_NIC_FC_RX)) in aq_nic_get_link_ksettings()
1273 int fduplex = (cmd->base.duplex == DUPLEX_FULL); in aq_nic_set_link_ksettings()
1274 u32 speed = cmd->base.speed; in aq_nic_set_link_ksettings()
1279 err = -EINVAL; in aq_nic_set_link_ksettings()
1283 if (cmd->base.autoneg == AUTONEG_ENABLE) { in aq_nic_set_link_ksettings()
1284 rate = self->aq_nic_cfg.aq_hw_caps->link_speed_msk; in aq_nic_set_link_ksettings()
1285 self->aq_nic_cfg.is_autoneg = true; in aq_nic_set_link_ksettings()
1314 err = -1; in aq_nic_set_link_ksettings()
1317 if (!(self->aq_nic_cfg.aq_hw_caps->link_speed_msk & rate)) { in aq_nic_set_link_ksettings()
1318 err = -1; in aq_nic_set_link_ksettings()
1322 self->aq_nic_cfg.is_autoneg = false; in aq_nic_set_link_ksettings()
1325 mutex_lock(&self->fwreq_mutex); in aq_nic_set_link_ksettings()
1326 err = self->aq_fw_ops->set_link_speed(self->aq_hw, rate); in aq_nic_set_link_ksettings()
1327 mutex_unlock(&self->fwreq_mutex); in aq_nic_set_link_ksettings()
1331 self->aq_nic_cfg.link_speed_msk = rate; in aq_nic_set_link_ksettings()
1339 return &self->aq_nic_cfg; in aq_nic_get_cfg()
1344 return self->aq_hw_ops->hw_get_fw_version(self->aq_hw); in aq_nic_get_fw_version()
1349 struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; in aq_nic_set_loopback()
1351 if (!self->aq_hw_ops->hw_set_loopback || in aq_nic_set_loopback()
1352 !self->aq_fw_ops->set_phyloopback) in aq_nic_set_loopback()
1353 return -EOPNOTSUPP; in aq_nic_set_loopback()
1355 mutex_lock(&self->fwreq_mutex); in aq_nic_set_loopback()
1356 self->aq_hw_ops->hw_set_loopback(self->aq_hw, in aq_nic_set_loopback()
1358 !!(cfg->priv_flags & in aq_nic_set_loopback()
1361 self->aq_hw_ops->hw_set_loopback(self->aq_hw, in aq_nic_set_loopback()
1363 !!(cfg->priv_flags & in aq_nic_set_loopback()
1366 self->aq_hw_ops->hw_set_loopback(self->aq_hw, in aq_nic_set_loopback()
1368 !!(cfg->priv_flags & in aq_nic_set_loopback()
1371 self->aq_fw_ops->set_phyloopback(self->aq_hw, in aq_nic_set_loopback()
1373 !!(cfg->priv_flags & in aq_nic_set_loopback()
1376 self->aq_fw_ops->set_phyloopback(self->aq_hw, in aq_nic_set_loopback()
1378 !!(cfg->priv_flags & in aq_nic_set_loopback()
1380 mutex_unlock(&self->fwreq_mutex); in aq_nic_set_loopback()
1389 netif_tx_disable(self->ndev); in aq_nic_stop()
1390 netif_carrier_off(self->ndev); in aq_nic_stop()
1392 del_timer_sync(&self->service_timer); in aq_nic_stop()
1393 cancel_work_sync(&self->service_task); in aq_nic_stop()
1395 self->aq_hw_ops->hw_irq_disable(self->aq_hw, AQ_CFG_IRQ_MASK); in aq_nic_stop()
1397 if (self->aq_nic_cfg.is_polling) in aq_nic_stop()
1398 del_timer_sync(&self->polling_timer); in aq_nic_stop()
1404 for (i = 0U; self->aq_vecs > i; ++i) in aq_nic_stop()
1405 aq_vec_stop(self->aq_vec[i]); in aq_nic_stop()
1409 return self->aq_hw_ops->hw_stop(self->aq_hw); in aq_nic_stop()
1414 if (self->power_state != AQ_HW_POWER_STATE_D0 || in aq_nic_set_power()
1415 self->aq_hw->aq_nic_cfg->wol) in aq_nic_set_power()
1416 if (likely(self->aq_fw_ops->set_power)) { in aq_nic_set_power()
1417 mutex_lock(&self->fwreq_mutex); in aq_nic_set_power()
1418 self->aq_fw_ops->set_power(self->aq_hw, in aq_nic_set_power()
1419 self->power_state, in aq_nic_set_power()
1420 self->ndev->dev_addr); in aq_nic_set_power()
1421 mutex_unlock(&self->fwreq_mutex); in aq_nic_set_power()
1433 for (i = 0U; i < self->aq_vecs; i++) { in aq_nic_deinit()
1434 aq_vec = self->aq_vec[i]; in aq_nic_deinit()
1444 if (likely(self->aq_fw_ops->deinit) && link_down) { in aq_nic_deinit()
1445 mutex_lock(&self->fwreq_mutex); in aq_nic_deinit()
1446 self->aq_fw_ops->deinit(self->aq_hw); in aq_nic_deinit()
1447 mutex_unlock(&self->fwreq_mutex); in aq_nic_deinit()
1460 for (i = ARRAY_SIZE(self->aq_vec); i--;) { in aq_nic_free_vectors()
1461 if (self->aq_vec[i]) { in aq_nic_free_vectors()
1462 aq_vec_free(self->aq_vec[i]); in aq_nic_free_vectors()
1463 self->aq_vec[i] = NULL; in aq_nic_free_vectors()
1476 for (self->aq_vecs = 0; self->aq_vecs < cfg->vecs; self->aq_vecs++) { in aq_nic_realloc_vectors()
1477 self->aq_vec[self->aq_vecs] = aq_vec_alloc(self, self->aq_vecs, in aq_nic_realloc_vectors()
1479 if (unlikely(!self->aq_vec[self->aq_vecs])) in aq_nic_realloc_vectors()
1480 return -ENOMEM; in aq_nic_realloc_vectors()
1490 if (!self->ndev) in aq_nic_shutdown()
1495 netif_device_detach(self->ndev); in aq_nic_shutdown()
1497 if (netif_running(self->ndev)) { in aq_nic_shutdown()
1502 aq_nic_deinit(self, !self->aq_hw->aq_nic_cfg->wol); in aq_nic_shutdown()
1517 location = AQ_RX_LAST_LOC_FETHERT - AQ_RX_FIRST_LOC_FETHERT - in aq_nic_reserve_filter()
1518 self->aq_hw_rx_fltrs.fet_reserved_count; in aq_nic_reserve_filter()
1519 self->aq_hw_rx_fltrs.fet_reserved_count++; in aq_nic_reserve_filter()
1522 fltr_cnt = AQ_RX_LAST_LOC_FL3L4 - AQ_RX_FIRST_LOC_FL3L4; in aq_nic_reserve_filter()
1523 n_bit = fltr_cnt - self->aq_hw_rx_fltrs.fl3l4.reserved_count; in aq_nic_reserve_filter()
1525 self->aq_hw_rx_fltrs.fl3l4.active_ipv4 |= BIT(n_bit); in aq_nic_reserve_filter()
1526 self->aq_hw_rx_fltrs.fl3l4.reserved_count++; in aq_nic_reserve_filter()
1541 self->aq_hw_rx_fltrs.fet_reserved_count--; in aq_nic_release_filter()
1544 self->aq_hw_rx_fltrs.fl3l4.reserved_count--; in aq_nic_release_filter()
1545 self->aq_hw_rx_fltrs.fl3l4.active_ipv4 &= ~BIT(location); in aq_nic_release_filter()
1555 struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; in aq_nic_set_downshift()
1557 if (!self->aq_fw_ops->set_downshift) in aq_nic_set_downshift()
1558 return -EOPNOTSUPP; in aq_nic_set_downshift()
1561 netdev_err(self->ndev, "downshift counter should be <= 15\n"); in aq_nic_set_downshift()
1562 return -EINVAL; in aq_nic_set_downshift()
1564 cfg->downshift_counter = val; in aq_nic_set_downshift()
1566 mutex_lock(&self->fwreq_mutex); in aq_nic_set_downshift()
1567 err = self->aq_fw_ops->set_downshift(self->aq_hw, cfg->downshift_counter); in aq_nic_set_downshift()
1568 mutex_unlock(&self->fwreq_mutex); in aq_nic_set_downshift()
1575 struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; in aq_nic_set_media_detect()
1578 if (!self->aq_fw_ops->set_media_detect) in aq_nic_set_media_detect()
1579 return -EOPNOTSUPP; in aq_nic_set_media_detect()
1582 netdev_err(self->ndev, "EDPD on this device could have only fixed value of %d\n", in aq_nic_set_media_detect()
1584 return -EINVAL; in aq_nic_set_media_detect()
1587 mutex_lock(&self->fwreq_mutex); in aq_nic_set_media_detect()
1588 err = self->aq_fw_ops->set_media_detect(self->aq_hw, !!val); in aq_nic_set_media_detect()
1589 mutex_unlock(&self->fwreq_mutex); in aq_nic_set_media_detect()
1591 /* msecs plays no role - configuration is always fixed in PHY */ in aq_nic_set_media_detect()
1593 cfg->is_media_detect = !!val; in aq_nic_set_media_detect()
1600 struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; in aq_nic_setup_tc_mqprio()
1601 const unsigned int prev_vecs = cfg->vecs; in aq_nic_setup_tc_mqprio()
1609 if (tcs == cfg->tcs || (tcs == 0 && !cfg->is_qos)) in aq_nic_setup_tc_mqprio()
1612 ndev_running = netif_running(self->ndev); in aq_nic_setup_tc_mqprio()
1614 dev_close(self->ndev); in aq_nic_setup_tc_mqprio()
1616 cfg->tcs = tcs; in aq_nic_setup_tc_mqprio()
1617 if (cfg->tcs == 0) in aq_nic_setup_tc_mqprio()
1618 cfg->tcs = 1; in aq_nic_setup_tc_mqprio()
1620 memcpy(cfg->prio_tc_map, prio_tc_map, sizeof(cfg->prio_tc_map)); in aq_nic_setup_tc_mqprio()
1622 for (i = 0; i < sizeof(cfg->prio_tc_map); i++) in aq_nic_setup_tc_mqprio()
1623 cfg->prio_tc_map[i] = cfg->tcs * i / 8; in aq_nic_setup_tc_mqprio()
1625 cfg->is_qos = !!tcs; in aq_nic_setup_tc_mqprio()
1626 cfg->is_ptp = (cfg->tcs <= AQ_HW_PTP_TC); in aq_nic_setup_tc_mqprio()
1627 if (!cfg->is_ptp) in aq_nic_setup_tc_mqprio()
1628 netdev_warn(self->ndev, "%s\n", in aq_nic_setup_tc_mqprio()
1631 netdev_set_num_tc(self->ndev, cfg->tcs); in aq_nic_setup_tc_mqprio()
1635 if (prev_vecs != cfg->vecs) { in aq_nic_setup_tc_mqprio()
1642 err = dev_open(self->ndev, NULL); in aq_nic_setup_tc_mqprio()
1651 struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; in aq_nic_setup_tc_max_rate()
1654 return -EINVAL; in aq_nic_setup_tc_max_rate()
1657 netdev_warn(self->ndev, in aq_nic_setup_tc_max_rate()
1660 cfg->tc_max_rate[tc] = 10; in aq_nic_setup_tc_max_rate()
1662 cfg->tc_max_rate[tc] = max_rate; in aq_nic_setup_tc_max_rate()
1671 struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; in aq_nic_setup_tc_min_rate()
1674 return -EINVAL; in aq_nic_setup_tc_min_rate()
1677 set_bit(tc, &cfg->tc_min_rate_msk); in aq_nic_setup_tc_min_rate()
1679 clear_bit(tc, &cfg->tc_min_rate_msk); in aq_nic_setup_tc_min_rate()
1682 netdev_warn(self->ndev, in aq_nic_setup_tc_min_rate()
1685 cfg->tc_min_rate[tc] = 20; in aq_nic_setup_tc_min_rate()
1687 cfg->tc_min_rate[tc] = min_rate; in aq_nic_setup_tc_min_rate()