From patchwork Thu Jan 12 15:28:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Lomovtsev X-Patchwork-Id: 9513415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DC37B60710 for ; Thu, 12 Jan 2017 15:29:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD5D0286DB for ; Thu, 12 Jan 2017 15:29:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C11E5286D5; Thu, 12 Jan 2017 15:29:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 487BC286D5 for ; Thu, 12 Jan 2017 15:29:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cRhJs-0003FH-Gg; Thu, 12 Jan 2017 15:29:40 +0000 Received: from mail-co1nam03on0604.outbound.protection.outlook.com ([2a01:111:f400:fe48::604] helo=NAM03-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cRhJk-0002wd-AA for linux-arm-kernel@lists.infradead.org; Thu, 12 Jan 2017 15:29:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-caviumnetworks-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=gNaw4bbuFoZq4IcuKqpHlfDATfJM3obNOB8jFNu23Hs=; b=I+R8+mWMf26omuWUVbLdvKBhkPq+ZGAvK72bsMLK9vIHzVZ67uVc+o60cadc/bRKLR9edpAq3kPrdX7/akw0Nm3pRdAnTOCRGJB/l/KyDJCLBzckEFDopb9K2mXZdkaFSK2MinQQv8DEoB7hTp0Z8UvyKrSMAzdR2pl28vG2K7o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Vadim.Lomovtsev@caviumnetworks.com; Received: from localhost.localdomain.localdomain (50.233.148.156) by BN3PR07MB2643.namprd07.prod.outlook.com (10.167.5.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Thu, 12 Jan 2017 15:29:10 +0000 From: Vadim Lomovtsev To: , , , , , Subject: [PATCH] net: thunderx: acpi: fix LMAC initialization Date: Thu, 12 Jan 2017 07:28:06 -0800 Message-ID: <1484234886-22172-1-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> X-Mailer: git-send-email 2.4.11 MIME-Version: 1.0 X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: BY2PR16CA0029.namprd16.prod.outlook.com (10.164.126.167) To BN3PR07MB2643.namprd07.prod.outlook.com (10.167.5.23) X-MS-Office365-Filtering-Correlation-Id: ffd58742-4665-43dd-b2b4-08d43affc1b4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN3PR07MB2643; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2643; 3:Mn+oT6ok4FORZiNCFc2CocsPWTLyDRFdzQbwUGZtBph+/Zk0Fj3wu4YBLTo759oJVDZc+Nq9q39JOSPmFzXpBxaKL2dknSdaLTeAeprab8GW36LhfsIOq31FWkk9Ps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31:PBCFZK5o1NyDrSuWpLgphVls170DqlK5v44PJKaFLhkLF0fAux+wWH4HD6TMCWOG8NDGiX7o0ElUbnEjkGdehSvzgc+ByrLxIl6M9GFZ3DjMIwJQFuAxiGgy0MKgpNGTLDyIKQwqj5uncgeNi5XdJ88uigpBw+TBh7X3/zTTzPfG+Ge77WKd13d4YIswi9wBOsMQebADPX9CmNkmVY1HlKMzbDqTubWLl9sIwBiqvlbcIyzHNqyRtGonuITJQveikNwXGjdJgL7gqojqWKnq4w==; 20:o/h0EGNegWd/jb5yR2151Ghuf7LE+PD335zjWD5BKZWwhLQt2ifYZ5577W3zxsxNSFSMCAmwkuCl/5ku90QVyl/yd0vnO5WDoJ1+AwhQCEB7zKgjqoEC1Ii04cLJYzy6jrTA2Qc/OjEsy3W28pBsOanjqv4y8IDESuNpeDpVSMhwZXc62LuKNJVy/rGi4q33VQY1S2GvCHC2rKDyZ7tF3qVq+cVBW441IeL9XSlxBm+pEWgAMTzfW8XNP5FA98qJwbDP8vqFC7DMLAx02yGc7VImMF5dA8a4OVrq1rtBUFxgcTY1r+Cw6sKSRRHYZSTjZFqvF64AJfxj1DsMDpJlR28VLa19QN3KbYZIOX+5c5XgOP9FFsQSUBf+BBtxG6XfhejkWUTVLwrWXHF6WgLa6y37phIvmcVoQnK/EI9/FdTv+dF9UF1AoAkqbHOAX/Vf6qlQhhIeFVQAfcGAlUmKX7xUQMo7GgLgSP6DhOZ5jHkBhOADZLlzVtxkF1FkM4IfEO9XuqpQG2mtx1EoqpdIfMM3oAhLcekPB1UXMIQPLRhY5hQCDchMvQCtTCIHwAu14+Mfjpm83RrCWw8vvZDyB0PJ3z77HZcL4T/SuwOATnE= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041248)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(6072148); SRVR:BN3PR07MB2643; BCL:0; PCL:0; RULEID:; SRVR:BN3PR07MB2643; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2643; 4:pCLt2tFXIURfCqbY5sftqBr6CJ5J6gx7DHXlekoZ2d6MWWa/tGABp9oN74wNwdmWOn8P4g6cJhdmQYQ6f59wZa9y3aVKjicV4OGVTkl/7EnhiYuiS546sIbd4zR1ykuVZfoyDWpPXYT/tXxqLRmK2QYNRf2khryBkZH6OfI8HuTVycNMQBJmIgAcEh7CrJ9Lcvb4jZmpZW4hTHZr8O1/db+1fgVXcmylqzss6Yo5dxlcBdUMDAls7ZEU+qkYFR9RBqV1zo9BV3NilXKiz9aSV+JY88+5fTdkclHR8TvUavbNtPaGvcqAgBZP4V80+Hag9M9j4CJfB5OBDenpZ7tUEVoglBiYGHsp06hZiaHi82IaMW8UL+4p4450a+7/0Ia9kT41TBb/EeI4bTD1VyXw9zVbz/wKwv2zLNi7NqGH6uSICmGvWhr7SsVgwAQAAvA4LTT9FO+D1vvprcBOfcorhBcgA+fdsJIEQ0r1aAodzMlbiIuZxryY80bWGfmArLCw5WNhBoKgIkgq13p2S6hN6AyJGfUVXkL+jjXuDF0zsA4jx6BMCL0mxLM2TbAC9qpIDLIEWA7Km6lBgltE7aZpMg== X-Forefront-PRVS: 018577E36E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(39450400003)(189002)(199003)(36756003)(6512007)(8676002)(92566002)(5003940100001)(4001430100002)(38730400001)(66066001)(86362001)(106356001)(6506006)(25786008)(6486002)(4326007)(2201001)(2906002)(68736007)(189998001)(50466002)(3846002)(5660300001)(6116002)(48376002)(6862003)(50986999)(50226002)(101416001)(81156014)(6666003)(81166006)(7736002)(42186005)(305945005)(47776003)(107886002)(97736004)(105586002)(5001770100001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR07MB2643; H:localhost.localdomain.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR07MB2643; 23:acFcKWOAREvDv6UT6PGHzuZBTMAJBhlvpIMLMPB4m?= =?us-ascii?Q?ODhIKzzAKfLC6nopE+5y10eQSN0zFFUvVQVKbW/Xel3WDcXW7Cp4A2w8T7Md?= =?us-ascii?Q?fEwKdqhAI+NERkSbfL9yJ0qsM276mdt2khQcCbfleCJ0wWd35Jr/v7lriuyA?= =?us-ascii?Q?99Zx8mOwmTQym+HjVeUljd4b0f61Lcm9SoD1Zd80ZQVExuSqJEMRlCgoWWoF?= =?us-ascii?Q?FlusTGUmqCraxRq4FaroM1hnWV9BO174nqmRUOmk5S+Mq6Xm5cSl/maqleSD?= =?us-ascii?Q?lkKc0sy5xgGmMuljzcOBVAsmz6Utyu7pZtiXW3qiMdzGqsVs9CJG9k531VFw?= =?us-ascii?Q?OaOzDpDlpH+tM5V/6o7W4scVpV8ZEB2sJemVLeZq+yjneyoc5QAzRoYvPxP2?= =?us-ascii?Q?yJ3E8S5xkJGZf/H5EYq6Z9xw2goyCM5nsKVS1PYLZoRODKgnD9vPRCNeOj+F?= =?us-ascii?Q?AiVpoG1Fbo7R7FId7yxe26w34LyyNpnAOuTxTThSvezcrjMelxhNxTuDUjq/?= =?us-ascii?Q?B53C4HrVlJnFO6lInsptTQOpsLd5GFhQ4EGxRyD/zLR4oWm2KiryxSDgf9Bg?= =?us-ascii?Q?fTUayx25SrdSeG36yEymk90/56ULGbDB2pUHs4uymlN3IN3ZAOM86OTWjAL4?= =?us-ascii?Q?VB4dOydCFRe7uLQJCDU/mgMVcvotovQF/c/18WSpeFy3kAcwKxbImG79WA6E?= =?us-ascii?Q?+aAmlM+l2MlUF6sSTqpsjr9QodmYjqMRDZIxljo3T7xgviXnOg508gxXN8bb?= =?us-ascii?Q?xLNpLPlItWrxiNs6mybbfoseaDRbi0vLS0Rf4/OI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HTaDQsFiwb4tYQbt99BmK/bNY6r1v6qWezu9L+vxSX+OPeMMk+SE5HP/1F67TPzXFskOaht8/33s= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2643; 7:N8dQN1OLMdcctxwtabQfNzmxBhfpw7IaJHVtTUDyGEHiyfOA29y5Q49MSsWV/IOOiq3+yd8TgybyC4nlbEUyiy/+CKVmCmgmIvDfdWpaNU5VVuZdJQ559nIMsoo2kw6M418mpdIeRmSLkgE2MlTsOuFNXPt4Q130uSd2XVA0PlnkRo8VY7A8mef3WVRs7SAbIbPgrSP7f6y8Xr3hJQTZQOuVnedXTcDEoB2bECpE3GPnbiuYTFCb/5Re0azNHxj7fq+vp3N1SYec3a698D7ZeV5qsDfivLbkkgdof7YcM+u6QTSkSVnms6C6d3QYsbadA8SY5kjRNIcBFAvpZ0kmcHhzQCpw6qohi3a32sK8UOm00DgmMsv5BNnoQiGo7ISv5mICxKVWFH0/BOIzSDRuzaov02xpDkiNDIFgXQBwwyyNWE0HXW4FZ4wp5Uekg8SLhx2iyQ0CEf7xJMYxvWpkSg== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2017 15:29:10.1404 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2643 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170112_072932_508000_CE042F9A X-CRM114-Status: UNSURE ( 7.29 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vadim Lomovtsev Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP While probing BGX we requesting appropriate QLM for it's configuration and get LMAC count by that request. Then, while reading configured MAC values from SSDT table we need to save them in proper mapping: BGX[i]->lmac[j].mac = to later provide for initialization stuff. In order to fill such mapping properly we need to add lmac index to be used while acpi initialization since at this moment bgx->lmac_count already contains actual value. Signed-off-by: Vadim Lomovtsev --- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c index be30ad0..a3f4f83 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c @@ -47,8 +47,9 @@ struct lmac { struct bgx { u8 bgx_id; struct lmac lmac[MAX_LMAC_PER_BGX]; - int lmac_count; + u8 lmac_count; u8 max_lmac; + u8 acpi_lmac_idx; void __iomem *reg_base; struct pci_dev *pdev; bool is_dlm; @@ -1073,13 +1074,13 @@ static acpi_status bgx_acpi_register_phy(acpi_handle handle, if (acpi_bus_get_device(handle, &adev)) goto out; - acpi_get_mac_address(dev, adev, bgx->lmac[bgx->lmac_count].mac); + acpi_get_mac_address(dev, adev, bgx->lmac[bgx->acpi_lmac_idx].mac); - SET_NETDEV_DEV(&bgx->lmac[bgx->lmac_count].netdev, dev); + SET_NETDEV_DEV(&bgx->lmac[bgx->acpi_lmac_idx].netdev, dev); - bgx->lmac[bgx->lmac_count].lmacid = bgx->lmac_count; + bgx->lmac[bgx->acpi_lmac_idx].lmacid = bgx->acpi_lmac_idx; + bgx->acpi_lmac_idx++; /* move to next LMAC */ out: - bgx->lmac_count++; return AE_OK; }