From patchwork Fri Jan 4 08:48:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 1931681 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 8E15FDFABD for ; Fri, 4 Jan 2013 08:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754102Ab3ADItZ (ORCPT ); Fri, 4 Jan 2013 03:49:25 -0500 Received: from mail-ee0-f54.google.com ([74.125.83.54]:40534 "EHLO mail-ee0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753993Ab3ADItU (ORCPT ); Fri, 4 Jan 2013 03:49:20 -0500 Received: by mail-ee0-f54.google.com with SMTP id c13so8080874eek.41 for ; Fri, 04 Jan 2013 00:49:19 -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=7MTDqRRaV52dqB09shlOpmmwlYxXuIJgfMDT3JPctys=; b=Wcy5GiAMSF4ZYerLNR3KiEuk2e/aCmTbRYm1h658T4NPCeRgBF4U6e6vlYidmO0IC1 F6zUt+sQo3emtFVpZMh+jkuVWGs3pl8x9Thg+M3EuKof5kGvyt5Yj6273/fSmNLtYftD 7cD61Et8JmKvEtI8B1LotmoWgl1poxsXv8RhrKh//f69XAuzO2WrQmnAelr4JViVJSD2 sfUSPiKbdI36/gYhCKjeV/KNyTAGnGXDbmzhyEd7D3bDs6aclHYqImfp15+ie4SEVdW9 GJ7CM7CMz8SzensaEvif6E1T2SD5Vjcroo02bhN+gAyMrVOmPTQDq4JAlBWVk7QFhX1P vOoA== X-Received: by 10.14.194.195 with SMTP id m43mr142180574een.44.1357289358971; Fri, 04 Jan 2013 00:49:18 -0800 (PST) Received: from localhost (ip-89-103-8-129.net.upcbroadband.cz. [89.103.8.129]) by mx.google.com with ESMTPS id e2sm109308084eeo.8.2013.01.04.00.49.16 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Jan 2013 00:49:18 -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 02/15] macvlan: add link to upper device Date: Fri, 4 Jan 2013 09:48:50 +0100 Message-Id: <1357289343-817-3-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: ALoCoQloI8lC5lhTC7XN1+BR1TuHhgbBSy8aFLjG7Aa6c6MI//VGv68lhe7gswlCP3A5lgD3f3rR 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 68a43fe..b7b614f 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);