From patchwork Thu Dec 18 11:15:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 42418 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B4C2726C6B for ; Thu, 18 Dec 2014 11:15:53 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id ex7sf547059wid.3 for ; Thu, 18 Dec 2014 03:15:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=gzD554PmGlcA0YtSTWto0HhStI3QrhHKZLO55Dli5VM=; b=PhrsXmGUr0NWi7Ov5Az7g2f6S9ciKQbjhsExmXVelivjvvpz47gU044avH498BqkrO JwUSN1mvCtlPMNZKKksoqzh7O/B0vovpaET1vCYKQvnpTLftzLKmIoEm7tU2rPF1Bobt +7R3mQ4CRHD6tc0J+l39Dkic2tiet4A7LwLt9iLVaNBWRrzPou6u1lmEG+Dv/qqp9pUv /aFE2IcPUilWOIKhJVxQiPNwnbN1Oz1N45OaQaFk82u04Gr0ijRrC4ZMht+x4/Bel44g L9kS8pkmkw/6m3t4ydocPOikzUrXWAwslx//4Fn/MjueVg503aNiw+he6WSKDkNU/LYn jDvw== X-Gm-Message-State: ALoCoQlFVZII0weoLwy8nw1zVtrQ4hUBwEx18DJ2oAy1qIYGdPA95KK+uIW3UHHtIaUtzqX4KG5u X-Received: by 10.181.13.147 with SMTP id ey19mr2058682wid.2.1418901352937; Thu, 18 Dec 2014 03:15:52 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.97 with SMTP id l1ls1274614lam.59.gmail; Thu, 18 Dec 2014 03:15:52 -0800 (PST) X-Received: by 10.152.29.6 with SMTP id f6mr1713061lah.32.1418901352515; Thu, 18 Dec 2014 03:15:52 -0800 (PST) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id ti8si6509667lbb.95.2014.12.18.03.15.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 03:15:52 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id 10so765495lbg.5 for ; Thu, 18 Dec 2014 03:15:52 -0800 (PST) X-Received: by 10.112.135.6 with SMTP id po6mr1602475lbb.69.1418901352383; Thu, 18 Dec 2014 03:15:52 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp1669151lbb; Thu, 18 Dec 2014 03:15:51 -0800 (PST) X-Received: by 10.224.121.142 with SMTP id h14mr2449614qar.80.1418901350735; Thu, 18 Dec 2014 03:15:50 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id l7si7848687qcz.4.2014.12.18.03.15.49 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 18 Dec 2014 03:15:50 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1Z3b-0005FH-MG; Thu, 18 Dec 2014 11:15:47 +0000 Received: from mail-oi0-f43.google.com ([209.85.218.43]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1Z3U-00058V-Lk for lng-odp@lists.linaro.org; Thu, 18 Dec 2014 11:15:40 +0000 Received: by mail-oi0-f43.google.com with SMTP id a3so231230oib.16 for ; Thu, 18 Dec 2014 03:15:35 -0800 (PST) X-Received: by 10.202.83.139 with SMTP id h133mr874224oib.90.1418901335216; Thu, 18 Dec 2014 03:15:35 -0800 (PST) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by mx.google.com with ESMTPSA id kv10sm3082501obb.15.2014.12.18.03.15.34 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 03:15:34 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 18 Dec 2014 05:15:29 -0600 Message-Id: <1418901329-32369-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-Topics: patch Subject: [lng-odp] [PATCHv3] linux-generic: packet: streamline packet add/rem data X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bill.fischofer@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Ensure packet parser metadata is copied from old to new packet as part of add/rem data operations. Signed-off-by: Bill Fischofer --- v3 removes reparsing in all cases platform/linux-generic/include/odp_packet_internal.h | 20 ++++++++++++++++++++ platform/linux-generic/odp_packet.c | 6 ++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 068f969..54a12b5 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -187,6 +187,26 @@ static inline void packet_init(pool_entry_t *pool, (pool->s.headroom + size); } +static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr, + odp_packet_hdr_t *dst_hdr) +{ + dst_hdr->input_flags = src_hdr->input_flags; + dst_hdr->error_flags = src_hdr->error_flags; + dst_hdr->output_flags = src_hdr->output_flags; + + dst_hdr->l2_offset = src_hdr->l2_offset; + dst_hdr->l3_offset = src_hdr->l3_offset; + dst_hdr->l4_offset = src_hdr->l4_offset; + dst_hdr->payload_offset = src_hdr->payload_offset; + + dst_hdr->vlan_s_tag = src_hdr->vlan_s_tag; + dst_hdr->vlan_c_tag = src_hdr->vlan_c_tag; + dst_hdr->l3_protocol = src_hdr->l3_protocol; + dst_hdr->l3_len = src_hdr->l3_len; + dst_hdr->l4_protocol = src_hdr->l4_protocol; + dst_hdr->l4_len = src_hdr->l4_len; +} + static inline void *packet_map(odp_packet_hdr_t *pkt_hdr, uint32_t offset, uint32_t *seglen) { diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 65e6288..a78b3d1 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -396,12 +396,13 @@ odp_packet_t odp_packet_add_data(odp_packet_t pkt, uint32_t offset, newpkt = ODP_PACKET_INVALID; } else { odp_packet_hdr_t *new_hdr = odp_packet_hdr(newpkt); + new_hdr->input = pkt_hdr->input; new_hdr->buf_hdr.buf_u64 = pkt_hdr->buf_hdr.buf_u64; odp_atomic_store_u32( &new_hdr->buf_hdr.ref_count, odp_atomic_load_u32( &pkt_hdr->buf_hdr.ref_count)); - _odp_packet_parse(newpkt); + copy_packet_parser_metadata(pkt_hdr, new_hdr); odp_packet_free(pkt); } } @@ -431,12 +432,13 @@ odp_packet_t odp_packet_rem_data(odp_packet_t pkt, uint32_t offset, newpkt = ODP_PACKET_INVALID; } else { odp_packet_hdr_t *new_hdr = odp_packet_hdr(newpkt); + new_hdr->input = pkt_hdr->input; new_hdr->buf_hdr.buf_u64 = pkt_hdr->buf_hdr.buf_u64; odp_atomic_store_u32( &new_hdr->buf_hdr.ref_count, odp_atomic_load_u32( &pkt_hdr->buf_hdr.ref_count)); - _odp_packet_parse(newpkt); + copy_packet_parser_metadata(pkt_hdr, new_hdr); odp_packet_free(pkt); } }