关于 cfg80211
cfg80211是Linux 802.11配置API。 cfg80211用于取代Wireless-Extensions。 nl80211用来配置一个cfg80211设备,用于内核< - >用户空间之间的通信。 Wireless extensions 现在处于维护模式,将不会添加新的功到它上面,我们只修复bug。cfg80211现在与wireless-extensions是完全特性兼容的,它实际上有更多的功能,这些功能wireless extension根本是没有的,而且以后也不会有。当实现一个cfg80211驱动时,仍然会通过CONFIG_CFG80211_WEXT为你自动提供wireless extensions的支持,不再需要无线扩展的发行版可以删除它,我们也鼓励他们这样做。 cfg80211还提供了完整的regulatory支持,这是通过wireless-regdb 和CRDA的使用来实现的。
所有新的Linux无线驱动程序应该面向fullmac设备的cfg80211或softmac设备的mac80211编程。
cfg80211 驱动编程
我们现在有一些cfg80211驱动,一个完整的cfg80211驱动的很好的例子是Atheros ath6kl驱动程序。 取代之前的wext ioctls 编程,你现在通过设置cfg80211回调和wiphy结构体来告知cfg80211其设备信息。
下面是一个关于 ath6kl cfg80211_ops的例子:
static struct cfg80211_ops ath6kl_cfg80211_ops = {
.add_virtual_intf = ath6kl_cfg80211_add_iface,
.del_virtual_intf = ath6kl_cfg80211_del_iface,
.change_virtual_intf = ath6kl_cfg80211_change_iface,
.scan = ath6kl_cfg80211_scan,
.connect = ath6kl_cfg80211_connect,
.disconnect = ath6kl_cfg80211_disconnect,
.add_key = ath6kl_cfg80211_add_key,
.get_key = ath6kl_cfg80211_get_key,
.del_key = ath6kl_cfg80211_del_key,
.set_default_key = ath6kl_cfg80211_set_default_key,
.set_wiphy_params = ath6kl_cfg80211_set_wiphy_params,
.set_tx_power = ath6kl_cfg80211_set_txpower,
.get_tx_power = ath6kl_cfg80211_get_txpower,
.set_power_mgmt = ath6kl_cfg80211_set_power_mgmt,
.join_ibss = ath6kl_cfg80211_join_ibss,
.leave_ibss = ath6kl_cfg80211_leave_ibss,
.get_station = ath6kl_get_station,
.set_pmksa = ath6kl_set_pmksa,
.del_pmksa = ath6kl_del_pmksa,
.flush_pmksa = ath6kl_flush_pmksa,
CFG80211_TESTMODE_CMD(ath6kl_tm_cmd)
#ifdef CONFIG_PM
.suspend = __ath6kl_cfg80211_suspend,
.resume = __ath6kl_cfg80211_resume,
#endif
.start_ap = ath6kl_start_ap,
.change_beacon = ath6kl_change_beacon,
.stop_ap = ath6kl_stop_ap,
.del_station = ath6kl_del_station,
.change_station = ath6kl_change_station,
.remain_on_channel = ath6kl_remain_on_channel,
.cancel_remain_on_channel = ath6kl_cancel_remain_on_channel,
.mgmt_tx = ath6kl_mgmt_tx,
.mgmt_frame_register = ath6kl_mgmt_frame_register,
.sched_scan_start = ath6kl_cfg80211_sscan_start,
.sched_scan_stop = ath6kl_cfg80211_sscan_stop,
};
然后你通过指定cfg80211 ops分配wiphy并填写wiphy。
欲了解更多详情,请参阅cfg80211.h,作为一个驱动程序的示例,您可以阅读ath6kl。
Regulatory
Linux wireless regulatory 文档:
- Addressing vendor concerns
- Regulatory statement by developer on responsibility
- Linux wireless regulatory documentation
- Regulatory processing rule documentation
- CRDA documentation
其他文档
- Johannes Berg's presentation (out of date!)
cfg80211 文件和内核文档