[BPI-R2] internal Wifi/BT (MT6625L) - Kernel

make sure you make not “echo 1” before “echo A”…echo 1 creates wlan0 for client-mode and “echo A” creates ap0 for ap-mode…please only one of these echoes :slight_smile:

No luck with multiple ssid. Seems that internal adapter does not support this mode. Tried both repository hostapd 2.4 and 2.6 compiled from sources.

nl80211: Create interface iftype 3 (AP)
Failed to create interface ap0_0: -95 (Operation not supported)
Failed to add BSS (BSSID=02:08:22:ac:b6:01)
hostapd.conf
interface=ap0
bssid=02:08:22:ac:b6:00
driver=nl80211
hw_mode=g
channel=2
#ignore_broadcast_ssid=1
#ssid for real root interface seems to be required
ssid=root-ssid

bss=ap0_0
ssid=ssid00
bridge=br0
wmm_enabled=1
wpa=2
preamble=1
wpa_passphrase=pass0000
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0

bss=ap0_1
ssid=ssid01
wmm_enabled=1
wpa=2
preamble=1
wpa_passphrase=pass0001
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0

ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
full log
mxbpir201 hostapd # hostapd -dd /etc/hostapd/hostapd_ap0.conf
random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd_ap0.conf
ctrl_interface_group=0
rfkill: Cannot open RFKILL control device
nl80211: RFKILL status not available
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:6
nl80211: Supported vendor command: vendor_id=0x1a11 subcmd=1
nl80211: Supported vendor command: vendor_id=0x1a11 subcmd=6
nl80211: Disable use_monitor with device_ap_sme since no monitor mode support detected
nl80211: interface ap0 in phy phy1
nl80211: Set mode ifindex 12 iftype 3 (AP)
nl80211: Setup AP(ap0) - device_ap_sme=1 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0x4e5740 (device SME)
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x4e5740 match=
nl80211: Enable Probe Request reporting nl_preq=0x4e56f8
nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0x4e56f8 match=
nl80211: QCA vendor test command returned -95 (Operation not supported)
nl80211: Interface ap0 is in bridge br0
nl80211: Add own interface ifindex 8
nl80211: if_indices[16]: 8
nl80211: Add own interface ifindex 12
nl80211: if_indices[16]: 8 12
phy: phy1
BSS count 3, BSSID mask ff:ff:ff:ff:ff:fc (2 bits)
nl80211: Regulatory information - country=00
nl80211: 2402-2472 @ 40 MHz 20 mBm
nl80211: 2457-2482 @ 20 MHz 20 mBm (no IR)
nl80211: 2474-2494 @ 20 MHz 20 mBm (no OFDM) (no IR)
nl80211: 5170-5250 @ 80 MHz 20 mBm (no IR)
nl80211: 5250-5330 @ 80 MHz 20 mBm (DFS) (no IR)
nl80211: 5490-5730 @ 160 MHz 20 mBm (DFS) (no IR)
nl80211: 5735-5835 @ 80 MHz 20 mBm (no IR)
nl80211: 57240-63720 @ 2160 MHz 0 mBm
nl80211: Added 802.11b mode based on 802.11g information
Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=12 freq=2467 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=13 freq=2472 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=36 freq=5180 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=40 freq=5200 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=44 freq=5220 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=48 freq=5240 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=52 freq=5260 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=56 freq=5280 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=60 freq=5300 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=64 freq=5320 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=100 freq=5500 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=104 freq=5520 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=108 freq=5540 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=112 freq=5560 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=116 freq=5580 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=120 freq=5600 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=124 freq=5620 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=128 freq=5640 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=132 freq=5660 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=136 freq=5680 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=140 freq=5700 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=149 freq=5745 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=153 freq=5765 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=157 freq=5785 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=161 freq=5805 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=165 freq=5825 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=12 freq=2467 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=13 freq=2472 MHz max_tx_power=20 dBm
Completing interface initialization
Mode: IEEE 802.11g  Channel: 2  Frequency: 2417 MHz
DFS 0 channels required radar detection
nl80211: Set freq 2417 (ht_enabled=0, vht_enabled=0, bandwidth=20 MHz, cf1=2417 MHz, cf2=0 MHz)
  * freq=2417
  * vht_enabled=0
  * ht_enabled=0
