wlan0 interface up but not RUNNING

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

wlan0 interface up but not RUNNING

19,275 Views
andron
Contributor I

I'm using the IMX7-Dual board to configure the drivers to run in AP mode. I've followed the instructions from Wi-Fi/Bluetooth for Linux and Android: Getting ... | Cypress Developer Community  and downloaded the drivers and a Linux Kernel. I followed all the steps provided in that link and was able to compile/load and get the board to associate to an open WLAN, and then also to a secured (WPA2-PSK) WLAN.

Now, I'm trying to get the board to run in AP mode. I bring up the wireless interface (wlan0) with the following command sequence:


ifconfig wlan0
ifconfig wlan0 up

wl -i wlan0 down
wl -i wlan0 ap 1
wl -i wlan0 country US
wl -i wlan0 5g_rate auto
wl -i wlan0 bw_cap 5g 0x7
wl -i wlan0 ssid "001_mesh_open"
wl -i wlan0 bss 1
wl -i wlan0 chanspec 36/20
wl -i wlan0 txchain 7
wl -i wlan0 rxchain 7
wl -i wlan0 up
wl -i wlan0 bss 1
wl -i wlan0 status
wl -i wlan0 msglevel + assoc + error + info

ifconfig wlan0 up

With this sequence of commands, the board is able to broadcast an SSID (001_mesh_open) and a client is able to associate, however, the client does not get an IP address and when configured with a static IP address that's in the same network as the configured IP address of wlan0, traffic does not pass. 

#
# wl assoclist
assoclist 8C:85:90:A8:FF:01
#
#
#

On checking wlan0, its status is UP, but not RUNNING! (This seems to be the main issue)

When the board is acting as a STA, wlan0 shows as UP and RUNNING. 

#
# # logs for when using board as AP
# ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr A4:08:EA:E1:A1:B0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:77 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:18475 (18.0 KiB) TX bytes:0 (0.0 B)

#
#

# dmesg | tail

IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
random: crng init done

The devices are all unblocked for the wireless interface:
#
# rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
#

Trying to bring up the wireless interface with ifup wlan0 doesn't seem to do anything. 

#
# ifdown wlan0
#
# ifup wlan0
#

Checking the IP link, it says "No-Carrier"

# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq qlen 1000
link/ether 00:04:9f:05:24:eb brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc mq qlen 1000
link/ether 00:04:9f:05:24:ec brd ff:ff:ff:ff:ff:ff
4: tunl0@NONE: <NOARP> mtu 1480 qdisc noop qlen 1
link/ipip 0.0.0.0 brd 0.0.0.0
5: gre0@NONE: <NOARP> mtu 1476 qdisc noop qlen 1
link/gre 0.0.0.0 brd 0.0.0.0
6: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
7: sit0@NONE: <NOARP> mtu 1480 qdisc noop qlen 1
link/sit 0.0.0.0 brd 0.0.0.0
8: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether a4:08:ea:e1:a1:b0 brd ff:ff:ff:ff:ff:ff
#
#

The interfaces file is as follows:

#
#
# cat /etc/network/interfaces
# interface file auto-generated by buildroot

auto lo
iface lo inet loopback

# The primary network interface
#auto eth0
#iface eth0 inet dhcp


# allow-hotplug wlan0
iface wlan0 inet dhcp

My questions:

Why is the link not RUNNING? Is there something that I am missing? Is the driver capable of operating in an AP mode? Is there kernel support for driver to operate in AP mode?

Any help in debugging this issue is appreciated. 

0 Kudos
5 Replies

5,980 Views
shawnstevenson
Contributor II

Hi Andro,

Have you tried using hostapd to run in AP mode? I am using hostapd on an imx6 design and it works fine. I am also using a Cypress/Broadcom Wi-Fi chip.

Thanks,

Shawn

0 Kudos

5,980 Views
andronooh
Contributor I

Hi Shawn,

Yes I have and it's working!

The ultimate goal was to get the board to operate in APSTA mode simultaneously.

I am using  i.MX7D SABRESD  board with Broadcom's 43455 interfaced through SDIO.

By default the board comes up in STA mode, and it's able to connect to a secure SSID by configuring WPA Supplicant. 

When I tried to configure the board in AP mode, I ran into issues, hence this question. Since then, I debugged the issue and found out that as part of the configurations (^ wl commands above) , the wrong firmware event is populated to "soft mac" (FMAC) for setting the SSID. The firmware event BRCMF_E_LINK is reported to driver instead of BRCMF_E_SET_SSID when the command “wl -i wlan0 ssid test_ssid1” is issued. With the SSID not set, the interface was not fully initialized, therefore the Linux netdev interface could not go into "RUNNING" state. 

I implemented a quick workaround of handling the event BRCMF_E_LINK as BRCMF_E_SET_SSID in the function brcmf_is_linkup() to fix this issue.

After the workaround, the board is able to operate in AP mode and clients are able to associate. I brought up HOSTAPd to allow secure connection, and that works now.

Now the trick to operating the board in AP/STA mode simultaneously is by initially configuring the base interface (wlan0) as STA, and then creating a virtual interface wlan1(linked to wlan0) to operate in AP mode. 

This seems to be working fine, but there are intermittent issues seen. I'm following up with Cypress on whether the open source firmware supports APSTA mode (How to configure driver for AP/STA mode simulta... | Cypress Developer Community ), while also debugging the issues in parallel. 

 

For now, I think we can close this question. 

Appreciate everyone's inputs/help.

Regards,

Andro 

0 Kudos

5,980 Views
andronooh
Contributor I

