All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ding Tianhong <dingtianhong@huawei.com>
To: Vlad Yasevich <vyasevich@gmail.com>, <kaber@trash.net>,
	<davem@davemloft.net>
Cc: <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 1/2] macvlan: slight optimization for passthru mode
Date: Thu, 29 May 2014 12:16:40 +0800	[thread overview]
Message-ID: <5386B4A8.6090302@huawei.com> (raw)
In-Reply-To: <53861500.7050803@gmail.com>

On 2014/5/29 0:55, Vlad Yasevich wrote:
> On 05/27/2014 06:53 AM, Ding Tianhong wrote:
>> When the maclvan is in passthru mode, there should be one(and only one)
>> macvlan dev, so no need to check the vlan point, remove the judgement and
>> the redundant variables.
>>
>> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
>> ---
>>  drivers/net/macvlan.c | 15 +++++++--------
>>  1 file changed, 7 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
>> index 55faff3..c9ada17 100644
>> --- a/drivers/net/macvlan.c
>> +++ b/drivers/net/macvlan.c
>> @@ -274,7 +274,6 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
>>  	const struct ethhdr *eth = eth_hdr(skb);
>>  	const struct macvlan_dev *vlan;
>>  	const struct macvlan_dev *src;
>> -	struct net_device *dev;
>>  	unsigned int len = 0;
>>  	int ret = NET_RX_DROP;
>>  
>> @@ -300,16 +299,16 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
>>  		return RX_HANDLER_PASS;
>>  	}
>>  
>> -	if (port->passthru)
>> +	if (port->passthru) {
>>  		vlan = list_first_or_null_rcu(&port->vlans,
>>  					      struct macvlan_dev, list);
>> -	else
>> +	} else {
>>  		vlan = macvlan_hash_lookup(port, eth->h_dest);
>> -	if (vlan == NULL)
>> -		return RX_HANDLER_PASS;
>> +		if (vlan == NULL)
>> +			return RX_HANDLER_PASS;
>> +	}
>>  
> 
> I don't think you can do that.  del_link() happens before ndo_uninit(),
> and we unregister the rx_handler in ndo_uninit().  As such it is
> possible to enter the rx_handler while the ports->vlans is empty.
> 
> -vlad

Yes, I miss it, the ports->vlans is already empty when unregister rx_handler, thanks.

Ding

> 
>> -	dev = vlan->dev;
>> -	if (unlikely(!(dev->flags & IFF_UP))) {
>> +	if (unlikely(!(vlan->dev->flags & IFF_UP))) {
>>  		kfree_skb(skb);
>>  		return RX_HANDLER_CONSUMED;
>>  	}
>> @@ -318,7 +317,7 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
>>  	if (!skb)
>>  		goto out;
>>  
>> -	skb->dev = dev;
>> +	skb->dev = vlan->dev;
>>  	skb->pkt_type = PACKET_HOST;
>>  
>>  	ret = netif_rx(skb);
>>
> 
> 
> 

  reply	other threads:[~2014-05-29  4:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-27 10:53 [PATCH net-next 0/2] macvlan: slight optimization for fast path Ding Tianhong
2014-05-27 10:53 ` [PATCH net-next 1/2] macvlan: slight optimization for passthru mode Ding Tianhong
2014-05-28 16:55   ` Vlad Yasevich
2014-05-29  4:16     ` Ding Tianhong [this message]
2014-05-27 10:53 ` [PATCH net-next 2/2] macvlan: slight optimization for macvlan_handle_frame Ding Tianhong
2014-05-27 16:58   ` 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=5386B4A8.6090302@huawei.com \
    --to=dingtianhong@huawei.com \
    --cc=davem@davemloft.net \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=vyasevich@gmail.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.