From patchwork Wed Jan 2 12:28:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 1923231 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 9E4C9DF215 for ; Wed, 2 Jan 2013 12:30:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752851Ab3ABM32 (ORCPT ); Wed, 2 Jan 2013 07:29:28 -0500 Received: from mail-ee0-f43.google.com ([74.125.83.43]:42307 "EHLO mail-ee0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752843Ab3ABM3V (ORCPT ); Wed, 2 Jan 2013 07:29:21 -0500 Received: by mail-ee0-f43.google.com with SMTP id e49so6768802eek.30 for ; Wed, 02 Jan 2013 04:29:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=L39lTTZIQXxZPS2I6IjBkwoD53g6FgsGsKwkQwJji90=; b=QXHQ4bJFaQ4UCWj8zemY/3kIkEZ1KEEXytetCT/Ix0N6FQLaNkOJa99W40YAhIQNWS c+F0SAZ7tQsz3DasqF9D5eSfwU1ph1yURYfpJGGjOhFrXl3gQdOUv0uTns5eo44rkeGg QBNwMHrGbeCTV+o9sKKmN7nBbk8YVIE6b8jQXMjZF1sn4aO4e5+/9k0S6MkCCRqpmEvy 03X19lvvJI3loqa4R3obqRfGLhYR4rXjEVU8KQTUF/9iCPHJ/sVhIL/LIvwO6LQWAthY oG3W/nHe6MkUKihNP8Ypx2tSf4Y3Rf/CtB7cKaUgrfQSR6APupoJKhnZjdOUc9hdN6M6 uPjw== X-Received: by 10.14.207.195 with SMTP id n43mr124062828eeo.38.1357129760635; Wed, 02 Jan 2013 04:29:20 -0800 (PST) Received: from localhost (sun-0.pirko.cz. [84.16.102.25]) by mx.google.com with ESMTPS id d3sm97280874eeo.13.2013.01.02.04.29.18 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 02 Jan 2013 04:29:19 -0800 (PST) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, edumazet@google.com, faisal.latif@intel.com, roland@kernel.org, sean.hefty@intel.com, hal.rosenstock@gmail.com, fubar@us.ibm.com, andy@greyhouse.net, divy@chelsio.com, jitendra.kalsaria@qlogic.com, sony.chacko@qlogic.com, linux-driver@qlogic.com, kaber@trash.net, ursula.braun@de.ibm.com, blaschka@linux.vnet.ibm.com, linux390@de.ibm.com, shemminger@vyatta.com, bhutchings@solarflare.com, therbert@google.com, xiyou.wangcong@gmail.com, joe@perches.com, gregory.v.rose@intel.com, john.r.fastabend@intel.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, bridge@lists.linux-foundation.org, fbl@redhat.com Subject: [patch net-next V5 11/15] vlan: remove usage of dev->master in __vlan_find_dev_deep() Date: Wed, 2 Jan 2013 13:28:32 +0100 Message-Id: <1357129716-2450-12-git-send-email-jiri@resnulli.us> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1357129716-2450-1-git-send-email-jiri@resnulli.us> References: <1357129716-2450-1-git-send-email-jiri@resnulli.us> X-Gm-Message-State: ALoCoQl8yAmh4Uv/IEKpnNDASX2P9IElqSd+SSkRLhBH0dGJTFri52jfvLq9gOgXEc+Bz8SMtIIb Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Also, since all users call __vlan_find_dev_deep() with rcu_read_lock, make no possibility to call this with rtnl mutex held only. Signed-off-by: Jiri Pirko --- net/8021q/vlan_core.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 65e06ab..380440b 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c @@ -60,21 +60,25 @@ bool vlan_do_receive(struct sk_buff **skbp) return true; } -/* Must be invoked with rcu_read_lock or with RTNL. */ -struct net_device *__vlan_find_dev_deep(struct net_device *real_dev, +/* Must be invoked with rcu_read_lock. */ +struct net_device *__vlan_find_dev_deep(struct net_device *dev, u16 vlan_id) { - struct vlan_info *vlan_info = rcu_dereference_rtnl(real_dev->vlan_info); + struct vlan_info *vlan_info = rcu_dereference(dev->vlan_info); if (vlan_info) { return vlan_group_get_device(&vlan_info->grp, vlan_id); } else { /* - * Bonding slaves do not have grp assigned to themselves. - * Grp is assigned to bonding master instead. + * Lower devices of master uppers (bonding, team) do not have + * grp assigned to themselves. Grp is assigned to upper device + * instead. */ - if (netif_is_bond_slave(real_dev)) - return __vlan_find_dev_deep(real_dev->master, vlan_id); + struct net_device *upper_dev; + + upper_dev = netdev_master_upper_dev_get_rcu(dev); + if (upper_dev) + return __vlan_find_dev_deep(upper_dev, vlan_id); } return NULL;