From patchwork Sat Jun 7 07:45:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ding Tianhong X-Patchwork-Id: 31507 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f198.google.com (mail-ie0-f198.google.com [209.85.223.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 042882100A for ; Sat, 7 Jun 2014 07:46:34 +0000 (UTC) Received: by mail-ie0-f198.google.com with SMTP id rp18sf18774299iec.1 for ; Sat, 07 Jun 2014 00:46:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=pHqURgokd8TMM1px18GoCWS98xv6hTx/j8QceHx06UQ=; b=IMJCgoNHI1du7K/MNfioF49oiQ4zmFAnGPoXuWtszaa7xbajcyGagrzjPtjBLImo09 HHcfumWwp5Z44IGIZaIor7YDoBSmOVRClyKUrzhi6aNbfJWVidh7vGE9lw9skBOG//MP wvAyj1ZY19oAsqh3lqTVDIJ93+7KSdRXmRigz95+MIKiZDaDUJV+7qVtHJMvwV/Z2dN3 7vwP3k29zdl8CzF+VARmHI+BLFnm7p0WJqAsbob7NF2odTu3oPGwJ9agphrajQ+kxndm C+CMmIzFW98VsxQodA3upXpHKCC8sfmkgrFhx9vOznJKSEiJ6gGlV849keBfhuBB9roi Jhqw== X-Gm-Message-State: ALoCoQnj0jeepi1kMEVNdE3yM6Qu4f2DFHwNbxZsLgT9Fkhh300MUAuteEbS6wxAPZlWdpzHwy9F X-Received: by 10.182.80.40 with SMTP id o8mr5856381obx.35.1402127194183; Sat, 07 Jun 2014 00:46:34 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.30.165 with SMTP id d34ls1003734qgd.25.gmail; Sat, 07 Jun 2014 00:46:34 -0700 (PDT) X-Received: by 10.52.33.241 with SMTP id u17mr8745880vdi.82.1402127194063; Sat, 07 Jun 2014 00:46:34 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id o5si7138293vcj.31.2014.06.07.00.46.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 07 Jun 2014 00:46:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so2558658vcb.30 for ; Sat, 07 Jun 2014 00:46:33 -0700 (PDT) X-Received: by 10.53.8.162 with SMTP id dl2mr9563387vdd.24.1402127193780; Sat, 07 Jun 2014 00:46:33 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp6580vcb; Sat, 7 Jun 2014 00:46:33 -0700 (PDT) X-Received: by 10.68.202.167 with SMTP id kj7mr304393pbc.160.1402127192942; Sat, 07 Jun 2014 00:46:32 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh2si23941557pbb.204.2014.06.07.00.46.32; Sat, 07 Jun 2014 00:46:32 -0700 (PDT) Received-SPF: none (google.com: netdev-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752785AbaFGHqV (ORCPT + 3 others); Sat, 7 Jun 2014 03:46:21 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:32051 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752758AbaFGHqU (ORCPT ); Sat, 7 Jun 2014 03:46:20 -0400 Received: from 172.24.2.119 (EHLO szxeml210-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BWN55048; Sat, 07 Jun 2014 15:45:50 +0800 (CST) Received: from SZXEML418-HUB.china.huawei.com (10.82.67.157) by szxeml210-edg.china.huawei.com (172.24.2.183) with Microsoft SMTP Server (TLS) id 14.3.158.1; Sat, 7 Jun 2014 15:45:45 +0800 Received: from localhost (10.177.22.246) by szxeml418-hub.china.huawei.com (10.82.67.157) with Microsoft SMTP Server id 14.3.158.1; Sat, 7 Jun 2014 15:45:46 +0800 From: Ding Tianhong To: , , , , CC: Subject: [PATCH net-next v2 RESEND 1/4] macvlan: support mac address changes when fwd_priv is enable Date: Sat, 7 Jun 2014 15:45:40 +0800 Message-ID: <1402127143-6456-2-git-send-email-dingtianhong@huawei.com> X-Mailer: git-send-email 1.8.5.2.msysgit.0 In-Reply-To: <1402127143-6456-1-git-send-email-dingtianhong@huawei.com> References: <1402127143-6456-1-git-send-email-dingtianhong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.22.246] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: netdev@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: dingtianhong@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If lowerdev supports L2 forwarding offload, the macvlan's hw address will be set to the rar of the lowerdev and no need to set uc list, and when the macvlan's hw address changes, the macvlan should remove the old fwd and rebuild a new fwd for the macvlan. Signed-off-by: Ding Tianhong --- drivers/net/macvlan.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 453d55a..67485ab 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -523,6 +523,27 @@ static int macvlan_sync_address(struct net_device *dev, unsigned char *addr) if (macvlan_addr_busy(vlan->port, addr)) return -EBUSY; + if (vlan->fwd_priv) { + lowerdev->netdev_ops->ndo_dfwd_del_station(lowerdev, + vlan->fwd_priv); + vlan->fwd_priv = NULL; + ether_addr_copy(dev->perm_addr, dev->dev_addr); + ether_addr_copy(dev->dev_addr, addr); + vlan->fwd_priv = + lowerdev->netdev_ops->ndo_dfwd_add_station(lowerdev, + dev); + /* If we get a NULL pointer back, or if we get an error + * then we should restore the old mac address and fwd. + */ + if (IS_ERR_OR_NULL(vlan->fwd_priv)) { + ether_addr_copy(dev->dev_addr, dev->perm_addr); + vlan->fwd_priv = + lowerdev->netdev_ops->ndo_dfwd_add_station(lowerdev, + dev); + return -EINVAL; + } + return 0; + } if (!vlan->port->passthru) { err = dev_uc_add(lowerdev, addr); if (err)