* DPDK callback to register the virtual device. * * @param vdev * Pointer to the virtual device. * * @return * 0 on success, negative error value otherwise. */
| 897 | * 0 on success, negative error value otherwise. |
| 898 | */ |
| 899 | static int |
| 900 | rte_pmd_mvneta_probe(struct rte_vdev_device *vdev) |
| 901 | { |
| 902 | struct rte_kvargs *kvlist; |
| 903 | struct mvneta_ifnames ifnames; |
| 904 | int ret = -EINVAL; |
| 905 | uint32_t i, ifnum; |
| 906 | const char *params; |
| 907 | |
| 908 | params = rte_vdev_device_args(vdev); |
| 909 | if (!params) |
| 910 | return -EINVAL; |
| 911 | |
| 912 | kvlist = rte_kvargs_parse(params, valid_args); |
| 913 | if (!kvlist) |
| 914 | return -EINVAL; |
| 915 | |
| 916 | ifnum = rte_kvargs_count(kvlist, MVNETA_IFACE_NAME_ARG); |
| 917 | if (ifnum > RTE_DIM(ifnames.names)) |
| 918 | goto out_free_kvlist; |
| 919 | |
| 920 | ifnames.idx = 0; |
| 921 | rte_kvargs_process(kvlist, MVNETA_IFACE_NAME_ARG, |
| 922 | mvneta_ifnames_get, &ifnames); |
| 923 | |
| 924 | /* |
| 925 | * The below system initialization should be done only once, |
| 926 | * on the first provided configuration file |
| 927 | */ |
| 928 | if (mvneta_dev_num) |
| 929 | goto init_devices; |
| 930 | |
| 931 | MVNETA_LOG(INFO, "Perform MUSDK initializations"); |
| 932 | |
| 933 | ret = rte_mvep_init(MVEP_MOD_T_NETA, kvlist); |
| 934 | if (ret) |
| 935 | goto out_free_kvlist; |
| 936 | |
| 937 | ret = mvneta_neta_init(); |
| 938 | if (ret) { |
| 939 | MVNETA_LOG(ERR, "Failed to init NETA!"); |
| 940 | rte_mvep_deinit(MVEP_MOD_T_NETA); |
| 941 | goto out_free_kvlist; |
| 942 | } |
| 943 | |
| 944 | init_devices: |
| 945 | for (i = 0; i < ifnum; i++) { |
| 946 | MVNETA_LOG(INFO, "Creating %s", ifnames.names[i]); |
| 947 | ret = mvneta_eth_dev_create(vdev, ifnames.names[i]); |
| 948 | if (ret) |
| 949 | goto out_cleanup; |
| 950 | |
| 951 | mvneta_dev_num++; |
| 952 | } |
| 953 | |
| 954 | rte_kvargs_free(kvlist); |
| 955 | |
| 956 | return 0; |
nothing calls this directly
no test coverage detected