# /space/home/slher/rel/Beken/v6_4_5/macsw/ip/lmac/src/p2p/p2p.c File Reference

Wi-Fi Peer-to-Peer (P2P) Management. More...

`#include "p2p.h"`
`#include "mac_ie.h"`
`#include "ps.h"`
`#include "mm.h"`
`#include "mm_bcn.h"`
`#include "vif_mgmt.h"`
`#include "td.h"`

Go to the source code of this file.

## Functions
__INLINE void | p2p_go_noa_get_intv_cnt (struct p2p_noa_info_tag *noa)
| Compute the number of NOA absence periods before updating Start Time field in NOA attribute.
static void | p2p_cli_noa_cancel (struct p2p_noa_info_tag *noa)
| Cancel NOA procedure on P2P client side.
static uint32_t | p2p_local_2_peer_time (struct vif_info_tag *vif, uint32_t local_time)
| Convert local (P2P CLI) time to peer (P2P GO) time.
static uint32_t | p2p_peer_2_local_time (struct vif_info_tag *vif, uint32_t peer_time)
| Convert peer (P2P GO) time to local (P2P CLI) time.
static uint32_t | p2p_att_find (uint32_t ie_addr, uint16_t ie_total_len, uint8_t att_id)
| Look for specific attribute inside a provided information element (IE).
static void | p2p_goto_idle_cb (void)
| Callback called once system entered in IDLE state before peer device absence.
static bool | p2p_noa_wait_end_abs (struct p2p_info_tag *p2p, uint8_t *low_noa_count)
| Check if at least one NOA absence is currently in progress.
static void | p2p_update_noa_presence_date (struct p2p_info_tag *p2p)
| Update P2P GO next absence and presence date.
static void | p2p_update_go_ps_state (struct p2p_info_tag *p2p)
| Update Power Save status of the GO.
static void | p2p_noa_timer_prog (struct p2p_noa_info_tag *noa, uint32_t time)
| Program the NOA Timer for a given P2P entry.
static void | p2p_noa_timer_end (void *env)
| Function called upon NOA timer expiration.
static void | p2p_oppps_timer_end (void *env)
| Callback for Opportunistic Power Save timer.
static void | p2p_go_send_noa_upd_ind (struct p2p_info_tag *p2p, uint8_t noa_instance)
| Send a MM_P2P_NOA_UPD_IND to the host so that it can maintain a status about the NoA scheme currently applied locally.
static uint8_t | p2p_go_get_noa_inst (struct p2p_info_tag *p2p)
| Get the number of NOA timer currently configured.
static uint32_t | p2p_cli_noa_get_abs_time (struct p2p_noa_info_tag *noa, uint8_t vif_index, uint32_t start_time, uint32_t tsf_peer)
| A frame containing a Notice of Absence attribute can be received after the indicated start time.
static bool | p2p_cli_noa_start (struct p2p_noa_info_tag *noa, uint8_t vif_index, uint32_t start_time, uint32_t tsf_peer)
| Start NOA procedure on P2P client side.
static void | p2p_cli_noa_handle_att (uint8_t p2p_index, uint32_t a_noa_att, uint32_t tsf_peer)
| Handle the received NOA attribute.
void | p2p_init (void)
| Initialize the p2p module.
uint8_t | p2p_create (uint8_t vif_index, uint8_t role)
| Link a VIF entry with a P2P entry.
void | p2p_cancel (uint8_t p2p_index, bool vif_del)
| Release a P2P structure.
void | p2p_set_vif_state (struct vif_info_tag *vif, bool active)
| Update the P2P entry parameters when VIF state is updated.
bool | p2p_is_present (uint8_t p2p_index)
| Check GO device presence.
bool | p2p_go_get_next_NOA_date (struct vif_info_tag *vif, uint32_t *next_p2p_present, uint32_t *next_p2p_absent)
| Get next presence/absence date for a p2p GO interface.
uint32_t | p2p_go_get_next_noa_end_date (struct vif_info_tag *vif, uint8_t noa_inst)
| Get end of the next NOA iteration.
void | p2p_tbtt_handle (struct vif_info_tag *vif, uint32_t tbtt_time)
| Handle P2P operation to be performed on STA_TBBT or AP_TBBT event.
void | p2p_bcn_evt_handle (struct vif_info_tag *vif)
| Handle P2P operation to be performed on Beacon reception.
uint32_t | p2p_cli_bcn_check_noa (struct vif_info_tag *vif, struct rx_pbd *pyld_desc, struct rx_dmadesc *dma_hdrdesc)
| Look for P2P NOA Attribute inside a received beacon.
void | p2p_cli_handle_action (struct vif_info_tag *vif, uint32_t a_frame, uint16_t length, uint32_t rx_tsf)
| Look for P2P NOA Attribute inside a received action frame.
bool | p2p_go_check_ps_mode (void)
| Check P2P PS mode.
void | p2p_go_td_evt (uint8_t vif_index, uint8_t new_status)
| Handle update of Traffic status generated by the Traffic Detection module.
void | p2p_go_oppps_start (struct vif_info_tag *vif, uint8_t ctw)
| Start Opportunistic Power Save mode on P2P GO side.
void | p2p_go_oppps_stop (struct vif_info_tag *vif)
| Stop Opportunistic Power Save mode on P2P GO side.
void | p2p_go_ps_state_update (struct vif_info_tag *vif)
| Check if GO PS state has to be updated once it is known that a peer CLI device is entered in Doze mode (used if OppPS has been enabled).
uint8_t | p2p_go_noa_start (struct vif_info_tag *vif, bool concurrent, bool dyn_noa, uint8_t counter, uint32_t intv_us, uint32_t dur_us, uint32_t start_time)
| Start NOA procedure on P2P GO side.
uint8_t | p2p_go_noa_stop (struct vif_info_tag *vif, uint8_t noa_inst, bool host_req)
| Stop NOA procedure on P2P GO side.
void | p2p_go_noa_concurrent_move (struct vif_info_tag *vif, int32_t offset)
| Shift concurrent NOA with a given offset.
uint8_t | p2p_go_bcn_get_noa_len (uint8_t p2p_index)
| Return the additional length to consider in the beacon for the NOA attribute.
void | p2p_go_bcn_init_noa_pyld (uint32_t a_noa_ie_elt)
| Initialize an NOA attribute payload buffer (attribute ID, attribute length, .
void | p2p_go_bcn_upd_noa_pyld (uint8_t p2p_index, uint32_t a_noa_ie_elt)
| Trigger an update of the provided NOA attribute payload buffer.
void | p2p_go_bcn_op_done (uint8_t p2p_index, uint8_t operation)
| Callback to be used by mm_bcn module once operation required by p2p module has been done (ADD, REMOVE, UPDATE).
void | p2p_go_pre_tbtt (struct vif_info_tag *vif)
| When HW is in doze mode, it does not trigger the TBTT interrupt anymore.
## Variables
struct p2p_env_tag | p2p_env
| Global p2p status.
struct p2p_info_tag | p2p_info_tab [NX_P2P_VIF_MAX]
| Global table with all P2P entries.

## Detailed Description

Wi-Fi Peer-to-Peer (P2P) Management.

Copyright (C) RivieraWaves 2011-2019

Definition in file p2p.c.