From patchwork Tue Dec 16 22:50:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 42365 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9FEFB26C8F for ; Tue, 16 Dec 2014 22:50:39 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id r20sf5572968wiv.1 for ; Tue, 16 Dec 2014 14:50:38 -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=MvExjBRVPDS936fQipjITOElMAY6ZpP74WUtjceoypI=; b=k81S1MPMaKHiMPpkTzlytKSoLkjNYspRD4FVgCaNY+8lxfo7q2ysO8KWYG3UmmBG7F OIsLWzrbxwI06IGRjVSKKdMId3FIPG0bNB1vsUhOBiRN3aXls+43wEBnQZ3PRGaNQZQM r8dbuw+V/vNAAZSXd8nfEQ3a/HRc4jkbFTIrhRZP8q3NFXwXo04Yp53oeV4tdeo341hB cLNv9673lPKk4zaHqPNkhum62COM8CO7nrtB9kn6jwS9PoUpk9GsDtC3y2JYE4Fpl+Wo slMq34Pja09B4l5Fox1AHkpBaND9MkSyf6PMhsRcz/Y+/3C+mjI5FGUjSDNytKos50jv dcNg== X-Gm-Message-State: ALoCoQn7fEYxHc9vZ2gDzUwpE+F3FmiaNBk+JW9cyPvDu0LLCSo2vW0q7PZwQeavEAtjI65jLOIl X-Received: by 10.194.71.48 with SMTP id r16mr8751wju.7.1418770238963; Tue, 16 Dec 2014 14:50:38 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.7 with SMTP id 7ls800775laq.88.gmail; Tue, 16 Dec 2014 14:50:38 -0800 (PST) X-Received: by 10.112.172.97 with SMTP id bb1mr37445168lbc.38.1418770238350; Tue, 16 Dec 2014 14:50:38 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id wm7si2027867lbb.136.2014.12.16.14.50.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Dec 2014 14:50:38 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id gd6so12286233lab.29 for ; Tue, 16 Dec 2014 14:50:38 -0800 (PST) X-Received: by 10.152.23.38 with SMTP id j6mr30393502laf.81.1418770238254; Tue, 16 Dec 2014 14:50:38 -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 ru5csp1183337lbb; Tue, 16 Dec 2014 14:50:37 -0800 (PST) X-Received: by 10.224.122.131 with SMTP id l3mr8416551qar.10.1418770236514; Tue, 16 Dec 2014 14:50:36 -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 q1si2600105qcc.24.2014.12.16.14.50.35 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 16 Dec 2014 14:50:36 -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 1Y10wr-0005wS-9Y; Tue, 16 Dec 2014 22:50:33 +0000 Received: from mail-ob0-f179.google.com ([209.85.214.179]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y10wk-0005rm-MF for lng-odp@lists.linaro.org; Tue, 16 Dec 2014 22:50:26 +0000 Received: by mail-ob0-f179.google.com with SMTP id va2so990970obc.10 for ; Tue, 16 Dec 2014 14:50:21 -0800 (PST) X-Received: by 10.202.45.79 with SMTP id t76mr1620688oit.100.1418770221321; Tue, 16 Dec 2014 14:50:21 -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 y15sm945470oia.20.2014.12.16.14.50.20 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Dec 2014 14:50:20 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Tue, 16 Dec 2014 16:50:14 -0600 Message-Id: <1418770214-17990-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-Topics: patch Subject: [lng-odp] [PATCHv2] Don't reparse on add/rem data for payload changes 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.215.42 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 Signed-off-by: Bill Fischofer Signed-off-by: ... --- 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); } }