linux/drivers/staging/rtl8712/sta_info.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2/******************************************************************************
   3 *
   4 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
   5 *
   6 * Modifications for inclusion into the Linux staging tree are
   7 * Copyright(c) 2010 Larry Finger. All rights reserved.
   8 *
   9 * Contact information:
  10 * WLAN FAE <wlanfae@realtek.com>
  11 * Larry Finger <Larry.Finger@lwfinger.net>
  12 *
  13 ******************************************************************************/
  14#ifndef __STA_INFO_H_
  15#define __STA_INFO_H_
  16
  17#include "osdep_service.h"
  18#include "drv_types.h"
  19#include "wifi.h"
  20
  21#define NUM_STA 32
  22#define NUM_ACL 64
  23
  24
  25/* if mode ==0, then the sta is allowed once the addr is hit.
  26 * if mode ==1, then the sta is rejected once the addr is non-hit.
  27 */
  28struct wlan_acl_node {
  29        struct list_head list;
  30        u8       addr[ETH_ALEN];
  31        u8       mode;
  32};
  33
  34struct wlan_acl_pool {
  35        struct wlan_acl_node aclnode[NUM_ACL];
  36};
  37
  38struct  stainfo_stats {
  39
  40        uint    rx_pkts;
  41        uint    rx_bytes;
  42        u64     tx_pkts;
  43        uint    tx_bytes;
  44};
  45
  46struct sta_info {
  47        spinlock_t lock;
  48        struct list_head list; /*free_sta_queue*/
  49        struct list_head hash_list; /*sta_hash*/
  50        struct sta_xmit_priv sta_xmitpriv;
  51        struct sta_recv_priv sta_recvpriv;
  52        uint state;
  53        uint aid;
  54        uint    mac_id;
  55        uint    qos_option;
  56        u8      hwaddr[ETH_ALEN];
  57        uint    ieee8021x_blocked;      /*0: allowed, 1:blocked */
  58        uint    XPrivacy; /*aes, tkip...*/
  59        union Keytype   tkiptxmickey;
  60        union Keytype   tkiprxmickey;
  61        union Keytype   x_UncstKey;
  62        union pn48              txpn;   /* PN48 used for Unicast xmit.*/
  63        union pn48              rxpn;   /* PN48 used for Unicast recv.*/
  64        u8      bssrateset[16];
  65        uint    bssratelen;
  66        s32  rssi;
  67        s32     signal_quality;
  68        struct stainfo_stats sta_stats;
  69        /*for A-MPDU Rx reordering buffer control */
  70        struct recv_reorder_ctrl recvreorder_ctrl[16];
  71        struct ht_priv  htpriv;
  72        /* Notes:
  73         * STA_Mode:
  74         * curr_network(mlme_priv/security_priv/qos/ht)
  75         *   + sta_info: (STA & AP) CAP/INFO
  76         * scan_q: AP CAP/INFO
  77         * AP_Mode:
  78         * curr_network(mlme_priv/security_priv/qos/ht) : AP CAP/INFO
  79         * sta_info: (AP & STA) CAP/INFO
  80         */
  81        struct list_head asoc_list;
  82        struct list_head auth_list;
  83        unsigned int expire_to;
  84        unsigned int auth_seq;
  85        unsigned int authalg;
  86        unsigned char chg_txt[128];
  87        unsigned int tx_ra_bitmap;
  88};
  89
  90struct  sta_priv {
  91        u8 *pallocated_stainfo_buf;
  92        u8 *pstainfo_buf;
  93        struct  __queue free_sta_queue;
  94        spinlock_t sta_hash_lock;
  95        struct list_head sta_hash[NUM_STA];
  96        int asoc_sta_count;
  97        struct  __queue sleep_q;
  98        struct  __queue wakeup_q;
  99        struct _adapter *padapter;
 100        struct list_head asoc_list;
 101        struct list_head auth_list;
 102        unsigned int auth_to;  /* sec, time to expire in authenticating. */
 103        unsigned int assoc_to; /* sec, time to expire before associating. */
 104        unsigned int expire_to; /* sec , time to expire after associated. */
 105};
 106
 107static inline u32 wifi_mac_hash(u8 *mac)
 108{
 109        u32 x;
 110
 111        x = mac[0];
 112        x = (x << 2) ^ mac[1];
 113        x = (x << 2) ^ mac[2];
 114        x = (x << 2) ^ mac[3];
 115        x = (x << 2) ^ mac[4];
 116        x = (x << 2) ^ mac[5];
 117        x ^= x >> 8;
 118        x  = x & (NUM_STA - 1);
 119        return x;
 120}
 121
 122int _r8712_init_sta_priv(struct sta_priv *pstapriv);
 123void _r8712_free_sta_priv(struct sta_priv *pstapriv);
 124struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv,
 125                                     u8 *hwaddr);
 126void r8712_free_stainfo(struct _adapter *padapter, struct sta_info *psta);
 127void r8712_free_all_stainfo(struct _adapter *padapter);
 128struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr);
 129void r8712_init_bcmc_stainfo(struct _adapter *padapter);
 130struct sta_info *r8712_get_bcmc_stainfo(struct _adapter *padapter);
 131u8 r8712_access_ctrl(struct wlan_acl_pool *pacl_list, u8 *mac_addr);
 132
 133#endif /* _STA_INFO_H_ */
 134
 135