1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Marvell International Ltd.
3 * Copyright(c) 2018 Semihalf.
7 #ifndef _MVNETA_ETHDEV_H_
8 #define _MVNETA_ETHDEV_H_
10 #include <rte_ethdev.h>
11 #include <rte_malloc.h>
15 * container_of is defined by both DPDK and MUSDK,
16 * we'll declare only one version.
18 * Note that it is not used in this PMD anyway.
24 #include <drivers/mv_neta.h>
25 #include <drivers/mv_neta_ppio.h>
27 /** Packet offset inside RX buffer. */
28 #define MRVL_NETA_PKT_OFFS 64
30 /** Maximum number of rx/tx queues per port */
31 #define MRVL_NETA_RXQ_MAX 8
32 #define MRVL_NETA_TXQ_MAX 8
34 /** Minimum/maximum number of descriptors in tx queue */
35 #define MRVL_NETA_TXD_MIN 16
36 #define MRVL_NETA_TXD_MAX 2048
38 /** Tx queue descriptors alignment in B */
39 #define MRVL_NETA_TXD_ALIGN 32
41 /** Minimum/maximum number of descriptors in rx queue */
42 #define MRVL_NETA_RXD_MIN 16
43 #define MRVL_NETA_RXD_MAX 2048
45 /** Rx queue descriptors alignment in B */
46 #define MRVL_NETA_RXD_ALIGN 32
48 #define MRVL_NETA_VLAN_TAG_LEN 4
49 #define MRVL_NETA_ETH_HDRS_LEN (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
50 MRVL_NETA_VLAN_TAG_LEN)
52 #define MRVL_NETA_HDRS_LEN (MV_MH_SIZE + MRVL_NETA_ETH_HDRS_LEN)
53 #define MRVL_NETA_MTU_TO_MRU(mtu) ((mtu) + MRVL_NETA_HDRS_LEN)
54 #define MRVL_NETA_MRU_TO_MTU(mru) ((mru) - MRVL_NETA_HDRS_LEN)
58 /* Hot fields, used in fast path. */
59 struct neta_ppio *ppio; /**< Port handler pointer */
62 uint8_t ppio_id; /* ppio port id */
63 uint8_t uc_mc_flushed;
66 struct neta_ppio_params ppio_params;
69 struct rte_eth_stats prev_stats;
72 /** Current log type. */
73 extern int mvneta_logtype;
75 #define MVNETA_LOG(level, fmt, args...) \
76 rte_log(RTE_LOG_ ## level, mvneta_logtype, "%s(): " fmt "\n", \
79 #endif /* _MVNETA_ETHDEV_H_ */