From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0045.outbound.protection.outlook.com [104.47.32.45]) by dpdk.org (Postfix) with ESMTP id 020C2235 for ; Wed, 23 May 2018 11:11:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SkbBSdUinYeaqLCOBLv1BgCRQmlNROhZ5M2J3QXflvA=; b=FMN38G/vIab80ul9S3lagruJz+uEqldvd/aO7N/YnPsaEwcYrlDyVnsMci8cnJkiGk/30cTn3GSCB2pSAk4o9BHepAD6+vYomYHF8P8EXwWXF9aXXRRoS4EBAvlSL+DW4x4FGO/A4k1mrTBNAHPrsS0P+/XC3bvfXm3pIneaYxE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Kiran.Kokkilagadda@cavium.com; Received: from kkokkilagadda.domain.name (111.93.218.67) by SN6PR07MB4494.namprd07.prod.outlook.com (2603:10b6:805:5c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.16; Wed, 23 May 2018 09:11:56 +0000 From: Kiran Kumar To: declan.doherty@intel.com Cc: dev@dpdk.org, Kiran Kumar Date: Wed, 23 May 2018 14:41:21 +0530 Message-Id: <20180523091121.9910-1-kiran.kokkilagadda@caviumnetworks.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: CO2PR07CA0061.namprd07.prod.outlook.com (2603:10b6:100::29) To SN6PR07MB4494.namprd07.prod.outlook.com (2603:10b6:805:5c::15) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:SN6PR07MB4494; X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4494; 3:G3QuwKFdSZcHv9KXy66QgfkqPBO4sQWA0Egr2Z0VVUofvTo+yjugx5MHvS7+Al9OuIl8BT3F/AdGppuhtsJIXol3oDXf5EZ7OMRLfU3QPDOz7owdF5KFinTIHw1Wg5XNyuWBIsxKCizXXzujQKe/rSgqjiAuU8x+yd6XCsfopGgnQUwgH5vRWUBXkgVT8ItD/9KbRMlXQULY2Wkbat6aCoFkZ6F0aP4k30bggpInANn4rrMOr2w4n+fEny7o3/lH; 25:z8IFmP8N4C1UMjDqx623NpINpXiNVDM3pMTkStXgc3siMazwsr/sJOAqGBHc30LObZVMLxOZvhEgUQ+bRMJSrK8YPmP8yDMUnKZO6YuHjB0puUlEeRWFJt2G1/9+GoCdsO46mNZ5+hujbO55JjeruzYpHDeMqjPC566Ldx5Sqv1EQ3GHMVRzQ8IwP6RtlfYh4zeDshLxbg5+U3HW9WS/tj73jDtQtypnDyF7H0awBIAGsuG7LfkTHXI7UTKA8alRLQBViwxwyXmDWmWNpNYkWkDqq8tkQQd70ZTdDns7oXU3mjEVLKs5J3nC9TFkCUK7XjYWoQ1k68SvY31rr54Tpw==; 31:UUD5SSwa6R/lD5aPLeOYvudspJpqup1Ahgto6EsqalqnFVyIBFeO3wEpK1zbfY+KeY4wRI6z4JT+yo8zwohPDGT97GQ4WotGVUYjF6LDknbErGAyNrx7V+qYsf+mnfA/rnh0PbkVWap8PAVEXfiXAigAhJnZyfAkIryD73WS0DsPzKhlihHiHuNRjfDkDx1FZw81zJkrYA1MH65l35ZVwSd96+vPO71NWdrsxHL5pyE= X-MS-TrafficTypeDiagnostic: SN6PR07MB4494: X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4494; 20:WJIwZwSyei6KtRNa/li2iLjTC2COx2aKlnY0QQbEabyLjciaqGExL6aeTcwT9dKaAyHxOOrKlOOeRxJlVxM4FaxUGj+mg4I2GD1TAgkWCoWh/hMWfgLW1FFkTp//JbdND0g/la4Grp0dQydfeUDcmEt+mRCL/d4xm5RJAJPQOOD+gS1eUVlO2BgMjLj7LIy3EcxRLTlJ5xYq0oK6I68GKvByy1eWKs8L+o6NYujsLddDLKSYDbyKjnwlBcd8Gb7OrSAkJhBoeuFMUD0NT8XNafBguP5i9q2ib0FIt+47WzCGZGefcMm/BHvsA0d9z3PqvWP5+d9P0UXIq3RQfCkrbnAqyRWQdz1Am9mlBDYeF5GiAFXojk0V0bWjD55biBWmJxPLoYqdBpfI1c2pOEKhkuoSmyUtoSMII+f2YN9qKRNZWvV5RH5DjVc+T5LQBPcCfeHLcYukCvFGFJO4yFA+3FfUgt5Wkkpi0gjTT32alA8T+lT1Tc12/s0gTddS+OlCHmepiREJ7ZgIxAJ39BM9FSMqg6tmuyi8bgxgpXrGW5dnMCWtvqUuE22jbg1G0JFDERD3JZtIJVdz1YHHW1E4EuxAputiF/RufRGa9tT+7UI=; 4:nxLelu8uh+nLwdinmkH1wcuI5nTwA8NRAjKQw2xwAgq3o7azAc35QTQVh1Qtf4iQAScji3iqEjnD0gy5A4bYdJyuVtBSa6Q8fl+4Tw7ci8+wT4LS8CxHRipqJFFSt0/wI2FRp631q+dhRMMFpyKxUqHKaF5qBpknV7T00FXqCWKiDpqXxNANxDcfLVbpx/fROr8jyt/hrPWsxb9D/b4QpTczynGg+SfsvydCUNaI0gk4GUAgwIv9fgXPmszLFknQMeqdUHcRr7/TPDkzBZ6zsg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231254)(944501410)(52105095)(93006095)(3002001)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:SN6PR07MB4494; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4494; X-Forefront-PRVS: 06818431B9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(366004)(39380400002)(39860400002)(346002)(376002)(199004)(189003)(47776003)(316002)(53416004)(106356001)(6666003)(478600001)(97736004)(8936002)(6486002)(72206003)(5660300001)(105586002)(16586007)(68736007)(1076002)(6916009)(6116002)(3846002)(5009440100003)(2906002)(25786009)(66066001)(2351001)(2361001)(50226002)(7736002)(48376002)(50466002)(51416003)(956004)(52116002)(305945005)(476003)(69596002)(2616005)(42882007)(16526019)(26005)(107886003)(81166006)(4326008)(59450400001)(53936002)(386003)(8676002)(6506007)(186003)(6512007)(1857600001)(486006)(81156014)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4494; H:kkokkilagadda.domain.name; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN6PR07MB4494; 23:74Ofuki7B4gsejfNRk1Fu5BDg14HFj++u3SaN3bxo?= =?us-ascii?Q?/iCrPjgbF6dtJvKK7IoW9rSObIOLLxc6AD3jJG3Z0/+4LUc7a/moLU3GbdVN?= =?us-ascii?Q?l4XLN6xxhAz1qOX4tt7SMx8kngxnQE3tqXriAdaYVT1hvKlyY9MqCdvdVrli?= =?us-ascii?Q?WO7EOBHk9pRcZlMVzD7Rkt9SBXNjzXdHIoNMKEuFzoUdZhHhKQIV+TQoOhcO?= =?us-ascii?Q?/rCdSnxmhcQ+qvQthYML/ydZjYJH3Bu90UNW4OscNMkM/ESOKzZz6XpQhQML?= =?us-ascii?Q?dJracb4q3W7X9zhnJReu/2BJKgwE8MLbZnhhL9TVd7gp/soEmXHBvQ3VtQyJ?= =?us-ascii?Q?sUL7dhVcItrHpA4bUKoz09QAVvyBW8ZR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4dGTqpBBekrwefb8qhL8boz8jvxyDoQoP0vSMnnF5ZcyrkIvnjR6uER8woOWIoqQqAT4U1IwQYS89nV2qzMFJyA0y+saA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4494; 7:qlcdvrEwyovO66Nw2eseET/3xKrdsVwFuKGrKPyemqT9KihBGlnKE3SQh/X5NaA4cr5bghOSn3nXi/cnWWGi5/aiVyJUyHZjXX5k3gTjqiIQk+0353zZseFjAMvQK88vYkepvWQ4hzYwe8fC9Lhv2NekJibRp7k7Lkm3WpKRxp8iXdSATkiIcgH/WqtWe64482hWI1mZbZBXltyLXxQTwN8JP1PZbU8PfEA1ugEljOPy8HDKU9dmDCBqXNVgiStt X-MS-Office365-Filtering-Correlation-Id: 2a8b2546-9d83-44af-f854-08d5c08d3c4d X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2018 09:11:56.4332 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2a8b2546-9d83-44af-f854-08d5c08d3c4d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4494 Subject: [dpdk-dev] [PATCH] drivers/bonding: fix bond mac address reset X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2018 09:12:00 -0000 Currently when resetting bond mac address, we are getting the persisted mac address from slave info considering primary port as index. But we need to compare the port id from slave info with the primary port to get the primary slave index and get the persisted mac address. Without this fix, persisted mac addr will be zero and rte_eth_dev_default_mac_addr_set will fail. Fixes: a45b288ef21a ("bond: support link status polling") Signed-off-by: Kiran Kumar --- drivers/net/bonding/rte_eth_bond_api.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index d558df8b9..d1a110ec9 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -716,9 +716,21 @@ rte_eth_bond_mac_address_reset(uint16_t bonded_port_id) internals->user_defined_mac = 0; if (internals->slave_count > 0) { + int slave_port; + /* Get the primary slave location based on the primary port + * number as, while slave_add(), we will keep the primary + * slave based on slave_count,but not based on the primary port. + */ + for (slave_port = 0; slave_port < internals->slave_count; + slave_port++) { + if (internals->slaves[slave_port].port_id == + internals->primary_port) + break; + } + /* Set MAC Address of Bonded Device */ if (mac_address_set(bonded_eth_dev, - &internals->slaves[internals->primary_port].persisted_mac_addr) + &internals->slaves[slave_port].persisted_mac_addr) != 0) { RTE_BOND_LOG(ERR, "Failed to set MAC address on bonded device"); return -1; -- 2.17.0