# TLDS
[LMAC]

TDLS module. More...

Collaboration diagram for TLDS:

## Modules
| TDLS_TASK

| Task responsible for TDLS operations.
## Defines
#define | TDLS_PTI_RSP_TOUT_US 5000000
| Peer Traffic Indication Response timeout, in us.
#define | TDLS_KEEP_ALIVE_US 10000000
| Keep-alive time, in us.
#define | TDLS_CHSW_SWITCH_TIME_US 5000
| Time spent to switch channel, in us.
#define | TDLS_CHSW_TX_FRAME_TIME_US 1000
| Time spent to transmit a frame included SIFS, in us.
#define | TDLS_MAX_CHSW_SWITCH_TIME_US 15000
| Max channel switch timeout, in us.
#define | TDLS_CHSW_REQ_DELAY_US 10000
| Delay of Channel Switch Request on TBTT time, in us.
#define | TDLS_KA_RETRIES 2
| Number of keep-alive frames transmitted before considering the TDLS peer unreachable.
#define | TDLS_CHSW_REQ_DELAY_AP_TRAFFIC_US 20000
| Delay of Channel Switch Request when there is traffic with AP, in us.
## Functions
static void | tdls_keep_alive_frame_tx_cfm (void *env, uint32_t status)
| Callback function indicating the completion of the QoS Null Frame.
static void | tdls_chsw_null_frame_tx_cfm (void *env, uint32_t status)
| Callback function indicating the completion of the QoS NULL transmission on the off channel.
static void | tdls_chsw_req_tx_cfm (void *env, uint32_t status)
| Callback function indicating the completion of the TDLS Channel Switch Request frame transmission.
static void | tdls_chsw_rsp_tx_cfm (void *env, uint32_t status)
| Callback function indicating the completion of the TDLS Channel Switch Response frame transmission.
static void | tdls_chsw_unsol_rsp_tx_cfm (void *env, uint32_t status)
| Callback function indicating the completion of the unsolicited TDLS Channel Switch Response frame transmission.
static uint16_t | tdls_check_tdls_channel_switch_request (uint8_t *frame, uint32_t offset, struct sta_info_tag *sta_tdls, uint32_t next_tbtt)
| Handle the reception of a TDLS Channel Switch Request.
static uint32_t | tdls_check_tdls_channel_switch_response (uint8_t *frame, uint32_t offset, struct sta_info_tag *sta_tdls, struct mac_addr *initiator_mac_addr, struct mac_addr *responder_mac_addr, uint32_t next_tbtt)
| Handle the reception of a TDLS Channel Switch Response.
static uint32_t | tdls_check_tdls_peer_traffic_response (uint8_t *frame, uint32_t offset, struct sta_info_tag *sta_tdls, struct mac_addr *initiator_mac_addr, struct mac_addr *responder_mac_addr)
| Handle a received TDLS Peer Traffic Response.
static void | tdls_chsw_end_evt (void *env)
| Callback called upon end of off-channel period.
static void | tdls_chsw_time_evt (void *env)
| Callback called when considering that the channel switch is done on both sides.
static void | tdls_chsw_timeout_evt (void *env)
| Callback called upon TDLS channel switch timeout timer expiration.
static void | tdls_keep_alive_evt (void *env)
| Callback called upon TDLS keep-alive timer expiration.
static void | tdls_pti_timeout_evt (void *env)
| Callback called upon TDLS Peer Traffic Indication Request timeout expired.
static bool | tdls_check_frame_action (uint8_t *frame, struct vif_info_tag *vif, uint8_t sta_idx)
| Function checking whether a received frame is a TDLS action frame or not.
static void | tdls_check_peer_ps (uint8_t *frame, struct vif_info_tag *vif, uint8_t sta_idx)
| This function checks if the received frame is a NULL function indicating that the TDLS peer is going to sleep and informs the host.
void | tdls_chsw_req_evt (void *env)
| Callback called upon TDLS channel switch request timer expiration.
bool | tdls_check_frame (uint8_t *frame, struct vif_info_tag *vif, uint8_t sta_idx)
| This function processes the received TDLS frames.
void | tdls_send_chan_switch_base_ind (struct chan_ctxt_tag *roc_chan_ctxt)
| TDLS channel switch to base channel indication.
void | tdls_send_peer_ps_ind (struct vif_info_tag *vif, bool ps_on, uint8_t sta_idx)
| TDLS peer power save indication.
void | tdls_add_sta (struct sta_info_tag *sta, bool initiator, bool chsw_allowed)
| Add TDLS station.
void | tdls_del_sta (struct sta_info_tag *sta)
| Del TDLS station.
void | tdls_peer_traffic_ind_tx_cfm (void *env, uint32_t status)
| Callback function indicating the completion of the TDLS Peer Traffic Indication Request frame transmission.
__INLINE uint32_t | tdls_get_dt_us (uint32_t next_tbtt, uint32_t now)
| This function is used to compute the time to the next TBTT.

