[dpdk-users] KNI Threads/Cores

Ferruh Yigit ferruh.yigit at intel.com
Wed Jun 8 21:31:21 CEST 2016


On 6/8/2016 5:30 PM, Cliff Burdick wrote:
> Hi, I have an application with two sockets where each core I'm planning to
> transmit and receive a fairly large amount of traffic per core. Each core
> right now handles a single queue of either TX or RX of a given port. Across
> all the cores, I may be processing up to 12 ports. I also need to handle
> things like ARP and ping, so I'm going to add in the KNI driver to handle
> that. Since the amount of traffic I'm expecting that I'll need to forward
> to Linux is very small, it seems like I should be able to dedicate one
> lcore per socket to handle this functionality and have the dataplane cores
> pass the traffic off to this core using rte_kni_tx_burst().
> 
> My question is, first of all, is this possible? It seems like I can
> configure the KNI driver to start in "single thread" mode. From that point,
> I want to initialize one KNI device for each port, and have each kernel
> lcore on each processor handle that traffic. I believe if I call
> rte_kni_alloc with core_id set to the kernel lcore for each device, then in
> the end I'll have something like 6 KNI devices on socket one being handled
> by lcore 0, and 6 KNI devices on socket 2 being handled by lcore 31 as an
> example. Then my threads that are handling the dataplane tx/rx can simply
> be passed a pointer to their respective rte_kni device. Does this sound
> correct?

If rte_kni module used "single thread" mode, kernel core_id is not used
at all. For single thread mode, a single thread created, this is used to
for all kni devices and not able to pin to any specific lcore.

For what you have described, first need to insert module with
kthread_mode=multiple param. This will create a kernel thread per kni
interface. But I guess it is possible to provide same
rte_kni_conf->core_id for some of them, and yes rte_kni_conf->force_pin
is required, otherwise core_id is not useful. According your sample,
first 6 kni devices will have core_id value 0, and other 6 kni devices
will have core_id value 31, with all have force_bind set. This will
create 12 kernel threads, will bind 6 of them to core 0 and other 6 to
core 31.

> 
> Also, the sample says the core affinity needs to be set using taskset. Is
> that already taken care of with conf.core_id in rte_kni_alloc or do I still
> need to set it?
> 
> Thanks
> 



More information about the users mailing list