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

Function main

dpdk/examples/vhost/main.c:1907–2085  ·  view source on GitHub ↗

* Main function, does initialisation and calls the per-lcore functions. */

Source from the content-addressed store, hash-verified

1905 * Main function, does initialisation and calls the per-lcore functions.
1906 */
1907int
1908main(int argc, char *argv[])
1909{
1910 unsigned lcore_id, core_id = 0;
1911 unsigned nb_ports, valid_num_ports;
1912 int ret, i;
1913 uint16_t portid;
1914 rte_thread_t tid;
1915 uint64_t flags = RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS;
1916
1917 signal(SIGINT, sigint_handler);
1918
1919 /* init EAL */
1920 ret = rte_eal_init(argc, argv);
1921 if (ret < 0)
1922 rte_exit(EXIT_FAILURE, "Error with EAL initialization\n");
1923 argc -= ret;
1924 argv += ret;
1925
1926 /* initialize dma structures */
1927 reset_dma();
1928
1929 /* parse app arguments */
1930 ret = us_vhost_parse_args(argc, argv);
1931 if (ret < 0)
1932 rte_exit(EXIT_FAILURE, "Invalid argument\n");
1933
1934 for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
1935 TAILQ_INIT(&lcore_info[lcore_id].vdev_list);
1936
1937 if (rte_lcore_is_enabled(lcore_id))
1938 lcore_ids[core_id++] = lcore_id;
1939 }
1940
1941 if (rte_lcore_count() > RTE_MAX_LCORE)
1942 rte_exit(EXIT_FAILURE,"Not enough cores\n");
1943
1944 /* Get the number of physical ports. */
1945 nb_ports = rte_eth_dev_count_avail();
1946
1947 /*
1948 * Update the global var NUM_PORTS and global array PORTS
1949 * and get value of var VALID_NUM_PORTS according to system ports number
1950 */
1951 valid_num_ports = check_ports_num(nb_ports);
1952
1953 if ((valid_num_ports == 0) || (valid_num_ports > MAX_SUP_PORTS)) {
1954 RTE_LOG(INFO, VHOST_PORT, "Current enabled port number is %u,"
1955 "but only %u port can be enabled\n",num_ports, MAX_SUP_PORTS);
1956 return -1;
1957 }
1958
1959 /*
1960 * FIXME: here we are trying to allocate mbufs big enough for
1961 * @MAX_QUEUES, but the truth is we're never going to use that
1962 * many queues here. We probably should only do allocation for
1963 * those queues we are going to use.
1964 */

Callers

nothing calls this directly

Calls 15

rte_exitFunction · 0.85
reset_dmaFunction · 0.85
us_vhost_parse_argsFunction · 0.85
rte_lcore_is_enabledFunction · 0.85
rte_lcore_countFunction · 0.85
rte_eth_dev_count_availFunction · 0.85
rte_pktmbuf_pool_createFunction · 0.85
rte_socket_idFunction · 0.85

Tested by

no test coverage detected