xref: /dpdk/drivers/net/zxdh/zxdh_rxtx.h (revision e77506397fc8005c5129e22e9e2d15d5876790fd)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2024 ZTE Corporation
3  */
4 
5 #ifndef ZXDH_RXTX_H
6 #define ZXDH_RXTX_H
7 
8 #include <stdint.h>
9 
10 #include <rte_common.h>
11 #include <rte_mbuf_core.h>
12 
13 struct zxdh_virtnet_stats {
14 	uint64_t packets;
15 	uint64_t bytes;
16 	uint64_t errors;
17 	uint64_t multicast;
18 	uint64_t broadcast;
19 	uint64_t truncated_err;
20 	uint64_t size_bins[8];
21 };
22 
23 struct __rte_packed_begin zxdh_virtnet_rx {
24 	struct zxdh_virtqueue         *vq;
25 
26 	/* dummy mbuf, for wraparound when processing RX ring. */
27 	struct rte_mbuf           fake_mbuf;
28 
29 	uint64_t                  mbuf_initializer; /* value to init mbufs. */
30 	struct rte_mempool       *mpool;            /* mempool for mbuf allocation */
31 	uint16_t                  queue_id;         /* DPDK queue index. */
32 	uint16_t                  port_id;          /* Device port identifier. */
33 	struct zxdh_virtnet_stats      stats;
34 	const struct rte_memzone *mz;               /* mem zone to populate RX ring. */
35 } __rte_packed_end;
36 
37 struct __rte_packed_begin zxdh_virtnet_tx {
38 	struct zxdh_virtqueue         *vq;
39 	const struct rte_memzone *zxdh_net_hdr_mz;  /* memzone to populate hdr. */
40 	rte_iova_t                zxdh_net_hdr_mem; /* hdr for each xmit packet */
41 	uint16_t                  queue_id;           /* DPDK queue index. */
42 	uint16_t                  port_id;            /* Device port identifier. */
43 	struct zxdh_virtnet_stats      stats;
44 	const struct rte_memzone *mz;                 /* mem zone to populate TX ring. */
45 } __rte_packed_end;
46 
47 #endif  /* ZXDH_RXTX_H */
48