netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tommy Christensen <tommy.christensen@tpack.net>
To: Ben Greear <greearb@candelatech.com>
Cc: "'netdev@oss.sgi.com'" <netdev@oss.sgi.com>,
	"Linux 802.1Q VLAN" <vlan@candelatech.com>,
	Francois Romieu <romieu@fr.zoreil.com>,
	"David S. Miller" <davem@redhat.com>
Subject: Re: [PATCH]  802.1Q VLAN
Date: Fri, 29 Oct 2004 01:40:59 +0200	[thread overview]
Message-ID: <4181838B.6040002@tpack.net> (raw)
In-Reply-To: <417D675F.3000909@candelatech.com>

Ben Greear wrote:
> 
> --- linux-2.6.9/net/8021q/vlan_dev.c	2004-10-18 14:55:07.000000000 -0700
> +++ linux-2.6.9.p4s/net/8021q/vlan_dev.c	2004-10-25 13:38:32.779294920 -0700
> @@ -1,4 +1,4 @@
> -/*
> +/* -*- linux-c -*-
>   * INET		802.1Q VLAN
>   *		Ethernet-type device handling.
>   *
> @@ -484,13 +484,26 @@
>  	       veth->h_vlan_proto, veth->h_vlan_TCI, veth->h_vlan_encapsulated_proto);
>  #endif
>  
> -	stats->tx_packets++; /* for statics only */
> -	stats->tx_bytes += skb->len;
> -
>  	skb->dev = VLAN_DEV_INFO(dev)->real_dev;
> -	dev_queue_xmit(skb);
>  
> -	return 0;
> +	{
> +		/* Please note, dev_queue_xmit consumes the pkt regardless of the
> +		 * error value.  So, will copy the skb first and free if successful.
> +		 */
> +		struct sk_buff* skb2 = skb_get(skb);
> +		int rv = dev_queue_xmit(skb2);
> +		if (rv == 0) {
> +			/* Was success, need to free the skb reference since we bumped up the
> +			 * user count above.
> +			 */
> +
> +			stats->tx_packets++; /* for statics only */
> +			stats->tx_bytes += skb->len;
> +
> +			kfree_skb(skb);
> +		}
> +		return rv;
> +	}
>  }
>  
>  int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)

Hi Ben,

I am not happy with this change to vlan_dev_hard_start_xmit().

I certainly appreciate the idea of avoiding flow-control "black-holes", but that would
take more than just this change. You have to consider (at least) these issues:

  o It is considered an error if a queue-less device returns anything but zero from its
    hard_start_xmit() function (see dev_queue_xmit()).

  o So, lets add a tx queue to it. Sure, that would be nice. Now we can even do shaping
    and other fancy stuff. But then how do we manage netif_queue_stopped? Especially
    restarting the queue could be tricky.

  o But couldn't we skip netif_stop_queue() and just return NETDEV_TX_BUSY when congested?
    No, that would make the qdisc system "busy-retry" untill it succeeds. BAD.

  o It is unsafe to pass a shared skb to dev_queue_xmit() unless you control all the
    references yourself. (It will likely be enqueued on a list.)

And specifically for this patch:

  o The skb could be freed (replaced) in __vlan_put_tag(), so you cannot tell the caller
    to hang on to it.

  o If rv is NET_XMIT_CN (and probably also rv < 0) you have to return 0, in order to
    make the caller forget about this skb.


Dave, I think this part of the patch should be reverted until someone comes up with a
general scheme for flow_control handling through virtual devices.


-Tommy

  parent reply	other threads:[~2004-10-28 23:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-22 21:07 [PATCH] 802.1Q VLAN Ben Greear
2004-10-22 21:46 ` Francois Romieu
2004-10-22 22:09   ` Ben Greear
2004-10-23  0:24     ` Francois Romieu
2004-10-25 20:51     ` Ben Greear
2004-10-25 23:56       ` Ben Greear
2004-10-27  1:02         ` David S. Miller
2004-10-27 23:49         ` David S. Miller
2004-10-28  1:28           ` Ben Greear
2004-10-28  4:42             ` David S. Miller
2004-10-28 23:40       ` Tommy Christensen [this message]
2004-10-28 23:35         ` David S. Miller
2004-10-29  0:23         ` Ben Greear
2004-10-29  0:38           ` Krzysztof Halasa
2004-10-29  8:29           ` Tommy Christensen
2004-10-29 17:45             ` Ben Greear
2004-10-29 23:37               ` Tommy Christensen
2004-10-29 23:56                 ` Ben Greear
2004-10-30  0:05                 ` Ben Greear
2004-10-30  0:31                   ` Tommy Christensen
2004-11-01 18:58                     ` Ben Greear
2004-11-01 23:08                       ` Tommy Christensen

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=4181838B.6040002@tpack.net \
    --to=tommy.christensen@tpack.net \
    --cc=davem@redhat.com \
    --cc=greearb@candelatech.com \
    --cc=netdev@oss.sgi.com \
    --cc=romieu@fr.zoreil.com \
    --cc=vlan@candelatech.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).