From patchwork Thu Jun 14 10:08:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Pisati X-Patchwork-Id: 929321 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 415zqQ3LyWz9ryk; Thu, 14 Jun 2018 20:09:06 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fTPBc-0001Er-0l; Thu, 14 Jun 2018 10:09:00 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fTPBa-0001EZ-4u for kernel-team@lists.ubuntu.com; Thu, 14 Jun 2018 10:08:58 +0000 Received: from 1.general.ppisati.uk.vpn ([10.172.193.134] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fTPBZ-0006Qz-SY for kernel-team@lists.ubuntu.com; Thu, 14 Jun 2018 10:08:57 +0000 From: Paolo Pisati To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 0/2] [SRU] [B/master] UBUNTU: SAUCE: arm64: snapdragon: wcn36xx MAC Date: Thu, 14 Jun 2018 12:08:55 +0200 Message-Id: <1528970937-26879-1-git-send-email-paolo.pisati@canonical.com> X-Mailer: git-send-email 2.7.4 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: http://bugs.launchpad.net/bugs/1776491 Impact: The wcn36xx driver in Xenial/linux-snapdragon had an ability to autogenerate its MAC address upon boot, or read it from a file (/lib/firmware/wlan/macaddr0). The linux-snapdragon kernel in Bionic doesn't have this feature. While by itself not a bug (Xenial used a QCOM provided custom driver, while Bionic uses the upstream wcn36xx driver), it can be easily work-arounded by specifying the hw address in /etc/network/interfaces, or set using ifconfig on the command line, but it turned out to be a real problem on ubuntu core: 1) upon boot, with no MAC address assigned, the wcn36xx assigns itself the dummy address "00:00:00:00:00" and that prevents the network interface from working at all, until a valid address is set 2) the ubuntu core installer doesn't have any knowledge about this behaviour, it simply tries to bring up the interface and on failure, it marks it as 'not working' On top of that, ubuntu core ships a small script in initramfs, that generates the /lib/firmware/wlan/macaddr0 file starting from the android boot serial, effectively generating a unique MAC address per board: clearly, without driver support, this ubuntu core feature doesn't work. Fix: Import back the MAC generation mechanism from Xenial: the pseudo random generation and the parsing of /lib/firmware/wlan/macaddr0 - see the attached patch. How to test: Unpon boot, if no /lib/firmware/wlan/macaddr0 is present, the kernel will print: [ 10.612701] wcn36xx a204000.wcnss:smd-edge:wcnss:wifi: Direct firmware load for wlan/macaddr0 failed with error -2 [ 10.612713] wcn36xx a204000.wcnss:smd-edge:wcnss:wifi: Failed (-2) to read macaddressfile wlan/macaddr0, using a random address instead ubuntu@dragon410c:~$ ifconfig wlan0 wlan0: flags=4098 mtu 1500 ether 00:0a:f5:d5:54:d7 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 else, if /lib/firmware/wlan/macaddr0 is present, its content will be used to generate wlan0 MAC address: ubuntu@dragon410c:~$ cat /lib/firmware/wlan/macaddr0 fe:1a:19:77:d9:88 ubuntu@dragon410c:~$ ifconfig wlan0 wlan0: flags=4098 mtu 1500 ether fe:1a:19:77:d9:88 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 Regression potential: Low - the patch is small and the code is wrapped in a Kconfig option (WCN36XX_SNAPDRAGON_HACKS) that only affects the linux-snapdragon flavour, leaving the generic kernel untouched. Paolo Pisati (2): UBUNTU: SAUCE: wcn36xx: read MAC from file or randomly generate one UBUNTU: [Config] arm64: snapdragon: WCN36XX_SNAPDRAGON_HACKS=y debian.master/config/amd64/config.common.amd64 | 1 + debian.master/config/arm64/config.flavour.generic | 1 + .../config/arm64/config.flavour.snapdragon | 1 + debian.master/config/armhf/config.common.armhf | 1 + debian.master/config/i386/config.common.i386 | 1 + debian.master/config/ppc64el/config.common.ppc64el | 1 + drivers/net/wireless/ath/wcn36xx/Kconfig | 9 +++++ drivers/net/wireless/ath/wcn36xx/main.c | 38 +++++++++++++++++++++- 8 files changed, 52 insertions(+), 1 deletion(-) Acked-by: Stefan Bader Acked-by: Khalid Elmously