ath9k网卡驱动相关

news/2025/3/22 12:15:40/

      因最近需要对ath9k的网卡驱动进行一些修改,但是网上资料比较少也比较零散,所以在这里整理一下并加上一些自己的理解,有助于自己的分析。

(1):ath_softc是硬件与MAC层进行交互的中间载体,很多有用的

网络参数都可以从ath_softc中得到,对于进一步的网卡驱动开发,收集网络数据等很有帮助。

       定义位置:drivers/net/wireless/ath/ath9k/ath9k.h 具体定义如下:

struct ath_softc {struct ieee80211_hw *hw;    //保存硬件信息struct device *dev;         //当前工作的设备u32 chan_bw;                // 信道带宽int chan_idx;               // 信道序号int chan_is_ht;             // 是否使用high_throughput模式 即绿野模式struct survey_info *cur_survey;struct survey_info survey[ATH9K_NUM_CHANNELS];struct tasklet_struct intr_tq;   struct tasklet_struct bcon_tasklet;   //结构体定义在 include <linux/interrupt.h>  用于中断管理struct ath_hw *sc_ah;                //hw的包装结构体void __iomem *mem;                   //内存区域int irq;spinlock_t sc_serial_rw;spinlock_t sc_pm_lock;spinlock_t sc_pcu_lock;             //进行数据读取,或者处理skb时需要的锁struct mutex mutex;struct work_struct paprd_work;struct work_struct hw_check_work;struct work_struct hw_reset_work;   //执行不同工作的工作队列 以后在代码中具体解释struct completion paprd_complete;unsigned int hw_busy_count;u32 intrstatus;u32 sc_flags; /* SC_OP_* */u16 ps_flags; /* PS_* */u16 curtxpow;bool ps_enabled;bool ps_idle;short nbcnvifs;short nvifs;unsigned long ps_usecount;struct ath_config config;struct ath_rx rx;struct ath_tx tx;struct ath_beacon beacon;struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];     //当前支持的带宽#ifdef CONFIG_MAC80211_LEDSconst char *led_default_trigger;struct list_head leds;
#endifstruct ath9k_hw_cal_data caldata;int last_rssi;#ifdef CONFIG_ATH9K_DEBUGFSstruct ath9k_debug debug;spinlock_t nodes_lock;struct list_head nodes; /* basically, stations */unsigned int tx_complete_poll_work_seen;
#endifstruct ath_beacon_config cur_beacon_conf;struct delayed_work tx_complete_work;struct delayed_work hw_pll_work;struct ath_btcoex btcoex;struct ath_mci_coex mci_coex;struct ath_descdma txsdma;struct ath_ant_comb ant_comb;u8 ant_tx, ant_rx;
};


(2): * struct ieee80211_hw - hardware information and state
 *
 * This structure contains the configuration and hardware
 * information for an 802.11 PHY.
 *
 * @wiphy: This points to the &struct wiphy allocated for this
 * 802.11 PHY. You must fill in the @perm_addr and @dev
 * members of this structure using SET_IEEE80211_DEV()
 * and SET_IEEE80211_PERM_ADDR(). Additionally, all supported
 * bands (with channels, bitrates) are registered here.
 *
 * @conf: &struct ieee80211_conf, device configuration, don't use.
 *
 * @priv: pointer to private area that was allocated for driver use
 * along with this structure.
 *
 * @flags: hardware flags, see &enum ieee80211_hw_flags.
 *
 * @extra_tx_headroom: headroom to reserve in each transmit skb
 * for use by the driver (e.g. for transmit headers.)
 *
 * @extra_beacon_tailroom: tailroom to reserve in each beacon tx skb.
 * Can be used by drivers to add extra IEs.
 *
 * @max_signal: Maximum value for signal (rssi) in RX information, used
 * only when @IEEE80211_HW_SIGNAL_UNSPEC or @IEEE80211_HW_SIGNAL_DB
 *
 * @max_listen_interval: max listen interval in units of beacon interval
 * that HW supports
 *
 * @queues: number of available hardware transmit queues for
 * data packets. WMM/QoS requires at least four, these
 * queues need to have configurable access parameters.
 *
 * @rate_control_algorithm: rate control algorithm for this hardware.
 * If unset (NULL), the default algorithm will be used. Must be
 * set before calling ieee80211_register_hw().
 *
 * @vif_data_size: size (in bytes) of the drv_priv data area
 * within &struct ieee80211_vif.
 * @sta_data_size: size (in bytes) of the drv_priv data area
 * within &struct ieee80211_sta.
 * @chanctx_data_size: size (in bytes) of the drv_priv data area
 * within &struct ieee80211_chanctx_conf.
 * @txq_data_size: size (in bytes) of the drv_priv data area
 * within @struct ieee80211_txq.
 *
 * @max_rates: maximum number of alternate rate retry stages the hw
 * can handle.
 * @max_report_rates: maximum number of alternate rate retry stages
 * the hw can report back.
 * @max_rate_tries: maximum number of tries for each stage
 *
 * @max_rx_aggregation_subframes: maximum buffer size (number of
 * sub-frames) to be used for A-MPDU block ack receiver
 * aggregation.
 * This is only relevant if the device has restrictions on the
 * number of subframes, if it relies on mac80211 to do reordering
 * it shouldn't be set.
 *
 * @max_tx_aggregation_subframes: maximum number of subframes in an
 * aggregate an HT driver will transmit, used by the peer as a
 * hint to size its reorder buffer.
 *
 * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
 * (if %IEEE80211_HW_QUEUE_CONTROL is set)
 *
 * @radiotap_mcs_details: lists which MCS information can the HW
 * reports, by default it is set to _MCS, _GI and _BW but doesn't
 * include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_* values, only
 * adding _BW is supported today.
 *
 * @radiotap_vht_details: lists which VHT MCS information the HW reports,
 * the default is _GI | _BANDWIDTH.
 * Use the %IEEE80211_RADIOTAP_VHT_KNOWN_* values.
 *
 * @netdev_features: netdev features to be set in each netdev created
 * from this HW. Note only HW checksum features are currently
 * compatible with mac80211. Other feature bits will be rejected.
 *
 * @uapsd_queues: This bitmap is included in (re)association frame to indicate
 * for each access category if it is uAPSD trigger-enabled and delivery-
 * enabled. Use IEEE80211_WMM_IE_STA_QOSINFO_AC_* to set this bitmap.
 * Each bit corresponds to different AC. Value '1' in specific bit means
 * that corresponding AC is both trigger- and delivery-enabled. '0' means
 * neither enabled.
 *
 * @uapsd_max_sp_len: maximum number of total buffered frames the WMM AP may
 * deliver to a WMM STA during any Service Period triggered by the WMM STA.
 * Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct values.
 *
 * @n_cipher_schemes: a size of an array of cipher schemes definitions.
 * @cipher_schemes: a pointer to an array of cipher scheme definitions
 * supported by HW.
 *
 * @txq_ac_max_pending: maximum number of frames per AC pending in all txq
 * entries for a vif.

*/

ieee80211_hw主要是硬件的信息和状态

struct ieee80211_hw {struct ieee80211_conf conf;struct wiphy *wiphy;const char *rate_control_algorithm;void *priv;u32 flags;unsigned int extra_tx_headroom;unsigned int extra_beacon_tailroom;int vif_data_size;int sta_data_size;int chanctx_data_size;int txq_data_size;u16 queues;u16 max_listen_interval;s8 max_signal;u8 max_rates;u8 max_report_rates;u8 max_rate_tries;u8 max_rx_aggregation_subframes;u8 max_tx_aggregation_subframes;u8 offchannel_tx_hw_queue;u8 radiotap_mcs_details;u16 radiotap_vht_details;netdev_features_t netdev_features;u8 uapsd_queues;u8 uapsd_max_sp_len;u8 n_cipher_schemes;const struct ieee80211_cipher_scheme *cipher_schemes;int txq_ac_max_pending;<pre name="code" class="cpp">}

 


http://www.ppmy.cn/news/591206.html

相关文章

IEEE 802现有标准

IEEE 802现有标准 IEEE 802.1 &#xff1a;局域网体系结构、寻址、网络互联和网络 IEEE 802.1A&#xff1a;概述和系统结构 IEEE 802.1B&#xff1a;网络管理和网络互连 IEEE 802.2 &#xff1a;逻辑链路控制子层&#xff08;LLC&#xff09;的定义。IEEE 802.3 &#xff1a;以…

k均值聚类算法考试例题_K-均值法计算示例(示例)

B到两个类的平均距离 类 B1 B2 AB 9 31 CDE 28 13 A到两个类的平均距离 B到两个类的平均距离 D到两个类的平均距离 E到两个类的平均距离 结论:所有像元不再重新分类 A B C D E AB 2 2 338 882 890 CDE 613 761 61 13 17 D 2 (D,CDE)=(30- 28 ) 2 +(10- 13 ) 2 = 13 D 2 (E,C…

802.1AS 延迟测量理解

协议&#xff1a;802.1AS-2020.pdf&#xff08;这个有多域的概念&#xff09; 802.1AS,2020版本的-网络基础文档类资源-CSDN下载 802.1AS的SystemIdentity理解_cao849861802的博客-CSDN博客 802.1AS的BMCA(最佳主时钟选举)理解_cao849861802的博客-CSDN博客 802.1AS 时钟同…

802.11ah

IEEE 802.11工作组正在定义称为802.11ah的新标准。该标准工作在不到1GHz的免许可频段&#xff0c;可提供长得多的传输距离&#xff0c;也可以用于大规模传感器网络&#xff0c;具有适合数百万物联网(IoT)或机器到机器(M2M)设备连接的低功耗特性。802.11ah以降低了时钟速率的802…

802.11协议总结

802.11协议 版本说明工作频段802.11原始标准2.4G&#xff08;2Mb/s&#xff09;802.11a新增物理层补充5G&#xff08;54Mb/s&#xff09;802.11b最普及的标准&#xff0c;称为Wi-Fi2.4G&#xff08;11Mb/s&#xff09;802.11c扩展MAC/LLC802.11d解决2.4G在某些国家不能使用问题…

华为k662c的虚拟服务器,华为k662c光猫怎么样? 华为K662c拆机技巧

听说宽带用户补50元&#xff0c;运营商就会送这台为什么K662c&#xff0c;而我在闲鱼却要花225元买来。听说K662c可以让千兆宽带测速超过千兆&#xff0c;只要手机支持160MHz。卖家说只开机试了&#xff0c;像全新的&#xff0c;包装齐全&#xff0c;像新的一样。 打开包装如下…

802.1标准

IEEE 802.1是一组协议的集合&#xff0c;如生成树协议、VLAN协议等。为了将各个协议区别开来&#xff0c;IEEE在制定某一个协议时&#xff0c;就在IEEE 802.1后面加上不同的小写字母&#xff0c;如IEEE 802.1a定义局域网体系结构&#xff1b;IEEE 802.1b定义网际互连&#xff0…

以太网和802.3

紫色代表一级目录 粉红代表二级目录 蓝色代表三级目录 红色代表关键字 橙色代表说明 以太网和802.3   同轴电缆以太网     最初的以太网是将许多计算机都连接到一根总线上。当初认为这样的连接方法既简单又可靠&#xff0c;因为总线上没有有源器件。      使用集线器…