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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Paolo Pisati-5
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<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@dragon410c:~$ cat /lib/firmware/wlan/macaddr0
fe:1a:19:77:d9:88

ubuntu@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):
  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(-)

--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH v2 1/2] UBUNTU: SAUCE: wcn36xx: read MAC from file or randomly generate one

Paolo Pisati-5
BugLink: http://bugs.launchpad.net/bugs/1776491

By default, wcn36xx initializes itself with a dummy 00:00:00:00:00:00 MAC
address, preventing the interface from working until a valid MAC address was set.

While not an issue on Ubuntu Classic (where the user can always set it
later on the command line or via /etc/network/interfaces), it became a problem
on Ubuntu Core where the wifi interface is probed during installation,
before the user has any chance to set a new MAC address.

To overcome this scenario, the wcn36xx driver in Xenial had a couple of features:

1) during probe, if /lib/firmware/wlan/macaddr0 was present, its content was
used as the new MAC address

2) if that failed, a pseudo-random MAC addres was generated and set

and this is a port of a the corresponding Xenial code to Bionic:
see xenial/snapdragon tree,
drivers/net/wireless/ath/wcn36xx/wcn36xx-msm.c::wcn36xx_msm_get_hw_mac().

Signed-off-by: Paolo Pisati <[hidden email]>
---
 drivers/net/wireless/ath/wcn36xx/Kconfig |  9 ++++++++
 drivers/net/wireless/ath/wcn36xx/main.c  | 38 +++++++++++++++++++++++++++++++-
 2 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/Kconfig b/drivers/net/wireless/ath/wcn36xx/Kconfig
index 20bf967..44d34a80 100644
--- a/drivers/net/wireless/ath/wcn36xx/Kconfig
+++ b/drivers/net/wireless/ath/wcn36xx/Kconfig
@@ -16,3 +16,12 @@ config WCN36XX_DEBUGFS
   Enabled debugfs support
 
   If unsure, say Y to make it easier to debug problems.
+
+config WCN36XX_SNAPDRAGON_HACKS
+ bool "Dragonboard 410c WCN36XX MAC address generation hacks"
+ default n
+ depends on WCN36XX
+ ---help---
+  Upon probe, WCN36XX will try to read its MAC address from
+  a file located at /lib/firmware/wlan/macaddr0. If the file
+  is not present, it will randomly generate a new MAC address.
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index fcc98d4..ed0b973 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1265,6 +1265,14 @@ static int wcn36xx_probe(struct platform_device *pdev)
  void *wcnss;
  int ret;
  const u8 *addr;
+#ifdef CONFIG_WCN36XX_SNAPDRAGON_HACKS
+ int status;
+ const struct firmware *addr_file = NULL;
+ u8 tmp[18], _addr[ETH_ALEN];
+ static const u8 qcom_oui[3] = {0x00, 0x0A, 0xF5};
+ static const char *files = {"wlan/macaddr0"};
+#endif
+
 
  wcn36xx_dbg(WCN36XX_DBG_MAC, "platform probe\n");
 
@@ -1298,7 +1306,35 @@ static int wcn36xx_probe(struct platform_device *pdev)
  wcn36xx_err("invalid local-mac-address\n");
  ret = -EINVAL;
  goto out_wq;
- } else if (addr) {
+ }
+#ifdef CONFIG_WCN36XX_SNAPDRAGON_HACKS
+ else if (addr == NULL) {
+ addr = _addr;
+ status = request_firmware(&addr_file, files, &pdev->dev);
+
+ if (status < 0) {
+ /* Assign a random mac with Qualcomm oui */
+ dev_err(&pdev->dev, "Failed (%d) to read macaddress"
+ "file %s, using a random address instead", status, files);
+ memcpy(addr, qcom_oui, 3);
+ get_random_bytes(addr + 3, 3);
+ } else {
+ memset(tmp, 0, sizeof(tmp));
+ memcpy(tmp, addr_file->data, sizeof(tmp) - 1);
+ sscanf(tmp, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
+ &addr[0],
+ &addr[1],
+ &addr[2],
+ &addr[3],
+ &addr[4],
+ &addr[5]);
+
+ release_firmware(addr_file);
+ }
+ }
+#endif
+
+ if (addr) {
  wcn36xx_info("mac address: %pM\n", addr);
  SET_IEEE80211_PERM_ADDR(wcn->hw, addr);
  }
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH v2 2/2] UBUNTU: [Config] arm64: snapdragon: WCN36XX_SNAPDRAGON_HACKS=y

Paolo Pisati-5
In reply to this post by Paolo Pisati-5
BugLink: http://bugs.launchpad.net/bugs/1776491

Signed-off-by: Paolo Pisati <[hidden email]>
---
 debian.master/config/amd64/config.common.amd64       | 1 +
 debian.master/config/arm64/config.flavour.generic    | 1 +
 debian.master/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 +
 6 files changed, 6 insertions(+)

