DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Tiago Lam <tiago.lam@intel.com>, dev@dpdk.org
Cc: linville@tuxdriver.com
Subject: Re: [dpdk-dev] [PATCH v2 2/3] net/af_packet: move parse and validation of iface
Date: Tue, 27 Nov 2018 17:42:54 +0000	[thread overview]
Message-ID: <ac8971af-7a37-c655-5e30-b6c6489f897e@intel.com> (raw)
In-Reply-To: <1542709592-215007-2-git-send-email-tiago.lam@intel.com>

On 11/20/2018 10:26 AM, Tiago Lam wrote:
> Instead of re-iterating through kvlist just to parse the
> ETH_AF_PACKET_IFACE_ARG argument in rte_pmd_init_internals(), we now use
> the already existing iteration in rte_eth_from_packet() to parse and
> validate the ETH_AF_PACKET_IFACE_ARG argument.

+1

> 
> This will be useful for a later commit, which needs to access the
> interface name to get the underlying configured MTU.
> 
> Signed-off-by: Tiago Lam <tiago.lam@intel.com>
> ---
> 
> v2: Fix checkpatches.sh and check-git-log.sh warnings.
> 
> ---
>  drivers/net/af_packet/rte_eth_af_packet.c | 77 ++++++++++++++++---------------
>  1 file changed, 41 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
> index 264cfc0..8d749a2 100644
> --- a/drivers/net/af_packet/rte_eth_af_packet.c
> +++ b/drivers/net/af_packet/rte_eth_af_packet.c
> @@ -540,15 +540,12 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
>  		       unsigned int qdisc_bypass,
>                         struct pmd_internals **internals,
>                         struct rte_eth_dev **eth_dev,
> -                       struct rte_kvargs *kvlist)
> +					   const char *ifname)

Please align other parameter formatting.

<...>

> @@ -877,6 +856,32 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
>  			}
>  			continue;
>  		}
> +		if (strstr(pair->key, ETH_AF_PACKET_IFACE_ARG) != NULL) {
> +			ifname = pair->value;
> +			if (strlen(ifname) == 0) {
> +				RTE_LOG(ERR, PMD,
> +					"%s: invalid iface value\n",
> +					name);
> +				return -1;
> +			}
> +
> +			continue;
> +		}

Indeed instead of accessing kvargs internal pair->values, this should call
rte_kvargs_process() but that is for another patch to fix all occurrences.

> +	}
> +
> +	if (ifname == NULL) {
> +		RTE_LOG(ERR, PMD,
> +			"%s: no interface specified for AF_PACKET ethdev\n",
> +			name);
> +		return -1;
> +	}
> +
> +	ifnamelen = strlen(ifname);

I am aware this is copy-paste but since update, perhaps we can use strnlen()
instead.

  reply	other threads:[~2018-11-27 17:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20  9:54 [dpdk-dev] [PATCH 1/3] net/af_packet: set_mtu() decrements sockaddr twice Tiago Lam
2018-11-20  9:54 ` [dpdk-dev] [PATCH 2/3] net/af_packet: Move parse and validation of iface Tiago Lam
2018-11-20  9:54 ` [dpdk-dev] [PATCH 3/3] net/af_packet: Get 'framesz' from the iface's MTU Tiago Lam
2018-11-20 10:26 ` [dpdk-dev] [PATCH v2 1/3] net/af_packet: set_mtu() decrements sockaddr twice Tiago Lam
2018-11-20 10:26   ` [dpdk-dev] [PATCH v2 2/3] net/af_packet: move parse and validation of iface Tiago Lam
2018-11-27 17:42     ` Ferruh Yigit [this message]
2018-11-20 10:26   ` [dpdk-dev] [PATCH v2 3/3] net/af_packet: get 'framesz' from the iface's MTU Tiago Lam
2018-11-27 17:43     ` Ferruh Yigit
2018-11-27 17:45       ` Ferruh Yigit
2018-11-28 13:12       ` Lam, Tiago
2018-11-28 13:33         ` Ferruh Yigit
2018-12-17  9:21           ` Lam, Tiago
2018-12-21 12:21             ` Ferruh Yigit
2019-02-18 18:01         ` Yigit, Ferruh
2019-03-19 13:16           ` Yigit, Ferruh
2019-03-19 13:16             ` Yigit, Ferruh
2018-11-20 10:29   ` [dpdk-dev] [PATCH v2 1/3] net/af_packet: set_mtu() decrements sockaddr twice Kevin Traynor
2018-11-20 10:45     ` Lam, Tiago
2018-11-27 17:42   ` Ferruh Yigit
2018-12-21 12:29   ` Ferruh Yigit

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=ac8971af-7a37-c655-5e30-b6c6489f897e@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=linville@tuxdriver.com \
    --cc=tiago.lam@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).