struct txq_entry_t *tqe;
wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
unsigned long flags;
+
p->os_func.os_spin_lock(p->txq_spinlock, &flags);
if (p->txq_head) {
tqe = p->txq_head;
{
wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
unsigned long flags;
+
p->os_func.os_spin_lock(p->txq_spinlock, &flags);
p->os_func.os_spin_unlock(p->txq_spinlock, &flags);
int i;
wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
unsigned long flags;
+
p->os_func.os_spin_lock(p->txq_spinlock, &flags);
eth_hdr_ptr = &buffer[0];
if (protocol == 0x06) {
uint8_t *tcp_hdr_ptr;
uint32_t IHL, Total_Length, Data_offset;
+
tcp_hdr_ptr = &ip_hdr_ptr[IP_HDR_LEN];
IHL = (ip_hdr_ptr[0] & 0xf) << 2;
Total_Length = (((uint32_t)ip_hdr_ptr[2]) << 8) + ((uint32_t)ip_hdr_ptr[3]);
Data_offset = (((uint32_t)tcp_hdr_ptr[12] & 0xf0) >> 2);
if (Total_Length == (IHL + Data_offset)) { /*we want to recognize the clear Acks(packet only carry Ack infos not with data) so data size must be equal zero*/
uint32_t seq_no, Ack_no;
+
seq_no = (((uint32_t)tcp_hdr_ptr[4]) << 24) + (((uint32_t)tcp_hdr_ptr[5]) << 16) + (((uint32_t)tcp_hdr_ptr[6]) << 8) + ((uint32_t)tcp_hdr_ptr[7]);
Ack_no = (((uint32_t)tcp_hdr_ptr[8]) << 24) + (((uint32_t)tcp_hdr_ptr[9]) << 16) + (((uint32_t)tcp_hdr_ptr[10]) << 8) + ((uint32_t)tcp_hdr_ptr[11]);
for (i = PendingAcks_arrBase; i < (PendingAcks_arrBase + Pending_Acks); i++) {
if (Pending_Acks_info[i].ack_num < Acks_keep_track_info[Pending_Acks_info[i].Session_index].Bigger_Ack_num) {
struct txq_entry_t *tqe;
+
PRINT_D(TCP_ENH, "DROP ACK: %u\n", Pending_Acks_info[i].ack_num);
tqe = Pending_Acks_info[i].txqe;
if (tqe) {
tqe->status = 1; /* mark the packet send */
if (tqe->tx_complete_func)
tqe->tx_complete_func(tqe->priv, tqe->status);
- p->os_func.os_free(tqe);
+ kfree(tqe);
Dropped++;
}
}
return 0;
}
- tqe = (struct txq_entry_t *)p->os_func.os_malloc_atomic(sizeof(struct txq_entry_t));
+ tqe = kmalloc(sizeof(struct txq_entry_t), GFP_ATOMIC);
if (tqe == NULL) {
PRINT_ER("Failed to allocate memory\n");
return 0;
if (p->quit)
return 0;
- tqe = (struct txq_entry_t *)p->os_func.os_malloc_atomic(sizeof(struct txq_entry_t));
+ tqe = kmalloc(sizeof(struct txq_entry_t), GFP_ATOMIC);
if (tqe == NULL)
return 0;
if (p->quit)
return 0;
- tqe = (struct txq_entry_t *)p->os_func.os_malloc_atomic(sizeof(struct txq_entry_t));
+ tqe = kmalloc(sizeof(struct txq_entry_t), GFP_KERNEL);
if (tqe == NULL)
return 0;
if (p->quit)
return 0;
- tqe = (struct txq_entry_t *)p->os_func.os_malloc_atomic(sizeof(struct txq_entry_t));
+ tqe = kmalloc(sizeof(struct txq_entry_t), GFP_ATOMIC);
if (tqe == NULL)
return 0;
if (wilc_get_chipid(false) >= 0x1002b0) {
/* Enable PALDO back right after wakeup */
uint32_t val32;
+
g_wlan.hif_func.hif_read_reg(0x1e1c, &val32);
val32 |= (1 << 6);
g_wlan.hif_func.hif_write_reg(0x1e1c, val32);
INLINE void chip_wakeup(void)
{
uint32_t reg, trials = 0;
+
do {
if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) {
g_wlan.hif_func.hif_read_reg(1, ®);
if (wilc_get_chipid(false) >= 0x1002b0) {
/* Enable PALDO back right after wakeup */
uint32_t val32;
+
g_wlan.hif_func.hif_read_reg(0x1e1c, &val32);
val32 |= (1 << 6);
g_wlan.hif_func.hif_write_reg(0x1e1c, val32);
int counter;
int timeout;
uint32_t vmm_table[WILC_VMM_TBL_SIZE];
+
p->txq_exit = 0;
do {
if (p->quit)
/* and WILC_DATA_PKT_MAC_HDR*/
else if (tqe->type == WILC_NET_PKT) {
char *pBSSID = ((struct tx_complete_data *)(tqe->priv))->pBssid;
+
buffer_offset = ETH_ETHERNET_HDR_OFFSET;
/* copy the bssid at the sart of the buffer */
memcpy(&txb[offset + 4], pBSSID, 6);
Pending_Acks_info[tqe->tcp_PendingAck_index].txqe = NULL;
}
#endif
- p->os_func.os_free(tqe);
+ kfree(tqe);
} else {
break;
}
uint32_t header;
uint32_t pkt_len, pkt_offset, tp_len;
int is_cfg_packet;
+
PRINT_D(RX_DBG, "In the 2nd do-while\n");
memcpy(&header, &buffer[offset], 4);
#ifdef BIG_ENDIAN
#ifndef MEMORY_STATIC
- if (buffer != NULL)
- p->os_func.os_free((void *)buffer);
+ kfree(buffer);
#endif
- if (rqe != NULL)
- p->os_func.os_free((void *)rqe);
+ kfree(rqe);
if (has_packet) {
if (p->net_func.rx_complete)
}
#else
- buffer = p->os_func.os_malloc(size);
+ buffer = kmalloc(size, GFP_KERNEL);
if (buffer == NULL) {
wilc_debug(N_ERR, "[wilc isr]: fail alloc host memory...drop the packets (%d)\n", size);
usleep_range(100 * 1000, 100 * 1000);
/**
* add to rx queue
**/
- rqe = (struct rxq_entry_t *)p->os_func.os_malloc(sizeof(struct rxq_entry_t));
+ rqe = kmalloc(sizeof(struct rxq_entry_t), GFP_KERNEL);
if (rqe != NULL) {
rqe->buffer = buffer;
rqe->buffer_size = size;
}
} else {
#ifndef MEMORY_STATIC
- if (buffer != NULL)
- p->os_func.os_free(buffer);
+ kfree(buffer);
#endif
}
}
blksz = (1ul << 12); /* Bug 4703: 4KB Good enough size for most platforms = PAGE_SIZE. */
/* Allocate a DMA coherent buffer. */
-#if (defined WILC_PREALLOC_AT_BOOT)
- {
- extern void *get_fw_buffer(void);
- dma_buffer = (uint8_t *)get_fw_buffer();
- PRINT_D(TX_DBG, "fw_buffer = 0x%x\n", dma_buffer);
- }
-#else
- dma_buffer = (uint8_t *)g_wlan.os_func.os_malloc(blksz);
-#endif
+ dma_buffer = kmalloc(blksz, GFP_KERNEL);
if (dma_buffer == NULL) {
/*EIO 5*/
ret = -5;
_fail_:
-#if (defined WILC_PREALLOC_AT_BOOT)
-
-#else
- if (dma_buffer)
- g_wlan.os_func.os_free(dma_buffer);
-#endif
+ kfree(dma_buffer);
_fail_1:
{
wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+
acquire_bus(ACQUIRE_AND_WAKEUP);
p->hif_func.hif_write_reg(WILC_GLB_RESET_0, 0x0);
release_bus(RELEASE_ONLY);
break;
if (tqe->tx_complete_func)
tqe->tx_complete_func(tqe->priv, 0);
- p->os_func.os_free((void *)tqe);
+ kfree(tqe);
} while (1);
do {
if (rqe == NULL)
break;
#ifdef MEMORY_DYNAMIC
- p->os_func.os_free((void *)tqe->buffer);
+ kfree(tqe->buffer);
#endif
- p->os_func.os_free((void *)rqe);
+ kfree(rqe);
} while (1);
/**
* clean up buffer
**/
-#if (defined WILC_PREALLOC_AT_BOOT)
-
-#else
#ifdef MEMORY_STATIC
- if (p->rx_buffer) {
- p->os_func.os_free(p->rx_buffer);
- p->rx_buffer = NULL;
- }
+ kfree(p->rx_buffer);
+ p->rx_buffer = NULL;
#endif
- if (p->tx_buffer) {
- p->os_func.os_free(p->tx_buffer);
- p->tx_buffer = NULL;
- }
-#endif
+ kfree(p->tx_buffer);
acquire_bus(ACQUIRE_AND_WAKEUP);
/**
* alloc tx, rx buffer
**/
-#if (defined WILC_PREALLOC_AT_BOOT)
- extern void *get_tx_buffer(void);
- extern void *get_rx_buffer(void);
-
- PRINT_D(TX_DBG, "malloc before, g_wlan.tx_buffer = 0x%x, g_wlan.rx_buffer = 0x%x\n", g_wlan.tx_buffer, g_wlan.rx_buffer);
-#endif
-
-
-
if (g_wlan.tx_buffer == NULL)
-#if (defined WILC_PREALLOC_AT_BOOT)
- g_wlan.tx_buffer = (uint8_t *)get_tx_buffer();
-#else
- g_wlan.tx_buffer = (uint8_t *)g_wlan.os_func.os_malloc(g_wlan.tx_buffer_size);
-#endif
+ g_wlan.tx_buffer = kmalloc(g_wlan.tx_buffer_size, GFP_KERNEL);
PRINT_D(TX_DBG, "g_wlan.tx_buffer = %p\n", g_wlan.tx_buffer);
if (g_wlan.tx_buffer == NULL) {
/* rx_buffer is not used unless we activate USE_MEM STATIC which is not applicable, allocating such memory is useless*/
#if defined (MEMORY_STATIC)
if (g_wlan.rx_buffer == NULL)
- #if (defined WILC_PREALLOC_AT_BOOT)
- g_wlan.rx_buffer = (uint8_t *)get_rx_buffer();
- #else
- g_wlan.rx_buffer = (uint8_t *)g_wlan.os_func.os_malloc(g_wlan.rx_buffer_size);
- #endif
+ g_wlan.rx_buffer = kmalloc(g_wlan.rx_buffer_size, GFP_KERNEL);
PRINT_D(TX_DBG, "g_wlan.rx_buffer =%p\n", g_wlan.rx_buffer);
if (g_wlan.rx_buffer == NULL) {
/* ENOBUFS 105 */
_fail_:
-#if (defined WILC_PREALLOC_AT_BOOT)
-
-#else
#ifdef MEMORY_STATIC
- if (g_wlan.rx_buffer) {
- g_wlan.os_func.os_free(g_wlan.rx_buffer);
- g_wlan.rx_buffer = NULL;
- }
+ kfree(g_wlan.rx_buffer);
+ g_wlan.rx_buffer = NULL;
#endif
- if (g_wlan.tx_buffer) {
- g_wlan.os_func.os_free(g_wlan.tx_buffer);
- g_wlan.tx_buffer = NULL;
- }
-#endif
+ kfree(g_wlan.tx_buffer);
+ g_wlan.tx_buffer = NULL;
#if defined(PLAT_RK3026_TCHIP) /* AMR : 0422 RK3026 Crash issue */
if (!g_wilc_initialized)