From patchwork Mon Aug 13 15:27:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 1313681 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 39E123FC81 for ; Mon, 13 Aug 2012 15:30:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752977Ab2HMP3r (ORCPT ); Mon, 13 Aug 2012 11:29:47 -0400 Received: from mail-ey0-f174.google.com ([209.85.215.174]:59946 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752975Ab2HMP1u (ORCPT ); Mon, 13 Aug 2012 11:27:50 -0400 Received: by mail-ey0-f174.google.com with SMTP id c11so1186783eaa.19 for ; Mon, 13 Aug 2012 08:27:50 -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=n77kdMKbDsBiIlxqIodRz2F3tRynttsrKfTfgIO7GsE=; b=pI+tIP0BHaikMwu0Ov+818cix4ljm4qmfV1F5WQJfDHysTBjtdy9l8TZd6s2sEf4M1 OX5R+QzqHUNjDwNBqXvZz8obfdz8GoAvqFQjwWu2glc3kxYxKkmUsyPwwSrjFFyLUR5K D5IC00vkco2PP5nBbvwAnydr4aNPoVRAcRhRFs4vAfxouxIHrfnM1E4oxXJxWJS9b8e+ lOPY/HDGMUI7cLvo+vu9xcjS9GSEjVpHv/mF5AtLq35G7p73howl/YJmZweID7VrTqSx qEWlLnNzclP3QmpBhZ9boe/smzebyrQyCjIy9ioKLgg8TamPXDlsotIAWVHIqMdovdZX xfmA== Received: by 10.14.5.78 with SMTP id 54mr14812904eek.1.1344871669992; Mon, 13 Aug 2012 08:27:49 -0700 (PDT) Received: from localhost (nat-pool-brq-t.redhat.com. [209.132.186.34]) by mx.google.com with ESMTPS id 45sm19815834eed.17.2012.08.13.08.27.48 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 13 Aug 2012 08:27:49 -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 11/16] vlan: remove usage of dev->master in __vlan_find_dev_deep() Date: Mon, 13 Aug 2012 17:27:10 +0200 Message-Id: <1344871635-1052-12-git-send-email-jiri@resnulli.us> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1344871635-1052-1-git-send-email-jiri@resnulli.us> References: <1344871635-1052-1-git-send-email-jiri@resnulli.us> X-Gm-Message-State: ALoCoQnIZdVwv3ELUN0ukyeQqUADDd/szebNI7oguCoO6yJ6CN1FBsMmMP7n/KWtcaqZC//F2Bt4 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..f9518ad 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 unique 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_unique_upper_dev_get_rcu(dev); + if (upper_dev) + return __vlan_find_dev_deep(upper_dev, vlan_id); } return NULL;