net/octeontx2: support TSO offload
[dpdk.git] / drivers / net / octeontx2 / otx2_ethdev.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2019 Marvell International Ltd.
3  */
4
5 #ifndef __OTX2_ETHDEV_H__
6 #define __OTX2_ETHDEV_H__
7
8 #include <math.h>
9 #include <stdint.h>
10
11 #include <rte_common.h>
12 #include <rte_ethdev.h>
13 #include <rte_kvargs.h>
14 #include <rte_mbuf.h>
15 #include <rte_mempool.h>
16 #include <rte_string_fns.h>
17 #include <rte_time.h>
18
19 #include "otx2_common.h"
20 #include "otx2_dev.h"
21 #include "otx2_flow.h"
22 #include "otx2_irq.h"
23 #include "otx2_mempool.h"
24 #include "otx2_rx.h"
25 #include "otx2_tm.h"
26 #include "otx2_tx.h"
27
28 #define OTX2_ETH_DEV_PMD_VERSION        "1.0"
29
30 /* Ethdev HWCAP and Fixup flags. Use from MSB bits to avoid conflict with dev */
31
32 /* Minimum CQ size should be 4K */
33 #define OTX2_FIXUP_F_MIN_4K_Q           BIT_ULL(63)
34 #define otx2_ethdev_fixup_is_min_4k_q(dev)      \
35                                 ((dev)->hwcap & OTX2_FIXUP_F_MIN_4K_Q)
36 /* Limit CQ being full */
37 #define OTX2_FIXUP_F_LIMIT_CQ_FULL      BIT_ULL(62)
38 #define otx2_ethdev_fixup_is_limit_cq_full(dev) \
39                                 ((dev)->hwcap & OTX2_FIXUP_F_LIMIT_CQ_FULL)
40
41 /* Used for struct otx2_eth_dev::flags */
42 #define OTX2_LINK_CFG_IN_PROGRESS_F     BIT_ULL(0)
43
44 /* VLAN tag inserted by NIX_TX_VTAG_ACTION.
45  * In Tx space is always reserved for this in FRS.
46  */
47 #define NIX_MAX_VTAG_INS                2
48 #define NIX_MAX_VTAG_ACT_SIZE           (4 * NIX_MAX_VTAG_INS)
49
50 /* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
51 #define NIX_L2_OVERHEAD \
52         (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 8)
53
54 /* HW config of frame size doesn't include FCS */
55 #define NIX_MAX_HW_FRS                  9212
56 #define NIX_MIN_HW_FRS                  60
57
58 /* Since HW FRS includes NPC VTAG insertion space, user has reduced FRS */
59 #define NIX_MAX_FRS     \
60         (NIX_MAX_HW_FRS + RTE_ETHER_CRC_LEN - NIX_MAX_VTAG_ACT_SIZE)
61
62 #define NIX_MIN_FRS     \
63         (NIX_MIN_HW_FRS + RTE_ETHER_CRC_LEN)
64
65 #define NIX_MAX_MTU     \
66         (NIX_MAX_FRS - NIX_L2_OVERHEAD)
67
68 #define NIX_MAX_SQB                     512
69 #define NIX_DEF_SQB                     16
70 #define NIX_MIN_SQB                     8
71 #define NIX_SQB_LIST_SPACE              2
72 #define NIX_RSS_RETA_SIZE_MAX           256
73 /* Group 0 will be used for RSS, 1 -7 will be used for rte_flow RSS action*/
74 #define NIX_RSS_GRPS                    8
75 #define NIX_HASH_KEY_SIZE               48 /* 352 Bits */
76 #define NIX_RSS_RETA_SIZE               64
77 #define NIX_RX_MIN_DESC                 16
78 #define NIX_RX_MIN_DESC_ALIGN           16
79 #define NIX_RX_NB_SEG_MAX               6
80 #define NIX_CQ_ENTRY_SZ                 128
81 #define NIX_CQ_ALIGN                    512
82 #define NIX_SQB_LOWER_THRESH            90
83 #define LMT_SLOT_MASK                   0x7f
84 #define NIX_RX_DEFAULT_RING_SZ          4096
85
86 /* If PTP is enabled additional SEND MEM DESC is required which
87  * takes 2 words, hence max 7 iova address are possible
88  */
89 #if defined(RTE_LIBRTE_IEEE1588)
90 #define NIX_TX_NB_SEG_MAX               7
91 #else
92 #define NIX_TX_NB_SEG_MAX               9
93 #endif
94
95 #define NIX_TX_MSEG_SG_DWORDS                           \
96         ((RTE_ALIGN_MUL_CEIL(NIX_TX_NB_SEG_MAX, 3) / 3) \
97          + NIX_TX_NB_SEG_MAX)
98
99 /* Apply BP/DROP when CQ is 95% full */
100 #define NIX_CQ_THRESH_LEVEL     (5 * 256 / 100)
101 #define NIX_CQ_FULL_ERRATA_SKID (1024ull * 256)
102
103 #define CQ_OP_STAT_OP_ERR       63
104 #define CQ_OP_STAT_CQ_ERR       46
105
106 #define OP_ERR                  BIT_ULL(CQ_OP_STAT_OP_ERR)
107 #define CQ_ERR                  BIT_ULL(CQ_OP_STAT_CQ_ERR)
108
109 #define CQ_CQE_THRESH_DEFAULT   0x1ULL /* IRQ triggered when
110                                         * NIX_LF_CINTX_CNT[QCOUNT]
111                                         * crosses this value
112                                         */
113 #define CQ_TIMER_THRESH_DEFAULT 0xAULL /* ~1usec i.e (0xA * 100nsec) */
114 #define CQ_TIMER_THRESH_MAX     255
115
116 #define NIX_RSS_OFFLOAD         (ETH_RSS_PORT | ETH_RSS_IP | ETH_RSS_UDP |\
117                                  ETH_RSS_TCP | ETH_RSS_SCTP | \
118                                  ETH_RSS_TUNNEL | ETH_RSS_L2_PAYLOAD)
119
120 #define NIX_TX_OFFLOAD_CAPA ( \
121         DEV_TX_OFFLOAD_MBUF_FAST_FREE   | \
122         DEV_TX_OFFLOAD_MT_LOCKFREE      | \
123         DEV_TX_OFFLOAD_VLAN_INSERT      | \
124         DEV_TX_OFFLOAD_QINQ_INSERT      | \
125         DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | \
126         DEV_TX_OFFLOAD_OUTER_UDP_CKSUM  | \
127         DEV_TX_OFFLOAD_TCP_CKSUM        | \
128         DEV_TX_OFFLOAD_UDP_CKSUM        | \
129         DEV_TX_OFFLOAD_SCTP_CKSUM       | \
130         DEV_TX_OFFLOAD_TCP_TSO          | \
131         DEV_TX_OFFLOAD_VXLAN_TNL_TSO    | \
132         DEV_TX_OFFLOAD_GENEVE_TNL_TSO   | \
133         DEV_TX_OFFLOAD_MULTI_SEGS       | \
134         DEV_TX_OFFLOAD_IPV4_CKSUM)
135
136 #define NIX_RX_OFFLOAD_CAPA ( \
137         DEV_RX_OFFLOAD_CHECKSUM         | \
138         DEV_RX_OFFLOAD_SCTP_CKSUM       | \
139         DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | \
140         DEV_RX_OFFLOAD_SCATTER          | \
141         DEV_RX_OFFLOAD_JUMBO_FRAME      | \
142         DEV_RX_OFFLOAD_OUTER_UDP_CKSUM | \
143         DEV_RX_OFFLOAD_VLAN_STRIP | \
144         DEV_RX_OFFLOAD_VLAN_FILTER | \
145         DEV_RX_OFFLOAD_QINQ_STRIP | \
146         DEV_RX_OFFLOAD_TIMESTAMP)
147
148 #define NIX_DEFAULT_RSS_CTX_GROUP  0
149 #define NIX_DEFAULT_RSS_MCAM_IDX  -1
150
151 #define otx2_ethdev_is_ptp_en(dev)      ((dev)->ptp_en)
152
153 #define NIX_TIMESYNC_TX_CMD_LEN         8
154 /* Additional timesync values. */
155 #define OTX2_CYCLECOUNTER_MASK   0xffffffffffffffffULL
156
157 enum nix_q_size_e {
158         nix_q_size_16,  /* 16 entries */
159         nix_q_size_64,  /* 64 entries */
160         nix_q_size_256,
161         nix_q_size_1K,
162         nix_q_size_4K,
163         nix_q_size_16K,
164         nix_q_size_64K,
165         nix_q_size_256K,
166         nix_q_size_1M,  /* Million entries */
167         nix_q_size_max
168 };
169
170 struct otx2_qint {
171         struct rte_eth_dev *eth_dev;
172         uint8_t qintx;
173 };
174
175 struct otx2_rss_info {
176         uint64_t nix_rss;
177         uint32_t flowkey_cfg;
178         uint16_t rss_size;
179         uint8_t rss_grps;
180         uint8_t alg_idx; /* Selected algo index */
181         uint16_t ind_tbl[NIX_RSS_RETA_SIZE_MAX];
182         uint8_t key[NIX_HASH_KEY_SIZE];
183 };
184
185 struct otx2_eth_qconf {
186         union {
187                 struct rte_eth_txconf tx;
188                 struct rte_eth_rxconf rx;
189         } conf;
190         void *mempool;
191         uint32_t socket_id;
192         uint16_t nb_desc;
193 };
194
195 struct otx2_fc_info {
196         enum rte_eth_fc_mode mode;  /**< Link flow control mode */
197         uint8_t rx_pause;
198         uint8_t tx_pause;
199         uint8_t chan_cnt;
200         uint16_t bpid[NIX_MAX_CHAN];
201 };
202
203 struct vlan_mkex_info {
204         struct npc_xtract_info la_xtract;
205         struct npc_xtract_info lb_xtract;
206         uint64_t lb_lt_offset;
207 };
208
209 struct vlan_entry {
210         uint32_t mcam_idx;
211         uint16_t vlan_id;
212         TAILQ_ENTRY(vlan_entry) next;
213 };
214
215 TAILQ_HEAD(otx2_vlan_filter_tbl, vlan_entry);
216
217 struct otx2_vlan_info {
218         struct otx2_vlan_filter_tbl fltr_tbl;
219         /* MKEX layer info */
220         struct mcam_entry def_tx_mcam_ent;
221         struct mcam_entry def_rx_mcam_ent;
222         struct vlan_mkex_info mkex;
223         /* Default mcam entry that matches vlan packets */
224         uint32_t def_rx_mcam_idx;
225         uint32_t def_tx_mcam_idx;
226         /* MCAM entry that matches double vlan packets */
227         uint32_t qinq_mcam_idx;
228         /* Indices of tx_vtag def registers */
229         uint32_t outer_vlan_idx;
230         uint32_t inner_vlan_idx;
231         uint16_t outer_vlan_tpid;
232         uint16_t inner_vlan_tpid;
233         uint16_t pvid;
234         /* QinQ entry allocated before default one */
235         uint8_t qinq_before_def;
236         uint8_t pvid_insert_on;
237         /* Rx vtag action type */
238         uint8_t vtag_type_idx;
239         uint8_t filter_on;
240         uint8_t strip_on;
241         uint8_t qinq_on;
242         uint8_t promisc_on;
243 };
244
245 struct otx2_eth_dev {
246         OTX2_DEV; /* Base class */
247         MARKER otx2_eth_dev_data_start;
248         uint16_t sqb_size;
249         uint16_t rx_chan_base;
250         uint16_t tx_chan_base;
251         uint8_t rx_chan_cnt;
252         uint8_t tx_chan_cnt;
253         uint8_t lso_tsov4_idx;
254         uint8_t lso_tsov6_idx;
255         uint8_t lso_base_idx;
256         uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
257         uint8_t mkex_pfl_name[MKEX_NAME_LEN];
258         uint8_t max_mac_entries;
259         uint8_t lf_tx_stats;
260         uint8_t lf_rx_stats;
261         uint16_t flags;
262         uint16_t cints;
263         uint16_t qints;
264         uint8_t configured;
265         uint8_t configured_qints;
266         uint8_t configured_cints;
267         uint8_t configured_nb_rx_qs;
268         uint8_t configured_nb_tx_qs;
269         uint16_t nix_msixoff;
270         uintptr_t base;
271         uintptr_t lmt_addr;
272         uint16_t scalar_ena;
273         uint16_t max_sqb_count;
274         uint16_t rx_offload_flags; /* Selected Rx offload flags(NIX_RX_*_F) */
275         uint64_t rx_offloads;
276         uint16_t tx_offload_flags; /* Selected Tx offload flags(NIX_TX_*_F) */
277         uint64_t tx_offloads;
278         uint64_t rx_offload_capa;
279         uint64_t tx_offload_capa;
280         struct otx2_qint qints_mem[RTE_MAX_QUEUES_PER_PORT];
281         struct otx2_qint cints_mem[RTE_MAX_QUEUES_PER_PORT];
282         uint16_t txschq[NIX_TXSCH_LVL_CNT];
283         uint16_t txschq_contig[NIX_TXSCH_LVL_CNT];
284         uint16_t txschq_index[NIX_TXSCH_LVL_CNT];
285         uint16_t txschq_contig_index[NIX_TXSCH_LVL_CNT];
286         /* Dis-contiguous queues */
287         uint16_t txschq_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
288         /* Contiguous queues */
289         uint16_t txschq_contig_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
290         uint16_t otx2_tm_root_lvl;
291         uint16_t tm_flags;
292         uint16_t tm_leaf_cnt;
293         struct otx2_nix_tm_node_list node_list;
294         struct otx2_nix_tm_shaper_profile_list shaper_profile_list;
295         struct otx2_rss_info rss_info;
296         struct otx2_fc_info fc_info;
297         uint32_t txmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
298         uint32_t rxmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
299         struct otx2_npc_flow_info npc_flow;
300         struct otx2_vlan_info vlan_info;
301         struct otx2_eth_qconf *tx_qconf;
302         struct otx2_eth_qconf *rx_qconf;
303         struct rte_eth_dev *eth_dev;
304         eth_rx_burst_t rx_pkt_burst_no_offload;
305         /* PTP counters */
306         bool ptp_en;
307         struct otx2_timesync_info tstamp;
308         struct rte_timecounter  systime_tc;
309         struct rte_timecounter  rx_tstamp_tc;
310         struct rte_timecounter  tx_tstamp_tc;
311         double clk_freq_mult;
312         uint64_t clk_delta;
313 } __rte_cache_aligned;
314
315 struct otx2_eth_txq {
316         uint64_t cmd[8];
317         int64_t fc_cache_pkts;
318         uint64_t *fc_mem;
319         void *lmt_addr;
320         rte_iova_t io_addr;
321         rte_iova_t fc_iova;
322         uint16_t sqes_per_sqb_log2;
323         int16_t nb_sqb_bufs_adj;
324         MARKER slow_path_start;
325         uint16_t nb_sqb_bufs;
326         uint16_t sq;
327         uint64_t offloads;
328         struct otx2_eth_dev *dev;
329         struct rte_mempool *sqb_pool;
330         struct otx2_eth_qconf qconf;
331 } __rte_cache_aligned;
332
333 struct otx2_eth_rxq {
334         uint64_t mbuf_initializer;
335         uint64_t data_off;
336         uintptr_t desc;
337         void *lookup_mem;
338         uintptr_t cq_door;
339         uint64_t wdata;
340         int64_t *cq_status;
341         uint32_t head;
342         uint32_t qmask;
343         uint32_t available;
344         uint16_t rq;
345         struct otx2_timesync_info *tstamp;
346         MARKER slow_path_start;
347         uint64_t aura;
348         uint64_t offloads;
349         uint32_t qlen;
350         struct rte_mempool *pool;
351         enum nix_q_size_e qsize;
352         struct rte_eth_dev *eth_dev;
353         struct otx2_eth_qconf qconf;
354         uint16_t cq_drop;
355 } __rte_cache_aligned;
356
357 static inline struct otx2_eth_dev *
358 otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)
359 {
360         return eth_dev->data->dev_private;
361 }
362
363 /* Ops */
364 int otx2_nix_info_get(struct rte_eth_dev *eth_dev,
365                       struct rte_eth_dev_info *dev_info);
366 int otx2_nix_dev_filter_ctrl(struct rte_eth_dev *eth_dev,
367                              enum rte_filter_type filter_type,
368                              enum rte_filter_op filter_op, void *arg);
369 int otx2_nix_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version,
370                             size_t fw_size);
371 int otx2_nix_get_module_info(struct rte_eth_dev *eth_dev,
372                              struct rte_eth_dev_module_info *modinfo);
373 int otx2_nix_get_module_eeprom(struct rte_eth_dev *eth_dev,
374                                struct rte_dev_eeprom_info *info);
375 int otx2_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool);
376 void otx2_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
377                            struct rte_eth_rxq_info *qinfo);
378 void otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
379                            struct rte_eth_txq_info *qinfo);
380 uint32_t otx2_nix_rx_queue_count(struct rte_eth_dev *eth_dev, uint16_t qidx);
381 int otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
382 int otx2_nix_rx_descriptor_done(void *rxq, uint16_t offset);
383 int otx2_nix_rx_descriptor_status(void *rx_queue, uint16_t offset);
384 int otx2_nix_tx_descriptor_status(void *tx_queue, uint16_t offset);
385
386 void otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en);
387 int otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
388 int otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev);
389 int otx2_nix_allmulticast_enable(struct rte_eth_dev *eth_dev);
390 int otx2_nix_allmulticast_disable(struct rte_eth_dev *eth_dev);
391 int otx2_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qidx);
392 int otx2_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx);
393 uint64_t otx2_nix_rxq_mbuf_setup(struct otx2_eth_dev *dev, uint16_t port_id);
394
395 /* MTU */
396 int otx2_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu);
397 int otx2_nix_recalc_mtu(struct rte_eth_dev *eth_dev);
398
399 /* Link */
400 void otx2_nix_toggle_flag_link_cfg(struct otx2_eth_dev *dev, bool set);
401 int otx2_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
402 void otx2_eth_dev_link_status_update(struct otx2_dev *dev,
403                                      struct cgx_link_user_info *link);
404 int otx2_nix_dev_set_link_up(struct rte_eth_dev *eth_dev);
405 int otx2_nix_dev_set_link_down(struct rte_eth_dev *eth_dev);
406
407 /* IRQ */
408 int otx2_nix_register_irqs(struct rte_eth_dev *eth_dev);
409 int oxt2_nix_register_queue_irqs(struct rte_eth_dev *eth_dev);
410 int oxt2_nix_register_cq_irqs(struct rte_eth_dev *eth_dev);
411 void otx2_nix_unregister_irqs(struct rte_eth_dev *eth_dev);
412 void oxt2_nix_unregister_queue_irqs(struct rte_eth_dev *eth_dev);
413 void oxt2_nix_unregister_cq_irqs(struct rte_eth_dev *eth_dev);
414
415 int otx2_nix_rx_queue_intr_enable(struct rte_eth_dev *eth_dev,
416                                   uint16_t rx_queue_id);
417 int otx2_nix_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
418                                    uint16_t rx_queue_id);
419
420 /* Debug */
421 int otx2_nix_reg_dump(struct otx2_eth_dev *dev, uint64_t *data);
422 int otx2_nix_dev_get_reg(struct rte_eth_dev *eth_dev,
423                          struct rte_dev_reg_info *regs);
424 int otx2_nix_queues_ctx_dump(struct rte_eth_dev *eth_dev);
425 void otx2_nix_cqe_dump(const struct nix_cqe_hdr_s *cq);
426
427 /* Stats */
428 int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
429                            struct rte_eth_stats *stats);
430 int otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
431
432 int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
433                                  uint16_t queue_id, uint8_t stat_idx,
434                                  uint8_t is_rx);
435 int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
436                         struct rte_eth_xstat *xstats, unsigned int n);
437 int otx2_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
438                               struct rte_eth_xstat_name *xstats_names,
439                               unsigned int limit);
440 int otx2_nix_xstats_reset(struct rte_eth_dev *eth_dev);
441
442 int otx2_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev,
443                               const uint64_t *ids,
444                               uint64_t *values, unsigned int n);
445 int otx2_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
446                                     struct rte_eth_xstat_name *xstats_names,
447                                     const uint64_t *ids, unsigned int limit);
448
449 /* RSS */
450 void otx2_nix_rss_set_key(struct otx2_eth_dev *dev,
451                           uint8_t *key, uint32_t key_len);
452 uint32_t otx2_rss_ethdev_to_nix(struct otx2_eth_dev *dev,
453                                 uint64_t ethdev_rss, uint8_t rss_level);
454 int otx2_rss_set_hf(struct otx2_eth_dev *dev,
455                     uint32_t flowkey_cfg, uint8_t *alg_idx,
456                     uint8_t group, int mcam_index);
457 int otx2_nix_rss_tbl_init(struct otx2_eth_dev *dev, uint8_t group,
458                           uint16_t *ind_tbl);
459 int otx2_nix_rss_config(struct rte_eth_dev *eth_dev);
460
461 int otx2_nix_dev_reta_update(struct rte_eth_dev *eth_dev,
462                              struct rte_eth_rss_reta_entry64 *reta_conf,
463                              uint16_t reta_size);
464 int otx2_nix_dev_reta_query(struct rte_eth_dev *eth_dev,
465                             struct rte_eth_rss_reta_entry64 *reta_conf,
466                             uint16_t reta_size);
467 int otx2_nix_rss_hash_update(struct rte_eth_dev *eth_dev,
468                              struct rte_eth_rss_conf *rss_conf);
469
470 int otx2_nix_rss_hash_conf_get(struct rte_eth_dev *eth_dev,
471                                struct rte_eth_rss_conf *rss_conf);
472
473 /* CGX */
474 int otx2_cgx_rxtx_start(struct otx2_eth_dev *dev);
475 int otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev);
476 int otx2_cgx_mac_addr_set(struct rte_eth_dev *eth_dev,
477                           struct rte_ether_addr *addr);
478
479 /* Flow Control */
480 int otx2_nix_flow_ctrl_get(struct rte_eth_dev *eth_dev,
481                            struct rte_eth_fc_conf *fc_conf);
482
483 int otx2_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,
484                            struct rte_eth_fc_conf *fc_conf);
485
486 int otx2_nix_rxchan_bpid_cfg(struct rte_eth_dev *eth_dev, bool enb);
487
488 int otx2_nix_update_flow_ctrl_mode(struct rte_eth_dev *eth_dev);
489
490 /* VLAN */
491 int otx2_nix_vlan_offload_init(struct rte_eth_dev *eth_dev);
492 int otx2_nix_vlan_fini(struct rte_eth_dev *eth_dev);
493 int otx2_nix_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask);
494 void otx2_nix_vlan_update_promisc(struct rte_eth_dev *eth_dev, int enable);
495 int otx2_nix_vlan_filter_set(struct rte_eth_dev *eth_dev, uint16_t vlan_id,
496                              int on);
497 void otx2_nix_vlan_strip_queue_set(struct rte_eth_dev *dev,
498                                    uint16_t queue, int on);
499 int otx2_nix_vlan_tpid_set(struct rte_eth_dev *eth_dev,
500                            enum rte_vlan_type type, uint16_t tpid);
501 int otx2_nix_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on);
502
503 /* Lookup configuration */
504 void *otx2_nix_fastpath_lookup_mem_get(void);
505
506 /* PTYPES */
507 const uint32_t *otx2_nix_supported_ptypes_get(struct rte_eth_dev *dev);
508
509 /* Mac address handling */
510 int otx2_nix_mac_addr_set(struct rte_eth_dev *eth_dev,
511                           struct rte_ether_addr *addr);
512 int otx2_nix_mac_addr_get(struct rte_eth_dev *eth_dev, uint8_t *addr);
513 int otx2_nix_mac_addr_add(struct rte_eth_dev *eth_dev,
514                           struct rte_ether_addr *addr,
515                           uint32_t index, uint32_t pool);
516 void otx2_nix_mac_addr_del(struct rte_eth_dev *eth_dev, uint32_t index);
517 int otx2_cgx_mac_max_entries_get(struct otx2_eth_dev *dev);
518
519 /* Devargs */
520 int otx2_ethdev_parse_devargs(struct rte_devargs *devargs,
521                               struct otx2_eth_dev *dev);
522
523 /* Rx and Tx routines */
524 void otx2_eth_set_rx_function(struct rte_eth_dev *eth_dev);
525 void otx2_eth_set_tx_function(struct rte_eth_dev *eth_dev);
526 void otx2_nix_form_default_desc(struct otx2_eth_txq *txq);
527
528 /* Timesync - PTP routines */
529 int otx2_nix_timesync_enable(struct rte_eth_dev *eth_dev);
530 int otx2_nix_timesync_disable(struct rte_eth_dev *eth_dev);
531 int otx2_nix_timesync_read_rx_timestamp(struct rte_eth_dev *eth_dev,
532                                         struct timespec *timestamp,
533                                         uint32_t flags);
534 int otx2_nix_timesync_read_tx_timestamp(struct rte_eth_dev *eth_dev,
535                                         struct timespec *timestamp);
536 int otx2_nix_timesync_adjust_time(struct rte_eth_dev *eth_dev, int64_t delta);
537 int otx2_nix_timesync_write_time(struct rte_eth_dev *eth_dev,
538                                  const struct timespec *ts);
539 int otx2_nix_timesync_read_time(struct rte_eth_dev *eth_dev,
540                                 struct timespec *ts);
541 int otx2_eth_dev_ptp_info_update(struct otx2_dev *dev, bool ptp_en);
542 int otx2_nix_read_clock(struct rte_eth_dev *eth_dev, uint64_t *time);
543 int otx2_nix_raw_clock_tsc_conv(struct otx2_eth_dev *dev);
544
545 #endif /* __OTX2_ETHDEV_H__ */