Is there a way to preserve metadata or any equivalent data while sending and receiving mbuf to and from kni interface in dpdk?? Thanks in advance.
If you are asking for an out of the box solution, then no there is no such functionality. Only length and frame content get copied to/from the host kernel. For more information please see kni_net_tx/rx() functions in kni_net.c: http://dpdk.org/browse/dpdk/tree/lib/librte_eal/linuxapp/kni/kni_net.c#n202
But sure, you can add whatever you want to each mbuf passing from/to kernel. The only requirement is that you have to change both user-space (i.e. DPDK lib/librte_kni) and kernel-space (i.e. lib/librte_eal/linuxapp/kni) to support the metadata you need.