From patchwork Tue Aug 14 15:05:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 1320821 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 6E4DFDF215 for ; Tue, 14 Aug 2012 15:07:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756476Ab2HNPGe (ORCPT ); Tue, 14 Aug 2012 11:06:34 -0400 Received: from mail-ee0-f46.google.com ([74.125.83.46]:33396 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756630Ab2HNPGb (ORCPT ); Tue, 14 Aug 2012 11:06:31 -0400 Received: by eeil10 with SMTP id l10so194367eei.19 for ; Tue, 14 Aug 2012 08:06:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=XzlCl4cNOqlMKo5Ysgo4emPr5HtwpvB2KM90TGQyzOM=; b=kd4Qx+p/8PLrfmqBkbY33DoUTIIldd3Sk9FUsmgF7c+gK/3ZKP/vsW9aPaBU6I8Iab vcMlVtQZ0UCcKoQqiZaqyhGaLAOKTFsZ8zyjJfd86HLETcw3OnqzrEx315n+jwj82qJO 86B/9K5n7/tMZcWH4a9Xq6mlL31PDKNB886LDKCerD0jwjuj1x1Q5GBoZVTV0ZrAlUp0 udmne8MsFE7Osen42VjAppnYpDSb519q+Jkl9Mv9PX5OG7lxF3dJNbQpU3upjmxp7Jy6 xu9VVvVd42q96t6B59Y81NR/9y67j6/BgpOqrlUuI8AiUXaxVBszILb/q8dhOjgqSQqh 7BlA== Received: by 10.14.5.78 with SMTP id 54mr20159215eek.1.1344956789611; Tue, 14 Aug 2012 08:06:29 -0700 (PDT) Received: from localhost (nat-pool-brq-t.redhat.com. [209.132.186.34]) by mx.google.com with ESMTPS id h2sm7618278eeo.3.2012.08.14.08.06.28 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 14 Aug 2012 08:06:28 -0700 (PDT) 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 v2 11/15] vlan: remove usage of dev->master in __vlan_find_dev_deep() Date: Tue, 14 Aug 2012 17:05:44 +0200 Message-Id: <1344956748-2099-12-git-send-email-jiri@resnulli.us> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1344956748-2099-1-git-send-email-jiri@resnulli.us> References: <1344956748-2099-1-git-send-email-jiri@resnulli.us> X-Gm-Message-State: ALoCoQlofmXBx5e/ee1v1GAgN5uyG6UyE+UQGc0X5J+hHV2LwrqqIsi7NQ/IeCzTH6B9NOQe2QXt 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 8ca533c..d4babc6 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c @@ -66,21 +66,25 @@ bool vlan_do_receive(struct sk_buff **skbp, bool last_handler) 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;