net/octeontx2: fix device configuration sequence
[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            70
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_L3_L4_SRC_DST  (ETH_RSS_L3_SRC_ONLY | ETH_RSS_L3_DST_ONLY \
117                                 | ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)
118
119 #define NIX_RSS_OFFLOAD         (ETH_RSS_PORT | ETH_RSS_IP | ETH_RSS_UDP |\
120                                  ETH_RSS_TCP | ETH_RSS_SCTP | \
121                                  ETH_RSS_TUNNEL | ETH_RSS_L2_PAYLOAD | \
122                                  NIX_RSS_L3_L4_SRC_DST)
123
124 #define NIX_TX_OFFLOAD_CAPA ( \
125         DEV_TX_OFFLOAD_MBUF_FAST_FREE   | \
126         DEV_TX_OFFLOAD_MT_LOCKFREE      | \
127         DEV_TX_OFFLOAD_VLAN_INSERT      | \
128         DEV_TX_OFFLOAD_QINQ_INSERT      | \
129         DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | \
130         DEV_TX_OFFLOAD_OUTER_UDP_CKSUM  | \
131         DEV_TX_OFFLOAD_TCP_CKSUM        | \
132         DEV_TX_OFFLOAD_UDP_CKSUM        | \
133         DEV_TX_OFFLOAD_SCTP_CKSUM       | \
134         DEV_TX_OFFLOAD_TCP_TSO          | \
135         DEV_TX_OFFLOAD_VXLAN_TNL_TSO    | \
136         DEV_TX_OFFLOAD_GENEVE_TNL_TSO   | \
137         DEV_TX_OFFLOAD_GRE_TNL_TSO      | \
138         DEV_TX_OFFLOAD_MULTI_SEGS       | \
139         DEV_TX_OFFLOAD_IPV4_CKSUM)
140
141 #define NIX_RX_OFFLOAD_CAPA ( \
142         DEV_RX_OFFLOAD_CHECKSUM         | \
143         DEV_RX_OFFLOAD_SCTP_CKSUM       | \
144         DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | \
145         DEV_RX_OFFLOAD_SCATTER          | \
146         DEV_RX_OFFLOAD_JUMBO_FRAME      | \
147         DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  | \
148         DEV_RX_OFFLOAD_VLAN_STRIP       | \
149         DEV_RX_OFFLOAD_VLAN_FILTER      | \
150         DEV_RX_OFFLOAD_QINQ_STRIP       | \
151         DEV_RX_OFFLOAD_TIMESTAMP        | \
152         DEV_RX_OFFLOAD_RSS_HASH)
153
154 #define NIX_DEFAULT_RSS_CTX_GROUP  0
155 #define NIX_DEFAULT_RSS_MCAM_IDX  -1
156
157 #define otx2_ethdev_is_ptp_en(dev)      ((dev)->ptp_en)
158
159 #define NIX_TIMESYNC_TX_CMD_LEN         8
160 /* Additional timesync values. */
161 #define OTX2_CYCLECOUNTER_MASK   0xffffffffffffffffULL
162
163 enum nix_q_size_e {
164         nix_q_size_16,  /* 16 entries */
165         nix_q_size_64,  /* 64 entries */
166         nix_q_size_256,
167         nix_q_size_1K,
168         nix_q_size_4K,
169         nix_q_size_16K,
170         nix_q_size_64K,
171         nix_q_size_256K,
172         nix_q_size_1M,  /* Million entries */
173         nix_q_size_max
174 };
175
176 struct otx2_qint {
177         struct rte_eth_dev *eth_dev;
178         uint8_t qintx;
179 };
180
181 struct otx2_rss_info {
182         uint64_t nix_rss;
183         uint32_t flowkey_cfg;
184         uint16_t rss_size;
185         uint8_t rss_grps;
186         uint8_t alg_idx; /* Selected algo index */
187         uint16_t ind_tbl[NIX_RSS_RETA_SIZE_MAX];
188         uint8_t key[NIX_HASH_KEY_SIZE];
189 };
190
191 struct otx2_eth_qconf {
192         union {
193                 struct rte_eth_txconf tx;
194                 struct rte_eth_rxconf rx;
195         } conf;
196         void *mempool;
197         uint32_t socket_id;
198         uint16_t nb_desc;
199         uint8_t valid;
200 };
201
202 struct otx2_fc_info {
203         enum rte_eth_fc_mode mode;  /**< Link flow control mode */
204         uint8_t rx_pause;
205         uint8_t tx_pause;
206         uint8_t chan_cnt;
207         uint16_t bpid[NIX_MAX_CHAN];
208 };
209
210 struct vlan_mkex_info {
211         struct npc_xtract_info la_xtract;
212         struct npc_xtract_info lb_xtract;
213         uint64_t lb_lt_offset;
214 };
215
216 struct mcast_entry {
217         struct rte_ether_addr mcast_mac;
218         uint16_t mcam_index;
219         TAILQ_ENTRY(mcast_entry) next;
220 };
221
222 TAILQ_HEAD(otx2_nix_mc_filter_tbl, mcast_entry);
223
224 struct vlan_entry {
225         uint32_t mcam_idx;
226         uint16_t vlan_id;
227         TAILQ_ENTRY(vlan_entry) next;
228 };
229
230 TAILQ_HEAD(otx2_vlan_filter_tbl, vlan_entry);
231
232 struct otx2_vlan_info {
233         struct otx2_vlan_filter_tbl fltr_tbl;
234         /* MKEX layer info */
235         struct mcam_entry def_tx_mcam_ent;
236         struct mcam_entry def_rx_mcam_ent;
237         struct vlan_mkex_info mkex;
238         /* Default mcam entry that matches vlan packets */
239         uint32_t def_rx_mcam_idx;
240         uint32_t def_tx_mcam_idx;
241         /* MCAM entry that matches double vlan packets */
242         uint32_t qinq_mcam_idx;
243         /* Indices of tx_vtag def registers */
244         uint32_t outer_vlan_idx;
245         uint32_t inner_vlan_idx;
246         uint16_t outer_vlan_tpid;
247         uint16_t inner_vlan_tpid;
248         uint16_t pvid;
249         /* QinQ entry allocated before default one */
250         uint8_t qinq_before_def;
251         uint8_t pvid_insert_on;
252         /* Rx vtag action type */
253         uint8_t vtag_type_idx;
254         uint8_t filter_on;
255         uint8_t strip_on;
256         uint8_t qinq_on;
257         uint8_t promisc_on;
258 };
259
260 struct otx2_eth_dev {
261         OTX2_DEV; /* Base class */
262         RTE_MARKER otx2_eth_dev_data_start;
263         uint16_t sqb_size;
264         uint16_t rx_chan_base;
265         uint16_t tx_chan_base;
266         uint8_t rx_chan_cnt;
267         uint8_t tx_chan_cnt;
268         uint8_t lso_tsov4_idx;
269         uint8_t lso_tsov6_idx;
270         uint8_t lso_base_idx;
271         uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
272         uint8_t mkex_pfl_name[MKEX_NAME_LEN];
273         uint8_t max_mac_entries;
274         uint8_t lf_tx_stats;
275         uint8_t lf_rx_stats;
276         uint16_t flags;
277         uint16_t cints;
278         uint16_t qints;
279         uint8_t configured;
280         uint8_t configured_qints;
281         uint8_t configured_cints;
282         uint8_t configured_nb_rx_qs;
283         uint8_t configured_nb_tx_qs;
284         uint8_t ptype_disable;
285         uint16_t nix_msixoff;
286         uintptr_t base;
287         uintptr_t lmt_addr;
288         uint16_t scalar_ena;
289         uint16_t rss_tag_as_xor;
290         uint16_t max_sqb_count;
291         uint16_t rx_offload_flags; /* Selected Rx offload flags(NIX_RX_*_F) */
292         uint64_t rx_offloads;
293         uint16_t tx_offload_flags; /* Selected Tx offload flags(NIX_TX_*_F) */
294         uint64_t tx_offloads;
295         uint64_t rx_offload_capa;
296         uint64_t tx_offload_capa;
297         struct otx2_qint qints_mem[RTE_MAX_QUEUES_PER_PORT];
298         struct otx2_qint cints_mem[RTE_MAX_QUEUES_PER_PORT];
299         uint16_t txschq[NIX_TXSCH_LVL_CNT];
300         uint16_t txschq_contig[NIX_TXSCH_LVL_CNT];
301         uint16_t txschq_index[NIX_TXSCH_LVL_CNT];
302         uint16_t txschq_contig_index[NIX_TXSCH_LVL_CNT];
303         /* Dis-contiguous queues */
304         uint16_t txschq_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
305         /* Contiguous queues */
306         uint16_t txschq_contig_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
307         uint16_t otx2_tm_root_lvl;
308         uint16_t link_cfg_lvl;
309         uint16_t tm_flags;
310         uint16_t tm_leaf_cnt;
311         uint64_t tm_rate_min;
312         struct otx2_nix_tm_node_list node_list;
313         struct otx2_nix_tm_shaper_profile_list shaper_profile_list;
314         struct otx2_rss_info rss_info;
315         struct otx2_fc_info fc_info;
316         uint32_t txmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
317         uint32_t rxmap[RTE_ETHDEV_QUEUE_STAT_CNTRS];
318         struct otx2_npc_flow_info npc_flow;
319         struct otx2_vlan_info vlan_info;
320         struct otx2_eth_qconf *tx_qconf;
321         struct otx2_eth_qconf *rx_qconf;
322         struct rte_eth_dev *eth_dev;
323         eth_rx_burst_t rx_pkt_burst_no_offload;
324         /* PTP counters */
325         bool ptp_en;
326         struct otx2_timesync_info tstamp;
327         struct rte_timecounter  systime_tc;
328         struct rte_timecounter  rx_tstamp_tc;
329         struct rte_timecounter  tx_tstamp_tc;
330         double clk_freq_mult;
331         uint64_t clk_delta;
332         bool mc_tbl_set;
333         struct otx2_nix_mc_filter_tbl mc_fltr_tbl;
334         bool sdp_link; /* SDP flag */
335         /* Inline IPsec params */
336         uint16_t ipsec_in_max_spi;
337         uint8_t duplex;
338         uint32_t speed;
339 } __rte_cache_aligned;
340
341 struct otx2_eth_txq {
342         uint64_t cmd[8];
343         int64_t fc_cache_pkts;
344         uint64_t *fc_mem;
345         void *lmt_addr;
346         rte_iova_t io_addr;
347         rte_iova_t fc_iova;
348         uint16_t sqes_per_sqb_log2;
349         int16_t nb_sqb_bufs_adj;
350         RTE_MARKER slow_path_start;
351         uint16_t nb_sqb_bufs;
352         uint16_t sq;
353         uint64_t offloads;
354         struct otx2_eth_dev *dev;
355         struct rte_mempool *sqb_pool;
356         struct otx2_eth_qconf qconf;
357 } __rte_cache_aligned;
358
359 struct otx2_eth_rxq {
360         uint64_t mbuf_initializer;
361         uint64_t data_off;
362         uintptr_t desc;
363         void *lookup_mem;
364         uintptr_t cq_door;
365         uint64_t wdata;
366         int64_t *cq_status;
367         uint32_t head;
368         uint32_t qmask;
369         uint32_t available;
370         uint16_t rq;
371         struct otx2_timesync_info *tstamp;
372         RTE_MARKER slow_path_start;
373         uint64_t aura;
374         uint64_t offloads;
375         uint32_t qlen;
376         struct rte_mempool *pool;
377         enum nix_q_size_e qsize;
378         struct rte_eth_dev *eth_dev;
379         struct otx2_eth_qconf qconf;
380         uint16_t cq_drop;
381 } __rte_cache_aligned;
382
383 static inline struct otx2_eth_dev *
384 otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev)
385 {
386         return eth_dev->data->dev_private;
387 }
388
389 /* Ops */
390 int otx2_nix_info_get(struct rte_eth_dev *eth_dev,
391                       struct rte_eth_dev_info *dev_info);
392 int otx2_nix_dev_filter_ctrl(struct rte_eth_dev *eth_dev,
393                              enum rte_filter_type filter_type,
394                              enum rte_filter_op filter_op, void *arg);
395 int otx2_nix_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version,
396                             size_t fw_size);
397 int otx2_nix_get_module_info(struct rte_eth_dev *eth_dev,
398                              struct rte_eth_dev_module_info *modinfo);
399 int otx2_nix_get_module_eeprom(struct rte_eth_dev *eth_dev,
400                                struct rte_dev_eeprom_info *info);
401 int otx2_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool);
402 void otx2_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
403                            struct rte_eth_rxq_info *qinfo);
404 void otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
405                            struct rte_eth_txq_info *qinfo);
406 int otx2_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
407                            struct rte_eth_burst_mode *mode);
408 int otx2_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
409                            struct rte_eth_burst_mode *mode);
410 uint32_t otx2_nix_rx_queue_count(struct rte_eth_dev *eth_dev, uint16_t qidx);
411 int otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
412 int otx2_nix_rx_descriptor_done(void *rxq, uint16_t offset);
413 int otx2_nix_rx_descriptor_status(void *rx_queue, uint16_t offset);
414 int otx2_nix_tx_descriptor_status(void *tx_queue, uint16_t offset);
415
416 void otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en);
417 int otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
418 int otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev);
419 int otx2_nix_allmulticast_enable(struct rte_eth_dev *eth_dev);
420 int otx2_nix_allmulticast_disable(struct rte_eth_dev *eth_dev);
421 int otx2_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qidx);
422 int otx2_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx);
423 uint64_t otx2_nix_rxq_mbuf_setup(struct otx2_eth_dev *dev, uint16_t port_id);
424
425 /* Multicast filter APIs */
426 void otx2_nix_mc_filter_init(struct otx2_eth_dev *dev);
427 void otx2_nix_mc_filter_fini(struct otx2_eth_dev *dev);
428 int otx2_nix_mc_addr_list_install(struct rte_eth_dev *eth_dev);
429 int otx2_nix_mc_addr_list_uninstall(struct rte_eth_dev *eth_dev);
430 int otx2_nix_set_mc_addr_list(struct rte_eth_dev *eth_dev,
431                               struct rte_ether_addr *mc_addr_set,
432                               uint32_t nb_mc_addr);
433
434 /* MTU */
435 int otx2_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu);
436 int otx2_nix_recalc_mtu(struct rte_eth_dev *eth_dev);
437
438 /* Link */
439 void otx2_nix_toggle_flag_link_cfg(struct otx2_eth_dev *dev, bool set);
440 int otx2_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
441 void otx2_eth_dev_link_status_update(struct otx2_dev *dev,
442                                      struct cgx_link_user_info *link);
443 int otx2_nix_dev_set_link_up(struct rte_eth_dev *eth_dev);
444 int otx2_nix_dev_set_link_down(struct rte_eth_dev *eth_dev);
445 int otx2_apply_link_speed(struct rte_eth_dev *eth_dev);
446
447 /* IRQ */
448 int otx2_nix_register_irqs(struct rte_eth_dev *eth_dev);
449 int oxt2_nix_register_queue_irqs(struct rte_eth_dev *eth_dev);
450 int oxt2_nix_register_cq_irqs(struct rte_eth_dev *eth_dev);
451 void otx2_nix_unregister_irqs(struct rte_eth_dev *eth_dev);
452 void oxt2_nix_unregister_queue_irqs(struct rte_eth_dev *eth_dev);
453 void oxt2_nix_unregister_cq_irqs(struct rte_eth_dev *eth_dev);
454 void otx2_nix_err_intr_enb_dis(struct rte_eth_dev *eth_dev, bool enb);
455 void otx2_nix_ras_intr_enb_dis(struct rte_eth_dev *eth_dev, bool enb);
456
457 int otx2_nix_rx_queue_intr_enable(struct rte_eth_dev *eth_dev,
458                                   uint16_t rx_queue_id);
459 int otx2_nix_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
460                                    uint16_t rx_queue_id);
461
462 /* Debug */
463 int otx2_nix_reg_dump(struct otx2_eth_dev *dev, uint64_t *data);
464 int otx2_nix_dev_get_reg(struct rte_eth_dev *eth_dev,
465                          struct rte_dev_reg_info *regs);
466 int otx2_nix_queues_ctx_dump(struct rte_eth_dev *eth_dev);
467 void otx2_nix_cqe_dump(const struct nix_cqe_hdr_s *cq);
468 void otx2_nix_tm_dump(struct otx2_eth_dev *dev);
469
470 /* Stats */
471 int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
472                            struct rte_eth_stats *stats);
473 int otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
474
475 int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
476                                  uint16_t queue_id, uint8_t stat_idx,
477                                  uint8_t is_rx);
478 int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
479                         struct rte_eth_xstat *xstats, unsigned int n);
480 int otx2_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
481                               struct rte_eth_xstat_name *xstats_names,
482                               unsigned int limit);
483 int otx2_nix_xstats_reset(struct rte_eth_dev *eth_dev);
484
485 int otx2_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev,
486                               const uint64_t *ids,
487                               uint64_t *values, unsigned int n);
488 int otx2_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
489                                     struct rte_eth_xstat_name *xstats_names,
490                                     const uint64_t *ids, unsigned int limit);
491
492 /* RSS */
493 void otx2_nix_rss_set_key(struct otx2_eth_dev *dev,
494                           uint8_t *key, uint32_t key_len);
495 uint32_t otx2_rss_ethdev_to_nix(struct otx2_eth_dev *dev,
496                                 uint64_t ethdev_rss, uint8_t rss_level);
497 int otx2_rss_set_hf(struct otx2_eth_dev *dev,
498                     uint32_t flowkey_cfg, uint8_t *alg_idx,
499                     uint8_t group, int mcam_index);
500 int otx2_nix_rss_tbl_init(struct otx2_eth_dev *dev, uint8_t group,
501                           uint16_t *ind_tbl);
502 int otx2_nix_rss_config(struct rte_eth_dev *eth_dev);
503
504 int otx2_nix_dev_reta_update(struct rte_eth_dev *eth_dev,
505                              struct rte_eth_rss_reta_entry64 *reta_conf,
506                              uint16_t reta_size);
507 int otx2_nix_dev_reta_query(struct rte_eth_dev *eth_dev,
508                             struct rte_eth_rss_reta_entry64 *reta_conf,
509                             uint16_t reta_size);
510 int otx2_nix_rss_hash_update(struct rte_eth_dev *eth_dev,
511                              struct rte_eth_rss_conf *rss_conf);
512
513 int otx2_nix_rss_hash_conf_get(struct rte_eth_dev *eth_dev,
514                                struct rte_eth_rss_conf *rss_conf);
515
516 /* CGX */
517 int otx2_cgx_rxtx_start(struct otx2_eth_dev *dev);
518 int otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev);
519 int otx2_cgx_mac_addr_set(struct rte_eth_dev *eth_dev,
520                           struct rte_ether_addr *addr);
521
522 /* Flow Control */
523 int otx2_nix_flow_ctrl_init(struct rte_eth_dev *eth_dev);
524
525 int otx2_nix_flow_ctrl_get(struct rte_eth_dev *eth_dev,
526                            struct rte_eth_fc_conf *fc_conf);
527
528 int otx2_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,
529                            struct rte_eth_fc_conf *fc_conf);
530
531 int otx2_nix_rxchan_bpid_cfg(struct rte_eth_dev *eth_dev, bool enb);
532
533 int otx2_nix_update_flow_ctrl_mode(struct rte_eth_dev *eth_dev);
534
535 /* VLAN */
536 int otx2_nix_vlan_offload_init(struct rte_eth_dev *eth_dev);
537 int otx2_nix_vlan_fini(struct rte_eth_dev *eth_dev);
538 int otx2_nix_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask);
539 void otx2_nix_vlan_update_promisc(struct rte_eth_dev *eth_dev, int enable);
540 int otx2_nix_vlan_filter_set(struct rte_eth_dev *eth_dev, uint16_t vlan_id,
541                              int on);
542 void otx2_nix_vlan_strip_queue_set(struct rte_eth_dev *dev,
543                                    uint16_t queue, int on);
544 int otx2_nix_vlan_tpid_set(struct rte_eth_dev *eth_dev,
545                            enum rte_vlan_type type, uint16_t tpid);
546 int otx2_nix_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on);
547
548 /* Lookup configuration */
549 void *otx2_nix_fastpath_lookup_mem_get(void);
550
551 /* PTYPES */
552 const uint32_t *otx2_nix_supported_ptypes_get(struct rte_eth_dev *dev);
553 int otx2_nix_ptypes_set(struct rte_eth_dev *eth_dev, uint32_t ptype_mask);
554
555 /* Mac address handling */
556 int otx2_nix_mac_addr_set(struct rte_eth_dev *eth_dev,
557                           struct rte_ether_addr *addr);
558 int otx2_nix_mac_addr_get(struct rte_eth_dev *eth_dev, uint8_t *addr);
559 int otx2_nix_mac_addr_add(struct rte_eth_dev *eth_dev,
560                           struct rte_ether_addr *addr,
561                           uint32_t index, uint32_t pool);
562 void otx2_nix_mac_addr_del(struct rte_eth_dev *eth_dev, uint32_t index);
563 int otx2_cgx_mac_max_entries_get(struct otx2_eth_dev *dev);
564
565 /* Devargs */
566 int otx2_ethdev_parse_devargs(struct rte_devargs *devargs,
567                               struct otx2_eth_dev *dev);
568
569 /* Rx and Tx routines */
570 void otx2_eth_set_rx_function(struct rte_eth_dev *eth_dev);
571 void otx2_eth_set_tx_function(struct rte_eth_dev *eth_dev);
572 void otx2_nix_form_default_desc(struct otx2_eth_txq *txq);
573
574 /* Timesync - PTP routines */
575 int otx2_nix_timesync_enable(struct rte_eth_dev *eth_dev);
576 int otx2_nix_timesync_disable(struct rte_eth_dev *eth_dev);
577 int otx2_nix_timesync_read_rx_timestamp(struct rte_eth_dev *eth_dev,
578                                         struct timespec *timestamp,
579                                         uint32_t flags);
580 int otx2_nix_timesync_read_tx_timestamp(struct rte_eth_dev *eth_dev,
581                                         struct timespec *timestamp);
582 int otx2_nix_timesync_adjust_time(struct rte_eth_dev *eth_dev, int64_t delta);
583 int otx2_nix_timesync_write_time(struct rte_eth_dev *eth_dev,
584                                  const struct timespec *ts);
585 int otx2_nix_timesync_read_time(struct rte_eth_dev *eth_dev,
586                                 struct timespec *ts);
587 int otx2_eth_dev_ptp_info_update(struct otx2_dev *dev, bool ptp_en);
588 int otx2_nix_read_clock(struct rte_eth_dev *eth_dev, uint64_t *time);
589 int otx2_nix_raw_clock_tsc_conv(struct otx2_eth_dev *dev);
590 void otx2_nix_ptp_enable_vf(struct rte_eth_dev *eth_dev);
591
592 #endif /* __OTX2_ETHDEV_H__ */