diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 687bfa4965..042dc6fb9f 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -14,7 +14,7 @@ #include "testpmd.h" static inline void -print_ether_addr(const char *what, struct ether_addr *eth_addr) +print_ether_addr(const char *what, const struct ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -26,7 +26,8 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, int is_rx) { struct rte_mbuf *mb; - struct ether_hdr *eth_hdr; + const struct ether_hdr *eth_hdr; + struct ether_hdr _eth_hdr; uint16_t eth_type; uint64_t ol_flags; uint16_t i, packet_type; @@ -45,7 +46,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], (unsigned int) nb_pkts); for (i = 0; i < nb_pkts; i++) { mb = pkts[i]; - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_read(mb, 0, sizeof(_eth_hdr), &_eth_hdr); eth_type = RTE_BE_TO_CPU_16(eth_hdr->ether_type); ol_flags = mb->ol_flags; packet_type = mb->packet_type;