| 58 | } |
| 59 | |
| 60 | static int |
| 61 | bphy_rawdev_selftest(uint16_t dev_id) |
| 62 | { |
| 63 | unsigned int i, queues, descs; |
| 64 | uint16_t pf_func; |
| 65 | uint64_t max_irq; |
| 66 | int ret; |
| 67 | |
| 68 | queues = rte_rawdev_queue_count(dev_id); |
| 69 | if (queues == 0) |
| 70 | return -ENODEV; |
| 71 | if (queues != BPHY_QUEUE_CNT) |
| 72 | return -EINVAL; |
| 73 | |
| 74 | ret = rte_rawdev_start(dev_id); |
| 75 | if (ret) |
| 76 | return ret; |
| 77 | |
| 78 | ret = rte_rawdev_queue_conf_get(dev_id, CNXK_BPHY_DEF_QUEUE, &descs, |
| 79 | sizeof(descs)); |
| 80 | if (ret) |
| 81 | goto err_desc; |
| 82 | if (descs != 1) { |
| 83 | ret = -ENODEV; |
| 84 | plt_err("Wrong number of descs reported\n"); |
| 85 | goto err_desc; |
| 86 | } |
| 87 | |
| 88 | ret = rte_pmd_bphy_npa_pf_func_get(dev_id, &pf_func); |
| 89 | if (ret || pf_func == 0) |
| 90 | plt_warn("NPA pf_func is invalid"); |
| 91 | |
| 92 | ret = rte_pmd_bphy_sso_pf_func_get(dev_id, &pf_func); |
| 93 | if (ret || pf_func == 0) |
| 94 | plt_warn("SSO pf_func is invalid"); |
| 95 | |
| 96 | ret = rte_pmd_bphy_intr_init(dev_id); |
| 97 | if (ret) { |
| 98 | plt_err("intr init failed"); |
| 99 | return ret; |
| 100 | } |
| 101 | |
| 102 | max_irq = cnxk_bphy_irq_max_get(dev_id); |
| 103 | |
| 104 | test = rte_zmalloc("BPHY", max_irq * sizeof(*test), 0); |
| 105 | if (test == NULL) { |
| 106 | plt_err("intr alloc failed"); |
| 107 | goto err_alloc; |
| 108 | } |
| 109 | |
| 110 | for (i = 0; i < max_irq; i++) { |
| 111 | test[i].test_data = i; |
| 112 | test[i].irq_num = i; |
| 113 | test[i].handler = bphy_test_handler_fn; |
| 114 | test[i].data = &test[i].test_data; |
| 115 | } |
| 116 | |
| 117 | for (i = 0; i < max_irq; i++) { |
nothing calls this directly
no test coverage detected