diff options
author | John W. Linville <linville@tuxdriver.com> | 2011-03-07 16:32:59 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-03-11 15:34:18 -0500 |
commit | 81266baf04ce80b088a7fa0dcf3b9f5e79023dd2 (patch) | |
tree | 2a5767181cf0b69726cd9b45ff6c5248f878fd79 /drivers/net/wireless | |
parent | 38c091590f6ed78fcaf114c14ce133e5b3f717e6 (diff) |
ath5k: implement ieee80211_ops->{get,set}_ringparam
set_ringparam only allows changes to tx ring at this time.
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/base.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/base.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/mac80211-ops.c | 43 |
3 files changed, 46 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index e6ff62e60a79..4d7f21ee111c 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -943,6 +943,7 @@ ath5k_txq_setup(struct ath5k_softc *sc, | |||
943 | spin_lock_init(&txq->lock); | 943 | spin_lock_init(&txq->lock); |
944 | txq->setup = true; | 944 | txq->setup = true; |
945 | txq->txq_len = 0; | 945 | txq->txq_len = 0; |
946 | txq->txq_max = ATH5K_TXQ_LEN_MAX; | ||
946 | txq->txq_poll_mark = false; | 947 | txq->txq_poll_mark = false; |
947 | txq->txq_stuck = 0; | 948 | txq->txq_stuck = 0; |
948 | } | 949 | } |
@@ -1534,7 +1535,7 @@ ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
1534 | goto drop_packet; | 1535 | goto drop_packet; |
1535 | } | 1536 | } |
1536 | 1537 | ||
1537 | if (txq->txq_len >= ATH5K_TXQ_LEN_MAX) | 1538 | if (txq->txq_len >= txq->txq_max) |
1538 | ieee80211_stop_queue(hw, txq->qnum); | 1539 | ieee80211_stop_queue(hw, txq->qnum); |
1539 | 1540 | ||
1540 | spin_lock_irqsave(&sc->txbuflock, flags); | 1541 | spin_lock_irqsave(&sc->txbuflock, flags); |
diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h index 8d1df1fa2351..978f1f4ac2f3 100644 --- a/drivers/net/wireless/ath/ath5k/base.h +++ b/drivers/net/wireless/ath/ath5k/base.h | |||
@@ -86,6 +86,7 @@ struct ath5k_txq { | |||
86 | spinlock_t lock; /* lock on q and link */ | 86 | spinlock_t lock; /* lock on q and link */ |
87 | bool setup; | 87 | bool setup; |
88 | int txq_len; /* number of queued buffers */ | 88 | int txq_len; /* number of queued buffers */ |
89 | int txq_max; /* max allowed num of queued buffers */ | ||
89 | bool txq_poll_mark; | 90 | bool txq_poll_mark; |
90 | unsigned int txq_stuck; /* informational counter */ | 91 | unsigned int txq_stuck; /* informational counter */ |
91 | }; | 92 | }; |
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c index c9b0b676adda..9be29b728b1c 100644 --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c +++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c | |||
@@ -740,6 +740,47 @@ ath5k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) | |||
740 | } | 740 | } |
741 | 741 | ||
742 | 742 | ||
743 | static void ath5k_get_ringparam(struct ieee80211_hw *hw, | ||
744 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) | ||
745 | { | ||
746 | struct ath5k_softc *sc = hw->priv; | ||
747 | |||
748 | *tx = sc->txqs[AR5K_TX_QUEUE_ID_DATA_MIN].txq_max; | ||
749 | |||
750 | *tx_max = ATH5K_TXQ_LEN_MAX; | ||
751 | *rx = *rx_max = ATH_RXBUF; | ||
752 | } | ||
753 | |||
754 | |||
755 | static int ath5k_set_ringparam(struct ieee80211_hw *hw, u32 tx, u32 rx) | ||
756 | { | ||
757 | struct ath5k_softc *sc = hw->priv; | ||
758 | u16 qnum; | ||
759 | |||
760 | /* only support setting tx ring size for now */ | ||
761 | if (rx != ATH_RXBUF) | ||
762 | return -EINVAL; | ||
763 | |||
764 | /* restrict tx ring size min/max */ | ||
765 | if (!tx || tx > ATH5K_TXQ_LEN_MAX) | ||
766 | return -EINVAL; | ||
767 | |||
768 | for (qnum = 0; qnum < ARRAY_SIZE(sc->txqs); qnum++) { | ||
769 | if (!sc->txqs[qnum].setup) | ||
770 | continue; | ||
771 | if (sc->txqs[qnum].qnum < AR5K_TX_QUEUE_ID_DATA_MIN || | ||
772 | sc->txqs[qnum].qnum > AR5K_TX_QUEUE_ID_DATA_MAX) | ||
773 | continue; | ||
774 | |||
775 | sc->txqs[qnum].txq_max = tx; | ||
776 | if (sc->txqs[qnum].txq_len >= sc->txqs[qnum].txq_max) | ||
777 | ieee80211_stop_queue(hw, sc->txqs[qnum].qnum); | ||
778 | } | ||
779 | |||
780 | return 0; | ||
781 | } | ||
782 | |||
783 | |||
743 | const struct ieee80211_ops ath5k_hw_ops = { | 784 | const struct ieee80211_ops ath5k_hw_ops = { |
744 | .tx = ath5k_tx, | 785 | .tx = ath5k_tx, |
745 | .start = ath5k_start, | 786 | .start = ath5k_start, |
@@ -778,4 +819,6 @@ const struct ieee80211_ops ath5k_hw_ops = { | |||
778 | /* .napi_poll = not implemented */ | 819 | /* .napi_poll = not implemented */ |
779 | .set_antenna = ath5k_set_antenna, | 820 | .set_antenna = ath5k_set_antenna, |
780 | .get_antenna = ath5k_get_antenna, | 821 | .get_antenna = ath5k_get_antenna, |
822 | .set_ringparam = ath5k_set_ringparam, | ||
823 | .get_ringparam = ath5k_get_ringparam, | ||
781 | }; | 824 | }; |