Dear all, I am trying to obtain in ath5k the duration of a transmitted frame over the air, and also what I call the "access delay" duration, which I define as the time since this frame is the first one in the transmission buffer (HOL) until the time ath5k puts the first bit of this frame on the air (so basically it is the time that ath5k spends doing backoff for this frame).
This is the way I am trying to obtain the previous measurements, and I would appreciate if someone could let me know whether I am doing anything wrong: 1) I have added three new members in ath5k_buf: struct ath5k_buf { ... u64tsf_buf_allocation; /* We store the time that the buffer containing a certain frame is allocated, for ASPP to compute the access delay of this frame */ int frame_tx_duration; /* This variable contains the estimated time in the air that is going to take to transmit this frame (TODO: Address retries) */ bool buffer_was_empty; /* This variable indicates if the TX buffer was empty when this frame was inserted */ }; 2) These three values are updated before the frame is going to be transmitted in the functions "ath5k_tx_queue" and "ath5k_txbuf_setup" in base.c: int ath5k_tx_queue( ...{ ... bf->tsf_buf_allocation = ath5k_hw_get_tsf64(sc->ah); } static int ath5k_txbuf_setup( ... ) { ... frame_len = (int) pktlen - padsize + FCS_LEN; bf->frame_tx_duration = ath5k_hw_get_frame_duration(sc->ah, frame_len, rate); //Update variable bf->buffer_was_empty depending on the number of frames in txq } Now, my understanding is that "bf->frame_tx_duration" contains the duration of the frame over the air. I know that probably this is not 100% correct, since I am not counting the duration of the ACK, and if the frame gets retransmitted, the re-transmissions may have a different PHY rate screwing up that value. 3) When the HW completes the transmission of a frame, issues an interruption like AR5K_INT_TXOK or AR5K_INT_TXERR that ends up being treated by the function "ath5k_tx_processq". My assumption is that this function is called when the frame has been completely transmitted, since only then can the HW report whether there was a failure or not. Therefore, I estimate the access_delay of this frame in the following way: static void ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq) { ... current_tsf = ath5k_hw_get_tsf64(sc->ah); if(bf->buffer_was_empty){ //This frame saw no queueing delay, therefore we count the time it was inserted in the TX buffer total_frame_delay = current_tsf - bf->tsf_buf_allocation; } else{ //This frame saw queuing delay, therefore we count the last transmission as the beginning of its access delay total_frame_delay = current_tsf - sc->last_tx_time; } sc->last_tx_time = current_tsf; //Now we should be able to compute the access_delay out of the total delay in the following way: access_delay = total_frame_delay - bf->tsf_buf_allocation; ... } If my understanding would be correct, then "access_delay" would always be >=0, but I find that sometimes it is not! This can only mean that either the HW is reporting the TX interruption before the frame has completed its transmission, or that the estimated duration in "bf->frame_tx_duration" is wrong. Any help is appreciated. Best Regards Daniel _______________________________________________ ath5k-devel mailing list ath5k-devel@lists.ath5k.org https://lists.ath5k.org/mailman/listinfo/ath5k-devel