1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2010-2015 Intel Corporation 3 */ 4 5 #ifndef _VIRTIO_RXTX_H_ 6 #define _VIRTIO_RXTX_H_ 7 8 #define RTE_PMD_VIRTIO_RX_MAX_BURST 64 9 10 struct virtnet_stats { 11 uint64_t packets; 12 uint64_t bytes; 13 uint64_t errors; 14 uint64_t multicast; 15 uint64_t broadcast; 16 /* Size bins in array as RFC 2819, undersized [0], 64 [1], etc */ 17 uint64_t size_bins[8]; 18 }; 19 20 struct virtnet_rx { 21 struct virtqueue *vq; 22 /* dummy mbuf, for wraparound when processing RX ring. */ 23 struct rte_mbuf fake_mbuf; 24 uint64_t mbuf_initializer; /**< value to init mbufs. */ 25 struct rte_mempool *mpool; /**< mempool for mbuf allocation */ 26 27 uint16_t queue_id; /**< DPDK queue index. */ 28 uint16_t port_id; /**< Device port identifier. */ 29 30 /* Statistics */ 31 struct virtnet_stats stats; 32 33 const struct rte_memzone *mz; /**< mem zone to populate RX ring. */ 34 }; 35 36 struct virtnet_tx { 37 struct virtqueue *vq; 38 /**< memzone to populate hdr. */ 39 const struct rte_memzone *virtio_net_hdr_mz; 40 rte_iova_t virtio_net_hdr_mem; /**< hdr for each xmit packet */ 41 42 uint16_t queue_id; /**< DPDK queue index. */ 43 uint16_t port_id; /**< Device port identifier. */ 44 45 /* Statistics */ 46 struct virtnet_stats stats; 47 48 const struct rte_memzone *mz; /**< mem zone to populate TX ring. */ 49 }; 50 51 struct virtnet_ctl { 52 struct virtqueue *vq; 53 /**< memzone to populate hdr. */ 54 const struct rte_memzone *virtio_net_hdr_mz; 55 rte_iova_t virtio_net_hdr_mem; /**< hdr for each xmit packet */ 56 uint16_t port_id; /**< Device port identifier. */ 57 const struct rte_memzone *mz; /**< mem zone to populate CTL ring. */ 58 rte_spinlock_t lock; /**< spinlock for control queue. */ 59 }; 60 61 int virtio_rxq_vec_setup(struct virtnet_rx *rxvq); 62 63 int virtqueue_enqueue_recv_refill_simple(struct virtqueue *vq, 64 struct rte_mbuf *m); 65 66 #endif /* _VIRTIO_RXTX_H_ */ 67