mirror of
https://github.com/open-sdr/openwifi.git
synced 2024-12-18 21:28:07 +00:00
update document
This commit is contained in:
parent
da62eb45a3
commit
5f436b3c82
@ -3,11 +3,42 @@
|
||||
|
||||
Above figure shows software and hardware/FPGA modules that compose the openwifi design. The module name is equal/similar to the source code file name. Driver modules source code are in openwifi/driver/. FPGA modules source code are in openwifi-hw repository. The user space tool sdrctl source code are in openwifi/user_space/sdrctl_src/.
|
||||
|
||||
**sdrctl command**
|
||||
- [driver and software overall principle](#driver-and-software-overall-principle)
|
||||
- [rx packet flow and filtering config](#rx-packet-flow-and-filtering-config)
|
||||
- [tx packet flow and config](#tx-packet-flow-and-config)
|
||||
- [sdrctl command](#sdrctl-command)
|
||||
|
||||
## driver and software overall principle
|
||||
|
||||
[Linux mac80211 subsystem](https://www.kernel.org/doc/html/v4.16/driver-api/80211/mac80211.html), as a part of [Linux wireless](https://wireless.wiki.kernel.org/en/developers/documentation/mac80211) defines a set of APIs ([ieee80211_ops](https://www.kernel.org/doc/html/v4.9/80211/mac80211.html#c.ieee80211_ops)) to rule the Wi-Fi chip driver behavior. SoftMAC Wi-Fi chip driver implements (part of) APIs. That is why Linux can support so many types of Wi-Fi chip.
|
||||
|
||||
openwifi driver (sdr.c) implements following APIs of ieee80211_ops:
|
||||
- **tx**. It is called when upper layer has a packet to send
|
||||
- **start**. It is called when NIC up. (ifconfig sdr0 up)
|
||||
- **stop**. It is called when NIC down. (ifconfig sdr0 down)
|
||||
- **add_interface**. It is called when NIC is created
|
||||
- **remove_interface**. It is called when NIC is deleted
|
||||
- **config**. It is called when upper layer wants to change channel/frequency (like the scan operation)
|
||||
- **bss_info_changed**. It is called when upper layer believe some BSS parameters need to be changed (BSSID, TX power, beacon interval, etc)
|
||||
- **conf_tx**. It is called when upper layer needs to config/change some tx parameters (AIFS, CW_MIN, CW_MAX, TXOP, etc)
|
||||
- **prepare_multicast**.
|
||||
- **configure_filter**. It is called when upper layer wants to config/change the [frame filtering](https://www.kernel.org/doc/html/v4.9/80211/mac80211.html#frame-filtering) rule in FPGA.
|
||||
- **rfkill_poll**. It is called when upper layer wants to know the RF status (ON/OFF).
|
||||
- **get_tsf**. It is called when upper layer wants to get 64bit FPGA timer value (TSF - Timing synchronization function)
|
||||
- **set_tsf**. It is called when upper layer wants to set 64bit FPGA timer value
|
||||
- **reset_tsf**. It is called when upper layer wants to reset 64bit FPGA timer value
|
||||
- **set_rts_threshold**. It is called when upper layer wants to change the threshold (packet length) for turning on RTS mechanism
|
||||
- **testmode_cmd**. It is called when upper layer has test command for us. [sdrctl command](#sdrctl-command) message is handled by this function.
|
||||
|
||||
Above APIs are called actively by upper layer. When they are called, the driver (sdr.c) will do necessary job over SDR platform. If necessary the driver will call other component drivers (tx_intf_api/rx_intf_api/openofdm_tx_api/openofdm_rx_api/xpu_api) for helping.
|
||||
|
||||
For receiving packet from the air, FPGA will raise interrupt (if the frame filtering rule allows) to Linux, then the funcion openwifi_rx_interrupt() of openwifi driver (sdr.c) will be triggered. In that function, ieee80211_rx_irqsafe() API is used to give the packet to upper layer.
|
||||
|
||||
## sdrctl command
|
||||
|
||||
Besides the Linux native Wi-Fi control programs, such as ifconfig/iw/iwconfig/iwlist/wpa_supplicant/hostapd/etc, openwifi offers a user space tool sdrctl to access openwifi specific functionalities. sdrctl is implemented as nl80211 testmode command and communicates with openwifi driver (function openwifi_testmode_cmd in sdr.c) via Linux nl80211--cfg80211--mac80211 path
|
||||
|
||||
* **get and set a parameter**
|
||||
### get and set a parameter
|
||||
```
|
||||
sdrctl dev sdr0 get para_name
|
||||
sdrctl dev sdr0 set para_name value
|
||||
@ -23,7 +54,7 @@ slice_total1|tx slice 1 cycle length in us|for length 50ms, you set 49999
|
||||
slice_start1|tx slice 1 cycle start time in us|for start at 10ms, you set 10000
|
||||
slice_end1| tx slice 1 cycle end time in us|for end at 40ms, you set 39999
|
||||
|
||||
* **get and set a register of a module**
|
||||
### get and set a register of a module
|
||||
```
|
||||
sdrctl dev sdr0 get reg module_name reg_idx
|
||||
sdrctl dev sdr0 set reg module_name reg_idx reg_value
|
||||
@ -105,3 +136,10 @@ reg_idx|meaning|example
|
||||
31|openwifi MAC address high 32bit|check XPU_REG_MAC_ADDR_write in sdr.c to see how we set MAC address to FPGA when NIC start
|
||||
58|TSF runtime value low 32bit|read only
|
||||
59|TSF runtime value high 32bit|read only
|
||||
|
||||
## rx packet flow and filtering config
|
||||
|
||||
|
||||
|
||||
## tx packet flow and config
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user