From patchwork Wed Oct 25 09:00:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 117035 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp614313qgn; Wed, 25 Oct 2017 02:11:21 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Tm4pSGKeNMJDKdS8UhXMgZ4br3EYSE/PSKawrcITKLMefqwmlsFwzQhpZtCaQDiBTK8Ugh X-Received: by 10.200.1.72 with SMTP id f8mr22551998qtg.146.1508922681054; Wed, 25 Oct 2017 02:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508922681; cv=none; d=google.com; s=arc-20160816; b=O8VZcahb9jlEVLxSvboOxHlIoiEAsL35ZDpRy4AeMfqB8ItVP7V1acTYpBCg4FID4D K3tNwu827rutoqEFVuFuYQtiYltzwDqvTLW8nALcpBRYQDTIkcfTgzaGg0FaXn3O7ylF FLpdtL0IywUEr+STmsytCCZzeu+AWJtn1iwmcce3xtmMltjCT6obRrVAoGn0oGxsEFC+ Jx7GknVMImgQgcTMLYXTVZ6Hkj68lc3q+NmVDMGUXTLS/zfgIHdp8Ca8UL9F6F12g34z NYku9vfU+T75wPaYZWt/OZuL7Z0Mn2eLZdRU/BAzAtNLwQL2HUoOWpxT13RoGIZsjNha BpDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=uk0Litg81W7VjK06vfE2GG7oT28gvqPHSntE7StCsrI=; b=tLgi6A2SEp9P/62U6paAAG0jCFXcvA9L+QMuqF9298hDgPd6KoGTTM3nj0ZR0FgU2w 4WcLH9LWg2hK1xdNJ1jS6War6RQEognnsDx5YCWnddwahWZhl3hu+/JqXfHJVFePeHNl 0i4Th7lnATAQ636+xQGq49ASJ9qbjRUMHv0TuvWw+sdJDiM0USk6xkiA16P2lm9sZhVO orDW//vbjrdCWMVP3WwwcXORKH9xpvASJqNIPaRF56PoM3P/45DnALDp03O6Dt53Nfe6 6O+06rij40InidQfK3R128D2BmI84HiAGSvN0aeXgUZICMi8TsJQOTm30ztYe1mqfJI6 xpiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id d26si2002132qte.37.2017.10.25.02.11.20; Wed, 25 Oct 2017 02:11:21 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id B29E762875; Wed, 25 Oct 2017 09:11:20 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,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 2613B6298D; Wed, 25 Oct 2017 09:03:23 +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 23C8A6295F; Wed, 25 Oct 2017 09:03:00 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id 75BB062962 for ; Wed, 25 Oct 2017 09:00:58 +0000 (UTC) Received: from mxback14g.mail.yandex.net (mxback14g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:93]) by forward101o.mail.yandex.net (Yandex) with ESMTP id EF2321346B83 for ; Wed, 25 Oct 2017 12:00:56 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback14g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id WhllPeLHl3-0uvCTusq; Wed, 25 Oct 2017 12:00:56 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id XXwHVNLqhU-0u5mxToj; Wed, 25 Oct 2017 12:00:56 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 25 Oct 2017 12:00:17 +0300 Message-Id: <1508922019-30663-10-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508922019-30663-1-git-send-email-odpbot@yandex.ru> References: <1508922019-30663-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 243 Subject: [lng-odp] [PATCH API-NEXT v3 9/11] linux-gen: classification: split cls_pkt_get_queue() function X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Separate function returning destination queue from cos_t instance. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 243 (lumag:ipsec-packet-impl-3) ** https://github.com/Linaro/odp/pull/243 ** Patch: https://github.com/Linaro/odp/pull/243.patch ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375 ** Merge commit sha: 42beb7e73df5f59ecb1d29f3adb5d8669c61bca7 **/ .../include/odp_classification_internal.h | 7 +++++ platform/linux-generic/odp_classification.c | 34 ++++++++++++++++------ 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/platform/linux-generic/include/odp_classification_internal.h b/platform/linux-generic/include/odp_classification_internal.h index 8882a7177..4cadb9bdb 100644 --- a/platform/linux-generic/include/odp_classification_internal.h +++ b/platform/linux-generic/include/odp_classification_internal.h @@ -42,6 +42,13 @@ int cls_classify_packet(pktio_entry_t *entry, const uint8_t *base, odp_packet_hdr_t *pkt_hdr); /** + * @internal + * Select packet destination queue basing on provided cos entry + */ +odp_queue_t cls_pkt_get_queue(odp_packet_hdr_t *pkt_hdr, cos_t *cos, + const uint8_t *base); + +/** Packet IO classifier init This function does initialization of classifier object associated with pktio. diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index 6ece74fca..317caefbf 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -961,8 +961,7 @@ int cls_classify_packet(pktio_entry_t *entry, const uint8_t *base, odp_packet_hdr_t *pkt_hdr) { cos_t *cos; - uint32_t tbl_index; - uint32_t hash; + odp_queue_t queue; packet_parse_reset(pkt_hdr); packet_set_len(pkt_hdr, pkt_len); @@ -979,20 +978,37 @@ int cls_classify_packet(pktio_entry_t *entry, const uint8_t *base, return -EFAULT; *pool = cos->s.pool; + pkt_hdr->p.input_flags.dst_queue = 1; - if (!cos->s.queue_group) { - pkt_hdr->dst_queue = queue_fn->from_ext(cos->s.queue); - return 0; - } + queue = cls_pkt_get_queue(pkt_hdr, cos, base); + pkt_hdr->dst_queue = queue_fn->from_ext(queue); + + return 0; +} + +/** + * Set packet destination queue basing on the cos + * + * @param cos + * @param pkt_hdr Packet header + * @param base Packet data + */ +odp_queue_t cls_pkt_get_queue(odp_packet_hdr_t *pkt_hdr, cos_t *cos, + const uint8_t *base) +{ + uint32_t tbl_index; + uint32_t hash; + + if (!cos->s.queue_group) + return cos->s.queue; hash = packet_rss_hash(pkt_hdr, cos->s.hash_proto, base); /* CLS_COS_QUEUE_MAX is a power of 2 */ hash = hash & (CLS_COS_QUEUE_MAX - 1); tbl_index = (cos->s.index * CLS_COS_QUEUE_MAX) + hash; - pkt_hdr->dst_queue = queue_fn->from_ext(queue_grp_tbl-> - s.queue[tbl_index]); - return 0; + + return queue_grp_tbl->s.queue[tbl_index]; } static uint32_t packet_rss_hash(odp_packet_hdr_t *pkt_hdr,