Solomon Peachy | a910e4a | 2013-05-24 20:04:38 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Datapath interface for ST-Ericsson CW1200 mac80211 drivers |
| 3 | * |
| 4 | * Copyright (c) 2010, ST-Ericsson |
| 5 | * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
| 12 | #ifndef CW1200_TXRX_H |
| 13 | #define CW1200_TXRX_H |
| 14 | |
| 15 | #include <linux/list.h> |
| 16 | |
| 17 | /* extern */ struct ieee80211_hw; |
| 18 | /* extern */ struct sk_buff; |
| 19 | /* extern */ struct wsm_tx; |
| 20 | /* extern */ struct wsm_rx; |
| 21 | /* extern */ struct wsm_tx_confirm; |
| 22 | /* extern */ struct cw1200_txpriv; |
| 23 | |
| 24 | struct tx_policy { |
| 25 | union { |
| 26 | __le32 tbl[3]; |
| 27 | u8 raw[12]; |
| 28 | }; |
| 29 | u8 defined; |
| 30 | u8 usage_count; |
| 31 | u8 retry_count; |
| 32 | u8 uploaded; |
| 33 | }; |
| 34 | |
| 35 | struct tx_policy_cache_entry { |
| 36 | struct tx_policy policy; |
| 37 | struct list_head link; |
| 38 | }; |
| 39 | |
| 40 | #define TX_POLICY_CACHE_SIZE (8) |
| 41 | struct tx_policy_cache { |
| 42 | struct tx_policy_cache_entry cache[TX_POLICY_CACHE_SIZE]; |
| 43 | struct list_head used; |
| 44 | struct list_head free; |
| 45 | spinlock_t lock; /* Protect policy cache */ |
| 46 | }; |
| 47 | |
| 48 | /* ******************************************************************** */ |
| 49 | /* TX policy cache */ |
| 50 | /* Intention of TX policy cache is an overcomplicated WSM API. |
| 51 | * Device does not accept per-PDU tx retry sequence. |
| 52 | * It uses "tx retry policy id" instead, so driver code has to sync |
| 53 | * linux tx retry sequences with a retry policy table in the device. |
| 54 | */ |
| 55 | void tx_policy_init(struct cw1200_common *priv); |
| 56 | void tx_policy_upload_work(struct work_struct *work); |
| 57 | void tx_policy_clean(struct cw1200_common *priv); |
| 58 | |
| 59 | /* ******************************************************************** */ |
| 60 | /* TX implementation */ |
| 61 | |
| 62 | u32 cw1200_rate_mask_to_wsm(struct cw1200_common *priv, |
| 63 | u32 rates); |
| 64 | void cw1200_tx(struct ieee80211_hw *dev, |
| 65 | struct ieee80211_tx_control *control, |
| 66 | struct sk_buff *skb); |
| 67 | void cw1200_skb_dtor(struct cw1200_common *priv, |
| 68 | struct sk_buff *skb, |
| 69 | const struct cw1200_txpriv *txpriv); |
| 70 | |
| 71 | /* ******************************************************************** */ |
| 72 | /* WSM callbacks */ |
| 73 | |
| 74 | void cw1200_tx_confirm_cb(struct cw1200_common *priv, |
| 75 | int link_id, |
| 76 | struct wsm_tx_confirm *arg); |
| 77 | void cw1200_rx_cb(struct cw1200_common *priv, |
| 78 | struct wsm_rx *arg, |
| 79 | int link_id, |
| 80 | struct sk_buff **skb_p); |
| 81 | |
| 82 | /* ******************************************************************** */ |
| 83 | /* Timeout */ |
| 84 | |
| 85 | void cw1200_tx_timeout(struct work_struct *work); |
| 86 | |
| 87 | /* ******************************************************************** */ |
| 88 | /* Security */ |
| 89 | int cw1200_alloc_key(struct cw1200_common *priv); |
| 90 | void cw1200_free_key(struct cw1200_common *priv, int idx); |
| 91 | void cw1200_free_keys(struct cw1200_common *priv); |
| 92 | int cw1200_upload_keys(struct cw1200_common *priv); |
| 93 | |
| 94 | /* ******************************************************************** */ |
| 95 | /* Workaround for WFD test case 6.1.10 */ |
| 96 | void cw1200_link_id_reset(struct work_struct *work); |
| 97 | |
| 98 | #define CW1200_LINK_ID_GC_TIMEOUT ((unsigned long)(10 * HZ)) |
| 99 | |
| 100 | int cw1200_find_link_id(struct cw1200_common *priv, const u8 *mac); |
| 101 | int cw1200_alloc_link_id(struct cw1200_common *priv, const u8 *mac); |
| 102 | void cw1200_link_id_work(struct work_struct *work); |
| 103 | void cw1200_link_id_gc_work(struct work_struct *work); |
| 104 | |
| 105 | |
| 106 | #endif /* CW1200_TXRX_H */ |