diff mbox series

[API-NEXT,v1,1/1] linux-gen: pktio: dpdk: skip TX csum calculation if L3/L4 offsets are invalid

Message ID 1511366406-22668-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v1,1/1] linux-gen: pktio: dpdk: skip TX csum calculation if L3/L4 offsets are invalid | expand

Commit Message

Github ODP bot Nov. 22, 2017, 4 p.m. UTC
From: Bogdan Pricope <bogdan.pricope@linaro.org>


L3/L4 offsets may be invalid (ODP_PACKET_OFFSET_INVALID)
for a TX packet. This will prevent form providing the arguments
needed by dpdk for csum calculation.

Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org>

---
/** Email created from pull request 308 (bogdanPricope:api_next_tx_csum_crash)
 ** https://github.com/Linaro/odp/pull/308
 ** Patch: https://github.com/Linaro/odp/pull/308.patch
 ** Base sha: b95e7d08043ba45d12635c5afaa3fbf3a07ecc90
 ** Merge commit sha: a391a6f5609755883e71d89b00e5a589ec486744
 **/
 platform/linux-generic/pktio/dpdk.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c
index 5032b8dfb..9c211b4d7 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -545,6 +545,10 @@  static inline void pkt_set_ol_tx(odp_pktout_config_opt_t *pktout_cfg,
 	odp_bool_t ipv4_chksum_pkt, udp_chksum_pkt, tcp_chksum_pkt;
 	packet_parser_t *pkt_p = &pkt_hdr->p;
 
+	if (pkt_p->l3_offset == ODP_PACKET_OFFSET_INVALID ||
+	    pkt_p->l4_offset == ODP_PACKET_OFFSET_INVALID)
+		return;
+
 	l3_hdr = (void *)(mbuf_data + pkt_p->l3_offset);
 
 	if (check_proto(l3_hdr, &l3_proto_v4, &l4_proto))