net/mvneta: add PMD skeleton
[dpdk.git] / drivers / net / mvneta / mvneta_ethdev.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Marvell International Ltd.
3  * Copyright(c) 2018 Semihalf.
4  * All rights reserved.
5  */
6
7 #ifndef _MVNETA_ETHDEV_H_
8 #define _MVNETA_ETHDEV_H_
9
10 /*
11  * container_of is defined by both DPDK and MUSDK,
12  * we'll declare only one version.
13  *
14  * Note that it is not used in this PMD anyway.
15  */
16 #ifdef container_of
17 #undef container_of
18 #endif
19
20 #include <drivers/mv_neta.h>
21 #include <drivers/mv_neta_ppio.h>
22
23 /** Packet offset inside RX buffer. */
24 #define MRVL_NETA_PKT_OFFS 64
25
26 /** Maximum number of rx/tx queues per port */
27 #define MRVL_NETA_RXQ_MAX 8
28 #define MRVL_NETA_TXQ_MAX 8
29
30 /** Minimum/maximum number of descriptors in tx queue */
31 #define MRVL_NETA_TXD_MIN 16
32 #define MRVL_NETA_TXD_MAX 2048
33
34 /** Tx queue descriptors alignment in B */
35 #define MRVL_NETA_TXD_ALIGN 32
36
37 /** Minimum/maximum number of descriptors in rx queue */
38 #define MRVL_NETA_RXD_MIN 16
39 #define MRVL_NETA_RXD_MAX 2048
40
41 /** Rx queue descriptors alignment in B */
42 #define MRVL_NETA_RXD_ALIGN 32
43
44 #define MRVL_NETA_VLAN_TAG_LEN          4
45 #define MRVL_NETA_ETH_HDRS_LEN          (ETHER_HDR_LEN + ETHER_CRC_LEN + \
46                                         MRVL_NETA_VLAN_TAG_LEN)
47
48 #define MRVL_NETA_HDRS_LEN              (MV_MH_SIZE + MRVL_NETA_ETH_HDRS_LEN)
49 #define MRVL_NETA_MTU_TO_MRU(mtu)       ((mtu) + MRVL_NETA_HDRS_LEN)
50 #define MRVL_NETA_MRU_TO_MTU(mru)       ((mru) - MRVL_NETA_HDRS_LEN)
51
52
53 struct mvneta_priv {
54         /* Hot fields, used in fast path. */
55         struct neta_ppio        *ppio;    /**< Port handler pointer */
56
57         uint8_t pp_id;
58         uint8_t ppio_id;        /* ppio port id */
59         uint8_t uc_mc_flushed;
60         uint8_t multiseg;
61
62         struct neta_ppio_params ppio_params;
63
64         uint64_t rate_max;
65 };
66
67 /** Current log type. */
68 extern int mvneta_logtype;
69
70 #define MVNETA_LOG(level, fmt, args...) \
71         rte_log(RTE_LOG_ ## level, mvneta_logtype, "%s(): " fmt "\n", \
72                 __func__, ##args)
73
74 #endif /* _MVNETA_ETHDEV_H_ */