DPDK usage discussions
 help / color / mirror / Atom feed
From: "Van Haaren, Harry" <harry.van.haaren@intel.com>
To: Jeevan Nailwal <jeevan.ginnie@gmail.com>,
	"users@dpdk.org" <users@dpdk.org>
Subject: Re: [dpdk-users] New to DPDK
Date: Wed, 15 Sep 2021 12:22:24 +0000
Message-ID: <BN0PR11MB5712222D5683BD885EA08BB5D7DB9@BN0PR11MB5712.namprd11.prod.outlook.com> (raw)
In-Reply-To: <CA+NhQKx-_6NDe1U3+o3Wgb1Lk_nKWOKJKGjBfUFyKLOm6Ecpdg@mail.gmail.com>

> -----Original Message-----
> From: users <users-bounces@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

  reply	other threads:[~2021-09-15 12:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15 12:11 Jeevan Nailwal
2021-09-15 12:22 ` Van Haaren, Harry [this message]
     [not found]   ` <CA+NhQKwOvbHBv_eadQDMjarGv7Qs+1dna8s9_-JyP0eZthwTZQ@mail.gmail.com>
2021-09-16  5:08     ` [dpdk-users] Fwd: " Jeevan Nailwal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BN0PR11MB5712222D5683BD885EA08BB5D7DB9@BN0PR11MB5712.namprd11.prod.outlook.com \
    --to=harry.van.haaren@intel.com \
    --cc=jeevan.ginnie@gmail.com \
    --cc=users@dpdk.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK usage discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/users/0 users/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 users users/ http://inbox.dpdk.org/users \
	public-inbox-index users

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git