Intel Wi-Fi Control Path

  • In this section, you are going to learn

  • Wi-Fi Control Path

#

Version

Freebsd

14.1.0

wpa_supplicant

2.10

Ex:
const  struct wpa_driver_ops wpa_driver_bsd_ops = {
                                                        .scan2 = wpa_driver_bsd_scan,
                                                        };
  • Defined in /usr/src/contrib/wpa/src/drivers/driver_bsd.c

  • The ‘struct wpa_driver_ops’ is a structure in wpa_supplicant (user-space daemon) that defines a set of function pointers for various operations that the driver needs to support to interact with the Wi-Fi hardware.

  • wpa_driver_bsd_ops It provides an interface between wpa_supplicant and the FreeBSD kernel’s Wi-Fi driver.

static int wpa_driver_bsd_scan(void *priv, struct wpa_driver_scan_params *params)
  • Defined in /usr/src/contrib/wpa/src/drivers/driver_bsd.c

  • It is a driver interaction function responsible for sending scan requests to the kernel. This function issues an IOCTL system call/command.

  • The WLAN (Wireless Local Area Network) functionality is handled primarily through the net80211 subsystem, which provides a comprehensive framework for wireless networking based on the IEEE 802.11 standard.

  • The net80211 framework is responsible for managing the core 802.11 wireless protocol stack in FreeBSD. It handles wireless-specific tasks such as scanning for networks, authentication, association, encryption, and managing wireless data traffic.

int ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
  • Defined in /usr/src/sys/net80211/ieee80211_ioctl.c

  • Once the ioctl request is received, it is handled by the FreeBSD 802.11 stack. This is the entry point in the kernel for ioctl calls related to 802.11

Struct ieee80211com {
                   * scanning support */
                     void   (*ic_scan_start)(struct ieee80211com *)
             };
  • Defined in /usr/src/sys/net80211/ieee80211_var.h

  • The struct ieee80211com is a structure in the FreeBSD networking stack specifically within net80211 framework, which handles 802.11 (Wi-Fi) networking.

  • It provides an interact with actual Wi-Fi hardware

  • From ‘ic_scan_start’ as call back and called the linux_KPI functions

int linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw)
{
        ic->ic_scan_start = lkpi_ic_scan_start;
}
  • Defined in sys/compat/linuxkpi/common/src/linux_80211.c

  • The LinuxKPI (Linux Kernel Programming Interface) in FreeBSD is a compatibility layer that allows certain Linux kernel functions and drivers to work on FreeBSD by providing equivalents or mappings to FreeBSD’s own kernel APIs.

  • Many hardware vendors provide Linux drivers, but not FreeBSD drivers. The LinuxKPI layer enables FreeBSD to use Linux drivers by adapting Linux kernel function calls to FreeBSD equivalents.

  • In linuxkpi called the same ieee80211_ops call back functions and then enter intel driver(iwlwifi).

struct ieee80211_ops {
                        int  (*hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_scan_request *);
                       }
  • Defined in sys/compat/linuxkpi/common/include/net/mac80211.h

struct ieee80211_ops iwl_mvm_hw_ops = {
                              .hw_scan = iwl_mvm_mac_hw_scan,
                                        }
  • Defined in /usr/src/sys/contrib/dev/iwlwifi/mvm/mac80211.c

  • From the linuxkpi function finally calls the ieee80211 operation function.

  • ieee80211_ops define a set of operations (function pointers) for the 802.11 (Wi-Fi) hardware to handle various Wi-Fi tasks like scanning, association, and data transmission

  • iwl_mvm_hw_ops is the Intel-specific implementation for handling Wi-Fi hardware operations.