From patchwork Fri Aug 28 11:05:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Kiss X-Patchwork-Id: 52789 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 5501622E8B for ; Fri, 28 Aug 2015 11:07:36 +0000 (UTC) Received: by labth1 with SMTP id th1sf16800993lab.2 for ; Fri, 28 Aug 2015 04:07:35 -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:in-reply-to:references: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=ltqrDq5Kvm1cxM3wmHA37Ghu1rXfY48pUJcA0+HI1yQ=; b=KlshOmdX8fw5gJWrt0kIz7XdqFFz31nnMjCn8KpNxJwDdWutCy9uLHnTciaGQ33jX4 jB0RZU3/hVONQyr+iWMDemeZeZNIWe45orYg7PZXJI2h/dxXVo4Q4O3HnBwC5I0fhXBG lX8oYkQ9g5jb4VoMmRQaPbjuz98agog77d1rZUfEq40U+npOXazLFE2CupoERuSkRjbe TvaZbupw9E58sG7XH//wsbkjgMWGyuDb6KbzbWxvr/cWKjoClZWltJiI7t1rh+kOwMVP jG5Bu1nrTMQ0bXuQ1k8SGS7xrvdikOskg6r6kIFT88h4dRtMu1uAKRDAmnAv2rvqkoS/ HcHA== X-Gm-Message-State: ALoCoQk3VjZ755ZzdyeXHLGjuVddk+vJYbjG2y9WhjbsQvnMebKO+kyymnWNl141sAghG+b7I44p X-Received: by 10.152.4.69 with SMTP id i5mr2551611lai.10.1440760055294; Fri, 28 Aug 2015 04:07:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.8 with SMTP id ls8ls192174lac.71.gmail; Fri, 28 Aug 2015 04:07:35 -0700 (PDT) X-Received: by 10.112.163.226 with SMTP id yl2mr4620519lbb.100.1440760054378; Fri, 28 Aug 2015 04:07:34 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id qx9si5434361lbb.116.2015.08.28.04.07.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Aug 2015 04:07:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by laba3 with SMTP id a3so30105094lab.1 for ; Fri, 28 Aug 2015 04:07:33 -0700 (PDT) X-Received: by 10.152.18.164 with SMTP id x4mr4640555lad.35.1440760053772; Fri, 28 Aug 2015 04:07:33 -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.151.194 with SMTP id us2csp455479lbb; Fri, 28 Aug 2015 04:07:33 -0700 (PDT) X-Received: by 10.50.73.170 with SMTP id m10mr1805245igv.71.1440760052932; Fri, 28 Aug 2015 04:07:32 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id u82si4595573ioi.147.2015.08.28.04.07.32; Fri, 28 Aug 2015 04:07:32 -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 F20FE61A38; Fri, 28 Aug 2015 11:07:31 +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, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED 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 1FA4B61B50; Fri, 28 Aug 2015 11:06:01 +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 7F3D161B40; Fri, 28 Aug 2015 11:05:57 +0000 (UTC) Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by lists.linaro.org (Postfix) with ESMTPS id AED3E619A6 for ; Fri, 28 Aug 2015 11:05:53 +0000 (UTC) Received: by wibgu7 with SMTP id gu7so5956030wib.1 for ; Fri, 28 Aug 2015 04:05:52 -0700 (PDT) X-Received: by 10.180.108.175 with SMTP id hl15mr3925566wib.1.1440759952859; Fri, 28 Aug 2015 04:05:52 -0700 (PDT) Received: from localhost.localdomain ([90.152.119.35]) by smtp.googlemail.com with ESMTPSA id i6sm7505091wje.33.2015.08.28.04.05.51 for (version=TLSv1/SSLv3 cipher=OTHER); Fri, 28 Aug 2015 04:05:52 -0700 (PDT) From: Zoltan Kiss To: lng-odp@lists.linaro.org Date: Fri, 28 Aug 2015 12:05:39 +0100 Message-Id: <1440759940-17679-3-git-send-email-zoltan.kiss@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440759940-17679-1-git-send-email-zoltan.kiss@linaro.org> References: <1440759940-17679-1-git-send-email-zoltan.kiss@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH v8 2/3] linux-generic: packet: implement flow hash 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: zoltan.kiss@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.51 as permitted sender) smtp.mailfrom=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 This platform doesn't compute it, packet_init sets the flag to 0. Signed-off-by: Zoltan Kiss --- v8: adjust to newer API definition platform/linux-generic/include/odp_packet_internal.h | 3 +++ platform/linux-generic/odp_packet.c | 15 +++++++++++++++ platform/linux-generic/odp_packet_flags.c | 15 +++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 8c41491..ba2cd7e 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -137,6 +137,9 @@ typedef struct { odp_pktio_t input; + uint32_t has_hash:1; /**< Flow hash present */ + uint32_t flow_hash; /**< Flow hash value */ + odp_crypto_generic_op_result_t op_result; /**< Result for crypto */ } odp_packet_hdr_t; diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 5581cc4..209a6e6 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -326,6 +326,21 @@ int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset) return 0; } +uint32_t odp_packet_flow_hash(odp_packet_t pkt) +{ + odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + + return pkt_hdr->flow_hash; +} + +void odp_packet_flow_hash_set(odp_packet_t pkt, uint32_t flow_hash) +{ + odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + + pkt_hdr->flow_hash = flow_hash; + pkt_hdr->has_hash = 1; +} + int odp_packet_is_segmented(odp_packet_t pkt) { return odp_packet_hdr(pkt)->buf_hdr.segcount > 1; diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 4f680a1..ea308f7 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -116,6 +116,13 @@ int odp_packet_has_icmp(odp_packet_t pkt) retflag(pkt, input_flags.icmp); } +int odp_packet_has_flow_hash(odp_packet_t pkt) +{ + odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + + return pkt_hdr->has_hash; +} + /* Set Input Flags */ void odp_packet_has_l2_set(odp_packet_t pkt, int val) @@ -202,3 +209,11 @@ void odp_packet_has_icmp_set(odp_packet_t pkt, int val) { setflag(pkt, input_flags.icmp, val); } + +void odp_packet_has_flow_hash_clr(odp_packet_t pkt) +{ + odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + + pkt_hdr->has_hash = 0; +} +