xref: /dpdk/drivers/net/virtio/virtio_rxtx.h (revision e9dac45c0d3071bf3c6308a0cfbae93421ac4829)
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 rte_mbuf **sw_ring;  /**< RX software ring. */
22 	struct rte_mbuf *fake_mbuf; /**< dummy mbuf, for wraparound when processing RX ring. */
23 	uint64_t mbuf_initializer; /**< value to init mbufs. */
24 	struct rte_mempool *mpool; /**< mempool for mbuf allocation */
25 
26 	/* Statistics */
27 	struct virtnet_stats stats;
28 };
29 
30 struct virtnet_tx {
31 	const struct rte_memzone *hdr_mz; /**< memzone to populate hdr. */
32 	rte_iova_t hdr_mem;               /**< hdr for each xmit packet */
33 
34 	struct virtnet_stats stats;       /* Statistics */
35 };
36 
37 int virtio_rxq_vec_setup(struct virtnet_rx *rxvq);
38 void virtio_update_packet_stats(struct virtnet_stats *const stats,
39 		const struct rte_mbuf *const mbuf);
40 
41 #endif /* _VIRTIO_RXTX_H_ */
42