提交 082e889b 编写于 作者: S Stephen Hemminger

beceem: remove OS wrapper library

Use native kernel functions for kmalloc/kfree directly
Signed-off-by: NStephen Hemminger <shemminger@vyatta.com>
上级 c5113e3c
...@@ -50,7 +50,7 @@ reply_to_arp_request(struct sk_buff *skb) ...@@ -50,7 +50,7 @@ reply_to_arp_request(struct sk_buff *skb)
{ {
if(memcmp(pethhdr->h_source, Adapter->dev->dev_addr, ETH_ALEN)) if(memcmp(pethhdr->h_source, Adapter->dev->dev_addr, ETH_ALEN))
{ {
bcm_kfree_skb(skb); dev_kfree_skb(skb);
return; return;
} }
} }
......
...@@ -93,7 +93,7 @@ static int bcm_char_release(struct inode *inode, struct file *filp) ...@@ -93,7 +93,7 @@ static int bcm_char_release(struct inode *inode, struct file *filp)
/*Stop Queuing the control response Packets*/ /*Stop Queuing the control response Packets*/
atomic_dec(&Adapter->ApplicationRunning); atomic_dec(&Adapter->ApplicationRunning);
bcm_kfree(pTarang); kfree(pTarang);
/* remove this filp from the asynchronously notified filp's */ /* remove this filp from the asynchronously notified filp's */
filp->private_data = NULL; filp->private_data = NULL;
...@@ -141,12 +141,12 @@ static ssize_t bcm_char_read(struct file *filp, char __user *buf, size_t size, l ...@@ -141,12 +141,12 @@ static ssize_t bcm_char_read(struct file *filp, char __user *buf, size_t size, l
PktLen = Packet->len; PktLen = Packet->len;
if(copy_to_user(buf, Packet->data, PktLen)) if(copy_to_user(buf, Packet->data, PktLen))
{ {
bcm_kfree_skb(Packet); dev_kfree_skb(Packet);
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "\nReturning from copy to user failure \n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "\nReturning from copy to user failure \n");
return -EFAULT; return -EFAULT;
} }
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Read %d Bytes From Adapter packet = 0x%p by process %d!\n", PktLen, Packet, current->pid); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Read %d Bytes From Adapter packet = 0x%p by process %d!\n", PktLen, Packet, current->pid);
bcm_kfree_skb(Packet); dev_kfree_skb(Packet);
} }
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "<====\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "<====\n");
...@@ -239,7 +239,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -239,7 +239,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
(PUINT)temp_buff, Bufflen); (PUINT)temp_buff, Bufflen);
if(Status != STATUS_SUCCESS) if(Status != STATUS_SUCCESS)
{ {
bcm_kfree(temp_buff); kfree(temp_buff);
return Status; return Status;
} }
if(copy_to_user(IoBuffer.OutputBuffer, if(copy_to_user(IoBuffer.OutputBuffer,
...@@ -247,7 +247,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -247,7 +247,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
{ {
Status = -EFAULT; Status = -EFAULT;
} }
bcm_kfree(temp_buff); kfree(temp_buff);
break; break;
} }
case IOCTL_BCM_REGISTER_WRITE_PRIVATE: case IOCTL_BCM_REGISTER_WRITE_PRIVATE:
...@@ -344,7 +344,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -344,7 +344,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
(PUINT)temp_buff, IoBuffer.OutputLength); (PUINT)temp_buff, IoBuffer.OutputLength);
if(Status != STATUS_SUCCESS) if(Status != STATUS_SUCCESS)
{ {
bcm_kfree(temp_buff); kfree(temp_buff);
return Status; return Status;
} }
if(copy_to_user(IoBuffer.OutputBuffer, if(copy_to_user(IoBuffer.OutputBuffer,
...@@ -352,7 +352,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -352,7 +352,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
{ {
Status = -EFAULT; Status = -EFAULT;
} }
bcm_kfree(temp_buff); kfree(temp_buff);
break; break;
} }
case IOCTL_BCM_REGISTER_WRITE: case IOCTL_BCM_REGISTER_WRITE:
...@@ -796,7 +796,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -796,7 +796,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
IoBuffer.InputLength)) IoBuffer.InputLength))
{ {
Status = -EFAULT; Status = -EFAULT;
bcm_kfree(pvBuffer); kfree(pvBuffer);
break; break;
} }
...@@ -816,7 +816,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -816,7 +816,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
Status = CopyBufferToControlPacket(Adapter, (PVOID)pvBuffer); Status = CopyBufferToControlPacket(Adapter, (PVOID)pvBuffer);
cntrlEnd: cntrlEnd:
up(&Adapter->LowPowerModeSync); up(&Adapter->LowPowerModeSync);
bcm_kfree(pvBuffer); kfree(pvBuffer);
break; break;
} }
case IOCTL_BCM_BUFFER_DOWNLOAD_START: case IOCTL_BCM_BUFFER_DOWNLOAD_START:
...@@ -924,7 +924,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -924,7 +924,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
if(Status != STATUS_SUCCESS) if(Status != STATUS_SUCCESS)
up(&Adapter->fw_download_sema); up(&Adapter->fw_download_sema);
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, OSAL_DBG, DBG_LVL_ALL, "IOCTL: Firmware File Uploaded\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, OSAL_DBG, DBG_LVL_ALL, "IOCTL: Firmware File Uploaded\n");
bcm_kfree(psFwInfo); kfree(psFwInfo);
break; break;
} }
case IOCTL_BCM_BUFFER_DOWNLOAD_STOP: case IOCTL_BCM_BUFFER_DOWNLOAD_STOP:
...@@ -1193,11 +1193,11 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1193,11 +1193,11 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
sizeof(S_MIBS_HOST_STATS_MIBS))) sizeof(S_MIBS_HOST_STATS_MIBS)))
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Copy to user failed\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Copy to user failed\n");
bcm_kfree(temp_buff); kfree(temp_buff);
return -EFAULT; return -EFAULT;
} }
bcm_kfree(temp_buff); kfree(temp_buff);
break; break;
} }
...@@ -1246,7 +1246,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1246,7 +1246,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
/* Get WrmBuffer structure */ /* Get WrmBuffer structure */
if(copy_from_user(pvBuffer, IoBuffer.InputBuffer, IoBuffer.InputLength)) if(copy_from_user(pvBuffer, IoBuffer.InputBuffer, IoBuffer.InputLength))
{ {
bcm_kfree(pvBuffer); kfree(pvBuffer);
Status = -EFAULT; Status = -EFAULT;
break; break;
} }
...@@ -1256,7 +1256,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1256,7 +1256,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
if(((ULONG)pBulkBuffer->Register & 0x0F000000) != 0x0F000000 || if(((ULONG)pBulkBuffer->Register & 0x0F000000) != 0x0F000000 ||
((ULONG)pBulkBuffer->Register & 0x3)) ((ULONG)pBulkBuffer->Register & 0x3))
{ {
bcm_kfree(pvBuffer); kfree(pvBuffer);
BCM_DEBUG_PRINT (Adapter, DBG_TYPE_PRINTK, 0, 0,"WRM Done On invalid Address : %x Access Denied.\n",(int)pBulkBuffer->Register); BCM_DEBUG_PRINT (Adapter, DBG_TYPE_PRINTK, 0, 0,"WRM Done On invalid Address : %x Access Denied.\n",(int)pBulkBuffer->Register);
Status = -EINVAL; Status = -EINVAL;
break; break;
...@@ -1271,7 +1271,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1271,7 +1271,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
(uiTempVar == EEPROM_REJECT_REG_4)) && (uiTempVar == EEPROM_REJECT_REG_4)) &&
(cmd == IOCTL_BCM_REGISTER_WRITE)) (cmd == IOCTL_BCM_REGISTER_WRITE))
{ {
bcm_kfree(pvBuffer); kfree(pvBuffer);
BCM_DEBUG_PRINT (Adapter, DBG_TYPE_PRINTK, 0, 0,"EEPROM Access Denied, not in VSG Mode\n"); BCM_DEBUG_PRINT (Adapter, DBG_TYPE_PRINTK, 0, 0,"EEPROM Access Denied, not in VSG Mode\n");
Status = -EFAULT; Status = -EFAULT;
break; break;
...@@ -1287,7 +1287,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1287,7 +1287,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "WRM Failed\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "WRM Failed\n");
} }
bcm_kfree(pvBuffer); kfree(pvBuffer);
break; break;
} }
...@@ -1486,7 +1486,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1486,7 +1486,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
stNVMReadWrite.uiNumBytes)) stNVMReadWrite.uiNumBytes))
{ {
Status = -EFAULT; Status = -EFAULT;
bcm_kfree(pReadData); kfree(pReadData);
break; break;
} }
...@@ -1501,7 +1501,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1501,7 +1501,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"Device is in Idle/Shutdown Mode\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"Device is in Idle/Shutdown Mode\n");
up(&Adapter->NVMRdmWrmLock); up(&Adapter->NVMRdmWrmLock);
bcm_kfree(pReadData); kfree(pReadData);
return -EACCES; return -EACCES;
} }
...@@ -1512,13 +1512,13 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1512,13 +1512,13 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
if(Status != STATUS_SUCCESS) if(Status != STATUS_SUCCESS)
{ {
bcm_kfree(pReadData); kfree(pReadData);
return Status; return Status;
} }
if(copy_to_user(stNVMReadWrite.pBuffer, if(copy_to_user(stNVMReadWrite.pBuffer,
pReadData, (UINT)stNVMReadWrite.uiNumBytes)) pReadData, (UINT)stNVMReadWrite.uiNumBytes))
{ {
bcm_kfree(pReadData); kfree(pReadData);
Status = -EFAULT; Status = -EFAULT;
} }
} }
...@@ -1533,7 +1533,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1533,7 +1533,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"Device is in Idle/Shutdown Mode\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"Device is in Idle/Shutdown Mode\n");
up(&Adapter->NVMRdmWrmLock); up(&Adapter->NVMRdmWrmLock);
bcm_kfree(pReadData); kfree(pReadData);
return -EACCES; return -EACCES;
} }
...@@ -1561,7 +1561,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1561,7 +1561,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"DSD Sig is present neither in Flash nor User provided Input.."); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"DSD Sig is present neither in Flash nor User provided Input..");
up(&Adapter->NVMRdmWrmLock); up(&Adapter->NVMRdmWrmLock);
bcm_kfree(pReadData); kfree(pReadData);
return Status; return Status;
} }
...@@ -1570,7 +1570,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1570,7 +1570,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"DSD Sig is present neither in Flash nor User provided Input.."); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"DSD Sig is present neither in Flash nor User provided Input..");
up(&Adapter->NVMRdmWrmLock); up(&Adapter->NVMRdmWrmLock);
bcm_kfree(pReadData); kfree(pReadData);
return Status; return Status;
} }
} }
...@@ -1587,7 +1587,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1587,7 +1587,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
if(Status != STATUS_SUCCESS) if(Status != STATUS_SUCCESS)
{ {
bcm_kfree(pReadData); kfree(pReadData);
return Status; return Status;
} }
} }
...@@ -1595,7 +1595,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1595,7 +1595,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, " timetaken by Write/read :%ld msec\n",(tv1.tv_sec - tv0.tv_sec)*1000 +(tv1.tv_usec - tv0.tv_usec)/1000); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, " timetaken by Write/read :%ld msec\n",(tv1.tv_sec - tv0.tv_sec)*1000 +(tv1.tv_usec - tv0.tv_usec)/1000);
bcm_kfree(pReadData); kfree(pReadData);
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
} }
break; break;
...@@ -1666,7 +1666,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1666,7 +1666,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"Device is in Idle/Shutdown Mode\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"Device is in Idle/Shutdown Mode\n");
up(&Adapter->NVMRdmWrmLock); up(&Adapter->NVMRdmWrmLock);
bcm_kfree(pReadBuff); kfree(pReadBuff);
return -EACCES; return -EACCES;
} }
...@@ -1706,7 +1706,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1706,7 +1706,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
} }
up(&Adapter->NVMRdmWrmLock); up(&Adapter->NVMRdmWrmLock);
bcm_kfree(pReadBuff); kfree(pReadBuff);
} }
break ; break ;
...@@ -1799,7 +1799,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1799,7 +1799,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"Device is in Idle/Shutdown Mode\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"Device is in Idle/Shutdown Mode\n");
up(&Adapter->NVMRdmWrmLock); up(&Adapter->NVMRdmWrmLock);
bcm_kfree(pWriteBuff); kfree(pWriteBuff);
return -EACCES; return -EACCES;
} }
...@@ -1838,7 +1838,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1838,7 +1838,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
} while(NOB > 0); } while(NOB > 0);
BcmFlash2xWriteSig(Adapter,sFlash2xWrite.Section); BcmFlash2xWriteSig(Adapter,sFlash2xWrite.Section);
up(&Adapter->NVMRdmWrmLock); up(&Adapter->NVMRdmWrmLock);
bcm_kfree(pWriteBuff); kfree(pWriteBuff);
} }
break ; break ;
case IOCTL_BCM_GET_FLASH2X_SECTION_BITMAP : case IOCTL_BCM_GET_FLASH2X_SECTION_BITMAP :
...@@ -1874,7 +1874,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1874,7 +1874,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"Device is in Idle/Shutdown Mode\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"Device is in Idle/Shutdown Mode\n");
up(&Adapter->NVMRdmWrmLock); up(&Adapter->NVMRdmWrmLock);
bcm_kfree(psFlash2xBitMap); kfree(psFlash2xBitMap);
return -EACCES; return -EACCES;
} }
...@@ -1884,10 +1884,10 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1884,10 +1884,10 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
if(Status) if(Status)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "copying Flash2x bitMap failed"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "copying Flash2x bitMap failed");
bcm_kfree(psFlash2xBitMap); kfree(psFlash2xBitMap);
return -EFAULT; return -EFAULT;
} }
bcm_kfree(psFlash2xBitMap); kfree(psFlash2xBitMap);
} }
break ; break ;
case IOCTL_BCM_SET_ACTIVE_SECTION : case IOCTL_BCM_SET_ACTIVE_SECTION :
...@@ -2214,7 +2214,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -2214,7 +2214,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
(Adapter->bPreparingForLowPowerMode ==TRUE)) (Adapter->bPreparingForLowPowerMode ==TRUE))
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"Device is in Idle/Shutdown Mode\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,"Device is in Idle/Shutdown Mode\n");
bcm_kfree(pReadBuff); kfree(pReadBuff);
up(&Adapter->NVMRdmWrmLock); up(&Adapter->NVMRdmWrmLock);
return -EACCES; return -EACCES;
} }
...@@ -2254,7 +2254,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -2254,7 +2254,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
} }
Adapter->bFlashRawRead = FALSE ; Adapter->bFlashRawRead = FALSE ;
up(&Adapter->NVMRdmWrmLock); up(&Adapter->NVMRdmWrmLock);
bcm_kfree(pReadBuff); kfree(pReadBuff);
break ; break ;
} }
......
...@@ -985,7 +985,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A ...@@ -985,7 +985,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A
if(Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication) if(Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication)
{ {
bcm_kfree(Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication); kfree(Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication);
Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication = NULL; Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication = NULL;
} }
Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication = pstAddIndication; Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication = pstAddIndication;
...@@ -1844,7 +1844,7 @@ ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter,PVOID pvBuffer,UINT *p ...@@ -1844,7 +1844,7 @@ ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter,PVOID pvBuffer,UINT *p
(*puBufferLength) = sizeof(stLocalSFAddIndication); (*puBufferLength) = sizeof(stLocalSFAddIndication);
*(stLocalSFAddIndication *)pvBuffer = *pstAddIndication; *(stLocalSFAddIndication *)pvBuffer = *pstAddIndication;
bcm_kfree(pstAddIndication); kfree(pstAddIndication);
return 1; return 1;
} }
...@@ -1931,7 +1931,7 @@ static inline stLocalSFAddIndicationAlt ...@@ -1931,7 +1931,7 @@ static inline stLocalSFAddIndicationAlt
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "============================================================"); BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "============================================================");
return pstAddIndicationDest; return pstAddIndicationDest;
failed_restore_sf_param: failed_restore_sf_param:
bcm_kfree(pstAddIndicationDest); kfree(pstAddIndicationDest);
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<=====" ); BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<=====" );
return NULL; return NULL;
} }
...@@ -2049,7 +2049,7 @@ INT FreeAdapterDsxBuffer(PMINI_ADAPTER Adapter) ...@@ -2049,7 +2049,7 @@ INT FreeAdapterDsxBuffer(PMINI_ADAPTER Adapter)
{ {
if(Adapter->caDsxReqResp) if(Adapter->caDsxReqResp)
{ {
bcm_kfree(Adapter->caDsxReqResp); kfree(Adapter->caDsxReqResp);
} }
return 0; return 0;
...@@ -2102,7 +2102,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap ...@@ -2102,7 +2102,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, " VCID = %x", ntohs(pstAddIndication->u16VCID)); BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, " VCID = %x", ntohs(pstAddIndication->u16VCID));
CopyBufferToControlPacket(Adapter,(PVOID)Adapter->caDsxReqResp); CopyBufferToControlPacket(Adapter,(PVOID)Adapter->caDsxReqResp);
bcm_kfree(pstAddIndication); kfree(pstAddIndication);
} }
break; break;
case DSA_RSP: case DSA_RSP:
...@@ -2169,7 +2169,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap ...@@ -2169,7 +2169,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap
Adapter->PackInfo[uiSearchRuleIndex].bActive=FALSE; Adapter->PackInfo[uiSearchRuleIndex].bActive=FALSE;
Adapter->PackInfo[uiSearchRuleIndex].bValid=FALSE; Adapter->PackInfo[uiSearchRuleIndex].bValid=FALSE;
Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value=0; Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value=0;
bcm_kfree(pstAddIndication); kfree(pstAddIndication);
} }
else if(psfLocalSet->bValid && (pstAddIndication->u8CC == 0)) else if(psfLocalSet->bValid && (pstAddIndication->u8CC == 0))
...@@ -2218,13 +2218,13 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap ...@@ -2218,13 +2218,13 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap
Adapter->PackInfo[uiSearchRuleIndex].bActive=FALSE; Adapter->PackInfo[uiSearchRuleIndex].bActive=FALSE;
Adapter->PackInfo[uiSearchRuleIndex].bValid=FALSE; Adapter->PackInfo[uiSearchRuleIndex].bValid=FALSE;
Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value=0; Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value=0;
bcm_kfree(pstAddIndication); kfree(pstAddIndication);
} }
} }
else else
{ {
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_PRINTK, 0, 0, "DSA ACK did not get valid SFID"); BCM_DEBUG_PRINT( Adapter,DBG_TYPE_PRINTK, 0, 0, "DSA ACK did not get valid SFID");
bcm_kfree(pstAddIndication); kfree(pstAddIndication);
return FALSE; return FALSE;
} }
} }
...@@ -2239,7 +2239,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap ...@@ -2239,7 +2239,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap
((stLocalSFChangeIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSC_RSP; ((stLocalSFChangeIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSC_RSP;
CopyBufferToControlPacket(Adapter,(PVOID)Adapter->caDsxReqResp); CopyBufferToControlPacket(Adapter,(PVOID)Adapter->caDsxReqResp);
bcm_kfree(pstAddIndication); kfree(pstAddIndication);
} }
break; break;
case DSC_RSP: case DSC_RSP:
...@@ -2312,13 +2312,13 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap ...@@ -2312,13 +2312,13 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap
else if(pstChangeIndication->u8CC == 6) else if(pstChangeIndication->u8CC == 6)
{ {
deleteSFBySfid(Adapter,uiSearchRuleIndex); deleteSFBySfid(Adapter,uiSearchRuleIndex);
bcm_kfree(pstAddIndication); kfree(pstAddIndication);
} }
} }
else else
{ {
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_PRINTK, 0, 0, "DSC ACK did not get valid SFID"); BCM_DEBUG_PRINT( Adapter,DBG_TYPE_PRINTK, 0, 0, "DSC ACK did not get valid SFID");
bcm_kfree(pstAddIndication); kfree(pstAddIndication);
return FALSE; return FALSE;
} }
} }
...@@ -2355,7 +2355,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap ...@@ -2355,7 +2355,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "DSD ACK Rcd, let App handle it\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "DSD ACK Rcd, let App handle it\n");
break; break;
default: default:
bcm_kfree(pstAddIndication); kfree(pstAddIndication);
return FALSE ; return FALSE ;
} }
return TRUE; return TRUE;
......
...@@ -134,7 +134,7 @@ VOID handle_rx_control_packet(PMINI_ADAPTER Adapter, /**<Pointer to the Adapter ...@@ -134,7 +134,7 @@ VOID handle_rx_control_packet(PMINI_ADAPTER Adapter, /**<Pointer to the Adapter
} }
up(&Adapter->RxAppControlQueuelock); up(&Adapter->RxAppControlQueuelock);
wake_up(&Adapter->process_read_wait_queue); wake_up(&Adapter->process_read_wait_queue);
bcm_kfree_skb(skb); dev_kfree_skb(skb);
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, "After wake_up_interruptible"); BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, "After wake_up_interruptible");
} }
...@@ -231,7 +231,7 @@ INT flushAllAppQ(void) ...@@ -231,7 +231,7 @@ INT flushAllAppQ(void)
{ {
PacketToDrop=pTarang->RxAppControlHead; PacketToDrop=pTarang->RxAppControlHead;
DEQUEUEPACKET(pTarang->RxAppControlHead,pTarang->RxAppControlTail); DEQUEUEPACKET(pTarang->RxAppControlHead,pTarang->RxAppControlTail);
bcm_kfree_skb(PacketToDrop); dev_kfree_skb(PacketToDrop);
} }
pTarang->AppCtrlQueueLen = 0; pTarang->AppCtrlQueueLen = 0;
//dropped contrl packet statistics also should be reset. //dropped contrl packet statistics also should be reset.
......
...@@ -48,7 +48,7 @@ int InterfaceFileDownload( PVOID arg, ...@@ -48,7 +48,7 @@ int InterfaceFileDownload( PVOID arg,
on_chip_loc+=MAX_TRANSFER_CTRL_BYTE_USB; on_chip_loc+=MAX_TRANSFER_CTRL_BYTE_USB;
}/* End of for(;;)*/ }/* End of for(;;)*/
bcm_kfree(buff); kfree(buff);
return errno; return errno;
} }
...@@ -69,8 +69,8 @@ int InterfaceFileReadbackFromChip( PVOID arg, ...@@ -69,8 +69,8 @@ int InterfaceFileReadbackFromChip( PVOID arg,
buff_readback=(PCHAR)kmalloc(MAX_TRANSFER_CTRL_BYTE_USB , GFP_DMA); buff_readback=(PCHAR)kmalloc(MAX_TRANSFER_CTRL_BYTE_USB , GFP_DMA);
if(!buff || !buff_readback) if(!buff || !buff_readback)
{ {
bcm_kfree(buff); kfree(buff);
bcm_kfree(buff_readback); kfree(buff_readback);
return -ENOMEM; return -ENOMEM;
} }
...@@ -137,8 +137,8 @@ int InterfaceFileReadbackFromChip( PVOID arg, ...@@ -137,8 +137,8 @@ int InterfaceFileReadbackFromChip( PVOID arg,
on_chip_loc+=MAX_TRANSFER_CTRL_BYTE_USB; on_chip_loc+=MAX_TRANSFER_CTRL_BYTE_USB;
}/* End of while(1)*/ }/* End of while(1)*/
exit: exit:
bcm_kfree(buff); kfree(buff);
bcm_kfree(buff_readback); kfree(buff_readback);
return Status; return Status;
} }
...@@ -164,7 +164,7 @@ static int bcm_download_config_file(PMINI_ADAPTER Adapter, ...@@ -164,7 +164,7 @@ static int bcm_download_config_file(PMINI_ADAPTER Adapter,
psFwInfo->pvMappedFirmwareAddress, psFwInfo->u32FirmwareLength); psFwInfo->pvMappedFirmwareAddress, psFwInfo->u32FirmwareLength);
if(retval) if(retval)
{ {
bcm_kfree (Adapter->pstargetparams); kfree(Adapter->pstargetparams);
Adapter->pstargetparams = NULL; Adapter->pstargetparams = NULL;
return -EFAULT; return -EFAULT;
} }
...@@ -261,7 +261,7 @@ static int bcm_download_buffer(PMINI_ADAPTER Adapter, ...@@ -261,7 +261,7 @@ static int bcm_download_buffer(PMINI_ADAPTER Adapter,
u32FirmwareLength -= len; u32FirmwareLength -= len;
mappedbuffer +=len; mappedbuffer +=len;
} }
bcm_kfree(buff); kfree(buff);
return retval; return retval;
} }
#endif #endif
...@@ -313,7 +313,7 @@ static int bcm_buffer_readback(PMINI_ADAPTER Adapter, ...@@ -313,7 +313,7 @@ static int bcm_buffer_readback(PMINI_ADAPTER Adapter,
GFP_KERNEL); GFP_KERNEL);
if(NULL == readbackbuff) if(NULL == readbackbuff)
{ {
bcm_kfree(buff); kfree(buff);
return -ENOMEM; return -ENOMEM;
} }
while (u32FirmwareLength && !retval) while (u32FirmwareLength && !retval)
...@@ -343,8 +343,8 @@ static int bcm_buffer_readback(PMINI_ADAPTER Adapter, ...@@ -343,8 +343,8 @@ static int bcm_buffer_readback(PMINI_ADAPTER Adapter,
u32FirmwareLength -= len; u32FirmwareLength -= len;
mappedbuffer +=len; mappedbuffer +=len;
}/* end of while (u32FirmwareLength && !retval) */ }/* end of while (u32FirmwareLength && !retval) */
bcm_kfree(buff); kfree(buff);
bcm_kfree(readbackbuff); kfree(readbackbuff);
return retval; return retval;
} }
#endif #endif
...@@ -416,7 +416,7 @@ int bcm_ioctl_fw_download(PMINI_ADAPTER Adapter, FIRMWARE_INFO *psFwInfo) ...@@ -416,7 +416,7 @@ int bcm_ioctl_fw_download(PMINI_ADAPTER Adapter, FIRMWARE_INFO *psFwInfo)
} }
} }
error: error:
bcm_kfree(buff); kfree(buff);
return retval; return retval;
} }
...@@ -479,7 +479,7 @@ static INT buffRdbkVerify(PMINI_ADAPTER Adapter, ...@@ -479,7 +479,7 @@ static INT buffRdbkVerify(PMINI_ADAPTER Adapter,
u32FirmwareLength -= len; u32FirmwareLength -= len;
mappedbuffer +=len; mappedbuffer +=len;
}/* end of while (u32FirmwareLength && !retval) */ }/* end of while (u32FirmwareLength && !retval) */
bcm_kfree(readbackbuff); kfree(readbackbuff);
return retval; return retval;
} }
......
...@@ -55,7 +55,7 @@ VOID InterfaceAdapterFree(PS_INTERFACE_ADAPTER psIntfAdapter) ...@@ -55,7 +55,7 @@ VOID InterfaceAdapterFree(PS_INTERFACE_ADAPTER psIntfAdapter)
{ {
if (psIntfAdapter->asUsbRcb[i].urb != NULL) if (psIntfAdapter->asUsbRcb[i].urb != NULL)
{ {
bcm_kfree(psIntfAdapter->asUsbRcb[i].urb->transfer_buffer); kfree(psIntfAdapter->asUsbRcb[i].urb->transfer_buffer);
usb_free_urb(psIntfAdapter->asUsbRcb[i].urb); usb_free_urb(psIntfAdapter->asUsbRcb[i].urb);
psIntfAdapter->asUsbRcb[i].urb = NULL; psIntfAdapter->asUsbRcb[i].urb = NULL;
} }
......
...@@ -173,7 +173,7 @@ static void read_bulk_callback(struct urb *urb) ...@@ -173,7 +173,7 @@ static void read_bulk_callback(struct urb *urb)
else else
{ {
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_RX, RX_DATA, DBG_LVL_ALL, "i/f not up hance freeing SKB..."); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_RX, RX_DATA, DBG_LVL_ALL, "i/f not up hance freeing SKB...");
bcm_kfree_skb(skb); dev_kfree_skb(skb);
} }
atomic_inc(&Adapter->GoodRxPktCount); atomic_inc(&Adapter->GoodRxPktCount);
for(uiIndex = 0 ; uiIndex < MIBS_MAX_HIST_ENTRIES ; uiIndex++) for(uiIndex = 0 ; uiIndex < MIBS_MAX_HIST_ENTRIES ; uiIndex++)
......
...@@ -9,4 +9,4 @@ bcm_wimax-y := InterfaceDld.o InterfaceIdleMode.o InterfaceInit.o InterfaceRx.o ...@@ -9,4 +9,4 @@ bcm_wimax-y := InterfaceDld.o InterfaceIdleMode.o InterfaceInit.o InterfaceRx.o
Arp.o CmHost.o IPv6Protocol.o Qos.o Transmit.o\ Arp.o CmHost.o IPv6Protocol.o Qos.o Transmit.o\
Bcmnet.o DDRInit.o HandleControlPacket.o\ Bcmnet.o DDRInit.o HandleControlPacket.o\
LeakyBucket.o Misc.o sort.o Bcmchar.o hostmibs.o PHSModule.o\ LeakyBucket.o Misc.o sort.o Bcmchar.o hostmibs.o PHSModule.o\
Osal_Misc.o led_control.o nvm.o vendorspecificextn.o led_control.o nvm.o vendorspecificextn.o
...@@ -132,24 +132,24 @@ VOID AdapterFree(PMINI_ADAPTER Adapter) ...@@ -132,24 +132,24 @@ VOID AdapterFree(PMINI_ADAPTER Adapter)
free_netdev(Adapter->dev); free_netdev(Adapter->dev);
if(Adapter->pstargetparams != NULL) if(Adapter->pstargetparams != NULL)
{ {
bcm_kfree(Adapter->pstargetparams); kfree(Adapter->pstargetparams);
} }
for (count =0;count < MAX_CNTRL_PKTS;count++) for (count =0;count < MAX_CNTRL_PKTS;count++)
{ {
if(Adapter->txctlpacket[count]) if(Adapter->txctlpacket[count])
bcm_kfree(Adapter->txctlpacket[count]); kfree(Adapter->txctlpacket[count]);
} }
FreeAdapterDsxBuffer(Adapter); FreeAdapterDsxBuffer(Adapter);
if(Adapter->pvInterfaceAdapter) if(Adapter->pvInterfaceAdapter)
bcm_kfree(Adapter->pvInterfaceAdapter); kfree(Adapter->pvInterfaceAdapter);
//Free the PHS Interface //Free the PHS Interface
PhsCleanup(&Adapter->stBCMPhsContext); PhsCleanup(&Adapter->stBCMPhsContext);
BcmDeAllocFlashCSStructure(Adapter); BcmDeAllocFlashCSStructure(Adapter);
bcm_kfree (Adapter); kfree(Adapter);
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "<========\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "<========\n");
} }
...@@ -259,25 +259,6 @@ int BcmFileDownload(PMINI_ADAPTER Adapter,/**< Logical Adapter */ ...@@ -259,25 +259,6 @@ int BcmFileDownload(PMINI_ADAPTER Adapter,/**< Logical Adapter */
return errorno; return errorno;
} }
void bcm_kfree_skb(struct sk_buff *skb)
{
if(skb)
{
kfree_skb(skb);
}
skb = NULL ;
}
VOID bcm_kfree(VOID *ptr)
{
if(ptr)
{
kfree(ptr);
}
ptr = NULL ;
}
/** /**
@ingroup ctrl_pkt_functions @ingroup ctrl_pkt_functions
This function copies the contents of given buffer This function copies the contents of given buffer
...@@ -579,7 +560,7 @@ __inline VOID LinkMessage(PMINI_ADAPTER Adapter) ...@@ -579,7 +560,7 @@ __inline VOID LinkMessage(PMINI_ADAPTER Adapter)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Calling CopyBufferToControlPacket"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Calling CopyBufferToControlPacket");
CopyBufferToControlPacket(Adapter, pstLinkRequest); CopyBufferToControlPacket(Adapter, pstLinkRequest);
bcm_kfree(pstLinkRequest); kfree(pstLinkRequest);
} }
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "LinkMessage <====="); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "LinkMessage <=====");
return; return;
...@@ -1292,14 +1273,14 @@ int bcm_parse_target_params(PMINI_ADAPTER Adapter) ...@@ -1292,14 +1273,14 @@ int bcm_parse_target_params(PMINI_ADAPTER Adapter)
if((Adapter->pstargetparams = if((Adapter->pstargetparams =
kmalloc(sizeof(STARGETPARAMS), GFP_KERNEL)) == NULL) kmalloc(sizeof(STARGETPARAMS), GFP_KERNEL)) == NULL)
{ {
bcm_kfree(buff); kfree(buff);
return -ENOMEM; return -ENOMEM;
} }
flp=open_firmware_file(Adapter, CFG_FILE); flp=open_firmware_file(Adapter, CFG_FILE);
if(!flp) { if(!flp) {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "NOT ABLE TO OPEN THE %s FILE \n", CFG_FILE); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "NOT ABLE TO OPEN THE %s FILE \n", CFG_FILE);
bcm_kfree(buff); kfree(buff);
bcm_kfree(Adapter->pstargetparams); kfree(Adapter->pstargetparams);
Adapter->pstargetparams = NULL; Adapter->pstargetparams = NULL;
return -ENOENT; return -ENOENT;
} }
...@@ -1310,8 +1291,8 @@ int bcm_parse_target_params(PMINI_ADAPTER Adapter) ...@@ -1310,8 +1291,8 @@ int bcm_parse_target_params(PMINI_ADAPTER Adapter)
if(len != sizeof(STARGETPARAMS)) if(len != sizeof(STARGETPARAMS))
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL,"Mismatch in Target Param Structure!\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL,"Mismatch in Target Param Structure!\n");
bcm_kfree(buff); kfree(buff);
bcm_kfree(Adapter->pstargetparams); kfree(Adapter->pstargetparams);
Adapter->pstargetparams = NULL; Adapter->pstargetparams = NULL;
filp_close(flp, current->files); filp_close(flp, current->files);
return -ENOENT; return -ENOENT;
...@@ -1323,7 +1304,7 @@ int bcm_parse_target_params(PMINI_ADAPTER Adapter) ...@@ -1323,7 +1304,7 @@ int bcm_parse_target_params(PMINI_ADAPTER Adapter)
* Values in Adapter->pstargetparams are in network byte order * Values in Adapter->pstargetparams are in network byte order
*/ */
memcpy(Adapter->pstargetparams, buff, sizeof(STARGETPARAMS)); memcpy(Adapter->pstargetparams, buff, sizeof(STARGETPARAMS));
bcm_kfree (buff); kfree (buff);
beceem_parse_target_struct(Adapter); beceem_parse_target_struct(Adapter);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -1478,7 +1459,7 @@ static unsigned char *ReadMacAddrEEPROM(PMINI_ADAPTER Adapter, ulong dwAddress) ...@@ -1478,7 +1459,7 @@ static unsigned char *ReadMacAddrEEPROM(PMINI_ADAPTER Adapter, ulong dwAddress)
if(status != STATUS_SUCCESS) if(status != STATUS_SUCCESS)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "wrm Failed..\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "wrm Failed..\n");
bcm_kfree(pucmacaddr); kfree(pucmacaddr);
pucmacaddr = NULL; pucmacaddr = NULL;
goto OUT; goto OUT;
} }
...@@ -1488,7 +1469,7 @@ static unsigned char *ReadMacAddrEEPROM(PMINI_ADAPTER Adapter, ulong dwAddress) ...@@ -1488,7 +1469,7 @@ static unsigned char *ReadMacAddrEEPROM(PMINI_ADAPTER Adapter, ulong dwAddress)
if(status != STATUS_SUCCESS) if(status != STATUS_SUCCESS)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "rdm Failed..\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "rdm Failed..\n");
bcm_kfree(pucmacaddr); kfree(pucmacaddr);
pucmacaddr = NULL; pucmacaddr = NULL;
goto OUT; goto OUT;
} }
...@@ -1522,7 +1503,7 @@ INT ReadMacAddressFromEEPROM(PMINI_ADAPTER Adapter) ...@@ -1522,7 +1503,7 @@ INT ReadMacAddressFromEEPROM(PMINI_ADAPTER Adapter)
puMacAddr[4] == 0xFF && puMacAddr[5] == 0xFF)) puMacAddr[4] == 0xFF && puMacAddr[5] == 0xFF))
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, "Invalid Mac Address\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, "Invalid Mac Address\n");
bcm_kfree(puMacAddr); kfree(puMacAddr);
return STATUS_FAILURE; return STATUS_FAILURE;
} }
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, "The Mac Address received is: \n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, "The Mac Address received is: \n");
...@@ -1532,7 +1513,7 @@ INT ReadMacAddressFromEEPROM(PMINI_ADAPTER Adapter) ...@@ -1532,7 +1513,7 @@ INT ReadMacAddressFromEEPROM(PMINI_ADAPTER Adapter)
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"%02x ", Adapter->dev->dev_addr[i]); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"%02x ", Adapter->dev->dev_addr[i]);
} }
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"\n"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"\n");
bcm_kfree(puMacAddr); kfree(puMacAddr);
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -1980,7 +1961,7 @@ void flush_queue(PMINI_ADAPTER Adapter, UINT iQIndex) ...@@ -1980,7 +1961,7 @@ void flush_queue(PMINI_ADAPTER Adapter, UINT iQIndex)
Adapter->PackInfo[iQIndex].uiDroppedCountBytes += PacketToDrop->len; Adapter->PackInfo[iQIndex].uiDroppedCountBytes += PacketToDrop->len;
Adapter->PackInfo[iQIndex].uiDroppedCountPackets++; Adapter->PackInfo[iQIndex].uiDroppedCountPackets++;
bcm_kfree_skb(PacketToDrop); dev_kfree_skb(PacketToDrop);
atomic_dec(&Adapter->TotalPacketCount); atomic_dec(&Adapter->TotalPacketCount);
atomic_inc(&Adapter->TxDroppedPacketCount); atomic_inc(&Adapter->TxDroppedPacketCount);
......
/*++
Copyright (c) Beceem Communications Inc.
Module Name:
WIN_Misc.c
Abstract:
Implements the Miscelanneous OS Construts
Linked Lists
Dispatcher Objects(Events,Semaphores,Spin Locks and the like)
Files
Revision History:
Who When What
-------- -------- ----------------------------------------------
Name Date Created/reviewed/modified
Rajeev 24/1/08 Created
Notes:
--*/
#include "headers.h"
bool OsalMemCompare(void *dest, void *src, UINT len)
{
return (memcmp(src, dest, len));
}
...@@ -120,15 +120,15 @@ int PHSTransmit(PMINI_ADAPTER Adapter, ...@@ -120,15 +120,15 @@ int PHSTransmit(PMINI_ADAPTER Adapter,
if(newPacket == NULL) if(newPacket == NULL)
return STATUS_FAILURE; return STATUS_FAILURE;
bcm_kfree_skb(Packet); dev_kfree_skb(Packet);
*pPacket = Packet = newPacket; *pPacket = Packet = newPacket;
pucPHSPktHdrInBuf = Packet->data + BytesToRemove; pucPHSPktHdrInBuf = Packet->data + BytesToRemove;
} }
numBytesCompressed = unPhsOldHdrSize - (unPHSNewPktHeaderLen+PHSI_LEN); numBytesCompressed = unPhsOldHdrSize - (unPHSNewPktHeaderLen+PHSI_LEN);
OsalMemMove(pucPHSPktHdrInBuf + numBytesCompressed, pucPHSPktHdrOutBuf, unPHSNewPktHeaderLen + PHSI_LEN); memcpy(pucPHSPktHdrInBuf + numBytesCompressed, pucPHSPktHdrOutBuf, unPHSNewPktHeaderLen + PHSI_LEN);
OsalMemMove(Packet->data + numBytesCompressed, Packet->data, BytesToRemove); memcpy(Packet->data + numBytesCompressed, Packet->data, BytesToRemove);
skb_pull(Packet, numBytesCompressed); skb_pull(Packet, numBytesCompressed);
return STATUS_SUCCESS; return STATUS_SUCCESS;
...@@ -223,7 +223,7 @@ int PHSRecieve(PMINI_ADAPTER Adapter, ...@@ -223,7 +223,7 @@ int PHSRecieve(PMINI_ADAPTER Adapter,
} }
} }
OsalMemMove(packet->data, Adapter->ucaPHSPktRestoreBuf, nStandardPktHdrLen); memcpy(packet->data, Adapter->ucaPHSPktRestoreBuf, nStandardPktHdrLen);
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;
...@@ -270,15 +270,9 @@ int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,PMINI_ADAPTER Adapter) ...@@ -270,15 +270,9 @@ int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,PMINI_ADAPTER Adapter)
return -EINVAL; return -EINVAL;
pPhsdeviceExtension->pstServiceFlowPhsRulesTable = pPhsdeviceExtension->pstServiceFlowPhsRulesTable =
(S_SERVICEFLOW_TABLE*)OsalMemAlloc(sizeof(S_SERVICEFLOW_TABLE), kzalloc(sizeof(S_SERVICEFLOW_TABLE), GFP_KERNEL);
PHS_MEM_TAG);
if(pPhsdeviceExtension->pstServiceFlowPhsRulesTable) if(!pPhsdeviceExtension->pstServiceFlowPhsRulesTable)
{
OsalZeroMemory(pPhsdeviceExtension->pstServiceFlowPhsRulesTable,
sizeof(S_SERVICEFLOW_TABLE));
}
else
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAllocation ServiceFlowPhsRulesTable failed"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAllocation ServiceFlowPhsRulesTable failed");
return -ENOMEM; return -ENOMEM;
...@@ -288,14 +282,8 @@ int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,PMINI_ADAPTER Adapter) ...@@ -288,14 +282,8 @@ int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,PMINI_ADAPTER Adapter)
for(i=0;i<MAX_SERVICEFLOWS;i++) for(i=0;i<MAX_SERVICEFLOWS;i++)
{ {
S_SERVICEFLOW_ENTRY sServiceFlow = pstServiceFlowTable->stSFList[i]; S_SERVICEFLOW_ENTRY sServiceFlow = pstServiceFlowTable->stSFList[i];
sServiceFlow.pstClassifierTable = (S_CLASSIFIER_TABLE*)OsalMemAlloc( sServiceFlow.pstClassifierTable = kzalloc(sizeof(S_CLASSIFIER_TABLE), GFP_KERNEL);
sizeof(S_CLASSIFIER_TABLE), PHS_MEM_TAG); if(!sServiceFlow.pstClassifierTable)
if(sServiceFlow.pstClassifierTable)
{
OsalZeroMemory(sServiceFlow.pstClassifierTable,sizeof(S_CLASSIFIER_TABLE));
pstServiceFlowTable->stSFList[i].pstClassifierTable = sServiceFlow.pstClassifierTable;
}
else
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAllocation failed"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAllocation failed");
free_phs_serviceflow_rules(pPhsdeviceExtension-> free_phs_serviceflow_rules(pPhsdeviceExtension->
...@@ -305,9 +293,7 @@ int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,PMINI_ADAPTER Adapter) ...@@ -305,9 +293,7 @@ int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,PMINI_ADAPTER Adapter)
} }
} }
pPhsdeviceExtension->CompressedTxBuffer = kmalloc(PHS_BUFFER_SIZE, GFP_KERNEL);
pPhsdeviceExtension->CompressedTxBuffer =
OsalMemAlloc(PHS_BUFFER_SIZE,PHS_MEM_TAG);
if(pPhsdeviceExtension->CompressedTxBuffer == NULL) if(pPhsdeviceExtension->CompressedTxBuffer == NULL)
{ {
...@@ -317,12 +303,11 @@ int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,PMINI_ADAPTER Adapter) ...@@ -317,12 +303,11 @@ int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,PMINI_ADAPTER Adapter)
return -ENOMEM; return -ENOMEM;
} }
pPhsdeviceExtension->UnCompressedRxBuffer = pPhsdeviceExtension->UnCompressedRxBuffer = kmalloc(PHS_BUFFER_SIZE, GFP_KERNEL);
OsalMemAlloc(PHS_BUFFER_SIZE,PHS_MEM_TAG);
if(pPhsdeviceExtension->UnCompressedRxBuffer == NULL) if(pPhsdeviceExtension->UnCompressedRxBuffer == NULL)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAllocation failed"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAllocation failed");
OsalMemFree(pPhsdeviceExtension->CompressedTxBuffer,PHS_BUFFER_SIZE); kfree(pPhsdeviceExtension->CompressedTxBuffer);
free_phs_serviceflow_rules(pPhsdeviceExtension->pstServiceFlowPhsRulesTable); free_phs_serviceflow_rules(pPhsdeviceExtension->pstServiceFlowPhsRulesTable);
pPhsdeviceExtension->pstServiceFlowPhsRulesTable = NULL; pPhsdeviceExtension->pstServiceFlowPhsRulesTable = NULL;
return -ENOMEM; return -ENOMEM;
...@@ -343,16 +328,11 @@ int PhsCleanup(IN PPHS_DEVICE_EXTENSION pPHSDeviceExt) ...@@ -343,16 +328,11 @@ int PhsCleanup(IN PPHS_DEVICE_EXTENSION pPHSDeviceExt)
pPHSDeviceExt->pstServiceFlowPhsRulesTable = NULL; pPHSDeviceExt->pstServiceFlowPhsRulesTable = NULL;
} }
if(pPHSDeviceExt->CompressedTxBuffer) kfree(pPHSDeviceExt->CompressedTxBuffer);
{ pPHSDeviceExt->CompressedTxBuffer = NULL;
OsalMemFree(pPHSDeviceExt->CompressedTxBuffer,PHS_BUFFER_SIZE);
pPHSDeviceExt->CompressedTxBuffer = NULL; kfree(pPHSDeviceExt->UnCompressedRxBuffer);
} pPHSDeviceExt->UnCompressedRxBuffer = NULL;
if(pPHSDeviceExt->UnCompressedRxBuffer)
{
OsalMemFree(pPHSDeviceExt->UnCompressedRxBuffer,PHS_BUFFER_SIZE);
pPHSDeviceExt->UnCompressedRxBuffer = NULL;
}
return 0; return 0;
} }
...@@ -478,20 +458,12 @@ ULONG PhsDeletePHSRule(IN void* pvContext,IN B_UINT16 uiVcid,IN B_UINT8 u8PHSI) ...@@ -478,20 +458,12 @@ ULONG PhsDeletePHSRule(IN void* pvContext,IN B_UINT16 uiVcid,IN B_UINT8 u8PHSI)
{ {
if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].bUsed && pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule) if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].bUsed && pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule)
{ {
if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8PHSI == u8PHSI) {
.pstPhsRule->u8PHSI == u8PHSI) if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
{ pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt--;
if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule if(0 == pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
->u8RefCnt) kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule);
pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0,
->u8RefCnt--;
if(0 == pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex]
.pstPhsRule->u8RefCnt)
OsalMemFree(pstClassifierRulesTable
->stActivePhsRulesList[nClsidIndex].pstPhsRule,
sizeof(S_PHS_RULE));
OsalZeroMemory(&pstClassifierRulesTable
->stActivePhsRulesList[nClsidIndex],
sizeof(S_CLASSIFIER_ENTRY)); sizeof(S_CLASSIFIER_ENTRY));
} }
} }
...@@ -548,10 +520,10 @@ ULONG PhsDeleteClassifierRule(IN void* pvContext,IN B_UINT16 uiVcid ,IN B_UINT16 ...@@ -548,10 +520,10 @@ ULONG PhsDeleteClassifierRule(IN void* pvContext,IN B_UINT16 uiVcid ,IN B_UINT16
if(pstClassifierEntry->pstPhsRule->u8RefCnt) if(pstClassifierEntry->pstPhsRule->u8RefCnt)
pstClassifierEntry->pstPhsRule->u8RefCnt--; pstClassifierEntry->pstPhsRule->u8RefCnt--;
if(0==pstClassifierEntry->pstPhsRule->u8RefCnt) if(0==pstClassifierEntry->pstPhsRule->u8RefCnt)
OsalMemFree(pstClassifierEntry->pstPhsRule,sizeof(S_PHS_RULE)); kfree(pstClassifierEntry->pstPhsRule);
} }
OsalZeroMemory(pstClassifierEntry,sizeof(S_CLASSIFIER_ENTRY)); memset(pstClassifierEntry, 0, sizeof(S_CLASSIFIER_ENTRY));
} }
nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable, nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable,
...@@ -559,10 +531,8 @@ ULONG PhsDeleteClassifierRule(IN void* pvContext,IN B_UINT16 uiVcid ,IN B_UINT16 ...@@ -559,10 +531,8 @@ ULONG PhsDeleteClassifierRule(IN void* pvContext,IN B_UINT16 uiVcid ,IN B_UINT16
if((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule)) if((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule))
{ {
if(pstClassifierEntry->pstPhsRule) kfree(pstClassifierEntry->pstPhsRule);
//Delete the classifier entry memset(pstClassifierEntry, 0, sizeof(S_CLASSIFIER_ENTRY));
OsalMemFree(pstClassifierEntry->pstPhsRule,sizeof(S_PHS_RULE));
OsalZeroMemory(pstClassifierEntry,sizeof(S_CLASSIFIER_ENTRY));
} }
} }
return lStatus; return lStatus;
...@@ -619,14 +589,11 @@ ULONG PhsDeleteSFRules(IN void* pvContext,IN B_UINT16 uiVcid) ...@@ -619,14 +589,11 @@ ULONG PhsDeleteSFRules(IN void* pvContext,IN B_UINT16 uiVcid)
.pstPhsRule->u8RefCnt--; .pstPhsRule->u8RefCnt--;
if(0==pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] if(0==pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex]
.pstPhsRule->u8RefCnt) .pstPhsRule->u8RefCnt)
OsalMemFree(pstClassifierRulesTable kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule);
->stActivePhsRulesList[nClsidIndex].pstPhsRule,
sizeof(S_PHS_RULE));
pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex]
.pstPhsRule = NULL; .pstPhsRule = NULL;
} }
OsalZeroMemory(&pstClassifierRulesTable memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0, sizeof(S_CLASSIFIER_ENTRY));
->stActivePhsRulesList[nClsidIndex],sizeof(S_CLASSIFIER_ENTRY));
if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule) if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule)
{ {
if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex]
...@@ -635,15 +602,12 @@ ULONG PhsDeleteSFRules(IN void* pvContext,IN B_UINT16 uiVcid) ...@@ -635,15 +602,12 @@ ULONG PhsDeleteSFRules(IN void* pvContext,IN B_UINT16 uiVcid)
.pstPhsRule->u8RefCnt--; .pstPhsRule->u8RefCnt--;
if(0 == pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] if(0 == pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex]
.pstPhsRule->u8RefCnt) .pstPhsRule->u8RefCnt)
OsalMemFree(pstClassifierRulesTable kfree(pstClassifierRulesTable
->stOldPhsRulesList[nClsidIndex].pstPhsRule, ->stOldPhsRulesList[nClsidIndex].pstPhsRule);
sizeof(S_PHS_RULE));
pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex]
.pstPhsRule = NULL; .pstPhsRule = NULL;
} }
OsalZeroMemory(&pstClassifierRulesTable memset(&pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex], 0, sizeof(S_CLASSIFIER_ENTRY));
->stOldPhsRulesList[nClsidIndex],
sizeof(S_CLASSIFIER_ENTRY));
} }
} }
pstServiceFlowEntry->bUsed = FALSE; pstServiceFlowEntry->bUsed = FALSE;
...@@ -876,8 +840,7 @@ void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTable) ...@@ -876,8 +840,7 @@ void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTable)
->u8RefCnt--; ->u8RefCnt--;
if(0==pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule if(0==pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule
->u8RefCnt) ->u8RefCnt)
OsalMemFree(pstClassifierRulesTable->stActivePhsRulesList[j]. kfree(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule);
pstPhsRule, sizeof(S_PHS_RULE));
pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule = NULL; pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule = NULL;
} }
if(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule) if(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule)
...@@ -888,19 +851,18 @@ void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTable) ...@@ -888,19 +851,18 @@ void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTable)
->u8RefCnt--; ->u8RefCnt--;
if(0==pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule if(0==pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule
->u8RefCnt) ->u8RefCnt)
OsalMemFree(pstClassifierRulesTable->stOldPhsRulesList[j] kfree(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule);
.pstPhsRule,sizeof(S_PHS_RULE));
pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule = NULL; pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule = NULL;
} }
} }
OsalMemFree(pstClassifierRulesTable,sizeof(S_CLASSIFIER_TABLE)); kfree(pstClassifierRulesTable);
stServiceFlowEntry.pstClassifierTable = pstClassifierRulesTable = NULL; stServiceFlowEntry.pstClassifierTable = pstClassifierRulesTable = NULL;
} }
} }
} }
OsalMemFree(psServiceFlowRulesTable,sizeof(S_SERVICEFLOW_TABLE)); kfree(psServiceFlowRulesTable);
psServiceFlowRulesTable = NULL; psServiceFlowRulesTable = NULL;
} }
...@@ -1102,7 +1064,7 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, ...@@ -1102,7 +1064,7 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid,
if(psPhsRule->u8PHSFLength) if(psPhsRule->u8PHSFLength)
{ {
//update PHSF //update PHSF
OsalMemMove(pstClassifierEntry->pstPhsRule->u8PHSF, memcpy(pstClassifierEntry->pstPhsRule->u8PHSF,
psPhsRule->u8PHSF , MAX_PHS_LENGTHS); psPhsRule->u8PHSF , MAX_PHS_LENGTHS);
} }
if(psPhsRule->u8PHSFLength) if(psPhsRule->u8PHSFLength)
...@@ -1114,7 +1076,7 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, ...@@ -1114,7 +1076,7 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid,
if(psPhsRule->u8PHSMLength) if(psPhsRule->u8PHSMLength)
{ {
//update PHSM //update PHSM
OsalMemMove(pstClassifierEntry->pstPhsRule->u8PHSM, memcpy(pstClassifierEntry->pstPhsRule->u8PHSM,
psPhsRule->u8PHSM, MAX_PHS_LENGTHS); psPhsRule->u8PHSM, MAX_PHS_LENGTHS);
} }
if(psPhsRule->u8PHSMLength) if(psPhsRule->u8PHSMLength)
...@@ -1234,8 +1196,7 @@ UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1234,8 +1196,7 @@ UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId,
{ {
if(psClassifierRules->pstPhsRule == NULL) if(psClassifierRules->pstPhsRule == NULL)
{ {
psClassifierRules->pstPhsRule = (S_PHS_RULE*)OsalMemAlloc psClassifierRules->pstPhsRule = kmalloc(sizeof(S_PHS_RULE),GFP_KERNEL);
(sizeof(S_PHS_RULE),PHS_MEM_TAG);
if(NULL == psClassifierRules->pstPhsRule) if(NULL == psClassifierRules->pstPhsRule)
return ERR_PHSRULE_MEMALLOC_FAIL; return ERR_PHSRULE_MEMALLOC_FAIL;
...@@ -1247,7 +1208,7 @@ UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1247,7 +1208,7 @@ UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId,
psClassifierRules->bUnclassifiedPHSRule = psPhsRule->bUnclassifiedPHSRule; psClassifierRules->bUnclassifiedPHSRule = psPhsRule->bUnclassifiedPHSRule;
/* Update The PHS rule */ /* Update The PHS rule */
OsalMemMove(psClassifierRules->pstPhsRule, memcpy(psClassifierRules->pstPhsRule,
psPhsRule, sizeof(S_PHS_RULE)); psPhsRule, sizeof(S_PHS_RULE));
} }
else else
...@@ -1289,13 +1250,13 @@ UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1289,13 +1250,13 @@ UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId,
//Step 2.a PHS Rule Does Not Exist .Create New PHS Rule for uiClsId //Step 2.a PHS Rule Does Not Exist .Create New PHS Rule for uiClsId
if(FALSE == bPHSRuleOrphaned) if(FALSE == bPHSRuleOrphaned)
{ {
pstClassifierEntry->pstPhsRule = (S_PHS_RULE*)OsalMemAlloc(sizeof(S_PHS_RULE),PHS_MEM_TAG); pstClassifierEntry->pstPhsRule = kmalloc(sizeof(S_PHS_RULE), GFP_KERNEL);
if(NULL == pstClassifierEntry->pstPhsRule) if(NULL == pstClassifierEntry->pstPhsRule)
{ {
return ERR_PHSRULE_MEMALLOC_FAIL; return ERR_PHSRULE_MEMALLOC_FAIL;
} }
} }
OsalMemMove(pstClassifierEntry->pstPhsRule, psPhsRule, sizeof(S_PHS_RULE)); memcpy(pstClassifierEntry->pstPhsRule, psPhsRule, sizeof(S_PHS_RULE));
} }
else else
...@@ -1304,14 +1265,8 @@ UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1304,14 +1265,8 @@ UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId,
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nTying Classifier to Existing PHS Rule"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nTying Classifier to Existing PHS Rule");
if(bPHSRuleOrphaned) if(bPHSRuleOrphaned)
{ {
if(pstClassifierEntry->pstPhsRule) kfree(pstClassifierEntry->pstPhsRule);
{
//Just Free the PHS Rule as Ref Count is Zero
OsalMemFree(pstClassifierEntry->pstPhsRule,sizeof(S_PHS_RULE));
pstClassifierEntry->pstPhsRule = NULL; pstClassifierEntry->pstPhsRule = NULL;
}
} }
pstClassifierEntry->pstPhsRule = pstAddPhsRule; pstClassifierEntry->pstPhsRule = pstAddPhsRule;
......
...@@ -11,10 +11,6 @@ VOID StatisticsResponse(PMINI_ADAPTER Adapter,PVOID pvBuffer); ...@@ -11,10 +11,6 @@ VOID StatisticsResponse(PMINI_ADAPTER Adapter,PVOID pvBuffer);
VOID IdleModeResponse(PMINI_ADAPTER Adapter,PUINT puiBuffer); VOID IdleModeResponse(PMINI_ADAPTER Adapter,PUINT puiBuffer);
void bcm_kfree_skb(struct sk_buff *skb);
VOID bcm_kfree(VOID *ptr);
VOID handle_rx_control_packet(PMINI_ADAPTER Adapter, /**<Pointer to the Adapter structure*/ VOID handle_rx_control_packet(PMINI_ADAPTER Adapter, /**<Pointer to the Adapter structure*/
struct sk_buff *skb); /**<Pointer to the socket buffer*/ struct sk_buff *skb); /**<Pointer to the socket buffer*/
......
...@@ -407,7 +407,7 @@ VOID PruneQueue(PMINI_ADAPTER Adapter,/**<Pointer to the driver control structur ...@@ -407,7 +407,7 @@ VOID PruneQueue(PMINI_ADAPTER Adapter,/**<Pointer to the driver control structur
/// update dropped bytes and packets counts /// update dropped bytes and packets counts
Adapter->PackInfo[iIndex].uiDroppedCountBytes += PacketToDrop->len; Adapter->PackInfo[iIndex].uiDroppedCountBytes += PacketToDrop->len;
Adapter->PackInfo[iIndex].uiDroppedCountPackets++; Adapter->PackInfo[iIndex].uiDroppedCountPackets++;
bcm_kfree_skb(PacketToDrop); dev_kfree_skb(PacketToDrop);
} }
...@@ -455,7 +455,7 @@ VOID flush_all_queues(PMINI_ADAPTER Adapter) ...@@ -455,7 +455,7 @@ VOID flush_all_queues(PMINI_ADAPTER Adapter)
Adapter->PackInfo[iQIndex].LastTxQueue); Adapter->PackInfo[iQIndex].LastTxQueue);
/* Free the skb */ /* Free the skb */
bcm_kfree_skb(PacketToDrop); dev_kfree_skb(PacketToDrop);
/// update current bytes and packets count /// update current bytes and packets count
Adapter->PackInfo[iQIndex].uiCurrentBytesOnHost -= uiTotalPacketLength; Adapter->PackInfo[iQIndex].uiCurrentBytesOnHost -= uiTotalPacketLength;
......
...@@ -117,7 +117,7 @@ INT bcm_transmit(struct sk_buff *skb, /**< skb */ ...@@ -117,7 +117,7 @@ INT bcm_transmit(struct sk_buff *skb, /**< skb */
BCM_DEBUG_PRINT (Adapter, DBG_TYPE_TX, TX_OSAL_DBG, DBG_LVL_ALL, BCM_DEBUG_PRINT (Adapter, DBG_TYPE_TX, TX_OSAL_DBG, DBG_LVL_ALL,
"Invalid queue index, dropping pkt\n"); "Invalid queue index, dropping pkt\n");
bcm_kfree_skb(skb); dev_kfree_skb(skb);
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -125,7 +125,7 @@ INT bcm_transmit(struct sk_buff *skb, /**< skb */ ...@@ -125,7 +125,7 @@ INT bcm_transmit(struct sk_buff *skb, /**< skb */
if(Adapter->PackInfo[qindex].uiCurrentPacketsOnHost >= SF_MAX_ALLOWED_PACKETS_TO_BACKUP) if(Adapter->PackInfo[qindex].uiCurrentPacketsOnHost >= SF_MAX_ALLOWED_PACKETS_TO_BACKUP)
{ {
atomic_inc(&Adapter->TxDroppedPacketCount); atomic_inc(&Adapter->TxDroppedPacketCount);
bcm_kfree_skb(skb); dev_kfree_skb(skb);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -159,7 +159,7 @@ INT bcm_transmit(struct sk_buff *skb, /**< skb */ ...@@ -159,7 +159,7 @@ INT bcm_transmit(struct sk_buff *skb, /**< skb */
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_OSAL_DBG, DBG_LVL_ALL, "<===="); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_OSAL_DBG, DBG_LVL_ALL, "<====");
} }
else else
bcm_kfree_skb(skb); dev_kfree_skb(skb);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -333,7 +333,7 @@ INT SetupNextSend(PMINI_ADAPTER Adapter, /**<Logical Adapter*/ ...@@ -333,7 +333,7 @@ INT SetupNextSend(PMINI_ADAPTER Adapter, /**<Logical Adapter*/
} }
bcm_kfree_skb(Packet); dev_kfree_skb(Packet);
return status; return status;
} }
......
...@@ -58,7 +58,6 @@ ...@@ -58,7 +58,6 @@
#include "Debug.h" #include "Debug.h"
#include "HostMibs.h" #include "HostMibs.h"
#include "IPv6ProtocolHdr.h" #include "IPv6ProtocolHdr.h"
#include "osal_misc.h"
#include "PHSModule.h" #include "PHSModule.h"
#include "Protocol.h" #include "Protocol.h"
#include "Prototypes.h" #include "Prototypes.h"
......
...@@ -54,7 +54,7 @@ INT ProcessGetHostMibs(PMINI_ADAPTER Adapter, ...@@ -54,7 +54,7 @@ INT ProcessGetHostMibs(PMINI_ADAPTER Adapter,
{ {
if(Adapter->PackInfo[nSfIndex].bValid) if(Adapter->PackInfo[nSfIndex].bValid)
{ {
OsalMemMove((PVOID)&pstHostMibs->astSFtable[nSfIndex],(PVOID)&Adapter->PackInfo[nSfIndex],sizeof(S_MIBS_SERVICEFLOW_TABLE)); memcpy((PVOID)&pstHostMibs->astSFtable[nSfIndex],(PVOID)&Adapter->PackInfo[nSfIndex],sizeof(S_MIBS_SERVICEFLOW_TABLE));
} }
else else
{ {
...@@ -83,7 +83,7 @@ INT ProcessGetHostMibs(PMINI_ADAPTER Adapter, ...@@ -83,7 +83,7 @@ INT ProcessGetHostMibs(PMINI_ADAPTER Adapter,
pstHostMibs->astPhsRulesTable[nPhsTableIndex].ulSFID = Adapter->PackInfo[nSfIndex].ulSFID; pstHostMibs->astPhsRulesTable[nPhsTableIndex].ulSFID = Adapter->PackInfo[nSfIndex].ulSFID;
OsalMemMove(&pstHostMibs->astPhsRulesTable[nPhsTableIndex].u8PHSI, memcpy(&pstHostMibs->astPhsRulesTable[nPhsTableIndex].u8PHSI,
&pstPhsRule->u8PHSI, &pstPhsRule->u8PHSI,
sizeof(S_PHS_RULE)); sizeof(S_PHS_RULE));
nPhsTableIndex++; nPhsTableIndex++;
......
...@@ -293,7 +293,7 @@ static INT ValidateDSDParamsChecksum( ...@@ -293,7 +293,7 @@ static INT ValidateDSDParamsChecksum(
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LED_DUMP_INFO, DBG_LVL_ALL,"LED Thread:ValidateDSDParamsChecksum: 0x%lx 0x%X",ulParamOffset, usParamLen); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LED_DUMP_INFO, DBG_LVL_ALL,"LED Thread:ValidateDSDParamsChecksum: 0x%lx 0x%X",ulParamOffset, usParamLen);
puBuffer = OsalMemAlloc(usParamLen,"!MEM"); puBuffer = kmalloc(usParamLen, GFP_KERNEL);
if(!puBuffer) if(!puBuffer)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LED_DUMP_INFO, DBG_LVL_ALL,"LED Thread: ValidateDSDParamsChecksum Allocation failed"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LED_DUMP_INFO, DBG_LVL_ALL,"LED Thread: ValidateDSDParamsChecksum Allocation failed");
...@@ -341,10 +341,7 @@ static INT ValidateDSDParamsChecksum( ...@@ -341,10 +341,7 @@ static INT ValidateDSDParamsChecksum(
} }
exit: exit:
if(puBuffer) kfree(puBuffer);
{
OsalMemFree(puBuffer, usParamLen);
}
return Status; return Status;
} }
......
...@@ -228,7 +228,7 @@ INT ReadBeceemEEPROM( PMINI_ADAPTER Adapter, ...@@ -228,7 +228,7 @@ INT ReadBeceemEEPROM( PMINI_ADAPTER Adapter,
ReadBeceemEEPROMBulk(Adapter, uiTempOffset + MAX_RW_SIZE, (PUINT)&uiData[4], 4); ReadBeceemEEPROMBulk(Adapter, uiTempOffset + MAX_RW_SIZE, (PUINT)&uiData[4], 4);
} }
OsalMemMove( (PUCHAR) pBuffer, ( ((PUCHAR)&uiData[0]) + uiByteOffset ), 4); memcpy( (PUCHAR) pBuffer, ( ((PUCHAR)&uiData[0]) + uiByteOffset ), 4);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} /* ReadBeceemEEPROM() */ } /* ReadBeceemEEPROM() */
...@@ -476,7 +476,7 @@ INT BeceemEEPROMBulkRead( ...@@ -476,7 +476,7 @@ INT BeceemEEPROMBulkRead(
ReadBeceemEEPROMBulk(Adapter,uiTempOffset,(PUINT)&uiData[0],4); ReadBeceemEEPROMBulk(Adapter,uiTempOffset,(PUINT)&uiData[0],4);
if(uiBytesRemaining >= (MAX_RW_SIZE - uiExtraBytes)) if(uiBytesRemaining >= (MAX_RW_SIZE - uiExtraBytes))
{ {
OsalMemMove(pBuffer,(((PUCHAR)&uiData[0])+uiExtraBytes),MAX_RW_SIZE - uiExtraBytes); memcpy(pBuffer,(((PUCHAR)&uiData[0])+uiExtraBytes),MAX_RW_SIZE - uiExtraBytes);
uiBytesRemaining -= (MAX_RW_SIZE - uiExtraBytes); uiBytesRemaining -= (MAX_RW_SIZE - uiExtraBytes);
uiIndex += (MAX_RW_SIZE - uiExtraBytes); uiIndex += (MAX_RW_SIZE - uiExtraBytes);
...@@ -484,7 +484,7 @@ INT BeceemEEPROMBulkRead( ...@@ -484,7 +484,7 @@ INT BeceemEEPROMBulkRead(
} }
else else
{ {
OsalMemMove(pBuffer,(((PUCHAR)&uiData[0])+uiExtraBytes),uiBytesRemaining); memcpy(pBuffer,(((PUCHAR)&uiData[0])+uiExtraBytes),uiBytesRemaining);
uiIndex += uiBytesRemaining; uiIndex += uiBytesRemaining;
uiOffset += uiBytesRemaining; uiOffset += uiBytesRemaining;
uiBytesRemaining = 0; uiBytesRemaining = 0;
...@@ -508,7 +508,7 @@ INT BeceemEEPROMBulkRead( ...@@ -508,7 +508,7 @@ INT BeceemEEPROMBulkRead(
* We read 4 Dwords of data */ * We read 4 Dwords of data */
if(0 == ReadBeceemEEPROMBulk(Adapter,uiOffset,&uiData[0],4)) if(0 == ReadBeceemEEPROMBulk(Adapter,uiOffset,&uiData[0],4))
{ {
OsalMemMove(pcBuff+uiIndex,&uiData[0],MAX_RW_SIZE); memcpy(pcBuff+uiIndex,&uiData[0],MAX_RW_SIZE);
uiOffset += MAX_RW_SIZE; uiOffset += MAX_RW_SIZE;
uiBytesRemaining -= MAX_RW_SIZE; uiBytesRemaining -= MAX_RW_SIZE;
uiIndex += MAX_RW_SIZE; uiIndex += MAX_RW_SIZE;
...@@ -523,7 +523,7 @@ INT BeceemEEPROMBulkRead( ...@@ -523,7 +523,7 @@ INT BeceemEEPROMBulkRead(
{ {
if(0 == ReadBeceemEEPROM(Adapter,uiOffset,&uiData[0])) if(0 == ReadBeceemEEPROM(Adapter,uiOffset,&uiData[0]))
{ {
OsalMemMove(pcBuff+uiIndex,&uiData[0],4); memcpy(pcBuff+uiIndex,&uiData[0],4);
uiOffset += 4; uiOffset += 4;
uiBytesRemaining -= 4; uiBytesRemaining -= 4;
uiIndex +=4; uiIndex +=4;
...@@ -540,7 +540,7 @@ INT BeceemEEPROMBulkRead( ...@@ -540,7 +540,7 @@ INT BeceemEEPROMBulkRead(
pCharBuff += uiIndex; pCharBuff += uiIndex;
if(0 == ReadBeceemEEPROM(Adapter,uiOffset,&uiData[0])) if(0 == ReadBeceemEEPROM(Adapter,uiOffset,&uiData[0]))
{ {
OsalMemMove(pCharBuff,&uiData[0],uiBytesRemaining);//copy only bytes requested. memcpy(pCharBuff,&uiData[0],uiBytesRemaining);//copy only bytes requested.
uiBytesRemaining = 0; uiBytesRemaining = 0;
} }
else else
...@@ -973,7 +973,7 @@ static INT flashWrite( ...@@ -973,7 +973,7 @@ static INT flashWrite(
// need not write 0xFFFFFFFF because write requires an erase and erase will // need not write 0xFFFFFFFF because write requires an erase and erase will
// make whole sector 0xFFFFFFFF. // make whole sector 0xFFFFFFFF.
// //
if (!OsalMemCompare(pData, uiErasePattern, MAX_RW_SIZE)) if (!memcmp(pData, uiErasePattern, MAX_RW_SIZE))
{ {
return 0; return 0;
} }
...@@ -1138,7 +1138,7 @@ static INT flashWriteStatus( ...@@ -1138,7 +1138,7 @@ static INT flashWriteStatus(
// need not write 0xFFFFFFFF because write requires an erase and erase will // need not write 0xFFFFFFFF because write requires an erase and erase will
// make whole sector 0xFFFFFFFF. // make whole sector 0xFFFFFFFF.
// //
if (!OsalMemCompare(pData,uiErasePattern,MAX_RW_SIZE)) if (!memcmp(pData,uiErasePattern,MAX_RW_SIZE))
{ {
return 0; return 0;
} }
...@@ -1377,12 +1377,9 @@ INT BeceemFlashBulkWrite( ...@@ -1377,12 +1377,9 @@ INT BeceemFlashBulkWrite(
uiCurrSectOffsetAddr = uiOffset & (Adapter->uiSectorSize - 1); uiCurrSectOffsetAddr = uiOffset & (Adapter->uiSectorSize - 1);
uiSectBoundary = uiSectAlignAddr + Adapter->uiSectorSize; uiSectBoundary = uiSectAlignAddr + Adapter->uiSectorSize;
//pTempBuff = OsalMemAlloc(MAX_SECTOR_SIZE,'!MVN'); pTempBuff = kmalloc(Adapter->uiSectorSize, GFP_KERNEL);
pTempBuff = OsalMemAlloc(Adapter->uiSectorSize ,"!MVN");
if(NULL == pTempBuff) if(NULL == pTempBuff)
{
goto BeceemFlashBulkWrite_EXIT; goto BeceemFlashBulkWrite_EXIT;
}
// //
// check if the data to be written is overlapped accross sectors // check if the data to be written is overlapped accross sectors
// //
...@@ -1448,13 +1445,13 @@ INT BeceemFlashBulkWrite( ...@@ -1448,13 +1445,13 @@ INT BeceemFlashBulkWrite(
if(uiNumSectTobeRead > 1) if(uiNumSectTobeRead > 1)
{ {
OsalMemMove(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr)); memcpy(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr));
pcBuffer += ((uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr))); pcBuffer += ((uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr)));
uiNumBytes -= (uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr)); uiNumBytes -= (uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr));
} }
else else
{ {
OsalMemMove(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiNumBytes); memcpy(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiNumBytes);
} }
if(IsFlash2x(Adapter)) if(IsFlash2x(Adapter))
...@@ -1503,7 +1500,7 @@ INT BeceemFlashBulkWrite( ...@@ -1503,7 +1500,7 @@ INT BeceemFlashBulkWrite(
} }
else else
{ {
if(OsalMemCompare(ucReadBk,&pTempBuff[uiIndex],MAX_RW_SIZE)) if(memcmp(ucReadBk,&pTempBuff[uiIndex],MAX_RW_SIZE))
{ {
if(STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter,uiPartOffset+uiIndex,&pTempBuff[uiIndex])) if(STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter,uiPartOffset+uiIndex,&pTempBuff[uiIndex]))
{ {
...@@ -1541,10 +1538,8 @@ INT BeceemFlashBulkWrite( ...@@ -1541,10 +1538,8 @@ INT BeceemFlashBulkWrite(
{ {
BcmRestoreBlockProtectStatus(Adapter,ulStatus); BcmRestoreBlockProtectStatus(Adapter,ulStatus);
} }
if(pTempBuff)
{ kfree(pTempBuff);
OsalMemFree(pTempBuff,Adapter->uiSectorSize);
}
Adapter->SelectedChip = RESET_CHIP_SELECT; Adapter->SelectedChip = RESET_CHIP_SELECT;
return Status; return Status;
...@@ -1599,14 +1594,10 @@ static INT BeceemFlashBulkWriteStatus( ...@@ -1599,14 +1594,10 @@ static INT BeceemFlashBulkWriteStatus(
uiCurrSectOffsetAddr = uiOffset & (Adapter->uiSectorSize - 1); uiCurrSectOffsetAddr = uiOffset & (Adapter->uiSectorSize - 1);
uiSectBoundary = uiSectAlignAddr + Adapter->uiSectorSize; uiSectBoundary = uiSectAlignAddr + Adapter->uiSectorSize;
pTempBuff = kmalloc(Adapter->uiSectorSize, GFP_KERNEL);
// pTempBuff = OsalMemAlloc(MAX_SECTOR_SIZE,'!MVN');
pTempBuff = OsalMemAlloc(Adapter->uiSectorSize,"!MVN");
if(NULL == pTempBuff) if(NULL == pTempBuff)
{
goto BeceemFlashBulkWriteStatus_EXIT; goto BeceemFlashBulkWriteStatus_EXIT;
}
// //
// check if the data to be written is overlapped accross sectors // check if the data to be written is overlapped accross sectors
// //
...@@ -1662,13 +1653,13 @@ static INT BeceemFlashBulkWriteStatus( ...@@ -1662,13 +1653,13 @@ static INT BeceemFlashBulkWriteStatus(
if(uiNumSectTobeRead > 1) if(uiNumSectTobeRead > 1)
{ {
OsalMemMove(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr)); memcpy(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr));
pcBuffer += ((uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr))); pcBuffer += ((uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr)));
uiNumBytes -= (uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr)); uiNumBytes -= (uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr));
} }
else else
{ {
OsalMemMove(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiNumBytes); memcpy(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiNumBytes);
} }
if(IsFlash2x(Adapter)) if(IsFlash2x(Adapter))
...@@ -1716,7 +1707,7 @@ static INT BeceemFlashBulkWriteStatus( ...@@ -1716,7 +1707,7 @@ static INT BeceemFlashBulkWriteStatus(
if(STATUS_SUCCESS == BeceemFlashBulkRead(Adapter,(PUINT)ucReadBk,uiOffsetFromSectStart+uiIndex,MAX_RW_SIZE)) if(STATUS_SUCCESS == BeceemFlashBulkRead(Adapter,(PUINT)ucReadBk,uiOffsetFromSectStart+uiIndex,MAX_RW_SIZE))
{ {
if(OsalMemCompare(ucReadBk,&pTempBuff[uiIndex],MAX_RW_SIZE)) if(memcmp(ucReadBk,&pTempBuff[uiIndex],MAX_RW_SIZE))
{ {
Status = STATUS_FAILURE; Status = STATUS_FAILURE;
goto BeceemFlashBulkWriteStatus_EXIT; goto BeceemFlashBulkWriteStatus_EXIT;
...@@ -1747,10 +1738,8 @@ static INT BeceemFlashBulkWriteStatus( ...@@ -1747,10 +1738,8 @@ static INT BeceemFlashBulkWriteStatus(
{ {
BcmRestoreBlockProtectStatus(Adapter,ulStatus); BcmRestoreBlockProtectStatus(Adapter,ulStatus);
} }
if(pTempBuff)
{ kfree(pTempBuff);
OsalMemFree(pTempBuff,Adapter->uiSectorSize);
}
Adapter->SelectedChip = RESET_CHIP_SELECT; Adapter->SelectedChip = RESET_CHIP_SELECT;
return Status; return Status;
...@@ -1771,7 +1760,7 @@ static INT BeceemFlashBulkWriteStatus( ...@@ -1771,7 +1760,7 @@ static INT BeceemFlashBulkWriteStatus(
INT PropagateCalParamsFromEEPROMToMemory(PMINI_ADAPTER Adapter) INT PropagateCalParamsFromEEPROMToMemory(PMINI_ADAPTER Adapter)
{ {
PCHAR pBuff = OsalMemAlloc(BUFFER_4K,"3MVN"); PCHAR pBuff = kmalloc(BUFFER_4K, GFP_KERNEL);
UINT uiEepromSize = 0; UINT uiEepromSize = 0;
UINT uiIndex = 0; UINT uiIndex = 0;
UINT uiBytesToCopy = 0; UINT uiBytesToCopy = 0;
...@@ -1787,14 +1776,14 @@ INT PropagateCalParamsFromEEPROMToMemory(PMINI_ADAPTER Adapter) ...@@ -1787,14 +1776,14 @@ INT PropagateCalParamsFromEEPROMToMemory(PMINI_ADAPTER Adapter)
if(0 != BeceemEEPROMBulkRead(Adapter,&uiEepromSize,EEPROM_SIZE_OFFSET,4)) if(0 != BeceemEEPROMBulkRead(Adapter,&uiEepromSize,EEPROM_SIZE_OFFSET,4))
{ {
OsalMemFree(pBuff,BUFFER_4K); kfree(pBuff);
return -1; return -1;
} }
uiEepromSize >>= 16; uiEepromSize >>= 16;
if(uiEepromSize > 1024*1024) if(uiEepromSize > 1024*1024)
{ {
OsalMemFree(pBuff,BUFFER_4K); kfree(pBuff);
return -1; return -1;
} }
...@@ -1820,7 +1809,7 @@ INT PropagateCalParamsFromEEPROMToMemory(PMINI_ADAPTER Adapter) ...@@ -1820,7 +1809,7 @@ INT PropagateCalParamsFromEEPROMToMemory(PMINI_ADAPTER Adapter)
wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC-4,&value, sizeof(value)); wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC-4,&value, sizeof(value));
value = 0xbeadbead; value = 0xbeadbead;
wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC-8,&value, sizeof(value)); wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC-8,&value, sizeof(value));
OsalMemFree(pBuff,MAX_RW_SIZE); kfree(pBuff);
return Status; return Status;
...@@ -1873,7 +1862,7 @@ INT PropagateCalParamsFromFlashToMemory(PMINI_ADAPTER Adapter) ...@@ -1873,7 +1862,7 @@ INT PropagateCalParamsFromFlashToMemory(PMINI_ADAPTER Adapter)
return -1; return -1;
} }
pBuff = OsalMemAlloc(uiEepromSize, 0); pBuff = kmalloc(uiEepromSize, GFP_KERNEL);
if ( pBuff == NULL ) if ( pBuff == NULL )
{ {
...@@ -1882,7 +1871,7 @@ INT PropagateCalParamsFromFlashToMemory(PMINI_ADAPTER Adapter) ...@@ -1882,7 +1871,7 @@ INT PropagateCalParamsFromFlashToMemory(PMINI_ADAPTER Adapter)
if(0 != BeceemNVMRead(Adapter,(PUINT)pBuff,uiCalStartAddr, uiEepromSize)) if(0 != BeceemNVMRead(Adapter,(PUINT)pBuff,uiCalStartAddr, uiEepromSize))
{ {
OsalMemFree(pBuff, 0); kfree(pBuff);
return -1; return -1;
} }
...@@ -1905,7 +1894,7 @@ INT PropagateCalParamsFromFlashToMemory(PMINI_ADAPTER Adapter) ...@@ -1905,7 +1894,7 @@ INT PropagateCalParamsFromFlashToMemory(PMINI_ADAPTER Adapter)
uiBytesToCopy = MIN(BUFFER_4K,uiEepromSize); uiBytesToCopy = MIN(BUFFER_4K,uiEepromSize);
} }
OsalMemFree(pBuff, 0); kfree(pBuff);
return Status; return Status;
} }
...@@ -1947,14 +1936,14 @@ static INT BeceemEEPROMReadBackandVerify( ...@@ -1947,14 +1936,14 @@ static INT BeceemEEPROMReadBackandVerify(
{// for the requests more than or equal to MAX_RW_SIZE bytes, use bulk read function to make the access faster. {// for the requests more than or equal to MAX_RW_SIZE bytes, use bulk read function to make the access faster.
BeceemEEPROMBulkRead(Adapter,&auiData[0],uiOffset,MAX_RW_SIZE); BeceemEEPROMBulkRead(Adapter,&auiData[0],uiOffset,MAX_RW_SIZE);
if(OsalMemCompare(&pBuffer[uiIndex],&auiData[0],MAX_RW_SIZE)) if(memcmp(&pBuffer[uiIndex],&auiData[0],MAX_RW_SIZE))
{ {
// re-write // re-write
BeceemEEPROMBulkWrite(Adapter,(PUCHAR)(pBuffer+uiIndex),uiOffset,MAX_RW_SIZE,FALSE); BeceemEEPROMBulkWrite(Adapter,(PUCHAR)(pBuffer+uiIndex),uiOffset,MAX_RW_SIZE,FALSE);
mdelay(3); mdelay(3);
BeceemEEPROMBulkRead(Adapter,&auiData[0],uiOffset,MAX_RW_SIZE); BeceemEEPROMBulkRead(Adapter,&auiData[0],uiOffset,MAX_RW_SIZE);
if(OsalMemCompare(&pBuffer[uiIndex],&auiData[0],MAX_RW_SIZE)) if(memcmp(&pBuffer[uiIndex],&auiData[0],MAX_RW_SIZE))
{ {
return -1; return -1;
} }
...@@ -1986,7 +1975,7 @@ static INT BeceemEEPROMReadBackandVerify( ...@@ -1986,7 +1975,7 @@ static INT BeceemEEPROMReadBackandVerify(
else else
{ // Handle the reads less than 4 bytes... { // Handle the reads less than 4 bytes...
uiData = 0; uiData = 0;
OsalMemMove(&uiData,((PUCHAR)pBuffer)+(uiIndex*sizeof(UINT)),uiNumBytes); memcpy(&uiData,((PUCHAR)pBuffer)+(uiIndex*sizeof(UINT)),uiNumBytes);
BeceemEEPROMBulkRead(Adapter,&uiRdbk,uiOffset,4); BeceemEEPROMBulkRead(Adapter,&uiRdbk,uiOffset,4);
if(memcmp(&uiData, &uiRdbk, uiNumBytes)) if(memcmp(&uiData, &uiRdbk, uiNumBytes))
...@@ -2186,7 +2175,7 @@ INT BeceemEEPROMBulkWrite( ...@@ -2186,7 +2175,7 @@ INT BeceemEEPROMBulkWrite(
if(uiBytesToCopy >= (16 -uiExtraBytes)) if(uiBytesToCopy >= (16 -uiExtraBytes))
{ {
OsalMemMove((((PUCHAR)&uiData[0])+uiExtraBytes),pBuffer,MAX_RW_SIZE- uiExtraBytes); memcpy((((PUCHAR)&uiData[0])+uiExtraBytes),pBuffer,MAX_RW_SIZE- uiExtraBytes);
if ( STATUS_FAILURE == BeceemEEPROMWritePage( Adapter, uiData, uiTempOffset ) ) if ( STATUS_FAILURE == BeceemEEPROMWritePage( Adapter, uiData, uiTempOffset ) )
return STATUS_FAILURE; return STATUS_FAILURE;
...@@ -2197,7 +2186,7 @@ INT BeceemEEPROMBulkWrite( ...@@ -2197,7 +2186,7 @@ INT BeceemEEPROMBulkWrite(
} }
else else
{ {
OsalMemMove((((PUCHAR)&uiData[0])+uiExtraBytes),pBuffer,uiBytesToCopy); memcpy((((PUCHAR)&uiData[0])+uiExtraBytes),pBuffer,uiBytesToCopy);
if ( STATUS_FAILURE == BeceemEEPROMWritePage( Adapter, uiData, uiTempOffset ) ) if ( STATUS_FAILURE == BeceemEEPROMWritePage( Adapter, uiData, uiTempOffset ) )
return STATUS_FAILURE; return STATUS_FAILURE;
...@@ -2233,7 +2222,7 @@ INT BeceemEEPROMBulkWrite( ...@@ -2233,7 +2222,7 @@ INT BeceemEEPROMBulkWrite(
// To program non 16byte aligned data, read 16byte and then update. // To program non 16byte aligned data, read 16byte and then update.
// //
BeceemEEPROMBulkRead(Adapter,&uiData[0],uiOffset,16); BeceemEEPROMBulkRead(Adapter,&uiData[0],uiOffset,16);
OsalMemMove(&uiData[0],pBuffer+uiIndex,uiBytesToCopy); memcpy(&uiData[0],pBuffer+uiIndex,uiBytesToCopy);
if ( STATUS_FAILURE == BeceemEEPROMWritePage( Adapter, uiData, uiOffset ) ) if ( STATUS_FAILURE == BeceemEEPROMWritePage( Adapter, uiData, uiOffset ) )
...@@ -2763,7 +2752,7 @@ INT BcmAllocFlashCSStructure(PMINI_ADAPTER psAdapter) ...@@ -2763,7 +2752,7 @@ INT BcmAllocFlashCSStructure(PMINI_ADAPTER psAdapter)
if(psAdapter->psFlash2xCSInfo == NULL) if(psAdapter->psFlash2xCSInfo == NULL)
{ {
BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_PRINTK, 0, 0,"Can't Allocate memory for Flash 2.x"); BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_PRINTK, 0, 0,"Can't Allocate memory for Flash 2.x");
bcm_kfree(psAdapter->psFlashCSInfo); kfree(psAdapter->psFlashCSInfo);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2771,8 +2760,8 @@ INT BcmAllocFlashCSStructure(PMINI_ADAPTER psAdapter) ...@@ -2771,8 +2760,8 @@ INT BcmAllocFlashCSStructure(PMINI_ADAPTER psAdapter)
if(psAdapter->psFlash2xVendorInfo == NULL) if(psAdapter->psFlash2xVendorInfo == NULL)
{ {
BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_PRINTK, 0, 0,"Can't Allocate Vendor Info Memory for Flash 2.x"); BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_PRINTK, 0, 0,"Can't Allocate Vendor Info Memory for Flash 2.x");
bcm_kfree(psAdapter->psFlashCSInfo); kfree(psAdapter->psFlashCSInfo);
bcm_kfree(psAdapter->psFlash2xCSInfo); kfree(psAdapter->psFlash2xCSInfo);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2786,9 +2775,9 @@ INT BcmDeAllocFlashCSStructure(PMINI_ADAPTER psAdapter) ...@@ -2786,9 +2775,9 @@ INT BcmDeAllocFlashCSStructure(PMINI_ADAPTER psAdapter)
BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_PRINTK, 0, 0," Adapter structure point is NULL"); BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_PRINTK, 0, 0," Adapter structure point is NULL");
return -EINVAL; return -EINVAL;
} }
bcm_kfree(psAdapter->psFlashCSInfo); kfree(psAdapter->psFlashCSInfo);
bcm_kfree(psAdapter->psFlash2xCSInfo); kfree(psAdapter->psFlash2xCSInfo);
bcm_kfree(psAdapter->psFlash2xVendorInfo); kfree(psAdapter->psFlash2xVendorInfo);
return STATUS_SUCCESS ; return STATUS_SUCCESS ;
} }
...@@ -4570,7 +4559,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) ...@@ -4570,7 +4559,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut)
} }
bcm_kfree(Buff); kfree(Buff);
return Status; return Status;
} }
...@@ -4936,7 +4925,7 @@ INT BcmCopySection(PMINI_ADAPTER Adapter, ...@@ -4936,7 +4925,7 @@ INT BcmCopySection(PMINI_ADAPTER Adapter,
BytesToBeCopied = numOfBytes; BytesToBeCopied = numOfBytes;
} }
}while(numOfBytes > 0) ; }while(numOfBytes > 0) ;
bcm_kfree(pBuff); kfree(pBuff);
Adapter->bHeaderChangeAllowed = FALSE ; Adapter->bHeaderChangeAllowed = FALSE ;
return Status; return Status;
} }
...@@ -5006,7 +4995,7 @@ INT SaveHeaderIfPresent(PMINI_ADAPTER Adapter, PUCHAR pBuff, UINT uiOffset) ...@@ -5006,7 +4995,7 @@ INT SaveHeaderIfPresent(PMINI_ADAPTER Adapter, PUCHAR pBuff, UINT uiOffset)
//Replace Buffer content with Header //Replace Buffer content with Header
memcpy(pBuff +offsetToProtect,pTempBuff,HeaderSizeToProtect); memcpy(pBuff +offsetToProtect,pTempBuff,HeaderSizeToProtect);
bcm_kfree(pTempBuff); kfree(pTempBuff);
} }
if(bHasHeader && Adapter->bSigCorrupted) if(bHasHeader && Adapter->bSigCorrupted)
{ {
...@@ -5525,11 +5514,11 @@ INT CorruptDSDSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) ...@@ -5525,11 +5514,11 @@ INT CorruptDSDSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal)
else else
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"BCM Signature is not present in header"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"BCM Signature is not present in header");
bcm_kfree(pBuff); kfree(pBuff);
return STATUS_FAILURE; return STATUS_FAILURE;
} }
bcm_kfree(pBuff); kfree(pBuff);
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Corrupted the signature"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Corrupted the signature");
return STATUS_SUCCESS ; return STATUS_SUCCESS ;
} }
...@@ -5575,14 +5564,14 @@ INT CorruptISOSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) ...@@ -5575,14 +5564,14 @@ INT CorruptISOSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal)
else else
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"BCM Signature is not present in header"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"BCM Signature is not present in header");
bcm_kfree(pBuff); kfree(pBuff);
return STATUS_FAILURE; return STATUS_FAILURE;
} }
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Corrupted the signature"); BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,"Corrupted the signature");
BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,pBuff,MAX_RW_SIZE); BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL,pBuff,MAX_RW_SIZE);
bcm_kfree(pBuff); kfree(pBuff);
return STATUS_SUCCESS ; return STATUS_SUCCESS ;
} }
......
/*++
Copyright (c) Beceem Communications Inc.
Module Name:
OSAL_Misc.h
Abstract:
Provides the OS Abstracted macros to access:
Linked Lists
Dispatcher Objects(Events,Semaphores,Spin Locks and the like)
Files
Revision History:
Who When What
-------- -------- ----------------------------------------------
Name Date Created/reviewed/modified
Rajeev 24/1/08 Created
Notes:
--*/
#ifndef _OSAL_MISC_H_
#define _OSAL_MISC_H_
//OSAL Macros
//OSAL Primitives
typedef PUCHAR POSAL_NW_PACKET ; //Nw packets
#define OsalMemAlloc(n,t) kmalloc(n,GFP_KERNEL)
#define OsalMemFree(x,n) bcm_kfree(x)
#define OsalMemMove(dest, src, len) \
{ \
memcpy(dest,src, len); \
}
#define OsalZeroMemory(pDest, Len) \
{ \
memset(pDest,0,Len); \
}
//#define OsalMemSet(pSrc,Char,Len) memset(pSrc,Char,Len)
bool OsalMemCompare(void *dest, void *src, UINT len);
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册