| 2379 | } |
| 2380 | |
| 2381 | static int |
| 2382 | rxa_create(uint8_t id, uint8_t dev_id, |
| 2383 | struct rte_event_eth_rx_adapter_params *rxa_params, |
| 2384 | rte_event_eth_rx_adapter_conf_cb conf_cb, |
| 2385 | void *conf_arg) |
| 2386 | { |
| 2387 | struct event_eth_rx_adapter *rx_adapter; |
| 2388 | struct eth_event_enqueue_buffer *buf; |
| 2389 | struct rte_event *events; |
| 2390 | int ret; |
| 2391 | int socket_id; |
| 2392 | uint16_t i; |
| 2393 | char mem_name[ETH_RX_ADAPTER_SERVICE_NAME_LEN]; |
| 2394 | const uint8_t default_rss_key[] = { |
| 2395 | 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, |
| 2396 | 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0, |
| 2397 | 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4, |
| 2398 | 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c, |
| 2399 | 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa, |
| 2400 | }; |
| 2401 | |
| 2402 | RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); |
| 2403 | RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); |
| 2404 | |
| 2405 | if (conf_cb == NULL) |
| 2406 | return -EINVAL; |
| 2407 | |
| 2408 | if (event_eth_rx_adapter == NULL) { |
| 2409 | ret = rte_event_eth_rx_adapter_init(); |
| 2410 | if (ret) |
| 2411 | return ret; |
| 2412 | } |
| 2413 | |
| 2414 | rx_adapter = rxa_id_to_adapter(id); |
| 2415 | if (rx_adapter != NULL) { |
| 2416 | RTE_EDEV_LOG_ERR("Eth Rx adapter exists id = %" PRIu8, id); |
| 2417 | return -EEXIST; |
| 2418 | } |
| 2419 | |
| 2420 | socket_id = rte_event_dev_socket_id(dev_id); |
| 2421 | snprintf(mem_name, ETH_RX_ADAPTER_MEM_NAME_LEN, |
| 2422 | "rte_event_eth_rx_adapter_%d", |
| 2423 | id); |
| 2424 | |
| 2425 | rx_adapter = rte_zmalloc_socket(mem_name, sizeof(*rx_adapter), |
| 2426 | RTE_CACHE_LINE_SIZE, socket_id); |
| 2427 | if (rx_adapter == NULL) { |
| 2428 | RTE_EDEV_LOG_ERR("failed to get mem for rx adapter"); |
| 2429 | return -ENOMEM; |
| 2430 | } |
| 2431 | |
| 2432 | rx_adapter->eventdev_id = dev_id; |
| 2433 | rx_adapter->socket_id = socket_id; |
| 2434 | rx_adapter->conf_cb = conf_cb; |
| 2435 | rx_adapter->conf_arg = conf_arg; |
| 2436 | rx_adapter->id = id; |
| 2437 | TAILQ_INIT(&rx_adapter->vector_list); |
| 2438 | strcpy(rx_adapter->mem_name, mem_name); |
no test coverage detected