Author: adrian
Date: Thu Jan 20 05:49:15 2011
New Revision: 217621
URL: http://svn.freebsd.org/changeset/base/217621

Log:
  Add a new HAL method to retrieve the completion schedule. It sets
  the completion schedule from the hardware and returns AH_TRUE if
  the hardware supports multi-rate retries (AR5212 and above); and
  returns AH_FALSE if the hardware doesn't support multi-rate retries.
  
  The sample rate module directly reads the TX completion descriptor
  and extracts the TX schedule information from that. It will be
  updated in a future commit to instead use this method to determine
  the completion schedule.

Modified:
  head/sys/dev/ath/ath_hal/ah.h
  head/sys/dev/ath/ath_hal/ar5210/ar5210.h
  head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
  head/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c
  head/sys/dev/ath/ath_hal/ar5211/ar5211.h
  head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c
  head/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c
  head/sys/dev/ath/ath_hal/ar5212/ar5212.h
  head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
  head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c

Modified: head/sys/dev/ath/ath_hal/ah.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.h       Thu Jan 20 05:44:36 2011        
(r217620)
+++ head/sys/dev/ath/ath_hal/ah.h       Thu Jan 20 05:49:15 2011        
(r217621)
@@ -680,6 +680,8 @@ struct ath_hal {
                                struct ath_desc *, struct ath_tx_status *);
        void       __ahdecl(*ah_getTxIntrQueue)(struct ath_hal *, uint32_t *);
        void       __ahdecl(*ah_reqTxIntrDesc)(struct ath_hal *, struct 
ath_desc*);
+       HAL_BOOL        __ahdecl(*ah_getTxCompletionRates)(struct ath_hal *,
+                               const struct ath_desc *ds, int *rates, int 
*tries);
 
        /* Receive Functions */
        uint32_t __ahdecl(*ah_getRxDP)(struct ath_hal*);

Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5210/ar5210.h    Thu Jan 20 05:44:36 2011        
(r217620)
+++ head/sys/dev/ath/ath_hal/ar5210/ar5210.h    Thu Jan 20 05:49:15 2011        
(r217621)
@@ -177,6 +177,8 @@ extern      HAL_STATUS ar5210ProcTxDesc(struc
                struct ath_desc *, struct ath_tx_status *);
 extern  void ar5210GetTxIntrQueue(struct ath_hal *ah, uint32_t *);
 extern  void ar5210IntrReqTxDesc(struct ath_hal *ah, struct ath_desc *);
+extern HAL_BOOL ar5210GetTxCompletionRates(struct ath_hal *ah,
+               const struct ath_desc *, int *rates, int *tries);
 
 extern uint32_t ar5210GetRxDP(struct ath_hal *);
 extern void ar5210SetRxDP(struct ath_hal *, uint32_t rxdp);

Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c     Thu Jan 20 05:44:36 
2011        (r217620)
+++ head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c     Thu Jan 20 05:49:15 
2011        (r217621)
@@ -73,6 +73,7 @@ static const struct ath_hal_private ar52
        .ah_procTxDesc                  = ar5210ProcTxDesc,
        .ah_getTxIntrQueue              = ar5210GetTxIntrQueue,
        .ah_reqTxIntrDesc               = ar5210IntrReqTxDesc,
