MCPcopy Create free account
hub / github.com/F-Stack/f-stack / reader_create

Function reader_create

dpdk/lib/port/rte_swx_port_ethdev.c:46–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44};
45
46static void *
47reader_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
85static int
86reader_pkt_rx(void *port, struct rte_swx_pkt *pkt)

Callers

nothing calls this directly

Calls 4

rte_eth_dev_info_getFunction · 0.85
callocFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected