From patchwork Tue Jan 23 09: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: 125485 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1633257ljf; Tue, 23 Jan 2018 01:04:20 -0800 (PST) X-Google-Smtp-Source: AH8x225mav9yGhusDQVFlWVjxzUM0XnqGGKD5UVGjGgbzGJvEQSlww9srQTDmryTmhQg2A/kkkXA X-Received: by 10.237.61.66 with SMTP id h2mr2596714qtf.268.1516698260070; Tue, 23 Jan 2018 01:04:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516698260; cv=none; d=google.com; s=arc-20160816; b=a4UsJlRBqKX6Pu+tYdbb8FZbguRXmFt3tlRpFXmQwoNYQF3ICM4vwhovaPoEuXPUJV 7u04PZOJXAJ86taWa9LVXBSs5ASLmnbbqc/euxe33GhLzFVf2KYfiBPiNU4osf3HfPBL W5tBDiRIi5QowwJIB0vnUpYQkpZO2HAHWL3dKtU8iGFfRBwEWDd4a1FVZDUWjJma7fBy AwUipDdsCSNJQsURM6oF1471uTjTY41QzpFlLIiEgCSgkvF/s1e+BEjTvFjMSebReAGU bS//1UZqSFDwM0pCR1xf/UQhz6rc+TNlnnM6G7q9upG5XhE8PTCiC0aA1mjjP8bO/b9L lM2A== 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=fL2qGBrIZJog3/CrujwOf8X884eU6lCDg+PAd1i5q34=; b=VWbsRa9X1rQZu9cLHSdYMRvxPQlMUH+JjjqZFeHYszr6Tm1w2sxkU4J78XEqgbNAlY YvIROQ/s7Mb/W6WHB29wCPHAOg2KukK4a9GWQdyeniYZRKngMNvV1+rCr4hivo0u+6yR 6+ZzfQkzy+fsP+rPLPcukv6eXRROmmL31g1SjpNf4xnwq5mE4AjN1FO1UNJaZhNkTo5C kF++LjRY7oDY18EmBWejyof2PgaYlOWd9tDSAUPsKb4STKFx/peH9GfdP3n7nDXOiUn0 elAYgOZPEK8xphbYW+Y4C3N3LRThI/X5Y80AII53qgAh7zlvud2DYJKdNr3okWwICXge sA0w== 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 v62si3127579qkd.376.2018.01.23.01.04.19; Tue, 23 Jan 2018 01:04:20 -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 B28ED61768; Tue, 23 Jan 2018 09:04:19 +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 D587961794; Tue, 23 Jan 2018 09:01:02 +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 2707B609A8; Tue, 23 Jan 2018 09:00:27 +0000 (UTC) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [77.88.28.106]) by lists.linaro.org (Postfix) with ESMTPS id 3F7C960887 for ; Tue, 23 Jan 2018 09:00:18 +0000 (UTC) Received: from mxback6o.mail.yandex.net (mxback6o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::20]) by forward103p.mail.yandex.net (Yandex) with ESMTP id 77272218258E for ; Tue, 23 Jan 2018 12: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 P3SM1TX6EX-0G5K2q8g; Tue, 23 Jan 2018 12:00:16 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id VKzM4bguQ1-0FDmODVv; Tue, 23 Jan 2018 12: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: Tue, 23 Jan 2018 12:00:09 +0300 Message-Id: <1516698014-28886-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> References: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 392 Subject: [lng-odp] [PATCH API-NEXT v4 1/6] 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 392 (psavol:next-user-ptr-init-rebase) ** https://github.com/Linaro/odp/pull/392 ** Patch: https://github.com/Linaro/odp/pull/392.patch ** Base sha: 4508f410a04cf1657d607d24aa2530a42ef011f7 ** Merge commit sha: 3781732a78e4a3f0347b6b4299e9753da3929a42 **/ 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 d78c6c37e..bd90ee156 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_ALIGNED_CACHE 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 2ac356785..735670479 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -36,7 +36,7 @@ const _odp_packet_inline_offset_t ODP_ALIGNED_CACHE _odp_packet_inline = { .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), @@ -266,7 +266,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: @@ -1259,9 +1259,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) @@ -1932,7 +1932,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 Tue Jan 23 09: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: 125480 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1631928ljf; Tue, 23 Jan 2018 01:01:36 -0800 (PST) X-Google-Smtp-Source: AH8x225rfNTSbC8poaMFsPlDTWwXo06yU16N57ltSnD4hwOxVGKw/jpoWXsvjUYWL+ORoJ2iZzA7 X-Received: by 10.55.207.156 with SMTP id v28mr2378277qkl.36.1516698095959; Tue, 23 Jan 2018 01:01:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516698095; cv=none; d=google.com; s=arc-20160816; b=E/nL7ohE+kuyd09ceHOxBbwY28BrGJytlLuLOorhBQFOfd1ZLutkJlJ9DN5PoVkGJl 2ZAyxjg2ZhpLGQulzpwEeFA3/2Nb62ff7TGKlaW4q1AjPDOyg1zR5lGTINQa5ILnmIjy feRChwW+gVixvxq6Pp5ct4uo37WyPLp8GfVs9wplacegVAfQll47RmjgvUmqIZqSoCXm S/1achwMBKaapHXs2kY375w+O1OsdmXdOwP+jsy4NGlfgQfe9jWonJDe8LTWOF+T/6+g /OSMmCt48XD+FVE2Fnjv9lU9ZCMrrrTHH8Yn9AktasckUfsx3WQwvu73VEiujY5tHBFW k5uw== 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=jiTdfxodhnsyhOwcmz/jqr7npVHmTphS+fXFSq0O7Wc=; b=y4dQ3Rd3JelYpGBAv5bb4M3SSpr/VJd86Yxh3ciwYheNdRwlnrwq65+JcwgqkurijF h1AF+17APLk+DqGFOd3vWlIr+Cv2XxgUvCgcbq+SmuRBEWqc0XTwtXxvOihL0rB22/l8 JHXPBCkG8cTFTuXJEDVqbX9/YZuFrv7UZbI6XF5irEMCPs9Cz3r7IvRMdZntGhbUqPf3 L8N3obQslAra+zkSW6x4dq4KGz0h1rpuHmyEt1AAbY4R5W9M2CjP9Jh4eVvi9V4O7lda HHqOdlVxgVM7gObgWoav215mOpEpLvk1aZts3Gd8Nh0IjLQHvV6j2k5fQLow1zZiRgpB CWVA== 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 p80si4058889qkp.168.2018.01.23.01.01.35; Tue, 23 Jan 2018 01:01:35 -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 6C941609A2; Tue, 23 Jan 2018 09:01:35 +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 57A1D61698; Tue, 23 Jan 2018 09:00:34 +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 43E37608A2; Tue, 23 Jan 2018 09:00:23 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id F077B608A2 for ; Tue, 23 Jan 2018 09:00:18 +0000 (UTC) Received: from mxback19j.mail.yandex.net (mxback19j.mail.yandex.net [IPv6:2a02:6b8:0:1619::95]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 4F5345104021 for ; Tue, 23 Jan 2018 12:00:17 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback19j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id S9JyVTUgqw-0HGu5DbW; Tue, 23 Jan 2018 12:00:17 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id VKzM4bguQ1-0GDWGduv; Tue, 23 Jan 2018 12: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: Tue, 23 Jan 2018 12:00:10 +0300 Message-Id: <1516698014-28886-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> References: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 392 Subject: [lng-odp] [PATCH API-NEXT v4 2/6] linux-gen: packet: hide internal definitions from Doxygen 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 This internal header file is included from API files and thus Doxygen sees it. Use Doxygen tag @cond to hide implementation internal definitions. Dummy Doxygen doxumentation is not needed any more. Signed-off-by: Petri Savolainen --- /** Email created from pull request 392 (psavol:next-user-ptr-init-rebase) ** https://github.com/Linaro/odp/pull/392 ** Patch: https://github.com/Linaro/odp/pull/392.patch ** Base sha: 4508f410a04cf1657d607d24aa2530a42ef011f7 ** Merge commit sha: 3781732a78e4a3f0347b6b4299e9753da3929a42 **/ .../include/odp/api/plat/packet_inline_types.h | 100 +++++++++------------ 1 file changed, 44 insertions(+), 56 deletions(-) diff --git a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h index 2ac75152f..091598c27 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h @@ -20,101 +20,89 @@ extern "C" { #include -/** @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; +/** @endcond */ + #ifdef __cplusplus } #endif From patchwork Tue Jan 23 09: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: 125484 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1633200ljf; Tue, 23 Jan 2018 01:04:13 -0800 (PST) X-Google-Smtp-Source: AH8x2251CwD7yMXIfxdi9O4MZS1TdZwXKcjrUNep0FFQJjoc57F0R25IrDzy1fhXwepXMirh9l8j X-Received: by 10.55.73.1 with SMTP id w1mr2515636qka.215.1516698252846; Tue, 23 Jan 2018 01:04:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516698252; cv=none; d=google.com; s=arc-20160816; b=U377YMLCpcNLRMnsz74GJiGm6Os+htCGju9iQw7G53PEyEx6WRs5Z5ARE5S1/ZkDMi a0eti8E+kJKhFA4kE4gJDE3IU3JTgnyR8GcPjoIKILL9XCiFT1SR7pNvwAE+VFRDpFAP ScnfnPfc8LPp60Np5A3HL1C2vbz1qI0Yc4OvQoCMHRXi54yeygljOYqho936edPrDR5T hqZ6Yd7rcksmJftnGhwzjzmrRySqJGFQaDcHG33fCmATYVrNqYMaRTWqBecJSN+aOeRb /P3vrM69Isugdl0iRl07Mw7KNd1qhchW2Ecw5Me67ULWDqA+BdT3d/l0QG3xctlqrk6g S/+g== 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=pxBduH5r3QU3w2eB4XdYz0wY53FOQ8yJiJnRlBNhOu0=; b=rTLTW8RF7WmhVHlY63fGoIGs+FTkqMTwHXf7UMgQeBg/qRJ1VrvSruz4FO8z/U4aXB Q/Gzn85z28zhJ+vnZTRWQZtHw84LC+A7mAxYjlLRJOLDkr8z9sX+wLVf95WbaLsPmPoU EeNjgaRsmXx1xQHgSmbLlvu0TldQmTiTlhOX0nXYEFybw7xdl4fEFwXQGvhb+igDF5GI /fh1tg4+ElmBcLDl9zjeJEYRX2mtviJdTjcGUbWHT9CmOV29upqP8jkLAMCCKdEssRpK /CP9KVS8AlfLh8/O1wLMazyKRSj6AbloJQHCFxwHFSgD4Ao5czDULMo8VfhJDpfPi+jX czKQ== 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 j12si12541179qke.300.2018.01.23.01.04.12; Tue, 23 Jan 2018 01:04:12 -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 82C5F609A2; Tue, 23 Jan 2018 09:04:12 +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 7F78361788; Tue, 23 Jan 2018 09:00:55 +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 A5CB061719; Tue, 23 Jan 2018 09:00:25 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 825C4609A2 for ; Tue, 23 Jan 2018 09:00:20 +0000 (UTC) Received: from mxback10j.mail.yandex.net (mxback10j.mail.yandex.net [IPv6:2a02:6b8:0:1619::113]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 3AFCD43010EE for ; Tue, 23 Jan 2018 12:00:18 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback10j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 90X4gsLOTn-0IoGChvH; Tue, 23 Jan 2018 12:00:18 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id VKzM4bguQ1-0HDmiOPU; Tue, 23 Jan 2018 12:00:17 +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: Tue, 23 Jan 2018 12:00:11 +0300 Message-Id: <1516698014-28886-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> References: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 392 Subject: [lng-odp] [PATCH API-NEXT v4 3/6] 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. Signed-off-by: Petri Savolainen --- /** Email created from pull request 392 (psavol:next-user-ptr-init-rebase) ** https://github.com/Linaro/odp/pull/392 ** Patch: https://github.com/Linaro/odp/pull/392.patch ** Base sha: 4508f410a04cf1657d607d24aa2530a42ef011f7 ** Merge commit sha: 3781732a78e4a3f0347b6b4299e9753da3929a42 **/ .../include/odp/api/plat/packet_inline_types.h | 41 +++++++++++++++ .../linux-generic/include/odp_packet_internal.h | 59 +++------------------- 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, 88 insertions(+), 98 deletions(-) diff --git a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h index 091598c27..dbfc66411 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h @@ -101,6 +101,47 @@ typedef union { } _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 diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 184b8f40e..83bc27b12 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -33,65 +33,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 ipsec_err:1; /**< IPsec error */ - uint32_t crypto_err:1; /**< Crypto packet operation error */ - uint32_t l4_chksum:1; /**< L4 checksum error */ - }; -} error_flags_t; - -ODP_STATIC_ASSERT(sizeof(error_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"); +ODP_STATIC_ASSERT(sizeof(_odp_packet_flags_t) == sizeof(uint32_t), + "PACKET_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; @@ -232,8 +188,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 8c7eb0444..75757fe04 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -931,7 +931,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 bcb0541ba..e1d1c84b2 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -1418,7 +1418,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 e9ff9cbd6..b6192377e 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -831,7 +831,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; @@ -1408,7 +1408,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 735670479..c8ba69e25 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -339,9 +339,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; @@ -1310,16 +1309,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) @@ -1329,7 +1328,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; @@ -1342,7 +1341,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; @@ -1784,11 +1783,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, @@ -1990,7 +1986,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) @@ -2037,7 +2033,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; } @@ -2079,7 +2075,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; } @@ -2108,7 +2104,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; } @@ -2135,7 +2131,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; @@ -2154,7 +2150,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) { @@ -2183,7 +2179,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; @@ -2214,7 +2210,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; @@ -2265,7 +2261,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 adb1881e8..0c33666eb 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 7078be80a..63942cece 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 Tue Jan 23 09:00:12 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: 125481 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1632361ljf; Tue, 23 Jan 2018 01:02:25 -0800 (PST) X-Google-Smtp-Source: AH8x224GmTgj0d115QSOdkLIB2NAAI9xLalwVedtNqJQVYmkUuihcSyyd2UBAaJtA5EAvcrRVege X-Received: by 10.55.187.135 with SMTP id l129mr2552260qkf.322.1516698145308; Tue, 23 Jan 2018 01:02:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516698145; cv=none; d=google.com; s=arc-20160816; b=o738QkSN4m0UUTQeFtyysFuNRcyLEovpzBu4JwtXQxOfLw6/Ulc0KYSwzXafMF6Nhv MHxf/aAP8Gb+a00z/jZG/Vgj/IR0QDWI12ohJqUVW4xQ4aIzBnQiyw0Khl0s8tDeWPA4 2P0WsuB0Xep14xv3mG3SySM1dMffkfGPU848xCoLvoL4UZ0XO6MFepSUE2pXrsOzaXzD s0i2gdCh78RuxDmiCiugkPi2+rnT8Rvfiv93aUQvoaELlahlR/MMlGosgy4/sLPvFg/U zvEuHptTQUs8Bygr+TkHk+efkU6KsmlErUuHdFcCxI6ytjHgb0t3C7HDiYt16z+Zk1Lz JY+A== 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=a50hUqk/KZJQ06rrunCTH65n3czHJU2KdIbtqroTsZs=; b=clsXMTFBZ7whCNiMsPf9WXwMB5iTV92Hr8VNw7Pjibb8blxZekhrT9NYW/KXYYMad5 qOPQ44+jwvdtkMTpLibSzUMD6hyz2wBU4i4HmkSIJMTCQBi8JgNoiiNMrUBwjwtj3hmv MCfCrbExt9XFgCacByDgUzFABDLnPbrh65YtmVpYK7MNSneTxOBs7gUZ1bGhGVQOenzd ltfweAfwyzh/LZpbDP2EJ/Afi15wfDdeBricps2aI8uWb6pc34V4/JzEWSIRCrK4TfpX MhbeIQgeQfsGo/CRh8nbC9JxLouKbsA+BRk0Te16ZwGkUdf0L07sr0c50/FC2waQjUNm 2H5w== 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 l2si6818041qtd.285.2018.01.23.01.02.25; Tue, 23 Jan 2018 01:02:25 -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 EE44E61719; Tue, 23 Jan 2018 09:02:24 +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 B9FF961751; Tue, 23 Jan 2018 09:00:37 +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 A11E660953; Tue, 23 Jan 2018 09:00:23 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id 55FFD60855 for ; Tue, 23 Jan 2018 09:00:20 +0000 (UTC) Received: from mxback11j.mail.yandex.net (mxback11j.mail.yandex.net [IPv6:2a02:6b8:0:1619::84]) by forward104p.mail.yandex.net (Yandex) with ESMTP id E25261821FF for ; Tue, 23 Jan 2018 12:00:18 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback11j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id vl3Rpt91te-0IeSNo63; Tue, 23 Jan 2018 12:00:18 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id VKzM4bguQ1-0IDufHcV; Tue, 23 Jan 2018 12:00:18 +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: Tue, 23 Jan 2018 12:00:12 +0300 Message-Id: <1516698014-28886-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> References: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 392 Subject: [lng-odp] [PATCH API-NEXT v4 4/6] 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 392 (psavol:next-user-ptr-init-rebase) ** https://github.com/Linaro/odp/pull/392 ** Patch: https://github.com/Linaro/odp/pull/392.patch ** Base sha: 4508f410a04cf1657d607d24aa2530a42ef011f7 ** Merge commit sha: 3781732a78e4a3f0347b6b4299e9753da3929a42 **/ 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 a1111325e..3222ff5c2 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 Tue Jan 23 09:00:13 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: 125483 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1632793ljf; Tue, 23 Jan 2018 01:03:16 -0800 (PST) X-Google-Smtp-Source: AH8x224dYtZDEBVr2ACgsMkMfVK2G3MXQmsbAfIMEWAK6MSnV/WHD+jY42wpCscwsRhdMb7z7+RL X-Received: by 10.55.40.204 with SMTP id o73mr2598602qko.173.1516698196607; Tue, 23 Jan 2018 01:03:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516698196; cv=none; d=google.com; s=arc-20160816; b=Ey7BesXCIWCagdtdNi6XGP4uwMA2a/RoscqppnIcLNb7UoLmeK4VLc5VchyKvaEoSD LFxwy1EwnQ+SCDXJ3QyYBfA0dsUvqkr8Nhc2A5jZJtwwACE7lZ4z6o9Pjgpm1w66xKWP HuN6VzHSfCjxkeoevpXq862zE5nHgQvkgae00k7D+U2prRMUNb9iGJDAwuoNAp+wO4w2 ZuvnZ1um2WtPu42QS6EJZyUPxRR9MBdN+bQR+x6C73XxL669u4q4ILwwd4BJn97zJshM 6n9l8BlqhSjVQ0kMhgfTF0lqVReqRHYoER8tr/cXwbDCQEe+jsRhpyPxH5y31RzQ0xOD 3AfQ== 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=B2YoWrMZp9oCMWeLrmEe6KZarvIzz6HubNPL3CHYapk=; b=t8xskEI2RT/MPBxJMgOfyOPS+iDAZ7aiB1G7i0rc3teMHmEKsNuTbhxIQrXPUV00vo E6i6tb1i7YiL4dKUUu5jSngtCNsxfooKDniGfo3sFsGt8SwgCaXNTgmER1lws3YxXpgd 45wy+c7FF1M16oesG/23enbpq4jnQ4t5c9Jhd58323HUuqS9JBu45THsc/41eghFWQPt JwXXuVNxbf7Jc3dsDk8lBHfuyLUhopnQYScJwy5E+CgV7+KYilfEL1Odvpugbxnqv+Fh pPbuIYfLs5G6oal2UK58oC95Iw9jr5j2NycliMYaktji9kifE4JSGhz/C7eyMvrsCUwe 6j/w== 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 s126si2934764qkd.242.2018.01.23.01.03.16; Tue, 23 Jan 2018 01:03:16 -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 44C4161751; Tue, 23 Jan 2018 09:03:16 +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 1433B61763; Tue, 23 Jan 2018 09:00:48 +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 64C9561725; Tue, 23 Jan 2018 09:00:25 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id 00D2C609A8 for ; Tue, 23 Jan 2018 09:00:21 +0000 (UTC) Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward101p.mail.yandex.net (Yandex) with ESMTP id 8D9796A84176 for ; Tue, 23 Jan 2018 12:00:19 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id vjXNeVQMcI-0JBKQ3x6; Tue, 23 Jan 2018 12:00:19 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id VKzM4bguQ1-0ID0Ogcn; Tue, 23 Jan 2018 12:00:18 +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: Tue, 23 Jan 2018 12:00:13 +0300 Message-Id: <1516698014-28886-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> References: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 392 Subject: [lng-odp] [PATCH API-NEXT v4 5/6] 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 392 (psavol:next-user-ptr-init-rebase) ** https://github.com/Linaro/odp/pull/392 ** Patch: https://github.com/Linaro/odp/pull/392.patch ** Base sha: 4508f410a04cf1657d607d24aa2530a42ef011f7 ** Merge commit sha: 3781732a78e4a3f0347b6b4299e9753da3929a42 **/ .../include/odp/api/plat/packet_inline_types.h | 12 +++++++++--- .../linux-generic/include/odp/api/plat/packet_inlines.h | 7 +++++++ platform/linux-generic/odp_packet.c | 13 +++++++++++-- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h index dbfc66411..e8ebdabb1 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h @@ -44,6 +44,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; @@ -109,7 +110,12 @@ typedef union { uint32_t all_flags; struct { - uint32_t reserved1: 12; + uint32_t reserved1: 11; + + /* + * Init flags + */ + uint32_t user_ptr_set: 1; /* User has set a non-NULL value */ /* * Packet output flags @@ -135,8 +141,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/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h index 3416b9949..fe22d70a8 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -102,6 +102,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/odp_packet.c b/platform/linux-generic/odp_packet.c index c8ba69e25..dc16e9be4 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -43,7 +43,8 @@ const _odp_packet_inline_offset_t ODP_ALIGNED_CACHE _odp_packet_inline = { .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) }; @@ -1260,7 +1261,15 @@ 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); + + if (odp_unlikely(ptr == NULL)) { + pkt_hdr->p.flags.user_ptr_set = 0; + return; + } + + 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 Tue Jan 23 09:00:14 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: 125488 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1633894ljf; Tue, 23 Jan 2018 01:05:43 -0800 (PST) X-Google-Smtp-Source: AH8x226Hz0WvSHFtlu1ZidMGxmKZ0lkXM1WEYvw4eEWypI6hfktHrXOp6TSgjugqxpoUhLvLoXqi X-Received: by 10.55.160.14 with SMTP id j14mr2274224qke.305.1516698342907; Tue, 23 Jan 2018 01:05:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516698342; cv=none; d=google.com; s=arc-20160816; b=o5oj0pZTmlSsIXI/zqs2/4eowunb48ROn8zeN61dQRfjbFFvNf1PEqJTuo8lnoiQAA eoy0p7V4tip3ZDDr9nTZfiCVWKUtzBRHzmpMrFjdVUxPv3znWYgvLHlqgA0t+pHBv1t9 //e+GdNogMqr0StdlSQW0JDQKg9lMmSjxsvag4PZqzSPUyHb1/xaeEE8UglylQruzeDK gWgQF/LbglJ2Le7RWzatvu3K/IKJAtwfv1gTLYYvtbpxmnmCAm16h31JZi+v2lrH/SX5 vCfXDHUrkANNqxUdvTMEgDzG6He/oQGC/rkp2mZ3rp1OFlqIbG/WbIMWw0jJoLhc628W WtrQ== 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=wdBuCzhyJCZwx3ciujOFlZff4aXKn/Jwv2sqvx+DMP8=; b=QLBCxtAn3Y1Fu4IZlne7GobKbCdx3fh9RDNZS64fVmK2pZ9rZ17yeZer8KZeG4Xp4Q 9/2wcVvfDt4De2x2UvB55N6GKYX8k9LBnLBmGvP4inh0IY/9mmjfwJYYrVGfaWnl7HRc WJPOgTuJ9eEmMYO8CxOmVjcdkMYPSW7rd91D6l6KaK/YIiBZstsmTMpOBNuX74o51ont baGoB874T5T4qCqmDSzLts48R8Gj29zOzr4+zvJISJAoSTyyfmvVpF0oZ1mVrvdNO1xC X8FvURLavisdBerfpwo+5GU5hOE0zDAayCHlUSQ4aeseShcvMNIr39tWe7Vs3nl2fpbJ UX4w== 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 b27si2664402qkb.194.2018.01.23.01.05.42; Tue, 23 Jan 2018 01:05:42 -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 7E35D61719; Tue, 23 Jan 2018 09:05:42 +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 2CC5C617B5; Tue, 23 Jan 2018 09: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 0B74761722; Tue, 23 Jan 2018 09:00:32 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 592B161698 for ; Tue, 23 Jan 2018 09:00:21 +0000 (UTC) Received: from mxback9j.mail.yandex.net (mxback9j.mail.yandex.net [IPv6:2a02:6b8:0:1619::112]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 415C94302AA1 for ; Tue, 23 Jan 2018 12:00:20 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback9j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id O563I7QoIz-0Kve18k7; Tue, 23 Jan 2018 12:00:20 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id VKzM4bguQ1-0JDmm50V; Tue, 23 Jan 2018 12:00:19 +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: Tue, 23 Jan 2018 12:00:14 +0300 Message-Id: <1516698014-28886-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> References: <1516698014-28886-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 392 Subject: [lng-odp] [PATCH API-NEXT v4 6/6] 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 392 (psavol:next-user-ptr-init-rebase) ** https://github.com/Linaro/odp/pull/392 ** Patch: https://github.com/Linaro/odp/pull/392.patch ** Base sha: 4508f410a04cf1657d607d24aa2530a42ef011f7 ** Merge commit sha: 3781732a78e4a3f0347b6b4299e9753da3929a42 **/ test/validation/api/packet/packet.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 184473aba..7d19e0125 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,15 @@ void packet_test_context(void) CU_ASSERT(memcmp(udat, &test_packet_udata, sizeof(struct udata_struct)) == 0); + odp_packet_user_ptr_set(pkt, NULL); + CU_ASSERT(odp_packet_user_ptr(pkt) == NULL); + odp_packet_user_ptr_set(pkt, (void *)0xdead); + CU_ASSERT(odp_packet_user_ptr(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)