On 06/03, Xiaoyun Li wrote: >Enable an example for rawdev ntb. Support interactive mode to send >file on one host and receive file from another host. The command line >would be 'send [filepath]' and 'receive [filepath]'. > >But since the FIFO is not enabled right now, use rte_memcpy as the enqueue >and dequeue functions and only support transmitting file no more than 4M. > >Signed-off-by: Xiaoyun Li <xiaoyun...@intel.com>
[snip] >--- >+ >+int >+main(int argc, char **argv) >+{ >+ int ret, i; >+ >+ signal(SIGINT, signal_handler); >+ signal(SIGTERM, signal_handler); >+ >+ ret = rte_eal_init(argc, argv); >+ if (ret < 0) >+ rte_exit(EXIT_FAILURE, "Error with EAL initialization.\n"); >+ >+ /* Find 1st ntb rawdev. */ >+ for (i = 0; i < RTE_RAWDEV_MAX_DEVS; i++) >+ if (rte_rawdevs[i].driver_name && >+ (strncmp(rte_rawdevs[i].driver_name, "raw_ntb", 7) == 0) && >+ (rte_rawdevs[i].attached == 1)) >+ break; Can replace above code block with rawdev API rte_rawdev_get_dev_id. Thanks, Xiaolong >+ >+ if (i == RTE_RAWDEV_MAX_DEVS) >+ rte_exit(EXIT_FAILURE, "Cannot find any ntb device.\n"); >+ >+ dev_id = i; >+ >+ argc -= ret; >+ argv += ret; >+ >+ ret = parse_args(argc, argv); >+ if (ret < 0) >+ rte_exit(EXIT_FAILURE, "Invalid arguments\n"); >+ >+ rte_rawdev_start(dev_id); >+ >+ if (interactive) { >+ sleep(1); >+ prompt(); >+ } >+ >+ return 0; >+} >-- >2.17.1 >