DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pascal Mazon <pascal.mazon@6wind.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org, Keith Wiles <keith.wiles@intel.com>,
	Vipin Varghese <vipin.varghese@intel.com>,
	stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 1/2] net/tap: fix setting speed by argument
Date: Tue, 19 Sep 2017 14:45:38 +0200	[thread overview]
Message-ID: <8cf71f00-ca73-86b4-b6dd-fa24aac3167f@6wind.com> (raw)
In-Reply-To: <20170918184735.43968-1-ferruh.yigit@intel.com>

Hi,

The patch looks mainly ok to me.

I'll put some comments inline.

On 18/09/2017 20:47, Ferruh Yigit wrote:
> From: Vipin Varghese <vipin.varghese@intel.com>
>
> tap speed argument is not working without generating any error.
Can you describe the error, paste the log?
>
> This patch sets the configured speed during device start.
>
> Fixes: 02f96a0a82d1 ("net/tap: add TUN/TAP device PMD")
> Cc: stable@dpdk.org
>
> Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
> ---
>  drivers/net/tap/rte_eth_tap.c | 27 +++++++++++++++++++++++++++
>  drivers/net/tap/rte_eth_tap.h |  2 ++
>  2 files changed, 29 insertions(+)
>
> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
> index 01cba0fa1..00dad167f 100644
> --- a/drivers/net/tap/rte_eth_tap.c
> +++ b/drivers/net/tap/rte_eth_tap.c
> @@ -545,6 +545,7 @@ tap_ioctl(struct pmd_internals *pmd, unsigned long request,
>  	case SIOCGIFHWADDR:
>  	case SIOCSIFHWADDR:
>  	case SIOCSIFMTU:
> +	case SIOCETHTOOL:
>  		break;
>  	default:
>  		RTE_ASSERT(!"unsupported request type: must not happen");
> @@ -585,6 +586,32 @@ static int
>  tap_dev_start(struct rte_eth_dev *dev)
>  {
>  	int err;
> +	struct ifreq ifr;
> +	struct ethtool_cmd edata = {0};
> +	struct pmd_internals *pmd = dev->data->dev_private;
> +
> +	/*set & get speed to device*/
> +	edata.speed = pmd_link.link_speed;
> +	edata.cmd = ETHTOOL_SSET;
> +	ifr.ifr_data = (caddr_t)&edata;
> +	if (tap_ioctl(pmd, SIOCETHTOOL, &ifr, 0, LOCAL_ONLY) < 0) {
I think it would be best to also try setting the speed on the remote
(tap_ioctl(REMOTE_ONLY)), but continue execution even if that fails.
> +		RTE_LOG(WARNING, PMD,
> +			"Could not set param speed %d for ifindex for %s.\n",
> +				pmd_link.link_speed,
> +				pmd->name);
> +
> +		/* fetch current speed of created device */
> +		edata.cmd = ETHTOOL_GSET;
> +		ifr.ifr_data = (caddr_t)&edata;
> +		if (tap_ioctl(pmd, SIOCETHTOOL, &ifr, 0, LOCAL_ONLY) < 0)
> +			return 0;
> +
> +		pmd_link.link_speed = edata.speed;
> +		RTE_LOG(INFO, PMD, "get speed %d for ifindex for %s.\n",
I would say "got".

> +			pmd_link.link_speed,
> +			pmd->name);
> +	}
> +	dev->data->dev_link = pmd_link;
>  
>  	err = tap_intr_handle_set(dev, 1);
>  	if (err)
> diff --git a/drivers/net/tap/rte_eth_tap.h b/drivers/net/tap/rte_eth_tap.h
> index 928a0454e..3e91db4ae 100644
> --- a/drivers/net/tap/rte_eth_tap.h
> +++ b/drivers/net/tap/rte_eth_tap.h
> @@ -40,6 +40,8 @@
>  #include <net/if.h>
>  
>  #include <linux/if_tun.h>
> +#include <linux/ethtool.h>
> +#include <linux/sockios.h>
>  
>  #include <rte_ethdev.h>
>  #include <rte_ether.h>
These includes are only useful inside rte_eth_tap.c, I would put them
there only.

  parent reply	other threads:[~2017-09-19 12:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 18:47 Ferruh Yigit
2017-09-18 18:47 ` [dpdk-dev] [PATCH 2/2] net/tap: fix unregistering callback with invalid fd Ferruh Yigit
2017-09-19 12:46   ` Pascal Mazon
2017-09-20 16:05     ` Ferruh Yigit
2017-09-19 12:45 ` Pascal Mazon [this message]
2017-10-25  1:24   ` [dpdk-dev] [PATCH 1/2] net/tap: fix setting speed by argument Ferruh Yigit
2017-10-25  6:27     ` Pascal Mazon

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=8cf71f00-ca73-86b4-b6dd-fa24aac3167f@6wind.com \
    --to=pascal.mazon@6wind.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=keith.wiles@intel.com \
    --cc=stable@dpdk.org \
    --cc=vipin.varghese@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).