From patchwork Thu Apr 30 03:02:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 47752 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 537AA20553 for ; Thu, 30 Apr 2015 03:03:03 +0000 (UTC) Received: by wixv7 with SMTP id v7sf959357wix.0 for ; Wed, 29 Apr 2015 20:03:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to: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=w6MXtQVf+RFlvoL/6U8iC/5yQVopDxUJxfkul++v2n8=; b=joGECAkslEHvwxAm+v+g44sJGR+DcrsQJ/A1c7LtTmLWHSiu+BCRznQ9Vgau81NbXG XPuVxo0hYWG53Li9X/CCLtA0BL1cwROsdCgjg6kptWgM5UN7sgmsACyoYFs2x2JGjrxF 3XHsbgVEHteGpc49RNPRF0rW1rmhbbXO6wzzTahjokKNvdGHIPS+2i8csv699jjI2ded a1h/GMg+BpA62WLUsO0jRrhUuzFsmwoxCViWcesdyJoi+cfTz947d4+GiFiH0esHalk6 CHc3wPRFEM3afsLmEf+1VX5woqR7YAsXakOfWwK8dRyu+zxjCPxdn3ZBrj/pWe1Z+SS/ BQZw== X-Gm-Message-State: ALoCoQnuFKb5PtGVKy7kYUPvgdNWO+AKdrmzFo++cjlE9UL+4S46Szx4/qvY3UNiCDL8Qgt9CIjP X-Received: by 10.112.26.5 with SMTP id h5mr1283709lbg.4.1430362982577; Wed, 29 Apr 2015 20:03:02 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.115.211 with SMTP id jq19ls327964lab.69.gmail; Wed, 29 Apr 2015 20:03:02 -0700 (PDT) X-Received: by 10.152.179.195 with SMTP id di3mr1810241lac.15.1430362982425; Wed, 29 Apr 2015 20:03:02 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id ba11si681924lab.113.2015.04.29.20.03.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Apr 2015 20:03:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbcga7 with SMTP id ga7so34520516lbc.1 for ; Wed, 29 Apr 2015 20:03:02 -0700 (PDT) X-Received: by 10.152.9.66 with SMTP id x2mr1839108laa.36.1430362982125; Wed, 29 Apr 2015 20:03:02 -0700 (PDT) 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.67.65 with SMTP id l1csp2854735lbt; Wed, 29 Apr 2015 20:03:01 -0700 (PDT) X-Received: by 10.140.202.20 with SMTP id x20mr2343069qha.101.1430362980745; Wed, 29 Apr 2015 20:03:00 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 133si1601346qhx.1.2015.04.29.20.02.59; Wed, 29 Apr 2015 20:03:00 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 5A79E61E1D; Thu, 30 Apr 2015 03:02:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 4883D61B35; Thu, 30 Apr 2015 03:02:52 +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 C90FE61CEB; Thu, 30 Apr 2015 03:02:43 +0000 (UTC) Received: from mail-oi0-f41.google.com (mail-oi0-f41.google.com [209.85.218.41]) by lists.linaro.org (Postfix) with ESMTPS id 5537A61B35 for ; Thu, 30 Apr 2015 03:02:42 +0000 (UTC) Received: by oign205 with SMTP id n205so37836727oig.2 for ; Wed, 29 Apr 2015 20:02:41 -0700 (PDT) X-Received: by 10.60.70.40 with SMTP id j8mr1732020oeu.59.1430362961621; Wed, 29 Apr 2015 20:02:41 -0700 (PDT) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by mx.google.com with ESMTPSA id a76sm661451oig.11.2015.04.29.20.02.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Apr 2015 20:02:40 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Wed, 29 Apr 2015 22:02:40 -0500 Message-Id: <1430362960-23440-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 X-Topics: patch Subject: [lng-odp] [PATCH] linux-generic: packet: Add lazy parsing support X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 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" 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.178 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 Lazy parsing defers parsing until the results are actually needed. This allows applications that do their own parsing and never reference ODP parse results to avoid the overhead of SW parsing. Signed-off-by: Bill Fischofer --- .../linux-generic/include/odp_packet_internal.h | 72 +++++++++++--------- platform/linux-generic/odp_packet.c | 26 ++++++-- platform/linux-generic/odp_packet_flags.c | 76 ++++++++++++---------- platform/linux-generic/odp_packet_io.c | 2 +- platform/linux-generic/odp_packet_socket.c | 6 +- 5 files changed, 107 insertions(+), 75 deletions(-) diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index c3dcdd8..81f2d8e 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -31,37 +31,37 @@ extern "C" { */ typedef union { /* All input flags */ - uint32_t all; + uint64_t all; struct { /* Bitfield flags for each protocol */ - uint32_t l2:1; /**< known L2 protocol present */ - uint32_t l3:1; /**< known L3 protocol present */ - uint32_t l4:1; /**< known L4 protocol present */ - - uint32_t eth:1; /**< Ethernet */ - uint32_t jumbo:1; /**< Jumbo frame */ - uint32_t vlan:1; /**< VLAN hdr found */ - uint32_t vlan_qinq:1; /**< Stacked VLAN found, QinQ */ - - uint32_t snap:1; /**< SNAP */ - uint32_t arp:1; /**< ARP */ - - uint32_t ipv4:1; /**< IPv4 */ - uint32_t ipv6:1; /**< IPv6 */ - uint32_t ipfrag:1; /**< IP fragment */ - uint32_t ipopt:1; /**< IP optional headers */ - uint32_t ipsec:1; /**< IPSec decryption may be needed */ - - uint32_t udp:1; /**< UDP */ - uint32_t tcp:1; /**< TCP */ - uint32_t tcpopt:1; /**< TCP options present */ - uint32_t sctp:1; /**< SCTP */ - uint32_t icmp:1; /**< ICMP */ + uint32_t l2:2; /**< known L2 protocol present */ + uint32_t l3:2; /**< known L3 protocol present */ + uint32_t l4:2; /**< known L4 protocol present */ + + uint32_t eth:2; /**< Ethernet */ + uint32_t jumbo:2; /**< Jumbo frame */ + uint32_t vlan:2; /**< VLAN hdr found */ + uint32_t vlan_qinq:2; /**< Stacked VLAN found, QinQ */ + + uint32_t snap:2; /**< SNAP */ + uint32_t arp:2; /**< ARP */ + + uint32_t ipv4:2; /**< IPv4 */ + uint32_t ipv6:2; /**< IPv6 */ + uint32_t ipfrag:2; /**< IP fragment */ + uint32_t ipopt:2; /**< IP optional headers */ + uint32_t ipsec:2; /**< IPSec decryption may be needed */ + + uint32_t udp:2; /**< UDP */ + uint32_t tcp:2; /**< TCP */ + uint32_t tcpopt:2; /**< TCP options present */ + uint32_t sctp:2; /**< SCTP */ + uint32_t icmp:2; /**< ICMP */ }; } input_flags_t; -_ODP_STATIC_ASSERT(sizeof(input_flags_t) == sizeof(uint32_t), +_ODP_STATIC_ASSERT(sizeof(input_flags_t) == sizeof(uint64_t), "INPUT_FLAGS_SIZE_ERROR"); /** @@ -95,10 +95,10 @@ typedef union { struct { /* 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 */ + uint32_t l3_chksum_set:2; /**< L3 chksum bit is valid */ + uint32_t l3_chksum:2; /**< L3 chksum override */ + uint32_t l4_chksum_set:2; /**< L3 chksum bit is valid */ + uint32_t l4_chksum:2; /**< L4 chksum override */ }; } output_flags_t; @@ -248,6 +248,18 @@ static inline void packet_set_len(odp_packet_t pkt, uint32_t len) odp_packet_hdr(pkt)->frame_len = len; } +#define ODP_PACKET_OFFSET_UNPARSED (ODP_PACKET_OFFSET_INVALID - 1) + +static inline void _odp_packet_reset_parse(odp_packet_t pkt) +{ + odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + pkt_hdr->input_flags.all = -1; + pkt_hdr->error_flags.all = -1; + pkt_hdr->l2_offset = ODP_PACKET_OFFSET_UNPARSED; + pkt_hdr->l3_offset = ODP_PACKET_OFFSET_UNPARSED; + pkt_hdr->l4_offset = ODP_PACKET_OFFSET_UNPARSED; +} + /* Forward declarations */ int _odp_packet_copy_to_packet(odp_packet_t srcpkt, uint32_t srcoffset, odp_packet_t dstpkt, uint32_t dstoffset, @@ -257,7 +269,7 @@ void _odp_packet_copy_md_to_packet(odp_packet_t srcpkt, odp_packet_t dstpkt); odp_packet_t _odp_packet_alloc(odp_pool_t pool_hdl); -int _odp_packet_parse(odp_packet_t pkt); +int _odp_packet_parse(odp_packet_hdr_t *pkt_hdr); /* Convert a packet handle to a buffer handle */ odp_buffer_t _odp_packet_to_buffer(odp_packet_t pkt); diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index c5a3f7d..ac171cd 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -242,12 +242,17 @@ void odp_packet_user_u64_set(odp_packet_t pkt, uint64_t ctx) void *odp_packet_l2_ptr(odp_packet_t pkt, uint32_t *len) { odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + if (pkt_hdr->l2_offset == ODP_PACKET_OFFSET_UNPARSED) + _odp_packet_parse(pkt_hdr); return packet_map(pkt_hdr, pkt_hdr->l2_offset, len); } uint32_t odp_packet_l2_offset(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->l2_offset; + odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + if (pkt_hdr->l2_offset == ODP_PACKET_OFFSET_UNPARSED) + _odp_packet_parse(pkt_hdr); + return pkt_hdr->l2_offset; } int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset) @@ -264,12 +269,17 @@ int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset) void *odp_packet_l3_ptr(odp_packet_t pkt, uint32_t *len) { odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + if (pkt_hdr->l3_offset == ODP_PACKET_OFFSET_UNPARSED) + _odp_packet_parse(pkt_hdr); return packet_map(pkt_hdr, pkt_hdr->l3_offset, len); } uint32_t odp_packet_l3_offset(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->l3_offset; + odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + if (pkt_hdr->l3_offset == ODP_PACKET_OFFSET_UNPARSED) + _odp_packet_parse(pkt_hdr); + return pkt_hdr->l3_offset; } int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t offset) @@ -286,12 +296,17 @@ int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t offset) void *odp_packet_l4_ptr(odp_packet_t pkt, uint32_t *len) { odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + if (pkt_hdr->l4_offset == ODP_PACKET_OFFSET_UNPARSED) + _odp_packet_parse(pkt_hdr); return packet_map(pkt_hdr, pkt_hdr->l4_offset, len); } uint32_t odp_packet_l4_offset(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->l4_offset; + odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + if (pkt_hdr->l4_offset == ODP_PACKET_OFFSET_UNPARSED) + _odp_packet_parse(pkt_hdr); + return pkt_hdr->l4_offset; } int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset) @@ -558,7 +573,7 @@ void odp_packet_print(odp_packet_t pkt) len += snprintf(&str[len], n-len, "Packet "); len += odp_buffer_snprint(&str[len], n-len, (odp_buffer_t) pkt); len += snprintf(&str[len], n-len, - " input_flags 0x%x\n", hdr->input_flags.all); + " input_flags 0x%" PRIx64 "\n", hdr->input_flags.all); len += snprintf(&str[len], n-len, " error_flags 0x%x\n", hdr->error_flags.all); len += snprintf(&str[len], n-len, @@ -790,9 +805,8 @@ static inline void parse_udp(odp_packet_hdr_t *pkt_hdr, * Simple packet parser */ -int _odp_packet_parse(odp_packet_t pkt) +int _odp_packet_parse(odp_packet_hdr_t *pkt_hdr) { - odp_packet_hdr_t *const pkt_hdr = odp_packet_hdr(pkt); odph_ethhdr_t *eth; odph_vlanhdr_t *vlan; uint16_t ethtype; diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index ab3d12f..04e37ba 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -7,182 +7,188 @@ #include #include +#define retflag(p, x) do { \ + odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(p); \ + if (pkt_hdr->x > 1) \ + _odp_packet_parse(pkt_hdr); \ + return pkt_hdr->x; \ + } while (0) int odp_packet_has_error(odp_packet_t pkt) { - return (odp_packet_hdr(pkt)->error_flags.all != 0); + return odp_packet_hdr(pkt)->error_flags.all != 0; } /* Get Input Flags */ int odp_packet_has_l2(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.l2; + retflag(pkt, input_flags.l2); } int odp_packet_has_l3(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.l3; + retflag(pkt, input_flags.l3); } int odp_packet_has_l4(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.l4; + retflag(pkt, input_flags.l4); } int odp_packet_has_eth(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.eth; + retflag(pkt, input_flags.eth); } int odp_packet_has_jumbo(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.jumbo; + retflag(pkt, input_flags.jumbo); } int odp_packet_has_vlan(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.vlan; + retflag(pkt, input_flags.vlan); } int odp_packet_has_vlan_qinq(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.vlan_qinq; + retflag(pkt, input_flags.vlan_qinq); } int odp_packet_has_arp(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.arp; + retflag(pkt, input_flags.arp); } int odp_packet_has_ipv4(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.ipv4; + retflag(pkt, input_flags.ipv4); } int odp_packet_has_ipv6(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.ipv6; + retflag(pkt, input_flags.ipv6); } int odp_packet_has_ipfrag(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.ipfrag; + retflag(pkt, input_flags.ipfrag); } int odp_packet_has_ipopt(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.ipopt; + retflag(pkt, input_flags.ipopt); } int odp_packet_has_ipsec(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.ipsec; + retflag(pkt, input_flags.ipsec); } int odp_packet_has_udp(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.udp; + retflag(pkt, input_flags.udp); } int odp_packet_has_tcp(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.tcp; + retflag(pkt, input_flags.tcp); } int odp_packet_has_sctp(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.sctp; + retflag(pkt, input_flags.sctp); } int odp_packet_has_icmp(odp_packet_t pkt) { - return odp_packet_hdr(pkt)->input_flags.icmp; + retflag(pkt, input_flags.icmp); } /* Set Input Flags */ void odp_packet_has_l2_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.l2 = val; + odp_packet_hdr(pkt)->input_flags.l2 = val & 1; } void odp_packet_has_l3_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.l3 = val; + odp_packet_hdr(pkt)->input_flags.l3 = val & 1; } void odp_packet_has_l4_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.l4 = val; + odp_packet_hdr(pkt)->input_flags.l4 = val & 1; } void odp_packet_has_eth_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.eth = val; + odp_packet_hdr(pkt)->input_flags.eth = val & 1; } void odp_packet_has_jumbo_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.jumbo = val; + odp_packet_hdr(pkt)->input_flags.jumbo = val & 1; } void odp_packet_has_vlan_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.vlan = val; + odp_packet_hdr(pkt)->input_flags.vlan = val & 1; } void odp_packet_has_vlan_qinq_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.vlan_qinq = val; + odp_packet_hdr(pkt)->input_flags.vlan_qinq = val & 1; } void odp_packet_has_arp_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.arp = val; + odp_packet_hdr(pkt)->input_flags.arp = val & 1; } void odp_packet_has_ipv4_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.ipv4 = val; + odp_packet_hdr(pkt)->input_flags.ipv4 = val & 1; } void odp_packet_has_ipv6_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.ipv6 = val; + odp_packet_hdr(pkt)->input_flags.ipv6 = val & 1; } void odp_packet_has_ipfrag_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.ipfrag = val; + odp_packet_hdr(pkt)->input_flags.ipfrag = val & 1; } void odp_packet_has_ipopt_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.ipopt = val; + odp_packet_hdr(pkt)->input_flags.ipopt = val & 1; } void odp_packet_has_ipsec_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.ipsec = val; + odp_packet_hdr(pkt)->input_flags.ipsec = val & 1; } void odp_packet_has_udp_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.udp = val; + odp_packet_hdr(pkt)->input_flags.udp = val & 1; } void odp_packet_has_tcp_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.tcp = val; + odp_packet_hdr(pkt)->input_flags.tcp = val & 1; } void odp_packet_has_sctp_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.sctp = val; + odp_packet_hdr(pkt)->input_flags.sctp = val & 1; } void odp_packet_has_icmp_set(odp_packet_t pkt, int val) { - odp_packet_hdr(pkt)->input_flags.icmp = val; + odp_packet_hdr(pkt)->input_flags.icmp = val & 1; } diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index f16685d..5ae24b9 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -378,7 +378,7 @@ static int deq_loopback(pktio_entry_t *pktio_entry, odp_packet_t pkts[], for (i = 0; i < nbr; ++i) { pkts[i] = _odp_packet_from_buffer(odp_hdr_to_buf(hdr_tbl[i])); - _odp_packet_parse(pkts[i]); + _odp_packet_reset_parse(pkts[i]); } return nbr; diff --git a/platform/linux-generic/odp_packet_socket.c b/platform/linux-generic/odp_packet_socket.c index 2802c43..9272146 100644 --- a/platform/linux-generic/odp_packet_socket.c +++ b/platform/linux-generic/odp_packet_socket.c @@ -251,7 +251,7 @@ int recv_pkt_sock_basic(pkt_sock_t *const pkt_sock, /* Parse and set packet header data */ odp_packet_pull_tail(pkt, pkt_sock->max_frame_len - recv_bytes); - _odp_packet_parse(pkt); + _odp_packet_reset_parse(pkt); pkt_table[nb_rx] = pkt; pkt = ODP_PACKET_INVALID; @@ -360,7 +360,7 @@ int recv_pkt_sock_mmsg(pkt_sock_t *const pkt_sock, odp_packet_pull_tail(pkt_table[i], pkt_sock->max_frame_len - msgvec[i].msg_len); - _odp_packet_parse(pkt_table[i]); + _odp_packet_reset_parse(pkt_table[i]); pkt_table[nb_rx] = pkt_table[i]; nb_rx++; @@ -519,7 +519,7 @@ static inline unsigned pkt_mmap_v2_rx(int sock, struct ring *ring, mmap_rx_user_ready(ppd.raw); /* Parse and set packet header data */ - _odp_packet_parse(pkt_table[i]); + _odp_packet_reset_parse(pkt_table[i]); frame_num = next_frame_num; i++;