From patchwork Wed Dec 17 01:57:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 42367 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A8BFD26C90 for ; Wed, 17 Dec 2014 01:57:50 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id l18sf9344924wgh.6 for ; Tue, 16 Dec 2014 17:57:49 -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=WuxMQCHbzJz27fMskic+Mr2v7BY/Qz97GPukWsBx80o=; b=KrDhs4Umel3cD5yskG72P/A5z1oNOrjEO5fIzNlhRAK/40hXc1+OYzBzqkDO29DRt/ jQfJASkcVRQSLdDBZzdURjxJBWHnoOBYZx0egjGV3Ktgg4HG/Q4eqvwMfemBLBHqET1C gm3uh4Yyu5Arn/9MqvLU/OVAqVDSzlPPzUNhQZmGc+q9GPD/BMneEEcmnOCa/B9srsKO 7t08brtgnLkAOqopIUPzBjejvLn2SAIu/q6Ft+M8gAT4neJLk6Chr3xREA44HTQ5EAAo DllUquX7ehAVosOC1GfH6Qa3xuwv233VvUseGzzcoxsxirf3zNoKpQS9sNBmIgjoDxfX SkBQ== X-Gm-Message-State: ALoCoQnHo4kans9gOTSpEfx7Hi+mEslZtD0GP8ivmIcvrWnyeUwPGqJtAl7gCWcBQsAUj4KIUNd3 X-Received: by 10.152.5.2 with SMTP id o2mr6053633lao.1.1418781469836; Tue, 16 Dec 2014 17:57:49 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.134 with SMTP id b6ls819163laa.27.gmail; Tue, 16 Dec 2014 17:57:49 -0800 (PST) X-Received: by 10.152.43.103 with SMTP id v7mr38719790lal.29.1418781469555; Tue, 16 Dec 2014 17:57:49 -0800 (PST) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id tz3si2394691lbb.66.2014.12.16.17.57.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Dec 2014 17:57:49 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id z12so11860787lbi.32 for ; Tue, 16 Dec 2014 17:57:49 -0800 (PST) X-Received: by 10.112.130.132 with SMTP id oe4mr38195461lbb.82.1418781469469; Tue, 16 Dec 2014 17:57:49 -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 ru5csp1216327lbb; Tue, 16 Dec 2014 17:57:48 -0800 (PST) X-Received: by 10.140.34.67 with SMTP id k61mr7433559qgk.95.1418781468070; Tue, 16 Dec 2014 17:57:48 -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 a92si2958845qge.117.2014.12.16.17.57.47 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 16 Dec 2014 17:57:48 -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 1Y13s1-000154-NE; Wed, 17 Dec 2014 01:57:45 +0000 Received: from mail-oi0-f44.google.com ([209.85.218.44]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y13rv-0000zN-Hm for lng-odp@lists.linaro.org; Wed, 17 Dec 2014 01:57:39 +0000 Received: by mail-oi0-f44.google.com with SMTP id e131so10496939oig.17 for ; Tue, 16 Dec 2014 17:57:34 -0800 (PST) X-Received: by 10.202.102.65 with SMTP id a62mr22968167oic.108.1418781454251; Tue, 16 Dec 2014 17:57:34 -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 a10sm1181177obh.7.2014.12.16.17.57.33 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Dec 2014 17:57:33 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Tue, 16 Dec 2014 19:57:28 -0600 Message-Id: <1418781448-20711-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-Topics: patch Subject: [lng-odp] [PATCHv2] 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.173 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 perser metadata is copied from old to new packet as part of add/rem data operations that omit packet reparsing. Signed-off-by: Bill Fischofer --- v2 Ensures that parser metadata is copied if we're not reparsing platform/linux-generic/include/odp_packet_internal.h | 20 ++++++++++++++++++++ platform/linux-generic/odp_packet.c | 12 ++++++++++-- 2 files changed, 30 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..43a9419 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -396,12 +396,16 @@ 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); + if (offset < pkt_hdr->payload_offset) + _odp_packet_parse(newpkt); + else + copy_packet_parser_metadata(pkt_hdr, new_hdr); odp_packet_free(pkt); } } @@ -431,12 +435,16 @@ 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); + if (offset < pkt_hdr->payload_offset) + _odp_packet_parse(newpkt); + else + copy_packet_parser_metadata(pkt_hdr, new_hdr); odp_packet_free(pkt); } }