net/cnxk: support Rx security offload on cn10k
[dpdk.git] / drivers / net / cnxk / cn9k_ethdev.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4 #ifndef __CN9K_ETHDEV_H__
5 #define __CN9K_ETHDEV_H__
6
7 #include <cnxk_ethdev.h>
8 #include <cnxk_security.h>
9
10 struct cn9k_eth_txq {
11         uint64_t cmd[8];
12         int64_t fc_cache_pkts;
13         uint64_t *fc_mem;
14         void *lmt_addr;
15         rte_iova_t io_addr;
16         uint64_t lso_tun_fmt;
17         uint16_t sqes_per_sqb_log2;
18         int16_t nb_sqb_bufs_adj;
19         rte_iova_t cpt_io_addr;
20         uint64_t sa_base;
21         uint64_t *cpt_fc;
22         uint16_t cpt_desc;
23 } __plt_cache_aligned;
24
25 struct cn9k_eth_rxq {
26         uint64_t mbuf_initializer;
27         uint64_t data_off;
28         uintptr_t desc;
29         void *lookup_mem;
30         uintptr_t cq_door;
31         uint64_t wdata;
32         int64_t *cq_status;
33         uint32_t head;
34         uint32_t qmask;
35         uint32_t available;
36         uint16_t rq;
37         struct cnxk_timesync_info *tstamp;
38 } __plt_cache_aligned;
39
40 /* Private data in sw rsvd area of struct roc_onf_ipsec_inb_sa */
41 struct cn9k_inb_priv_data {
42         void *userdata;
43         struct cnxk_eth_sec_sess *eth_sec;
44 };
45
46 /* Private data in sw rsvd area of struct roc_onf_ipsec_outb_sa */
47 struct cn9k_outb_priv_data {
48         union {
49                 uint64_t esn;
50                 struct {
51                         uint32_t seq;
52                         uint32_t esn_hi;
53                 };
54         };
55
56         /* Rlen computation data */
57         struct cnxk_ipsec_outb_rlens rlens;
58
59         /* IP identifier */
60         uint16_t ip_id;
61
62         /* SA index */
63         uint32_t sa_idx;
64
65         /* Flags */
66         uint16_t copy_salt : 1;
67
68         /* Salt */
69         uint32_t nonce;
70
71         /* User data pointer */
72         void *userdata;
73
74         /* Back pointer to eth sec session */
75         struct cnxk_eth_sec_sess *eth_sec;
76 };
77
78 struct cn9k_sec_sess_priv {
79         union {
80                 struct {
81                         uint32_t sa_idx;
82                         uint8_t inb_sa : 1;
83                         uint8_t rsvd1 : 2;
84                         uint8_t roundup_byte : 5;
85                         uint8_t roundup_len;
86                         uint16_t partial_len;
87                 };
88
89                 uint64_t u64;
90         };
91 } __rte_packed;
92
93 /* Rx and Tx routines */
94 void cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev);
95 void cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev);
96
97 /* Security context setup */
98 void cn9k_eth_sec_ops_override(void);
99
100 #endif /* __CN9K_ETHDEV_H__ */