1186904Ssam/*- 2186904Ssam * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting 3186904Ssam * Copyright (c) 2007-2009 Intel Corporation 4186904Ssam * All rights reserved. 5186904Ssam * 6186904Ssam * Redistribution and use in source and binary forms, with or without 7186904Ssam * modification, are permitted provided that the following conditions 8186904Ssam * are met: 9186904Ssam * 1. Redistributions of source code must retain the above copyright 10186904Ssam * notice, this list of conditions and the following disclaimer. 11186904Ssam * 2. Redistributions in binary form must reproduce the above copyright 12186904Ssam * notice, this list of conditions and the following disclaimer in the 13186904Ssam * documentation and/or other materials provided with the distribution. 14186904Ssam * 15186904Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16186904Ssam * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17186904Ssam * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18186904Ssam * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19186904Ssam * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20186904Ssam * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21186904Ssam * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22186904Ssam * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23186904Ssam * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24186904Ssam * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25186904Ssam * 26186904Ssam * $FreeBSD: releng/11.0/sys/net80211/ieee80211_tdma.h 283535 2015-05-25 16:37:41Z adrian $ 27186904Ssam */ 28186904Ssam#ifndef _NET80211_IEEE80211_TDMA_H_ 29186904Ssam#define _NET80211_IEEE80211_TDMA_H_ 30186904Ssam 31186904Ssam/* 32186904Ssam * TDMA-mode implementation definitions. 33186904Ssam */ 34190455Ssam 35190455Ssam#define TDMA_SUBTYPE_PARAM 0x01 36190455Ssam#define TDMA_VERSION_V2 2 37190455Ssam#define TDMA_VERSION TDMA_VERSION_V2 38190455Ssam 39190455Ssam/* NB: we only support 2 right now but protocol handles up to 8 */ 40190455Ssam#define TDMA_MAXSLOTS 2 /* max slots/sta's */ 41190455Ssam 42190455Ssam#define TDMA_PARAM_LEN_V2 sizeof(struct ieee80211_tdma_param) 43190455Ssam 44190455Ssam/* 45190455Ssam * TDMA information element. 46190455Ssam */ 47190455Ssamstruct ieee80211_tdma_param { 48190455Ssam u_int8_t tdma_id; /* IEEE80211_ELEMID_VENDOR */ 49190455Ssam u_int8_t tdma_len; 50190455Ssam u_int8_t tdma_oui[3]; /* TDMA_OUI */ 51190455Ssam u_int8_t tdma_type; /* TDMA_OUI_TYPE */ 52190455Ssam u_int8_t tdma_subtype; /* TDMA_SUBTYPE_PARAM */ 53190455Ssam u_int8_t tdma_version; /* spec revision */ 54190455Ssam u_int8_t tdma_slot; /* station slot # [0..7] */ 55190455Ssam u_int8_t tdma_slotcnt; /* bss slot count [1..8] */ 56190455Ssam u_int16_t tdma_slotlen; /* bss slot len (100us) */ 57190455Ssam u_int8_t tdma_bintval; /* beacon interval (superframes) */ 58190455Ssam u_int8_t tdma_inuse[1]; /* slot occupancy map */ 59190455Ssam u_int8_t tdma_pad[2]; 60190455Ssam u_int8_t tdma_tstamp[8]; /* timestamp from last beacon */ 61190455Ssam} __packed; 62190455Ssam 63190455Ssam#ifdef _KERNEL 64190455Ssam/* 65190455Ssam * Implementation state. 66190455Ssam */ 67186904Ssamstruct ieee80211_tdma_state { 68186904Ssam u_int tdma_slotlen; /* bss slot length (us) */ 69189980Ssam uint8_t tdma_version; /* protocol version to use */ 70186904Ssam uint8_t tdma_slotcnt; /* bss slot count */ 71186904Ssam uint8_t tdma_bintval; /* beacon interval (slots) */ 72186904Ssam uint8_t tdma_slot; /* station slot # */ 73186904Ssam uint8_t tdma_inuse[1]; /* mask of slots in use */ 74186904Ssam uint8_t tdma_active[1]; /* mask of active slots */ 75186904Ssam int tdma_count; /* active/inuse countdown */ 76189981Ssam void *tdma_peer; /* peer station cookie */ 77189981Ssam struct timeval tdma_lastprint; /* time of last rate-limited printf */ 78189981Ssam int tdma_fails; /* fail count for rate-limiting */ 79186904Ssam 80186904Ssam /* parent method pointers */ 81186904Ssam int (*tdma_newstate)(struct ieee80211vap *, enum ieee80211_state, 82186904Ssam int arg); 83186904Ssam void (*tdma_recv_mgmt)(struct ieee80211_node *, 84283535Sadrian struct mbuf *, int, 85283535Sadrian const struct ieee80211_rx_stats *rxs, int, int); 86186904Ssam void (*tdma_opdetach)(struct ieee80211vap *); 87186904Ssam}; 88189980Ssam 89189980Ssam#define TDMA_UPDATE_SLOT 0x0001 /* tdma_slot changed */ 90189980Ssam#define TDMA_UPDATE_SLOTCNT 0x0002 /* tdma_slotcnt changed */ 91189980Ssam#define TDMA_UPDATE_SLOTLEN 0x0004 /* tdma_slotlen changed */ 92189980Ssam#define TDMA_UPDATE_BINTVAL 0x0008 /* tdma_bintval changed */ 93186904Ssam 94186904Ssamvoid ieee80211_tdma_vattach(struct ieee80211vap *); 95186904Ssam 96186904Ssamint ieee80211_tdma_getslot(struct ieee80211vap *vap); 97186904Ssamvoid ieee80211_parse_tdma(struct ieee80211_node *ni, const uint8_t *ie); 98186904Ssamuint8_t *ieee80211_add_tdma(uint8_t *frm, struct ieee80211vap *vap); 99186904Ssamstruct ieee80211_beacon_offsets; 100186904Ssamvoid ieee80211_tdma_update_beacon(struct ieee80211vap *vap, 101186904Ssam struct ieee80211_beacon_offsets *bo); 102190455Ssam#endif /* _KERNEL */ 103186904Ssam#endif /* !_NET80211_IEEE80211_TDMA_H_ */ 104