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 <ethdev_driver.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_ETH_HDRS_LEN (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
51 #define MRVL_NETA_HDRS_LEN (MV_MH_SIZE + MRVL_NETA_ETH_HDRS_LEN)
52 #define MRVL_NETA_MTU_TO_MRU(mtu) ((mtu) + MRVL_NETA_HDRS_LEN)
53 #define MRVL_NETA_MRU_TO_MTU(mru) ((mru) - MRVL_NETA_HDRS_LEN)
55 /** Rx offloads capabilities */
56 #define MVNETA_RX_OFFLOADS (RTE_ETH_RX_OFFLOAD_CHECKSUM)
58 /** Tx offloads capabilities */
59 #define MVNETA_TX_OFFLOAD_CHECKSUM (RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | \
60 RTE_ETH_TX_OFFLOAD_UDP_CKSUM | \
61 RTE_ETH_TX_OFFLOAD_TCP_CKSUM)
62 #define MVNETA_TX_OFFLOADS (MVNETA_TX_OFFLOAD_CHECKSUM | \
63 RTE_ETH_TX_OFFLOAD_MULTI_SEGS)
65 #define MVNETA_TX_PKT_OFFLOADS (RTE_MBUF_F_TX_IP_CKSUM | \
66 RTE_MBUF_F_TX_TCP_CKSUM | \
67 RTE_MBUF_F_TX_UDP_CKSUM)
70 /* Hot fields, used in fast path. */
71 struct neta_ppio *ppio; /**< Port handler pointer */
74 uint8_t ppio_id; /* ppio port id */
75 uint8_t uc_mc_flushed;
78 struct neta_ppio_params ppio_params;
81 struct rte_eth_stats prev_stats;
84 /** Current log type. */
85 extern int mvneta_logtype;
87 #define MVNETA_LOG(level, fmt, args...) \
88 rte_log(RTE_LOG_ ## level, mvneta_logtype, "%s(): " fmt "\n", \
91 #endif /* _MVNETA_ETHDEV_H_ */