| 44 | }; |
| 45 | |
| 46 | static void * |
| 47 | reader_create(void *args) |
| 48 | { |
| 49 | struct rte_eth_dev_info info; |
| 50 | struct rte_swx_port_ethdev_reader_params *params = args; |
| 51 | struct reader *p; |
| 52 | int status; |
| 53 | uint16_t port_id; |
| 54 | |
| 55 | /* Check input parameters. */ |
| 56 | CHECK(params); |
| 57 | |
| 58 | CHECK(params->dev_name); |
| 59 | status = rte_eth_dev_get_port_by_name(params->dev_name, &port_id); |
| 60 | CHECK(!status); |
| 61 | |
| 62 | status = rte_eth_dev_info_get(port_id, &info); |
| 63 | CHECK((status == -ENOTSUP) || (params->queue_id < info.nb_rx_queues)); |
| 64 | |
| 65 | CHECK(params->burst_size); |
| 66 | |
| 67 | /* Memory allocation. */ |
| 68 | p = calloc(1, sizeof(struct reader)); |
| 69 | CHECK(p); |
| 70 | |
| 71 | p->pkts = calloc(params->burst_size, sizeof(struct rte_mbuf *)); |
| 72 | if (!p->pkts) { |
| 73 | free(p); |
| 74 | CHECK(0); |
| 75 | } |
| 76 | |
| 77 | /* Initialization. */ |
| 78 | p->params.port_id = port_id; |
| 79 | p->params.queue_id = params->queue_id; |
| 80 | p->params.burst_size = params->burst_size; |
| 81 | |
| 82 | return p; |
| 83 | } |
| 84 | |
| 85 | static int |
| 86 | reader_pkt_rx(void *port, struct rte_swx_pkt *pkt) |
nothing calls this directly
no test coverage detected