From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D416EA2EFC for ; Mon, 14 Oct 2019 09:08:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1C9861C12A; Mon, 14 Oct 2019 09:08:41 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 0F80A1C128 for ; Mon, 14 Oct 2019 09:08:39 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us5.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id D797D80050; Mon, 14 Oct 2019 07:08:36 +0000 (UTC) Received: from [192.168.38.17] (91.220.146.112) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 14 Oct 2019 08:08:23 +0100 To: , Adrien Mazarguil , John McNamara , Marko Kovacevic , Thomas Monjalon , "Ferruh Yigit" CC: , References: <20191014042956.18616-1-kirankumark@marvell.com> From: Andrew Rybchenko Message-ID: <38d75229-554c-5a8d-5aa9-e4dc6e968c00@solarflare.com> Date: Mon, 14 Oct 2019 10:08:20 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191014042956.18616-1-kirankumark@marvell.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB X-Originating-IP: [91.220.146.112] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24974.003 X-TM-AS-Result: No-14.695100-8.000000-10 X-TMASE-MatchedRID: xcONGPdDH5rmLzc6AOD8DfHkpkyUphL9NV9S7O+u3KZ+SLLtNOiBho+6 rpsQrK11Bu48gwYo41iclGPdyA5gnvirh+cliRUjXK5keCa+bmhr9+Kgn2XgeNZd/DOmlnxIdHn bA2HfA0lEyRr1yZ+TeeDN4matanrekwqG9GH9l94/ApMPW/xhXkyQ5fRSh265CNtDUIANZQyFoq lLIrmVqZiXUTPYiDnX9k3gQgWisFC91arw4xzlzeIfK/Jd5eHmRPSUa19sr+lvmq6agcbc/HrYP 7mo+hqY/2jTSlAtRWGwuxPU0B5donbI+PVdeqUpPKN38CLPK0FADiNYpPhgILlmMfLNiukaLBS0 rZizbDNoTEHC2+l7XLiiKeszSmU4dm10NLkSjkFwyzIdDi4qeRsl1jYkPzj/wyzogwih92KjxYy RBa/qJQPTK4qtAgwIWWZjCFLCEBpGONWF/6P/CnTKzu8nNCP8KrauXd3MZDWg42+KMinH0Xo+kB P1O02dO34yWI6LDPbEYoAf6hb/u8ryRsvYWFn7 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--14.695100-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24974.003 X-MDID: 1571036918-eXWHQU0yukf3 Subject: Re: [dpdk-dev] [PATCH] ethdev: add HIGIG2 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" On 10/14/19 7:29 AM, kirankumark@marvell.com wrote: > From: Kiran Kumar K > > Add new rte_flow_item_higig2_hdr in order to match higig2 header. > It is a layer 2.5 protocol and used in broadcom switches. > Header format is based on the following document. > http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf > > Signed-off-by: Kiran Kumar K > --- > doc/guides/prog_guide/rte_flow.rst | 8 ++++ > lib/librte_ethdev/rte_flow.c | 1 + > lib/librte_ethdev/rte_flow.h | 77 ++++++++++++++++++++++++++++++ As far as I remember support in testpmd is a must requirement to add new RTE flow API feature. > 3 files changed, 86 insertions(+) > > diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst > index 1c837ff13..71365b159 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -1290,6 +1290,14 @@ Matches a IP Authentication Header (RFC 4302). > - Default ``mask`` matches spi. > > > +Item: ``HIGIG2`` > +^^^^^^^^^^^^^^^^^ > + > +Matches a HIGIG2 header field. It is layer 2.5 protocol and used in > +broadcom switches. > + > +- Default ``mask`` matches classification and vlan. > + Right now there is one empty line between items and two between the last item and actions. It should be preserved. > Actions > ~~~~~~~ > > diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c > index 81a85b995..ca0f68016 100644 > --- a/lib/librte_ethdev/rte_flow.c > +++ b/lib/librte_ethdev/rte_flow.c > @@ -83,6 +83,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { > MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)), > MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)), > MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)), > + MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)), > }; > > /** Generate flow_action[] entry. */ > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h > index bcfc06cdc..59e37f714 100644 > --- a/lib/librte_ethdev/rte_flow.h > +++ b/lib/librte_ethdev/rte_flow.h > @@ -491,6 +491,12 @@ enum rte_flow_item_type { > * > */ > RTE_FLOW_ITEM_TYPE_AH, > + > + /** > + * Matches a HIGIG header. > + * see struct rte_flow_item_higig2_hdr. > + */ > + RTE_FLOW_ITEM_TYPE_HIGIG2, > }; > > /** > @@ -515,6 +521,77 @@ static const struct rte_flow_item_any rte_flow_item_any_mask = { > }; > #endif > > +/** > + * RTE_FLOW_ITEM_TYPE_HIGIG2 > + * Matches higig2 header. > + */ > +struct rte_higig2_frc { > + uint32_t ksop:8; > + uint32_t resv:3; > + uint32_t mcst:1; > + uint32_t tc:4; > + uint32_t dst_modid:8; > + uint32_t dst_pid:8; > + uint32_t src_modid:8; > + uint32_t src_pid:8; > + uint32_t lbid:8; > + uint32_t dp:2; > + uint32_t resv1:3; > + uint32_t ppd_type:3; > +} __attribute__((packed)); > + > +struct rte_higig2_ppt_type0 { > + uint32_t dst_t:1; > + uint32_t dst_tgid:3; > + uint32_t ingress_tagged:1; > + uint32_t mirror_only:1; > + uint32_t mirror_done:1; > + uint32_t mirror:1; > + uint32_t res:2; > + uint32_t l3:1; > + uint32_t label_present:1; > + uint32_t vc_label2:4; > + uint32_t vc_label1:8; > + uint32_t vc_label0:8; > + uint32_t vid_high:8; > + uint32_t vid_low:8; > + uint32_t pfm:2; > + uint32_t src_t:1; > + uint32_t res1:2; > + uint32_t opcode:3; > + uint32_t hdr_ext_len:3; > + uint32_t res2:5; > +} __attribute__((packed)); > + > +struct rte_higig2_ppt_type1 { > + uint32_t classification:16; > + uint32_t resv:16; > + uint32_t vid:16; > + uint32_t pfm:2; > + uint32_t src_t:1; > + uint32_t resv1:2; > + uint32_t opcode:3; > + uint32_t hdr_ext_len:3; > + uint32_t resv2:5; > +} __attribute__((packed)); > + Usage of bit fields in network headers require big/little endian handling. See lib/librte_net/rte_gre.h Also other network protocol headers are defined in lib/librte_net. > +RTE_STD_C11 > +struct rte_flow_item_higig2_hdr { > + struct rte_higig2_frc fcr; > + union { > + struct rte_higig2_ppt_type0 ppt0; > + struct rte_higig2_ppt_type1 ppt1; > + }; > +} __attribute__((packed)); > + > +/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */ > +#ifndef __cplusplus > +static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = { > + .ppt1.classification = 0xffff, > + .ppt1.vid = 0xfff, > +}; It would be useful to see default mask choice motivation. > +#endif > + > /** > * RTE_FLOW_ITEM_TYPE_VF > *