Skip to content

Instantly share code, notes, and snippets.

@zhangwei1984
Created September 1, 2016 04:43
Show Gist options
  • Save zhangwei1984/7f85d695d456991c5e6cbbef0b8aea8f to your computer and use it in GitHub Desktop.
Save zhangwei1984/7f85d695d456991c5e6cbbef0b8aea8f to your computer and use it in GitHub Desktop.
rust
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment