📄 defer exit execs
字号:
/* Lock the mutex that serializes accessing the roaming related */
/* information of this MAC. */
op_prg_mt_mutex_lock (roam_state_ptr->roam_info_mutex, 0);
/* Store the previous receiver status before processing the */
/* interrupt, which may change the status information. */
pre_rx_status = wlan_flags->receiver_busy;
/* Call the interrupt processing routine for each interrupt. */
wlan_interrupts_process ();
if (wlan_flags->ignore_busy == OPC_FALSE)
{
/* If the receiver is busy while the station is deferring */
/* then clear the self interrupt. As there will be a new self */
/* interrupt generated once the receiver becomes idle again. */
if (RECEIVER_BUSY_HIGH && (op_ev_valid (deference_evh) == OPC_TRUE))
{
op_ev_cancel (deference_evh);
}
/* Update the value of the temporary bad packet flag, which is */
/* used in the FRAME_RCVD macro below. */
bad_packet_rcvd = wlan_flags->rcvd_bad_packet;
/* If the receiver became idle again schedule the end of the */
/* deference. */
if (RECEIVER_BUSY_LOW && pre_rx_status != OPC_FALSE)
{
// printf("The receiver became idle, new deference in Defer Exit for node <%d> \n", my_address);
wlan_schedule_deference ();
}
/* While we were deferring, if we receive a frame which */
/* requires a response, or we had used EIFS due to a previous */
/* error, then we need to re-schedule our end of */
/* deference interrupt, since the deference time for response */
/* frames is shorter. Similarly, we need to re-schedule it if */
/* the received frame made us set our NAV to a higher value. */
else if (FRAME_RCVD &&
(fresp_to_send != WlanC_None || wlan_flags->nav_updated == OPC_TRUE ||
((wlan_flags->wait_eifs_dur == OPC_TRUE && IN_CFP) || wlan_flags->polled == OPC_TRUE)) &&
op_ev_valid (deference_evh) == OPC_TRUE)
{
/* Cancel the current event and schedule a new one. */
op_ev_cancel (deference_evh);
wlan_schedule_deference ();
}
/* Similarly if we received a self interrupt that indicates the */
/* time to send a Beacon frame, and if we are deferring for the */
/* transmission of a frame that is different then ACK frame, */
/* then we need to reschedule the deference interrupt since the */
/* Beacon frame will have priority over that frame, and a */
/* different waiting time for deference. */
else if (intrpt_type == OPC_INTRPT_SELF && intrpt_code == WlanC_Beacon_Tx_Time && fresp_to_send != WlanC_Ack &&
op_ev_valid (deference_evh) == OPC_TRUE)
{
/* Cancel the current event and schedule a new one. */
op_ev_cancel (deference_evh);
wlan_schedule_deference ();
}
}
#ifndef OPD_NO_DEBUG
// energy calculation check
if ((op_sim_time() > wsn_test_time) && (my_address == wsn_test_address || my_address == wsn_test_address_2) )
if (DEFERENCE_OFF)
printf("Node <%d> is exiting DEFER and NOT calculating E before DEFERENCE_OFF\n", my_address);
else if (SLEEP_NOW)
printf("Node <%d> is exiting DEFER and IS calculating E before SLEEP_NOW\n", my_address);
else if (IDLE_AFTER_CFP)
printf("Node <%d> is exiting Backoff and NOT calculating E before going to IDLE_AFTER_CFP\n", my_address);
#endif
// mib added 1 Dec 2005: OPNET bug
// In a VERY infrequent case (1/16E6 events in my case), the bad packet flag
// does not clear during transmissions which start at the same time. A positive
// flag traps a node next time it enters Xmit state, never allows it to send its packet
wlan_flags->rcvd_bad_packet = OPC_FALSE;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -