All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Fischer, Anna" <anna.fischer@hp.com>
To: Stephen Hemminger <shemminger@vyatta.com>,
	Jiri Pirko <jpirko@redhat.com>,
	"davem@davemloft.net" <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"kaber@trash.net" <kaber@trash.net>,
	"eric.dumazet@gmail.com" <eric.dumazet@gmail.com>
Subject: RE: replace hooks in __netif_receive_skb (v4)
Date: Tue, 1 Jun 2010 16:13:51 +0000	[thread overview]
Message-ID: <0199E0D51A61344794750DC57738F58E70B17D377A@GVW1118EXC.americas.hpqcorp.net> (raw)
In-Reply-To: <20100601082805.1c84b16d@nehalam>

> Subject: net: replace hooks in __netif_receive_skb (v4)
> 
> 
> From: Jiri Pirko <jpirko@redhat.com>
> 
> What this patch does is it removes two receive frame hooks (for bridge
> and for
> macvlan) from __netif_receive_skb. These are replaced them with a
> single
> hook for both. It only supports one hook per device because it makes no
> sense to do bridging and macvlan on the same device.
> 
> Then a network driver (of virtual netdev like macvlan or bridge) can
> register
> an rx_handler for needed net device.


I think the idea of this is really good, and it has been long required to get rid of the bridging hook and the "hack" for macvlan to get into the network stack. 

However, I wonder, if this is to be used as a generic interface, then why the restriction of only having a single hook per device? Yes, it makes sense to do this for the bridge/macvlan combination, but in general there could be other cases where you would want to allow multiple receivers per device. 


> @@ -2792,6 +2778,7 @@ EXPORT_SYMBOL(__skb_bond_should_drop);
>  static int __netif_receive_skb(struct sk_buff *skb)
>  {
>  	struct packet_type *ptype, *pt_prev;
> +	rx_callback_func_t *rh;
>  	struct net_device *orig_dev;
>  	struct net_device *master;
>  	struct net_device *null_or_orig;
> @@ -2855,12 +2842,16 @@ static int __netif_receive_skb(struct sk
>  ncls:
>  #endif
> 
> -	skb = handle_bridge(skb, &pt_prev, &ret, orig_dev);
> -	if (!skb)
> -		goto out;
> -	skb = handle_macvlan(skb, &pt_prev, &ret, orig_dev);
> -	if (!skb)
> -		goto out;
> +	/* Handle special case of bridge or macvlan */
> +	if ((rh = rcu_dereference(skb->dev->rx_handler)) != NULL) {
> +		if (pt_prev) {
> +			ret = deliver_skb(skb, pt_prev, orig_dev);

What happens with 'ret' here? It is completely ignored, isn't it? Because you assume that there is only a single receiver per device? I think it would be much better to have return codes that indicate whether a packet has been consumed by a receive handler, or whether it is supposed to be processed further. The same actually applies for the packet handlers that are processed a bit further down in netif_receive_skb() - the return code is ignored and so a handler has no control over further processing of the packet.

  parent reply	other threads:[~2010-06-01 16:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-27 18:08 [PATCH net-next-2.6] net: replace hooks in __netif_receive_skb V2 Jiri Pirko
2010-05-27 20:08 ` Stephen Hemminger
2010-05-28  5:51   ` Jiri Pirko
2010-05-28  6:12     ` [PATCH net-next-2.6] net: replace hooks in __netif_receive_skb V3 Jiri Pirko
2010-05-28  7:02       ` Eric Dumazet
2010-05-28  7:33         ` [PATCH net-next-2.6] net: replace hooks in __netif_receive_skb V4 Jiri Pirko
2010-06-01 15:28           ` net: replace hooks in __netif_receive_skb (v4) Stephen Hemminger
2010-06-01 15:41             ` Jiri Pirko
2010-06-01 16:10               ` Stephen Hemminger
2010-06-02  7:02                 ` Jiri Pirko
2010-06-01 16:13             ` Fischer, Anna [this message]
2010-06-02  6:50               ` Jiri Pirko
2010-06-02  7:24             ` net: " Jiri Pirko
2010-06-02  7:52             ` [PATCH net-next-2.6] net: replace hooks in __netif_receive_skb V5 Jiri Pirko
2010-06-02 14:11               ` David Miller
2010-06-02 15:07               ` Stephen Hemminger
2010-06-02 15:15                 ` Eric Dumazet
2010-06-02 20:43                   ` Paul E. McKenney
2010-06-02 16:20               ` Fischer, Anna

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=0199E0D51A61344794750DC57738F58E70B17D377A@GVW1118EXC.americas.hpqcorp.net \
    --to=anna.fischer@hp.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jpirko@redhat.com \
    --cc=kaber@trash.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.