## Detailed Description

TDLS module.

## Function Documentation

void tdls_add_sta | ( | struct sta_info_tag * | sta,
|  | bool | initiator,
|  | bool | chsw_allowed |
| ) |  |  |

Add TDLS station.

This function initialises the TDLS station parameters.

Parameters:

  `[in]` | sta | Pointer to TDLS station entry
  `[in]` | initiator | The STA is the TDLS link initiator
  `[in]` | chsw_allowed | TDLS Channel Switch is allowed with this STA

bool tdls_check_frame | ( | uint8_t * | frame,
|  | struct vif_info_tag * | vif,
|  | uint8_t | sta_idx |
| ) |  |  |

This function processes the received TDLS frames.

Parameters:

  `[in]` | frame | Pointer to the frame
  `[in]` | vif | Pointer to the VIF entry
  `[in]` | sta_idx | Index of the TDLS sender station

Returns:
  A boolean indicating if the frame is handled internally, or needs to be forwarded to the host.

Referenced by rxl_frame_handle().

static bool tdls_check_frame_action | ( | uint8_t * | frame,
|  | struct vif_info_tag * | vif,
|  | uint8_t | sta_idx |
| ) |  |  | `[static]`

Function checking whether a received frame is a TDLS action frame or not.

Subsequent functions depending on the action to be performed are then called.

Parameters:

  `[in]` | frame | Pointer the TDLS frame
  `[in]` | vif | Pointer the VIF entry
  `[in]` | sta_idx | Index of the transmitting station

Returns:
  Whether the frame shall be uploaded by the RX path or not

Definition at line 696 of file tdls.c.