diff --git a/debian.master/config/amd64/config.common.amd64 b/debian.master/config/amd64/config.common.amd64
index 74bdfce..c380997 100644
--- a/debian.master/config/amd64/config.common.amd64
+++ b/debian.master/config/amd64/config.common.amd64
@@ -524,6 +524,7 @@ CONFIG_VMXNET3=m
 CONFIG_VXFS_FS=m
 CONFIG_W1=m
 CONFIG_WAN=y
+# CONFIG_WCN36XX_SNAPDRAGON_HACKS is not set
 CONFIG_WDTPCI=m
 CONFIG_WIMAX=m
 CONFIG_X25=m
diff --git a/debian.master/config/arm64/config.flavour.generic b/debian.master/config/arm64/config.flavour.generic
index d57a37e..b22966a 100644
--- a/debian.master/config/arm64/config.flavour.generic
+++ b/debian.master/config/arm64/config.flavour.generic
@@ -68,3 +68,4 @@ CONFIG_SPI_QUP=m
 CONFIG_SPMI=m
 CONFIG_SPMI_MSM_PMIC_ARB=m
 CONFIG_USB_ULPI_BUS=m
+# CONFIG_WCN36XX_SNAPDRAGON_HACKS is not set
diff --git a/debian.master/config/arm64/config.flavour.snapdragon b/debian.master/config/arm64/config.flavour.snapdragon
index cef01ad..28179ca 100644
--- a/debian.master/config/arm64/config.flavour.snapdragon
+++ b/debian.master/config/arm64/config.flavour.snapdragon
@@ -68,3 +68,4 @@ CONFIG_SPI_QUP=y
 CONFIG_SPMI=y
 CONFIG_SPMI_MSM_PMIC_ARB=y
 CONFIG_USB_ULPI_BUS=y
+CONFIG_WCN36XX_SNAPDRAGON_HACKS=y
diff --git a/debian.master/config/armhf/config.common.armhf b/debian.master/config/armhf/config.common.armhf
index 6ae8ae5..b7530fa 100644
--- a/debian.master/config/armhf/config.common.armhf
+++ b/debian.master/config/armhf/config.common.armhf
@@ -547,6 +547,7 @@ CONFIG_VMXNET3=m
 CONFIG_VXFS_FS=m
 CONFIG_W1=m
 CONFIG_WAN=y
+# CONFIG_WCN36XX_SNAPDRAGON_HACKS is not set
 CONFIG_WDTPCI=m
 CONFIG_WIMAX=m
 CONFIG_X25=m
diff --git a/debian.master/config/i386/config.common.i386 b/debian.master/config/i386/config.common.i386
index 3d4f6ad..85d45bd 100644
--- a/debian.master/config/i386/config.common.i386
+++ b/debian.master/config/i386/config.common.i386
@@ -516,6 +516,7 @@ CONFIG_VMXNET3=m
 CONFIG_VXFS_FS=m
 CONFIG_W1=m
 CONFIG_WAN=y
+# CONFIG_WCN36XX_SNAPDRAGON_HACKS is not set
 CONFIG_WDTPCI=m
 CONFIG_WIMAX=m
 CONFIG_X25=m
diff --git a/debian.master/config/ppc64el/config.common.ppc64el b/debian.master/config/ppc64el/config.common.ppc64el
index 02bb780..4719378 100644
--- a/debian.master/config/ppc64el/config.common.ppc64el
+++ b/debian.master/config/ppc64el/config.common.ppc64el
@@ -521,6 +521,7 @@ CONFIG_VME_BUS=y
 CONFIG_VXFS_FS=m
 CONFIG_W1=m
 CONFIG_WAN=y
+# CONFIG_WCN36XX_SNAPDRAGON_HACKS is not set
 CONFIG_WDTPCI=m
 CONFIG_WIMAX=m
 CONFIG_X25=m
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

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

Stefan Bader-2
In reply to this post by Paolo Pisati-5
On 14.06.2018 12:08, Paolo Pisati wrote:

> 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<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@dragon410c:~$ cat /lib/firmware/wlan/macaddr0
> fe:1a:19:77:d9:88
>
> ubuntu@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):
>   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 <[hidden email]>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

cmnt: [PATCH v2 1/2] UBUNTU: SAUCE: wcn36xx: read MAC from file or randomly generate one

Khaled Elmously
In reply to this post by Paolo Pisati-5
On 2018-06-14 12:08:56 , Paolo Pisati wrote:

