MCPcopy Create free account
hub / github.com/F-Stack/f-stack / roc_nix_dev_init

Function roc_nix_dev_init

dpdk/drivers/common/cnxk/roc_nix.c:398–511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396}
397
398int
399roc_nix_dev_init(struct roc_nix *roc_nix)
400{
401 enum roc_nix_rss_reta_sz reta_sz;
402 struct plt_pci_device *pci_dev;
403 struct roc_nix_list *nix_list;
404 uint16_t max_sqb_count;
405 uint64_t blkaddr;
406 struct dev *dev;
407 struct nix *nix;
408 int rc;
409
410 if (roc_nix == NULL || roc_nix->pci_dev == NULL)
411 return NIX_ERR_PARAM;
412
413 reta_sz = roc_nix->reta_sz;
414 if (reta_sz != 0 && reta_sz != 64 && reta_sz != 128 && reta_sz != 256)
415 return NIX_ERR_PARAM;
416
417 if (reta_sz == 0)
418 reta_sz = ROC_NIX_RSS_RETA_SZ_64;
419
420 max_sqb_count = roc_nix->max_sqb_count;
421 max_sqb_count = PLT_MIN(max_sqb_count, NIX_MAX_SQB);
422 max_sqb_count = PLT_MAX(max_sqb_count, NIX_MIN_SQB);
423 roc_nix->max_sqb_count = max_sqb_count;
424
425 PLT_STATIC_ASSERT(sizeof(struct nix) <= ROC_NIX_MEM_SZ);
426 nix = roc_nix_to_nix_priv(roc_nix);
427 pci_dev = roc_nix->pci_dev;
428 dev = &nix->dev;
429
430 nix_list = roc_idev_nix_list_get();
431 if (nix_list == NULL)
432 return -EINVAL;
433
434 TAILQ_INSERT_TAIL(nix_list, roc_nix, next);
435
436 if (nix->dev.drv_inited)
437 return 0;
438
439 if (dev->mbox_active)
440 goto skip_dev_init;
441
442 memset(nix, 0, sizeof(*nix));
443
444 /* Since 0 is a valid BPID, use -1 to represent invalid value. */
445 memset(nix->bpid, -1, sizeof(nix->bpid));
446
447 /* Initialize device */
448 rc = dev_init(dev, pci_dev);
449 if (rc) {
450 plt_err("Failed to init roc device");
451 goto fail;
452 }
453
454skip_dev_init:
455 dev->roc_nix = roc_nix;

Callers 1

cnxk_eth_dev_initFunction · 0.85

Calls 15

roc_nix_to_nix_privFunction · 0.85
roc_idev_nix_list_getFunction · 0.85
memsetFunction · 0.85
dev_initFunction · 0.85
nix_lf_attachFunction · 0.85
nix_get_blkaddrFunction · 0.85
nix_lf_get_msix_offsetFunction · 0.85
sdp_lbk_id_updateFunction · 0.85
roc_nix_max_pkt_lenFunction · 0.85
nix_register_irqsFunction · 0.85
nix_tm_conf_initFunction · 0.85
roc_nix_get_hw_infoFunction · 0.85

Tested by

no test coverage detected