From patchwork Sun Nov 12 00:00:08 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: 118629 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp255248qgn; Sat, 11 Nov 2017 16:07:06 -0800 (PST) X-Google-Smtp-Source: AGs4zMbzjRtbRFfsX82DyPbYEmGhZs2kNv644tI1UXoS0pLAkMmVw+8Jm2Ijmxo+Z38adbkuyKqz X-Received: by 10.237.59.184 with SMTP id r53mr7342812qte.271.1510445226693; Sat, 11 Nov 2017 16:07:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510445226; cv=none; d=google.com; s=arc-20160816; b=gNgnFRb0/Ydmp1UJFLF/eAg769dC8wVxMAFA98eVpbde2jPWN+1x2e/lMnppA2k+WS ZMkON4sPDKRkBCuGJgQPkktOLJpntyX8RjTtgKaGLyDuGO6kuKEstU2mfp7PAwMDUOuT Alxwxl7BRrTOwwwGLqPXFjInA7pF5GB0se7nfDPLmnnYJz12JDJd0oEpvcUgk5dvFWRt GzSlLwB136KL+UuDkrw+s5qvK2NGCX+WbsUMl1FhpljM05f7vdKDv6ecobcSoT5m34mq /rz2dwQyCGuglKw1BwJDzWxmLuJv8Mdliypl3Rdp/44ktuKokfBEDgoYioB7cb9hiOx7 8AMw== 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=mjMetoHH5T9syJ9AB7xdKk6QHFvBCVV1birdivB8rxI=; b=KsJ35c3fOFU9Ok2tg3Deetu5tVZnhC66kZMxmkO0+qdHsZfioWA1Vyi28UPI29OAwt ffMfEAo2+gLO3wUP+4T6TxT81DTCqufI2jMpdzJgXZRnxI0g4IsVIxbF9sQmoyOca7JB YJTU6v8u2L5m1JvNmf0eypsnxdBkFhAwFuXcKhS3gbz8xuRSJfOxlTW1MfpQ0mwAv6bL vdc5yyJITN+QHLT13Del0SEKVNIXLtuQTnQKM9ZenfX8Cu39GjJYAwO5L7FuaOsn0V1h OVRIwWMcWlv3FgbWFlNpm42wSlnJ/hboMozhrAPYeS4FCZMXQVyeYXJkzRHdYT7UtGoY 9Seg== 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 s184si645764qke.205.2017.11.11.16.07.06; Sat, 11 Nov 2017 16:07:06 -0800 (PST) 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 627BE60A32; Sun, 12 Nov 2017 00:07:06 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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 211DF60B4C; Sun, 12 Nov 2017 00:01:00 +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 175CD60737; Sun, 12 Nov 2017 00:00:31 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id 60BF0607A7 for ; Sun, 12 Nov 2017 00:00:23 +0000 (UTC) Received: from mxback10g.mail.yandex.net (mxback10g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:171]) by forward106p.mail.yandex.net (Yandex) with ESMTP id A9C492D81E67 for ; Sun, 12 Nov 2017 03:00:21 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback10g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 8ti2gFlJME-0LxWe305; Sun, 12 Nov 2017 03:00:21 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id VxCtJulSk2-0LWe7xiN; Sun, 12 Nov 2017 03:00:21 +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: Sun, 12 Nov 2017 03:00:08 +0300 Message-Id: <1510444815-25058-10-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510444815-25058-1-git-send-email-odpbot@yandex.ru> References: <1510444815-25058-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 243 Subject: [lng-odp] [PATCH API-NEXT v8 9/16] 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: 9ff682c8d0315f3f1921d5b9fe13d62897c78710 ** Merge commit sha: 38c770f1444aeb3ede5313b7304a1161277ae0b5 **/ .../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,