RATE[0] rate=10 flags=0x1
RATE[1] rate=20 flags=0x1
RATE[2] rate=55 flags=0x1
RATE[3] rate=110 flags=0x1
RATE[4] rate=60 flags=0x0
RATE[5] rate=90 flags=0x0
RATE[6] rate=120 flags=0x0
RATE[7] rate=180 flags=0x0
RATE[8] rate=240 flags=0x0
RATE[9] rate=360 flags=0x0
RATE[10] rate=480 flags=0x0
RATE[11] rate=540 flags=0x0
hostapd_setup_bss(hapd=0x4e29e0 (ap0), first=1)
ap0: Flushing old station entries
nl80211: flush -> DEL_STATION ap0 (all)
ap0: Deauthenticate all stations
nl80211: sta_remove -> DEL_STATION ap0 ff:ff:ff:ff:ff:ff --> 0 (Success)
wpa_driver_nl80211_set_key: ifindex=12 (ap0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=12 (ap0) alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=12 (ap0) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=12 (ap0) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
Using interface ap0 with hwaddr 02:08:22:ac:b6:00 and ssid "root-ssid"
nl80211: Set beacon (beacon_set=0)
nl80211: Beacon head - hexdump(len=60): 80 00 00 00 ff ff ff ff ff ff 02 08 22 ac b6 00 02 08 22 ac b6 00 00 00 00 00 00 00 00 00 00 00 64 00 21 04 00 09 72 6f 6f 74 2d 73 73 69 64 01 08 82 84 8b 96 0c 12 18 24 03 01 02
nl80211: Beacon tail - hexdump(len=15): 2a 01 00 32 04 30 48 60 6c 7f 04 00 00 00 02
nl80211: ifindex=12
nl80211: beacon_int=100
nl80211: dtim_period=2
nl80211: ssid - hexdump_ascii(len=9):
     72 6f 6f 74 2d 73 73 69 64                        root-ssid       
  * beacon_int=100
nl80211: hidden SSID not in use
nl80211: privacy=0
nl80211: auth_algs=0x3
nl80211: wpa_version=0x0
nl80211: key_mgmt_suites=0x4
nl80211: pairwise_ciphers=0x1
nl80211: group_cipher=0x1
nl80211: beacon_ies - hexdump(len=6): 7f 04 00 00 00 02
nl80211: proberesp_ies - hexdump(len=6): 7f 04 00 00 00 02
nl80211: assocresp_ies - hexdump(len=6): 7f 04 00 00 00 02
nl80211: Set ap0 operstate 0->1 (UP)
netlink: Operstate: ifindex=12 linkmode=-1 (no change), operstate=6 (IF_OPER_UP)
hostapd_setup_bss(hapd=0x4e3040 (ap0_0), first=0)
nl80211: Create interface iftype 3 (AP)
Failed to create interface ap0_0: -95 (Operation not supported)
Failed to add BSS (BSSID=02:08:22:ac:b6:01)
ap0: Flushing old station entries
nl80211: flush -> DEL_STATION ap0 (all)
ap0: Deauthenticate all stations
nl80211: sta_remove -> DEL_STATION ap0 ff:ff:ff:ff:ff:ff --> 0 (Success)
wpa_driver_nl80211_set_key: ifindex=0 (ap0_0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-19 No such device)
Failed to clear default encryption keys (ifname=ap0_0 keyidx=0)
wpa_driver_nl80211_set_key: ifindex=0 (ap0_0) alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-19 No such device)
Failed to clear default encryption keys (ifname=ap0_0 keyidx=1)
wpa_driver_nl80211_set_key: ifindex=0 (ap0_0) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-19 No such device)
Failed to clear default encryption keys (ifname=ap0_0 keyidx=2)
wpa_driver_nl80211_set_key: ifindex=0 (ap0_0) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-19 No such device)
Failed to clear default encryption keys (ifname=ap0_0 keyidx=3)
hostapd_free_hapd_data(ap0_0)
ap0: Flushing old station entries
nl80211: flush -> DEL_STATION ap0 (all)
ap0: Deauthenticate all stations
nl80211: sta_remove -> DEL_STATION ap0 ff:ff:ff:ff:ff:ff --> 0 (Success)
wpa_driver_nl80211_set_key: ifindex=12 (ap0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=12 (ap0) alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=12 (ap0) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=12 (ap0) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
hostapd_free_hapd_data(ap0)
Interface initialization failed
ap0: interface state UNINITIALIZED->DISABLED
ap0: AP-DISABLED 
ap0: Unable to setup interface.
hostapd_interface_deinit_free(0x4e1cd8)
hostapd_interface_deinit_free: num_bss=3 conf->num_bss=3
hostapd_interface_deinit(0x4e1cd8)
ap0: interface state DISABLED->DISABLED
hostapd_bss_deinit: deinit bss ap0_1
ap0: Deauthenticate all stations
nl80211: sta_remove -> DEL_STATION ap0 ff:ff:ff:ff:ff:ff --> 0 (Success)
ap0: AP-DISABLED 
hostapd_cleanup(hapd=0x4e5d28 (ap0_1))
hostapd_free_hapd_data: Interface ap0_1 wasn't started
hostapd_bss_deinit: deinit bss ap0_0
ap0: Deauthenticate all stations
nl80211: sta_remove -> DEL_STATION ap0 ff:ff:ff:ff:ff:ff --> 0 (Success)
ap0: AP-DISABLED 
hostapd_cleanup(hapd=0x4e3040 (ap0_0))
hostapd_free_hapd_data: Interface ap0_0 wasn't started
hostapd_bss_deinit: deinit bss ap0
ap0: Deauthenticate all stations
nl80211: sta_remove -> DEL_STATION ap0 ff:ff:ff:ff:ff:ff --> 0 (Success)
ap0: AP-DISABLED 
hostapd_cleanup(hapd=0x4e29e0 (ap0))
hostapd_free_hapd_data: Interface ap0 wasn't started
hostapd_interface_deinit_free: driver=0x4df5e0 drv_priv=0x4e38e8 -> hapd_deinit
nl80211: deinit ifname=ap0 disabled_11b_rates=0
nl80211: Disable Probe Request reporting nl_preq=0x88c6de71
nl80211: Remove monitor interface: refcount=0
nl80211: Remove beacon (ifindex=12)
netlink: Operstate: ifindex=12 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Unsubscribe mgmt frames handle 0x88c6dfc9 (deinit)
hostapd_interface_free(0x4e1cd8)
hostapd_interface_free: free hapd 0x4e29e0
hostapd_interface_free: free hapd 0x4e3040
hostapd_interface_free: free hapd 0x4e5d28
hostapd_cleanup_iface(0x4e1cd8)
hostapd_cleanup_iface_partial(0x4e1cd8)
hostapd_cleanup_iface: free iface=0x4e1cd8

Frank, do you have mt7612 like this? (yes, already found on your wiki)

Does it work in ac/n mode and are you happy with stability and coverage?

Does it support multi ssid? According to this wiki it seems that iw list | grep 'interface combinations'should answer. With our internal I get interface combinations are not supported.

At least can it work together with internal providing 2 ssid’s (e.g. 2 hostapd processes)?

this card works for 5ghz (my Intention to use in combination with internal) or 2.4 ghz. No dual ap. I have not tried stability yet

I’m currently not @ home…tomorrow evening i give you the output of iwlist

Could you please give the output of

iw list | grep 'interface combinations'

for mt7612.

I am ready to buy it, but want to buy one that is capable of holding several ssid. Thanks in advance.

I’ve found that iw- log created before: Need help porting mt76-driver to R2-Kernel

valid interface combinations:
	 * #{ IBSS } <= 1, #{ managed, AP } <= 8,
	   total <= 8, #channels <= 1, STA/AP BI must match, radar detect widths: { 20 MHz (no HT), 20 MHz, 40 MHz, 80 MHz }

Maybe this helps, else you have to wait till today evening (cest)

1 Like

Yep. Thanks again. According to guide it should hold up to 8 ssid’s.

But this does not mean that it can work in both bands (2.4+5 ghz) simultanously

I’ve found the information, that it should be impossible. Moreover you even can not bind different ssid’s to different channels.

can anybody explain me, how from_timer-function works and which-params (1st+3rd) are needed?

i found some patches like https://www.spinics.net/lists/raid/msg59618.html

but the params are not clear…first can be the same var like assigned to, second is the timer_list and the last??

include/linux/timer.h

#define from_timer(var, callback_timer, timer_fieldname) \
	container_of(callback_timer, typeof(*var), timer_fieldname)

here is the way i try to port:

having now problems with the from_timer-macro, have anyone an idea?

anyone here who can help? i guess it’s the last param i’ve set to from_timer…but also found no explaination of the from_timer-macro

Hi Frank, please apply attached patch to your 4.16-wifi branch, it does build but I don’t have an R2 board to test it.

patch.diff (3.8 KB)

1 Like

Hi Frank,

sorry didn’t look in detail about what you are trying to accomplish but this is just a simple trick to find an entry in the structure.

So second parameter is the pointer to the struct list that the timer uses and the third parameter is the name of the variable embedded in the structure that you are trying to pull.

Does that make sense?

Thanks

I just looked at the link you provided, that’s never going to work. You’re not initializing the structure correctly at the init time. Then you are trying to pull the wrong type and cast it.

This will either: crash, dump garbage or cause a memory corruption depending on what the rest of the code does with this variable.

What are you trying to do? Port something from 4.16 to 4.14?

I don’t have a ton of free time, but I do have about 24 years of linux kernel and drivers experience so maybe I can help here and there…

I try to port the wifi-driver of r2 from 4.14 to 4.16

@dfiloni thank you…will try it when i’m at home

@dfiloni’s patch seems better, let me know if you need help

there is a new problem:

drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/include/gl_kal.h:851:53: error: 'memset' writing 6 bytes into a region of size 5 overflows the destination [-Werror=stringop-overflow=]
 #define kalMemZero(pvAddr, u4Size)                  memset(pvAddr, 0, u4Size)
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.c:2084:5: note: in expansion of macro 'kalMemZero'
     kalMemZero(prBowLinkConnected->aucPeerAddress, MAC_ADDR_LEN); /* @FIXME */
     ^~~~~~~~~~

@frank-w can you post the structure definition for: prBowLinkConnected->aucPeerAddress

Full code is in 4.16-wifi branch in my github…

the wifi-driver is in drivers/misc/mediatek

I’m currently not @home

edit:

drivers/misc/mediatek/connectivity/wlan/gen2/common/wlan_bow.c:1262:	P_BOW_LINK_CONNECTED prBowLinkConnected;
drivers/misc/mediatek/connectivity/wlan/gen2/include/nic/bow.h:252:
typedef struct _BOW_LINK_CONNECTED {
        CHANNEL_DESC rChannel;
        UINT_8 aucReserved;
        UINT_8 aucPeerAddress[6];
} BOW_LINK_CONNECTED, *P_BOW_LINK_CONNECTED;