Skip to content

Instantly share code, notes, and snippets.

@zhangwei1984
zhangwei1984 / gist:36718ddd13e22c4227c9408a2277b2e7
Created April 9, 2017 02:19
case 1: firstly create VF with ixgbe, bind VF to dpdk
Two machines with 10G NIC directly connect each other
nn22 and nn23
step 1: create one VF on nn23
echo 1 > /sys/bus/pci/devices/0000:07:00.0/sriov_numvfs
Before bind VF to vfid-pci, try to ping this VF from nn22 (IP 12.0.0.22)
step 2: assign IP to this VF p2p1_0 12.0.0.23
p2p1 Link encap:Ethernet HWaddr 90:e2:ba:4a:e8:08
struct ether_hdr* eth;
struct rte_mbuf *pkt = batch->pkts[i];
eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
the related macro:
#define rte_pktmbuf_mtod_offset(m, t, o) ((t)((char *)(m)->buf_addr + (m)->data_off + (o)))
#define rte_pktmbuf_mtod(m, t) rte_pktmbuf_mtod_offset(m, t, 0)