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

Function link_create

dpdk/examples/ip_pipeline/link.c:98–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98struct link *
99link_create(const char *name, struct link_params *params)
100{
101 struct rte_eth_dev_info port_info;
102 struct rte_eth_conf port_conf;
103 struct link *link;
104 struct link_params_rss *rss;
105 struct mempool *mempool;
106 uint32_t cpu_id, i;
107 int status;
108 uint16_t port_id;
109
110 /* Check input params */
111 if ((name == NULL) ||
112 link_find(name) ||
113 (params == NULL) ||
114 (params->rx.n_queues == 0) ||
115 (params->rx.queue_size == 0) ||
116 (params->tx.n_queues == 0) ||
117 (params->tx.queue_size == 0))
118 return NULL;
119
120 port_id = params->port_id;
121 if (params->dev_name) {
122 status = rte_eth_dev_get_port_by_name(params->dev_name,
123 &port_id);
124
125 if (status)
126 return NULL;
127 } else
128 if (!rte_eth_dev_is_valid_port(port_id))
129 return NULL;
130
131 if (rte_eth_dev_info_get(port_id, &port_info) != 0)
132 return NULL;
133
134 mempool = mempool_find(params->rx.mempool_name);
135 if (mempool == NULL)
136 return NULL;
137
138 rss = params->rx.rss;
139 if (rss) {
140 if ((port_info.reta_size == 0) ||
141 (port_info.reta_size > RTE_ETH_RSS_RETA_SIZE_512))
142 return NULL;
143
144 if ((rss->n_queues == 0) ||
145 (rss->n_queues >= LINK_RXQ_RSS_MAX))
146 return NULL;
147
148 for (i = 0; i < rss->n_queues; i++)
149 if (rss->queue_id[i] >= port_info.max_rx_queues)
150 return NULL;
151 }
152
153 /**
154 * Resource create
155 */

Callers 1

cmd_linkFunction · 0.85

Calls 15

link_findFunction · 0.85
rte_eth_dev_info_getFunction · 0.85
mempool_findFunction · 0.85
rte_eth_dev_socket_idFunction · 0.85
rte_eth_dev_configureFunction · 0.85
rte_eth_rx_queue_setupFunction · 0.85
rte_eth_tx_queue_setupFunction · 0.85
rte_eth_dev_startFunction · 0.85
rte_eth_dev_stopFunction · 0.85

Tested by

no test coverage detected