> -----Original Message----- > From: users <users-boun...@dpdk.org> On Behalf Of Jeevan Nailwal > Sent: Wednesday, September 15, 2021 1:11 PM > To: users@dpdk.org > Subject: [dpdk-users] New to DPDK > > Hi Everyone, I am new to DPDK and trying to learn its usage. I am facing a > SEGFAULT while sending a single packet via this. > Please find the snippet of my code below:
Hi Jeevan, > ------------Started my program with initial pool configuration: > ret = rte_eal_init(argc, argv); > if (ret < 0) > rte_exit(EXIT_FAILURE, "Error with EAL initialization\n"); > argc -= ret; > argv += ret; > > rte_log_set_global_level(RTE_LOG_NOTICE); > > /* parse app arguments */ > if (rte_lcore_count() > RTE_MAX_LCORE) > rte_exit(EXIT_FAILURE,"Not enough cores\n"); > > create_mbuf_pool(128000, 128); > > ret = rte_vhost_driver_register(sockpath, 0); > if (ret != 0) > rte_exit(EXIT_FAILURE, "vhost driver register failure.\n"); > > > rte_vhost_driver_callback_register (sockpath, &virtio_net_device_ops); > chmod (sockpath, 0777); > rte_vhost_driver_start(sockpath); Could I suggest to start with a simpler program than going straight for vhost? Some basic forwarding using e.g. pcap PMD or something would simplify the problem... and help get something small working correctly before attempting big. > -------- afterwards i created a thread to instantiate m TX.. i.e. receive > packet from DPDK: > > ret = pthread_create (&proc_tx, NULL, (void *)tx_process, NULL); > if (ret != 0) > { > rte_exit (EXIT_FAILURE, "Cannot create TX thread\n"); > } DPDK handles thread creation, assigns "lcore ids" and various other thread-local specific things to the thread. These are later used in e.g. mempool library for optimized per-thread cache data structures. Using a "raw" pthread will not work with DPDK function-calls, nor is it expected to. Have a look at examples/helloworld to see how lcores are launch using DPDK. Then perhaps look at examples/skeleton to see how launched lcores can use rx/tx burst APIs correctly. Hope that helps! -Harry