ba2bfcd3e0aa192295818bbb9fa4cfb7c170c965
[dpdk.git] / drivers / net / cnxk / cnxk_ethdev.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4 #ifndef __CNXK_ETHDEV_H__
5 #define __CNXK_ETHDEV_H__
6
7 #include <math.h>
8 #include <stdint.h>
9
10 #include <ethdev_driver.h>
11 #include <ethdev_pci.h>
12
13 #include "roc_api.h"
14
15 #define CNXK_ETH_DEV_PMD_VERSION "1.0"
16
17 #define CNXK_NIX_TX_OFFLOAD_CAPA                                               \
18         (DEV_TX_OFFLOAD_MBUF_FAST_FREE | DEV_TX_OFFLOAD_MT_LOCKFREE |          \
19          DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_QINQ_INSERT |             \
20          DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_TX_OFFLOAD_OUTER_UDP_CKSUM |    \
21          DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM |                 \
22          DEV_TX_OFFLOAD_SCTP_CKSUM | DEV_TX_OFFLOAD_TCP_TSO |                  \
23          DEV_TX_OFFLOAD_VXLAN_TNL_TSO | DEV_TX_OFFLOAD_GENEVE_TNL_TSO |        \
24          DEV_TX_OFFLOAD_GRE_TNL_TSO | DEV_TX_OFFLOAD_MULTI_SEGS |              \
25          DEV_TX_OFFLOAD_IPV4_CKSUM)
26
27 #define CNXK_NIX_RX_OFFLOAD_CAPA                                               \
28         (DEV_RX_OFFLOAD_CHECKSUM | DEV_RX_OFFLOAD_SCTP_CKSUM |                 \
29          DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_RX_OFFLOAD_SCATTER |            \
30          DEV_RX_OFFLOAD_JUMBO_FRAME | DEV_RX_OFFLOAD_OUTER_UDP_CKSUM |         \
31          DEV_RX_OFFLOAD_RSS_HASH)
32
33 struct cnxk_eth_dev {
34         /* ROC NIX */
35         struct roc_nix nix;
36
37         /* Max macfilter entries */
38         uint8_t max_mac_entries;
39
40         uint16_t flags;
41
42         /* Pointer back to rte */
43         struct rte_eth_dev *eth_dev;
44
45         /* HW capabilities / Limitations */
46         union {
47                 struct {
48                         uint64_t cq_min_4k : 1;
49                 };
50                 uint64_t hwcap;
51         };
52
53         /* Rx and Tx offload capabilities */
54         uint64_t rx_offload_capa;
55         uint64_t tx_offload_capa;
56         uint32_t speed_capa;
57
58         /* Default mac address */
59         uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
60 };
61
62 static inline struct cnxk_eth_dev *
63 cnxk_eth_pmd_priv(struct rte_eth_dev *eth_dev)
64 {
65         return eth_dev->data->dev_private;
66 }
67
68 /* Common ethdev ops */
69 extern struct eth_dev_ops cnxk_eth_dev_ops;
70
71 /* Ops */
72 int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
73                    struct rte_pci_device *pci_dev);
74 int cnxk_nix_remove(struct rte_pci_device *pci_dev);
75
76 #endif /* __CNXK_ETHDEV_H__ */