From patchwork Fri Jan 12 16:00:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 124365 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2220543qgn; Fri, 12 Jan 2018 08:01:15 -0800 (PST) X-Google-Smtp-Source: ACJfBot+hocfaG/sacumcCgU0dcVgFtYSLNWRK6xG/ZbKwQn3kP+n8oqgplCSQKttNt8+4AiBrqR X-Received: by 10.129.87.23 with SMTP id l23mr13687862ywb.395.1515772875635; Fri, 12 Jan 2018 08:01:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515772875; cv=none; d=google.com; s=arc-20160816; b=SAT7puEqUgbiXKcAwgGkp4+t64fxY31cCidigRgNjfZu6ye7N9If/iN3jhs1r0ch83 eqVPOf0g1cRkKeL9FXzmipUSUeBDTERsB0Ja4JCbRcqK+t3tFdp/bfhCHyQR1FH9pCvM ehBabGocl8fhAa0PJDWNN9mSRcAkpECLhzHJCEuyNK9ek1OuiIOdazkFe8uIgivD66hG 7sKZlAtiNbbzYFJcR6GXm3tHZYH/83FBlB/8/+sd6Rf+iiqsTgmKYRyHaBeLhaDCrqXF +wdY2WIQPqXK/Uhe7bYrXQKyZGGs51XBiKSwuzVGKMynkmdLtztoq16bu9E7xZrc7vuy d1lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=EgPKYH9N7uNdi0dMjUl2gQh4HcVs4Oq5gIXzIkEv7Y8=; b=Uxjlqyz0nu1YB9jp6dggAEosi8AVwSgN3rZvrrzCkVjl8R1UkReYptskHg+GKzHMRZ o/TBPPXWXbB1Ha7EqZre4p2oIk4t+FNuIELiPTOZeY/lOjHyFdOVdd3xZDbyaAVuxz6s yIOCuPSPRFrAcquFnGrQY/oCoR25fZlmlU23Zf5FhVsj/nGHNWb2p+q42yorppK9y0XH L2l4ijaLI49LeqjyRNUlY0GcNU2gPjSnJZlG4r8eOFSasI1OzqvjM+xxc7yYvayPk5Jp RfyknsPIKGMSnYDG7GYrk2Xd2DnzFB21bxS5/CFnmd13PdMt78I9rYcifyVJ8XQrDFkJ DnbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id l188si3057017qkf.306.2018.01.12.08.01.14; Fri, 12 Jan 2018 08:01:15 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id EF8FF61722; Fri, 12 Jan 2018 16:01:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 44D2461525; Fri, 12 Jan 2018 16:00:58 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 37E2F616F5; Fri, 12 Jan 2018 16:00:52 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id 2408F61704 for ; Fri, 12 Jan 2018 16:00:15 +0000 (UTC) Received: from mxback7o.mail.yandex.net (mxback7o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::21]) by forward101j.mail.yandex.net (Yandex) with ESMTP id BEA561242A94 for ; Fri, 12 Jan 2018 19:00:13 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback7o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id kBxuDGpkDL-0DoiDPh3; Fri, 12 Jan 2018 19:00:13 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id rFPUuYkDkq-0DhilDH6; Fri, 12 Jan 2018 19:00:13 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 12 Jan 2018 19:00:07 +0300 Message-Id: <1515772811-30441-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515772811-30441-1-git-send-email-odpbot@yandex.ru> References: <1515772811-30441-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 388 Subject: [lng-odp] [PATCH API-NEXT v1 1/5] linux-gen: packet: single user ptr field X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Remove unnecessary union of user context u64/pointer. Rename the field for better code readability. Signed-off-by: Petri Savolainen --- /** Email created from pull request 388 (psavol:next-user-ptr-init) ** https://github.com/Linaro/odp/pull/388 ** Patch: https://github.com/Linaro/odp/pull/388.patch ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 9eaabe631329dd5cc41960f7cfb5592d60ff0499 **/ platform/linux-generic/include/odp_buffer_internal.h | 8 +------- platform/linux-generic/odp_packet.c | 10 +++++----- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index c56c5b01b..5252dc808 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -84,13 +84,7 @@ struct odp_buffer_hdr_t { struct odp_buffer_hdr_t *burst[BUFFER_BURST_SIZE]; /* --- Mostly read only data --- */ - - /* User context pointer or u64 */ - union { - uint64_t buf_u64; - void *buf_ctx; - const void *buf_cctx; /* const alias for ctx */ - }; + const void *user_ptr; /* Reference count */ odp_atomic_u32_t ref_cnt; diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 83a880947..2a977f064 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -35,7 +35,7 @@ const _odp_packet_inline_offset_t _odp_packet_inline ODP_ALIGNED_CACHE = { .pool = offsetof(odp_packet_hdr_t, buf_hdr.pool_ptr), .input = offsetof(odp_packet_hdr_t, input), .segcount = offsetof(odp_packet_hdr_t, buf_hdr.segcount), - .user_ptr = offsetof(odp_packet_hdr_t, buf_hdr.buf_ctx), + .user_ptr = offsetof(odp_packet_hdr_t, buf_hdr.user_ptr), .user_area = offsetof(odp_packet_hdr_t, buf_hdr.uarea_addr), .l2_offset = offsetof(odp_packet_hdr_t, p.l2_offset), .l3_offset = offsetof(odp_packet_hdr_t, p.l3_offset), @@ -265,7 +265,7 @@ static inline void packet_seg_copy_md(odp_packet_hdr_t *dst, dst->timestamp = src->timestamp; /* buffer header side packet metadata */ - dst->buf_hdr.buf_u64 = src->buf_hdr.buf_u64; + dst->buf_hdr.user_ptr = src->buf_hdr.user_ptr; dst->buf_hdr.uarea_addr = src->buf_hdr.uarea_addr; /* segmentation data is not copied: @@ -1258,9 +1258,9 @@ int odp_packet_input_index(odp_packet_t pkt) return odp_pktio_index(packet_hdr(pkt)->input); } -void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ctx) +void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ptr) { - packet_hdr(pkt)->buf_hdr.buf_cctx = ctx; + packet_hdr(pkt)->buf_hdr.user_ptr = ptr; } int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset) @@ -1931,7 +1931,7 @@ int _odp_packet_copy_md_to_packet(odp_packet_t srcpkt, odp_packet_t dstpkt) dsthdr->input = srchdr->input; dsthdr->dst_queue = srchdr->dst_queue; - dsthdr->buf_hdr.buf_u64 = srchdr->buf_hdr.buf_u64; + dsthdr->buf_hdr.user_ptr = srchdr->buf_hdr.user_ptr; if (dsthdr->buf_hdr.uarea_addr != NULL && srchdr->buf_hdr.uarea_addr != NULL) { memcpy(dsthdr->buf_hdr.uarea_addr, srchdr->buf_hdr.uarea_addr, From patchwork Fri Jan 12 16:00:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 124368 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2224508qgn; Fri, 12 Jan 2018 08:04:01 -0800 (PST) X-Google-Smtp-Source: ACJfBosAUqbTPZr+thDimscMR5cd+pGLAAeeMmOhIFLf/Ry6bHMDWdJ37gqWojNI5F4Z+JDtVClz X-Received: by 10.200.42.196 with SMTP id c4mr38086238qta.208.1515773041250; Fri, 12 Jan 2018 08:04:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515773041; cv=none; d=google.com; s=arc-20160816; b=LkiHbGdW4P3hRk2v66aomGM5Zmd8XhcviMUrWUxMt/WrEvvzJ9LZBw2tcWFK4qTclM IJGngxPOc6/jQVddCwaYdLABVXX2i/61i3m3BD0V5CN9aBOiqDgCNAvpMlkJhaCSHMZ9 iCazubq97UXisp4q5JWaBvHPgZlCx2IK05ZrQdPSRmVw0pIlu3LGFimPrkoLtMJ0nB7D l6u3cCVr68QjkjvkxB7+ANSj/Y4YKpWJ1bToh3e2e2j89jcJGTnWO1b7VDz41sgV4vrW Xar/ioITBCRsBTHWlipX02RkSTfyz8E2E6wznIbwa7QAyKlWyjOLANaMkZxhbkaYWRcs BETQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=CjkROtmriC1a0qV9SpiP8VE/CxDb1LL0+7T5aygQDLQ=; b=QoEP3wYWIGOz+1u2wm2JmnLbSQubjhKzjerGllyycCvyCvXD1UVmaDfcSJKvmMrG0u 34pv3tTVPIM0j6950sESg1kHaXlmFJaq+5L+ISbO1KmIOD1n66/+bvoj0NXwgvrecBS2 DA1nuNSwIM5YO/XYSNqmrutfaZxWeGA1BIPvZByn7RlYrh4kXJ2bAv8JzmTyagzqorVP xN53xCs5x71J5p8Yep6XRBdxwSWdehSFTe4xlumWsFrTUVeoe2AlQhQjc0R6lVB7c7rf fwCUTycpkGWy1SMkb/sTr4IO0ks+q1vFSTx6P5803s7Y2hooWJvTna6U7n6wcfuIGJp6 1aMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id f126si1313910qkb.101.2018.01.12.08.04.00; Fri, 12 Jan 2018 08:04:01 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id B5D6361731; Fri, 12 Jan 2018 16:04:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B4F0961722; Fri, 12 Jan 2018 16:01:21 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 8A3A161104; Fri, 12 Jan 2018 16:00:57 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id 3985D61524 for ; Fri, 12 Jan 2018 16:00:16 +0000 (UTC) Received: from mxback14j.mail.yandex.net (mxback14j.mail.yandex.net [IPv6:2a02:6b8:0:1619::90]) by forward105o.mail.yandex.net (Yandex) with ESMTP id BA43B4442A70 for ; Fri, 12 Jan 2018 19:00:14 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback14j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id XCqwaJfBtR-0E5uEYQc; Fri, 12 Jan 2018 19:00:14 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id rFPUuYkDkq-0DhWiXON; Fri, 12 Jan 2018 19:00:13 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 12 Jan 2018 19:00:08 +0300 Message-Id: <1515772811-30441-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515772811-30441-1-git-send-email-odpbot@yandex.ru> References: <1515772811-30441-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 388 Subject: [lng-odp] [PATCH API-NEXT v1 2/5] linux-gen: packet: clean up error and output flags X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Removed three unused error flags. Combined error and output flags into a single uint32_t. This saves four bytes and init of those bytes. There's still room for 12 flags in this word. Later on, these and input flags could be also combined. Moved the combined flag structure to packet types header, so that it can be accessed from inlined packet code. Also found away to hide these internal structures from doxygen. There's no need to add dummy doxygen documentation anymore. Signed-off-by: Petri Savolainen --- /** Email created from pull request 388 (psavol:next-user-ptr-init) ** https://github.com/Linaro/odp/pull/388 ** Patch: https://github.com/Linaro/odp/pull/388.patch ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 9eaabe631329dd5cc41960f7cfb5592d60ff0499 **/ .../include/odp/api/plat/packet_types.h | 141 +++++++++++++-------- .../linux-generic/include/odp_packet_internal.h | 57 +-------- platform/linux-generic/odp_classification.c | 2 +- platform/linux-generic/odp_crypto.c | 2 +- platform/linux-generic/odp_ipsec.c | 4 +- platform/linux-generic/odp_packet.c | 40 +++--- platform/linux-generic/odp_packet_flags.c | 14 +- platform/linux-generic/pktio/dpdk.c | 24 ++-- 8 files changed, 131 insertions(+), 153 deletions(-) diff --git a/platform/linux-generic/include/odp/api/plat/packet_types.h b/platform/linux-generic/include/odp/api/plat/packet_types.h index 98e5c4f03..14810e585 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_types.h @@ -67,101 +67,130 @@ typedef enum { #endif -/** @internal Packet field accessor */ +/** @cond _ODP_HIDE_FROM_DOXYGEN_ */ + +/* Packet field accessor */ #define _odp_pkt_get(pkt, cast, field) \ (*(cast *)(uintptr_t)((uint8_t *)pkt + _odp_packet_inline.field)) -/** @internal Packet header field offsets for inline functions */ +/* Packet header field offsets for inline functions */ typedef struct _odp_packet_inline_offset_t { - /** @internal field offset */ uint16_t data; - /** @internal field offset */ uint16_t seg_len; - /** @internal field offset */ uint16_t frame_len; - /** @internal field offset */ uint16_t headroom; - /** @internal field offset */ uint16_t tailroom; - /** @internal field offset */ uint16_t pool; - /** @internal field offset */ uint16_t input; - /** @internal field offset */ uint16_t segcount; - /** @internal field offset */ uint16_t user_ptr; - /** @internal field offset */ uint16_t user_area; - /** @internal field offset */ uint16_t l2_offset; - /** @internal field offset */ uint16_t l3_offset; - /** @internal field offset */ uint16_t l4_offset; - /** @internal field offset */ uint16_t flow_hash; - /** @internal field offset */ uint16_t timestamp; - /** @internal field offset */ uint16_t input_flags; } _odp_packet_inline_offset_t; -/** @internal Packet input & protocol flags */ +/* Packet input & protocol flags */ typedef union { - /** All input flags */ + /* All input flags */ uint64_t all; - /** Individual input flags */ + /* Individual input flags */ struct { - uint64_t dst_queue:1; /**< Dst queue present */ + uint64_t dst_queue:1; /* Dst queue present */ - uint64_t flow_hash:1; /**< Flow hash present */ - uint64_t timestamp:1; /**< Timestamp present */ + uint64_t flow_hash:1; /* Flow hash present */ + uint64_t timestamp:1; /* Timestamp present */ - uint64_t l2:1; /**< known L2 protocol present */ - uint64_t l3:1; /**< known L3 protocol present */ - uint64_t l4:1; /**< known L4 protocol present */ + uint64_t l2:1; /* known L2 protocol present */ + uint64_t l3:1; /* known L3 protocol present */ + uint64_t l4:1; /* known L4 protocol present */ - uint64_t eth:1; /**< Ethernet */ - uint64_t eth_bcast:1; /**< Ethernet broadcast */ - uint64_t eth_mcast:1; /**< Ethernet multicast */ - uint64_t jumbo:1; /**< Jumbo frame */ - uint64_t vlan:1; /**< VLAN hdr found */ - uint64_t vlan_qinq:1; /**< Stacked VLAN found, QinQ */ + uint64_t eth:1; /* Ethernet */ + uint64_t eth_bcast:1; /* Ethernet broadcast */ + uint64_t eth_mcast:1; /* Ethernet multicast */ + uint64_t jumbo:1; /* Jumbo frame */ + uint64_t vlan:1; /* VLAN hdr found */ + uint64_t vlan_qinq:1; /* Stacked VLAN found, QinQ */ - uint64_t snap:1; /**< SNAP */ - uint64_t arp:1; /**< ARP */ + uint64_t snap:1; /* SNAP */ + uint64_t arp:1; /* ARP */ - uint64_t ipv4:1; /**< IPv4 */ - uint64_t ipv6:1; /**< IPv6 */ - uint64_t ip_bcast:1; /**< IP broadcast */ - uint64_t ip_mcast:1; /**< IP multicast */ - uint64_t ipfrag:1; /**< IP fragment */ - uint64_t ipopt:1; /**< IP optional headers */ + uint64_t ipv4:1; /* IPv4 */ + uint64_t ipv6:1; /* IPv6 */ + uint64_t ip_bcast:1; /* IP broadcast */ + uint64_t ip_mcast:1; /* IP multicast */ + uint64_t ipfrag:1; /* IP fragment */ + uint64_t ipopt:1; /* IP optional headers */ - uint64_t ipsec:1; /**< IPSec packet. Required by the + uint64_t ipsec:1; /* IPSec packet. Required by the odp_packet_has_ipsec_set() func. */ - uint64_t ipsec_ah:1; /**< IPSec authentication header */ - uint64_t ipsec_esp:1; /**< IPSec encapsulating security + uint64_t ipsec_ah:1; /* IPSec authentication header */ + uint64_t ipsec_esp:1; /* IPSec encapsulating security payload */ - uint64_t udp:1; /**< UDP */ - uint64_t tcp:1; /**< TCP */ - uint64_t tcpopt:1; /**< TCP options present */ - uint64_t sctp:1; /**< SCTP */ - uint64_t icmp:1; /**< ICMP */ - - uint64_t color:2; /**< Packet color for traffic mgmt */ - uint64_t nodrop:1; /**< Drop eligibility status */ - - uint64_t l3_chksum_done:1; /**< L3 checksum validation done */ - uint64_t l4_chksum_done:1; /**< L4 checksum validation done */ - uint64_t ipsec_udp:1; /**< UDP-encapsulated IPsec packet */ + uint64_t udp:1; /* UDP */ + uint64_t tcp:1; /* TCP */ + uint64_t tcpopt:1; /* TCP options present */ + uint64_t sctp:1; /* SCTP */ + uint64_t icmp:1; /* ICMP */ + + uint64_t color:2; /* Packet color for traffic mgmt */ + uint64_t nodrop:1; /* Drop eligibility status */ + + uint64_t l3_chksum_done:1; /* L3 checksum validation done */ + uint64_t l4_chksum_done:1; /* L4 checksum validation done */ + uint64_t ipsec_udp:1; /* UDP-encapsulated IPsec packet */ }; } _odp_packet_input_flags_t; +/* + * Additional packet flags + */ +typedef union { + /* All flags */ + uint32_t all_flags; + + struct { + uint32_t reserved1: 12; + + /* + * Packet output flags + */ + uint32_t l3_chksum_set: 1; /* L3 chksum bit is valid */ + uint32_t l3_chksum: 1; /* L3 chksum override */ + uint32_t l4_chksum_set: 1; /* L4 chksum bit is valid */ + uint32_t l4_chksum: 1; /* L4 chksum override */ + uint32_t shaper_len_adj: 8; /* Adjustment for traffic mgr */ + + /* + * Error flags + */ + uint32_t snap_len_err: 1; /* Snap length error */ + uint32_t ip_err: 1; /* IP error */ + uint32_t l3_chksum_err: 1; /* L3 checksum error */ + uint32_t tcp_err: 1; /* TCP error */ + uint32_t udp_err: 1; /* UDP error */ + uint32_t l4_chksum_err: 1; /* L4 checksum error */ + uint32_t ipsec_err: 1; /* IPsec error */ + uint32_t crypto_err: 1; /* Crypto packet operation error */ + }; + + /* Flag groups */ + struct { + uint32_t reserved2: 12; + uint32_t other: 12; /* All other flags */ + uint32_t error: 8; /* All error flags */ + } all; + +} _odp_packet_flags_t; + +/** @endcond */ + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 346c2dc6f..a5304373d 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -32,65 +32,21 @@ extern "C" { /** Minimum segment length expected by packet_parse_common() */ #define PACKET_PARSE_SEG_LEN 96 - ODP_STATIC_ASSERT(sizeof(_odp_packet_input_flags_t) == sizeof(uint64_t), "INPUT_FLAGS_SIZE_ERROR"); -/** - * Packet error flags - */ -typedef union { - /* All error flags */ - uint32_t all; - - struct { - /* Bitfield flags for each detected error */ - uint32_t app_error:1; /**< Error bit for application use */ - uint32_t frame_len:1; /**< Frame length error */ - uint32_t snap_len:1; /**< Snap length error */ - uint32_t l2_chksum:1; /**< L2 checksum error, checks TBD */ - uint32_t ip_err:1; /**< IP error, checks TBD */ - uint32_t l3_chksum:1; /**< L3 checksum error */ - uint32_t tcp_err:1; /**< TCP error, checks TBD */ - uint32_t udp_err:1; /**< UDP error, checks TBD */ - uint32_t l4_chksum:1; /**< L4 checksum error */ - uint32_t ipsec_err:1; /**< IPsec error */ - uint32_t crypto_err:1; /**< Crypto packet operation error */ - }; -} error_flags_t; - -ODP_STATIC_ASSERT(sizeof(error_flags_t) == sizeof(uint32_t), +ODP_STATIC_ASSERT(sizeof(_odp_packet_flags_t) == sizeof(uint32_t), "ERROR_FLAGS_SIZE_ERROR"); -/** - * Packet output flags - */ -typedef union { - /* All output flags */ - uint32_t all; - - struct { - /** adjustment for traffic mgr */ - uint32_t shaper_len_adj:8; - - /* Bitfield flags for each output option */ - uint32_t l3_chksum_set:1; /**< L3 chksum bit is valid */ - uint32_t l3_chksum:1; /**< L3 chksum override */ - uint32_t l4_chksum_set:1; /**< L3 chksum bit is valid */ - uint32_t l4_chksum:1; /**< L4 chksum override */ - }; -} output_flags_t; - -ODP_STATIC_ASSERT(sizeof(output_flags_t) == sizeof(uint32_t), - "OUTPUT_FLAGS_SIZE_ERROR"); - /** * Packet parser metadata */ typedef struct { + /* Packet input flags */ _odp_packet_input_flags_t input_flags; - error_flags_t error_flags; - output_flags_t output_flags; + + /* Other flags */ + _odp_packet_flags_t flags; /* offset to L2 hdr, e.g. Eth */ uint16_t l2_offset; @@ -231,8 +187,7 @@ static inline void packet_init(odp_packet_hdr_t *pkt_hdr, uint32_t len) } pkt_hdr->p.input_flags.all = 0; - pkt_hdr->p.output_flags.all = 0; - pkt_hdr->p.error_flags.all = 0; + pkt_hdr->p.flags.all_flags = 0; pkt_hdr->p.l2_offset = 0; pkt_hdr->p.l3_offset = ODP_PACKET_OFFSET_INVALID; diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index 276430923..ade1a29a4 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -923,7 +923,7 @@ static inline cos_t *cls_select_cos(pktio_entry_t *entry, default_cos = cls->default_cos; /* Return error cos for error packet */ - if (pkt_hdr->p.error_flags.all) + if (pkt_hdr->p.flags.all.error) return cls->error_cos; /* Calls all the PMRs attached at the PKTIO level*/ for (i = 0; i < odp_atomic_load_u32(&default_cos->s.num_rule); i++) { diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 2038aa46b..e6975a602 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -1364,7 +1364,7 @@ int odp_crypto_int(odp_packet_t pkt_in, (rc_auth == ODP_CRYPTO_ALG_ERR_NONE); pkt_hdr = odp_packet_hdr(out_pkt); - pkt_hdr->p.error_flags.crypto_err = !op_result->ok; + pkt_hdr->p.flags.crypto_err = !op_result->ok; /* Synchronous, simply return results */ *pkt_out = out_pkt; diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index b023d308d..abade913f 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -828,7 +828,7 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, err: pkt_hdr = odp_packet_hdr(pkt); - pkt_hdr->p.error_flags.ipsec_err = 1; + pkt_hdr->p.flags.ipsec_err = 1; *pkt_out = pkt; @@ -1404,7 +1404,7 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, err: pkt_hdr = odp_packet_hdr(pkt); - pkt_hdr->p.error_flags.ipsec_err = 1; + pkt_hdr->p.flags.ipsec_err = 1; *pkt_out = pkt; return ipsec_sa; diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 2a977f064..ada5dca47 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -338,9 +338,8 @@ void *_odp_packet_map(void *pkt_ptr, uint32_t offset, uint32_t *seg_len, void packet_parse_reset(odp_packet_hdr_t *pkt_hdr) { /* Reset parser metadata before new parse */ - pkt_hdr->p.error_flags.all = 0; pkt_hdr->p.input_flags.all = 0; - pkt_hdr->p.output_flags.all = 0; + pkt_hdr->p.flags.all.error = 0; pkt_hdr->p.l2_offset = ODP_PACKET_OFFSET_INVALID; pkt_hdr->p.l3_offset = ODP_PACKET_OFFSET_INVALID; pkt_hdr->p.l4_offset = ODP_PACKET_OFFSET_INVALID; @@ -1309,16 +1308,16 @@ void odp_packet_l3_chksum_insert(odp_packet_t pkt, int insert) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - pkt_hdr->p.output_flags.l3_chksum_set = 1; - pkt_hdr->p.output_flags.l3_chksum = insert; + pkt_hdr->p.flags.l3_chksum_set = 1; + pkt_hdr->p.flags.l3_chksum = insert; } void odp_packet_l4_chksum_insert(odp_packet_t pkt, int insert) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - pkt_hdr->p.output_flags.l4_chksum_set = 1; - pkt_hdr->p.output_flags.l4_chksum = insert; + pkt_hdr->p.flags.l4_chksum_set = 1; + pkt_hdr->p.flags.l4_chksum = insert; } odp_packet_chksum_status_t odp_packet_l3_chksum_status(odp_packet_t pkt) @@ -1328,7 +1327,7 @@ odp_packet_chksum_status_t odp_packet_l3_chksum_status(odp_packet_t pkt) if (!pkt_hdr->p.input_flags.l3_chksum_done) return ODP_PACKET_CHKSUM_UNKNOWN; - if (pkt_hdr->p.error_flags.l3_chksum) + if (pkt_hdr->p.flags.l3_chksum_err) return ODP_PACKET_CHKSUM_BAD; return ODP_PACKET_CHKSUM_OK; @@ -1341,7 +1340,7 @@ odp_packet_chksum_status_t odp_packet_l4_chksum_status(odp_packet_t pkt) if (!pkt_hdr->p.input_flags.l4_chksum_done) return ODP_PACKET_CHKSUM_UNKNOWN; - if (pkt_hdr->p.error_flags.l4_chksum) + if (pkt_hdr->p.flags.l4_chksum_err) return ODP_PACKET_CHKSUM_BAD; return ODP_PACKET_CHKSUM_OK; @@ -1783,11 +1782,8 @@ void odp_packet_print(odp_packet_t pkt) len += odp_buffer_snprint(&str[len], n - len, buf); len += snprintf(&str[len], n - len, " input_flags 0x%" PRIx64 "\n", hdr->p.input_flags.all); - len += snprintf(&str[len], n - len, " error_flags 0x%" PRIx32 "\n", - hdr->p.error_flags.all); - len += snprintf(&str[len], n - len, - " output_flags 0x%" PRIx32 "\n", - hdr->p.output_flags.all); + len += snprintf(&str[len], n - len, " flags 0x%" PRIx32 "\n", + hdr->p.flags.all_flags); len += snprintf(&str[len], n - len, " l2_offset %" PRIu32 "\n", hdr->p.l2_offset); len += snprintf(&str[len], n - len, @@ -1989,7 +1985,7 @@ static inline uint16_t parse_eth(packet_parser_t *prs, const uint8_t **parseptr, if (ethtype < _ODP_ETH_LEN_MAX) { prs->input_flags.snap = 1; if (ethtype > frame_len - *offset) { - prs->error_flags.snap_len = 1; + prs->flags.snap_len_err = 1; return 0; } ethtype = odp_be_to_cpu_16(*((const uint16_t *)(uintptr_t) @@ -2036,7 +2032,7 @@ static inline uint8_t parse_ipv4(packet_parser_t *prs, const uint8_t **parseptr, if (odp_unlikely(ihl < _ODP_IPV4HDR_IHL_MIN) || odp_unlikely(ver != 4) || (l3_len > frame_len - *offset)) { - prs->error_flags.ip_err = 1; + prs->flags.ip_err = 1; return 0; } @@ -2078,7 +2074,7 @@ static inline uint8_t parse_ipv6(packet_parser_t *prs, const uint8_t **parseptr, /* Basic sanity checks on IPv6 header */ if ((odp_be_to_cpu_32(ipv6->ver_tc_flow) >> 28) != 6 || l3_len > frame_len - *offset) { - prs->error_flags.ip_err = 1; + prs->flags.ip_err = 1; return 0; } @@ -2107,7 +2103,7 @@ static inline uint8_t parse_ipv6(packet_parser_t *prs, const uint8_t **parseptr, if (*offset >= prs->l3_offset + odp_be_to_cpu_16(ipv6->payload_len)) { - prs->error_flags.ip_err = 1; + prs->flags.ip_err = 1; return 0; } @@ -2134,7 +2130,7 @@ static inline void parse_tcp(packet_parser_t *prs, const _odp_tcphdr_t *tcp = (const _odp_tcphdr_t *)*parseptr; if (tcp->hl < sizeof(_odp_tcphdr_t) / sizeof(uint32_t)) - prs->error_flags.tcp_err = 1; + prs->flags.tcp_err = 1; else if ((uint32_t)tcp->hl * 4 > sizeof(_odp_tcphdr_t)) prs->input_flags.tcpopt = 1; @@ -2153,7 +2149,7 @@ static inline void parse_udp(packet_parser_t *prs, uint32_t udplen = odp_be_to_cpu_16(udp->length); if (odp_unlikely(udplen < sizeof(_odp_udphdr_t))) - prs->error_flags.udp_err = 1; + prs->flags.udp_err = 1; if (odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT) == udp->dst_port && udplen > 4) { @@ -2182,7 +2178,7 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, prs->l3_offset = offset; if (layer <= ODP_PROTO_LAYER_L2) - return prs->error_flags.all != 0; + return prs->flags.all.error != 0; /* Set l3 flag only for known ethtypes */ prs->input_flags.l3 = 1; @@ -2213,7 +2209,7 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, } if (layer == ODP_PROTO_LAYER_L3) - return prs->error_flags.all != 0; + return prs->flags.all.error != 0; /* Set l4 flag only for known ip_proto */ prs->input_flags.l4 = 1; @@ -2264,7 +2260,7 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, break; } - return prs->error_flags.all != 0; + return prs->flags.all.error != 0; } /** diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 2e26ad601..bda85a8c6 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -24,7 +24,7 @@ int odp_packet_has_error(odp_packet_t pkt) { odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); - return pkt_hdr->p.error_flags.all != 0; + return pkt_hdr->p.flags.all.error != 0; } /* Get Input Flags */ @@ -34,9 +34,7 @@ int odp_packet_has_l2_error(odp_packet_t pkt) odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); /* L2 parsing is always done by default and hence no additional check is required */ - return pkt_hdr->p.error_flags.frame_len - | pkt_hdr->p.error_flags.snap_len - | pkt_hdr->p.error_flags.l2_chksum; + return pkt_hdr->p.flags.snap_len_err; } int odp_packet_has_l3(odp_packet_t pkt) @@ -48,7 +46,7 @@ int odp_packet_has_l3_error(odp_packet_t pkt) { odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); - return pkt_hdr->p.error_flags.ip_err; + return pkt_hdr->p.flags.ip_err; } int odp_packet_has_l4(odp_packet_t pkt) @@ -60,7 +58,7 @@ int odp_packet_has_l4_error(odp_packet_t pkt) { odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); - return pkt_hdr->p.error_flags.tcp_err | pkt_hdr->p.error_flags.udp_err; + return pkt_hdr->p.flags.tcp_err | pkt_hdr->p.flags.udp_err; } int odp_packet_has_eth_bcast(odp_packet_t pkt) @@ -169,14 +167,14 @@ void odp_packet_drop_eligible_set(odp_packet_t pkt, odp_bool_t drop) int8_t odp_packet_shaper_len_adjust(odp_packet_t pkt) { - retflag(pkt, output_flags.shaper_len_adj); + retflag(pkt, flags.shaper_len_adj); } void odp_packet_shaper_len_adjust_set(odp_packet_t pkt, int8_t adj) { odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); - pkt_hdr->p.output_flags.shaper_len_adj = adj; + pkt_hdr->p.flags.shaper_len_adj = adj; } /* Set Input Flags */ diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 54fd0bdef..177c9ec01 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -380,8 +380,8 @@ static inline int pkt_set_ol_rx(odp_pktin_config_opt_t *pktin_cfg, return -1; pkt_hdr->p.input_flags.l3_chksum_done = 1; - pkt_hdr->p.error_flags.ip_err = 1; - pkt_hdr->p.error_flags.l3_chksum = 1; + pkt_hdr->p.flags.ip_err = 1; + pkt_hdr->p.flags.l3_chksum_err = 1; } } @@ -396,8 +396,8 @@ static inline int pkt_set_ol_rx(odp_pktin_config_opt_t *pktin_cfg, return -1; pkt_hdr->p.input_flags.l4_chksum_done = 1; - pkt_hdr->p.error_flags.udp_err = 1; - pkt_hdr->p.error_flags.l4_chksum = 1; + pkt_hdr->p.flags.udp_err = 1; + pkt_hdr->p.flags.l4_chksum_err = 1; } } else if (pktin_cfg->bit.tcp_chksum && HAS_L4_PROTO(mbuf, RTE_PTYPE_L4_TCP)) { @@ -410,8 +410,8 @@ static inline int pkt_set_ol_rx(odp_pktin_config_opt_t *pktin_cfg, return -1; pkt_hdr->p.input_flags.l4_chksum_done = 1; - pkt_hdr->p.error_flags.tcp_err = 1; - pkt_hdr->p.error_flags.l4_chksum = 1; + pkt_hdr->p.flags.tcp_err = 1; + pkt_hdr->p.flags.l4_chksum_err = 1; } } @@ -572,18 +572,18 @@ static inline void pkt_set_ol_tx(odp_pktout_config_opt_t *pktout_cfg, ipv4_chksum_pkt = OL_TX_CHKSUM_PKT(pktout_cfg->bit.ipv4_chksum, pktout_capa->bit.ipv4_chksum, l3_proto_v4, - pkt_p->output_flags.l3_chksum_set, - pkt_p->output_flags.l3_chksum); + pkt_p->flags.l3_chksum_set, + pkt_p->flags.l3_chksum); udp_chksum_pkt = OL_TX_CHKSUM_PKT(pktout_cfg->bit.udp_chksum, pktout_capa->bit.udp_chksum, (l4_proto == _ODP_IPPROTO_UDP), - pkt_p->output_flags.l4_chksum_set, - pkt_p->output_flags.l4_chksum); + pkt_p->flags.l4_chksum_set, + pkt_p->flags.l4_chksum); tcp_chksum_pkt = OL_TX_CHKSUM_PKT(pktout_cfg->bit.tcp_chksum, pktout_capa->bit.tcp_chksum, (l4_proto == _ODP_IPPROTO_TCP), - pkt_p->output_flags.l4_chksum_set, - pkt_p->output_flags.l4_chksum); + pkt_p->flags.l4_chksum_set, + pkt_p->flags.l4_chksum); if (!ipv4_chksum_pkt && !udp_chksum_pkt && !tcp_chksum_pkt) return; From patchwork Fri Jan 12 16:00:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 124366 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2222444qgn; Fri, 12 Jan 2018 08:02:31 -0800 (PST) X-Google-Smtp-Source: ACJfBou6KXvVZx9auHihN9MDSTXgP7kIsgmBzC9a68MkjJd6R6INiQ1fGtV5kY2vBxG5Zv5sh+Ri X-Received: by 10.157.8.228 with SMTP id 91mr15203071otf.120.1515772951207; Fri, 12 Jan 2018 08:02:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515772951; cv=none; d=google.com; s=arc-20160816; b=hKzFpJGJaVYB+lAkHHn4Of1q+/+QvyO+mh47+bA+t1xKo3FAxNFOlePcOD9dsQALqA t6QMeGrgrlBUqNhyYeIR+OSJfyFBQjeP/pusGOfKZdYrtXA6dkGy0t3KypI8XTIoiIKN oSbRNKWpabeKzJ406p3ifFoJVuLThHHHAcbBDq7vF/d6UAh/dtpXLNyQ4j63ShQic14S XttfnmEMf49iZUuiskpLDB2/OFvVEhjJr62abslmJHl+0kc5YcL5NLI4ZidupTGaLtFx ECXlLRcMa0UecX1noCE9i9z0LkNP7UnCAsoViSh2l0xFcSpDCC1uLsUSxAoksBEqa7Mo L9mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=gpcLKHXEf1+x4KrdAQ58E78murwiuxqQIrzBt/IWeYY=; b=L/zopIVtkYHW+yUdnLbYvPMW/jxvFIlU5DDFYqPNCntZ4UJh4QNjM5k3S6VRHirubR VM5z5ce3XLnspFXVMDEqIQDJ0DIFGr5xjWXItjuBdY+F7E88LX7DYZqZ7O580Q4aQJRn pxPKMWfTZxLMugsbbJXwdIqZ88I2LSvzzR8Kxveo1nfdnXkbplcVzUyKkUiEE1QNvJ5t QO1HUDOW0RrUZCgHLvdt6WfKF2g5tvlm/3TqypEBOYjESESmBgNK6xxvkMFInonAV1UM DBZyGy0pmbzHQAPb382jl0KmQUkeQfpebB8rgJiqZ5K6b0MfYmBhexl66pxFZ92tYA+N Z+/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id l2si12605qtd.59.2018.01.12.08.02.30; Fri, 12 Jan 2018 08:02:31 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id C34D4616F5; Fri, 12 Jan 2018 16:02:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 00D32608DE; Fri, 12 Jan 2018 16:01:06 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 5E54F60961; Fri, 12 Jan 2018 16:00:55 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id 8F5C86170E for ; Fri, 12 Jan 2018 16:00:16 +0000 (UTC) Received: from mxback9g.mail.yandex.net (mxback9g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:170]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 9816D1842F0 for ; Fri, 12 Jan 2018 19:00:15 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback9g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id kb7Jq2vSU7-0Fme6JQh; Fri, 12 Jan 2018 19:00:15 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id rFPUuYkDkq-0Eh81hOI; Fri, 12 Jan 2018 19:00:14 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 12 Jan 2018 19:00:09 +0300 Message-Id: <1515772811-30441-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515772811-30441-1-git-send-email-odpbot@yandex.ru> References: <1515772811-30441-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 388 Subject: [lng-odp] [PATCH API-NEXT v1 3/5] api: packet: initialize user ptr to NULL X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Require that implementation initializes the pointer value to NULL. Application can use the pointer more robustly when it can tell if the pointer has been set previously or not. Signed-off-by: Petri Savolainen --- /** Email created from pull request 388 (psavol:next-user-ptr-init) ** https://github.com/Linaro/odp/pull/388 ** Patch: https://github.com/Linaro/odp/pull/388.patch ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 9eaabe631329dd5cc41960f7cfb5592d60ff0499 **/ include/odp/api/spec/packet.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 3655f5899..8aca552f6 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -1341,7 +1341,10 @@ int odp_packet_input_index(odp_packet_t pkt); /** * User context pointer * - * Return previously stored user context pointer. + * Return previously stored user context pointer. If not otherwise documented, + * the pointer value is maintained over packet manipulating operations. + * Implementation initializes the pointer value to NULL during new packet + * creation (e.g. alloc and packet input) and reset. * * @param pkt Packet handle * @@ -1357,10 +1360,10 @@ void *odp_packet_user_ptr(odp_packet_t pkt); * value of type intptr_t. ODP may use the pointer for data prefetching, but * must ignore any invalid addresses. * - * @param pkt Packet handle - * @param ctx User context pointer + * @param pkt Packet handle + * @param user_ptr User context pointer */ -void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ctx); +void odp_packet_user_ptr_set(odp_packet_t pkt, const void *user_ptr); /** * User area address From patchwork Fri Jan 12 16:00:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 124367 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2223394qgn; Fri, 12 Jan 2018 08:03:10 -0800 (PST) X-Google-Smtp-Source: ACJfBosSk3V+E8kr+y2g1R1Z69M6FGoWuESKy44eB5GxgDCSejBfE9U5/vCn1gljD/lALx208reL X-Received: by 10.55.190.129 with SMTP id o123mr38030880qkf.333.1515772990327; Fri, 12 Jan 2018 08:03:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515772990; cv=none; d=google.com; s=arc-20160816; b=y6LcgbYWyg5UuWjEGJXlOYbAE9Adq4vQA7qE+iXlm36FqakQU0Wu59syAdRqcSxS81 Dx4we/ssBr/L6VsjOMZheVv+31Z8QvX2undMz9hOiovlTvceh+L1H83mF8GeQ+YjAPV5 1dhJgXQUjiCAyLnWEs+b6iD2EILsojz59S3mJmYYTDzfIcGYLQMvMPdVHbItATkV/R85 hqS3Sh6+1b3A466sF2loAi2EjintMR1B3yQUsTObKvOgCswHquZO8bTIgjWr5YpiX2FU UC5yHTzGe2uqG3Ni+XMSMdkxsWhCBo2Q//JJEx3OsfRm7EhxNvxSzIcziUOYka/Hbgnc BIng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=2bpYW7M4r7gsLLPmL1s80/VtfsnXtiOWonRfrhHfXk0=; b=X96yAwbPfRQ/7ZPvd96Dio/zdgLq2lW4RbFzp7n0AsTX1ZOUCvALAKFakPeOH9epLi 5hcUBvMpZWc6sxvJzQ6OuyYw0IQxfRC1sslIugLkb8l6OdqHmTL2JDNt+hcVlYq0WYJ5 krd2Iftxtoaeu8WS3OlX9bhMd9cCB0/Dw1s7//ngtPNSLC+/vQ5vjZOZtvDAB17XrDWT uIKS8lkDH3dotmrGuzOeZrGQrswFkTgLpMGNmoayr3WxeJqyRoIU31fm+Vcmtzs/5RP3 +WL3g1eDLOE+PXSSW6VKGSWfSx+gReK58IvibldntMWrdOrVcxcLAANaiRh2LMkrWRFW BCkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id m4si2314143qkc.171.2018.01.12.08.03.10; Fri, 12 Jan 2018 08:03:10 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 03D70616F5; Fri, 12 Jan 2018 16:03:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 63D0961725; Fri, 12 Jan 2018 16:01:14 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C216960961; Fri, 12 Jan 2018 16:00:56 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id 1010E6171C for ; Fri, 12 Jan 2018 16:00:18 +0000 (UTC) Received: from mxback6o.mail.yandex.net (mxback6o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::20]) by forward106p.mail.yandex.net (Yandex) with ESMTP id 25CE72D808C0 for ; Fri, 12 Jan 2018 19:00:16 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback6o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id VqyBBKAiMV-0GVmlLVm; Fri, 12 Jan 2018 19:00:16 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id rFPUuYkDkq-0FhKKC1Z; Fri, 12 Jan 2018 19:00:15 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 12 Jan 2018 19:00:10 +0300 Message-Id: <1515772811-30441-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515772811-30441-1-git-send-email-odpbot@yandex.ru> References: <1515772811-30441-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 388 Subject: [lng-odp] [PATCH API-NEXT v1 4/5] linux-gen: packet: initialize user ptr to NULL X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Use a flag to record if user pointer has been set. This avoids resetting the pointer in every alloc. Signed-off-by: Petri Savolainen --- /** Email created from pull request 388 (psavol:next-user-ptr-init) ** https://github.com/Linaro/odp/pull/388 ** Patch: https://github.com/Linaro/odp/pull/388.patch ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 9eaabe631329dd5cc41960f7cfb5592d60ff0499 **/ platform/linux-generic/include/odp/api/plat/packet_inlines.h | 7 +++++++ platform/linux-generic/include/odp/api/plat/packet_types.h | 12 +++++++++--- platform/linux-generic/odp_packet.c | 8 ++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h index b00b9c923..64c12377b 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -98,6 +98,13 @@ static inline int _odp_packet_num_segs(odp_packet_t pkt) /** @internal Inline function @param pkt @return */ static inline void *_odp_packet_user_ptr(odp_packet_t pkt) { + _odp_packet_flags_t flags; + + flags.all_flags = _odp_pkt_get(pkt, uint32_t, flags); + + if (flags.user_ptr_set == 0) + return NULL; + return _odp_pkt_get(pkt, void *, user_ptr); } diff --git a/platform/linux-generic/include/odp/api/plat/packet_types.h b/platform/linux-generic/include/odp/api/plat/packet_types.h index 14810e585..79398f1bc 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_types.h @@ -91,6 +91,7 @@ typedef struct _odp_packet_inline_offset_t { uint16_t flow_hash; uint16_t timestamp; uint16_t input_flags; + uint16_t flags; } _odp_packet_inline_offset_t; @@ -156,7 +157,12 @@ typedef union { uint32_t all_flags; struct { - uint32_t reserved1: 12; + uint32_t reserved1: 11; + + /* + * Init flags + */ + uint32_t user_ptr_set: 1; /* Ptr has been set vs. NULL */ /* * Packet output flags @@ -182,8 +188,8 @@ typedef union { /* Flag groups */ struct { - uint32_t reserved2: 12; - uint32_t other: 12; /* All other flags */ + uint32_t reserved2: 11; + uint32_t other: 13; /* All other flags */ uint32_t error: 8; /* All error flags */ } all; diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index ada5dca47..c2e05801e 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -42,7 +42,8 @@ const _odp_packet_inline_offset_t _odp_packet_inline ODP_ALIGNED_CACHE = { .l4_offset = offsetof(odp_packet_hdr_t, p.l4_offset), .flow_hash = offsetof(odp_packet_hdr_t, flow_hash), .timestamp = offsetof(odp_packet_hdr_t, timestamp), - .input_flags = offsetof(odp_packet_hdr_t, p.input_flags) + .input_flags = offsetof(odp_packet_hdr_t, p.input_flags), + .flags = offsetof(odp_packet_hdr_t, p.flags) }; @@ -1259,7 +1260,10 @@ int odp_packet_input_index(odp_packet_t pkt) void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ptr) { - packet_hdr(pkt)->buf_hdr.user_ptr = ptr; + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); + + pkt_hdr->buf_hdr.user_ptr = ptr; + pkt_hdr->p.flags.user_ptr_set = 1; } int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset) From patchwork Fri Jan 12 16:00:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 124369 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2226719qgn; Fri, 12 Jan 2018 08:05:45 -0800 (PST) X-Google-Smtp-Source: ACJfBotPeLlCn45OvMscprIAhXFIYAXLTYQMIQcdyAPdO5rRcrQAyYsN3zUpUAY5/0PNtRBb/Ifh X-Received: by 10.200.18.202 with SMTP id b10mr12502167qtj.152.1515773145552; Fri, 12 Jan 2018 08:05:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515773145; cv=none; d=google.com; s=arc-20160816; b=sQdWjYeiJwrLskiVE6LtnW7aMpVoOYIG5GDEe7WTvlrpexlLOmUIxeQiGYfovnknCh qnP1MgzUyN5BaYMXzCEHJF5JUpJVbLlPMPciO2FUWPUNfFbiR8qcwHe0YfVAXJtu6mtz eunZBCzpGHiUeJbf4oJhqjCGfgOishL+LrG4YzIvdzS83PrvVFrAcI4P+hSQYQ6c8fcF 2BUMgI95ghlkCxA/ZYzRd2yyxKB25vU0GsFPOiTf+YGnPhjU171DQ8bf0NMB/mQxhThZ Rk+1JyVJEXE46LL9oZ2+vj9Cs06UNeBxgOtY5e0liAM8ffRrxZ7laPhoAFQJAC2z21Jp 8Lsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=O/aJVVcFutI9Q2b0eobuoQx7O7HzksKzlvwErepJmVI=; b=rze4v8udADY6kcafti++jl/IInOWXWRHhgeK+unNZoDmAPsohzHZfQGMyOkGOjetPq OErBRD9MoTxDBnDSIqyXCnV6C3phZYNJARYTaHBi6OzXsP0kJ9640jn1D1APSf0vJU0P udOoWxxvSwvHObOyJ5HApwSduwTIeCElrPOkVd3K93cxpi8ExV0B9yEVgVQx1piNVKng d2A8n//8Ld62qpx2tOlsB2Ho5e2fgtaB5jmwUdcMMONW4EcOxpEAe6hgmxVXSpc+tCHX JGwo2aj3r2VNEIcm8ClYrZzc7mCh11lHq+F5UsnoHRe9eczzNmO/RLDxFQAWOrj2fpbx k6rg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id 10si7477467qtp.445.2018.01.12.08.05.45; Fri, 12 Jan 2018 08:05:45 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 3D07461527; Fri, 12 Jan 2018 16:05:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id E22C46174B; Fri, 12 Jan 2018 16:01:30 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 4FE99616F5; Fri, 12 Jan 2018 16:01:01 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id AA68561722 for ; Fri, 12 Jan 2018 16:00:19 +0000 (UTC) Received: from mxback7g.mail.yandex.net (mxback7g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:168]) by forward101o.mail.yandex.net (Yandex) with ESMTP id D6916134224B for ; Fri, 12 Jan 2018 19:00:16 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback7g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id McjG9tYiRI-0G0GBQVF; Fri, 12 Jan 2018 19:00:16 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id rFPUuYkDkq-0GhWA3dl; Fri, 12 Jan 2018 19:00:16 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 12 Jan 2018 19:00:11 +0300 Message-Id: <1515772811-30441-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515772811-30441-1-git-send-email-odpbot@yandex.ru> References: <1515772811-30441-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 388 Subject: [lng-odp] [PATCH API-NEXT v1 5/5] validation: packet: test user pointer init to NULL X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Test if user pointer is NULL after alloc and reset. Signed-off-by: Petri Savolainen --- /** Email created from pull request 388 (psavol:next-user-ptr-init) ** https://github.com/Linaro/odp/pull/388 ** Patch: https://github.com/Linaro/odp/pull/388.patch ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 9eaabe631329dd5cc41960f7cfb5592d60ff0499 **/ test/validation/api/packet/packet.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 75e50d531..3b80e9919 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -290,6 +290,9 @@ void packet_test_alloc_free(void) CU_ASSERT(odp_packet_to_u64(packet) != odp_packet_to_u64(ODP_PACKET_INVALID)); + /* User pointer should be NULL after alloc */ + CU_ASSERT(odp_packet_user_ptr(packet) == NULL); + /* Pool should have only one packet */ CU_ASSERT_FATAL(odp_packet_alloc(pool, packet_len) == ODP_PACKET_INVALID); @@ -369,6 +372,9 @@ void packet_test_alloc_free_multi(void) CU_ASSERT(subtype == ODP_EVENT_PACKET_BASIC); CU_ASSERT(odp_packet_to_u64(packet[i]) != odp_packet_to_u64(ODP_PACKET_INVALID)); + + /* User pointer should be NULL after alloc */ + CU_ASSERT(odp_packet_user_ptr(packet[i]) == NULL); } /* Pools should have no more packets */ @@ -648,7 +654,12 @@ void packet_test_context(void) CU_ASSERT(memcmp(udat, &test_packet_udata, sizeof(struct udata_struct)) == 0); + odp_packet_user_ptr_set(pkt, (void *)0xdead); + odp_packet_reset(pkt, packet_len); + + /* User pointer should be NULL after reset */ + CU_ASSERT(odp_packet_user_ptr(pkt) == NULL); } void packet_test_layer_offsets(void)