Lines Matching +full:rx +full:- +full:shared

4  * Copyright (C) 2008-2024, VMware, Inc. All Rights Reserved.
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
23 * Maintained by: pv-drivers@vmware.com
89 { "Rx Queue#", 0 },
90 { " LRO pkts rx", offsetof(struct UPT1_RxStats, LROPktsRxOK) },
91 { " LRO byte rx", offsetof(struct UPT1_RxStats, LROBytesRxOK) },
92 { " ucast pkts rx", offsetof(struct UPT1_RxStats, ucastPktsRxOK) },
93 { " ucast bytes rx", offsetof(struct UPT1_RxStats, ucastBytesRxOK) },
94 { " mcast pkts rx", offsetof(struct UPT1_RxStats, mcastPktsRxOK) },
95 { " mcast bytes rx", offsetof(struct UPT1_RxStats, mcastBytesRxOK) },
96 { " bcast pkts rx", offsetof(struct UPT1_RxStats, bcastPktsRxOK) },
97 { " bcast bytes rx", offsetof(struct UPT1_RxStats, bcastBytesRxOK) },
98 { " pkts rx OOB", offsetof(struct UPT1_RxStats, pktsRxOutOfBuf) },
99 { " pkts rx err", offsetof(struct UPT1_RxStats, pktsRxError) },
106 { " drv dropped rx total", offsetof(struct vmxnet3_rq_driver_stats,
112 { " rx buf alloc fail", offsetof(struct vmxnet3_rq_driver_stats,
149 /* Collect the dev stats into the shared area */ in vmxnet3_get_stats64()
150 spin_lock_irqsave(&adapter->cmd_lock, flags); in vmxnet3_get_stats64()
152 spin_unlock_irqrestore(&adapter->cmd_lock, flags); in vmxnet3_get_stats64()
154 for (i = 0; i < adapter->num_tx_queues; i++) { in vmxnet3_get_stats64()
155 devTxStats = &adapter->tqd_start[i].stats; in vmxnet3_get_stats64()
156 drvTxStats = &adapter->tx_queue[i].stats; in vmxnet3_get_stats64()
157 stats->tx_packets += devTxStats->ucastPktsTxOK + in vmxnet3_get_stats64()
158 devTxStats->mcastPktsTxOK + in vmxnet3_get_stats64()
159 devTxStats->bcastPktsTxOK; in vmxnet3_get_stats64()
160 stats->tx_bytes += devTxStats->ucastBytesTxOK + in vmxnet3_get_stats64()
161 devTxStats->mcastBytesTxOK + in vmxnet3_get_stats64()
162 devTxStats->bcastBytesTxOK; in vmxnet3_get_stats64()
163 stats->tx_errors += devTxStats->pktsTxError; in vmxnet3_get_stats64()
164 stats->tx_dropped += drvTxStats->drop_total; in vmxnet3_get_stats64()
167 for (i = 0; i < adapter->num_rx_queues; i++) { in vmxnet3_get_stats64()
168 devRxStats = &adapter->rqd_start[i].stats; in vmxnet3_get_stats64()
169 drvRxStats = &adapter->rx_queue[i].stats; in vmxnet3_get_stats64()
170 stats->rx_packets += devRxStats->ucastPktsRxOK + in vmxnet3_get_stats64()
171 devRxStats->mcastPktsRxOK + in vmxnet3_get_stats64()
172 devRxStats->bcastPktsRxOK; in vmxnet3_get_stats64()
174 stats->rx_bytes += devRxStats->ucastBytesRxOK + in vmxnet3_get_stats64()
175 devRxStats->mcastBytesRxOK + in vmxnet3_get_stats64()
176 devRxStats->bcastBytesRxOK; in vmxnet3_get_stats64()
178 stats->rx_errors += devRxStats->pktsRxError; in vmxnet3_get_stats64()
179 stats->rx_dropped += drvRxStats->drop_total; in vmxnet3_get_stats64()
180 stats->multicast += devRxStats->mcastPktsRxOK; in vmxnet3_get_stats64()
192 adapter->num_tx_queues + in vmxnet3_get_sset_count()
195 adapter->num_rx_queues + in vmxnet3_get_sset_count()
198 return -EOPNOTSUPP; in vmxnet3_get_sset_count()
204 * the version 2 of the vmxnet3 support for ethtool(8) --register-dump.
207 * --register-dump would be required.
215 (1 + adapter->intr.num_intrs) + in vmxnet3_get_regs_len()
216 (1 + adapter->num_tx_queues * 17 /* Tx queue registers */) + in vmxnet3_get_regs_len()
217 (1 + adapter->num_rx_queues * 23 /* Rx queue registers */)) * in vmxnet3_get_regs_len()
227 strscpy(drvinfo->driver, vmxnet3_driver_name, sizeof(drvinfo->driver)); in vmxnet3_get_drvinfo()
229 strscpy(drvinfo->version, VMXNET3_DRIVER_VERSION_REPORT, in vmxnet3_get_drvinfo()
230 sizeof(drvinfo->version)); in vmxnet3_get_drvinfo()
232 strscpy(drvinfo->bus_info, pci_name(adapter->pdev), in vmxnet3_get_drvinfo()
233 sizeof(drvinfo->bus_info)); in vmxnet3_get_drvinfo()
246 for (j = 0; j < adapter->num_tx_queues; j++) { in vmxnet3_get_strings()
253 for (j = 0; j < adapter->num_rx_queues; j++) { in vmxnet3_get_strings()
269 /* If Rx checksum is disabled, then LRO should also be disabled */ in vmxnet3_fix_features()
290 skb->encapsulation && skb->ip_summed == CHECKSUM_PARTIAL) { in vmxnet3_features_check()
297 l4_proto = ip_hdr(skb)->protocol; in vmxnet3_features_check()
300 l4_proto = ipv6_hdr(skb)->nexthdr; in vmxnet3_features_check()
309 port = be16_to_cpu(udph->dest); in vmxnet3_features_check()
329 netdev->hw_enc_features |= NETIF_F_SG | NETIF_F_RXCSUM | in vmxnet3_enable_encap_offloads()
334 netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL; in vmxnet3_enable_encap_offloads()
336 netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; in vmxnet3_enable_encap_offloads()
341 if (vmxnet3_check_ptcapability(adapter->ptcap_supported[0], in vmxnet3_enable_encap_offloads()
343 adapter->dev_caps[0] |= 1UL << VMXNET3_CAP_GENEVE_CHECKSUM_OFFLOAD; in vmxnet3_enable_encap_offloads()
345 if (vmxnet3_check_ptcapability(adapter->ptcap_supported[0], in vmxnet3_enable_encap_offloads()
347 adapter->dev_caps[0] |= 1UL << VMXNET3_CAP_VXLAN_CHECKSUM_OFFLOAD; in vmxnet3_enable_encap_offloads()
349 if (vmxnet3_check_ptcapability(adapter->ptcap_supported[0], in vmxnet3_enable_encap_offloads()
351 adapter->dev_caps[0] |= 1UL << VMXNET3_CAP_GENEVE_TSO; in vmxnet3_enable_encap_offloads()
353 if (vmxnet3_check_ptcapability(adapter->ptcap_supported[0], in vmxnet3_enable_encap_offloads()
355 adapter->dev_caps[0] |= 1UL << VMXNET3_CAP_VXLAN_TSO; in vmxnet3_enable_encap_offloads()
357 if (vmxnet3_check_ptcapability(adapter->ptcap_supported[0], in vmxnet3_enable_encap_offloads()
359 adapter->dev_caps[0] |= 1UL << VMXNET3_CAP_GENEVE_OUTER_CHECKSUM_OFFLOAD; in vmxnet3_enable_encap_offloads()
361 if (vmxnet3_check_ptcapability(adapter->ptcap_supported[0], in vmxnet3_enable_encap_offloads()
363 adapter->dev_caps[0] |= 1UL << VMXNET3_CAP_VXLAN_OUTER_CHECKSUM_OFFLOAD; in vmxnet3_enable_encap_offloads()
366 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DCR, adapter->dev_caps[0]); in vmxnet3_enable_encap_offloads()
367 spin_lock_irqsave(&adapter->cmd_lock, flags); in vmxnet3_enable_encap_offloads()
369 adapter->dev_caps[0] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); in vmxnet3_enable_encap_offloads()
370 spin_unlock_irqrestore(&adapter->cmd_lock, flags); in vmxnet3_enable_encap_offloads()
372 if (!(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_GENEVE_CHECKSUM_OFFLOAD)) && in vmxnet3_enable_encap_offloads()
373 !(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_VXLAN_CHECKSUM_OFFLOAD)) && in vmxnet3_enable_encap_offloads()
374 !(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_GENEVE_TSO)) && in vmxnet3_enable_encap_offloads()
375 !(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_VXLAN_TSO))) { in vmxnet3_enable_encap_offloads()
376 netdev->hw_enc_features &= ~NETIF_F_GSO_UDP_TUNNEL; in vmxnet3_enable_encap_offloads()
378 if (!(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_GENEVE_OUTER_CHECKSUM_OFFLOAD)) && in vmxnet3_enable_encap_offloads()
379 !(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_VXLAN_OUTER_CHECKSUM_OFFLOAD))) { in vmxnet3_enable_encap_offloads()
380 netdev->hw_enc_features &= ~NETIF_F_GSO_UDP_TUNNEL_CSUM; in vmxnet3_enable_encap_offloads()
390 netdev->hw_enc_features &= ~(NETIF_F_SG | NETIF_F_RXCSUM | in vmxnet3_disable_encap_offloads()
399 adapter->dev_caps[0] &= ~(1UL << VMXNET3_CAP_GENEVE_CHECKSUM_OFFLOAD | in vmxnet3_disable_encap_offloads()
406 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DCR, adapter->dev_caps[0]); in vmxnet3_disable_encap_offloads()
407 spin_lock_irqsave(&adapter->cmd_lock, flags); in vmxnet3_disable_encap_offloads()
409 adapter->dev_caps[0] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); in vmxnet3_disable_encap_offloads()
410 spin_unlock_irqrestore(&adapter->cmd_lock, flags); in vmxnet3_disable_encap_offloads()
418 netdev_features_t changed = features ^ netdev->features; in vmxnet3_set_features()
421 u8 udp_tun_enabled = (netdev->features & tun_offload_mask) != 0; in vmxnet3_set_features()
426 adapter->shared->devRead.misc.uptFeatures |= in vmxnet3_set_features()
429 adapter->shared->devRead.misc.uptFeatures &= in vmxnet3_set_features()
434 adapter->shared->devRead.misc.uptFeatures |= in vmxnet3_set_features()
437 adapter->shared->devRead.misc.uptFeatures &= in vmxnet3_set_features()
441 adapter->shared->devRead.misc.uptFeatures |= in vmxnet3_set_features()
444 adapter->shared->devRead.misc.uptFeatures &= in vmxnet3_set_features()
449 adapter->shared->devRead.misc.uptFeatures |= in vmxnet3_set_features()
454 adapter->shared->devRead.misc.uptFeatures &= in vmxnet3_set_features()
458 spin_lock_irqsave(&adapter->cmd_lock, flags); in vmxnet3_set_features()
461 spin_unlock_irqrestore(&adapter->cmd_lock, flags); in vmxnet3_set_features()
476 spin_lock_irqsave(&adapter->cmd_lock, flags); in vmxnet3_get_ethtool_stats()
478 spin_unlock_irqrestore(&adapter->cmd_lock, flags); in vmxnet3_get_ethtool_stats()
480 /* this does assume each counter is 64-bit wide */ in vmxnet3_get_ethtool_stats()
481 for (j = 0; j < adapter->num_tx_queues; j++) { in vmxnet3_get_ethtool_stats()
482 base = (u8 *)&adapter->tqd_start[j].stats; in vmxnet3_get_ethtool_stats()
488 base = (u8 *)&adapter->tx_queue[j].stats; in vmxnet3_get_ethtool_stats()
494 for (j = 0; j < adapter->num_rx_queues; j++) { in vmxnet3_get_ethtool_stats()
495 base = (u8 *)&adapter->rqd_start[j].stats; in vmxnet3_get_ethtool_stats()
501 base = (u8 *)&adapter->rx_queue[j].stats; in vmxnet3_get_ethtool_stats()
514 * the version 2 of the vmxnet3 support for ethtool(8) --register-dump.
517 * --register-dump would be required.
528 regs->version = 2; in vmxnet3_get_regs()
542 buf[j++] = adapter->intr.num_intrs; in vmxnet3_get_regs()
543 for (i = 0; i < adapter->intr.num_intrs; i++) { in vmxnet3_get_regs()
548 buf[j++] = adapter->num_tx_queues; in vmxnet3_get_regs()
549 for (i = 0; i < adapter->num_tx_queues; i++) { in vmxnet3_get_regs()
550 struct vmxnet3_tx_queue *tq = &adapter->tx_queue[i]; in vmxnet3_get_regs()
552 buf[j++] = VMXNET3_READ_BAR0_REG(adapter, adapter->tx_prod_offset + in vmxnet3_get_regs()
555 buf[j++] = VMXNET3_GET_ADDR_LO(tq->tx_ring.basePA); in vmxnet3_get_regs()
556 buf[j++] = VMXNET3_GET_ADDR_HI(tq->tx_ring.basePA); in vmxnet3_get_regs()
557 buf[j++] = tq->tx_ring.size; in vmxnet3_get_regs()
558 buf[j++] = tq->tx_ring.next2fill; in vmxnet3_get_regs()
559 buf[j++] = tq->tx_ring.next2comp; in vmxnet3_get_regs()
560 buf[j++] = tq->tx_ring.gen; in vmxnet3_get_regs()
562 buf[j++] = VMXNET3_GET_ADDR_LO(tq->data_ring.basePA); in vmxnet3_get_regs()
563 buf[j++] = VMXNET3_GET_ADDR_HI(tq->data_ring.basePA); in vmxnet3_get_regs()
564 buf[j++] = tq->data_ring.size; in vmxnet3_get_regs()
565 buf[j++] = tq->txdata_desc_size; in vmxnet3_get_regs()
567 buf[j++] = VMXNET3_GET_ADDR_LO(tq->comp_ring.basePA); in vmxnet3_get_regs()
568 buf[j++] = VMXNET3_GET_ADDR_HI(tq->comp_ring.basePA); in vmxnet3_get_regs()
569 buf[j++] = tq->comp_ring.size; in vmxnet3_get_regs()
570 buf[j++] = tq->comp_ring.next2proc; in vmxnet3_get_regs()
571 buf[j++] = tq->comp_ring.gen; in vmxnet3_get_regs()
573 buf[j++] = tq->stopped; in vmxnet3_get_regs()
576 buf[j++] = adapter->num_rx_queues; in vmxnet3_get_regs()
577 for (i = 0; i < adapter->num_rx_queues; i++) { in vmxnet3_get_regs()
578 struct vmxnet3_rx_queue *rq = &adapter->rx_queue[i]; in vmxnet3_get_regs()
580 buf[j++] = VMXNET3_READ_BAR0_REG(adapter, adapter->rx_prod_offset + in vmxnet3_get_regs()
582 buf[j++] = VMXNET3_READ_BAR0_REG(adapter, adapter->rx_prod2_offset + in vmxnet3_get_regs()
585 buf[j++] = VMXNET3_GET_ADDR_LO(rq->rx_ring[0].basePA); in vmxnet3_get_regs()
586 buf[j++] = VMXNET3_GET_ADDR_HI(rq->rx_ring[0].basePA); in vmxnet3_get_regs()
587 buf[j++] = rq->rx_ring[0].size; in vmxnet3_get_regs()
588 buf[j++] = rq->rx_ring[0].next2fill; in vmxnet3_get_regs()
589 buf[j++] = rq->rx_ring[0].next2comp; in vmxnet3_get_regs()
590 buf[j++] = rq->rx_ring[0].gen; in vmxnet3_get_regs()
592 buf[j++] = VMXNET3_GET_ADDR_LO(rq->rx_ring[1].basePA); in vmxnet3_get_regs()
593 buf[j++] = VMXNET3_GET_ADDR_HI(rq->rx_ring[1].basePA); in vmxnet3_get_regs()
594 buf[j++] = rq->rx_ring[1].size; in vmxnet3_get_regs()
595 buf[j++] = rq->rx_ring[1].next2fill; in vmxnet3_get_regs()
596 buf[j++] = rq->rx_ring[1].next2comp; in vmxnet3_get_regs()
597 buf[j++] = rq->rx_ring[1].gen; in vmxnet3_get_regs()
599 buf[j++] = VMXNET3_GET_ADDR_LO(rq->data_ring.basePA); in vmxnet3_get_regs()
600 buf[j++] = VMXNET3_GET_ADDR_HI(rq->data_ring.basePA); in vmxnet3_get_regs()
601 buf[j++] = rq->rx_ring[0].size; in vmxnet3_get_regs()
602 buf[j++] = rq->data_ring.desc_size; in vmxnet3_get_regs()
604 buf[j++] = VMXNET3_GET_ADDR_LO(rq->comp_ring.basePA); in vmxnet3_get_regs()
605 buf[j++] = VMXNET3_GET_ADDR_HI(rq->comp_ring.basePA); in vmxnet3_get_regs()
606 buf[j++] = rq->comp_ring.size; in vmxnet3_get_regs()
607 buf[j++] = rq->comp_ring.next2proc; in vmxnet3_get_regs()
608 buf[j++] = rq->comp_ring.gen; in vmxnet3_get_regs()
618 wol->supported = WAKE_UCAST | WAKE_ARP | WAKE_MAGIC; in vmxnet3_get_wol()
619 wol->wolopts = adapter->wol; in vmxnet3_get_wol()
628 if (wol->wolopts & (WAKE_PHY | WAKE_MCAST | WAKE_BCAST | in vmxnet3_set_wol()
630 return -EOPNOTSUPP; in vmxnet3_set_wol()
633 adapter->wol = wol->wolopts; in vmxnet3_set_wol()
635 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); in vmxnet3_set_wol()
653 ecmd->base.port = PORT_TP; in vmxnet3_get_link_ksettings()
655 if (adapter->link_speed) { in vmxnet3_get_link_ksettings()
656 ecmd->base.speed = adapter->link_speed; in vmxnet3_get_link_ksettings()
657 ecmd->base.duplex = DUPLEX_FULL; in vmxnet3_get_link_ksettings()
659 ecmd->base.speed = SPEED_UNKNOWN; in vmxnet3_get_link_ksettings()
660 ecmd->base.duplex = DUPLEX_UNKNOWN; in vmxnet3_get_link_ksettings()
673 param->rx_max_pending = VMXNET3_RX_RING_MAX_SIZE; in vmxnet3_get_ringparam()
674 param->tx_max_pending = VMXNET3_TX_RING_MAX_SIZE; in vmxnet3_get_ringparam()
675 param->rx_mini_max_pending = VMXNET3_VERSION_GE_3(adapter) ? in vmxnet3_get_ringparam()
677 param->rx_jumbo_max_pending = VMXNET3_RX_RING2_MAX_SIZE; in vmxnet3_get_ringparam()
679 param->rx_pending = adapter->rx_ring_size; in vmxnet3_get_ringparam()
680 param->tx_pending = adapter->tx_ring_size; in vmxnet3_get_ringparam()
681 param->rx_mini_pending = VMXNET3_VERSION_GE_3(adapter) ? in vmxnet3_get_ringparam()
682 adapter->rxdata_desc_size : 0; in vmxnet3_get_ringparam()
683 param->rx_jumbo_pending = adapter->rx_ring2_size; in vmxnet3_get_ringparam()
698 if (param->tx_pending == 0 || param->tx_pending > in vmxnet3_set_ringparam()
700 return -EINVAL; in vmxnet3_set_ringparam()
702 if (param->rx_pending == 0 || param->rx_pending > in vmxnet3_set_ringparam()
704 return -EINVAL; in vmxnet3_set_ringparam()
706 if (param->rx_jumbo_pending == 0 || in vmxnet3_set_ringparam()
707 param->rx_jumbo_pending > VMXNET3_RX_RING2_MAX_SIZE) in vmxnet3_set_ringparam()
708 return -EINVAL; in vmxnet3_set_ringparam()
711 if (adapter->rx_buf_per_pkt == 0) { in vmxnet3_set_ringparam()
714 return -EOPNOTSUPP; in vmxnet3_set_ringparam()
718 if (param->rx_mini_pending > VMXNET3_RXDATA_DESC_MAX_SIZE) in vmxnet3_set_ringparam()
719 return -EINVAL; in vmxnet3_set_ringparam()
720 } else if (param->rx_mini_pending != 0) { in vmxnet3_set_ringparam()
721 return -EINVAL; in vmxnet3_set_ringparam()
725 new_tx_ring_size = (param->tx_pending + VMXNET3_RING_SIZE_MASK) & in vmxnet3_set_ringparam()
731 return -EINVAL; in vmxnet3_set_ringparam()
736 sz = adapter->rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN; in vmxnet3_set_ringparam()
737 new_rx_ring_size = (param->rx_pending + sz - 1) / sz * sz; in vmxnet3_set_ringparam()
742 return -EINVAL; in vmxnet3_set_ringparam()
745 new_rx_ring2_size = (param->rx_jumbo_pending + VMXNET3_RING_SIZE_MASK) & in vmxnet3_set_ringparam()
757 /* rx data ring buffer size has to be a multiple of in vmxnet3_set_ringparam()
761 (param->rx_mini_pending + VMXNET3_RXDATA_DESC_SIZE_MASK) & in vmxnet3_set_ringparam()
766 if (new_tx_ring_size == adapter->tx_ring_size && in vmxnet3_set_ringparam()
767 new_rx_ring_size == adapter->rx_ring_size && in vmxnet3_set_ringparam()
768 new_rx_ring2_size == adapter->rx_ring2_size && in vmxnet3_set_ringparam()
769 new_rxdata_desc_size == adapter->rxdata_desc_size) { in vmxnet3_set_ringparam()
777 while (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state)) in vmxnet3_set_ringparam()
784 /* recreate the rx queue and the tx queue based on the in vmxnet3_set_ringparam()
791 adapter->txdata_desc_size, in vmxnet3_set_ringparam()
808 adapter->txdata_desc_size, in vmxnet3_set_ringparam()
819 netdev_err(netdev, "failed to re-activate, error %d." in vmxnet3_set_ringparam()
822 adapter->tx_ring_size = new_tx_ring_size; in vmxnet3_set_ringparam()
823 adapter->rx_ring_size = new_rx_ring_size; in vmxnet3_set_ringparam()
824 adapter->rx_ring2_size = new_rx_ring2_size; in vmxnet3_set_ringparam()
825 adapter->rxdata_desc_size = new_rxdata_desc_size; in vmxnet3_set_ringparam()
828 clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state); in vmxnet3_set_ringparam()
841 if (netif_running(adapter->netdev)) { in vmxnet3_get_rss_hash_opts()
844 spin_lock_irqsave(&adapter->cmd_lock, flags); in vmxnet3_get_rss_hash_opts()
849 spin_unlock_irqrestore(&adapter->cmd_lock, flags); in vmxnet3_get_rss_hash_opts()
851 rss_fields = adapter->rss_fields; in vmxnet3_get_rss_hash_opts()
854 info->data = 0; in vmxnet3_get_rss_hash_opts()
857 switch (info->flow_type) { in vmxnet3_get_rss_hash_opts()
860 info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3 | in vmxnet3_get_rss_hash_opts()
865 info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in vmxnet3_get_rss_hash_opts()
866 info->data |= RXH_IP_SRC | RXH_IP_DST; in vmxnet3_get_rss_hash_opts()
872 info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in vmxnet3_get_rss_hash_opts()
876 info->data |= RXH_IP_SRC | RXH_IP_DST; in vmxnet3_get_rss_hash_opts()
880 info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in vmxnet3_get_rss_hash_opts()
881 info->data |= RXH_IP_SRC | RXH_IP_DST; in vmxnet3_get_rss_hash_opts()
888 info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in vmxnet3_get_rss_hash_opts()
892 info->data |= RXH_IP_SRC | RXH_IP_DST; in vmxnet3_get_rss_hash_opts()
895 return -EINVAL; in vmxnet3_get_rss_hash_opts()
906 enum Vmxnet3_RSSField rss_fields = adapter->rss_fields; in vmxnet3_set_rss_hash_opt()
911 if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST | in vmxnet3_set_rss_hash_opt()
913 return -EINVAL; in vmxnet3_set_rss_hash_opt()
915 switch (nfc->flow_type) { in vmxnet3_set_rss_hash_opt()
918 if (!(nfc->data & RXH_IP_SRC) || in vmxnet3_set_rss_hash_opt()
919 !(nfc->data & RXH_IP_DST) || in vmxnet3_set_rss_hash_opt()
920 !(nfc->data & RXH_L4_B_0_1) || in vmxnet3_set_rss_hash_opt()
921 !(nfc->data & RXH_L4_B_2_3)) in vmxnet3_set_rss_hash_opt()
922 return -EINVAL; in vmxnet3_set_rss_hash_opt()
925 if (!(nfc->data & RXH_IP_SRC) || in vmxnet3_set_rss_hash_opt()
926 !(nfc->data & RXH_IP_DST)) in vmxnet3_set_rss_hash_opt()
927 return -EINVAL; in vmxnet3_set_rss_hash_opt()
928 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in vmxnet3_set_rss_hash_opt()
936 return -EINVAL; in vmxnet3_set_rss_hash_opt()
940 if (!(nfc->data & RXH_IP_SRC) || in vmxnet3_set_rss_hash_opt()
941 !(nfc->data & RXH_IP_DST)) in vmxnet3_set_rss_hash_opt()
942 return -EINVAL; in vmxnet3_set_rss_hash_opt()
943 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in vmxnet3_set_rss_hash_opt()
951 return -EINVAL; in vmxnet3_set_rss_hash_opt()
957 if (!(nfc->data & RXH_IP_SRC) || in vmxnet3_set_rss_hash_opt()
958 !(nfc->data & RXH_IP_DST)) in vmxnet3_set_rss_hash_opt()
959 return -EINVAL; in vmxnet3_set_rss_hash_opt()
960 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in vmxnet3_set_rss_hash_opt()
968 return -EINVAL; in vmxnet3_set_rss_hash_opt()
975 return -EOPNOTSUPP; in vmxnet3_set_rss_hash_opt()
976 if (!(nfc->data & RXH_IP_SRC) || in vmxnet3_set_rss_hash_opt()
977 !(nfc->data & RXH_IP_DST)) in vmxnet3_set_rss_hash_opt()
978 return -EINVAL; in vmxnet3_set_rss_hash_opt()
979 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in vmxnet3_set_rss_hash_opt()
987 return -EINVAL; in vmxnet3_set_rss_hash_opt()
992 if (!(nfc->data & RXH_IP_SRC) || in vmxnet3_set_rss_hash_opt()
993 !(nfc->data & RXH_IP_DST) || in vmxnet3_set_rss_hash_opt()
994 (nfc->data & RXH_L4_B_0_1) || in vmxnet3_set_rss_hash_opt()
995 (nfc->data & RXH_L4_B_2_3)) in vmxnet3_set_rss_hash_opt()
996 return -EINVAL; in vmxnet3_set_rss_hash_opt()
999 return -EINVAL; in vmxnet3_set_rss_hash_opt()
1003 if (rss_fields != adapter->rss_fields) { in vmxnet3_set_rss_hash_opt()
1004 adapter->default_rss_fields = false; in vmxnet3_set_rss_hash_opt()
1006 struct Vmxnet3_DriverShared *shared = adapter->shared; in vmxnet3_set_rss_hash_opt() local
1007 union Vmxnet3_CmdInfo *cmdInfo = &shared->cu.cmdInfo; in vmxnet3_set_rss_hash_opt()
1013 vmxnet3_check_ptcapability(adapter->ptcap_supported[0], in vmxnet3_set_rss_hash_opt()
1015 adapter->dev_caps[0] |= 1UL << VMXNET3_CAP_UDP_RSS; in vmxnet3_set_rss_hash_opt()
1017 adapter->dev_caps[0] &= ~(1UL << VMXNET3_CAP_UDP_RSS); in vmxnet3_set_rss_hash_opt()
1020 vmxnet3_check_ptcapability(adapter->ptcap_supported[0], in vmxnet3_set_rss_hash_opt()
1022 adapter->dev_caps[0] |= 1UL << VMXNET3_CAP_ESP_RSS_IPV4; in vmxnet3_set_rss_hash_opt()
1024 adapter->dev_caps[0] &= ~(1UL << VMXNET3_CAP_ESP_RSS_IPV4); in vmxnet3_set_rss_hash_opt()
1027 vmxnet3_check_ptcapability(adapter->ptcap_supported[0], in vmxnet3_set_rss_hash_opt()
1029 adapter->dev_caps[0] |= 1UL << VMXNET3_CAP_ESP_RSS_IPV6; in vmxnet3_set_rss_hash_opt()
1031 adapter->dev_caps[0] &= ~(1UL << VMXNET3_CAP_ESP_RSS_IPV6); in vmxnet3_set_rss_hash_opt()
1035 adapter->dev_caps[0]); in vmxnet3_set_rss_hash_opt()
1036 spin_lock_irqsave(&adapter->cmd_lock, flags); in vmxnet3_set_rss_hash_opt()
1039 adapter->dev_caps[0] = VMXNET3_READ_BAR1_REG(adapter, in vmxnet3_set_rss_hash_opt()
1041 spin_unlock_irqrestore(&adapter->cmd_lock, flags); in vmxnet3_set_rss_hash_opt()
1043 spin_lock_irqsave(&adapter->cmd_lock, flags); in vmxnet3_set_rss_hash_opt()
1044 cmdInfo->setRssFields = rss_fields; in vmxnet3_set_rss_hash_opt()
1053 adapter->rss_fields = in vmxnet3_set_rss_hash_opt()
1055 spin_unlock_irqrestore(&adapter->cmd_lock, flags); in vmxnet3_set_rss_hash_opt()
1060 adapter->rss_fields = rss_fields; in vmxnet3_set_rss_hash_opt()
1073 switch (info->cmd) { in vmxnet3_get_rxnfc()
1075 info->data = adapter->num_rx_queues; in vmxnet3_get_rxnfc()
1079 err = -EOPNOTSUPP; in vmxnet3_get_rxnfc()
1083 if (!adapter->rss) { in vmxnet3_get_rxnfc()
1084 err = -EOPNOTSUPP; in vmxnet3_get_rxnfc()
1091 err = -EOPNOTSUPP; in vmxnet3_get_rxnfc()
1105 err = -EOPNOTSUPP; in vmxnet3_set_rxnfc()
1109 if (!adapter->rss) { in vmxnet3_set_rxnfc()
1110 err = -EOPNOTSUPP; in vmxnet3_set_rxnfc()
1115 switch (info->cmd) { in vmxnet3_set_rxnfc()
1120 err = -EOPNOTSUPP; in vmxnet3_set_rxnfc()
1133 struct UPT1_RSSConf *rssConf = adapter->rss_conf; in vmxnet3_get_rss_indir_size()
1135 return rssConf->indTableSize; in vmxnet3_get_rss_indir_size()
1142 struct UPT1_RSSConf *rssConf = adapter->rss_conf; in vmxnet3_get_rss()
1143 unsigned int n = rssConf->indTableSize; in vmxnet3_get_rss()
1145 rxfh->hfunc = ETH_RSS_HASH_TOP; in vmxnet3_get_rss()
1146 if (!rxfh->indir) in vmxnet3_get_rss()
1150 while (n--) in vmxnet3_get_rss()
1151 rxfh->indir[n] = rssConf->indTable[n]; in vmxnet3_get_rss()
1163 struct UPT1_RSSConf *rssConf = adapter->rss_conf; in vmxnet3_set_rss()
1166 if (rxfh->key || in vmxnet3_set_rss()
1167 (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in vmxnet3_set_rss()
1168 rxfh->hfunc != ETH_RSS_HASH_TOP)) in vmxnet3_set_rss()
1169 return -EOPNOTSUPP; in vmxnet3_set_rss()
1170 if (!rxfh->indir) in vmxnet3_set_rss()
1172 for (i = 0; i < rssConf->indTableSize; i++) in vmxnet3_set_rss()
1173 rssConf->indTable[i] = rxfh->indir[i]; in vmxnet3_set_rss()
1175 spin_lock_irqsave(&adapter->cmd_lock, flags); in vmxnet3_set_rss()
1178 spin_unlock_irqrestore(&adapter->cmd_lock, flags); in vmxnet3_set_rss()
1193 return -EOPNOTSUPP; in vmxnet3_get_coalesce()
1195 switch (adapter->coal_conf->coalMode) { in vmxnet3_get_coalesce()
1200 ec->use_adaptive_rx_coalesce = true; in vmxnet3_get_coalesce()
1203 ec->tx_max_coalesced_frames = in vmxnet3_get_coalesce()
1204 adapter->coal_conf->coalPara.coalStatic.tx_comp_depth; in vmxnet3_get_coalesce()
1205 ec->rx_max_coalesced_frames = in vmxnet3_get_coalesce()
1206 adapter->coal_conf->coalPara.coalStatic.rx_depth; in vmxnet3_get_coalesce()
1211 rbc_rate = adapter->coal_conf->coalPara.coalRbc.rbc_rate; in vmxnet3_get_coalesce()
1212 ec->rx_coalesce_usecs = VMXNET3_COAL_RBC_USECS(rbc_rate); in vmxnet3_get_coalesce()
1216 return -EOPNOTSUPP; in vmxnet3_get_coalesce()
1228 struct Vmxnet3_DriverShared *shared = adapter->shared; in vmxnet3_set_coalesce() local
1229 union Vmxnet3_CmdInfo *cmdInfo = &shared->cu.cmdInfo; in vmxnet3_set_coalesce()
1233 return -EOPNOTSUPP; in vmxnet3_set_coalesce()
1235 if ((ec->rx_coalesce_usecs == 0) && in vmxnet3_set_coalesce()
1236 (ec->use_adaptive_rx_coalesce == 0) && in vmxnet3_set_coalesce()
1237 (ec->tx_max_coalesced_frames == 0) && in vmxnet3_set_coalesce()
1238 (ec->rx_max_coalesced_frames == 0)) { in vmxnet3_set_coalesce()
1239 memset(adapter->coal_conf, 0, sizeof(*adapter->coal_conf)); in vmxnet3_set_coalesce()
1240 adapter->coal_conf->coalMode = VMXNET3_COALESCE_DISABLED; in vmxnet3_set_coalesce()
1244 if (ec->rx_coalesce_usecs != 0) { in vmxnet3_set_coalesce()
1247 if ((ec->use_adaptive_rx_coalesce != 0) || in vmxnet3_set_coalesce()
1248 (ec->tx_max_coalesced_frames != 0) || in vmxnet3_set_coalesce()
1249 (ec->rx_max_coalesced_frames != 0)) { in vmxnet3_set_coalesce()
1250 return -EINVAL; in vmxnet3_set_coalesce()
1253 rbc_rate = VMXNET3_COAL_RBC_RATE(ec->rx_coalesce_usecs); in vmxnet3_set_coalesce()
1256 return -EINVAL; in vmxnet3_set_coalesce()
1259 memset(adapter->coal_conf, 0, sizeof(*adapter->coal_conf)); in vmxnet3_set_coalesce()
1260 adapter->coal_conf->coalMode = VMXNET3_COALESCE_RBC; in vmxnet3_set_coalesce()
1261 adapter->coal_conf->coalPara.coalRbc.rbc_rate = rbc_rate; in vmxnet3_set_coalesce()
1265 if (ec->use_adaptive_rx_coalesce != 0) { in vmxnet3_set_coalesce()
1266 if (ec->tx_max_coalesced_frames != 0 || in vmxnet3_set_coalesce()
1267 ec->rx_max_coalesced_frames != 0) { in vmxnet3_set_coalesce()
1268 return -EINVAL; in vmxnet3_set_coalesce()
1270 memset(adapter->coal_conf, 0, sizeof(*adapter->coal_conf)); in vmxnet3_set_coalesce()
1271 adapter->coal_conf->coalMode = VMXNET3_COALESCE_ADAPT; in vmxnet3_set_coalesce()
1275 if ((ec->tx_max_coalesced_frames != 0) || in vmxnet3_set_coalesce()
1276 (ec->rx_max_coalesced_frames != 0)) { in vmxnet3_set_coalesce()
1277 if ((ec->tx_max_coalesced_frames > in vmxnet3_set_coalesce()
1279 (ec->rx_max_coalesced_frames > in vmxnet3_set_coalesce()
1281 return -EINVAL; in vmxnet3_set_coalesce()
1284 memset(adapter->coal_conf, 0, sizeof(*adapter->coal_conf)); in vmxnet3_set_coalesce()
1285 adapter->coal_conf->coalMode = VMXNET3_COALESCE_STATIC; in vmxnet3_set_coalesce()
1287 adapter->coal_conf->coalPara.coalStatic.tx_comp_depth = in vmxnet3_set_coalesce()
1288 (ec->tx_max_coalesced_frames ? in vmxnet3_set_coalesce()
1289 ec->tx_max_coalesced_frames : in vmxnet3_set_coalesce()
1292 adapter->coal_conf->coalPara.coalStatic.rx_depth = in vmxnet3_set_coalesce()
1293 (ec->rx_max_coalesced_frames ? in vmxnet3_set_coalesce()
1294 ec->rx_max_coalesced_frames : in vmxnet3_set_coalesce()
1297 adapter->coal_conf->coalPara.coalStatic.tx_depth = in vmxnet3_set_coalesce()
1303 adapter->default_coal_mode = false; in vmxnet3_set_coalesce()
1305 spin_lock_irqsave(&adapter->cmd_lock, flags); in vmxnet3_set_coalesce()
1306 cmdInfo->varConf.confVer = 1; in vmxnet3_set_coalesce()
1307 cmdInfo->varConf.confLen = in vmxnet3_set_coalesce()
1308 cpu_to_le32(sizeof(*adapter->coal_conf)); in vmxnet3_set_coalesce()
1309 cmdInfo->varConf.confPA = cpu_to_le64(adapter->coal_conf_pa); in vmxnet3_set_coalesce()
1312 spin_unlock_irqrestore(&adapter->cmd_lock, flags); in vmxnet3_set_coalesce()
1323 if (IS_ENABLED(CONFIG_PCI_MSI) && adapter->intr.type == VMXNET3_IT_MSIX) { in vmxnet3_get_channels()
1324 if (adapter->share_intr == VMXNET3_INTR_BUDDYSHARE) { in vmxnet3_get_channels()
1325 ec->combined_count = adapter->num_tx_queues; in vmxnet3_get_channels()
1327 ec->rx_count = adapter->num_rx_queues; in vmxnet3_get_channels()
1328 ec->tx_count = in vmxnet3_get_channels()
1329 adapter->share_intr == VMXNET3_INTR_TXSHARE ? in vmxnet3_get_channels()
1330 1 : adapter->num_tx_queues; in vmxnet3_get_channels()
1333 ec->combined_count = 1; in vmxnet3_get_channels()
1336 ec->other_count = 1; in vmxnet3_get_channels()
1340 ec->max_rx = ec->rx_count; in vmxnet3_get_channels()
1341 ec->max_tx = ec->tx_count; in vmxnet3_get_channels()
1342 ec->max_combined = ec->combined_count; in vmxnet3_get_channels()
1343 ec->max_other = ec->other_count; in vmxnet3_get_channels()
1376 netdev->ethtool_ops = &vmxnet3_ethtool_ops; in vmxnet3_set_ethtool_ops()