| 120 | }; |
| 121 | |
| 122 | static void |
| 123 | member_port_init(uint16_t portid, struct rte_mempool *mbuf_pool) |
| 124 | { |
| 125 | int retval; |
| 126 | uint16_t nb_rxd = RTE_RX_DESC_DEFAULT; |
| 127 | uint16_t nb_txd = RTE_TX_DESC_DEFAULT; |
| 128 | struct rte_eth_dev_info dev_info; |
| 129 | struct rte_eth_rxconf rxq_conf; |
| 130 | struct rte_eth_txconf txq_conf; |
| 131 | struct rte_eth_conf local_port_conf = port_conf; |
| 132 | |
| 133 | if (!rte_eth_dev_is_valid_port(portid)) |
| 134 | rte_exit(EXIT_FAILURE, "Invalid port\n"); |
| 135 | |
| 136 | retval = rte_eth_dev_info_get(portid, &dev_info); |
| 137 | if (retval != 0) |
| 138 | rte_exit(EXIT_FAILURE, |
| 139 | "Error during getting device (port %u) info: %s\n", |
| 140 | portid, strerror(-retval)); |
| 141 | |
| 142 | if (dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) |
| 143 | local_port_conf.txmode.offloads |= |
| 144 | RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE; |
| 145 | |
| 146 | local_port_conf.rx_adv_conf.rss_conf.rss_hf &= |
| 147 | dev_info.flow_type_rss_offloads; |
| 148 | if (local_port_conf.rx_adv_conf.rss_conf.rss_hf != |
| 149 | port_conf.rx_adv_conf.rss_conf.rss_hf) { |
| 150 | printf("Port %u modified RSS hash function based on hardware support," |
| 151 | "requested:%#"PRIx64" configured:%#"PRIx64"\n", |
| 152 | portid, |
| 153 | port_conf.rx_adv_conf.rss_conf.rss_hf, |
| 154 | local_port_conf.rx_adv_conf.rss_conf.rss_hf); |
| 155 | } |
| 156 | |
| 157 | retval = rte_eth_dev_configure(portid, 1, 1, &local_port_conf); |
| 158 | if (retval != 0) |
| 159 | rte_exit(EXIT_FAILURE, "port %u: configuration failed (res=%d)\n", |
| 160 | portid, retval); |
| 161 | |
| 162 | retval = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd, &nb_txd); |
| 163 | if (retval != 0) |
| 164 | rte_exit(EXIT_FAILURE, "port %u: rte_eth_dev_adjust_nb_rx_tx_desc " |
| 165 | "failed (res=%d)\n", portid, retval); |
| 166 | |
| 167 | /* RX setup */ |
| 168 | rxq_conf = dev_info.default_rxconf; |
| 169 | rxq_conf.offloads = local_port_conf.rxmode.offloads; |
| 170 | retval = rte_eth_rx_queue_setup(portid, 0, nb_rxd, |
| 171 | rte_eth_dev_socket_id(portid), |
| 172 | &rxq_conf, |
| 173 | mbuf_pool); |
| 174 | if (retval < 0) |
| 175 | rte_exit(retval, " port %u: RX queue 0 setup failed (res=%d)", |
| 176 | portid, retval); |
| 177 | |
| 178 | /* TX setup */ |
| 179 | txq_conf = dev_info.default_txconf; |
no test coverage detected