netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH] netdev: handle setting transmit queue length on active device.
Date: Wed, 18 Mar 2009 18:18:44 +0100	[thread overview]
Message-ID: <49C12CF4.1000609@cosmosbay.com> (raw)
In-Reply-To: <20090318100237.06e974c9@nehalam>

Stephen Hemminger a écrit :
> Some virtual devices like VLAN's or bridges by default have not transmit queue.
> In order to do queuing disciplines on these devices a queue must be added
> by setting transmit queue length. The kernel allows doing this at any time, but
> setting the queue length value is not enough. Setting the queue length does
> not create the transmit queue (going from 0 to non-zero) or destroy it
> (setting to zero); the queue is only created (or destroyed) when device
> comes up (or goes down).
> 
> This patch handles this be doing the necessary activations.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> ---
>  include/linux/netdevice.h |    2 ++
>  net/core/dev.c            |   19 +++++++++++++++++--
>  net/core/net-sysfs.c      |    5 ++---
>  net/core/rtnetlink.c      |    2 +-
>  4 files changed, 22 insertions(+), 6 deletions(-)
> 
> --- a/include/linux/netdevice.h	2009-03-17 11:06:40.358479573 -0700
> +++ b/include/linux/netdevice.h	2009-03-17 11:13:55.243604979 -0700
> @@ -1436,6 +1436,8 @@ extern int		dev_change_net_namespace(str
>  extern int		dev_set_mtu(struct net_device *, int);
>  extern int		dev_set_mac_address(struct net_device *,
>  					    struct sockaddr *);
> +extern int		dev_set_tx_queue_len(struct net_device *dev,
> +					     unsigned long len);
>  extern int		dev_hard_start_xmit(struct sk_buff *skb,
>  					    struct net_device *dev,
>  					    struct netdev_queue *txq);
> --- a/net/core/dev.c	2009-03-17 11:05:54.919541341 -0700
> +++ b/net/core/dev.c	2009-03-17 11:16:25.717479320 -0700
> @@ -983,6 +983,22 @@ int dev_set_alias(struct net_device *dev
>  	return len;
>  }
>  
> +/**
> + *
> + *	@dev: device
> + *	@len: limit of frames in transmit queue
> + *
> + *	Set ifalias for a device,

copy/pasted from "dev_set_alias - change ifalias of a device" ? ;)

> + */
> +int dev_set_tx_queue_len(struct net_device *dev, unsigned long len)
> +{

if (dev->tx_queue_len == len)
	return 0;

> +	if (dev->flags & IFF_UP)
> +		dev_deactivate(dev);

So changing txqueuelen will drop frames ?


> +	dev->tx_queue_len = len;
> +	if (dev->flags & IFF_UP)
> +		dev_activate(dev);
> +	return 0;
> +}
>  
> 




  parent reply	other threads:[~2009-03-18 17:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-18 17:02 [PATCH] netdev: handle setting transmit queue length on active device Stephen Hemminger
2009-03-18 17:15 ` Patrick McHardy
2009-03-18 18:02   ` Stephen Hemminger
2009-03-18 18:08     ` Patrick McHardy
2009-03-18 18:16       ` Stephen Hemminger
2009-03-18 18:31         ` Patrick McHardy
2009-03-18 18:20     ` Stephen Hemminger
2009-03-18 17:18 ` Eric Dumazet [this message]
2009-03-18 18:00   ` Stephen Hemminger

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=49C12CF4.1000609@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.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).