ath9k NIC driver related

Source: Internet
Author: User
Tags bool mutex

Due to the recent need to ath9k network card driver to make some changes, but the online information is relatively small and fragmented, so here to tidy up and add some of their own understanding, to help their analysis.

(1): ATH_SOFTC is the hardware and Mac layer to interact with the intermediate carrier, a lot of useful

Network parameters can be obtained from the ATH_SOFTC, for the further development of network card driver, the collection of Web data, etc. is very helpful.

Define location: Drivers/net/wireless/ath/ath9k/ath9k.h specifically defined as follows:

struct ATH_SOFTC {struct IEEE80211_HW *hw;         Save hardware information struct device *dev;                The current working equipment u32 CHAN_BW;               Channel bandwidth int CHAN_IDX;             Channel ordinal int chan_is_ht;
    Whether to use High_throughput mode is the green mode struct Survey_info *cur_survey;

    struct Survey_info survey[ath9k_num_channels];   
    struct Tasklet_struct intr_tq;   struct Tasklet_struct bcon_tasklet;                Structure definition in include <linux/interrupt.h> for interrupt management struct ATH_HW *sc_ah;                   HW Packaging structural body void __iomem *mem;
    memory area int IRQ;
    spinlock_t SC_SERIAL_RW;
    spinlock_t Sc_pm_lock;             spinlock_t Sc_pcu_lock;
    The lock struct mutex mutex required for data reading, or for processing SKB;
    struct Work_struct paprd_work;
    struct Work_struct hw_check_work;   struct Work_struct hw_reset_work;

    The work queue that performs the different work will explain the struct completion Paprd_complete in the code later.

    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];
    The bandwidth currently supported #ifdef config_mac80211_leds const char *led_default_trigger;
struct List_head LEDs;
    #endif struct Ath9k_hw_cal_data caldata;

int Last_rssi;
    #ifdef CONFIG_ATH9K_DEBUGFS struct Ath9k_debug debug;
    spinlock_t Nodes_lock; struct List_head nodes;
/* Basically, stations */unsigned int tx_complete_poll_work_seen;
    #endif struct 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) is registered here.
*
* @conf: &struct ieee80211_conf, device configuration, don ' t use.
*
* @priv: Pointer to private area the is allocated for driver use
* Along with this structure.
*
* @flags: Hardware flags, see &enum ieee80211_hw_flags.
*
* @extra_tx_headroom: Headroom to transmit SKB
* For use by the driver (e.g. transmit headers.)
*
* @extra_beacon_tailroom: Tailroom to reserve on each beacon TX skb.
* Can is 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, these
* Queues need to has configurable access parameters.
*
* @rate_control_algorithm: Rate control algorithm for this hardware.
* If unset (NULL), the default algorithm would 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 being used for A-MPDU block ACK receiver
* Aggregation.
* This was only relevant if the device had 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 would transmit, used by the peer as a
* Hint to size it 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 was 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 BES set in each Netdev created
* from the This HW. Note only HW checksum features is currently
* Compatible with mac80211. Other feature bits would be rejected.
*
* @uapsd_queues: This bitmap was included in (re) association frame to indicate
* For each access category if it is UAPSD trigger-enabled and delivery-
* Enabled. Use the ieee80211_wmm_ie_sta_qosinfo_ac_* to set this bitmap.
* Each bit corresponds to different AC. Value ' 1 ' in specific bit means
* That's corresponding AC is both Trigger-and delivery-enabled. ' 0 ' means
* Neither enabled.
*
* @uapsd_max_sp_len: Maximum number of total buffered frames the WMM APS 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 is primarily hardware information and status

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";}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.