Esempio n. 1
0
/*-----------------------------------------------------------------------------
 * Function:    cmpk_message_handle_rx()
 *
 * Overview:    In the function, we will capture different RX command packet
 *				info. Every RX command packet element has different message
 *				length and meaning in content. We only support three type of RX
 *				command packet now. Please refer to document
 *				ws-06-0063-rtl8190-command-packet-specification.
 *
 * Input:       NONE
 *
 * Output:      NONE
 *
 * Return:      NONE
 *
 * Revised History:
 *  When		Who		Remark
 *  05/06/2008	amy		Create Version 0 porting from windows code.
 *
 *---------------------------------------------------------------------------*/
extern	u32
cmpk_message_handle_rx(
	struct net_device *dev,
	struct ieee80211_rx_stats *pstats)
{
//	u32			debug_level = DBG_LOUD;
	struct r8192_priv *priv = ieee80211_priv(dev);
	int			total_length;
	u8			cmd_length, exe_cnt = 0;
	u8			element_id;
	u8			*pcmd_buff;

	/* 0. Check inpt arguments. If is is a command queue message or pointer is
	      null. */
	if (/*(prfd->queue_id != CMPK_RX_QUEUE_ID) || */(pstats== NULL))
	{
		/* Print error message. */
		/*RT_TRACE(COMP_SEND, DebugLevel,
				("\n\r[CMPK]-->Err queue id or pointer"));*/
		return 0;	/* This is not a command packet. */
	}

	/* 1. Read received command packet message length from RFD. */
	total_length = pstats->Length;

	/* 2. Read virtual address from RFD. */
	pcmd_buff = pstats->virtual_address;

	/* 3. Read command pakcet element id and length. */
	element_id = pcmd_buff[0];
	/*RT_TRACE(COMP_SEND, DebugLevel,
			("\n\r[CMPK]-->element ID=%d Len=%d", element_id, total_length));*/

	/* 4. Check every received command packet conent according to different
	      element type. Because FW may aggregate RX command packet to minimize
	      transmit time between DRV and FW.*/
	// Add a counter to prevent to locked in the loop too long
	while (total_length > 0 || exe_cnt++ >100)
	{
		/* 2007/01/17 MH We support aggregation of different cmd in the same packet. */
		element_id = pcmd_buff[0];

		switch(element_id)
		{
			case RX_TX_FEEDBACK:
				cmpk_handle_tx_feedback (dev, pcmd_buff);
				cmd_length = CMPK_RX_TX_FB_SIZE;
				break;

			case RX_INTERRUPT_STATUS:
				cmpk_handle_interrupt_status(dev, pcmd_buff);
				cmd_length = sizeof(cmpk_intr_sta_t);
				break;

			case BOTH_QUERY_CONFIG:
				cmpk_handle_query_config_rx(dev, pcmd_buff);
				cmd_length = CMPK_BOTH_QUERY_CONFIG_SIZE;
				break;

			case RX_TX_STATUS:
				cmpk_handle_tx_status(dev, pcmd_buff);
				cmd_length = CMPK_RX_TX_STS_SIZE;
				break;

			case RX_TX_PER_PKT_FEEDBACK:
				// You must at lease add a switch case element here,
				// Otherwise, we will jump to default case.
				//DbgPrint("CCX Test\r\n");
				cmd_length = CMPK_RX_TX_FB_SIZE;
				break;

			case RX_TX_RATE_HISTORY:
				//DbgPrint(" rx tx rate history\r\n");
				cmpk_handle_tx_rate_history(dev, pcmd_buff);
				cmd_length = CMPK_TX_RAHIS_SIZE;
				break;

			default:

				RT_TRACE(COMP_ERR, "---->cmpk_message_handle_rx():unknow CMD Element\n");
				return 1;	/* This is a command packet. */
		}
		// 2007/01/22 MH Display received rx command packet info.
		//cmpk_Display_Message(cmd_length, pcmd_buff);

		// 2007/01/22 MH Add to display tx statistic.
		//cmpk_DisplayTxStatistic(pAdapter);

		/* 2007/03/09 MH Collect sidderent cmd element pkt num. */
		priv->stats.rxcmdpkt[element_id]++;

		total_length -= cmd_length;
		pcmd_buff    += cmd_length;
	}	/* while (total_length > 0) */
	return	1;	/* This is a command packet. */

}	/* CMPK_Message_Handle_Rx */
Esempio n. 2
0
u32 cmpk_message_handle_rx(struct net_device *dev,
			   struct rtllib_rx_stats *pstats)
{
	int			total_length;
	u8			cmd_length, exe_cnt = 0;
	u8			element_id;
	u8			*pcmd_buff;

	RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx()\n");

	if (pstats == NULL)
		return 0;

	total_length = pstats->Length;

	pcmd_buff = pstats->virtual_address;

	element_id = pcmd_buff[0];

	while (total_length > 0 || exe_cnt++ > 100) {
		element_id = pcmd_buff[0];

		switch (element_id) {
		case RX_TX_FEEDBACK:
			RT_TRACE(COMP_CMDPKT,
				 "---->cmpk_message_handle_rx():RX_TX_FEEDBACK\n");
			cmpk_handle_tx_feedback(dev, pcmd_buff);
			cmd_length = CMPK_RX_TX_FB_SIZE;
			break;
		case RX_INTERRUPT_STATUS:
			RT_TRACE(COMP_CMDPKT,
				 "---->cmpk_message_handle_rx():RX_INTERRUPT_STATUS\n");
			cmpk_handle_interrupt_status(dev, pcmd_buff);
			cmd_length = sizeof(struct cmpk_intr_sta);
			break;
		case BOTH_QUERY_CONFIG:
			RT_TRACE(COMP_CMDPKT,
				 "---->cmpk_message_handle_rx():BOTH_QUERY_CONFIG\n");
			cmpk_handle_query_config_rx(dev, pcmd_buff);
			cmd_length = CMPK_BOTH_QUERY_CONFIG_SIZE;
			break;
		case RX_TX_STATUS:
			RT_TRACE(COMP_CMDPKT,
				 "---->cmpk_message_handle_rx():RX_TX_STATUS\n");
			cmpk_handle_tx_status(dev, pcmd_buff);
			cmd_length = CMPK_RX_TX_STS_SIZE;
			break;
		case RX_TX_PER_PKT_FEEDBACK:
			RT_TRACE(COMP_CMDPKT,
				 "---->cmpk_message_handle_rx():RX_TX_PER_PKT_FEEDBACK\n");
			cmd_length = CMPK_RX_TX_FB_SIZE;
			break;
		case RX_TX_RATE_HISTORY:
			RT_TRACE(COMP_CMDPKT,
				 "---->cmpk_message_handle_rx():RX_TX_HISTORY\n");
			cmpk_handle_tx_rate_history(dev, pcmd_buff);
			cmd_length = CMPK_TX_RAHIS_SIZE;
			break;
		default:

			RT_TRACE(COMP_CMDPKT,
				 "---->cmpk_message_handle_rx():unknown CMD Element\n");
			return 1;
		}

		total_length -= cmd_length;
		pcmd_buff    += cmd_length;
	}
	return	1;
}
u32 cmpk_message_handle_rx(struct net_device *dev,
			   struct rtllib_rx_stats *pstats)
{
	struct r8192_priv *priv = rtllib_priv(dev);
	int			total_length;
	u8			cmd_length, exe_cnt = 0;
	u8			element_id;
	u8			*pcmd_buff;

	RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx()\n");

	if (pstats == NULL) {
		/* Print error message. */
		/*RT_TRACE(COMP_SEND, DebugLevel,
				("\n\r[CMPK]-->Err queue id or pointer"));*/
		return 0;
	}

	total_length = pstats->Length;

	pcmd_buff = pstats->virtual_address;

	element_id = pcmd_buff[0];

