[PATCH 0/2] [SRU] [SAUCE] [B/master] arm64: snapdragon: wcn36xx MAC

Paolo Pisati paolo.pisati at canonical.com
Tue Jun 12 14:28:38 UTC 2018


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 at dragon410c:~$ ifconfig wlan0
wlan0: flags=4098<BROADCAST,MULTICAST> 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 at dragon410c:~$ cat /lib/firmware/wlan/macaddr0
fe:1a:19:77:d9:88

ubuntu at dragon410c:~$ ifconfig wlan0
wlan0: flags=4098<BROADCAST,MULTICAST> 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):
  SAUCE: wcn36xx: read MAC from file or randomly generate one
  UBUNTU: [Config] arm64: snapdragon: WCN36XX_SNAPDRAGON_HACKS=y

 .../config/amd64/config.common.amd64          |  1 +
 .../config/arm64/config.flavour.generic       |  1 +
 .../config/arm64/config.flavour.snapdragon    |  1 +
 .../config/armhf/config.common.armhf          |  1 +
 debian.master/config/i386/config.common.i386  |  1 +
 .../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(-)

-- 
2.17.1





More information about the kernel-team mailing list