Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Datapath interface for ST-Ericsson CW1200 mac80211 drivers
0004  *
0005  * Copyright (c) 2010, ST-Ericsson
0006  * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
0007  */
0008 
0009 #ifndef CW1200_TXRX_H
0010 #define CW1200_TXRX_H
0011 
0012 #include <linux/list.h>
0013 
0014 /* extern */ struct ieee80211_hw;
0015 /* extern */ struct sk_buff;
0016 /* extern */ struct wsm_tx;
0017 /* extern */ struct wsm_rx;
0018 /* extern */ struct wsm_tx_confirm;
0019 /* extern */ struct cw1200_txpriv;
0020 
0021 struct tx_policy {
0022     union {
0023         __le32 tbl[3];
0024         u8 raw[12];
0025     };
0026     u8  defined;
0027     u8  usage_count;
0028     u8  retry_count;
0029     u8  uploaded;
0030 };
0031 
0032 struct tx_policy_cache_entry {
0033     struct tx_policy policy;
0034     struct list_head link;
0035 };
0036 
0037 #define TX_POLICY_CACHE_SIZE    (8)
0038 struct tx_policy_cache {
0039     struct tx_policy_cache_entry cache[TX_POLICY_CACHE_SIZE];
0040     struct list_head used;
0041     struct list_head free;
0042     spinlock_t lock; /* Protect policy cache */
0043 };
0044 
0045 /* ******************************************************************** */
0046 /* TX policy cache                          */
0047 /* Intention of TX policy cache is an overcomplicated WSM API.
0048  * Device does not accept per-PDU tx retry sequence.
0049  * It uses "tx retry policy id" instead, so driver code has to sync
0050  * linux tx retry sequences with a retry policy table in the device.
0051  */
0052 void tx_policy_init(struct cw1200_common *priv);
0053 void tx_policy_upload_work(struct work_struct *work);
0054 void tx_policy_clean(struct cw1200_common *priv);
0055 
0056 /* ******************************************************************** */
0057 /* TX implementation                            */
0058 
0059 u32 cw1200_rate_mask_to_wsm(struct cw1200_common *priv,
0060                    u32 rates);
0061 void cw1200_tx(struct ieee80211_hw *dev,
0062            struct ieee80211_tx_control *control,
0063            struct sk_buff *skb);
0064 void cw1200_skb_dtor(struct cw1200_common *priv,
0065              struct sk_buff *skb,
0066              const struct cw1200_txpriv *txpriv);
0067 
0068 /* ******************************************************************** */
0069 /* WSM callbacks                            */
0070 
0071 void cw1200_tx_confirm_cb(struct cw1200_common *priv,
0072               int link_id,
0073               struct wsm_tx_confirm *arg);
0074 void cw1200_rx_cb(struct cw1200_common *priv,
0075           struct wsm_rx *arg,
0076           int link_id,
0077           struct sk_buff **skb_p);
0078 
0079 /* ******************************************************************** */
0080 /* Timeout                              */
0081 
0082 void cw1200_tx_timeout(struct work_struct *work);
0083 
0084 /* ******************************************************************** */
0085 /* Security                             */
0086 int cw1200_alloc_key(struct cw1200_common *priv);
0087 void cw1200_free_key(struct cw1200_common *priv, int idx);
0088 void cw1200_free_keys(struct cw1200_common *priv);
0089 int cw1200_upload_keys(struct cw1200_common *priv);
0090 
0091 /* ******************************************************************** */
0092 /* Workaround for WFD test case 6.1.10                  */
0093 void cw1200_link_id_reset(struct work_struct *work);
0094 
0095 #define CW1200_LINK_ID_GC_TIMEOUT ((unsigned long)(10 * HZ))
0096 
0097 int cw1200_find_link_id(struct cw1200_common *priv, const u8 *mac);
0098 int cw1200_alloc_link_id(struct cw1200_common *priv, const u8 *mac);
0099 void cw1200_link_id_work(struct work_struct *work);
0100 void cw1200_link_id_gc_work(struct work_struct *work);
0101 
0102 
0103 #endif /* CW1200_TXRX_H */