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

Function main

dpdk/examples/qos_meter/main.c:292–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290}
291
292int
293main(int argc, char **argv)
294{
295 uint32_t lcore_id;
296 uint16_t nb_rxd = NIC_RX_QUEUE_DESC;
297 uint16_t nb_txd = NIC_TX_QUEUE_DESC;
298 struct rte_eth_conf conf;
299 struct rte_eth_rxconf rxq_conf;
300 struct rte_eth_txconf txq_conf;
301 struct rte_eth_dev_info dev_info;
302 int ret;
303
304 /* EAL init */
305 ret = rte_eal_init(argc, argv);
306 if (ret < 0)
307 rte_exit(EXIT_FAILURE, "Invalid EAL parameters\n");
308 argc -= ret;
309 argv += ret;
310 if (rte_lcore_count() != 1) {
311 rte_exit(EXIT_FAILURE, "This application does not accept more than one core. "
312 "Please adjust the \"-c COREMASK\" parameter accordingly.\n");
313 }
314
315 /* Application non-EAL arguments parse */
316 ret = parse_args(argc, argv);
317 if (ret < 0)
318 rte_exit(EXIT_FAILURE, "Invalid input arguments\n");
319
320 /* Buffer pool init */
321 pool = rte_pktmbuf_pool_create("pool", NB_MBUF, MEMPOOL_CACHE_SIZE,
322 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
323 if (pool == NULL)
324 rte_exit(EXIT_FAILURE, "Buffer pool creation error\n");
325
326 /* NIC init */
327 conf = port_conf;
328
329 ret = rte_eth_dev_info_get(port_rx, &dev_info);
330 if (ret != 0)
331 rte_exit(EXIT_FAILURE,
332 "Error during getting device (port %u) info: %s\n",
333 port_rx, strerror(-ret));
334
335 if (dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
336 conf.txmode.offloads |= RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
337
338 conf.rx_adv_conf.rss_conf.rss_hf &= dev_info.flow_type_rss_offloads;
339 if (conf.rx_adv_conf.rss_conf.rss_hf !=
340 port_conf.rx_adv_conf.rss_conf.rss_hf) {
341 printf("Port %u modified RSS hash function based on hardware support,"
342 "requested:%#"PRIx64" configured:%#"PRIx64"\n",
343 port_rx,
344 port_conf.rx_adv_conf.rss_conf.rss_hf,
345 conf.rx_adv_conf.rss_conf.rss_hf);
346 }
347
348 ret = rte_eth_dev_configure(port_rx, 1, 1, &conf);
349 if (ret < 0)

Callers

nothing calls this directly

Calls 15

rte_exitFunction · 0.85
rte_lcore_countFunction · 0.85
rte_pktmbuf_pool_createFunction · 0.85
rte_socket_idFunction · 0.85
rte_eth_dev_info_getFunction · 0.85
rte_eth_dev_configureFunction · 0.85
rte_eth_rx_queue_setupFunction · 0.85
rte_eth_dev_socket_idFunction · 0.85
rte_eth_tx_queue_setupFunction · 0.85
rte_zmalloc_socketFunction · 0.85
rte_eth_tx_buffer_initFunction · 0.85

Tested by

no test coverage detected