References mac_chan_op::band, mm_timer_tag::cb, mm_remain_on_channel_req::chan, vif_info_tag::chan_ctxt, chan_roc_req(), chan_ctxt_tag::channel, tdls_info_tag::chsw, tdls_info_tag::chsw_allowed, tdls_info_tag::chsw_end_timer, tdls_info_tag::chsw_initiator, tdls_info_tag::chsw_time, tdls_info_tag::chsw_time_timer, tdls_info_tag::chsw_timeout_timer, CO_OK, co_read16(), co_read32p(), co_read8p(), CPU2HW, mm_remain_on_channel_req::duration_ms, EIV_LEN, mm_timer_tag::env, FRAME_BODY_LLC_H, FRAME_BODY_LLC_L, hal_machw_time_past(), vif_info_tag::index, tdls_info_tag::initiator, INVALID_STA_IDX, IV_LEN, tdls_info_tag::ka_tx_req, ke_state_get(), ke_state_set(), ke_time(), MAC_ACTION_ACTION_OFT, vif_info_tag::mac_addr, sta_info_tag::mac_addr, MAC_ENCAPSULATED_LLC_L_OFT, MAC_ENCAPSULATED_PAYLOAD_OFT, MAC_ENCAPSULATED_PAYLOAD_TYPE_OFT, MAC_FCTRL_DATA_T, MAC_FCTRL_ORDER, MAC_FCTRL_PROTECTEDFRAME, MAC_FCTRL_TYPE_MASK, MAC_HTC_LEN, MAC_QOS_ST_BIT, MAC_QOSCTRL_EOSP, MAC_QOSCTRL_UP_OFT, MAC_SHORT_QOS_MAC_HDR_LEN, MAC_TDLS_ACTION_CATEGORY, MAC_TDLS_ACTION_CHANSW_REQ, MAC_TDLS_ACTION_CHANSW_RSP, MAC_TDLS_ACTION_PEER_TRAFFIC_RSP, mm_timer_clear(), mm_timer_set(), mm_remain_on_channel_req::op_code, PAYLOAD_TYPE_TDLS, mac_chan_op::prim20_freq, PROF_TDLS_CHSW_END_TIMER_CLR, PROF_TDLS_CHSW_REQ_RX_CLR, PROF_TDLS_CHSW_REQ_RX_SET, PROF_TDLS_CHSW_RESP_RX_CLR, PROF_TDLS_CHSW_RESP_RX_SET, PROF_TDLS_CHSW_TIME_TIMER_CLR, PROF_TDLS_CHSW_TIME_TIMER_SET, PROF_TDLS_CHSW_TIMEOUT_TIMER_CLR, PROF_TDLS_SWITCH_TO_BASECH_CLR, PROF_TDLS_SWITCH_TO_BASECH_SET, PROF_TDLS_SWITCH_TO_OFFCH_CLR, PROF_TDLS_SWITCH_TO_OFFCH_SET, sta_info_tag::ps_state, tdls_info_tag::pti_timeout_timer, tdls_info_tag::pti_timer_running, vif_info_tag::sta, sta_info_tab, sta_info_tag::staid, TASK_TDLS, vif_info_tag::tbtt_timer, td_sta_has_traffic(), sta_info_tag::tdls, TDLS_BASE_CHANNEL, TDLS_CHANSW_REQUEST_ACCEPTED, TDLS_CHANSW_REQUEST_DECLINED, tdls_check_tdls_channel_switch_request(), tdls_check_tdls_channel_switch_response(), tdls_check_tdls_peer_traffic_response(), TDLS_CHSW_REQ_RX, TDLS_CHSW_REQ_TX, tdls_chsw_rsp_tx_cfm(), tdls_chsw_time_evt(), tdls_chsw_timeout_evt(), tdls_get_dt_us(), tdls_keep_alive_frame_tx_cfm(), TDLS_OFF_CHANNEL, tdls_send_peer_ps_ind(), TDLS_TRAFFIC_IND_TX, mm_timer_tag::time, TRACE_TDLS, tdls_info_tag::traffic_available, vif_info_tag::tx_power, mac_chan_op::tx_power, txl_frame_send_qosnull_frame(), txl_frame_send_tdls_channel_switch_rsp_frame(), mac_chan_op::type, vif_info_tag::u, and mm_remain_on_channel_req::vif_index.

static void tdls_check_peer_ps | ( | uint8_t * | frame,
|  | struct vif_info_tag * | vif,
|  | uint8_t | sta_idx |
| ) |  |  | `[static]`

This function checks if the received frame is a NULL function indicating that the TDLS peer is going to sleep and informs the host.

Parameters:

  `[in]` | frame | Pointer to the frame
  `[in]` | vif | Pointer to the VIF entry
  `[in]` | sta_idx | Index of the transmitting STA

Definition at line 969 of file tdls.c.

References mac_hdr::fctl, ke_state_get(), MAC_FCTRL_PWRMGT, MAC_FCTRL_TODS_FROMDS, MAC_QOS_ST_BIT, sta_info_tag::ps_state, sta_info_tab, TASK_TDLS, tdls_chsw_unsol_rsp_tx_cfm(), TDLS_OFF_CHANNEL, tdls_send_peer_ps_ind(), and txl_frame_send_tdls_channel_switch_rsp_frame().

static uint16_t tdls_check_tdls_channel_switch_request | ( | uint8_t * | frame,
|  | uint32_t | offset,
|  | struct sta_info_tag * | sta_tdls,
|  | uint32_t | next_tbtt |
| ) |  |  | `[static]`

Handle the reception of a TDLS Channel Switch Request.

Parameters:

  `[in]` | frame | Pointer to the received frame
  `[in]` | offset | Offset of the encapsulated payload inside the frame buffer
  `[in]` | sta_tdls | Pointer to the TDLS station
  `[in]` | next_tbtt | Time in us of the next TBTT

