MCPcopy Create free account
hub / github.com/F-Stack/f-stack / virtio_dev_info_get

Function virtio_dev_info_get

dpdk/drivers/net/virtio/virtio_ethdev.c:2615–2701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2613}
2614
2615static int
2616virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
2617{
2618 uint64_t tso_mask, host_features;
2619 uint32_t rss_hash_types = 0;
2620 struct virtio_hw *hw = dev->data->dev_private;
2621 dev_info->speed_capa = virtio_dev_speed_capa_get(hw->speed);
2622
2623 dev_info->max_rx_queues =
2624 RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
2625 dev_info->max_tx_queues =
2626 RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_TX_QUEUES);
2627 dev_info->min_rx_bufsize = VIRTIO_MIN_RX_BUFSIZE;
2628 dev_info->max_rx_pktlen = VIRTIO_MAX_RX_PKTLEN;
2629 dev_info->max_mac_addrs = VIRTIO_MAX_MAC_ADDRS;
2630 dev_info->max_mtu = hw->max_mtu;
2631
2632 host_features = VIRTIO_OPS(hw)->get_features(hw);
2633 dev_info->rx_offload_capa = RTE_ETH_RX_OFFLOAD_VLAN_STRIP;
2634 if (host_features & (1ULL << VIRTIO_NET_F_MRG_RXBUF))
2635 dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_SCATTER;
2636 if (host_features & (1ULL << VIRTIO_NET_F_GUEST_CSUM)) {
2637 dev_info->rx_offload_capa |=
2638 RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
2639 RTE_ETH_RX_OFFLOAD_UDP_CKSUM;
2640 }
2641 if (host_features & (1ULL << VIRTIO_NET_F_CTRL_VLAN))
2642 dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_VLAN_FILTER;
2643 tso_mask = (1ULL << VIRTIO_NET_F_GUEST_TSO4) |
2644 (1ULL << VIRTIO_NET_F_GUEST_TSO6);
2645 if ((host_features & tso_mask) == tso_mask)
2646 dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TCP_LRO;
2647
2648 dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS |
2649 RTE_ETH_TX_OFFLOAD_VLAN_INSERT;
2650 if (host_features & (1ULL << VIRTIO_NET_F_CSUM)) {
2651 dev_info->tx_offload_capa |=
2652 RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
2653 RTE_ETH_TX_OFFLOAD_TCP_CKSUM;
2654 }
2655 tso_mask = (1ULL << VIRTIO_NET_F_HOST_TSO4) |
2656 (1ULL << VIRTIO_NET_F_HOST_TSO6);
2657 if ((host_features & tso_mask) == tso_mask)
2658 dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_TCP_TSO;
2659
2660 if (host_features & (1ULL << VIRTIO_NET_F_RSS)) {
2661 virtio_dev_get_rss_config(hw, &rss_hash_types);
2662 dev_info->hash_key_size = VIRTIO_NET_RSS_KEY_SIZE;
2663 dev_info->reta_size = VIRTIO_NET_RSS_RETA_SIZE;
2664 dev_info->flow_type_rss_offloads =
2665 virtio_to_ethdev_rss_offloads(rss_hash_types);
2666 } else {
2667 dev_info->hash_key_size = 0;
2668 dev_info->reta_size = 0;
2669 dev_info->flow_type_rss_offloads = 0;
2670 }
2671
2672 if (host_features & (1ULL << VIRTIO_F_RING_PACKED)) {

Callers

nothing calls this directly

Calls 3

Tested by

no test coverage detected