From patchwork Thu Jul 25 09:03:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiran Kumar Kokkilagadda X-Patchwork-Id: 57075 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 075831C2B5; Thu, 25 Jul 2019 11:04:02 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 2500B1C2B0 for ; Thu, 25 Jul 2019 11:04:00 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x6P90imM029485; Thu, 25 Jul 2019 02:03:59 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=SsAaDnX24NQLx5UjC+BOgRSzvhFfmY99iIsb//alVos=; b=QHDcyNm3LYONY6e9ApmGXDPOnvJPqXhgoCkYadGBXp55ko1AsaUpnyVvZGgEbieHSGeg OjyH8m+RvMZo8JaSum5O1ikzmZu+C+qJ4j3DRkP8HGtW/CrB5plKwWpt1jHj6qBXbidE y6F6eH/ktgkmxcNFqDNsUbCCwHryPltvGrdkXcuLgP8j/8ezJzK8dP8kKJp4H/EugI0P DUGDjS8aqCxLgX+GPQSU3ymP1G4iCydrRj37762DNR0ZRyBvf+oCRS76LGJjY44zLtny acLJE7BU8Lorx3noY8JKMxNeFfux2JN/bwpDMqhE/lAjS5hDMNqK0/Wx6XgeAz+2BgvV uQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2tx6250h4y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 25 Jul 2019 02:03:59 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 25 Jul 2019 02:03:57 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 25 Jul 2019 02:03:57 -0700 Received: from localhost.localdomain (unknown [10.28.34.15]) by maili.marvell.com (Postfix) with ESMTP id 3D34D3F703F; Thu, 25 Jul 2019 02:03:55 -0700 (PDT) From: To: Adrien Mazarguil , John McNamara , Marko Kovacevic , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: , Kiran Kumar K Date: Thu, 25 Jul 2019 14:33:43 +0530 Message-ID: <20190725090345.31814-1-kirankumark@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-07-25_04:2019-07-25,2019-07-25 signatures=0 Subject: [dpdk-dev] [PATCH v3 1/3] ethdev: add NSH key field to flow API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Kiran Kumar K Add new rte_flow_item_nsh in order to match the network service header based on RFC 8300. Signed-off-by: Kiran Kumar K Reviewed-by: Ferruh Yigit --- V3 changes: * Fixed checkpatch issue V2 changes: * updated supported items in doc doc/guides/prog_guide/rte_flow.rst | 18 ++++++++++++++ lib/librte_ethdev/rte_flow.c | 1 + lib/librte_ethdev/rte_flow.h | 39 ++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) -- 2.17.1 diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 821b524b3..4109f199a 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1219,6 +1219,24 @@ Matches an application specific 32 bit metadata item. | ``mask`` | ``data`` | bit-mask applies to "spec" and "last" | +----------+----------+---------------------------------------+ +Item: ``NSH`` +^^^^^^^^^^^^^^^^^^^ + +Matches a network service header (RFC 8300). + +- ``version``: normally 0x0 (2 bits). +- ``oam_pkt``: indicate oam packet (1 bit). +- ``reserved``: reserved bit (1 bit). +- ``ttl``: maximum SFF hopes (6 bits). +- ``length``: total length in 4 bytes words (6 bits). +- ``reserved1``: reserved1 bits (4 bits). +- ``mdtype``: ndicates format of NSH header (4 bits). +- ``next_proto``: indicates protocol type of encap data (8 bits). +- ``spi``: service path identifier (3 bytes). +- ``sindex``: service index (1 byte). +- Default ``mask`` matches mdtype, next_proto, spi, sindex. + + Actions ~~~~~~~ diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index 18fcb018e..39646167c 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -75,6 +75,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(MARK, sizeof(struct rte_flow_item_mark)), MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)), MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)), + MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)), }; /** Generate flow_action[] entry. */ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index b66bf1495..f0e99fa3e 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -434,6 +434,13 @@ enum rte_flow_item_type { * @code rte_be32_t * @endcode */ RTE_FLOW_ITEM_TYPE_GRE_KEY, + + /** + * Matches Network service header (NSH). + * See struct rte_flow_item_nsh. + * + */ + RTE_FLOW_ITEM_TYPE_NSH, }; /** @@ -1214,6 +1221,38 @@ struct rte_flow_item_mark { uint32_t id; /**< Integer value to match against. */ }; +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ITEM_TYPE_NSH + * + * Match network service header (NSH), RFC 8300 + * + */ +struct rte_flow_item_nsh { + uint32_t version:2; + uint32_t oam_pkt:1; + uint32_t reserved:1; + uint32_t ttl:6; + uint32_t length:6; + uint32_t reserved1:4; + uint32_t mdtype:4; + uint32_t next_proto:8; + uint32_t spi:24; + uint32_t sindex:8; +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_NSH. */ +#ifndef __cplusplus +static const struct rte_flow_item_nsh rte_flow_item_nsh_mask = { + .mdtype = 0xf, + .next_proto = 0xff, + .spi = 0xffffff, + .sindex = 0xff, +}; +#endif + /** * Matching pattern item definition. *