- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

# /space/home/slher/rel/Beken/v6_4_5/macsw/ip/lmac/src/vif/vif_mgmt.h

Go to the documentation of this file.

    00001
    00013 #ifndef _VIF_MGMT_H_
    00014 #define _VIF_MGMT_H_
    00015
    00025 /*
    00026  * INCLUDE FILES
    00027  ****************************************************************************************
    00028  */
    00029 // for linked list definitions
    00030 #include "co_list.h"
    00031 // for mac_addr and other structure definitions
    00032 #include "mac.h"
    00033 // for MM timer structure
    00034 #include "mm_timer.h"
    00035 // for MM channel structures
    00036 #include "chan.h"
    00037 // for TX frame structures
    00038 #include "txl_frame.h"
    00039 // for band
    00040 #include "phy.h"
    00041
    00042 #if (NX_UMAC_PRESENT)
    00043 #include "me.h"
    00044 #endif
    00045 #if (NX_REORD)
    00046 // for RX definitions
    00047 #include "rxl_cntrl.h"
    00048 #endif //(NX_REORD)
    00049
    00050 /*
    00051  * DEFINES
    00052  ****************************************************************************************
    00053  */
    00054
    00056 #define VIF_MGMT_BCN_TO_DUR     (10000)
    00057
    00058 /*
    00059  * TYPE DEFINITIONS
    00060  ****************************************************************************************
    00061  */
    00063 #define INVALID_VIF_IDX 0xFF
    00064
    00066 #define VIF_UNDEF_POWER 0x7F
    00067
    00069 enum VIF_AP_BCMC_STATUS
    00070 {
    00072     VIF_AP_BCMC_BUFFERED = CO_BIT(0),
    00074     VIF_AP_BCMC_MOREDATA = CO_BIT(1),
    00075 };
    00076
    00078 struct vif_info_tag
    00079 {
    00081     struct co_list_hdr list_hdr;
    00083     uint32_t prevent_sleep;
    00085     uint32_t txq_params[AC_MAX];
    00086
    00087     #if (NX_MULTI_ROLE || NX_CHNL_CTXT || (NX_P2P_GO && NX_POWERSAVE))
    00089     struct mm_timer_tag tbtt_timer;
    00090     #endif //(NX_MULTI_ROLE || NX_CHNL_CTXT || (NX_P2P_GO && NX_POWERSAVE))
    00091
    00092     #if (NX_P2P || NX_CHNL_CTXT)
    00094     struct mm_timer_tag tmr_bcn_to;
    00095     #endif //(NX_P2P || NX_CHNL_CTXT)
    00096
    00097     #if (NX_MULTI_ROLE || NX_TDLS)
    00099     struct mac_addr bssid;
    00100     #endif //(NX_MULTI_ROLE)
    00101
    00102     #if (NX_CHNL_CTXT)
    00104     struct chan_ctxt_tag *chan_ctxt;
    00106     struct chan_tbtt_tag tbtt_switch;
    00107     #endif //(NX_CHNL_CTXT)
    00108
    00110     struct mac_addr mac_addr;
    00111
    00113     uint8_t type;
    00115     uint8_t index;
    00117     bool active;
    00118
    00120     int8_t tx_power;
    00121
    00122     #if NX_UMAC_PRESENT
    00125     int8_t user_tx_power;
    00126     #endif // NX_UMAC_PRESENT
    00127
    00128     union
    00129     {
    00131         struct
    00132         {
    00133             #if (!NX_UMAC_PRESENT && NX_MULTI_ROLE)
    00134             /*
    00135              * In SMAC configuration, when STA, beacon interval is provided before
    00136              * sta structure allocation. Hence it cannot be stored yet, ap_id value
    00137              * is INVALID_STA_IDX.
    00138              * When this case occurs, the beacon interval value will be stored in this
    00139              * variable until reception of MM_STA_ADD_REQ message.
    00140              * Value is in TUs
    00141              */
    00142             uint16_t ap_bcn_intv;
    00143             #endif //(!NX_UMAC_PRESENT && NX_MULTI_ROLE)
    00144             #if NX_POWERSAVE
    00146             uint16_t listen_interval;
    00148             bool dont_wait_bcmc;
    00150             uint8_t ps_retry;
    00151             #endif
    00153             uint8_t ap_id;
    00156             uint8_t bssid_index;
    00159             uint8_t max_bssid_ind;
    00160             #if NX_UAPSD
    00162             uint32_t uapsd_last_rxtx;
    00164             uint8_t uapsd_queues;
    00166             uint8_t uapsd_tid;
    00167             #endif
    00168             #if NX_CONNECTION_MONITOR
    00170             uint32_t mon_last_tx;
    00172             uint32_t mon_last_crc;
    00174             uint8_t beacon_loss_cnt;
    00175             #endif
    00176
    00177             #if (NX_P2P)
    00179             int32_t last_tsf_offset;
    00181             uint32_t ctw_add_dur;
    00183             bool sp_paused;
    00184             #endif //(NX_P2P)
    00185
    00186             #if (NX_P2P_GO)
    00187             // Indicate if AP Beacon has been received at least one time
    00188             bool bcn_rcved;
    00189             #endif //(NX_P2P_GO)
    00190
    00191             // Current RSSI
    00192             int8_t rssi;
    00193             // RSSI threshold (0=threshold not set)
    00194             int8_t rssi_thold;
    00195             // RSSI hysteresis
    00196             uint8_t rssi_hyst;
    00197             // Current status of RSSI (0=RSSI is high, 1=RSSI is low)
    00198             bool rssi_status;
    00199
    00200             #if NX_UMAC_PRESENT
    00202             uint8_t csa_count;
    00204             bool csa_occured;
    00205             #endif // NX_UMAC_PRESENT
    00206
    00207             #if (NX_TDLS)
    00209             uint8_t tdls_chsw_sta_idx;
    00210             #endif
    00211         } sta;
    00213         struct
    00214         {
    00215             uint32_t dummy;
    00216             #if NX_BCN_AUTONOMOUS_TX
    00218             struct txl_frame_desc_tag bcn_desc;
    00220             uint16_t bcn_len;
    00222             uint16_t tim_len;
    00224             uint16_t tim_bitmap_set;
    00226             uint16_t bcn_int;
    00227             #if (NX_UMAC_PRESENT)
    00229             uint8_t bcn_tbtt_ratio;
    00231             uint8_t bcn_tbtt_cnt;
    00232             #endif //(NX_UMAC_PRESENT)
    00234             bool bcn_configured;
    00236             uint8_t dtim_count;
    00238             uint8_t tim_n1;
    00240             uint8_t tim_n2;
    00242             uint8_t bc_mc_status;
    00243             #if (!NX_UMAC_PRESENT)
    00245             uint8_t bc_mc_nb;
    00246             #endif
    00248             uint8_t csa_count;
    00250             uint8_t csa_oft[BCN_MAX_CSA_CPT];
    00251             #endif
    00252             #if (NX_UMAC_PRESENT || NX_P2P_GO)
    00254             uint8_t ps_sta_cnt;
    00255             #endif //(NX_UMAC_PRESENT || NX_P2P_GO)
    00256             #if NX_UMAC_PRESENT
    00258             uint16_t ctrl_port_ethertype;
    00259             #endif
    00260         } ap;
    00261     } u;
    00262
    00263     #if (NX_UMAC_PRESENT || NX_TD_STA)
    00265     struct co_list sta_list;
    00266     #endif //(NX_UMAC_PRESENT || NX_TD_STA)
    00267
    00268     #if NX_UMAC_PRESENT
    00270     struct me_bss_info bss_info;
    00272     #if NX_MFP
    00273     struct key_info_tag key_info[MAC_DEFAULT_MFP_KEY_COUNT];
    00274     #else
    00275     struct key_info_tag key_info[MAC_DEFAULT_KEY_COUNT];
    00276     #endif
    00278     struct key_info_tag *default_key;
    00279     #if NX_MFP
    00281     struct key_info_tag *default_mgmt_key;
    00282     #endif
    00284     uint32_t flags;
    00286     struct mac_chan_op csa_channel;
    00287     #endif
    00288
    00289     #if NX_MAC_HE
    00291     uint16_t txop_dur_rts_thres;
    00292     #endif
    00293     #if (NX_P2P)
    00295     bool p2p;
    00297     uint8_t p2p_index;
    00299     uint8_t p2p_link_nb;
    00300     #endif //(NX_P2P)
    00301
    00302     #if (RW_UMESH_EN)
    00304     uint8_t mvif_idx;
    00305     #endif //(RW_UMESH_EN)
    00306 };
    00307
    00309 struct vif_mgmt_env_tag
    00310 {
    00312     struct co_list free_list;
    00314     struct co_list used_list;
    00316     uint8_t monitor_vif;
    00317     #if NX_MULTI_ROLE
    00319     uint8_t vif_sta_cnt;
    00321     uint8_t vif_ap_cnt;
    00322     #if (RW_MESH_EN)
    00324     uint8_t vif_mp_cnt;
    00325     #endif //(RW_MESH_EN)
    00326     #endif //(NX_MULTI_ROLE)
    00327     #if (NX_P2P && NX_CHNL_CTXT)
    00329     uint8_t nb_p2p_vifs;
    00330     #endif //(NX_P2P && NX_CHNL_CTXT)
    00331     #if (NX_UMAC_PRESENT)
    00333     uint8_t low_bcn_int_idx;
    00334     #endif //(NX_UMAC_PRESENT)
    00335 };
    00336
    00337 /*
    00338  * GLOBAL VARIABLES
    00339  ****************************************************************************************
    00340  */
    00342 extern struct vif_mgmt_env_tag vif_mgmt_env;
    00343
    00345 extern struct vif_info_tag vif_info_tab[NX_VIRT_DEV_MAX];
    00346
    00347
    00348 /*
    00349  * FUNCTION PROTOTYPES
    00350  ****************************************************************************************
    00351  */
    00352 #if NX_MULTI_ROLE
    00353
    00360 __INLINE int vif_mgmt_used_cnt(void)
    00361 {
    00362     return(vif_mgmt_env.vif_ap_cnt + vif_mgmt_env.vif_sta_cnt);
    00363 }
    00364 #endif
    00365
    00366
    00374 __INLINE struct vif_info_tag *vif_mgmt_first_used(void)
    00375 {
    00376     return((struct vif_info_tag *)co_list_pick(&vif_mgmt_env.used_list));
    00377 }
    00378
    00379
    00389 __INLINE struct vif_info_tag *vif_mgmt_next(struct vif_info_tag *vif)
    00390 {
    00391     return((struct vif_info_tag *)co_list_next(&vif->list_hdr));
    00392 }
    00393
    00402 void vif_mgmt_set_bssid_mask(void);
    00403
    00409 void vif_mgmt_init(void);
    00410
    00411 #if (NX_TX_FRAME)
    00412
    00418 void vif_mgmt_reset(void);
    00419 #endif //(NX_TX_FRAME)
    00420
    00434 uint8_t vif_mgmt_register(struct mac_addr const *mac_addr,
    00435                           uint8_t  vif_type,
    00436                           bool p2p,
    00437                           uint8_t *vif_idx);
    00438
    00446 void vif_mgmt_unregister(uint8_t vif_idx);
    00447
    00448 #if (NX_UMAC_PRESENT)
    00449
    00457 void vif_mgmt_add_key(struct mm_key_add_req const *param, uint8_t hw_key_idx);
    00458
    00467 void vif_mgmt_del_key(struct vif_info_tag *vif, uint8_t keyid);
    00468
    00478 __INLINE uint8_t vif_mgmt_get_type(uint8_t vif_idx)
    00479 {
    00480     return (vif_info_tab[vif_idx].type);
    00481 }
    00482
    00493 uint8_t vif_mgmt_get_staid(const struct vif_info_tag *vif, const struct mac_addr *sta_addr);
    00494
    00495 #endif //(NX_UMAC_PRESENT)
    00496
    00497 #if NX_TX_FRAME
    00498
    00508 __INLINE uint8_t vif_mgmt_get_band(struct vif_info_tag *vif)
    00509 {
    00510     #if (!NX_CHNL_CTXT)
    00511     struct phy_channel_info phy_info;
    00512     phy_get_channel(&phy_info, PHY_PRIM);
    00513     return PHY_INFO_BAND(phy_info);
    00514     #else
    00515     if (vif->chan_ctxt)
    00516         return vif->chan_ctxt->channel.band;
    00517     else
    00518         return PHY_BAND_MAX;
    00519     #endif
    00520 }
    00521
    00533 __INLINE int vif_mgmt_get_txtype(struct vif_info_tag *vif)
    00534 {
    00535     uint8_t band = vif_mgmt_get_band(vif);
    00536     ASSERT_ERR(band != PHY_BAND_MAX);
    00537
    00538     #if (NX_P2P)
    00539     if (vif->p2p)
    00540         // If P2P interface, 11b rates are forbidden
    00541         return TX_DEFAULT_5G;
    00542     #endif //(NX_P2P)
    00543
    00544     if (band == PHY_BAND_2G4)
    00545         return TX_DEFAULT_24G;
    00546     else
    00547         return TX_DEFAULT_5G;
    00548 }
    00549 #endif // NX_TX_FRAME
    00550
    00551 #if (RW_BFMER_EN || NX_UMAC_PRESENT)
    00552
    00560 __INLINE struct mac_addr *vif_mgmt_get_addr(uint8_t vif_idx)
    00561 {
    00562     return (&vif_info_tab[vif_idx].mac_addr);
    00563 }
    00564 #endif //(RW_BFMER_EN || NX_UMAC_PRESENT)
    00565
    00566 #if (NX_TX_FRAME)
    00567
    00575 void vif_mgmt_send_postponed_frame(struct vif_info_tag *vif);
    00576 #endif //(NX_TX_FRAME)
    00577
    00578 #if (NX_CHNL_CTXT || NX_P2P)
    00579
    00589 void vif_mgmt_bcn_to_prog(struct vif_info_tag *vif);
    00590
    00604 void vif_mgmt_bcn_recv(struct vif_info_tag *vif);
    00605 #endif //(NX_CHNL_CTXT || NX_P2P)
    00606
    00618 void vif_mgmt_set_ap_bcn_int(struct vif_info_tag *vif, uint16_t bcn_int);
    00619
    00620 #if NX_UMAC_PRESENT
    00621
    00637 void vif_mgmt_switch_channel(struct vif_info_tag *vif);
    00638 #endif
    00639
    00647 struct vif_info_tag *vif_mgmt_get_single_sta_vif(void);
    00648
    00650
    00651 #endif // _VIF_MGMT_H_
    00652