From patchwork Mon Aug 13 15:27:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 1313831 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 7133BDF223 for ; Mon, 13 Aug 2012 15:32:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752450Ab2HMP12 (ORCPT ); Mon, 13 Aug 2012 11:27:28 -0400 Received: from mail-ee0-f46.google.com ([74.125.83.46]:64718 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752373Ab2HMP10 (ORCPT ); Mon, 13 Aug 2012 11:27:26 -0400 Received: by mail-ee0-f46.google.com with SMTP id l10so1192531eei.19 for ; Mon, 13 Aug 2012 08:27:25 -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=F+ib7En+Rz1eX68aLafWv2qjnDkGlLHyjEsjFDWddXc=; b=a0yFjxLPJSY8UEAwxCiMtb4YYCaiCVNtAu8EdXMPzs/Ja35tqtcJ83hXStBjKrFa1Y of7CAk15aWBbnf2IXeKgk8a0FfQPMr7tjK36YpFGZLwW/Uiu2JKX2+WB60U/LIAtX8zj HiB3ZO6CM8xiYbxMR0EA+8j0qsslvH10EnuG08uTPlagJPiq0d/AvhjNumm62TbhIuYN cng40nE+kG058HAFYxlZQ4trWduNkJKD3id/AnMMWzkGQNCMIbVfMcX96Fc6yZOMpXvQ CC38ux29hznd6yp9W4b1EqzmjOhu5o+d/MSL9apet3WFRgTIPnbXk/bfrjlm/prUea3k Amow== Received: by 10.14.213.137 with SMTP id a9mr10329322eep.38.1344871645448; Mon, 13 Aug 2012 08:27:25 -0700 (PDT) Received: from localhost (nat-pool-brq-t.redhat.com. [209.132.186.34]) by mx.google.com with ESMTPS id k49sm491867een.4.2012.08.13.08.27.24 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 13 Aug 2012 08:27:24 -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 02/16] macvlan: add link to upper device Date: Mon, 13 Aug 2012 17:27:01 +0200 Message-Id: <1344871635-1052-3-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: ALoCoQkpY7hL8wqKm/DSr7Iijaom6IbtgW5LkDtr1KDAbpmrexWJpJ1L0apuQzybm9FHyij9Yb2X Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Signed-off-by: Jiri Pirko --- drivers/net/macvlan.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 66a9bfe..f5bd8a2 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -765,16 +765,22 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev, memcpy(dev->dev_addr, lowerdev->dev_addr, ETH_ALEN); } + err = netdev_upper_dev_link(lowerdev, dev); + if (err) + goto destroy_port; + port->count += 1; err = register_netdevice(dev); if (err < 0) - goto destroy_port; + goto upper_dev_unlink; list_add_tail(&vlan->list, &port->vlans); netif_stacked_transfer_operstate(lowerdev, dev); return 0; +upper_dev_unlink: + netdev_upper_dev_unlink(lowerdev, dev); destroy_port: port->count -= 1; if (!port->count) @@ -798,6 +804,7 @@ void macvlan_dellink(struct net_device *dev, struct list_head *head) list_del(&vlan->list); unregister_netdevice_queue(dev, head); + netdev_upper_dev_unlink(vlan->lowerdev, dev); } EXPORT_SYMBOL_GPL(macvlan_dellink);