From patchwork Wed Aug 26 10:03:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Kiss X-Patchwork-Id: 52719 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 725A022E8B for ; Wed, 26 Aug 2015 10:03:49 +0000 (UTC) Received: by labd1 with SMTP id d1sf63527721lab.0 for ; Wed, 26 Aug 2015 03:03:48 -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=Mxj7/n11QFKE44xXPWIH8g5C50ofmNnahTvaRc2vjJI=; b=M/F1g5UpcfvGikiV3MWjCEOQ/v2BeM0I9Bl4EVy8ZcLzg9ekNeMD1iccaj9J3ZSFfU Wp7mezj4PVmIG5naqPkpzteHUE2f8cFLCWFnGWgwf5OxpZtuKTBxTT+2ec/8SdfuNLej mmOcVCv6NlpmsHJyVg/tRTZB8I7CWkVrZIA06sn5tP8EG2Mqyas7hZR+AxAmtILvgi0t y7pMPA6yqrLqy8vrRNehGkc4fHgDzKWEwxQHWS1pftcemASOjsM0iElfLcnGGBcOxefe BhA3UMm4zCEmagBQNP5D8HTxuv5myORNykp548pXPg8QwYt109spu7Rwmvqfz0XLqH8h 6Pcg== X-Gm-Message-State: ALoCoQnbhmddiqYfooGOT2lviCKq/oUTDiMzJijj73U4zTKrT/xpfUp7wO46GrH1KV46Ar+b0zS6 X-Received: by 10.112.90.225 with SMTP id bz1mr9823877lbb.12.1440583428435; Wed, 26 Aug 2015 03:03:48 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.202 with SMTP id p10ls305438lae.95.gmail; Wed, 26 Aug 2015 03:03:48 -0700 (PDT) X-Received: by 10.152.7.37 with SMTP id g5mr30160283laa.101.1440583428271; Wed, 26 Aug 2015 03:03:48 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id v3si18408914lbw.9.2015.08.26.03.03.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2015 03:03:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by lalv9 with SMTP id v9so115686199lal.0 for ; Wed, 26 Aug 2015 03:03:48 -0700 (PDT) X-Received: by 10.152.36.102 with SMTP id p6mr29782938laj.19.1440583428168; Wed, 26 Aug 2015 03:03:48 -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.162.200 with SMTP id yc8csp3803671lbb; Wed, 26 Aug 2015 03:03:46 -0700 (PDT) X-Received: by 10.107.10.144 with SMTP id 16mr2255815iok.72.1440583426335; Wed, 26 Aug 2015 03:03:46 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id kj2si3114657igb.78.2015.08.26.03.03.45; Wed, 26 Aug 2015 03:03:46 -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 2B9296205F; Wed, 26 Aug 2015 10:03:45 +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 779A662050; Wed, 26 Aug 2015 10:03:35 +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 6159E62056; Wed, 26 Aug 2015 10:03:34 +0000 (UTC) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by lists.linaro.org (Postfix) with ESMTPS id 5F92D62048 for ; Wed, 26 Aug 2015 10:03:33 +0000 (UTC) Received: by wicne3 with SMTP id ne3so39604264wic.0 for ; Wed, 26 Aug 2015 03:03:32 -0700 (PDT) X-Received: by 10.180.20.48 with SMTP id k16mr11673574wie.56.1440583412573; Wed, 26 Aug 2015 03:03:32 -0700 (PDT) Received: from localhost.localdomain ([90.152.119.35]) by smtp.googlemail.com with ESMTPSA id bm9sm6790736wib.10.2015.08.26.03.03.31 for (version=TLSv1/SSLv3 cipher=OTHER); Wed, 26 Aug 2015 03:03:31 -0700 (PDT) From: Zoltan Kiss To: lng-odp@lists.linaro.org Date: Wed, 26 Aug 2015 11:03:16 +0100 Message-Id: <1440583396-29124-1-git-send-email-zoltan.kiss@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH v7] api: packet: allow access to packet flow hash values 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.52 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 Applications can read the computed hash (if any) and set it if they want to store any extra information in it. Signed-off-by: Zoltan Kiss --- v2: - focus on RSS hash only - use setter/getter's v3: - do not mention pointers - add a note - add new patches for implementation and test v4: I've accidentally skipped this version v5: - use separate flag get and clear, as hash can have any value (that maps to checking ol_flags in DPDK) - change terminology to "flow hash", it reflects better what is actually hashed - add function to generate hash by the platform v6: - remove stale function definition from the end of packet.h - spell out in hash_set that if platform cares about the validity of this value, it has to maintain it internally. - with the above change OVS doesn't need the hash generator function anymore, so remove that too. We can introduce it later on. v7: add more comments on Bala's request include/odp/api/packet.h | 33 +++++++++++++++++++++++++++++++++ include/odp/api/packet_flags.h | 18 ++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h index 3a454b5..c983332 100644 --- a/include/odp/api/packet.h +++ b/include/odp/api/packet.h @@ -605,6 +605,39 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt); int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset); /** + * Packet flow hash value + * + * Returns the hash generated from the packet header. Use + * odp_packet_has_flow_hash() to check if packet contains a hash. + * + * @param pkt Packet handle + * + * @return Hash value + * + * @note Zero can be a valid hash value. + * @note The hash algorithm and the header fields defining the flow (therefore + * used for hashing) is platform dependent. + */ +uint32_t odp_packet_flow_hash(odp_packet_t pkt); + +/** + * Set packet flow hash value + * + * Store the packet flow hash for the packet and sets the flow hash flag. This + * enables (but does not requires!) application to reflect packet header + * changes in the hash. + * + * @param pkt Packet handle + * @param flow_hash Hash value to set + * + * @note If the platform needs to keep the original hash value, it has to + * maintain it internally. + * @note The application is not required to keep this hash valid for new or + * modified packets. + */ +void odp_packet_flow_hash_set(odp_packet_t pkt, uint32_t flow_hash); + +/** * Tests if packet is segmented * * @param pkt Packet handle diff --git a/include/odp/api/packet_flags.h b/include/odp/api/packet_flags.h index bfbcc94..7c3b247 100644 --- a/include/odp/api/packet_flags.h +++ b/include/odp/api/packet_flags.h @@ -191,6 +191,15 @@ int odp_packet_has_sctp(odp_packet_t pkt); int odp_packet_has_icmp(odp_packet_t pkt); /** + * Check for packet flow hash + * + * @param pkt Packet handle + * @retval non-zero if packet contains a hash value + * @retval 0 if packet does not contain a hash value + */ +int odp_packet_has_flow_hash(odp_packet_t pkt); + +/** * Set flag for L2 header, e.g. ethernet * * @param pkt Packet handle @@ -327,6 +336,15 @@ void odp_packet_has_sctp_set(odp_packet_t pkt, int val); void odp_packet_has_icmp_set(odp_packet_t pkt, int val); /** + * Clear flag for packet flow hash + * + * @param pkt Packet handle + * + * @note Set this flag is only possible through odp_packet_flow_hash_set() + */ +void odp_packet_has_flow_hash_clr(odp_packet_t pkt); + +/** * @} */