[03/14] testpmd: use rte_pktmbuf_mtod_offset

Message ID 20230505174813.133894-4-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series rte_pktmbuf_mtod_offset usage |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger May 5, 2023, 5:48 p.m. UTC
  Use helper macro.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test-pmd/ieee1588fwd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c
index 386d9f10e642..3371771751dd 100644
--- a/app/test-pmd/ieee1588fwd.c
+++ b/app/test-pmd/ieee1588fwd.c
@@ -138,8 +138,8 @@  ieee1588_packet_fwd(struct fwd_stream *fs)
 	 * Check that the received PTP packet is a PTP V2 packet of type
 	 * PTP_SYNC_MESSAGE.
 	 */
-	ptp_hdr = (struct ptpv2_msg *) (rte_pktmbuf_mtod(mb, char *) +
-					sizeof(struct rte_ether_hdr));
+	ptp_hdr = rte_pktmbuf_mtod_offset(mb, struct ptpv2_msg *,
+					  sizeof(struct rte_ether_hdr));
 	if (ptp_hdr->version != 0x02) {
 		printf("Port %u Received PTP V2 Ethernet frame with wrong PTP"
 		       " protocol version 0x%x (should be 0x02)\n",