netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Zhu Yanjun <Yanjun.Zhu@windriver.com>,
	netdev@vger.kernel.org, mst@redhat.com, jasowang@redhat.com,
	viro@zeniv.linux.org.uk, davem@davemloft.net
Subject: Re: [PATCH V2 1/1] tun: change speed from 10M to dynamically configured
Date: Fri, 13 Feb 2015 13:37:58 +0300	[thread overview]
Message-ID: <54DDD406.7030609@cogentembedded.com> (raw)
In-Reply-To: <1423798552-7091-2-git-send-email-Yanjun.Zhu@windriver.com>

Hello.

On 2/13/2015 6:35 AM, Zhu Yanjun wrote:

> The default speed of normal nic is 1000M while the default speed
> of tun is 10M. Now the default speed of tun is changed to 1000M.
> And there are 3 options: 10M, 100M and 1000M to the speed of tun.
> The command "ethtool -s tun0 speed 10/100/1000" can configure the
> speed of tun dynamically.

> CC: Michael S. Tsirkin <mst@redhat.com>
> CC: Jason Wang <jasowang@redhat.com>
> CC: Al Viro <viro@zeniv.linux.org.uk>
> Reviewed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Signed-off-by: Zhu Yanjun <Yanjun.Zhu@windriver.com>
> ---
>   drivers/net/tun.c           | 42 +++++++++++++++++++++++++++++++++++++++++-
>   include/uapi/linux/if_tun.h |  5 +++++
>   2 files changed, 46 insertions(+), 1 deletion(-)

> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 8c8dc16..0ee36f1 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
[...]
> @@ -2257,9 +2260,18 @@ static struct miscdevice tun_miscdev = {
>
>   static int tun_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
>   {
> +	struct tun_struct *tun = netdev_priv(dev);
> +
> +	/* Get the speed of tun */
> +	if (tun->flags & TUN_CTRL_SPD_1000) {
> +		ethtool_cmd_speed_set(cmd, SPEED_1000);
> +	} else if (tun->flags & TUN_CTRL_SPD_100) {
> +		ethtool_cmd_speed_set(cmd, SPEED_100);
> +	} else
> +		ethtool_cmd_speed_set(cmd, SPEED_10);

    I probably missed it in the previous version: {} not needed here at all. 
Please remove to comply with Documentation/CodingStyle.

[...]

WBR, Sergei

      parent reply	other threads:[~2015-02-13 10:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-13  3:35 [PATCH V2 0/1] tun: dynamically set speed of tun Zhu Yanjun
2015-02-13  3:35 ` [PATCH V2 1/1] tun: change speed from 10M to dynamically configured Zhu Yanjun
2015-02-13  3:44   ` Jonathon Reinhart
2015-02-13  5:31     ` yzhu1
2015-02-13  5:42       ` Jonathon Reinhart
2015-02-13  5:56         ` yzhu1
2015-02-13 10:37   ` Sergei Shtylyov [this message]

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=54DDD406.7030609@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=Yanjun.Zhu@windriver.com \
    --cc=davem@davemloft.net \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).