diff options
Diffstat (limited to 'drivers/net/wireless/ath9k/core.h')
-rw-r--r-- | drivers/net/wireless/ath9k/core.h | 87 |
1 files changed, 65 insertions, 22 deletions
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h index 4ca2aed236e0..29251f8dabb0 100644 --- a/drivers/net/wireless/ath9k/core.h +++ b/drivers/net/wireless/ath9k/core.h | |||
@@ -18,7 +18,7 @@ | |||
18 | #define CORE_H | 18 | #define CORE_H |
19 | 19 | ||
20 | #include <linux/etherdevice.h> | 20 | #include <linux/etherdevice.h> |
21 | #include <linux/pci.h> | 21 | #include <linux/device.h> |
22 | #include <net/mac80211.h> | 22 | #include <net/mac80211.h> |
23 | #include <linux/leds.h> | 23 | #include <linux/leds.h> |
24 | #include <linux/rfkill.h> | 24 | #include <linux/rfkill.h> |
@@ -187,7 +187,6 @@ struct ath_config { | |||
187 | #define ATH_TXBUF_RESET(_bf) do { \ | 187 | #define ATH_TXBUF_RESET(_bf) do { \ |
188 | (_bf)->bf_status = 0; \ | 188 | (_bf)->bf_status = 0; \ |
189 | (_bf)->bf_lastbf = NULL; \ | 189 | (_bf)->bf_lastbf = NULL; \ |
190 | (_bf)->bf_lastfrm = NULL; \ | ||
191 | (_bf)->bf_next = NULL; \ | 190 | (_bf)->bf_next = NULL; \ |
192 | memset(&((_bf)->bf_state), 0, \ | 191 | memset(&((_bf)->bf_state), 0, \ |
193 | sizeof(struct ath_buf_state)); \ | 192 | sizeof(struct ath_buf_state)); \ |
@@ -245,10 +244,8 @@ struct ath_buf_state { | |||
245 | */ | 244 | */ |
246 | struct ath_buf { | 245 | struct ath_buf { |
247 | struct list_head list; | 246 | struct list_head list; |
248 | struct list_head *last; | ||
249 | struct ath_buf *bf_lastbf; /* last buf of this unit (a frame or | 247 | struct ath_buf *bf_lastbf; /* last buf of this unit (a frame or |
250 | an aggregate) */ | 248 | an aggregate) */ |
251 | struct ath_buf *bf_lastfrm; /* last buf of this frame */ | ||
252 | struct ath_buf *bf_next; /* next subframe in the aggregate */ | 249 | struct ath_buf *bf_next; /* next subframe in the aggregate */ |
253 | void *bf_mpdu; /* enclosing frame structure */ | 250 | void *bf_mpdu; /* enclosing frame structure */ |
254 | struct ath_desc *bf_desc; /* virtual addr of desc */ | 251 | struct ath_desc *bf_desc; /* virtual addr of desc */ |
@@ -261,13 +258,7 @@ struct ath_buf { | |||
261 | }; | 258 | }; |
262 | 259 | ||
263 | #define ATH_RXBUF_RESET(_bf) ((_bf)->bf_status = 0) | 260 | #define ATH_RXBUF_RESET(_bf) ((_bf)->bf_status = 0) |
264 | |||
265 | /* hw processing complete, desc processed by hal */ | ||
266 | #define ATH_BUFSTATUS_DONE 0x00000001 | ||
267 | /* hw processing complete, desc hold for hw */ | ||
268 | #define ATH_BUFSTATUS_STALE 0x00000002 | 261 | #define ATH_BUFSTATUS_STALE 0x00000002 |
269 | /* Rx-only: OS is done with this packet and it's ok to queued it to hw */ | ||
270 | #define ATH_BUFSTATUS_FREE 0x00000004 | ||
271 | 262 | ||
272 | /* DMA state for tx/rx descriptors */ | 263 | /* DMA state for tx/rx descriptors */ |
273 | 264 | ||
@@ -360,7 +351,6 @@ struct ath_txq { | |||
360 | u32 *axq_link; /* link ptr in last TX desc */ | 351 | u32 *axq_link; /* link ptr in last TX desc */ |
361 | struct list_head axq_q; /* transmit queue */ | 352 | struct list_head axq_q; /* transmit queue */ |
362 | spinlock_t axq_lock; | 353 | spinlock_t axq_lock; |
363 | unsigned long axq_lockflags; /* intr state when must cli */ | ||
364 | u32 axq_depth; /* queue depth */ | 354 | u32 axq_depth; /* queue depth */ |
365 | u8 axq_aggr_depth; /* aggregates queued */ | 355 | u8 axq_aggr_depth; /* aggregates queued */ |
366 | u32 axq_totalqueued; /* total ever queued */ | 356 | u32 axq_totalqueued; /* total ever queued */ |
@@ -485,28 +475,22 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush); | |||
485 | struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype); | 475 | struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype); |
486 | void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq); | 476 | void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq); |
487 | int ath_tx_setup(struct ath_softc *sc, int haltype); | 477 | int ath_tx_setup(struct ath_softc *sc, int haltype); |
488 | void ath_draintxq(struct ath_softc *sc, bool retry_tx); | 478 | void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx); |
489 | void ath_tx_draintxq(struct ath_softc *sc, | 479 | void ath_draintxq(struct ath_softc *sc, |
490 | struct ath_txq *txq, bool retry_tx); | 480 | struct ath_txq *txq, bool retry_tx); |
491 | void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an); | 481 | void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an); |
492 | void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an); | 482 | void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an); |
493 | void ath_tx_node_free(struct ath_softc *sc, struct ath_node *an); | ||
494 | void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq); | 483 | void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq); |
495 | int ath_tx_init(struct ath_softc *sc, int nbufs); | 484 | int ath_tx_init(struct ath_softc *sc, int nbufs); |
496 | int ath_tx_cleanup(struct ath_softc *sc); | 485 | int ath_tx_cleanup(struct ath_softc *sc); |
497 | int ath_tx_get_qnum(struct ath_softc *sc, int qtype, int haltype); | ||
498 | struct ath_txq *ath_test_get_txq(struct ath_softc *sc, struct sk_buff *skb); | 486 | struct ath_txq *ath_test_get_txq(struct ath_softc *sc, struct sk_buff *skb); |
499 | int ath_txq_update(struct ath_softc *sc, int qnum, | 487 | int ath_txq_update(struct ath_softc *sc, int qnum, |
500 | struct ath9k_tx_queue_info *q); | 488 | struct ath9k_tx_queue_info *q); |
501 | int ath_tx_start(struct ath_softc *sc, struct sk_buff *skb, | 489 | int ath_tx_start(struct ath_softc *sc, struct sk_buff *skb, |
502 | struct ath_tx_control *txctl); | 490 | struct ath_tx_control *txctl); |
503 | void ath_tx_tasklet(struct ath_softc *sc); | 491 | void ath_tx_tasklet(struct ath_softc *sc); |
504 | u32 ath_txq_depth(struct ath_softc *sc, int qnum); | ||
505 | u32 ath_txq_aggr_depth(struct ath_softc *sc, int qnum); | ||
506 | void ath_tx_cabq(struct ath_softc *sc, struct sk_buff *skb); | 492 | void ath_tx_cabq(struct ath_softc *sc, struct sk_buff *skb); |
507 | void ath_tx_resume_tid(struct ath_softc *sc, struct ath_atx_tid *tid); | ||
508 | bool ath_tx_aggr_check(struct ath_softc *sc, struct ath_node *an, u8 tidno); | 493 | bool ath_tx_aggr_check(struct ath_softc *sc, struct ath_node *an, u8 tidno); |
509 | void ath_tx_aggr_teardown(struct ath_softc *sc, struct ath_node *an, u8 tidno); | ||
510 | int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, | 494 | int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, |
511 | u16 tid, u16 *ssn); | 495 | u16 tid, u16 *ssn); |
512 | int ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); | 496 | int ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); |
@@ -692,14 +676,22 @@ enum PROT_MODE { | |||
692 | #define SC_OP_RFKILL_REGISTERED BIT(11) | 676 | #define SC_OP_RFKILL_REGISTERED BIT(11) |
693 | #define SC_OP_RFKILL_SW_BLOCKED BIT(12) | 677 | #define SC_OP_RFKILL_SW_BLOCKED BIT(12) |
694 | #define SC_OP_RFKILL_HW_BLOCKED BIT(13) | 678 | #define SC_OP_RFKILL_HW_BLOCKED BIT(13) |
679 | #define SC_OP_WAIT_FOR_BEACON BIT(14) | ||
680 | |||
681 | struct ath_bus_ops { | ||
682 | void (*read_cachesize)(struct ath_softc *sc, int *csz); | ||
683 | void (*cleanup)(struct ath_softc *sc); | ||
684 | bool (*eeprom_read)(struct ath_hal *ah, u32 off, u16 *data); | ||
685 | }; | ||
695 | 686 | ||
696 | struct ath_softc { | 687 | struct ath_softc { |
697 | struct ieee80211_hw *hw; | 688 | struct ieee80211_hw *hw; |
698 | struct pci_dev *pdev; | 689 | struct device *dev; |
699 | struct tasklet_struct intr_tq; | 690 | struct tasklet_struct intr_tq; |
700 | struct tasklet_struct bcon_tasklet; | 691 | struct tasklet_struct bcon_tasklet; |
701 | struct ath_hal *sc_ah; | 692 | struct ath_hal *sc_ah; |
702 | void __iomem *mem; | 693 | void __iomem *mem; |
694 | int irq; | ||
703 | spinlock_t sc_resetlock; | 695 | spinlock_t sc_resetlock; |
704 | struct mutex mutex; | 696 | struct mutex mutex; |
705 | 697 | ||
@@ -718,7 +710,7 @@ struct ath_softc { | |||
718 | u32 sc_keymax; | 710 | u32 sc_keymax; |
719 | DECLARE_BITMAP(sc_keymap, ATH_KEYMAX); | 711 | DECLARE_BITMAP(sc_keymap, ATH_KEYMAX); |
720 | u8 sc_splitmic; | 712 | u8 sc_splitmic; |
721 | u8 sc_protrix; | 713 | atomic_t ps_usecount; |
722 | enum ath9k_int sc_imask; | 714 | enum ath9k_int sc_imask; |
723 | enum PROT_MODE sc_protmode; | 715 | enum PROT_MODE sc_protmode; |
724 | enum ath9k_ht_extprotspacing sc_ht_extprotspacing; | 716 | enum ath9k_ht_extprotspacing sc_ht_extprotspacing; |
@@ -732,7 +724,6 @@ struct ath_softc { | |||
732 | struct ieee80211_rate rates[IEEE80211_NUM_BANDS][ATH_RATE_MAX]; | 724 | struct ieee80211_rate rates[IEEE80211_NUM_BANDS][ATH_RATE_MAX]; |
733 | struct ath_rate_table *hw_rate_table[ATH9K_MODE_MAX]; | 725 | struct ath_rate_table *hw_rate_table[ATH9K_MODE_MAX]; |
734 | struct ath_rate_table *cur_rate_table; | 726 | struct ath_rate_table *cur_rate_table; |
735 | struct ieee80211_channel channels[IEEE80211_NUM_BANDS][ATH_CHAN_MAX]; | ||
736 | struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS]; | 727 | struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS]; |
737 | struct ath_led radio_led; | 728 | struct ath_led radio_led; |
738 | struct ath_led assoc_led; | 729 | struct ath_led assoc_led; |
@@ -744,6 +735,7 @@ struct ath_softc { | |||
744 | #ifdef CONFIG_ATH9K_DEBUG | 735 | #ifdef CONFIG_ATH9K_DEBUG |
745 | struct ath9k_debug sc_debug; | 736 | struct ath9k_debug sc_debug; |
746 | #endif | 737 | #endif |
738 | struct ath_bus_ops *bus_ops; | ||
747 | }; | 739 | }; |
748 | 740 | ||
749 | int ath_reset(struct ath_softc *sc, bool retry_tx); | 741 | int ath_reset(struct ath_softc *sc, bool retry_tx); |
@@ -751,4 +743,55 @@ int ath_get_hal_qnum(u16 queue, struct ath_softc *sc); | |||
751 | int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc); | 743 | int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc); |
752 | int ath_cabq_update(struct ath_softc *); | 744 | int ath_cabq_update(struct ath_softc *); |
753 | 745 | ||
746 | static inline void ath_read_cachesize(struct ath_softc *sc, int *csz) | ||
747 | { | ||
748 | sc->bus_ops->read_cachesize(sc, csz); | ||
749 | } | ||
750 | |||
751 | static inline void ath_bus_cleanup(struct ath_softc *sc) | ||
752 | { | ||
753 | sc->bus_ops->cleanup(sc); | ||
754 | } | ||
755 | |||
756 | extern struct ieee80211_ops ath9k_ops; | ||
757 | |||
758 | irqreturn_t ath_isr(int irq, void *dev); | ||
759 | void ath_cleanup(struct ath_softc *sc); | ||
760 | int ath_attach(u16 devid, struct ath_softc *sc); | ||
761 | void ath_detach(struct ath_softc *sc); | ||
762 | const char *ath_mac_bb_name(u32 mac_bb_version); | ||
763 | const char *ath_rf_name(u16 rf_version); | ||
764 | |||
765 | #ifdef CONFIG_PCI | ||
766 | int ath_pci_init(void); | ||
767 | void ath_pci_exit(void); | ||
768 | #else | ||
769 | static inline int ath_pci_init(void) { return 0; }; | ||
770 | static inline void ath_pci_exit(void) {}; | ||
771 | #endif | ||
772 | |||
773 | #ifdef CONFIG_ATHEROS_AR71XX | ||
774 | int ath_ahb_init(void); | ||
775 | void ath_ahb_exit(void); | ||
776 | #else | ||
777 | static inline int ath_ahb_init(void) { return 0; }; | ||
778 | static inline void ath_ahb_exit(void) {}; | ||
779 | #endif | ||
780 | |||
781 | static inline void ath9k_ps_wakeup(struct ath_softc *sc) | ||
782 | { | ||
783 | if (atomic_inc_return(&sc->ps_usecount) == 1) | ||
784 | if (sc->sc_ah->ah_power_mode != ATH9K_PM_AWAKE) { | ||
785 | sc->sc_ah->ah_restore_mode = sc->sc_ah->ah_power_mode; | ||
786 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE); | ||
787 | } | ||
788 | } | ||
789 | |||
790 | static inline void ath9k_ps_restore(struct ath_softc *sc) | ||
791 | { | ||
792 | if (atomic_dec_and_test(&sc->ps_usecount)) | ||
793 | if (sc->hw->conf.flags & IEEE80211_CONF_PS) | ||
794 | ath9k_hw_setpower(sc->sc_ah, | ||
795 | sc->sc_ah->ah_restore_mode); | ||
796 | } | ||
754 | #endif /* CORE_H */ | 797 | #endif /* CORE_H */ |