[dpdk-dev] [PATCH v2 5/7] net/virtio_user: add vhost kernel support

Tan, Jianfeng jianfeng.tan at intel.com
Tue Jan 10 10:11:23 CET 2017

On 1/10/2017 4:46 PM, Thomas Monjalon wrote:
> 2017-01-10 14:11, Tan, Jianfeng:
>> On 1/9/2017 12:39 PM, Jason Wang wrote:
>>> On 2016年12月23日 15:14, Jianfeng Tan wrote:
>> [...]
>>>> +/* TUNSETIFF ifr flags */
>>>> +#define IFF_TAP          0x0002
>>>> +#define IFF_NO_PI        0x1000
>>>> +#define IFF_ONE_QUEUE    0x2000
>>>> +#define IFF_VNET_HDR     0x4000
>>>> +#define IFF_MULTI_QUEUE  0x0100
>>>> +#define IFF_ATTACH_QUEUE 0x0200
>>>> +#define IFF_DETACH_QUEUE 0x0400
>>> Do we really want to duplicate those things which has been exposed by
>>> uapi here?
>> You mean those defined in <linux/if_tun.h>? Redefine those common
>> macros, or include standard header file, with respective pros and cons.
>> DPDK prefers the redefinition way as far as I understand, doesn't it?
> What is the benefit of copying defines instead of including?

(1) Avoid compiling errors that old version missed some of macros.
(2) Better for portability (does not apply here).

I might take it for granted a little bit as I see some very popular open 
source projects behave like this way, like QEMU, HAProxy, etc.

More information about the dev mailing list