DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ori Kam <orika@mellanox.com>
To: Bing Zhao <bingz@mellanox.com>,
	"john.mcnamara@intel.com" <john.mcnamara@intel.com>,
	"marko.kovacevic@intel.com" <marko.kovacevic@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	"ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
	"arybchenko@solarflare.com" <arybchenko@solarflare.com>,
	"olivier.matz@6wind.com" <olivier.matz@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"wenzhuo.lu@intel.com" <wenzhuo.lu@intel.com>,
	"beilei.xing@intel.com" <beilei.xing@intel.com>,
	"bernard.iremonger@intel.com" <bernard.iremonger@intel.com>
Subject: Re: [dpdk-dev] [PATCH v3 2/2] app/testpmd: add eCPRI in flow creation patterns
Date: Sun, 5 Jul 2020 11:36:53 +0000
Message-ID: <AM6PR05MB51766D13AD1475542343E3F2DB680@AM6PR05MB5176.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <1593694422-299952-3-git-send-email-bingz@mellanox.com>

Hi Bing,

> -----Original Message-----
> From: Bing Zhao <bingz@mellanox.com>
> Sent: Thursday, July 2, 2020 3:54 PM
> To: Ori Kam <orika@mellanox.com>; john.mcnamara@intel.com;
> marko.kovacevic@intel.com; Thomas Monjalon <thomas@monjalon.net>;
> ferruh.yigit@intel.com; arybchenko@solarflare.com; olivier.matz@6wind.com
> Cc: dev@dpdk.org; wenzhuo.lu@intel.com; beilei.xing@intel.com;
> bernard.iremonger@intel.com
> Subject: [PATCH v3 2/2] app/testpmd: add eCPRI in flow creation patterns
> 
> In order to verify offloading of eCPRI protocol via flow rules, the
> command line of flow creation should support the parsing of the eCPRI
> pattern.
> 
> Based on the specification, one eCPRI message will have the common
> header and payload. Payload format is various based on the type field
> of the common header. Fixed strings will be used instead of integer
> to make the CLI easy for auto-completion.
> 
> The testpmd command line examples of flow to match eCPRI item are
> listed below:
>   1. flow create 0 ... pattern eth / ecpri / end actions ...
>     This is to match all eCPRI messages.
>   2. flow create 0 ... pattern eth / ecpri common type rtc_ctrl / end actions ...
>     This is to match all eCPRI messages with the type #2 - "Real-Time
>     Control Data".
>   3. flow create 0 ... pattern eth / ecpri common type iq_data pc_id is [U16Int] /
> end actions ...
>     This is to match eCPRI messages with the type #0 - "IQ Data", and
>     the physical channel ID 'pc_id' of the messages is a specific
>     value. Since the sequence ID is changeable, there is no need to
>     match that field in the flow.
> Currently, only type #0, #2 and #5 will be supported.
> 
> Since eCPRI could be over Ethernet layer (or after .1Q) and UDP
> layer, it is the PMD driver's responsibility to check whether eCPRI
> is supported and which protocol stack is supported. Network byte
> order should be used for eCPRI header, the same as other headers.
> 
> Signed-off-by: Bing Zhao <bingz@mellanox.com>
> ---
>  app/test-pmd/cmdline_flow.c | 143
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 143 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 4e2006c..801581e 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -230,6 +230,15 @@ enum index {
>  	ITEM_PFCP,
>  	ITEM_PFCP_S_FIELD,
>  	ITEM_PFCP_SEID,
> +	ITEM_ECPRI,
> +	ITEM_ECPRI_COMMON,
> +	ITEM_ECPRI_COMMON_TYPE,
> +	ITEM_ECPRI_COMMON_TYPE_IQ_DATA,
> +	ITEM_ECPRI_COMMON_TYPE_RTC_CTRL,
> +	ITEM_ECPRI_COMMON_TYPE_DLY_MSR,
> +	ITEM_ECPRI_MSG_IQ_DATA_PCID,
> +	ITEM_ECPRI_MSG_RTC_CTRL_RTCID,
> +	ITEM_ECPRI_MSG_DLY_MSR_MSRID,
> 
>  	/* Validate/create actions. */
>  	ACTIONS,
> @@ -791,6 +800,7 @@ static const enum index next_item[] = {
>  	ITEM_ESP,
>  	ITEM_AH,
>  	ITEM_PFCP,
> +	ITEM_ECPRI,
>  	END_SET,
>  	ZERO,
>  };
> @@ -1101,6 +1111,24 @@ static const enum index item_l2tpv3oip[] = {
>  	ZERO,
>  };
> 
> +static const enum index item_ecpri[] = {
> +	ITEM_ECPRI_COMMON,
> +	ITEM_NEXT,
> +	ZERO,
> +};
> +
> +static const enum index item_ecpri_common[] = {
> +	ITEM_ECPRI_COMMON_TYPE,
> +	ZERO,
> +};
> +
> +static const enum index item_ecpri_common_type[] = {
> +	ITEM_ECPRI_COMMON_TYPE_IQ_DATA,
> +	ITEM_ECPRI_COMMON_TYPE_RTC_CTRL,
> +	ITEM_ECPRI_COMMON_TYPE_DLY_MSR,
> +	ZERO,
> +};
> +
>  static const enum index next_action[] = {
>  	ACTION_END,
>  	ACTION_VOID,
> @@ -1409,6 +1437,9 @@ static int parse_vc_spec(struct context *, const struct
> token *,
>  			 const char *, unsigned int, void *, unsigned int);
>  static int parse_vc_conf(struct context *, const struct token *,
>  			 const char *, unsigned int, void *, unsigned int);
> +static int parse_vc_item_ecpri_type(struct context *, const struct token *,
> +				    const char *, unsigned int,
> +				    void *, unsigned int);
>  static int parse_vc_action_rss(struct context *, const struct token *,
>  			       const char *, unsigned int, void *,
>  			       unsigned int);
> @@ -2802,6 +2833,66 @@ static const struct token token_list[] = {
>  		.next = NEXT(item_pfcp, NEXT_ENTRY(UNSIGNED),
> item_param),
>  		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pfcp,
> seid)),
>  	},
> +	[ITEM_ECPRI] = {
> +		.name = "ecpri",
> +		.help = "match eCPRI header",
> +		.priv = PRIV_ITEM(ECPRI, sizeof(struct rte_flow_item_ecpri)),
> +		.next = NEXT(item_ecpri),
> +		.call = parse_vc,
> +	},
> +	[ITEM_ECPRI_COMMON] = {
> +		.name = "common",
> +		.help = "eCPRI common header",
> +		.next = NEXT(item_ecpri_common),
> +	},
> +	[ITEM_ECPRI_COMMON_TYPE] = {
> +		.name = "type",
> +		.help = "type of common header",
> +		.next = NEXT(item_ecpri_common_type),
> +		.args = ARGS(ARG_ENTRY_HTON(struct rte_flow_item_ecpri)),
> +	},
> +	[ITEM_ECPRI_COMMON_TYPE_IQ_DATA] = {
> +		.name = "iq_data",
> +		.help = "Type #0: IQ Data",
> +		.next = NEXT(NEXT_ENTRY(ITEM_ECPRI_MSG_IQ_DATA_PCID,
> +					ITEM_NEXT)),
> +		.call = parse_vc_item_ecpri_type,
> +	},
> +	[ITEM_ECPRI_MSG_IQ_DATA_PCID] = {
> +		.name = "pc_id",
> +		.help = "Physical Channel ID",
> +		.next = NEXT(item_ecpri, NEXT_ENTRY(UNSIGNED),
> item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ecpri,
> +				hdr.type0.pc_id)),
> +	},
> +	[ITEM_ECPRI_COMMON_TYPE_RTC_CTRL] = {
> +		.name = "rtc_ctrl",
> +		.help = "Type #2: Real-Time Control Data",
> +		.next =
> NEXT(NEXT_ENTRY(ITEM_ECPRI_MSG_RTC_CTRL_RTCID,
> +					ITEM_NEXT)),
> +		.call = parse_vc_item_ecpri_type,
> +	},
> +	[ITEM_ECPRI_MSG_RTC_CTRL_RTCID] = {
> +		.name = "rtc_id",
> +		.help = "Real-Time Control Data ID",
> +		.next = NEXT(item_ecpri, NEXT_ENTRY(UNSIGNED),
> item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ecpri,
> +				hdr.type2.rtc_id)),
> +	},
> +	[ITEM_ECPRI_COMMON_TYPE_DLY_MSR] = {
> +		.name = "delay_measure",
> +		.help = "Type #5: One-Way Delay Measurement",
> +		.next =
> NEXT(NEXT_ENTRY(ITEM_ECPRI_MSG_DLY_MSR_MSRID,
> +					ITEM_NEXT)),
> +		.call = parse_vc_item_ecpri_type,
> +	},
> +	[ITEM_ECPRI_MSG_DLY_MSR_MSRID] = {
> +		.name = "msr_id",
> +		.help = "Measurement ID",
> +		.next = NEXT(item_ecpri, NEXT_ENTRY(UNSIGNED),
> item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ecpri,
> +				hdr.type5.msr_id)),
> +	},
>  	/* Validate/create actions. */
>  	[ACTIONS] = {
>  		.name = "actions",
> @@ -4124,6 +4215,58 @@ parse_vc_conf(struct context *ctx, const struct
> token *token,
>  	return len;
>  }
> 
> +/** Parse eCPRI common header type field. */
> +static int
> +parse_vc_item_ecpri_type(struct context *ctx, const struct token *token,
> +			 const char *str, unsigned int len,
> +			 void *buf, unsigned int size)
> +{
> +	struct rte_flow_item_ecpri *ecpri;
> +	struct rte_flow_item_ecpri *ecpri_mask;
> +	struct rte_flow_item *item;
> +	uint32_t data_size;
> +	uint8_t msg_type;
> +	struct buffer *out = buf;
> +	const struct arg *arg;
> +
> +	(void)size;
> +	/* Token name must match. */
> +	if (parse_default(ctx, token, str, len, NULL, 0) < 0)
> +		return -1;
> +	switch (ctx->curr) {
> +	case ITEM_ECPRI_COMMON_TYPE_IQ_DATA:
> +		msg_type = RTE_ECPRI_MSG_TYPE_IQ_DATA;
> +		break;
> +	case ITEM_ECPRI_COMMON_TYPE_RTC_CTRL:
> +		msg_type = RTE_ECPRI_MSG_TYPE_RTC_CTRL;
> +		break;
> +	case ITEM_ECPRI_COMMON_TYPE_DLY_MSR:
> +		msg_type = RTE_ECPRI_MSG_TYPE_DLY_MSR;
> +		break;
> +	default:
> +		return -1;
> +	}
> +	if (!ctx->object)
> +		return len;
> +	arg = pop_args(ctx);
> +	if (!arg)
> +		return -1;
> +	ecpri = (struct rte_flow_item_ecpri *)out->args.vc.data;
> +	ecpri->hdr.common.type = msg_type;
> +	data_size = ctx->objdata / 3; /* spec, last, mask */
> +	ecpri_mask = (struct rte_flow_item_ecpri *)(out->args.vc.data +
> +						    (data_size * 2));
> +	ecpri_mask->hdr.common.type = 0xFF;
> +	if (arg->hton) {
> +		ecpri->hdr.dw0 = rte_cpu_to_be_32(ecpri->hdr.dw0);
> +		ecpri_mask->hdr.dw0 = rte_cpu_to_be_32(ecpri_mask-
> >hdr.dw0);
> +	}
> +	item = &out->args.vc.pattern[out->args.vc.pattern_n - 1];
> +	item->spec = ecpri;
> +	item->mask = ecpri_mask;
> +	return len;
> +}
> +
>  /** Parse RSS action. */
>  static int
>  parse_vc_action_rss(struct context *ctx, const struct token *token,
> --


Acked-by: Ori Kam <orika@mellanox.com>
Thanks,
Ori
> 2.5.5


  reply	other threads:[~2020-07-05 11:36 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-28 16:20 [dpdk-dev] [PATCH] rte_flow: add eCPRI key fields to flow API Bing Zhao
2020-07-02  6:46 ` [dpdk-dev] [PATCH v2] " Bing Zhao
2020-07-02  8:06   ` Ori Kam
2020-07-02 12:53   ` [dpdk-dev] [PATCH v3 0/2] rte_flow: introduce eCPRI item for rte_flow Bing Zhao
2020-07-02 12:53     ` [dpdk-dev] [PATCH v3 1/2] rte_flow: add eCPRI key fields to flow API Bing Zhao
2020-07-05 11:34       ` Ori Kam
2020-07-02 12:53     ` [dpdk-dev] [PATCH v3 2/2] app/testpmd: add eCPRI in flow creation patterns Bing Zhao
2020-07-05 11:36       ` Ori Kam [this message]
2020-07-07 15:36     ` [dpdk-dev] [PATCH v4 0/2] rte_flow: introduce eCPRI item for rte_flow Bing Zhao
2020-07-07 15:36       ` [dpdk-dev] [PATCH v4 1/2] rte_flow: add eCPRI key fields to flow API Bing Zhao
2020-07-08 18:49         ` Akhil Goyal
2020-07-09  3:58           ` Bing Zhao
2020-07-07 15:36       ` [dpdk-dev] [PATCH v4 2/2] app/testpmd: add eCPRI in flow creation patterns Bing Zhao
2020-07-10  8:45       ` [dpdk-dev] [PATCH v5 0/2] rte_flow: introduce eCPRI item for rte_flow Bing Zhao
2020-07-10  8:45         ` [dpdk-dev] [PATCH v5 1/2] rte_flow: add eCPRI key fields to flow API Bing Zhao
2020-07-10 14:31           ` Olivier Matz
2020-07-11  4:25             ` Bing Zhao
2020-07-12 13:17               ` Olivier Matz
2020-07-12 14:28                 ` Bing Zhao
2020-07-12 14:43                   ` Olivier Matz
2020-07-10  8:45         ` [dpdk-dev] [PATCH v5 2/2] app/testpmd: add eCPRI in flow creation patterns Bing Zhao
2020-07-12 13:35         ` [dpdk-dev] [PATCH v6 0/2] rte_flow: introduce eCPRI item for rte_flow Bing Zhao
2020-07-12 13:35           ` [dpdk-dev] [PATCH v6 1/2] rte_flow: add eCPRI key fields to flow API Bing Zhao
2020-07-12 14:45             ` Olivier Matz
2020-07-12 14:50               ` Bing Zhao
2020-07-13  0:50               ` Thomas Monjalon
2020-07-13  8:30                 ` Ferruh Yigit
2020-07-12 13:35           ` [dpdk-dev] [PATCH v6 2/2] app/testpmd: add eCPRI in flow creation patterns Bing Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM6PR05MB51766D13AD1475542343E3F2DB680@AM6PR05MB5176.eurprd05.prod.outlook.com \
    --to=orika@mellanox.com \
    --cc=arybchenko@solarflare.com \
    --cc=beilei.xing@intel.com \
    --cc=bernard.iremonger@intel.com \
    --cc=bingz@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=marko.kovacevic@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=thomas@monjalon.net \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git