net/cnxk: unify file names
[dpdk.git] / drivers / net / cnxk / cn10k_ethdev.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4 #include "cn10k_ethdev.h"
5 #include "cn10k_flow.h"
6 #include "cn10k_rx.h"
7 #include "cn10k_tx.h"
8
9 static uint16_t
10 nix_rx_offload_flags(struct rte_eth_dev *eth_dev)
11 {
12         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
13         struct rte_eth_dev_data *data = eth_dev->data;
14         struct rte_eth_conf *conf = &data->dev_conf;
15         struct rte_eth_rxmode *rxmode = &conf->rxmode;
16         uint16_t flags = 0;
17
18         if (rxmode->mq_mode == RTE_ETH_MQ_RX_RSS &&
19             (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_RSS_HASH))
20                 flags |= NIX_RX_OFFLOAD_RSS_F;
21
22         if (dev->rx_offloads &
23             (RTE_ETH_RX_OFFLOAD_TCP_CKSUM | RTE_ETH_RX_OFFLOAD_UDP_CKSUM))
24                 flags |= NIX_RX_OFFLOAD_CHECKSUM_F;
25
26         if (dev->rx_offloads &
27             (RTE_ETH_RX_OFFLOAD_IPV4_CKSUM | RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM))
28                 flags |= NIX_RX_OFFLOAD_CHECKSUM_F;
29
30         if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER)
31                 flags |= NIX_RX_MULTI_SEG_F;
32
33         if ((dev->rx_offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP))
34                 flags |= NIX_RX_OFFLOAD_TSTAMP_F;
35
36         if (!dev->ptype_disable)
37                 flags |= NIX_RX_OFFLOAD_PTYPE_F;
38
39         if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY)
40                 flags |= NIX_RX_OFFLOAD_SECURITY_F;
41
42         return flags;
43 }
44
45 static uint16_t
46 nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
47 {
48         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
49         uint64_t conf = dev->tx_offloads;
50         uint16_t flags = 0;
51
52         /* Fastpath is dependent on these enums */
53         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_TCP_CKSUM != (1ULL << 52));
54         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_SCTP_CKSUM != (2ULL << 52));
55         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_UDP_CKSUM != (3ULL << 52));
56         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_IP_CKSUM != (1ULL << 54));
57         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_IPV4 != (1ULL << 55));
58         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_OUTER_IP_CKSUM != (1ULL << 58));
59         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_OUTER_IPV4 != (1ULL << 59));
60         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_OUTER_IPV6 != (1ULL << 60));
61         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_OUTER_UDP_CKSUM != (1ULL << 41));
62         RTE_BUILD_BUG_ON(RTE_MBUF_L2_LEN_BITS != 7);
63         RTE_BUILD_BUG_ON(RTE_MBUF_L3_LEN_BITS != 9);
64         RTE_BUILD_BUG_ON(RTE_MBUF_OUTL2_LEN_BITS != 7);
65         RTE_BUILD_BUG_ON(RTE_MBUF_OUTL3_LEN_BITS != 9);
66         RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) !=
67                          offsetof(struct rte_mbuf, buf_iova) + 8);
68         RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
69                          offsetof(struct rte_mbuf, buf_iova) + 16);
70         RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
71                          offsetof(struct rte_mbuf, ol_flags) + 12);
72         RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, tx_offload) !=
73                          offsetof(struct rte_mbuf, pool) + 2 * sizeof(void *));
74
75         if (conf & RTE_ETH_TX_OFFLOAD_VLAN_INSERT ||
76             conf & RTE_ETH_TX_OFFLOAD_QINQ_INSERT)
77                 flags |= NIX_TX_OFFLOAD_VLAN_QINQ_F;
78
79         if (conf & RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM ||
80             conf & RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM)
81                 flags |= NIX_TX_OFFLOAD_OL3_OL4_CSUM_F;
82
83         if (conf & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ||
84             conf & RTE_ETH_TX_OFFLOAD_TCP_CKSUM ||
85             conf & RTE_ETH_TX_OFFLOAD_UDP_CKSUM || conf & RTE_ETH_TX_OFFLOAD_SCTP_CKSUM)
86                 flags |= NIX_TX_OFFLOAD_L3_L4_CSUM_F;
87
88         if (!(conf & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE))
89                 flags |= NIX_TX_OFFLOAD_MBUF_NOFF_F;
90
91         if (conf & RTE_ETH_TX_OFFLOAD_MULTI_SEGS)
92                 flags |= NIX_TX_MULTI_SEG_F;
93
94         /* Enable Inner checksum for TSO */
95         if (conf & RTE_ETH_TX_OFFLOAD_TCP_TSO)
96                 flags |= (NIX_TX_OFFLOAD_TSO_F | NIX_TX_OFFLOAD_L3_L4_CSUM_F);
97
98         /* Enable Inner and Outer checksum for Tunnel TSO */
99         if (conf & (RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |
100                     RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO))
101                 flags |= (NIX_TX_OFFLOAD_TSO_F | NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |
102                           NIX_TX_OFFLOAD_L3_L4_CSUM_F);
103
104         if ((dev->rx_offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP))
105                 flags |= NIX_TX_OFFLOAD_TSTAMP_F;
106
107         if (conf & RTE_ETH_TX_OFFLOAD_SECURITY)
108                 flags |= NIX_TX_OFFLOAD_SECURITY_F;
109
110         return flags;
111 }
112
113 static int
114 cn10k_nix_ptypes_set(struct rte_eth_dev *eth_dev, uint32_t ptype_mask)
115 {
116         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
117
118         if (ptype_mask) {
119                 dev->rx_offload_flags |= NIX_RX_OFFLOAD_PTYPE_F;
120                 dev->ptype_disable = 0;
121         } else {
122                 dev->rx_offload_flags &= ~NIX_RX_OFFLOAD_PTYPE_F;
123                 dev->ptype_disable = 1;
124         }
125
126         cn10k_eth_set_rx_function(eth_dev);
127         return 0;
128 }
129
130 static void
131 nix_form_default_desc(struct cnxk_eth_dev *dev, struct cn10k_eth_txq *txq,
132                       uint16_t qid)
133 {
134         union nix_send_hdr_w0_u send_hdr_w0;
135
136         /* Initialize the fields based on basic single segment packet */
137         send_hdr_w0.u = 0;
138         if (dev->tx_offload_flags & NIX_TX_NEED_EXT_HDR) {
139                 /* 2(HDR) + 2(EXT_HDR) + 1(SG) + 1(IOVA) = 6/2 - 1 = 2 */
140                 send_hdr_w0.sizem1 = 2;
141                 if (dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F) {
142                         /* Default: one seg packet would have:
143                          * 2(HDR) + 2(EXT) + 1(SG) + 1(IOVA) + 2(MEM)
144                          * => 8/2 - 1 = 3
145                          */
146                         send_hdr_w0.sizem1 = 3;
147
148                         /* To calculate the offset for send_mem,
149                          * send_hdr->w0.sizem1 * 2
150                          */
151                         txq->ts_mem = dev->tstamp.tx_tstamp_iova;
152                 }
153         } else {
154                 /* 2(HDR) + 1(SG) + 1(IOVA) = 4/2 - 1 = 1 */
155                 send_hdr_w0.sizem1 = 1;
156         }
157         send_hdr_w0.sq = qid;
158         txq->send_hdr_w0 = send_hdr_w0.u;
159         rte_wmb();
160 }
161
162 static int
163 cn10k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
164                          uint16_t nb_desc, unsigned int socket,
165                          const struct rte_eth_txconf *tx_conf)
166 {
167         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
168         struct roc_nix *nix = &dev->nix;
169         struct roc_cpt_lf *inl_lf;
170         struct cn10k_eth_txq *txq;
171         struct roc_nix_sq *sq;
172         uint16_t crypto_qid;
173         int rc;
174
175         RTE_SET_USED(socket);
176
177         /* Common Tx queue setup */
178         rc = cnxk_nix_tx_queue_setup(eth_dev, qid, nb_desc,
179                                      sizeof(struct cn10k_eth_txq), tx_conf);
180         if (rc)
181                 return rc;
182
183         sq = &dev->sqs[qid];
184         /* Update fast path queue */
185         txq = eth_dev->data->tx_queues[qid];
186         txq->fc_mem = sq->fc;
187         /* Store lmt base in tx queue for easy access */
188         txq->lmt_base = nix->lmt_base;
189         txq->io_addr = sq->io_addr;
190         txq->nb_sqb_bufs_adj = sq->nb_sqb_bufs_adj;
191         txq->sqes_per_sqb_log2 = sq->sqes_per_sqb_log2;
192
193         /* Fetch CPT LF info for outbound if present */
194         if (dev->outb.lf_base) {
195                 crypto_qid = qid % dev->outb.nb_crypto_qs;
196                 inl_lf = dev->outb.lf_base + crypto_qid;
197
198                 txq->cpt_io_addr = inl_lf->io_addr;
199                 txq->cpt_fc = inl_lf->fc_addr;
200                 txq->cpt_desc = inl_lf->nb_desc * 0.7;
201                 txq->sa_base = (uint64_t)dev->outb.sa_base;
202                 txq->sa_base |= eth_dev->data->port_id;
203                 PLT_STATIC_ASSERT(ROC_NIX_INL_SA_BASE_ALIGN == BIT_ULL(16));
204         }
205
206         nix_form_default_desc(dev, txq, qid);
207         txq->lso_tun_fmt = dev->lso_tun_fmt;
208         return 0;
209 }
210
211 static int
212 cn10k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
213                          uint16_t nb_desc, unsigned int socket,
214                          const struct rte_eth_rxconf *rx_conf,
215                          struct rte_mempool *mp)
216 {
217         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
218         struct cnxk_eth_rxq_sp *rxq_sp;
219         struct cn10k_eth_rxq *rxq;
220         struct roc_nix_rq *rq;
221         struct roc_nix_cq *cq;
222         int rc;
223
224         RTE_SET_USED(socket);
225
226         /* CQ Errata needs min 4K ring */
227         if (dev->cq_min_4k && nb_desc < 4096)
228                 nb_desc = 4096;
229
230         /* Common Rx queue setup */
231         rc = cnxk_nix_rx_queue_setup(eth_dev, qid, nb_desc,
232                                      sizeof(struct cn10k_eth_rxq), rx_conf, mp);
233         if (rc)
234                 return rc;
235
236         rq = &dev->rqs[qid];
237         cq = &dev->cqs[qid];
238
239         /* Update fast path queue */
240         rxq = eth_dev->data->rx_queues[qid];
241         rxq->rq = qid;
242         rxq->desc = (uintptr_t)cq->desc_base;
243         rxq->cq_door = cq->door;
244         rxq->cq_status = cq->status;
245         rxq->wdata = cq->wdata;
246         rxq->head = cq->head;
247         rxq->qmask = cq->qmask;
248         rxq->tstamp = &dev->tstamp;
249
250         /* Data offset from data to start of mbuf is first_skip */
251         rxq->data_off = rq->first_skip;
252         rxq->mbuf_initializer = cnxk_nix_rxq_mbuf_setup(dev);
253
254         /* Setup security related info */
255         if (dev->rx_offload_flags & NIX_RX_OFFLOAD_SECURITY_F) {
256                 rxq->lmt_base = dev->nix.lmt_base;
257                 rxq->sa_base = roc_nix_inl_inb_sa_base_get(&dev->nix,
258                                                            dev->inb.inl_dev);
259         }
260         rxq_sp = cnxk_eth_rxq_to_sp(rxq);
261         rxq->aura_handle = rxq_sp->qconf.mp->pool_id;
262
263         /* Lookup mem */
264         rxq->lookup_mem = cnxk_nix_fastpath_lookup_mem_get();
265         return 0;
266 }
267
268 static int
269 cn10k_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx)
270 {
271         struct cn10k_eth_txq *txq = eth_dev->data->tx_queues[qidx];
272         int rc;
273
274         rc = cnxk_nix_tx_queue_stop(eth_dev, qidx);
275         if (rc)
276                 return rc;
277
278         /* Clear fc cache pkts to trigger worker stop */
279         txq->fc_cache_pkts = 0;
280         return 0;
281 }
282
283 static int
284 cn10k_nix_configure(struct rte_eth_dev *eth_dev)
285 {
286         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
287         int rc;
288
289         /* Common nix configure */
290         rc = cnxk_nix_configure(eth_dev);
291         if (rc)
292                 return rc;
293
294         /* Update offload flags */
295         dev->rx_offload_flags = nix_rx_offload_flags(eth_dev);
296         dev->tx_offload_flags = nix_tx_offload_flags(eth_dev);
297
298         plt_nix_dbg("Configured port%d platform specific rx_offload_flags=%x"
299                     " tx_offload_flags=0x%x",
300                     eth_dev->data->port_id, dev->rx_offload_flags,
301                     dev->tx_offload_flags);
302         return 0;
303 }
304
305 /* Function to enable ptp config for VFs */
306 static void
307 nix_ptp_enable_vf(struct rte_eth_dev *eth_dev)
308 {
309         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
310
311         if (nix_recalc_mtu(eth_dev))
312                 plt_err("Failed to set MTU size for ptp");
313
314         dev->rx_offload_flags |= NIX_RX_OFFLOAD_TSTAMP_F;
315
316         /* Setting up the function pointers as per new offload flags */
317         cn10k_eth_set_rx_function(eth_dev);
318         cn10k_eth_set_tx_function(eth_dev);
319 }
320
321 static uint16_t
322 nix_ptp_vf_burst(void *queue, struct rte_mbuf **mbufs, uint16_t pkts)
323 {
324         struct cn10k_eth_rxq *rxq = queue;
325         struct cnxk_eth_rxq_sp *rxq_sp;
326         struct rte_eth_dev *eth_dev;
327
328         RTE_SET_USED(mbufs);
329         RTE_SET_USED(pkts);
330
331         rxq_sp = cnxk_eth_rxq_to_sp(rxq);
332         eth_dev = rxq_sp->dev->eth_dev;
333         nix_ptp_enable_vf(eth_dev);
334
335         return 0;
336 }
337
338 static int
339 cn10k_nix_ptp_info_update_cb(struct roc_nix *nix, bool ptp_en)
340 {
341         struct cnxk_eth_dev *dev = (struct cnxk_eth_dev *)nix;
342         struct rte_eth_dev *eth_dev;
343         struct cn10k_eth_rxq *rxq;
344         int i;
345
346         if (!dev)
347                 return -EINVAL;
348
349         eth_dev = dev->eth_dev;
350         if (!eth_dev)
351                 return -EINVAL;
352
353         dev->ptp_en = ptp_en;
354
355         for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
356                 rxq = eth_dev->data->rx_queues[i];
357                 rxq->mbuf_initializer = cnxk_nix_rxq_mbuf_setup(dev);
358         }
359
360         if (roc_nix_is_vf_or_sdp(nix) && !(roc_nix_is_sdp(nix)) &&
361             !(roc_nix_is_lbk(nix))) {
362                 /* In case of VF, setting of MTU cannot be done directly in this
363                  * function as this is running as part of MBOX request(PF->VF)
364                  * and MTU setting also requires MBOX message to be
365                  * sent(VF->PF)
366                  */
367                 eth_dev->rx_pkt_burst = nix_ptp_vf_burst;
368                 rte_mb();
369         }
370
371         return 0;
372 }
373
374 static int
375 cn10k_nix_timesync_enable(struct rte_eth_dev *eth_dev)
376 {
377         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
378         int i, rc;
379
380         rc = cnxk_nix_timesync_enable(eth_dev);
381         if (rc)
382                 return rc;
383
384         dev->rx_offload_flags |= NIX_RX_OFFLOAD_TSTAMP_F;
385         dev->tx_offload_flags |= NIX_TX_OFFLOAD_TSTAMP_F;
386
387         for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
388                 nix_form_default_desc(dev, eth_dev->data->tx_queues[i], i);
389
390         /* Setting up the rx[tx]_offload_flags due to change
391          * in rx[tx]_offloads.
392          */
393         cn10k_eth_set_rx_function(eth_dev);
394         cn10k_eth_set_tx_function(eth_dev);
395         return 0;
396 }
397
398 static int
399 cn10k_nix_timesync_disable(struct rte_eth_dev *eth_dev)
400 {
401         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
402         int i, rc;
403
404         rc = cnxk_nix_timesync_disable(eth_dev);
405         if (rc)
406                 return rc;
407
408         dev->rx_offload_flags &= ~NIX_RX_OFFLOAD_TSTAMP_F;
409         dev->tx_offload_flags &= ~NIX_TX_OFFLOAD_TSTAMP_F;
410
411         for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
412                 nix_form_default_desc(dev, eth_dev->data->tx_queues[i], i);
413
414         /* Setting up the rx[tx]_offload_flags due to change
415          * in rx[tx]_offloads.
416          */
417         cn10k_eth_set_rx_function(eth_dev);
418         cn10k_eth_set_tx_function(eth_dev);
419         return 0;
420 }
421
422 static int
423 cn10k_nix_dev_start(struct rte_eth_dev *eth_dev)
424 {
425         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
426         struct roc_nix *nix = &dev->nix;
427         int rc;
428
429         /* Common eth dev start */
430         rc = cnxk_nix_dev_start(eth_dev);
431         if (rc)
432                 return rc;
433
434         /* Update VF about data off shifted by 8 bytes if PTP already
435          * enabled in PF owning this VF
436          */
437         if (dev->ptp_en && (!roc_nix_is_pf(nix) && (!roc_nix_is_sdp(nix))))
438                 nix_ptp_enable_vf(eth_dev);
439
440         /* Setting up the rx[tx]_offload_flags due to change
441          * in rx[tx]_offloads.
442          */
443         dev->rx_offload_flags |= nix_rx_offload_flags(eth_dev);
444         dev->tx_offload_flags |= nix_tx_offload_flags(eth_dev);
445
446         cn10k_eth_set_tx_function(eth_dev);
447         cn10k_eth_set_rx_function(eth_dev);
448         return 0;
449 }
450
451 /* Update platform specific eth dev ops */
452 static void
453 nix_eth_dev_ops_override(void)
454 {
455         static int init_once;
456
457         if (init_once)
458                 return;
459         init_once = 1;
460
461         /* Update platform specific ops */
462         cnxk_eth_dev_ops.dev_configure = cn10k_nix_configure;
463         cnxk_eth_dev_ops.tx_queue_setup = cn10k_nix_tx_queue_setup;
464         cnxk_eth_dev_ops.rx_queue_setup = cn10k_nix_rx_queue_setup;
465         cnxk_eth_dev_ops.tx_queue_stop = cn10k_nix_tx_queue_stop;
466         cnxk_eth_dev_ops.dev_start = cn10k_nix_dev_start;
467         cnxk_eth_dev_ops.dev_ptypes_set = cn10k_nix_ptypes_set;
468         cnxk_eth_dev_ops.timesync_enable = cn10k_nix_timesync_enable;
469         cnxk_eth_dev_ops.timesync_disable = cn10k_nix_timesync_disable;
470 }
471
472 static void
473 npc_flow_ops_override(void)
474 {
475         static int init_once;
476
477         if (init_once)
478                 return;
479         init_once = 1;
480
481         /* Update platform specific ops */
482         cnxk_flow_ops.create = cn10k_flow_create;
483         cnxk_flow_ops.destroy = cn10k_flow_destroy;
484 }
485
486 static int
487 cn10k_nix_remove(struct rte_pci_device *pci_dev)
488 {
489         return cnxk_nix_remove(pci_dev);
490 }
491
492 static int
493 cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
494 {
495         struct rte_eth_dev *eth_dev;
496         struct cnxk_eth_dev *dev;
497         int rc;
498
499         if (RTE_CACHE_LINE_SIZE != 64) {
500                 plt_err("Driver not compiled for CN10K");
501                 return -EFAULT;
502         }
503
504         rc = roc_plt_init();
505         if (rc) {
506                 plt_err("Failed to initialize platform model, rc=%d", rc);
507                 return rc;
508         }
509
510         nix_eth_dev_ops_override();
511         npc_flow_ops_override();
512
513         cn10k_eth_sec_ops_override();
514
515         /* Common probe */
516         rc = cnxk_nix_probe(pci_drv, pci_dev);
517         if (rc)
518                 return rc;
519
520         /* Find eth dev allocated */
521         eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
522         if (!eth_dev)
523                 return -ENOENT;
524
525         if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
526                 /* Setup callbacks for secondary process */
527                 cn10k_eth_set_tx_function(eth_dev);
528                 cn10k_eth_set_rx_function(eth_dev);
529                 return 0;
530         }
531
532         dev = cnxk_eth_pmd_priv(eth_dev);
533
534         /* DROP_RE is not supported with inline IPSec for CN10K A0 and
535          * when vector mode is enabled.
536          */
537         if ((roc_model_is_cn10ka_a0() || roc_model_is_cnf10ka_a0() ||
538              roc_model_is_cnf10kb_a0()) &&
539             !roc_env_is_asim()) {
540                 dev->ipsecd_drop_re_dis = 1;
541                 dev->vec_drop_re_dis = 1;
542         }
543
544         /* Register up msg callbacks for PTP information */
545         roc_nix_ptp_info_cb_register(&dev->nix, cn10k_nix_ptp_info_update_cb);
546
547         return 0;
548 }
549
550 static const struct rte_pci_id cn10k_pci_nix_map[] = {
551         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KA, PCI_DEVID_CNXK_RVU_PF),
552         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KAS, PCI_DEVID_CNXK_RVU_PF),
553         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF10KA, PCI_DEVID_CNXK_RVU_PF),
554         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KA, PCI_DEVID_CNXK_RVU_VF),
555         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KAS, PCI_DEVID_CNXK_RVU_VF),
556         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF10KA, PCI_DEVID_CNXK_RVU_VF),
557         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KA, PCI_DEVID_CNXK_RVU_AF_VF),
558         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KAS, PCI_DEVID_CNXK_RVU_AF_VF),
559         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF10KA, PCI_DEVID_CNXK_RVU_AF_VF),
560         {
561                 .vendor_id = 0,
562         },
563 };
564
565 static struct rte_pci_driver cn10k_pci_nix = {
566         .id_table = cn10k_pci_nix_map,
567         .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_NEED_IOVA_AS_VA |
568                      RTE_PCI_DRV_INTR_LSC,
569         .probe = cn10k_nix_probe,
570         .remove = cn10k_nix_remove,
571 };
572
573 RTE_PMD_REGISTER_PCI(net_cn10k, cn10k_pci_nix);
574 RTE_PMD_REGISTER_PCI_TABLE(net_cn10k, cn10k_pci_nix_map);
575 RTE_PMD_REGISTER_KMOD_DEP(net_cn10k, "vfio-pci");