| 199 | }; |
| 200 | |
| 201 | static int |
| 202 | check_for_ext(struct ark_adapter *ark) |
| 203 | { |
| 204 | int found = 0; |
| 205 | |
| 206 | /* Get the env */ |
| 207 | const char *dllpath = getenv("ARK_EXT_PATH"); |
| 208 | |
| 209 | if (dllpath == NULL) { |
| 210 | ARK_PMD_LOG(DEBUG, "EXT NO dll path specified\n"); |
| 211 | return 0; |
| 212 | } |
| 213 | ARK_PMD_LOG(NOTICE, "EXT found dll path at %s\n", dllpath); |
| 214 | |
| 215 | /* Open and load the .so */ |
| 216 | ark->d_handle = dlopen(dllpath, RTLD_LOCAL | RTLD_LAZY); |
| 217 | if (ark->d_handle == NULL) { |
| 218 | ARK_PMD_LOG(ERR, "Could not load user extension %s\n", |
| 219 | dllpath); |
| 220 | return -1; |
| 221 | } |
| 222 | ARK_PMD_LOG(DEBUG, "SUCCESS: loaded user extension %s\n", |
| 223 | dllpath); |
| 224 | |
| 225 | /* Get the entry points */ |
| 226 | ark->user_ext.dev_init = |
| 227 | (void *(*)(struct rte_eth_dev *, void *, int)) |
| 228 | dlsym(ark->d_handle, "rte_pmd_ark_dev_init"); |
| 229 | ARK_PMD_LOG(DEBUG, "device ext init pointer = %p\n", |
| 230 | ark->user_ext.dev_init); |
| 231 | ark->user_ext.dev_get_port_count = |
| 232 | (int (*)(struct rte_eth_dev *, void *)) |
| 233 | dlsym(ark->d_handle, "rte_pmd_ark_dev_get_port_count"); |
| 234 | ark->user_ext.dev_uninit = |
| 235 | (void (*)(struct rte_eth_dev *, void *)) |
| 236 | dlsym(ark->d_handle, "rte_pmd_ark_dev_uninit"); |
| 237 | ark->user_ext.dev_configure = |
| 238 | (int (*)(struct rte_eth_dev *, void *)) |
| 239 | dlsym(ark->d_handle, "rte_pmd_ark_dev_configure"); |
| 240 | ark->user_ext.dev_start = |
| 241 | (int (*)(struct rte_eth_dev *, void *)) |
| 242 | dlsym(ark->d_handle, "rte_pmd_ark_dev_start"); |
| 243 | ark->user_ext.dev_stop = |
| 244 | (void (*)(struct rte_eth_dev *, void *)) |
| 245 | dlsym(ark->d_handle, "rte_pmd_ark_dev_stop"); |
| 246 | ark->user_ext.dev_close = |
| 247 | (void (*)(struct rte_eth_dev *, void *)) |
| 248 | dlsym(ark->d_handle, "rte_pmd_ark_dev_close"); |
| 249 | ark->user_ext.link_update = |
| 250 | (int (*)(struct rte_eth_dev *, int, void *)) |
| 251 | dlsym(ark->d_handle, "rte_pmd_ark_link_update"); |
| 252 | ark->user_ext.dev_set_link_up = |
| 253 | (int (*)(struct rte_eth_dev *, void *)) |
| 254 | dlsym(ark->d_handle, "rte_pmd_ark_dev_set_link_up"); |
| 255 | ark->user_ext.dev_set_link_down = |
| 256 | (int (*)(struct rte_eth_dev *, void *)) |
| 257 | dlsym(ark->d_handle, "rte_pmd_ark_dev_set_link_down"); |
| 258 | ark->user_ext.stats_get = |