Hi jimmychan 

Andro here(not able to log in my original account).

Thank you for replying back. Appreciate your comment. 

To clarify a few things, I downloaded the open source FMAC package from here Cypress Linux WiFi Driver Release (FMAC) [2018-... | Cypress Developer Community 

This package does not have fw_bcmdhd_apsta.bin 

Below are all the firmware files provided in that package. 

VirtualBox:~/mesh/new >
VirtualBox:~/mesh/new > find . -name *.bin
./firmware/brcmfmac4359-pcie.bin
./firmware/brcmfmac4356-sdio.bin
./firmware/brcmfmac43012-sdio.bin
./firmware/brcmfmac4339-sdio.bin
./firmware/brcmfmac4354-sdio.bin
./firmware/brcmfmac43340-sdio.bin
./firmware/brcmfmac43430-sdio.bin
./firmware/brcmfmac4359-sdio.bin
./firmware/brcmfmac43362-sdio.bin
./firmware/brcmfmac4356-pcie.bin
./firmware/brcmfmac43455-sdio.bin
VirtualBox:~/mesh/new >

Looking at the driver code in that package, the structure cfg80211_ops is mapping the basic mac80211 APIs to the Broadcom specific APIs.

  1. static struct cfg80211_ops brcmf_cfg80211_ops = {  
  2.     .add_virtual_intf = brcmf_cfg80211_add_iface,  
  3.     .del_virtual_intf = brcmf_cfg80211_del_iface,  
  4.     .change_virtual_intf = brcmf_cfg80211_change_iface,  
  5.     .scan = brcmf_cfg80211_scan,  
  6.     .set_wiphy_params = brcmf_cfg80211_set_wiphy_params,  
  7.     .join_ibss = brcmf_cfg80211_join_ibss,  
  8.     .leave_ibss = brcmf_cfg80211_leave_ibss,  
  9.     .get_station = brcmf_cfg80211_get_station,  
  10.     .dump_station = brcmf_cfg80211_dump_station,  
  11.     .set_tx_power = brcmf_cfg80211_set_tx_power,  
  12.     .get_tx_power = brcmf_cfg80211_get_tx_power,  
  13.     .add_key = brcmf_cfg80211_add_key,  
  14.     .del_key = brcmf_cfg80211_del_key,  
  15.     .get_key = brcmf_cfg80211_get_key,  
  16.     .set_default_key = brcmf_cfg80211_config_default_key,  
  17.     .set_default_mgmt_key = brcmf_cfg80211_config_default_mgmt_key,  
  18.     .set_power_mgmt = brcmf_cfg80211_set_power_mgmt,  
  19.     .connect = brcmf_cfg80211_connect,  
  20.     .disconnect = brcmf_cfg80211_disconnect,  
  21.     .suspend = brcmf_cfg80211_suspend,  
  22.     .resume = brcmf_cfg80211_resume,  
  23.     .set_pmksa = brcmf_cfg80211_set_pmksa,  
  24.     .del_pmksa = brcmf_cfg80211_del_pmksa,  
  25.     .flush_pmksa = brcmf_cfg80211_flush_pmksa,  
  26.     .start_ap = brcmf_cfg80211_start_ap,  
  27.     .stop_ap = brcmf_cfg80211_stop_ap,  
  28.     .change_beacon = brcmf_cfg80211_change_beacon,  
  29.     .del_station = brcmf_cfg80211_del_station,  
  30.     .change_station = brcmf_cfg80211_change_station,  
  31.     .sched_scan_start = brcmf_cfg80211_sched_scan_start,  
  32.     .sched_scan_stop = brcmf_cfg80211_sched_scan_stop,  
  33.     .mgmt_frame_register = brcmf_cfg80211_mgmt_frame_register,  
  34.     .mgmt_tx = brcmf_cfg80211_mgmt_tx,  
  35.     .remain_on_channel = brcmf_p2p_remain_on_channel,  
  36.     .cancel_remain_on_channel = brcmf_cfg80211_cancel_remain_on_channel,  
  37.     .get_channel = brcmf_cfg80211_get_channel,  
  38.     .start_p2p_device = brcmf_p2p_start_device,  
  39.     .stop_p2p_device = brcmf_p2p_stop_device,  
  40.     .crit_proto_start = brcmf_cfg80211_crit_proto_start,  
  41.     .crit_proto_stop = brcmf_cfg80211_crit_proto_stop,  
  42.     .tdls_oper = brcmf_cfg80211_tdls_oper,  
  43.     .update_connect_params = brcmf_cfg80211_update_conn_params,  
  44.     .set_pmk = brcmf_cfg80211_set_pmk,  
  45.     .del_pmk = brcmf_cfg80211_del_pmk,  
  46.     .change_bss = brcmf_cfg80211_change_bss,  
  47. }; 

The functions  brcmf_cfg80211_start_ap and brcmf_cfg80211_stop_ap  place AP in STA/AP mode, and these functions are defined and compiled. 

 

Given that these APIs are defined with the given driver code, would this be sufficient for placing the drivers in AP mode? 

Does the open source package not support AP mode? 

Would appreciate if I can get a confirmation on this, as this would clarify things. 

Looking forward to hearing back from you.

Thanks,

Andro 

0 Kudos

5,980 Views
jimmychan
NXP TechSupport
NXP TechSupport

You are better to ask Cypress to confirm their firmware is also support AP mode.

0 Kudos

5,980 Views
jimmychan
NXP TechSupport
NXP TechSupport

To support AP mode, you need to load the firmware that support AP mode.

e.g. fw_bcmdhd_apsta.bin