Adding some documentation

This commit is contained in:
farhan 2023-12-06 16:06:28 -05:00
parent 113d10c2b9
commit 1b1e0317ba
Signed by: farhan
GPG Key ID: 45FE45AD7E54F59B
2 changed files with 20 additions and 6 deletions

View File

@ -1,3 +1,4 @@
# FreeBSD net80211 template driver # FreeBSD net80211 template driver
## Introduction ## Introduction
@ -27,6 +28,17 @@ ifconfig wlan create wlandev i3e0
## How to read ## How to read
Like all drivers, this might come off like a wall of code with no context.
The order to read this code is:
1) `i3e_attach` - Executed after the device is identified by
the `probe` function. Note, because this driver is a software-only
implementation, not a real USB, PCI or SDIO driver. It should power on the device, read any hardcoded values (ie, device version, MAC address, etc) and enable the device accordingly. The end result will be the `i3e0` interface.
* Subfunction `i3e_getradiocaps` - Sets the device modes and frequencies. Technically this could be merged or inlined into `i3e_attach`, but keeping it a separate function is convention.
2) `i3e_parent`, `i3e_vap_create` and `i3e_init` - These three functions operate in tandem when creating the interface with `ifconfig wlan create wlandev i3e`.
* `i3e_vap_create` - This is executed when `wlan`, which is a virtual interface to connect to multiple nodes at once.
* `i3e_parent` - This function is executed when the device is set to `up` or `down`. It must be assigned in `i3e_attach`, such as `ic->ic_parent = i3e_parent`. If the device is off, it will run `i3e_init` and then start or stop all VAPs.
* `i3e_init` - This function turns the device on and starts reading or writing.
### Explanation ### Explanation
## Source Files ## Source Files

View File

@ -125,7 +125,6 @@ i3e_detach(struct i3e_softc *sc)
static int static int
i3e_init(struct i3e_softc *sc) i3e_init(struct i3e_softc *sc)
{ {
printf("i3e_init\n");
sc->sc_running = 1; sc->sc_running = 1;
return (0); return (0);
} }
@ -456,21 +455,24 @@ i3e_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit,
} }
/* /*
* Set the device modes that the physical device is capable of doing * Set the modes that the physical device is capable of.
* The modes are enumerated in ieee80211_phymode (sys/net80211/_ieee80211.h) * The modes are enumerated in ieee80211_phymode (sys/net80211/_ieee80211.h)
* *
* Simple example: zyd_getradiocaps * Simple example: zyd_getradiocaps
*/ */
static void static void
i3e_getradiocaps(struct ieee80211com *ic, int maxchans, int *nchans, struct ieee80211_channel chans[]) i3e_getradiocaps(struct ieee80211com *ic, int maxchans, int *nchans,
struct ieee80211_channel chans[])
{ {
uint8_t bands[IEEE80211_MODE_BYTES]; uint8_t bands[IEEE80211_MODE_BYTES];
memset(bands, 0, sizeof(bands)); memset(bands, 0, sizeof(bands));
/* /*
* These are possible options that the device can physically module the signal and its associated frequency * These are possible options that the device can physically module the
* such as OFDM, CCK, GFSK, and 5GHz and 2GHz. * signal and its associated frequency such as OFDM, CCK, GFSK, and 5GHz
* The options are located in the enum ieee80211_phymode (sys/net80211/_ieee80211.h) * and 2GHz.
* The options are located in the enum ieee80211_phymode
* (sys/net80211/_ieee80211.h):
* - IEEE80211_MODE_AUTO * - IEEE80211_MODE_AUTO
* - IEEE80211_MODE_11A * - IEEE80211_MODE_11A
* - IEEE80211_MODE_11B * - IEEE80211_MODE_11B