DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xing, Beilei" <beilei.xing@intel.com>
To: "Qiao, Wenjing" <wenjing.qiao@intel.com>,
	"Zhang, Yuying" <yuying.zhang@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "Liu, Mingxia" <mingxia.liu@intel.com>
Subject: RE: [PATCH v2 1/4] net/cpfl: parse flow parser file in devargs
Date: Thu, 24 Aug 2023 03:15:21 +0000	[thread overview]
Message-ID: <LV2PR11MB59972718A50334BD35A5323DF71DA@LV2PR11MB5997.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230811100012.2078135-2-wenjing.qiao@intel.com>



> -----Original Message-----
> From: Qiao, Wenjing <wenjing.qiao@intel.com>
> Sent: Friday, August 11, 2023 6:00 PM
> To: Zhang, Yuying <yuying.zhang@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Liu, Mingxia <mingxia.liu@intel.com>; Qiao, Wenjing
> <wenjing.qiao@intel.com>
> Subject: [PATCH v2 1/4] net/cpfl: parse flow parser file in devargs
> 
> Add devargs "flow_parser" for rte_flow json parser.
> 
> Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
> ---
> Depends-on: series-29139 ("net/cpfl: support port representor")
> ---
>  drivers/net/cpfl/cpfl_ethdev.c | 30 +++++++++++++++++++++++++++++-
> drivers/net/cpfl/cpfl_ethdev.h |  3 +++
>  drivers/net/cpfl/meson.build   |  6 ++++++
>  3 files changed, 38 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c index
> 8dbc175749..a2f308fb86 100644
> --- a/drivers/net/cpfl/cpfl_ethdev.c
> +++ b/drivers/net/cpfl/cpfl_ethdev.c
> @@ -21,6 +21,7 @@
>  #define CPFL_TX_SINGLE_Q	"tx_single"
>  #define CPFL_RX_SINGLE_Q	"rx_single"
>  #define CPFL_VPORT		"vport"
> +#define CPFL_FLOW_PARSER	"flow_parser"
> 
>  rte_spinlock_t cpfl_adapter_lock;
>  /* A list for all adapters, one adapter matches one PCI device */ @@ -32,6
> +33,9 @@ static const char * const cpfl_valid_args_first[] = {
>  	CPFL_TX_SINGLE_Q,
>  	CPFL_RX_SINGLE_Q,
>  	CPFL_VPORT,
> +#ifdef CPFL_FLOW_JSON_SUPPORT
> +	CPFL_FLOW_PARSER,
> +#endif
>  	NULL
>  };
> 
> @@ -1671,6 +1675,19 @@ parse_repr(const char *key __rte_unused, const
> char *value, void *args)
>  	return 0;
>  }
> 
> +#ifdef CPFL_FLOW_JSON_SUPPORT
> +static int
> +parse_parser_file(const char *key, const char *value, void *args) {
> +	char *name = args;
> +
> +	PMD_DRV_LOG(DEBUG, "value:\"%s\" for key:\"%s\"", value, key);

Better to check if the value is valid first, e.g. return error if the length > CPFL_FLOW_FILE_LEN.

> +	strlcpy(name, value, CPFL_FLOW_FILE_LEN);
> +
> +	return 0;
> +}
> +#endif
> +
>  static int
>  cpfl_parse_devargs(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext
> *adapter, bool first)  { @@ -1719,7 +1736,18 @@ cpfl_parse_devargs(struct
> rte_pci_device *pci_dev, struct cpfl_adapter_ext *adap
>  				 &adapter->base.is_rx_singleq);
>  	if (ret != 0)
>  		goto fail;
> -
> +#ifdef CPFL_FLOW_JSON_SUPPORT
> +	if (rte_kvargs_get(kvlist, CPFL_FLOW_PARSER)) {
> +		ret = rte_kvargs_process(kvlist, CPFL_FLOW_PARSER,
> +					 &parse_parser_file, cpfl_args-
> >flow_parser);
> +		if (ret) {
> +			PMD_DRV_LOG(ERR, "Failed to parser flow_parser,
> ret: %d", ret);
> +			goto fail;
> +		}
> +	} else {
> +		cpfl_args->flow_parser[0] = '\0';
> +	}
> +#endif
>  fail:
>  	rte_kvargs_free(kvlist);
>  	return ret;
> diff --git a/drivers/net/cpfl/cpfl_ethdev.h b/drivers/net/cpfl/cpfl_ethdev.h
> index 5bd6f930b8..cf989a29b3 100644
> --- a/drivers/net/cpfl/cpfl_ethdev.h
> +++ b/drivers/net/cpfl/cpfl_ethdev.h
> @@ -87,6 +87,8 @@
>  #define ACC_LCE_ID	15
>  #define IMC_MBX_EFD_ID	0
> 
> +#define CPFL_FLOW_FILE_LEN 100
> +
>  struct cpfl_vport_param {
>  	struct cpfl_adapter_ext *adapter;
>  	uint16_t devarg_id; /* arg id from user */ @@ -100,6 +102,7 @@
> struct cpfl_devargs {
>  	uint16_t req_vport_nb;
>  	uint8_t repr_args_num;
>  	struct rte_eth_devargs repr_args[CPFL_REPR_ARG_NUM_MAX];
> +	char flow_parser[CPFL_FLOW_FILE_LEN];
>  };
> 
>  struct p2p_queue_chunks_info {
> diff --git a/drivers/net/cpfl/meson.build b/drivers/net/cpfl/meson.build index
> fb075c6860..0be25512c3 100644
> --- a/drivers/net/cpfl/meson.build
> +++ b/drivers/net/cpfl/meson.build
> @@ -38,3 +38,9 @@ if arch_subdir == 'x86'
>          cflags += ['-DCC_AVX512_SUPPORT']
>      endif
>  endif
> +
> +js_dep = dependency('json-c', required: false, method : 'pkg-config')
> +if js_dep.found()
> +    dpdk_conf.set('CPFL_FLOW_JSON_SUPPORT', true)
> +    ext_deps += js_dep
> +endif
> \ No newline at end of file
> --
> 2.34.1

Update doc to describe installing json lib first if need to parse json file.


  reply	other threads:[~2023-08-24  3:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11  9:30 [PATCH 0/4] net/cpfl: add basic support for rte_flow Wenjing Qiao
2023-08-11  9:30 ` [PATCH 1/4] net/cpfl: parse flow parser file in devargs Wenjing Qiao
2023-08-11 10:00   ` [PATCH v2 0/4] net/cpfl: add basic support for rte_flow Wenjing Qiao
2023-08-11 10:00   ` [PATCH v2 1/4] net/cpfl: parse flow parser file in devargs Wenjing Qiao
2023-08-24  3:15     ` Xing, Beilei [this message]
2023-08-11 10:00   ` [PATCH v2 2/4] net/cpfl: add flow json parser Wenjing Qiao
2023-08-24  7:25     ` Xing, Beilei
2023-08-11 10:00   ` [PATCH v2 3/4] net/cpfl: introduce CPF common library Wenjing Qiao
2023-08-11 10:00   ` [PATCH v2 4/4] net/cpfl: setup ctrl path Wenjing Qiao
2023-08-11  9:30 ` [PATCH 2/4] net/cpfl: add flow json parser Wenjing Qiao
2023-08-11  9:30 ` [PATCH 3/4] net/cpfl: introduce CPF common library Wenjing Qiao
2023-08-24  9:19   ` Xing, Beilei
2023-09-01  8:14     ` Qiao, Wenjing
2023-08-11  9:30 ` [PATCH 4/4] net/cpfl: setup ctrl path Wenjing Qiao
2023-08-24  9:15   ` Xing, Beilei

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=LV2PR11MB59972718A50334BD35A5323DF71DA@LV2PR11MB5997.namprd11.prod.outlook.com \
    --to=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=mingxia.liu@intel.com \
    --cc=wenjing.qiao@intel.com \
    --cc=yuying.zhang@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).