所需积分/C币:49 2019-11-17 00:13:57 721KB PDF
收藏 收藏 1

1. Transmission Path: kernel)mac80211ath9k Kernel hands the packet to the virtual interface struct ieee80211 local This struct contains information about the real hardware, and is created when the interface is first added ieee80211_ subif start_xmit(tx c): (ieee80211- register_ hw( in main.c -Adds the 802.11 header This data structure is created from the structure -Initializes transmission time in dev trans start ieee80211 hw in mac80211. h this data structure probably allows the hardware driver to register with mac80211 the proper function to be called by drv tx( The driver and mac80211 communicate through this ieee80211 xmit(tx. c): structure -Makes headroom for encryption ieee80211_ set qos header(wme. c) Sets TID in Wi-Fi header according to skb→ priority ieee80211 tx(tx. c): skb get queue_ mapping(? c): Obtains the proper transmission queue. Prepares transmission -lf the packet can not be transmitted, it is ieee80211_tx_prepare (fx.c) queued- timestamp queue entry. Queues are maintained per sub-interface, in invoke tx handlers(tx. c): the structure gdata[4] in -In an ap checks if the data has to be to be ieee80211sub讦 f data buffered Calls drv tx( to pass the frame to the actual Many other stuff driver for transmission struct adata(ieee80211_i h) drv_ tx((driver-ops. h): -enqueued .This is the entry point to the actual driver -max enqueued -It is called for each packet to be transmitted ewma serv ns avg(cah this be useful? -Receives struct ieee80211 local Receives the sk buff (the data) 1a. Transmission Path; ath9k hardware - The ath9k driver registers the functions to interface with mac80211 in struct drv tx( in mac80211 ieee80211 ops ath9k_ ops. The input of this struct is then loaded in mac80211 using the function ieee80211_alloc hw( in main. c of mac80211. The function interfacing with drv_txl is ath9k_tx( -The common data also contains other info like the number of hw queues ath9k txo(main. c): -Loads details of the hardware in struct ath9k ps wakeup()(xc) ath soft -Updates the Pm bit (not set by mac80211 struct ath soft (ath9k. h) struct ath tx ath9k. h): -Wakes up hardware if it was sleeping struct ieee80211 hw *hw: struct ath txq txqlATH9K_ NUM TX QUeUES] -Uses data struct ath tx control to track the struct device *dev: struct ath txq ' txq map[wME NUM_AC]: status of the transmission starts transmission in ath tx start bool ps enabled Contains the hw transmission queues, Ath 9k has 10 hw tx queues struct ath config config struct ath rx -points to the mac80211 tx queues ath tx start(xmit. c): struct ath tx -Receives a pointer to an struct struct ath beacon beacon ath_tx control containing a pointer to the struct ath_ txq(ath9k h queue that contains the frame? Contains the equivalent mac80211 queue -lf the destination is HT capable tries -Contains the hw queue number aggregation. wdocin.d -Actual queue ath_tx send ampul(xmit. c): ath tx send normal((xmit. c) -Receives as argument a txq Selects the data rate Adds the data to be transmitted in the txq ath_tx_ txqaddbu ath tx txqaddbuf((xmit. c) -Receives as parameter a txq then inserts the frame into the outbound ath9k hw txstart((mac. c) list, and sends it out to the hardware The hardware physical queues Writes the proper register in the hardware to trigger the transmission seem to support only 8 frames In a given queue. -lf the packet can not be inserted in the physical queue then it is held -The hardware is the one performing the CSMA-Ca according to the here configured parameters on that queue 16. Transmission Path; ath5k hardware - The ath 5k driver registers the functions to interface with mac80211 in struct drv tx( in mac80211 ieee80211_ ops ath5k_ hw ops in mac80211-ops c The input of this struct is then loaded in mac80211 using the function ieee80211- alloc hw() in main. c of mac80211 The function interfacing with drv_txo is ath sk_tx()in mac80211-opsc ath5k_ tx() in mac80211-opsc ath5k_ tasklet txo in base. c Receives the skb to be transmitted -Tasklet that is called when the following interrupts -finds the appropriate hw queue for that skb happen: ARSK_ INT_ TXOK, ARSK INT_ TXDESC ARSK INT TXERR, ARSK INT TXEOL ath5k tx queue 0 in base. c -lf the queue is already at its maximum size(max is 50 pkts)it ath5k tx_ process( in base. c sends a signal back to mac80211 so that this stops his queues (ieee80211 stop queue). It also may drop the packet -Copies the data to be transmitted in the txqueues struct ath5k_tx frame completed in base. c ath5k buf represents a single queued frame(buffer). ieee80211_ stop queue( in Check a timestamp here leee80211 tx_ status( in mac80211 ath5k txbuf setup in base. c ah setup tx desc() in desc. c Obtains data rate for this transmission -prepare for transmission ath5k hw setup mrr tx desco in desc. c ath5k hw start_tx dma()in dma. c Starts a transmission in the hw -My understanding is that the hw may already be trying to transmit other frames that were previously submitted ARSK REG_ WRITE Q0 in dma.c -Writes a certain register in the hw, so that the transmission on a certain queue starts 1a. Reception Path: hardware>ath9k When receiving a packet, and also for other reasons, the truct ieee80211 hdr (include/linux/ieee80211. h) hardware sends an interruption that ath9k has previously registered. The function in charge of handling the interruption seems to be irgreturn t ath isr in main. c this struct ieee80211_rx_ status(mac80211.h) function discovers the type of interruption and asks the u64 mactime: value in microseconds of the kernel to schedule the execution of a tasklet, 64-bit Time Synchronization Function(TSF ath9k tasklet in main. c. This function in turn calls thethe timer when the first data symbol (MPDU) receive tasklet ath rx taskletO) arrived at the hardware struct ath rx status(mac. h) enum ieee80211 band band u32 rs tstamp; This is given by the int rate idx: hardware and eventually carried on to unsigned int rx flags;… mactime in ieee80211 rx status 16 rs datalen u8 rs status; u8 rs payer athrx tasklet (recv.c) int8 t rs rssi; ath9k_rx skb_preprocess(recv.c) -obtains the frame header -Checks if the received data has CRc errors u8 rs keyi; u8 rs rate: -Obtains the current tsf value and in that case drops it. However, crypto u8 rs antenna; -Records info about received packet in struct errors are still passed up to mac80211 ieee80211 rx status Populates ath rx status -Insert received data in the receive buffer -Creates a new skb to contain the received data -passes the skb to ieee80211_ rx0 ath9k_ rx skb postprocess(recv. c) - Can we compute the airtime duration of the received Remove padding from the received header frame in this function, as airtime tsf-rxs->mactime"? ieee80211_rx((mac80211 rx. c) -this is the entry point to mac80211 1b. Reception Path: hardware >ath5k ath5k tasklet rx in base. c ath5k receive frame ok in base. c -Receives the interruption that a new frame has been received ath5k receive frame in base. c rxs->mactime contains the time the first bit was received in the air ieee80211_ rx((mac80211 rx.c) This is the entry point to mac80211 1. Reception Path: mac80211>kernel ieee80211_parse_qos()(xc) ieee80211_ rx()(mac80211 rx.c -Removes the radiotap header Parses QoS from header. Decides if this packet is addressed to this interface or to another sta in the bss struct ieee80211_rx data (ieee80211 ih) -Calls ieee80211 prepare and_rx handle( struct sk buff "skb struct ieee80211 local *local struct ieee80211 sub if data *sdata ieee80211_prepare_and_rx handle) struct sta into sta: -Receives as input an ieee80211_rx_data struct ieee80211 key*key: -Calls the rx handlers int queue…, struct sta info(sta info. h) ieee80211_rx h_ sta_ process()(rx.c) -Info about this station like: ieee80211 rx handlers(rx. c) Updates the sta info struct that contains -TX and RX statistics -Among other calls the following functions: information about this station pS buffers if we are an ap ieee80211 rx h decrypt ieee80211 rx h check more data struct ieee80211_sta sta; ieee80211 rx h sta_ process ieee80211 rx h data ieee80211_rx_ h data()(rx.c) ieee80211 rx h ctrl Removes the 802.11 header and passes up the 802.3 frame ieee80211_deliver skb((rx. c) netif_ receive skb((x c) Receives a frame with an Ethernet header Delivers the skb to the local stack( kernel) Decides if the frame has to go up to the stack, or must be reflected back to the wireless medium (if we are an AP dev queue xmit(x c) -Resends the skb to the wireless medium 1. Beacon Tx path from ath 9k to mac80211 ath beacon generate(beacon. c): Gets a new beacon from mac80211, ieee80211 beacon get The hardware seems to be in charge of generating Beacon Sets the proper timestamp and Sn in the Beacon interruption when the proper time comes, and then there this function seems a good candiate to modify a noA is a beacon tasklet defined to handle that interruption element in the Beacon! ath beacon tasklet -Updates TIM and DTIM, using ieee80211get_ buffered bc -Prepares transmission, ath beacon_ setup ath beacon tasklet beacon c): ath beacon setup( beacon. c) -f the previous beacon is not out, do nothing -Sets up the proper rate to use with the beacon Seems to implement on some beacon time scheduling to avoid Beaconing at the same time that other BSss Generates the beacon with ath beacon generate -Inserts the Beacon in the hardware beacon queue ieee80211 beacon get(mac80211 h in include/: Wrapper for ieee80211 beacon get_ timo) ath9k hw txstart(mac. c) Writes a register to start the transmission in the hardware dr ieee80211 beacon get tim(tx. c) Generates the beacon The actual beacon is contained within an structure called struct ieee80211 if ap associated to the interface (struct ieee80211 sub if data -Adds the tim with ieee80211 beacon add tim struct beacon parameters (/include/ net/cfg80211 h) u8*head. *tail: ieee80211_add beacon(mac80211 cfg. c): int interval, dtim_period - This function is called from the configuration interface int head len, tail len: cfg80211 or wext Contains pointers to the static parts before and after the -Calls ieee80211 config beacon that configures the beacon TIM based on given parameters But where is the Beacon actually constructed This is done by hostapd, next 1. Beacon set up: hostapd/wpa supplicant hostpad creates all the static template of the beacon frame(i.e SSID, supported rates and then passes it down to mac80211 The low level driver(ath9k is the one in control of the dyNAmIc parts of the beacon (SNS, Timestamp, TIM) hostapd eid p2p manage(p2p hostapd. c) ieee802_ 11 set_ beacon(beacon. c) - This function builds the p2P ie that goes in the Beacon This function allocates all the les in the HEAd and tAil parts of the beacon -Right now the function only adds the p2P Manageability element within which then will be used by mac80211 to construct the Beacon and pass t the p2P lE down to the driver we need to modify this function to also add a Notice of Absence -In P2P mode hostapd adds to the beacon a p2P le and calls the function Element in the Beacon with one NoA Descriptor. hostapd eid p2p manage -Then in ath beacon generate( from ath9k we have to be able to access the memory allocated to the noa element and overwrite it with the duration/interval values computed by our algorithm. When including the NoA element in the Beacon, we should reuse the definition already provided by hostap Note that the current p2P implementation can already send a p2p Presence Request frame which contains NoA descriptors struct p2p_ noa_ desc(p2p_ i h p2p_ build_presence req(hostap/src/p2p. c) u8 count type -Build a presence request which is an Action frame that u32 duration: includes a NoA le u32 interval u32 start time p2p_add_noa(hostap/src/p2p_ build. c) Adds an NoA element to a struct wpa buf

试读 11P mac80211_intro.pdf
立即下载 低至0.43元/次 身份认证VIP会员低至7折
    • 领英

    • GitHub

    • 签到新秀

    • 分享王者

    关注 私信 TA的资源
    mac80211_intro.pdf 49积分/C币 立即下载


    49积分/C币 立即下载 >