+       .ah_getTxCompletionRates        = ar5210GetTxCompletionRates,
 
        /* RX Functions */
        .ah_getRxDP                     = ar5210GetRxDP,

Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c       Thu Jan 20 05:44:36 
2011        (r217620)
+++ head/sys/dev/ath/ath_hal/ar5210/ar5210_xmit.c       Thu Jan 20 05:49:15 
2011        (r217621)
@@ -621,3 +621,12 @@ ar5210GetTxIntrQueue(struct ath_hal *ah,
 {
        return;
 }
+
+/*
+ * Retrieve the rate table from the given TX completion descriptor
+ */
+HAL_BOOL
+ar5210GetTxCompletionRates(struct ath_hal *ah, const struct ath_desc *ds0, int 
*rates, int *tries)
+{
+       return AH_FALSE;
+}

Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5211/ar5211.h    Thu Jan 20 05:44:36 2011        
(r217620)
+++ head/sys/dev/ath/ath_hal/ar5211/ar5211.h    Thu Jan 20 05:49:15 2011        
(r217621)
@@ -202,6 +202,8 @@ extern      HAL_STATUS ar5211ProcTxDesc(struc
                struct ath_desc *, struct ath_tx_status *);
 extern  void ar5211GetTxIntrQueue(struct ath_hal *ah, uint32_t *);
 extern  void ar5211IntrReqTxDesc(struct ath_hal *ah, struct ath_desc *);
+extern HAL_BOOL ar5211GetTxCompletionRates(struct ath_hal *ah,
+               const struct ath_desc *ds0, int *rates, int *tries);
 
 extern uint32_t ar5211GetRxDP(struct ath_hal *);
 extern void ar5211SetRxDP(struct ath_hal *, uint32_t rxdp);

Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c     Thu Jan 20 05:44:36 
2011        (r217620)
+++ head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c     Thu Jan 20 05:49:15 
2011        (r217621)
@@ -73,6 +73,7 @@ static const struct ath_hal_private ar52
        .ah_procTxDesc                  = ar5211ProcTxDesc,
        .ah_getTxIntrQueue              = ar5211GetTxIntrQueue,
        .ah_reqTxIntrDesc               = ar5211IntrReqTxDesc,
+       .ah_getTxCompletionRates        = ar5211GetTxCompletionRates,
 
        /* RX Functions */
        .ah_getRxDP                     = ar5211GetRxDP,

Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c       Thu Jan 20 05:44:36 
2011        (r217620)
+++ head/sys/dev/ath/ath_hal/ar5211/ar5211_xmit.c       Thu Jan 20 05:49:15 
2011        (r217621)
@@ -660,3 +660,13 @@ ar5211GetTxIntrQueue(struct ath_hal *ah,
 {
        return;
 }
+
+/*
+ * Retrieve the rate table from the given TX completion descriptor
+ */
+HAL_BOOL
+ar5211GetTxCompletionRates(struct ath_hal *ah, const struct ath_desc *ds0, int 
*rates, int *tries)
+{
+       return AH_FALSE;
+}
+

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212.h    Thu Jan 20 05:44:36 2011        
(r217620)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h    Thu Jan 20 05:49:15 2011        
(r217621)
@@ -589,6 +589,8 @@ extern      HAL_STATUS ar5212ProcTxDesc(struc
                struct ath_desc *, struct ath_tx_status *);
 extern  void ar5212GetTxIntrQueue(struct ath_hal *ah, uint32_t *);
 extern  void ar5212IntrReqTxDesc(struct ath_hal *ah, struct ath_desc *);
+extern HAL_BOOL ar5212GetTxCompletionRates(struct ath_hal *ah,
+               const struct ath_desc *ds0, int *rates, int *tries);
 
 extern const HAL_RATE_TABLE *ar5212GetRateTable(struct ath_hal *, u_int mode);
 

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c     Thu Jan 20 05:44:36 
2011        (r217620)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c     Thu Jan 20 05:49:15 
2011        (r217621)
@@ -69,6 +69,7 @@ static const struct ath_hal_private ar52
        .ah_procTxDesc                  = ar5212ProcTxDesc,
        .ah_getTxIntrQueue              = ar5212GetTxIntrQueue,
        .ah_reqTxIntrDesc               = ar5212IntrReqTxDesc,
+       .ah_getTxCompletionRates        = ar5212GetTxCompletionRates,
 
        /* RX Functions */
        .ah_getRxDP                     = ar5212GetRxDP,

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c       Thu Jan 20 05:44:36 
2011        (r217620)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c       Thu Jan 20 05:49:15 
2011        (r217621)
@@ -918,3 +918,24 @@ ar5212GetTxIntrQueue(struct ath_hal *ah,
        *txqs &= ahp->ah_intrTxqs;
        ahp->ah_intrTxqs &= ~(*txqs);
 }
+
+/*
+ * Retrieve the rate table from the given TX completion descriptor
+ */
+HAL_BOOL
+ar5212GetTxCompletionRates(struct ath_hal *ah, const struct ath_desc *ds0, int 
*rates, int *tries)
+{ 
+       const struct ar5212_desc *ads = AR5212DESC_CONST(ds0);
+
+       rates[0] = MS(ads->ds_ctl3, AR_XmitRate0);
+       rates[1] = MS(ads->ds_ctl3, AR_XmitRate1);
+       rates[2] = MS(ads->ds_ctl3, AR_XmitRate2);
+       rates[3] = MS(ads->ds_ctl3, AR_XmitRate3);
+
+       tries[0] = MS(ads->ds_ctl2, AR_XmitDataTries0);
+       tries[1] = MS(ads->ds_ctl2, AR_XmitDataTries1);
+       tries[2] = MS(ads->ds_ctl2, AR_XmitDataTries2);
+       tries[3] = MS(ads->ds_ctl2, AR_XmitDataTries3);
+
+       return AH_TRUE;
+}  

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416.h    Thu Jan 20 05:44:36 2011        
(r217620)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h    Thu Jan 20 05:49:15 2011        
(r217621)
@@ -218,6 +218,8 @@ extern      HAL_BOOL ar5416FillTxDesc(struct 
                const struct ath_desc *ds0);
 extern HAL_STATUS ar5416ProcTxDesc(struct ath_hal *ah,
                struct ath_desc *, struct ath_tx_status *);
+extern HAL_BOOL ar5416GetTxCompletionRates(struct ath_hal *ah,
+               const struct ath_desc *ds0, int *rates, int *tries);
 
 extern const HAL_RATE_TABLE *ar5416GetRateTable(struct ath_hal *, u_int mode);
 #endif /* _ATH_AR5416_H_ */

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c     Thu Jan 20 05:44:36 
2011        (r217620)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c     Thu Jan 20 05:49:15 
2011        (r217621)
@@ -98,6 +98,7 @@ ar5416InitState(struct ath_hal_5416 *ahp
        ah->ah_setupXTxDesc             = ar5416SetupXTxDesc;
        ah->ah_fillTxDesc               = ar5416FillTxDesc;
        ah->ah_procTxDesc               = ar5416ProcTxDesc;
+       ah->ah_getTxCompletionRates     = ar5416GetTxCompletionRates;
 
        /* Receive Functions */
        ah->ah_startPcuReceive          = ar5416StartPcuReceive;

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c       Thu Jan 20 05:44:36 
2011        (r217620)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c       Thu Jan 20 05:49:15 
2011        (r217621)
@@ -693,3 +693,25 @@ ar5416Set11nBurstDuration(struct ath_hal
        ads->ds_ctl2 |= SM(burstDuration, AR_BurstDur);
 }
 #endif
+
+/*
+ * Retrieve the rate table from the given TX completion descriptor
+ */
+HAL_BOOL
+ar5416GetTxCompletionRates(struct ath_hal *ah, const struct ath_desc *ds0, int 
*rates, int *tries)
+{
+       const struct ar5416_desc *ads = AR5416DESC_CONST(ds0);
+
+       rates[0] = MS(ads->ds_ctl3, AR_XmitRate0);
+       rates[1] = MS(ads->ds_ctl3, AR_XmitRate1);
+       rates[2] = MS(ads->ds_ctl3, AR_XmitRate2);
+       rates[3] = MS(ads->ds_ctl3, AR_XmitRate3);
+
+       tries[0] = MS(ads->ds_ctl2, AR_XmitDataTries0);
+       tries[1] = MS(ads->ds_ctl2, AR_XmitDataTries1);
+       tries[2] = MS(ads->ds_ctl2, AR_XmitDataTries2);
+       tries[3] = MS(ads->ds_ctl2, AR_XmitDataTries3);
+
+       return AH_TRUE;
+}
+
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to