On 08/09/17 13:27, Richard Cochran wrote:
Last time I looked, I didn't see any way to get a useful Tx time
stamp, due to aggregation and the opaque firmware blobs in the radio
chips.

But if you see a way in the ath9k, then by all means do it.
Otherwise, just use NTP over wireless.

Well, I must admit that I do not actually know much at all about wireless drivers, but after a few hours of poking around I wonder if generating the timestamp (immediately) after transmission might work, as this is likely to be consistent with regard to latency.

This idea is completely untested, and I realise that it does not handle advertising the capability, but I'm just casting around for ideas at the moment.

diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 4e2f3ac..116e8c4 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -2427,32 +2427,33 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
                            int tx_flags, struct ath_txq *txq,
                            struct ieee80211_sta *sta)
 {
        struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
        struct ath_common *common = ath9k_hw_common(sc->sc_ah);
        struct ieee80211_hdr * hdr = (struct ieee80211_hdr *)skb->data;
        int padpos, padsize;
        unsigned long flags;

        ath_dbg(common, XMIT, "TX complete: skb: %p\n", skb);

        if (sc->sc_ah->caldata)
                set_bit(PAPRD_PACKET_SENT, &sc->sc_ah->caldata->cal_flags);

        if (!(tx_flags & ATH_TX_ERROR)) {
+ skb_tx_timestamp(skb); /* report TX timestamp if requested */
                if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK)
tx_info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
                else
                        tx_info->flags |= IEEE80211_TX_STAT_ACK;
        }

        if (tx_info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) {
                padpos = ieee80211_hdrlen(hdr->frame_control);
                padsize = padpos & 3;
                if (padsize && skb->len>padpos+padsize) {
                        /*
* Remove MAC header padding before giving the frame back to
                         * mac80211.
                         */
                        memmove(skb->data + padsize, skb->data, padpos);
                        skb_pull(skb, padsize);


Alan.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to