software/drivers/sd8887/src/wlan/mlan/mlan_wmm.c
/**
 *   @brief Compute the time delay in the driver queues for a given packet.
 *
 *   When the packet is received at the OS/Driver interface, the current
 *     time is set in the packet structure.  The difference between the present
 *     time and that received time is computed in this function and limited
 *     based on pre-compiled limits in the driver.
 *
 *   @param priv   Ptr to the mlan_private driver data struct
 *   @param pmbuf  Ptr to the mlan_buffer which has been previously timestamped
 *
 *   @return  Time delay of the packet in 2ms units after having limit applied
 */
@brief Compute the time delay in the driver queues for a given packet.
When the packet is received at the OS/Driver interface, the current
time is set in the packet structure.  The difference between the present
time and that received time is computed in this function and limited
based on pre-compiled limits in the driver.

@param priv   Ptr to the mlan_private driver data struct
@param pmbuf  Ptr to the mlan_buffer which has been previously timestamped

@return  Time delay of the packet in 2ms units after having limit applied
@brief Compute the time delay in the driver queues for a given packet . When the packet is received at the OS / Driver interface the current time is set in the packet structure . The difference between the present time and that received time is computed in this function and limited based on pre - compiled limits in the driver . @param priv Ptr to the mlan_private driver data struct @param pmbuf Ptr to the mlan_buffer which has been previously timestamped @return Time delay of the packet in 2ms units after having limit applied
t_u8
wlan_wmm_compute_driver_packet_delay(pmlan_private priv,
				     const pmlan_buffer pmbuf)
{
	t_u8 ret_val = 0;
	t_u32 out_ts_sec, out_ts_usec;
	t_s32 queue_delay;
	ENTER();
	priv->adapter->callbacks.moal_get_system_time(priv->adapter->
						      pmoal_handle, &out_ts_sec,
						      &out_ts_usec);
	queue_delay = (t_s32)(out_ts_sec - pmbuf->in_ts_sec) * 1000;
	queue_delay += (t_s32)(out_ts_usec - pmbuf->in_ts_usec) / 1000;
	ret_val = (t_u8)(MIN(queue_delay, priv->wmm.drv_pkt_delay_max) >> 1);
	PRINTM(MINFO, "WMM: Pkt Delay: %d ms, %d ms sent to FW\n",
	       queue_delay, ret_val);
	LEAVE();
	return ret_val;
}
t_u8 wlan_wmm_compute_driver_packet_delay ( pmlan_private priv , const pmlan_buffer pmbuf ) { t_u8 ret_val = 0 ; t_u32 out_ts_sec , out_ts_usec ; t_s32 queue_delay ; ENTER ( ) ; priv -> adapter -> callbacks . moal_get_system_time ( priv -> adapter -> pmoal_handle , & out_ts_sec , & out_ts_usec ) ; queue_delay = ( t_s32 ) ( out_ts_sec - pmbuf -> in_ts_sec ) * 1000 ; queue_delay += ( t_s32 ) ( out_ts_usec - pmbuf -> in_ts_usec ) / 1000 ; ret_val = ( t_u8 ) ( MIN ( queue_delay , priv -> wmm . drv_pkt_delay_max ) >> 1 ) ; PRINTM ( MINFO , " \n " , queue_delay , ret_val ) ; LEAVE ( ) ; return ret_val ; }
@brief Compute the time delay in the driver queues for a given packet.
@brief Compute the time delay in the driver queues for a given packet .
/*
	 * Queue delay is passed as a uint8 in units of 2ms (ms shifted
	 *  by 1). Min value (other than 0) is therefore 2ms, max is 510ms.
	 *
	 * Pass max value if queue_delay is beyond the uint8 range
	 */