	while (total_length > 0 || exe_cnt++ > 100) {
		element_id = pcmd_buff[0];

		switch (element_id) {
		case RX_TX_FEEDBACK:
			RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():"
				 "RX_TX_FEEDBACK\n");
			cmpk_handle_tx_feedback(dev, pcmd_buff);
			cmd_length = CMPK_RX_TX_FB_SIZE;
			break;
		case RX_INTERRUPT_STATUS:
			RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():"
				 "RX_INTERRUPT_STATUS\n");
			cmpk_handle_interrupt_status(dev, pcmd_buff);
			cmd_length = sizeof(struct cmpk_intr_sta);
			break;
		case BOTH_QUERY_CONFIG:
			RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():"
				 "BOTH_QUERY_CONFIG\n");
			cmpk_handle_query_config_rx(dev, pcmd_buff);
			cmd_length = CMPK_BOTH_QUERY_CONFIG_SIZE;
			break;
		case RX_TX_STATUS:
			RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():"
				 "RX_TX_STATUS\n");
			cmpk_handle_tx_status(dev, pcmd_buff);
			cmd_length = CMPK_RX_TX_STS_SIZE;
			break;
		case RX_TX_PER_PKT_FEEDBACK:
			RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():"
				 "RX_TX_PER_PKT_FEEDBACK\n");
			cmd_length = CMPK_RX_TX_FB_SIZE;
			break;
		case RX_TX_RATE_HISTORY:
			RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():"
				 "RX_TX_HISTORY\n");
			cmpk_handle_tx_rate_history(dev, pcmd_buff);
			cmd_length = CMPK_TX_RAHIS_SIZE;
			break;
		default:

			RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():"
				 "unknow CMD Element\n");
			return 1;
		}

		priv->stats.rxcmdpkt[element_id]++;

		total_length -= cmd_length;
		pcmd_buff    += cmd_length;
	}
	return	1;
}
Esempio n. 4
0
/*-----------------------------------------------------------------------------
 * Function:    cmpk_message_handle_rx()
 *
 * Overview:    In the function, we will capture different RX command packet
 *		info. Every RX command packet element has different message
 *		length and meaning in content. We only support three type of RX
 *		command packet now. Please refer to document
 *		ws-06-0063-rtl8190-command-packet-specification.
 *
 * Input:       NONE
 *
 * Output:      NONE
 *
 * Return:      NONE
 *
 * Revised History:
 *  When		Who	Remark
 *  05/06/2008		amy	Create Version 0 porting from windows code.
 *
 *---------------------------------------------------------------------------
 */
u32 cmpk_message_handle_rx(struct net_device *dev,
			   struct ieee80211_rx_stats *pstats)
{
	int			total_length;
	u8			cmd_length, exe_cnt = 0;
	u8			element_id;
	u8			*pcmd_buff;

	/* 0. Check inpt arguments. It is a command queue message or
	 * pointer is null.
	 */
	if (pstats == NULL)
		return 0;	/* This is not a command packet. */

	/* 1. Read received command packet message length from RFD. */
	total_length = pstats->Length;

	/* 2. Read virtual address from RFD. */
	pcmd_buff = pstats->virtual_address;

	/* 3. Read command packet element id and length. */
	element_id = pcmd_buff[0];

	/* 4. Check every received command packet content according to different
	 *    element type. Because FW may aggregate RX command packet to
	 *    minimize transmit time between DRV and FW.
	 */
	/* Add a counter to prevent the lock in the loop from being held too
	 * long
	 */
	while (total_length > 0 && exe_cnt++ < 100) {
		/* We support aggregation of different cmd in the same packet */
		element_id = pcmd_buff[0];

		switch (element_id) {
		case RX_TX_FEEDBACK:
			cmpk_handle_tx_feedback(dev, pcmd_buff);
			cmd_length = CMPK_RX_TX_FB_SIZE;
			break;

		case RX_INTERRUPT_STATUS:
			cmpk_handle_interrupt_status(dev, pcmd_buff);
			cmd_length = sizeof(cmpk_intr_sta_t);
			break;

		case BOTH_QUERY_CONFIG:
			cmpk_handle_query_config_rx(dev, pcmd_buff);
			cmd_length = CMPK_BOTH_QUERY_CONFIG_SIZE;
			break;

		case RX_TX_STATUS:
			cmpk_handle_tx_status(dev, pcmd_buff);
			cmd_length = CMPK_RX_TX_STS_SIZE;
			break;

		case RX_TX_PER_PKT_FEEDBACK:
			/* You must at lease add a switch case element here,
			 * Otherwise, we will jump to default case.
			 */
			cmd_length = CMPK_RX_TX_FB_SIZE;
			break;

		case RX_TX_RATE_HISTORY:
			cmpk_handle_tx_rate_history(dev, pcmd_buff);
			cmd_length = CMPK_TX_RAHIS_SIZE;
			break;

		default:

			RT_TRACE(COMP_ERR, "---->%s():unknown CMD Element\n",
				 __func__);
			return 1;	/* This is a command packet. */
		}

		total_length -= cmd_length;
		pcmd_buff    += cmd_length;
	}
	return	1;	/* This is a command packet. */
}