/* Send pending packets to the WILC under HIF thread context. 
Support and FAQ: visit  */
void wilc_netif_tx_from_queue(hif_msg_t *msg)
/* Send pending packets to the WILC under HIF thread context. 
Support and FAQ: visit  */
void wilc_netif_tx_from_queue(hif_msg_t *msg)
{
	struct pbuf *p = (struct pbuf *)msg->pbuf;
	uint32_t tries = 0;
	sint8 err;
	for (;;) {
		if (msg->id == MSG_TX_STA) {
			err = m2m_wifi_send_ethernet_pkt((uint8*)(msg->payload), msg->payload_size, STATION_INTERFACE);
			} else {
			err = m2m_wifi_send_ethernet_pkt((uint8*)(msg->payload), msg->payload_size, AP_INTERFACE);
	    }
		if (M2M_SUCCESS == err) {
			break;
		} else {
			if (++tries == 100) {
				break;
			}
			vTaskDelay(1);
		}
	}
	if (p)
		pbuf_free(p);
}