| 1200 | } |
| 1201 | |
| 1202 | int |
| 1203 | main(int argc, char **argv) |
| 1204 | { |
| 1205 | struct rte_eth_conf eth_pconf = eth_port_conf; |
| 1206 | struct rte_rawdev_info ntb_rawdev_conf; |
| 1207 | struct rte_rawdev_info ntb_rawdev_info; |
| 1208 | struct rte_eth_dev_info ethdev_info; |
| 1209 | struct rte_eth_rxconf eth_rx_conf; |
| 1210 | struct rte_eth_txconf eth_tx_conf; |
| 1211 | struct ntb_queue_conf ntb_q_conf; |
| 1212 | struct ntb_dev_config ntb_conf; |
| 1213 | struct ntb_dev_info ntb_info; |
| 1214 | uint64_t ntb_link_status; |
| 1215 | uint32_t nb_mbuf; |
| 1216 | int ret, i; |
| 1217 | |
| 1218 | signal(SIGINT, signal_handler); |
| 1219 | signal(SIGTERM, signal_handler); |
| 1220 | |
| 1221 | ret = rte_eal_init(argc, argv); |
| 1222 | if (ret < 0) |
| 1223 | rte_exit(EXIT_FAILURE, "Error with EAL initialization.\n"); |
| 1224 | |
| 1225 | if (rte_lcore_count() < 2) |
| 1226 | rte_exit(EXIT_FAILURE, "Need at least 2 cores\n"); |
| 1227 | |
| 1228 | /* Find 1st ntb rawdev. */ |
| 1229 | for (i = 0; i < RTE_RAWDEV_MAX_DEVS; i++) |
| 1230 | if (rte_rawdevs[i].driver_name && |
| 1231 | (strncmp(rte_rawdevs[i].driver_name, "raw_ntb", |
| 1232 | NTB_DRV_NAME_LEN) == 0) && (rte_rawdevs[i].attached == 1)) |
| 1233 | break; |
| 1234 | |
| 1235 | if (i == RTE_RAWDEV_MAX_DEVS) |
| 1236 | rte_exit(EXIT_FAILURE, "Cannot find any ntb device.\n"); |
| 1237 | |
| 1238 | dev_id = i; |
| 1239 | |
| 1240 | argc -= ret; |
| 1241 | argv += ret; |
| 1242 | |
| 1243 | ntb_parse_args(argc, argv); |
| 1244 | |
| 1245 | rte_rawdev_set_attr(dev_id, NTB_QUEUE_SZ_NAME, nb_desc); |
| 1246 | printf("Set queue size as %u.\n", nb_desc); |
| 1247 | rte_rawdev_set_attr(dev_id, NTB_QUEUE_NUM_NAME, num_queues); |
| 1248 | printf("Set queue number as %u.\n", num_queues); |
| 1249 | ntb_rawdev_info.dev_private = (rte_rawdev_obj_t)(&ntb_info); |
| 1250 | rte_rawdev_info_get(dev_id, &ntb_rawdev_info, sizeof(ntb_info)); |
| 1251 | |
| 1252 | nb_mbuf = nb_desc * num_queues * 2 * 2 + rte_lcore_count() * |
| 1253 | MEMPOOL_CACHE_SIZE; |
| 1254 | mbuf_pool = ntb_mbuf_pool_create(ntb_buf_size, nb_mbuf, ntb_info, |
| 1255 | &ntb_conf, rte_socket_id()); |
| 1256 | if (mbuf_pool == NULL) |
| 1257 | rte_exit(EXIT_FAILURE, "Cannot create mbuf pool.\n"); |
| 1258 | |
| 1259 | ntb_conf.num_queues = num_queues; |
nothing calls this directly
no test coverage detected