From: deco33000 Jog Subject: Re: DPDK - TX from lcore in packet distributor configuration Date: Wed, 21 Jan 2015 20:25:40 +0100 Message-ID: <3643611421868340@web4m.yandex.ru> References: <2523541421848850@web15h.yandex.ru> <20150121163040.GA11720@bricha3-MOBL3> <3621191421867764@web4m.yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: quoted-printable To: dev-VfR2kkLFssw@public.gmane.org Return-path: In-Reply-To: <3621191421867764-kzyHp1J20u1uio3avFS2gg@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 21.01.2015, 20:16, "deco33000 Jog" : > 21.01.2015, 17:43, "Bruce Richardson" : >> =9AOn Wed, Jan 21, 2015 at 03:00:50PM +0100, deco33000 Jog wrote: >>> =9A=9AHello, >>> >>> =9A=9A-- PROBLEM >>> =9A=9AI have a AF_PACKET socket which is in promiscuous mode to get a= ll the NIC traffic and let my apps do the whole stuff. >>> >>> =9A=9ASo I have one receiver and need to communicate the packet to di= fferent threads/processes (lcore) so that they can process the rest of th= e packet (tcp/udp...) >>> >>> =9A=9A-- QUESTION >>> =9A=9AI read about the packet distributor architecture which seems to= answer that need. >>> =9A=9Ahttp://dpdk.org/doc/guides/prog_guide/packet_distrib_lib.html >>> >>> =9A=9ABUT i fear that it be slow at resending the packet to the distr= ibutor which may already be overloaded by inputs from the net. Why pass b= ack the answer to the distributor if the lcore could send to the wire dir= ectly ? >>> >>> =9A=9AMy problem is going back to the distributor after the packet pr= ocessing. i would a direct send to the tx ring. >>> >>> =9A=9AIs it possible ? How ? =9ABy passing the TX pointer to the lcor= e ? >> =9AIf you sent up the NIC so that it has multiple queues for each thre= ad you can >> =9Ahave each worker send directly to the NIC. Without multiple queues,= they could >> =9Astill send directly, they will just have to use locking or some oth= er access >> =9Amechanism to mediate access to the common TX queue. >> =9AThe other problem with this approach is that sending packets indivi= dually is >> =9Aalmost always slower than sending them in bursts. To mitigate again= st this, >> =9Ayou could look to buffer packets inside the workers before transmit= ting them >> =9Aback out, but that could lead to packets being sent out of order - = not sure if >> =9Athat is a problem for you or not. >> >> =9AThe reason the distributor sample app sends the packets back to the= distributor >> =9Aafter worker processing is to overcome these limitations. There is = no additional >> =9Across-core round trip involved in sending a packet back to the dist= ributor along >> =9Awith the request, and having the distributor re-gather the packets = ensures ordering >> =9Awithin flows/tags is maintained. Thereafter packets can be burst-se= nt out an >> =9Aethernet port. >> >> =9AOut of interest, given you are using the AF_PACKET driver, what rat= e of packets >> =9Aper second are you looking at? >> >> =9A/Bruce > > Bruce, thanks, > > 1) > I am looking for saturation of a 1 Gb/s link not a 10 Gb/s yet. > I want to feel at home before going higher. > > I work with raw packets for security purposes. > Do you think AF_PACKET is not good enough ? Do DPDK enables another (mo= re efficient) solution (I may have missed it)? > > 2) > I tried Netmap and PF_RING too; i am currently seeking for my "weapon" = :) > I want to use it in a socket context for a custom webserver. > > At first i thought the packet return would incur a cross core operation= . > But the problem remains : > the distributor has to deal with Rx data and packets returned from the = workers as well. Even if it is fast, I think I prefer to buffer + send di= rectly form the worker to release the distributor from doing it. > i decided to avoid the Nagle algo as much as possible because i want th= e least latency as possible for my app. I modulate to to balance the trad= e-off though.