From patchwork Tue Jan 21 09:44:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ding Tianhong X-Patchwork-Id: 312836 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B9A262C0092 for ; Tue, 21 Jan 2014 20:44:25 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754038AbaAUJoW (ORCPT ); Tue, 21 Jan 2014 04:44:22 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:52101 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751613AbaAUJoU (ORCPT ); Tue, 21 Jan 2014 04:44:20 -0500 Received: from 172.24.2.119 (EHLO szxeml214-edg.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id AJO10924; Tue, 21 Jan 2014 17:44:06 +0800 (CST) Received: from SZXEML421-HUB.china.huawei.com (10.82.67.160) by szxeml214-edg.china.huawei.com (172.24.2.29) with Microsoft SMTP Server (TLS) id 14.3.158.1; Tue, 21 Jan 2014 17:44:05 +0800 Received: from [127.0.0.1] (10.177.22.246) by szxeml421-hub.china.huawei.com (10.82.67.160) with Microsoft SMTP Server id 14.3.158.1; Tue, 21 Jan 2014 17:44:02 +0800 Message-ID: <52DE4161.3050801@huawei.com> Date: Tue, 21 Jan 2014 17:44:01 +0800 From: Ding Tianhong User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: Jay Vosburgh , Veaceslav Falico , "David S. Miller" , Netdev , Andy Gospodarek Subject: [PATCH net-next 1/5] bonding: The fail_over_mac should be set only in ACTIVE_BACKUP mode X-Originating-IP: [10.177.22.246] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org According the bonding.txt, the option fail_over_mac only affect for AB mode, but in currect code, the parameter could be set to active or follow in every mode, this will cause bonding could not set all slaves of an RR or XOR mode to the same MAC address at enslavement time, so reset fail_over_mac to 0 if the mode is not ACTIVE_BACKUP. Fix the wrong variables for pr_err(). Signed-off-by: Ding Tianhong --- drivers/net/bonding/bond_main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 3220b48..ecff04e 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -4307,12 +4307,14 @@ static int bond_check_params(struct bond_params *params) fail_over_mac_tbl); if (fail_over_mac_value == -1) { pr_err("Error: invalid fail_over_mac \"%s\"\n", - arp_validate == NULL ? "NULL" : arp_validate); + fail_over_mac == NULL ? "NULL" : fail_over_mac); return -EINVAL; } - if (bond_mode != BOND_MODE_ACTIVEBACKUP) - pr_warning("Warning: fail_over_mac only affects active-backup mode.\n"); + if (bond_mode != BOND_MODE_ACTIVEBACKUP) { + pr_warning("Warning: fail_over_mac only affects active-backup mode, set it to 0.\n"); + fail_over_mac_value = BOND_FOM_NONE; + } } else { fail_over_mac_value = BOND_FOM_NONE; }