From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f44.google.com (mail-oi0-f44.google.com [209.85.218.44]) by dpdk.org (Postfix) with ESMTP id 37B8E2BF6 for ; Fri, 11 Mar 2016 22:50:18 +0100 (CET) Received: by mail-oi0-f44.google.com with SMTP id d205so95836784oia.0 for ; Fri, 11 Mar 2016 13:50:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=Kzo94JRAIRbuhFeHLXkFBrQp2TGBCLnhn3Crwy3WrYc=; b=Wq7BRk9BZRCpZ6yIH2lHGUIpDTbV33G9T0siGNeWwwDfHIBBjTHaYU4T0CIKmU8YXb uPFf11x+w0b5vgHbqM1kPKs7PlinIPjhGfvimUOWUboJnYzMJxpn5SMaz4UshvDmFcdG 8jUc89fkljfH0bQ0wthANf4NmsFO2uy7MEvRBrxZR61za48+Z8qF4QiE9aTaze9aVedj 4AqtbWXDGejJ7Oq2NKN+tFkhiLdnUWPuOgVuCLipqFlorgWvBfYz92fCQV9ibsFDdHHN al9fS8BIXXAXqVJVwfHJplfRq9wKQ4Isgg25dF0kdFzS0VfboCxPmDrilvSqL22VHDae NYNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=Kzo94JRAIRbuhFeHLXkFBrQp2TGBCLnhn3Crwy3WrYc=; b=HsTQYf6f7qydlgJn5+HCDTAb1aGu/JWqOkMdfh7MniedNUUlHW0G7uvwxEgJspsqHL xUisLINGwrkG2zB8O+g+dyQxIFEA66FZFTCjz7u/RXM8XDkY7NcT/ed1UZHZIb2rWPcM ydlTMmtFGmeTa70lUIj0FVIBeHoZ7rCmj+NbXDg19+DPGYmp9+qwNbSXrp4+m+3TkE6i JfLSirg0+B5GNY2FxroaVtCdsDEAbhzX3i08g8rMYTwQgarWpwLKRAysY/cN2/IlrWWI A6v5kmeYDNQdlsWsurOtVOf3OoGoFE1PWe0b+WLGk4s2WuzsMdcxGJNWnUcNafALnn72 PaAQ== X-Gm-Message-State: AD7BkJJVgwEH1z7GAbXB2QnHq40387oUgPl98sd0sM7esPyeFWTHX/rhc7+L3uAqYPrqwOz/O4t7/wvsRcVa/Q== MIME-Version: 1.0 X-Received: by 10.202.3.135 with SMTP id 129mr6908084oid.91.1457733017583; Fri, 11 Mar 2016 13:50:17 -0800 (PST) Received: by 10.76.68.7 with HTTP; Fri, 11 Mar 2016 13:50:17 -0800 (PST) In-Reply-To: References: Date: Fri, 11 Mar 2016 16:50:17 -0500 Message-ID: From: Kyle Larose To: Mahdi Moradmand Badie Content-Type: text/plain; charset=UTF-8 Cc: users@dpdk.org Subject: Re: [dpdk-users] Send and Receive packets to/from specific core X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Mar 2016 21:50:18 -0000 On Fri, Mar 11, 2016 at 4:01 PM, Mahdi Moradmand Badie wrote: > Yes, I found it before :), its a little ambiguous for me, I don't know how I > could write the specific data(message or packet) into specific core, then > change it and then read with the other core. Well, when one process writes to the other, it moves between threads. Each thread is pinned to a specific core (i.e. processor affinity). You can see that this is happening by looking at the output from the example. It mentions on the page I linked something like "Starting core 9" or "core 9: Received...". This means that the application has started its worker thread and associated it with core 9. It will only ever run on that core. Thus, in order for it to actually process the message, the contents of the message must be copied into the cache/registers/etc. of that core. To control which cores are used, you use the "-c" argument, and give the "core mask" in hex. For example, -c 3 would use cores 0 and 1. The key things to take away from this are that threads are constrained by the scheduler to only run on specific cores using processor affinity, and that message queues in the form of rings can be used to pass messages between these cores. A message processed on a thread assigned to core X will be modified/accessed locally on that core. This doesn't mean other cores couldn't access it. But, that should be prevented by good design. > > On 11 March 2016 at 15:54, Kyle Larose wrote: >> >> On Fri, Mar 11, 2016 at 3:47 PM, Mahdi Moradmand Badie >> wrote: >> > My big challenge is having a tested code (run able with right >> > functionality), then run and change it in order to have my task. >> > I wanna use the share memory btw cores in order to write/read to/from >> > and >> > knowing how do that :), all available code which I found are based on >> > NIC :( >> > or maybe I am wrong!!! >> > Thanks in advance, >> >> Take a look at this example: >> >> >> http://dpdk.org/doc/guides/sample_app_ug/multi_process.html#basic-multi-process-example >> >> IIRC, it uses rings to send messages back and forth between the cores. >> The code is available with the dpdk source, so it should serve as a >> good starting point to see how to set up the shared memory and use it. >> >> Does that help? >> >> > >> > On 11 March 2016 at 15:43, Kyle Larose wrote: >> >> >> >> On Fri, Mar 11, 2016 at 3:22 PM, Mahdi Moradmand Badie >> >> wrote: >> >> > Dear All, >> >> > >> >> > I wanna Send(write) a Packet(s) with specific data (for example x = >> >> > 10) >> >> > from core 0 to share memory and Receive (Read) it with another Core >> >> > (for >> >> > example Core 1), change it in Core 1 (for example X = X + 1) and >> >> > write >> >> > again in share memory. >> >> > I really don't know How I could do it, I wanna do this without using >> >> > NIC >> >> > ot >> >> > rte_eth at all, so simple and easy but I confused. >> >> > Please help me. >> >> > >> >> > PS. I know there are many example do more complex than this small >> >> > exercise >> >> > but all did it via NIC. >> >> >> >> What is your biggest challenge? Is it moving information between >> >> cores, or getting information into your application? >> >> >> >> Consider that most of the multiprocess examples in DPDK do two things: >> >> 1) Send/Receive packets to/from a NIC >> >> 2) Send packets between cores >> >> >> >> You obviously want to do #2, and looking at those examples should make >> >> how to do it fairly obvious. Is your challenge replacing #1 with >> >> something other than a NIC? If so, you *could* consider using a pcap >> >> PMD to just read packets from a file. In the past, I have used ring >> >> PMDs in conjunction with a secondary process which generates packets >> >> to inject arbitrarily formatted packets into my program. >> >> >> >> > >> >> > -- >> >> > M@hdi Mor@dm@nd B@die >> > >> > >> > >> > >> > -- >> > M@hdi Mor@dm@nd B@die > > > > > -- > M@hdi Mor@dm@nd B@die