Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /******************************************************************************
0003  *
0004  * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
0005  *
0006  * Modifications for inclusion into the Linux staging tree are
0007  * Copyright(c) 2010 Larry Finger. All rights reserved.
0008  *
0009  * Contact information:
0010  * WLAN FAE <wlanfae@realtek.com>
0011  * Larry Finger <Larry.Finger@lwfinger.net>
0012  *
0013  ******************************************************************************/
0014 #ifndef __STA_INFO_H_
0015 #define __STA_INFO_H_
0016 
0017 #include "osdep_service.h"
0018 #include "drv_types.h"
0019 #include "wifi.h"
0020 
0021 #define NUM_STA 32
0022 #define NUM_ACL 64
0023 
0024 /* if mode ==0, then the sta is allowed once the addr is hit.
0025  * if mode ==1, then the sta is rejected once the addr is non-hit.
0026  */
0027 struct wlan_acl_node {
0028     struct list_head list;
0029     u8       addr[ETH_ALEN];
0030     u8       mode;
0031 };
0032 
0033 struct wlan_acl_pool {
0034     struct wlan_acl_node aclnode[NUM_ACL];
0035 };
0036 
0037 struct  stainfo_stats {
0038     uint    rx_pkts;
0039     uint    rx_bytes;
0040     u64 tx_pkts;
0041     uint    tx_bytes;
0042 };
0043 
0044 struct sta_info {
0045     spinlock_t lock;
0046     struct list_head list; /*free_sta_queue*/
0047     struct list_head hash_list; /*sta_hash*/
0048     struct sta_xmit_priv sta_xmitpriv;
0049     struct sta_recv_priv sta_recvpriv;
0050     uint state;
0051     uint aid;
0052     uint    mac_id;
0053     uint    qos_option;
0054     u8  hwaddr[ETH_ALEN];
0055     uint    ieee8021x_blocked;  /*0: allowed, 1:blocked */
0056     uint    XPrivacy; /*aes, tkip...*/
0057     union Keytype   tkiptxmickey;
0058     union Keytype   tkiprxmickey;
0059     union Keytype   x_UncstKey;
0060     union pn48      txpn;   /* PN48 used for Unicast xmit.*/
0061     union pn48      rxpn;   /* PN48 used for Unicast recv.*/
0062     u8  bssrateset[16];
0063     uint    bssratelen;
0064     s32  rssi;
0065     s32 signal_quality;
0066     struct stainfo_stats sta_stats;
0067     /*for A-MPDU Rx reordering buffer control */
0068     struct recv_reorder_ctrl recvreorder_ctrl[16];
0069     struct ht_priv  htpriv;
0070     /* Notes:
0071      * STA_Mode:
0072      * curr_network(mlme_priv/security_priv/qos/ht)
0073      *   + sta_info: (STA & AP) CAP/INFO
0074      * scan_q: AP CAP/INFO
0075      * AP_Mode:
0076      * curr_network(mlme_priv/security_priv/qos/ht) : AP CAP/INFO
0077      * sta_info: (AP & STA) CAP/INFO
0078      */
0079     struct list_head asoc_list;
0080     struct list_head auth_list;
0081     unsigned int expire_to;
0082     unsigned int auth_seq;
0083     unsigned int authalg;
0084     unsigned char chg_txt[128];
0085     unsigned int tx_ra_bitmap;
0086 };
0087 
0088 struct  sta_priv {
0089     u8 *pallocated_stainfo_buf;
0090     u8 *pstainfo_buf;
0091     struct  __queue free_sta_queue;
0092     spinlock_t sta_hash_lock;
0093     struct list_head sta_hash[NUM_STA];
0094     int asoc_sta_count;
0095     struct  __queue sleep_q;
0096     struct  __queue wakeup_q;
0097     struct _adapter *padapter;
0098     struct list_head asoc_list;
0099     struct list_head auth_list;
0100     unsigned int auth_to;  /* sec, time to expire in authenticating. */
0101     unsigned int assoc_to; /* sec, time to expire before associating. */
0102     unsigned int expire_to; /* sec , time to expire after associated. */
0103 };
0104 
0105 static inline u32 wifi_mac_hash(u8 *mac)
0106 {
0107     u32 x;
0108 
0109     x = mac[0];
0110     x = (x << 2) ^ mac[1];
0111     x = (x << 2) ^ mac[2];
0112     x = (x << 2) ^ mac[3];
0113     x = (x << 2) ^ mac[4];
0114     x = (x << 2) ^ mac[5];
0115     x ^= x >> 8;
0116     x  = x & (NUM_STA - 1);
0117     return x;
0118 }
0119 
0120 int _r8712_init_sta_priv(struct sta_priv *pstapriv);
0121 void _r8712_free_sta_priv(struct sta_priv *pstapriv);
0122 struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv,
0123                      u8 *hwaddr);
0124 void r8712_free_stainfo(struct _adapter *padapter, struct sta_info *psta);
0125 void r8712_free_all_stainfo(struct _adapter *padapter);
0126 struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr);
0127 void r8712_init_bcmc_stainfo(struct _adapter *padapter);
0128 struct sta_info *r8712_get_bcmc_stainfo(struct _adapter *padapter);
0129 u8 r8712_access_ctrl(struct wlan_acl_pool *pacl_list, u8 *mac_addr);
0130 
0131 #endif /* _STA_INFO_H_ */
0132