All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Qi Zhang <qi.z.zhang@intel.com>,
	jingjing.wu@intel.com, helin.zhang@intel.com
Cc: dev@dpdk.org
Subject: Re: [PATCH v3 3/3] app/testpmd: add CL for ptype mapping configure
Date: Tue, 21 Mar 2017 15:53:33 +0000	[thread overview]
Message-ID: <3cacac5b-773a-6e16-23f1-0efb790150e0@intel.com> (raw)
In-Reply-To: <20170317104512.25969-4-qi.z.zhang@intel.com>

On 3/17/2017 10:45 AM, Qi Zhang wrote:
> Add below command line to configure ptype mapping.
> ptype mapping get <port_id> <valid_only>.
> ptype mapping replace <port_id> <target> <mask> <pkt_type>.
> ptype mapping reset <port_id>.
> ptype mapping update <port_id> <hw_ptype> <sw_ptype>.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>

<...>

> +static void
> +cmd_ptype_mapping_get_parsed(
> +	void *parsed_result,
> +	__attribute__((unused)) struct cmdline *cl,
> +	__attribute__((unused)) void *data)
> +{
> +	struct cmd_ptype_mapping_get_result *res = parsed_result;
> +	int ret = -ENOTSUP;
> +#ifdef RTE_LIBRTE_I40E_PMD
> +	int max_ptype_num = 256;
> +	struct rte_pmd_i40e_ptype_mapping mapping[max_ptype_num];
> +	uint16_t count;
> +	int i;
> +#endif
> +
> +	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
> +		return;
> +
> +#ifdef RTE_LIBRTE_I40E_PMD
> +	ret = rte_pmd_i40e_ptype_mapping_get(res->port_id,
> +					mapping,
> +					max_ptype_num,
> +					&count,
> +					res->valid_only);
> +#endif
> +
> +	switch (ret) {
> +	case 0:
> +		break;
> +	case -ENODEV:
> +		printf("invalid port_id %d\n", res->port_id);
> +		break;
> +	case -ENOTSUP:
> +		printf("function not implemented\n");
> +		break;
> +	default:
> +		printf("programming error: (%s)\n", strerror(-ret));
> +	}
> +
> +#ifdef RTE_LIBRTE_I40E_PMD
> +	if (!ret) {
> +		for (i = 0; i < count; i++)
> +			printf("%3d\t0x%08x\n",
> +				mapping[i].hw_ptype, mapping[i].sw_ptype);
> +	}
> +#endif

Why this #ifdef exists?
I thinks only wrapping the API with #ifdef should be enough, like other
commands in this patch?

  reply	other threads:[~2017-03-21 15:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-17 10:45 [PATCH v2 0/3] net/i40e: configurable PTYPE mapping Qi Zhang
2017-03-17 10:45 ` [PATCH v3 1/3] net/i40e: enable per dev PTYPE mapping table Qi Zhang
2017-03-17 10:45 ` [PATCH v3 2/3] net/i40e: configurable PTYPE mapping Qi Zhang
2017-03-24  9:55   ` Wu, Jingjing
2017-03-27  1:55     ` Zhang, Qi Z
2017-03-17 10:45 ` [PATCH v3 3/3] app/testpmd: add CL for ptype mapping configure Qi Zhang
2017-03-21 15:53   ` Ferruh Yigit [this message]
2017-03-22  1:24     ` Zhang, Qi Z

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=3cacac5b-773a-6e16-23f1-0efb790150e0@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=qi.z.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.