From patchwork Fri Jan 4 08:48:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 1931561 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 4D29CDFABD for ; Fri, 4 Jan 2013 08:51:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754559Ab3ADIvs (ORCPT ); Fri, 4 Jan 2013 03:51:48 -0500 Received: from mail-ea0-f175.google.com ([209.85.215.175]:34315 "EHLO mail-ea0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754253Ab3ADItz (ORCPT ); Fri, 4 Jan 2013 03:49:55 -0500 Received: by mail-ea0-f175.google.com with SMTP id h11so6531900eaa.34 for ; Fri, 04 Jan 2013 00:49:53 -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=LGedFJVqrnVafcLjVh9c+l1IaV4Z72HbA00xnAmvnrlTVrQufrvME1x/zpQ3QA7x7T DD3bhdXE7bhaWdfu3X5FLiq/AVLmfEgSPed6SqYTfW+12KNgEJdpeVeBm35IsfLRSOjl 03bKTyoI2n2l8iUUtBHSqlWmYfWCdBeAmpnr94amh3ZjbiXqbjH4exEZGk/CZMtGT2Y2 WuiMGtqfWBrTf2RZrRzIQyFOHR8xVkTNb78EXG1q+JwWRKmjhB43doo7e0QKX6O2cXDC wnB8x0fFUWx11Q8loUBnjK7WTI4+dlnkU+BfkCTfZlqnlVNPQw6wPs5Vox7aG7wtCALh a39g== X-Received: by 10.14.204.198 with SMTP id h46mr142137136eeo.1.1357289393793; Fri, 04 Jan 2013 00:49:53 -0800 (PST) Received: from localhost (ip-89-103-8-129.net.upcbroadband.cz. [89.103.8.129]) by mx.google.com with ESMTPS id w3sm109543302eel.17.2013.01.04.00.49.51 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Jan 2013 00:49:53 -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 V6 11/15] vlan: remove usage of dev->master in __vlan_find_dev_deep() Date: Fri, 4 Jan 2013 09:48:59 +0100 Message-Id: <1357289343-817-12-git-send-email-jiri@resnulli.us> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1357289343-817-1-git-send-email-jiri@resnulli.us> References: <1357289343-817-1-git-send-email-jiri@resnulli.us> X-Gm-Message-State: ALoCoQkxri1JkYL7guEJp3vi279psknpjMQQmaB/1yxK8xDJXdaT4kujGzaxoSh70hJh7ndtdKH0 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;