Returns:
  The status to be put back in the response (TDLS_CHANSW_REQUEST_ACCEPTED or TDLS_CHANSW_REQUEST_DECLINED)

Definition at line 222 of file tdls.c.

References mac_chan_op::band, mac_chan_op::center1_freq, mac_chan_op::center2_freq, tdls_info_tag::chsw, tdls_info_tag::chsw_num, tdls_info_tag::chsw_op_class, tdls_info_tag::chsw_time, tdls_info_tag::chsw_timeout, co_read16p(), co_read8p(), CPU2HW, ke_time(), MAC_ELTID_CHANNEL_SWITCH_TIMING, MAC_ELTID_LINK_IDENTIFIER, MAC_ELTID_SEC_CH_OFFSET, MAC_ELTID_WIDE_BANDWIDTH_CHAN_SWITCH, MAC_INFOELT_CH_SWITCH_TIMING_SWTIME_OFT, MAC_INFOELT_CH_SWITCH_TIMING_SWTOUT_OFT, MAC_INFOELT_SEC_CH_OFFSET_SEC_ABOVE, MAC_INFOELT_SEC_CH_OFFSET_SEC_CH_OFT, MAC_INFOELT_WIDE_BW_CHAN_SWITCH_NEW_CENTER1_OFT, MAC_INFOELT_WIDE_BW_CHAN_SWITCH_NEW_CENTER2_OFT, MAC_INFOELT_WIDE_BW_CHAN_SWITCH_NEW_CW_OFT, PHY_BAND_2G4, PHY_BAND_5G, phy_channel_to_freq(), PHY_CHNL_BW_20, PHY_CHNL_BW_40, mac_chan_op::prim20_freq, sta_info_tag::tdls, TDLS_CHANSW_REQ_IE_CH_SWITCH_TIMING_LEN, TDLS_CHANSW_REQ_IE_LINK_ID_LEN, TDLS_CHANSW_REQ_IE_SEC_CH_OFT_LEN, TDLS_CHANSW_REQ_IES_OFFSET, TDLS_CHANSW_REQ_OP_CLASS, TDLS_CHANSW_REQ_TARGET_CH_OFFSET, TDLS_CHANSW_REQUEST_ACCEPTED, TDLS_CHANSW_REQUEST_DECLINED, TDLS_CHSW_SWITCH_TIME_US, TDLS_CHSW_TX_FRAME_TIME_US, tdls_get_dt_us(), TDLS_MAX_CHSW_SWITCH_TIME_US, TRACE_TDLS, and mac_chan_op::type.

Referenced by tdls_check_frame_action().

static uint32_t tdls_check_tdls_channel_switch_response | ( | uint8_t * | frame,
|  | uint32_t | offset,
|  | struct sta_info_tag * | sta_tdls,
|  | struct mac_addr * | initiator_mac_addr,
|  | struct mac_addr * | responder_mac_addr,
|  | uint32_t | next_tbtt |
| ) |  |  | `[static]`

Handle the reception of a TDLS Channel Switch Response.

Parameters:

  `[in]` | frame | Pointer to the received frame
  `[in]` | offset | Offset of the encapsulated payload inside the frame buffer
  `[in]` | sta_tdls | Pointer to the TDLS station
  `[in]` | initiator_mac_addr | MAC address of the TDLS initiator
  `[in]` | responder_mac_addr | MAC address of the TDLS responder
  `[in]` | next_tbtt | Time in us of the next TBTT

Returns:
  CO_OK if the frame is correct, CO_FAIL otherwise

Definition at line 343 of file tdls.c.

