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 0830DA327F for ; Mon, 21 Oct 2019 18:48:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ACEB41BF51; Mon, 21 Oct 2019 18:48:52 +0200 (CEST) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id 89AB41BF4C for ; Mon, 21 Oct 2019 18:48:51 +0200 (CEST) Received: by mail-wr1-f65.google.com with SMTP id o28so14795797wro.7 for ; Mon, 21 Oct 2019 09:48:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=RImBgLC20oORfkiPZ9kqsoGZ8bZdcNuqT7hWacc9V/w=; b=gWpLlNtRHyKgmQBGe6SwT9xZSXG7/Ki9BAzIh2JMQug57laN9TwypOKNlGhqEJ8t9r 8tsk11sIzEn27Qglz2O37Ve+p62Yg+nsbNoEWVFGdzkvDOhDyfGNqoxR9BIeNLh7aleL 25BlCRIeo4CamzKGcqEZ5UibItW9tROQKMuAnAd4beL/kKJ5Jzpa+T3uJxsq8C2blPS5 kJl1yJdZzlbZjyvxStPG1MbPIpJF5O2noMFcPd32ZgIHwJtwOc2s+A4t/GZZPBcCWUxy cQEm/p5t7/vYfv0xL99X4s01gkfZhG2KdJt1KRyd285iH0heDTPYTt0OuA5UQCUQObvV +37Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=RImBgLC20oORfkiPZ9kqsoGZ8bZdcNuqT7hWacc9V/w=; b=lFrnaI9UovgTOhQe3seyTUCYmJq2MEeO8wGl3sUrJixt4IAWGY74V928BhIyM1TGL3 B3EsB2cbix3Z+h5SvScbAnH1Y5opKBBmkum6YXmDHu6UDQACcFgL6Nzh1tR9PhjhuB4x +vb2eLebNv9frVHITLvPLihFKDfHIi0Hrw3v6lNetLTrXhxdHoRdFv87QHv/3+RnVStl /DYkKjKOYZr/5dvS4UxgxZvd69GxsYyvSy/Y3TZEeVA0ymjoVl3+89MQ5crsGfMakidX d4MEKxhWG3PhS+sKwthnUoXCGwmdrMUl89wNxN453kUVjyU3ss7k67TJ8ZDmd/q0dRWy CLpA== X-Gm-Message-State: APjAAAVTzOhVWaVJojwh/y1C+dPjoLr1aMDLwtTYu9+lQNqXUG3BAohW 2DUrYhUm0IZjHUy25eQrU53itg== X-Google-Smtp-Source: APXvYqzOb9vG9Aqkpk2dEvwsUiA3cfy5Ry6KxIKJ3njcLamJ4zdheQ6IcgfnTGq9VpaoHoOyUOSerA== X-Received: by 2002:a5d:660c:: with SMTP id n12mr6426167wru.310.1571676531041; Mon, 21 Oct 2019 09:48:51 -0700 (PDT) Received: from 6wind.com (2a01cb0c0005a6000226b0fffeed02fc.ipv6.abo.wanadoo.fr. [2a01:cb0c:5:a600:226:b0ff:feed:2fc]) by smtp.gmail.com with ESMTPSA id r27sm27071958wrc.55.2019.10.21.09.48.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 09:48:49 -0700 (PDT) Date: Mon, 21 Oct 2019 18:48:49 +0200 From: Olivier Matz To: kirankumark@marvell.com Cc: Adrien Mazarguil , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , dev@dpdk.org, ajit.khaparde@broadcom.com Message-ID: <20191021164849.cydvfmcuzooz4zsn@platinum> References: <20191021035213.9675-1-kirankumark@marvell.com> <20191021091617.11290-1-kirankumark@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191021091617.11290-1-kirankumark@marvell.com> User-Agent: NeoMutt/20180716 Subject: Re: [dpdk-dev] [PATCH v9] 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" Hi, On Mon, Oct 21, 2019 at 02:46:17PM +0530, 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 > Acked-by: Andrew Rybchenko > --- > V9 Changes: > * Fix gcc 4.8 compile issue > > V8 Changes: > * Fixed gcc 4.8 compile issue > > V7 changes: > * Added doxygen comments > * Moved rte_flow specific code to rte_flow.h > > V6 changes: > * Updated doxy-api > > V5 changes: > * Changed broadcom to Broadcom > * Changed RTE_HIGIG2_H to RTE_HIGIG_H > * Fixed meson build > > V4 Changes: > * Removed packed attribute > > V3 Changes: > * Fixed Copyright header > * Fixed version info in the subject > > V2 Changes: > * Added support in testpmd to parse the higig2 item > * Moved the higig2 header to new file > * Added indentation in doc > > app/test-pmd/cmdline_flow.c | 33 +++++++ > doc/api/doxy-api-index.md | 3 +- > doc/guides/prog_guide/rte_flow.rst | 8 ++ > lib/librte_ethdev/rte_flow.c | 1 + > lib/librte_ethdev/rte_flow.h | 29 ++++++ > lib/librte_net/Makefile | 2 +- > lib/librte_net/meson.build | 3 +- > lib/librte_net/rte_higig.h | 144 +++++++++++++++++++++++++++++ > 8 files changed, 220 insertions(+), 3 deletions(-) > create mode 100644 lib/librte_net/rte_higig.h > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index b26b8bfe2..970bdef1d 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -203,6 +203,9 @@ enum index { > ITEM_PPPOED, > ITEM_PPPOE_SEID, > ITEM_PPPOE_PROTO_ID, > + ITEM_HIGIG2, > + ITEM_HIGIG2_CLASSIFICATION, > + ITEM_HIGIG2_VID, > > /* Validate/create actions. */ > ACTIONS, > @@ -675,6 +678,7 @@ static const enum index next_item[] = { > ITEM_PPPOES, > ITEM_PPPOED, > ITEM_PPPOE_PROTO_ID, > + ITEM_HIGIG2, > END_SET, > ZERO, > }; > @@ -939,6 +943,13 @@ static const enum index item_pppoe_proto_id[] = { > ZERO, > }; > > +static const enum index item_higig2[] = { > + ITEM_HIGIG2_CLASSIFICATION, > + ITEM_HIGIG2_VID, > + ITEM_NEXT, > + ZERO, > +}; > + > static const enum index next_action[] = { > ACTION_END, > ACTION_VOID, > @@ -2419,6 +2430,28 @@ static const struct token token_list[] = { > .next = NEXT(item_pppoe_proto_id), > .call = parse_vc, > }, > + [ITEM_HIGIG2] = { > + .name = "higig2", > + .help = "matches higig2 header", > + .priv = PRIV_ITEM(HIGIG2, > + sizeof(struct rte_flow_item_higig2_hdr)), > + .next = NEXT(item_higig2), > + .call = parse_vc, > + }, > + [ITEM_HIGIG2_CLASSIFICATION] = { > + .name = "classification", > + .help = "matches classification of higig2 header", > + .next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param), > + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr, > + hdr.ppt1.classification)), > + }, > + [ITEM_HIGIG2_VID] = { > + .name = "vid", > + .help = "matches vid of higig2 header", > + .next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param), > + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr, > + hdr.ppt1.vid)), > + }, > /* Validate/create actions. */ > [ACTIONS] = { > .name = "actions", > diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md > index 6c2d888ee..c52b54e55 100644 > --- a/doc/api/doxy-api-index.md > +++ b/doc/api/doxy-api-index.md > @@ -101,7 +101,8 @@ The public API headers are grouped by topics: > [GSO] (@ref rte_gso.h), > [frag/reass] (@ref rte_ip_frag.h), > [LPM IPv4 route] (@ref rte_lpm.h), > - [LPM IPv6 route] (@ref rte_lpm6.h) > + [LPM IPv6 route] (@ref rte_lpm6.h), > + [HIGIG] (@ref rte_higig.h) > > - **QoS**: > [metering] (@ref rte_meter.h), > diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst > index 1c837ff13..6e6d44df2 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -1289,6 +1289,14 @@ Matches a IP Authentication Header (RFC 4302). > - ``seq_num``: counter value increased by 1 on each packet sent. > - 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. > + > > 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..4fee10559 100644 > --- a/lib/librte_ethdev/rte_flow.h > +++ b/lib/librte_ethdev/rte_flow.h > @@ -27,6 +27,7 @@ > #include > #include > #include > +#include > > #ifdef __cplusplus > extern "C" { > @@ -491,8 +492,36 @@ 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, > }; > > +/** > + * > + * RTE_FLOW_ITEM_TYPE_HIGIG2 > + * Matches higig2 header > + */ > +RTE_STD_C11 > +struct rte_flow_item_higig2_hdr { > + struct rte_higig2_hdr hdr; > +}; > + > +/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */ > +#ifndef __cplusplus > +static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = { > + .hdr = { > + .ppt1 = { > + .classification = 0xffff, > + .vid = 0xfff, > + }, > + }, > +}; > +#endif > + > /** > * RTE_FLOW_ITEM_TYPE_ANY > * > diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile > index 1244c9fd5..62735a5f9 100644 > --- a/lib/librte_net/Makefile > +++ b/lib/librte_net/Makefile > @@ -21,6 +21,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c > SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_esp.h > SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h > SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h > -SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h > +SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h rte_higig.h > > include $(RTE_SDK)/mk/rte.lib.mk > diff --git a/lib/librte_net/meson.build b/lib/librte_net/meson.build > index 868a93fd6..c52c34592 100644 > --- a/lib/librte_net/meson.build > +++ b/lib/librte_net/meson.build > @@ -14,7 +14,8 @@ headers = files('rte_ip.h', > 'rte_gre.h', > 'rte_net.h', > 'rte_net_crc.h', > - 'rte_mpls.h') > + 'rte_mpls.h', > + 'rte_higig.h') > > sources = files('rte_arp.c', 'rte_ether.c', 'rte_net.c', 'rte_net_crc.c') > deps += ['mbuf'] > diff --git a/lib/librte_net/rte_higig.h b/lib/librte_net/rte_higig.h > new file mode 100644 > index 000000000..4847448df > --- /dev/null > +++ b/lib/librte_net/rte_higig.h > @@ -0,0 +1,144 @@ > + > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2019 Marvell International Ltd. > + */ > + > +#ifndef _RTE_HIGIG_H_ > +#define _RTE_HIGIG_H_ > + > +#include > +#include > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +/** > + * > + * higig2 frc header. > + */ > +struct rte_higig2_frc { > +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN > + uint32_t ksop:8; > + uint32_t tc:4; > + uint32_t mcst:1; > + uint32_t resv:3; > + 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 ppd_type:3; > + uint32_t resv1:3; > + uint32_t dp:2; > +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN > + 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; > +#endif > +}; > + > + > +/** > + * > + * higig2 ppt type0 header > + */ > +struct rte_higig2_ppt_type0 { > +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN > + uint32_t mirror:1; > + uint32_t mirror_done:1; > + uint32_t mirror_only:1; > + uint32_t ingress_tagged:1; > + uint32_t dst_tgid:3; > + uint32_t dst_t:1; > + uint32_t vc_label2:4; > + uint32_t label_present:1; > + uint32_t l3:1; > + uint32_t res:2; > + uint32_t vc_label1:8; > + uint32_t vc_label0:8; > + uint32_t vid_high:8; > + uint32_t vid_low:8; > + uint32_t opc:3; > + uint32_t res1:2; > + uint32_t srce_t:1; > + uint32_t pf:2; > + uint32_t res2:5; > + uint32_t hdr_ext_length:3; > +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN > + 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 pf:2; > + uint32_t srce_t:1; > + uint32_t res1:2; > + uint32_t opc:3; > + uint32_t hdr_ext_length:3; > + uint32_t res2:5; > +#endif > +}; > + > + > +/** > + * > + * higig2 ppt type1 header. > + */ > +struct rte_higig2_ppt_type1 { > + uint16_t classification; > + uint16_t resv; > + uint16_t vid; > +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN > + uint32_t opcode:3; > + uint32_t resv1:2; > + uint32_t src_t:1; > + uint32_t pfm:2; > + uint32_t resv2:5; > + uint32_t hdr_ext_len:3; > +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN > + 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; > +#endif > +}; I don't know this protocol, but the output of pahole for this struct (little endian version) is: struct rte_higig2_ppt_type1 { uint16_t classification; /* 0 2 */ uint16_t resv; /* 2 2 */ uint16_t vid; /* 4 2 */ /* Bitfield combined with previous fields */ uint32_t opcode:3; /* 4:13 4 */ uint32_t resv1:2; /* 4:11 4 */ uint32_t src_t:1; /* 4:10 4 */ uint32_t pfm:2; /* 4: 8 4 */ uint32_t resv2:5; /* 4: 3 4 */ uint32_t hdr_ext_len:3; /* 4: 0 4 */ /* size: 8, cachelines: 1, members: 9 */ /* bit_padding: 16 bits */ /* last cacheline: 8 bytes */ }; There is a 16 bits padding at the end, is it expected? Apart from this comment: Acked-by: Olivier Matz