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

Function init_port

dpdk/app/test-flow-perf/main.c:1940–2105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1938}
1939
1940static void
1941init_port(void)
1942{
1943 int ret;
1944 uint16_t std_queue;
1945 uint16_t hairpin_queue;
1946 uint16_t port_id;
1947 uint16_t nr_ports;
1948 uint16_t nr_queues;
1949 struct rte_eth_hairpin_conf hairpin_conf = {
1950 .peer_count = 1,
1951 };
1952 struct rte_eth_conf port_conf = {
1953 .rx_adv_conf = {
1954 .rss_conf.rss_hf =
1955 GET_RSS_HF(),
1956 }
1957 };
1958 struct rte_eth_txconf txq_conf;
1959 struct rte_eth_rxconf rxq_conf;
1960 struct rte_eth_dev_info dev_info;
1961
1962 nr_queues = rx_queues_count;
1963 if (hairpin_queues_num != 0)
1964 nr_queues = rx_queues_count + hairpin_queues_num;
1965
1966 nr_ports = rte_eth_dev_count_avail();
1967 if (nr_ports == 0)
1968 rte_exit(EXIT_FAILURE, "Error: no port detected\n");
1969
1970 mbuf_mp = rte_pktmbuf_pool_create("mbuf_pool",
1971 total_mbuf_num, mbuf_cache_size,
1972 0, mbuf_size,
1973 rte_socket_id());
1974 if (mbuf_mp == NULL)
1975 rte_exit(EXIT_FAILURE, "Error: can't init mbuf pool\n");
1976
1977 for (port_id = 0; port_id < nr_ports; port_id++) {
1978 uint64_t rx_metadata = 0;
1979
1980 rx_metadata |= RTE_ETH_RX_METADATA_USER_FLAG;
1981 rx_metadata |= RTE_ETH_RX_METADATA_USER_MARK;
1982
1983 ret = rte_eth_rx_metadata_negotiate(port_id, &rx_metadata);
1984 if (ret == 0) {
1985 if (!(rx_metadata & RTE_ETH_RX_METADATA_USER_FLAG)) {
1986 printf(":: flow action FLAG will not affect Rx mbufs on port=%u\n",
1987 port_id);
1988 }
1989
1990 if (!(rx_metadata & RTE_ETH_RX_METADATA_USER_MARK)) {
1991 printf(":: flow action MARK will not affect Rx mbufs on port=%u\n",
1992 port_id);
1993 }
1994 } else if (ret != -ENOTSUP) {
1995 rte_exit(EXIT_FAILURE, "Error when negotiating Rx meta features on port=%u: %s\n",
1996 port_id, rte_strerror(-ret));
1997 }

Callers 1

mainFunction · 0.70

Calls 15

rte_eth_dev_count_availFunction · 0.85
rte_exitFunction · 0.85
rte_pktmbuf_pool_createFunction · 0.85
rte_socket_idFunction · 0.85
rte_strerrorFunction · 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

Tested by

no test coverage detected