# Wifi shows up in pciconf, but not configured as wlan0



## sedwards (Jun 1, 2021)

After a few days of hacking, I'm very close to finally using FreeBSD.
I think I have one (hopefully) final step left, to get wifi working.

Currently, my wifi adapter shows up in `pciconf`, but it doesn't seem to show up as wlan0.
Running net-mgmt/wifimgr gives me the error `ifconfig: interface wlan0 does not exist`, making me think I need to set up `wlan0`, but as a complete newbie, even after reading the handbook and various forums posts (1, 2, 3, 4, 5) I'm unsure what the correct method to resolve this is.

Currently, I have, for 
`ifconfig -v`

```
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
    ether 98:83:89:18:81:19
    inet 192.168.219.101 netmask 0xffffff00 broadcast 192.168.219.255
    media: Ethernet autoselect (1000baseT <full-duplex>)
    status: active
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
    inet 127.0.0.1 netmask 0xff000000
    groups: lo
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
```
`pciconf -lv` (relevant parts)

```
none1@pci0:1:0:0:    class=0x028000 rev=0x20 hdr=0x00 vendor=0x168c device=0x003e subvendor=0x144d subdevice=0x4125
    vendor     = 'Qualcomm Atheros'
    device     = 'QCA6174 802.11ac Wireless Network Adapter'
    class      = network
re0@pci0:2:0:0:    class=0x020000 rev=0x0c hdr=0x00 vendor=0x10ec device=0x8168 subvendor=0x144d subdevice=0xc757
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller'
    class      = network
    subclass   = ethernet
```
`sysctl net.wlan.devices` (empty)

```
net.wlan.devices:
```
`service netif restart`

```
* rc-service: service `netif' does not exist
```
/etc/rc.conf

```
rc_parallel="NO"
devfs_system_ruleset="devfsrules_common"
ntpd_sync_on_start="YES"
vboxservice_flags="--disable-timesync"
ifconfig_re0="DHCP"
kld_list="/boot/modules/i915kms.ko"
keymap="us.kbd"
hostname="bsd"
wlans_ath0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"
```
/boot/loader.conf

```
crypto_load="YES"
aesni_load="YES"
geom_eli_load="YES"
vfs.zfs.arc_max="512M"
zfs_load="YES"
snd_hda_load="YES"
mixer_enable="YES"
sound_load="YES"
hint.hdaa.1.nid33.config="as=1 seq=15 misc=0"
boot_verbose="YES"
if_ath_load="YES"
wlan_wep_load="YES"
wlan_ccmp_load="YES"
wlan_tkip_load="YES"
```

Thank you in advance.


----------



## SirDice (Jun 1, 2021)

sedwards said:


> `sysctl net.wlan.devices` (empty)


Two things can happen here, either the correct driver isn't loaded yet, or, and this is the most likely, the card is not supported.

The devices that are enumerated through pciconf(8) are just that. It's whatever is connected to the system and enumerated through ACPI. It doesn't mean that the card is supported, it just means that the system found the card on the bus.


----------



## sedwards (Jun 1, 2021)

How can I check which driver to install?


----------



## SirDice (Jun 1, 2021)

As far as I know there's only one driver for Atheros based cards, ath(4). And that's already included with the GENERIC kernel.


----------



## sedwards (Jun 1, 2021)

After going through the list of supported cards on ath() and digging through the Atheros card specs for my card (QCA6174 802.11ac Wireless Network Adapter), it seems it is supported.
Surely it shows up in `pciconf` so it's not a bus issue.

Is it possible to try and manually configure this as `wlan0`?


----------



## SirDice (Jun 1, 2021)

sedwards said:


> After going through the list of supported cards on ath() and digging through the Atheros card specs for my card (QCA6174 802.11ac Wireless Network Adapter), it seems it is supported.


Apparently not or else it would have shown up in `net.wlan.devices`



sedwards said:


> Is it possible to try and manually configure this as `wlan0`?


You can't "force" a driver to apply to hardware, it doesn't work that way. Hardware is detected by those vendor and device IDs. The driver looks if those match with the ones it supports, if it doesn't then the driver simply won't attach.


----------



## sedwards (Jun 1, 2021)

Okay, I think I misunderstood this post from 10.0 talking about adding QCA support for Atheros.

I suppose I'll have to get a USB adapter or try to run a Linux driver with bhyve.


----------



## Emrion (Jun 1, 2021)

sedwards said:


> I suppose I'll have to get a USB adapter or *try to **run a Linux driver with bhyve.*


I have a QCA6174 and it's what I did. It works great (run a Linux VM with a funtional driver and passthru this hardware).

A guy is working on the port of the linux driver ath10k but I think it's still not finished.








						GitHub - erikarn/athp: freebsd ath10k port
					

freebsd ath10k port. Contribute to erikarn/athp development by creating an account on GitHub.




					github.com


----------



## Vull (Jun 1, 2021)

You might want to try something like this before trying a USB dongle. I have similar, but not identical hardware on my Lenovo laptop; "pciconf -lv" gives me:
	
	



```
ath0@pci0:1:0:0:        class=0x028000 rev=0x01 hdr=0x00 vendor=0x168c device=0x
0036 subvendor=0x17aa subdevice=0x4026
    vendor     = 'Qualcomm Atheros'
    device     = 'QCA9565 / AR9565 Wireless Network Adapter'
    class      = network
re0@pci0:2:0:0: class=0x020000 rev=0x10 hdr=0x00 vendor=0x10ec device=0x8168 sub
vendor=0x17aa subdevice=0x3812
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller'
    class      = network
    subclass   = ethernet
```
The wired Realtek device was working okay, but I couldn't suss out how to set up the wireless Atheros card without help, so I let the FreeBSD installer configure it for me, on another partition, and copied the relevant changes, which I then manually configured into the original partition's install. Now both devices are working on both installs. I have nothing related to either device in /boot/loader.conf, but I have this in my /etc/wpa_supplicant.conf file:
	
	



```
ctrl_interface=/var/run/wpa_supplicant
eapol_version=2
ap_scan=1
fast_reauth=1

network={
        ssid="mywirelessnetworkid"
        scan_ssid=0
        psk="mywirelessnetworkpasskey"
        priority=5
}
network={
        priority=0
        key_mgmt=NONE
}
```
... and this in my /etc/rc.conf file:
	
	



```
ifconfig_re0="DHCP"
ifconfig_re0_ipv6="inet6 accept_rtadv"
wlans_ath0="wlan0"
ifconfig_wlan0="WPA DHCP"
ifconfig_wlan0_ipv6="inet6 accept_rtadv"
create_args_wlan0="country US"
```
Hope this helps.

Edited to add: By the way, this is on FreeBSD-13.0-RELEASE-p1 which seems to be doing a better-than-ever job of loading device drivers without putting them in /boot/loader.conf. Another thing I noticed while reviewing this thread is that "pciconf -lv" gives you "none1@pci0:1:0:0:" for your Atheros device, but gives me "ath0@pci0:1:0:0:" for mine. This might be because you didn't have a driver loaded yet, but it might also indicate that your device model isn't supported? I really don't know. Good luck in either case...


----------



## aponomarenko (Jun 9, 2021)

This device is not supported by kernel yet. See https://bsd-hardware.info/?view=search&vendorid=168c&deviceid=003e#list

The only option (as stated above) is to use a gateway to a Bhyve VM with Linux.


----------