References mac_addr::array, tdls_info_tag::chsw_time, tdls_info_tag::chsw_timeout, CO_BAD_PARAM, CO_FAIL, CO_NOT_FOUND, CO_OK, co_read16p(), co_read8p(), CPU2HW, ke_state_get(), ke_time(), MAC_ADDR_CMP, MAC_ADDR_LEN, MAC_ELTID_CHANNEL_SWITCH_TIMING, MAC_ELTID_LINK_IDENTIFIER, MAC_INFOELT_CH_SWITCH_TIMING_SWTIME_OFT, MAC_INFOELT_CH_SWITCH_TIMING_SWTOUT_OFT, MAC_INFOELT_LINK_ID_INIT_STA_OFT, MAC_INFOELT_LINK_ID_RESP_STA_OFT, TASK_TDLS, sta_info_tag::tdls, TDLS_CHANSW_REQ_IE_CH_SWITCH_TIMING_LEN, TDLS_CHANSW_REQ_IE_LINK_ID_LEN, TDLS_CHANSW_REQUEST_ACCEPTED, TDLS_CHANSW_RSP_IES_OFFSET, TDLS_CHANSW_RSP_STATUS_OFFSET, TDLS_CHSW_REQ_TX, TDLS_CHSW_TX_FRAME_TIME_US, tdls_get_dt_us(), and TRACE_TDLS.

Referenced by tdls_check_frame_action().

static uint32_t tdls_check_tdls_peer_traffic_response | ( | uint8_t * | frame,
|  | uint32_t | offset,
|  | struct sta_info_tag * | sta_tdls,
|  | struct mac_addr * | initiator_mac_addr,
|  | struct mac_addr * | responder_mac_addr |
| ) |  |  | `[static]`

Handle a received TDLS Peer Traffic Response.

Parameters:

  `[in]` | frame | Pointer to the received frame
  `[in]` | offset | Offset of the encapsulated payload inside the frame buffer
  `[in]` | sta_tdls | Pointer to the TDLS station
  `[in]` | initiator_mac_addr | MAC address of the TDLS initiator
  `[in]` | responder_mac_addr | MAC address of the TDLS responder

Returns:
  CO_OK if the frame is correct, CO_FAIL otherwise

Definition at line 433 of file tdls.c.

References mac_addr::array, CO_BAD_PARAM, CO_FAIL, CO_NOT_FOUND, CO_OK, co_read16p(), co_read8p(), CPU2HW, D_CRT, dbg, tdls_info_tag::dialog_token, MAC_ACTION_TOKEN_OFT, MAC_ADDR_CMP, MAC_ADDR_LEN, MAC_ELTID_LINK_IDENTIFIER, MAC_INFOELT_LINK_ID_INIT_STA_OFT, MAC_INFOELT_LINK_ID_RESP_STA_OFT, sta_info_tag::tdls, and TDLS_PEER_TRAFFIC_RSP_IES_OFFSET.

Referenced by tdls_check_frame_action().

static void tdls_chsw_end_evt | ( | void * | env | ) | `[static]`

Callback called upon end of off-channel period.

This timer is started as soon as a first frame exchange has occured on the off-channel. Upon this timer expiry an unsolicited TDLS channel switch response is transmitted to indicate to the peer that we are moving back to the base channel.

Parameters:

  `[in]` | env | Pointer the VIF entry

Definition at line 494 of file tdls.c.

References PROF_TDLS_CHSW_END_TIMER_CLR, tdls_chsw_unsol_rsp_tx_cfm(), and txl_frame_send_tdls_channel_switch_rsp_frame().

Referenced by tdls_chsw_time_evt().

static void tdls_chsw_null_frame_tx_cfm | ( | void * | env,
|  | uint32_t | status |
| ) |  |  | `[static]`

Callback function indicating the completion of the QoS NULL transmission on the off channel.

If this is successful, we move back to the base channel.

Parameters:

  `[in]` | env | Pointer to the TDLS STA entry
  `[in]` | status | Status of the transmission

Definition at line 108 of file tdls.c.

References tdls_info_tag::chsw_timeout_timer, FRAME_SUCCESSFUL_TX_BIT, sta_info_tag::inst_nbr, mm_timer_clear(), PROF_TDLS_CHSW_TIMEOUT_TIMER_CLR, sta_mgmt_send_postponed_frame(), sta_info_tag::tdls, and vif_info_tab.

Referenced by tdls_chsw_time_evt().

void tdls_chsw_req_evt | ( | void * | env | ) |

Callback called upon TDLS channel switch request timer expiration.

