From patchwork Fri Sep 7 17:21:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 10592413 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7E90D6CB for ; Fri, 7 Sep 2018 17:24:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61F482B13D for ; Fri, 7 Sep 2018 17:24:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5575D2B307; Fri, 7 Sep 2018 17:24:12 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D191A2B13D for ; Fri, 7 Sep 2018 17:24:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=shoS5/FuFrjwvF2LCOMFJ7FVNklFL4QUwYw7E3DVvCg=; b=A2Z6ruL1JeF6qo jSgO2Rto7zEcVMuKpKbPdgGKI9fhsCTTkJHxU6ZbLh8ADexoNp55urvEX3YmyfxAyWEQLzJ7pAMLj GZsJQl0aqF0IuQ2GiUY6IXjX25bY2D4fiobBLqUiDEToJnRV359kk77laaHqrmaEQihz5NVzEqj1V kI8e0o47ewiDlnBnLz0Ljo3uG+sCYPxvdHibPLkaK9ek3WzD22kv7e/FjRd4z+ncAU7JQcw0TN4he a5cneO9DA1CKuPykPb9y5loZCkw1SSew1TScB/m9g80OOn90ApaAqg+7UbK9JjYhdrMhJtEPfwcpj 1miT26EOVI9CGB2PPcug==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fyKUK-0006jM-JN; Fri, 07 Sep 2018 17:24:08 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fyKU8-0006d9-Qk for ath10k@lists.infradead.org; Fri, 07 Sep 2018 17:24:06 +0000 Received: by mail-pl1-x643.google.com with SMTP id b30-v6so4600459pla.0 for ; Fri, 07 Sep 2018 10:23:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=F3EScKHq882HmXSXacc/H2P5d85KqjVc6VQWxTmcaqM=; b=XjIKEMq7MJDedGI6KTXvY7jaA/GtXddn+4QP/k1WPKX1eZb2QwTmV1pjiJPnB2WrqK oibPp4bXq5H0UFsStXyv2yPSzmYkRJ3UNeA9sEatS0/dzCKZRHJzaiQUvDt+1ddZKtkx eKUUWVZ6mKfI89iEWovb8Cr05qqKZmnN3PZ5k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=F3EScKHq882HmXSXacc/H2P5d85KqjVc6VQWxTmcaqM=; b=HrxR6wNJdJnqDKJwPvzwrG/gFEgHx40UNjQdPY01nENzbUmnyGEURHnjorCBAUYY21 erSLXYA/JU2Rg6HbA5u3RRR9AQvjh9Uz2SvB8R/CiLC9IVUE/x+5x75n5ybm5zuVwH5R 0mXVlooevJ0lbDU7iLSWhDQghpHKvrB03dtObrCyBbq3vW5JzHe3XNVMCyPGI3MJpp33 jm9et09MyX1QrZr+3abom99iZVm2NIuhlKTVl8/vgIkBBUd+pZqFhL3xLmIMRyoHYX9U qVmEeSXwrMZZIpEhWKYcuD2kuAMFwmZvbCyzK5mwtc3rVWmkgWALExxrEMd5Ogl7ZuRE YnBg== X-Gm-Message-State: APzg51BWPlrwIk7AyOwjCKAcmCBAcnaaEnSBsW2thq1jNoOxi9bmoqvO cBrrqAPcc9+ovg0LlsUu5YY65g== X-Google-Smtp-Source: ANB0VdZP80c28VlbBiynmCZZj//n0X2AwAdo8Ayt1i1Z49+laNR/37RK7uIGFzbqb9nww+nI/4etew== X-Received: by 2002:a17:902:8e86:: with SMTP id bg6-v6mr9117767plb.108.1536341024871; Fri, 07 Sep 2018 10:23:44 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:1:299d:6b87:5478:d28a]) by smtp.gmail.com with ESMTPSA id q80-v6sm12908629pfd.15.2018.09.07.10.23.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 10:23:43 -0700 (PDT) From: Brian Norris To: Kalle Valo Subject: [PATCH] ath10k: utilize random MAC address if none is provided Date: Fri, 7 Sep 2018 10:21:57 -0700 Message-Id: <20180907172157.203785-1-briannorris@chromium.org> X-Mailer: git-send-email 2.19.0.rc2.392.g5ba43deb5a-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180907_102356_904560_D3B8B21D X-CRM114-Status: UNSURE ( 8.42 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brian Norris , Govind Singh , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, ath10k@lists.infradead.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Since commit 9d5804662ce1 ("ath10k: retrieve MAC address from system firmware if provided"), we support pulling our MAC address from system firmware. Along with this, we should admit that it's possible for system firmware to be screwed up as well, omitting the MAC address there. Provide a fallback, such that we choose a randomly-generated MAC address, with the local assignment bit set. This is not a preferred mode of operation and really should only serve the purpose of keeping the system chugging along while someone figures out what's wrong with the system. Grepping through other wireless drivers shows very similar fallback logic though, so why not? git grep eth_random_addr drivers/net/wireless/ Signed-off-by: Brian Norris --- drivers/net/wireless/ath/ath10k/mac.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 97548f96a2f7..484f9c74ce46 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -8325,6 +8325,10 @@ int ath10k_mac_register(struct ath10k *ar) void *channels; int ret; + if (!is_valid_ether_addr(ar->mac_addr)) { + ath10k_warn(ar, "invalid MAC address; choosing random\n"); + eth_random_addr(ar->mac_addr); + } SET_IEEE80211_PERM_ADDR(ar->hw, ar->mac_addr); SET_IEEE80211_DEV(ar->hw, ar->dev);