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

Function port_init

dpdk/examples/ipsec-secgw/ipsec-secgw.c:1920–2118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1918}
1919
1920static void
1921port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads,
1922 uint8_t hw_reassembly)
1923{
1924 struct rte_eth_dev_info dev_info;
1925 struct rte_eth_txconf *txconf;
1926 uint16_t nb_tx_queue, nb_rx_queue;
1927 uint16_t tx_queueid, rx_queueid, queue;
1928 uint32_t lcore_id;
1929 int32_t ret, socket_id;
1930 struct lcore_conf *qconf;
1931 struct rte_ether_addr ethaddr;
1932 struct rte_eth_conf local_port_conf = port_conf;
1933 struct rte_eth_ip_reassembly_params reass_capa = {0};
1934 int ptype_supported;
1935
1936 ret = rte_eth_dev_info_get(portid, &dev_info);
1937 if (ret != 0)
1938 rte_exit(EXIT_FAILURE,
1939 "Error during getting device (port %u) info: %s\n",
1940 portid, strerror(-ret));
1941
1942 /* limit allowed HW offloads, as user requested */
1943 dev_info.rx_offload_capa &= dev_rx_offload;
1944 dev_info.tx_offload_capa &= dev_tx_offload;
1945
1946 printf("Configuring device port %u:\n", portid);
1947
1948 ret = rte_eth_macaddr_get(portid, &ethaddr);
1949 if (ret != 0)
1950 rte_exit(EXIT_FAILURE,
1951 "Error getting MAC address (port %u): %s\n",
1952 portid, rte_strerror(-ret));
1953
1954 rte_ether_addr_copy(&ethaddr, &ethaddr_tbl[portid].src);
1955
1956 rte_ether_addr_copy(&ethaddr_tbl[portid].dst,
1957 (struct rte_ether_addr *)(val_eth + portid));
1958
1959 rte_ether_addr_copy(&ethaddr_tbl[portid].src,
1960 (struct rte_ether_addr *)(val_eth + portid) + 1);
1961
1962 print_ethaddr("Address: ", &ethaddr);
1963 printf("\n");
1964
1965 nb_rx_queue = get_port_nb_rx_queues(portid);
1966 nb_tx_queue = nb_lcores;
1967
1968 if (nb_rx_queue > dev_info.max_rx_queues)
1969 rte_exit(EXIT_FAILURE, "Error: queue %u not available "
1970 "(max rx queue is %u)\n",
1971 nb_rx_queue, dev_info.max_rx_queues);
1972
1973 if (nb_tx_queue > dev_info.max_tx_queues)
1974 rte_exit(EXIT_FAILURE, "Error: queue %u not available "
1975 "(max tx queue is %u)\n",
1976 nb_tx_queue, dev_info.max_tx_queues);
1977

Callers 1

mainFunction · 0.70

Calls 15

rte_eth_dev_info_getFunction · 0.85
rte_exitFunction · 0.85
rte_eth_macaddr_getFunction · 0.85
rte_strerrorFunction · 0.85
rte_ether_addr_copyFunction · 0.85
get_port_nb_rx_queuesFunction · 0.85
multi_seg_requiredFunction · 0.85
rte_eth_dev_configureFunction · 0.85
rte_lcore_is_enabledFunction · 0.85
rte_lcore_to_socket_idFunction · 0.85
rte_eth_tx_queue_setupFunction · 0.85

Tested by

no test coverage detected