This timer is started when channel switch is enabled and periodically transmits the TDLS Channel Switch Request frame. In case there is traffic with the AP, the transmission of TDLS Channel Switch Request frame is delayed. Next TDLS channel switch request timer time is set to 10 ms after next TBTT.

Parameters:

  `[in]` | env | Pointer the VIF entry

Referenced by tdls_chan_switch_req_handler().

static void tdls_chsw_req_tx_cfm | ( | void * | env,
|  | uint32_t | status |
| ) |  |  | `[static]`

Callback function indicating the completion of the TDLS Channel Switch Request frame transmission.

Parameters:

  `[in]` | env | Pointer to the VIF entry
  `[in]` | status | Status of the transmission

Definition at line 133 of file tdls.c.

References FRAME_SUCCESSFUL_TX_BIT, ke_state_set(), TASK_TDLS, and TDLS_BASE_CHANNEL.

static void tdls_chsw_rsp_tx_cfm | ( | void * | env,
|  | uint32_t | status |
| ) |  |  | `[static]`

Callback function indicating the completion of the TDLS Channel Switch Response frame transmission.

Parameters:

  `[in]` | env | Pointer to the VIF entry
  `[in]` | status | Status of the transmission

Definition at line 151 of file tdls.c.

References mm_remain_on_channel_req::chan, chan_roc_req(), tdls_info_tag::chsw, tdls_info_tag::chsw_time, tdls_info_tag::chsw_time_timer, mm_remain_on_channel_req::duration_ms, FRAME_SUCCESSFUL_TX_BIT, hal_machw_time(), vif_info_tag::index, INVALID_STA_IDX, ke_state_set(), ke_time(), mm_timer_set(), mm_remain_on_channel_req::op_code, PROF_TDLS_CHSW_TIME_TIMER_SET, PROF_TDLS_SWITCH_TO_OFFCH_CLR, PROF_TDLS_SWITCH_TO_OFFCH_SET, vif_info_tag::sta, sta_info_tab, TASK_TDLS, vif_info_tag::tbtt_timer, sta_info_tag::tdls, TDLS_BASE_CHANNEL, tdls_get_dt_us(), TDLS_OFF_CHANNEL, mm_timer_tag::time, vif_info_tag::u, and mm_remain_on_channel_req::vif_index.

Referenced by tdls_check_frame_action().

static void tdls_chsw_time_evt | ( | void * | env | ) | `[static]`

Callback called when considering that the channel switch is done on both sides.

This function programs the end of channel switch period timer and send a QoS NULL frame to indicate to the peer our presence on the off-channel.

Parameters:

  `[in]` | env | Pointer the VIF entry

Definition at line 514 of file tdls.c.

References mm_timer_tag::cb, vif_info_tag::chan_ctxt, tdls_chan_switch_ind::chan_ctxt_index, chan_is_on_channel(), chan_roc_req(), tdls_info_tag::chsw, tdls_info_tag::chsw_end_timer, tdls_info_tag::chsw_timeout, tdls_info_tag::chsw_timeout_timer, CO_OK, mm_timer_tag::env, chan_ctxt_tag::idx, vif_info_tag::index, INVALID_STA_IDX, KE_MSG_ALLOC, ke_msg_send(), ke_state_get(), ke_state_set(), ke_time(), me_sta_bw_nss_max_upd(), mm_timer_clear(), mm_timer_set(), mm_remain_on_channel_req::op_code, PROF_TDLS_CHSW_END_TIMER_CLR, PROF_TDLS_CHSW_END_TIMER_SET, PROF_TDLS_CHSW_NULL_FRAME_TX_CLR, PROF_TDLS_CHSW_NULL_FRAME_TX_SET, PROF_TDLS_CHSW_TIME_TIMER_CLR, PROF_TDLS_CHSW_TIMEOUT_TIMER_SET, PROF_TDLS_SWITCH_TO_BASECH_CLR, PROF_TDLS_SWITCH_TO_BASECH_SET, vif_info_tag::sta, sta_info_tab, sta_info_tag::staid, tdls_chan_switch_ind::status, TASK_TDLS, vif_info_tag::tbtt_timer, sta_info_tag::tdls, TDLS_BASE_CHANNEL, TDLS_CHAN_SWITCH_IND, tdls_chsw_end_evt(), tdls_chsw_null_frame_tx_cfm(), TDLS_OFF_CHANNEL, mm_timer_tag::time, txl_frame_send_qosnull_frame(), mac_chan_op::type, vif_info_tag::u, mm_remain_on_channel_req::vif_index, and tdls_chan_switch_ind::vif_index.