> BugLink: http://bugs.launchpad.net/bugs/1776491
>
> By default, wcn36xx initializes itself with a dummy 00:00:00:00:00:00 MAC
> address, preventing the interface from working until a valid MAC address was set.
>
> While not an issue on Ubuntu Classic (where the user can always set it
> later on the command line or via /etc/network/interfaces), it became a problem
> on Ubuntu Core where the wifi interface is probed during installation,
> before the user has any chance to set a new MAC address.
>
> To overcome this scenario, the wcn36xx driver in Xenial had a couple of features:
>
> 1) during probe, if /lib/firmware/wlan/macaddr0 was present, its content was
> used as the new MAC address
>
> 2) if that failed, a pseudo-random MAC addres was generated and set
>
> and this is a port of a the corresponding Xenial code to Bionic:
> see xenial/snapdragon tree,
> drivers/net/wireless/ath/wcn36xx/wcn36xx-msm.c::wcn36xx_msm_get_hw_mac().
>
> Signed-off-by: Paolo Pisati <[hidden email]>
> ---
>  drivers/net/wireless/ath/wcn36xx/Kconfig |  9 ++++++++
>  drivers/net/wireless/ath/wcn36xx/main.c  | 38 +++++++++++++++++++++++++++++++-
>  2 files changed, 46 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/wcn36xx/Kconfig b/drivers/net/wireless/ath/wcn36xx/Kconfig
> index 20bf967..44d34a80 100644
> --- a/drivers/net/wireless/ath/wcn36xx/Kconfig
> +++ b/drivers/net/wireless/ath/wcn36xx/Kconfig
> @@ -16,3 +16,12 @@ config WCN36XX_DEBUGFS
>    Enabled debugfs support
>  
>    If unsure, say Y to make it easier to debug problems.
> +
> +config WCN36XX_SNAPDRAGON_HACKS
> + bool "Dragonboard 410c WCN36XX MAC address generation hacks"
> + default n
> + depends on WCN36XX
> + ---help---
> +  Upon probe, WCN36XX will try to read its MAC address from
> +  a file located at /lib/firmware/wlan/macaddr0. If the file
> +  is not present, it will randomly generate a new MAC address.
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
> index fcc98d4..ed0b973 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -1265,6 +1265,14 @@ static int wcn36xx_probe(struct platform_device *pdev)
>   void *wcnss;
>   int ret;
>   const u8 *addr;
> +#ifdef CONFIG_WCN36XX_SNAPDRAGON_HACKS
> + int status;
> + const struct firmware *addr_file = NULL;
> + u8 tmp[18], _addr[ETH_ALEN];
> + static const u8 qcom_oui[3] = {0x00, 0x0A, 0xF5};
> + static const char *files = {"wlan/macaddr0"};
> +#endif
> +
>  
>   wcn36xx_dbg(WCN36XX_DBG_MAC, "platform probe\n");
>  
> @@ -1298,7 +1306,35 @@ static int wcn36xx_probe(struct platform_device *pdev)
>   wcn36xx_err("invalid local-mac-address\n");
>   ret = -EINVAL;
>   goto out_wq;
> - } else if (addr) {
> + }
> +#ifdef CONFIG_WCN36XX_SNAPDRAGON_HACKS
> + else if (addr == NULL) {
> + addr = _addr;
> + status = request_firmware(&addr_file, files, &pdev->dev);
> +
> + if (status < 0) {
> + /* Assign a random mac with Qualcomm oui */
> + dev_err(&pdev->dev, "Failed (%d) to read macaddress"
> + "file %s, using a random address instead", status, files);
> + memcpy(addr, qcom_oui, 3);
> + get_random_bytes(addr + 3, 3);
> + } else {
> + memset(tmp, 0, sizeof(tmp));
> + memcpy(tmp, addr_file->data, sizeof(tmp) - 1);
> + sscanf(tmp, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
> + &addr[0],
> + &addr[1],
> + &addr[2],
> + &addr[3],
> + &addr[4],
> + &addr[5]);
> +
> + release_firmware(addr_file);

Not sure of the details of release_firmware(), but seems like calling it right after the memcpy() would be better. Probably not important though.


> + }
> + }
> +#endif
> +
> + if (addr) {
>   wcn36xx_info("mac address: %pM\n", addr);
>   SET_IEEE80211_PERM_ADDR(wcn->hw, addr);
>   }
> --
> 2.7.4
>
>
> --
> kernel-team mailing list
> [hidden email]
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

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

Khaled Elmously
In reply to this post by Paolo Pisati-5
On 2018-06-14 12:08:55 , Paolo Pisati wrote:

> 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<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@dragon410c:~$ cat /lib/firmware/wlan/macaddr0
> fe:1a:19:77:d9:88
>
> ubuntu@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):
>   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: Khalid Elmously <[hidden email]>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

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

Khaled Elmously
In reply to this post by Paolo Pisati-5
Applied to Bionic

On 2018-06-14 12:08:55 , Paolo Pisati wrote:

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team