diff mbox series

[08/10] test: l2fwd: use packet_data

Message ID 1486384684-14761-9-git-send-email-petri.savolainen@linaro.org
State Superseded
Headers show
Series Packet function inline | expand

Commit Message

Petri Savolainen Feb. 6, 2017, 12:38 p.m. UTC
Since l2fwd can assume that all packets are Ethernet. Also
odp_packet_data() points to the first byte of the frame directly
after packet input.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
 test/common_plat/performance/odp_l2fwd.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

-- 
2.8.1
diff mbox series

Patch

diff --git a/test/common_plat/performance/odp_l2fwd.c b/test/common_plat/performance/odp_l2fwd.c
index 9864c64..8f5c5e1 100644
--- a/test/common_plat/performance/odp_l2fwd.c
+++ b/test/common_plat/performance/odp_l2fwd.c
@@ -241,15 +241,13 @@  static inline void fill_eth_addrs(odp_packet_t pkt_tbl[],
 
 		odp_packet_prefetch(pkt, 0, ODPH_ETHHDR_LEN);
 
-		if (odp_packet_has_eth(pkt)) {
-			eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
+		eth = odp_packet_data(pkt);
 
-			if (gbl_args->appl.src_change)
-				eth->src = gbl_args->port_eth_addr[dst_port];
+		if (gbl_args->appl.src_change)
+			eth->src = gbl_args->port_eth_addr[dst_port];
 
-			if (gbl_args->appl.dst_change)
-				eth->dst = gbl_args->dst_eth_addr[dst_port];
-		}
+		if (gbl_args->appl.dst_change)
+			eth->dst = gbl_args->dst_eth_addr[dst_port];
 	}
 }