Referenced by tdls_check_frame_action().

static void tdls_chsw_timeout_evt | ( | void * | env | ) | `[static]`

Callback called upon TDLS channel switch timeout timer expiration.

This timer is started when channel switch time timer is expired and the switch to the off channel has been done. This function is called only if no successful frame exchange is performed in the timeout timer time: in this case the switch to off channel is cancelled.

Parameters:

  `[in]` | env | Pointer the VIF entry

Definition at line 593 of file tdls.c.

References chan_roc_req(), tdls_info_tag::chsw_end_timer, tdls_info_tag::chsw_time_timer, vif_info_tag::index, ke_state_set(), mm_timer_clear(), mm_remain_on_channel_req::op_code, PROF_TDLS_CHSW_END_TIMER_CLR, PROF_TDLS_CHSW_TIME_TIMER_CLR, PROF_TDLS_CHSW_TIMEOUT_TIMER_CLR, PROF_TDLS_SWITCH_TO_BASECH_CLR, PROF_TDLS_SWITCH_TO_BASECH_SET, vif_info_tag::sta, sta_info_tab, TASK_TDLS, sta_info_tag::tdls, TDLS_BASE_CHANNEL, vif_info_tag::u, and mm_remain_on_channel_req::vif_index.

Referenced by tdls_check_frame_action().

static void tdls_chsw_unsol_rsp_tx_cfm | ( | void * | env,
|  | uint32_t | status |
| ) |  |  | `[static]`

Callback function indicating the completion of the unsolicited TDLS Channel Switch Response frame transmission.

Parameters:

  `[in]` | env | Pointer to the VIF entry
  `[in]` | status | Status of the transmission

Definition at line 193 of file tdls.c.

References chan_roc_req(), vif_info_tag::index, ke_state_set(), mm_remain_on_channel_req::op_code, PROF_TDLS_SWITCH_TO_BASECH_CLR, PROF_TDLS_SWITCH_TO_BASECH_SET, TASK_TDLS, TDLS_BASE_CHANNEL, and mm_remain_on_channel_req::vif_index.

Referenced by tdls_check_peer_ps(), and tdls_chsw_end_evt().

void tdls_del_sta | ( | struct sta_info_tag * | sta | ) |

Del TDLS station.

This function clears the TDLS station parameters.

Parameters:

  `[in]` | sta | Pointer to TDLS station entry

__INLINE uint32_t tdls_get_dt_us | ( | uint32_t | next_tbtt,
|  | uint32_t | now |
| ) |  |  |

This function is used to compute the time to the next TBTT.

The actual TBTT time taken into account is actually next_tbtt - TDLS_CHSW_REQ_DELAY_US in order to consider the delay to send the channel switch request.

Parameters:

  `[in]` | next_tbtt | Next TBTT time
  `[in]` | now | Current time

Returns:
  The time to the next TBTT.

Definition at line 95 of file tdls.h.

References TDLS_CHSW_REQ_DELAY_US.

Referenced by tdls_check_frame_action(), tdls_check_tdls_channel_switch_request(), tdls_check_tdls_channel_switch_response(), tdls_chsw_rsp_tx_cfm(), and txl_frame_send_tdls_channel_switch_req_frame().

static void tdls_keep_alive_evt | ( | void * | env | ) | `[static]`

Callback called upon TDLS keep-alive timer expiration.

This timer is started when the TDLS link is set up to check if the TDLS station is still reacheable. To check the TDLS peer presence, a QoS Null frame is sent.

Parameters:

  `[in]` | env | Pointer the TDLS STA entry

Definition at line 626 of file tdls.c.

