switch (policy) {
case BALANCE_XMIT_POLICY_LAYER2:
- eth_hdr = (struct ether_hdr *)buf->data;
+ eth_hdr = rte_pktmbuf_mtod(buf, struct ether_hdr *);
hash = ether_hash(eth_hdr);
hash ^= hash >> 8;
return hash % slave_count;
case BALANCE_XMIT_POLICY_LAYER23:
- eth_hdr = (struct ether_hdr *)buf->data;
+ eth_hdr = rte_pktmbuf_mtod(buf, struct ether_hdr *);
if (buf->ol_flags & PKT_RX_VLAN_PKT)
eth_offset = sizeof(struct ether_hdr) + sizeof(struct vlan_hdr);