[dpdk-dev] [PATCH v3] librte_pmd_af_packet: add PMD for AF_PACKET-based virtual devices

Thomas Monjalon thomas.monjalon at 6wind.com
Mon Nov 24 17:16:15 CET 2014


> This is a Linux-specific virtual PMD driver backed by an AF_PACKET
> socket.  This implementation uses mmap'ed ring buffers to limit copying
> and user/kernel transitions.  The PACKET_FANOUT_HASH behavior of
> AF_PACKET is used for frame reception.  In the current implementation,
> Tx and Rx queues are always paired, and therefore are always equal
> in number -- changing this would be a Simple Matter Of Programming.
> 
> Interfaces of this type are created with a command line option like
> "--vdev=eth_af_packet0,iface=...".  There are a number of options availabe
> as arguments:
> 
>  - Interface is chosen by "iface" (required)
>  - Number of queue pairs set by "qpairs" (optional, default: 1)
>  - AF_PACKET MMAP block size set by "blocksz" (optional, default: 4096)
>  - AF_PACKET MMAP frame size set by "framesz" (optional, default: 2048)
>  - AF_PACKET MMAP frame count set by "framecnt" (optional, default: 512)
> 
> Signed-off-by: John W. Linville <linville at tuxdriver.com>
> ---
> This PMD is intended to provide a means for using DPDK on a broad
> range of hardware without hardware-specific PMDs and (hopefully)
> with better performance than what PCAP offers in Linux.  This might
> be useful as a development platform for DPDK applications when
> DPDK-supported hardware is expensive or unavailable.
> 
> New in v3:
> 
> -- Adopt awkward renaming (pmd_packet -> pmd_af_packet) in hopes of
>    getting something merged...

There are some remaining occurences of ETH_PACKET.
	% git grep -i eth_packet | wc -l
	19
	% sed -ri 's,ETH_PACKET,ETH_AF_PACKET,' lib/librte_pmd_af_packet/*
I fixed it. It seems there is a hope of getting it merged :D

> New in v2:
> 
> -- fixup some style issues found by check patch
> -- use if_index as part of fanout group ID
> -- set default number of queue pairs to 1

When building on Debian, I remembered that it cannot be enabled for all kernels.
As a first step, I disabled it in default configuration.
I don't know how we could handle it better. Is it sufficient to test
availability of flags like PACKET_FANOUT_FLAG_ROLLOVER or PACKET_QDISC_BYPASS?

Applied with changes explained above.

Is it possible to improve it in coming weeks?
Thanks
-- 
Thomas


More information about the dev mailing list