References CO_OK, tdls_info_tag::dialog_token, tdls_peer_traffic_ind_req::dialog_token, vif_info_tag::index, sta_info_tag::inst_nbr, tdls_info_tag::ka_retries, tdls_info_tag::ka_tx_req, ke_state_set(), ke_time(), tdls_info_tag::keep_alive_timer, tdls_peer_traffic_ind_req::last_sn, tdls_peer_traffic_ind_req::last_tid, sta_info_tag::mac_addr, MAC_ADDR_CPY, mm_timer_set(), tdls_peer_traffic_ind_req::peer_mac_addr, PS_MODE_ON, sta_info_tag::ps_state, tdls_info_tag::pti_timer_running, tdls_peer_traffic_ind_req::sta_idx, sta_info_tag::staid, TASK_TDLS, sta_info_tag::tdls, TDLS_KA_RETRIES, tdls_keep_alive_frame_tx_cfm(), TDLS_KEEP_ALIVE_US, tdls_peer_traffic_ind_tx_cfm(), TDLS_TRAFFIC_IND_TX, txl_frame_send_qosnull_frame(), txl_frame_send_tdls_peer_traffic_ind_frame(), tdls_peer_traffic_ind_req::vif_index, and vif_info_tab.

static void tdls_keep_alive_frame_tx_cfm | ( | void * | env,
|  | uint32_t | status |
| ) |  |  | `[static]`

Callback function indicating the completion of the QoS Null Frame.

Parameters:

  `[in]` | env | Pointer to the TDLS station entry
  `[in]` | status | Status of the transmission

Definition at line 74 of file tdls.c.

References FRAME_SUCCESSFUL_TX_BIT, sta_info_tag::inst_nbr, tdls_info_tag::ka_retries, mm_send_pktloss_ind(), RATE_CONTROL_STEPS, RC_MAX_NUM_RETRY, sta_info_tag::staid, sta_info_tag::tdls, TDLS_KA_RETRIES, tdls_info_tag::traffic_available, txl_frame_send_qosnull_frame(), and vif_info_tab.

Referenced by tdls_check_frame_action(), and tdls_keep_alive_evt().

void tdls_peer_traffic_ind_tx_cfm | ( | void * | env,
|  | uint32_t | status |
| ) |  |  |

Callback function indicating the completion of the TDLS Peer Traffic Indication Request frame transmission.

Parameters:

  `[in]` | env | TX callback parameter (in this case, pointer to TDLS peer)
  `[in]` | status | status of the transmission

Referenced by tdls_keep_alive_evt(), and tdls_peer_traffic_ind_req_handler().

static void tdls_pti_timeout_evt | ( | void * | env | ) | `[static]`

Callback called upon TDLS Peer Traffic Indication Request timeout expired.

This timer is started when the TDLS Peer Traffic Indication Request is sent. If no TDLS Peer Traffic Indication Response is received, the packet loss indication is sent to the host.

Parameters:

  `[in]` | env | Pointer the TDLS STA entry

Definition at line 676 of file tdls.c.

References sta_info_tag::inst_nbr, mm_send_pktloss_ind(), RATE_CONTROL_STEPS, RC_MAX_NUM_RETRY, sta_info_tag::staid, and vif_info_tab.

void tdls_send_chan_switch_base_ind | ( | struct chan_ctxt_tag * | roc_chan_ctxt | ) |

TDLS channel switch to base channel indication.

This function sends the TDLS_CHAN_SWITCH_BASE_IND message and sets the new state of TDLS task as TDLS_BASE_CHANNEL.

Parameters:

  `[in]` | roc_chan_ctxt | pointer to the context allocated for the remain of channel operation

Referenced by chan_conn_less_ctxt_end().

void tdls_send_peer_ps_ind | ( | struct vif_info_tag * | vif,
|  | bool | ps_on,
|  | uint8_t | sta_idx |
| ) |  |  |

TDLS peer power save indication.

This function sends the TDLS_PEER_PS_IND message.

Parameters:

  `[in]` | vif | pointer to VIF entry
  `[in]` | ps_on | Power save status
  `[in]` | sta_idx | Index of the TDLS sender station

Referenced by tdls_check_frame_action(), and tdls_check_peer_ps().