From: Matthias Beyer Date: Tue, 15 Jul 2014 07:42:54 +0000 (+0200) Subject: Staging: bcm: PHSModule.c: Whitespace & Indentation cleanup X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=ca89a2950cc2821ef5ee678afc3eb3187db05294;p=openwrt%2Fstaging%2Fblogic.git Staging: bcm: PHSModule.c: Whitespace & Indentation cleanup Signed-off-by: Matthias Beyer Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c index 4b6de7683deb..79d84d712bf9 100644 --- a/drivers/staging/bcm/PHSModule.c +++ b/drivers/staging/bcm/PHSModule.c @@ -1,46 +1,80 @@ #include "headers.h" -static UINT CreateSFToClassifierRuleMapping(B_UINT16 uiVcid, B_UINT16 uiClsId, struct bcm_phs_table *psServiceFlowTable, struct bcm_phs_rule *psPhsRule, B_UINT8 u8AssociatedPHSI); - -static UINT CreateClassiferToPHSRuleMapping(B_UINT16 uiVcid, B_UINT16 uiClsId, struct bcm_phs_entry *pstServiceFlowEntry, struct bcm_phs_rule *psPhsRule, B_UINT8 u8AssociatedPHSI); - -static UINT CreateClassifierPHSRule(B_UINT16 uiClsId, struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *psPhsRule, enum bcm_phs_classifier_context eClsContext, B_UINT8 u8AssociatedPHSI); - -static UINT UpdateClassifierPHSRule(B_UINT16 uiClsId, struct bcm_phs_classifier_entry *pstClassifierEntry, struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *psPhsRule, B_UINT8 u8AssociatedPHSI); +static UINT CreateSFToClassifierRuleMapping(B_UINT16 uiVcid, + B_UINT16 uiClsId, + struct bcm_phs_table *psServiceFlowTable, + struct bcm_phs_rule *psPhsRule, + B_UINT8 u8AssociatedPHSI); + +static UINT CreateClassiferToPHSRuleMapping(B_UINT16 uiVcid, + B_UINT16 uiClsId, + struct bcm_phs_entry *pstServiceFlowEntry, + struct bcm_phs_rule *psPhsRule, + B_UINT8 u8AssociatedPHSI); + +static UINT CreateClassifierPHSRule(B_UINT16 uiClsId, + struct bcm_phs_classifier_table *psaClassifiertable, + struct bcm_phs_rule *psPhsRule, + enum bcm_phs_classifier_context eClsContext, + B_UINT8 u8AssociatedPHSI); + +static UINT UpdateClassifierPHSRule(B_UINT16 uiClsId, + struct bcm_phs_classifier_entry *pstClassifierEntry, + struct bcm_phs_classifier_table *psaClassifiertable, + struct bcm_phs_rule *psPhsRule, + B_UINT8 u8AssociatedPHSI); static bool ValidatePHSRuleComplete(struct bcm_phs_rule *psPhsRule); -static bool DerefPhsRule(B_UINT16 uiClsId, struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *pstPhsRule); +static bool DerefPhsRule(B_UINT16 uiClsId, + struct bcm_phs_classifier_table *psaClassifiertable, + struct bcm_phs_rule *pstPhsRule); -static UINT GetClassifierEntry(struct bcm_phs_classifier_table *pstClassifierTable, B_UINT32 uiClsid, enum bcm_phs_classifier_context eClsContext, struct bcm_phs_classifier_entry **ppstClassifierEntry); +static UINT GetClassifierEntry(struct bcm_phs_classifier_table *pstClassifierTable, + B_UINT32 uiClsid, + enum bcm_phs_classifier_context eClsContext, + struct bcm_phs_classifier_entry **ppstClassifierEntry); -static UINT GetPhsRuleEntry(struct bcm_phs_classifier_table *pstClassifierTable, B_UINT32 uiPHSI, enum bcm_phs_classifier_context eClsContext, struct bcm_phs_rule **ppstPhsRule); +static UINT GetPhsRuleEntry(struct bcm_phs_classifier_table *pstClassifierTable, + B_UINT32 uiPHSI, + enum bcm_phs_classifier_context eClsContext, + struct bcm_phs_rule **ppstPhsRule); static void free_phs_serviceflow_rules(struct bcm_phs_table *psServiceFlowRulesTable); -static int phs_compress(struct bcm_phs_rule *phs_members, unsigned char *in_buf, - unsigned char *out_buf, unsigned int *header_size, UINT *new_header_size); +static int phs_compress(struct bcm_phs_rule *phs_members, + unsigned char *in_buf, + unsigned char *out_buf, + unsigned int *header_size, + UINT *new_header_size); -static int verify_suppress_phsf(unsigned char *in_buffer, unsigned char *out_buffer, - unsigned char *phsf, unsigned char *phsm, unsigned int phss, unsigned int phsv, UINT *new_header_size); +static int verify_suppress_phsf(unsigned char *in_buffer, + unsigned char *out_buffer, + unsigned char *phsf, + unsigned char *phsm, + unsigned int phss, + unsigned int phsv, + UINT *new_header_size); -static int phs_decompress(unsigned char *in_buf, unsigned char *out_buf, - struct bcm_phs_rule *phs_rules, UINT *header_size); +static int phs_decompress(unsigned char *in_buf, + unsigned char *out_buf, + struct bcm_phs_rule *phs_rules, + UINT *header_size); static ULONG PhsCompress(void *pvContext, - B_UINT16 uiVcid, - B_UINT16 uiClsId, - void *pvInputBuffer, - void *pvOutputBuffer, - UINT *pOldHeaderSize, - UINT *pNewHeaderSize); + B_UINT16 uiVcid, + B_UINT16 uiClsId, + void *pvInputBuffer, + void *pvOutputBuffer, + UINT *pOldHeaderSize, + UINT *pNewHeaderSize); static ULONG PhsDeCompress(void *pvContext, - B_UINT16 uiVcid, - void *pvInputBuffer, - void *pvOutputBuffer, - UINT *pInHeaderSize, - UINT *pOutHeaderSize); + B_UINT16 uiVcid, + void *pvInputBuffer, + void *pvOutputBuffer, + UINT *pInHeaderSize, + UINT *pOutHeaderSize); #define IN #define OUT @@ -87,7 +121,8 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, struct sk_buff *newPacket = NULL; struct sk_buff *Packet = *pPacket; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "In PHSTransmit"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, + "In PHSTransmit"); if (!bEthCSSupport) BytesToRemove = ETH_HLEN; @@ -116,16 +151,22 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, (usPacketType == ETHERNET_FRAMETYPE_IPV6)) && (bHeaderSuppressionEnabled)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "\nTrying to PHS Compress Using Classifier rule 0x%X", uiClassifierRuleID); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, + DBG_LVL_ALL, + "\nTrying to PHS Compress Using Classifier rule 0x%X", + uiClassifierRuleID); unPHSNewPktHeaderLen = unPHSPktHdrBytesCopied; ulPhsStatus = PhsCompress(&Adapter->stBCMPhsContext, - Vcid, - uiClassifierRuleID, - pucPHSPktHdrInBuf, - pucPHSPktHdrOutBuf, - &unPhsOldHdrSize, - &unPHSNewPktHeaderLen); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "\nPHS Old header Size : %d New Header Size %d\n", unPhsOldHdrSize, unPHSNewPktHeaderLen); + Vcid, + uiClassifierRuleID, + pucPHSPktHdrInBuf, + pucPHSPktHdrOutBuf, + &unPhsOldHdrSize, + &unPHSNewPktHeaderLen); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, + DBG_LVL_ALL, + "\nPHS Old header Size : %d New Header Size %d\n", + unPhsOldHdrSize, unPHSNewPktHeaderLen); if (unPHSNewPktHeaderLen == unPhsOldHdrSize) { @@ -137,7 +178,9 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, if (ulPhsStatus == STATUS_PHS_COMPRESSED) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "PHS Sending packet Compressed"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, + PHS_SEND, DBG_LVL_ALL, + "PHS Sending packet Compressed"); if (skb_cloned(Packet)) { newPacket = skb_copy(Packet, GFP_ATOMIC); @@ -147,22 +190,32 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, dev_kfree_skb(Packet); *pPacket = Packet = newPacket; - pucPHSPktHdrInBuf = Packet->data + BytesToRemove; + pucPHSPktHdrInBuf = + Packet->data + BytesToRemove; } - numBytesCompressed = unPhsOldHdrSize - (unPHSNewPktHeaderLen + PHSI_LEN); + numBytesCompressed = unPhsOldHdrSize - + (unPHSNewPktHeaderLen + PHSI_LEN); - memcpy(pucPHSPktHdrInBuf + numBytesCompressed, pucPHSPktHdrOutBuf, unPHSNewPktHeaderLen + PHSI_LEN); - memcpy(Packet->data + numBytesCompressed, Packet->data, BytesToRemove); + memcpy(pucPHSPktHdrInBuf + numBytesCompressed, + pucPHSPktHdrOutBuf, + unPHSNewPktHeaderLen + PHSI_LEN); + memcpy(Packet->data + numBytesCompressed, + Packet->data, BytesToRemove); skb_pull(Packet, numBytesCompressed); return STATUS_SUCCESS; } else { - /* if one byte headroom is not available, increase it through skb_cow */ + /* if one byte headroom is not available, + * increase it through skb_cow + */ if (!(skb_headroom(Packet) > 0)) { if (skb_cow(Packet, 1)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "SKB Cow Failed\n"); + BCM_DEBUG_PRINT(Adapter, + DBG_TYPE_PRINTK, + 0, 0, + "SKB Cow Failed\n"); return STATUS_FAILURE; } } @@ -179,7 +232,9 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, } else { if (!bHeaderSuppressionEnabled) - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "\nHeader Suppression Disabled For SF: No PHS\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, + PHS_SEND, DBG_LVL_ALL, + "\nHeader Suppression Disabled For SF: No PHS\n"); return STATUS_SUCCESS; } @@ -190,11 +245,11 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, } int PHSReceive(struct bcm_mini_adapter *Adapter, - USHORT usVcid, - struct sk_buff *packet, - UINT *punPacketLen, - UCHAR *pucEthernetHdr, - UINT bHeaderSuppressionEnabled) + USHORT usVcid, + struct sk_buff *packet, + UINT *punPacketLen, + UCHAR *pucEthernetHdr, + UINT bHeaderSuppressionEnabled) { u32 nStandardPktHdrLen = 0; u32 nTotalsuppressedPktHdrBytes = 0; @@ -203,7 +258,9 @@ int PHSReceive(struct bcm_mini_adapter *Adapter, UINT TotalBytesAdded = 0; if (!bHeaderSuppressionEnabled) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, "\nPhs Disabled for incoming packet"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, + DBG_LVL_ALL, + "\nPhs Disabled for incoming packet"); return ulPhsStatus; } @@ -212,27 +269,31 @@ int PHSReceive(struct bcm_mini_adapter *Adapter, /* Restore PHS suppressed header */ nStandardPktHdrLen = packet->len; ulPhsStatus = PhsDeCompress(&Adapter->stBCMPhsContext, - usVcid, - pucInBuff, - Adapter->ucaPHSPktRestoreBuf, - &nTotalsuppressedPktHdrBytes, - &nStandardPktHdrLen); - - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, "\nSuppressed PktHdrLen : 0x%x Restored PktHdrLen : 0x%x", + usVcid, + pucInBuff, + Adapter->ucaPHSPktRestoreBuf, + &nTotalsuppressedPktHdrBytes, + &nStandardPktHdrLen); + + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, + "\nSuppressed PktHdrLen : 0x%x Restored PktHdrLen : 0x%x", nTotalsuppressedPktHdrBytes, nStandardPktHdrLen); if (ulPhsStatus != STATUS_PHS_COMPRESSED) { skb_pull(packet, 1); return STATUS_SUCCESS; } else { - TotalBytesAdded = nStandardPktHdrLen - nTotalsuppressedPktHdrBytes - PHSI_LEN; + TotalBytesAdded = nStandardPktHdrLen - + nTotalsuppressedPktHdrBytes - PHSI_LEN; if (TotalBytesAdded) { if (skb_headroom(packet) >= (SKB_RESERVE_ETHERNET_HEADER + TotalBytesAdded)) skb_push(packet, TotalBytesAdded); else { if (skb_cow(packet, skb_headroom(packet) + TotalBytesAdded)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "cow failed in receive\n"); + BCM_DEBUG_PRINT(Adapter, + DBG_TYPE_PRINTK, 0, 0, + "cow failed in receive\n"); return STATUS_FAILURE; } @@ -240,7 +301,8 @@ int PHSReceive(struct bcm_mini_adapter *Adapter, } } - memcpy(packet->data, Adapter->ucaPHSPktRestoreBuf, nStandardPktHdrLen); + memcpy(packet->data, Adapter->ucaPHSPktRestoreBuf, + nStandardPktHdrLen); } return STATUS_SUCCESS; @@ -250,8 +312,10 @@ void DumpFullPacket(UCHAR *pBuf, UINT nPktLen) { struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Dumping Data Packet"); - BCM_DEBUG_PRINT_BUFFER(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, pBuf, nPktLen); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, + "Dumping Data Packet"); + BCM_DEBUG_PRINT_BUFFER(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, + pBuf, nPktLen); } /* @@ -267,30 +331,38 @@ void DumpFullPacket(UCHAR *pBuf, UINT nPktLen) * TRUE(1) -If allocation of memory was successful. * FALSE -If allocation of memory fails. */ -int phs_init(struct bcm_phs_extension *pPhsdeviceExtension, struct bcm_mini_adapter *Adapter) +int phs_init(struct bcm_phs_extension *pPhsdeviceExtension, + struct bcm_mini_adapter *Adapter) { int i; struct bcm_phs_table *pstServiceFlowTable; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nPHS:phs_init function"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, + "\nPHS:phs_init function"); if (pPhsdeviceExtension->pstServiceFlowPhsRulesTable) return -EINVAL; - pPhsdeviceExtension->pstServiceFlowPhsRulesTable = kzalloc(sizeof(struct bcm_phs_table), GFP_KERNEL); + pPhsdeviceExtension->pstServiceFlowPhsRulesTable = + kzalloc(sizeof(struct bcm_phs_table), GFP_KERNEL); if (!pPhsdeviceExtension->pstServiceFlowPhsRulesTable) { - 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; } pstServiceFlowTable = pPhsdeviceExtension->pstServiceFlowPhsRulesTable; for (i = 0; i < MAX_SERVICEFLOWS; i++) { - struct bcm_phs_entry sServiceFlow = pstServiceFlowTable->stSFList[i]; - - sServiceFlow.pstClassifierTable = kzalloc(sizeof(struct bcm_phs_classifier_table), GFP_KERNEL); + struct bcm_phs_entry sServiceFlow = + pstServiceFlowTable->stSFList[i]; + sServiceFlow.pstClassifierTable = + kzalloc(sizeof(struct bcm_phs_classifier_table), + GFP_KERNEL); if (!sServiceFlow.pstClassifierTable) { - 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->pstServiceFlowPhsRulesTable); pPhsdeviceExtension->pstServiceFlowPhsRulesTable = NULL; return -ENOMEM; @@ -299,22 +371,26 @@ int phs_init(struct bcm_phs_extension *pPhsdeviceExtension, struct bcm_mini_adap pPhsdeviceExtension->CompressedTxBuffer = kmalloc(PHS_BUFFER_SIZE, GFP_KERNEL); if (pPhsdeviceExtension->CompressedTxBuffer == 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"); free_phs_serviceflow_rules(pPhsdeviceExtension->pstServiceFlowPhsRulesTable); pPhsdeviceExtension->pstServiceFlowPhsRulesTable = NULL; return -ENOMEM; } - pPhsdeviceExtension->UnCompressedRxBuffer = kmalloc(PHS_BUFFER_SIZE, GFP_KERNEL); + pPhsdeviceExtension->UnCompressedRxBuffer = + kmalloc(PHS_BUFFER_SIZE, GFP_KERNEL); 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"); kfree(pPhsdeviceExtension->CompressedTxBuffer); free_phs_serviceflow_rules(pPhsdeviceExtension->pstServiceFlowPhsRulesTable); pPhsdeviceExtension->pstServiceFlowPhsRulesTable = NULL; return -ENOMEM; } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\n phs_init Successful"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, + "\n phs_init Successful"); return STATUS_SUCCESS; } @@ -353,10 +429,10 @@ int PhsCleanup(IN struct bcm_phs_extension *pPHSDeviceExt) * >0 Error. */ ULONG PhsUpdateClassifierRule(IN void *pvContext, - IN B_UINT16 uiVcid , - IN B_UINT16 uiClsId , - IN struct bcm_phs_rule *psPhsRule, - IN B_UINT8 u8AssociatedPHSI) + IN B_UINT16 uiVcid , + IN B_UINT16 uiClsId , + IN struct bcm_phs_rule *psPhsRule, + IN B_UINT8 u8AssociatedPHSI) { ULONG lStatus = 0; UINT nSFIndex = 0; @@ -364,10 +440,12 @@ ULONG PhsUpdateClassifierRule(IN void *pvContext, struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); struct bcm_phs_extension *pDeviceExtension = (struct bcm_phs_extension *)pvContext; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "PHS With Corr2 Changes\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, + "PHS With Corr2 Changes\n"); if (pDeviceExtension == NULL) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "Invalid Device Extension\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, + DBG_LVL_ALL, "Invalid Device Extension\n"); return ERR_PHS_INVALID_DEVICE_EXETENSION; } @@ -376,18 +454,22 @@ ULONG PhsUpdateClassifierRule(IN void *pvContext, /* Retrieve the SFID Entry Index for requested Service Flow */ nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, - uiVcid, &pstServiceFlowEntry); + uiVcid, &pstServiceFlowEntry); if (nSFIndex == PHS_INVALID_TABLE_INDEX) { /* This is a new SF. Create a mapping entry for this */ lStatus = CreateSFToClassifierRuleMapping(uiVcid, uiClsId, - pDeviceExtension->pstServiceFlowPhsRulesTable, psPhsRule, u8AssociatedPHSI); + pDeviceExtension->pstServiceFlowPhsRulesTable, + psPhsRule, + u8AssociatedPHSI); return lStatus; } /* SF already Exists Add PHS Rule to existing SF */ lStatus = CreateClassiferToPHSRuleMapping(uiVcid, uiClsId, - pstServiceFlowEntry, psPhsRule, u8AssociatedPHSI); + pstServiceFlowEntry, + psPhsRule, + u8AssociatedPHSI); return lStatus; } @@ -408,7 +490,9 @@ ULONG PhsUpdateClassifierRule(IN void *pvContext, * 0 if successful, * >0 Error. */ -ULONG PhsDeletePHSRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT8 u8PHSI) +ULONG PhsDeletePHSRule(IN void *pvContext, + IN B_UINT16 uiVcid, + IN B_UINT8 u8PHSI) { UINT nSFIndex = 0, nClsidIndex = 0; struct bcm_phs_entry *pstServiceFlowEntry = NULL; @@ -416,14 +500,17 @@ ULONG PhsDeletePHSRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT8 u8PHSI struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); struct bcm_phs_extension *pDeviceExtension = (struct bcm_phs_extension *)pvContext; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "======>\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, + "======>\n"); if (pDeviceExtension) { /* Retrieve the SFID Entry Index for requested Service Flow */ - nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, uiVcid, &pstServiceFlowEntry); + nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, + uiVcid, &pstServiceFlowEntry); if (nSFIndex == PHS_INVALID_TABLE_INDEX) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "SFID Match Failed\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, + DBG_LVL_ALL, "SFID Match Failed\n"); return ERR_SF_MATCH_FAIL; } @@ -439,8 +526,9 @@ ULONG PhsDeletePHSRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT8 u8PHSI if (0 == pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt) kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule); - memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0, - sizeof(struct bcm_phs_classifier_entry)); + memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], + 0, + sizeof(struct bcm_phs_classifier_entry)); } } } @@ -471,18 +559,23 @@ ULONG PhsDeleteClassifierRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT1 struct bcm_phs_entry *pstServiceFlowEntry = NULL; struct bcm_phs_classifier_entry *pstClassifierEntry = NULL; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - struct bcm_phs_extension *pDeviceExtension = (struct bcm_phs_extension *)pvContext; + struct bcm_phs_extension *pDeviceExtension = + (struct bcm_phs_extension *)pvContext; if (pDeviceExtension) { /* Retrieve the SFID Entry Index for requested Service Flow */ - nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, uiVcid, &pstServiceFlowEntry); + nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, + uiVcid, &pstServiceFlowEntry); if (nSFIndex == PHS_INVALID_TABLE_INDEX) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "SFID Match Failed\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, + DBG_LVL_ALL, "SFID Match Failed\n"); return ERR_SF_MATCH_FAIL; } nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable, - uiClsId, eActiveClassifierRuleContext, &pstClassifierEntry); + uiClsId, + eActiveClassifierRuleContext, + &pstClassifierEntry); if ((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule)) { if (pstClassifierEntry->pstPhsRule) { @@ -492,15 +585,19 @@ ULONG PhsDeleteClassifierRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT1 if (0 == pstClassifierEntry->pstPhsRule->u8RefCnt) kfree(pstClassifierEntry->pstPhsRule); } - memset(pstClassifierEntry, 0, sizeof(struct bcm_phs_classifier_entry)); + memset(pstClassifierEntry, 0, + sizeof(struct bcm_phs_classifier_entry)); } nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable, - uiClsId, eOldClassifierRuleContext, &pstClassifierEntry); + uiClsId, + eOldClassifierRuleContext, + &pstClassifierEntry); if ((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule)) { kfree(pstClassifierEntry->pstPhsRule); - memset(pstClassifierEntry, 0, sizeof(struct bcm_phs_classifier_entry)); + memset(pstClassifierEntry, 0, + sizeof(struct bcm_phs_classifier_entry)); } } return 0; @@ -527,16 +624,19 @@ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 uiVcid) struct bcm_phs_entry *pstServiceFlowEntry = NULL; struct bcm_phs_classifier_table *pstClassifierRulesTable = NULL; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - struct bcm_phs_extension *pDeviceExtension = (struct bcm_phs_extension *)pvContext; + struct bcm_phs_extension *pDeviceExtension = + (struct bcm_phs_extension *)pvContext; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "====>\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, + "====>\n"); if (pDeviceExtension) { /* Retrieve the SFID Entry Index for requested Service Flow */ nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, - uiVcid, &pstServiceFlowEntry); + uiVcid, &pstServiceFlowEntry); if (nSFIndex == PHS_INVALID_TABLE_INDEX) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "SFID Match Failed\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, + DBG_LVL_ALL, "SFID Match Failed\n"); return ERR_SF_MATCH_FAIL; } @@ -553,7 +653,8 @@ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 uiVcid) pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule = NULL; } - memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0, sizeof(struct bcm_phs_classifier_entry)); + memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], + 0, sizeof(struct bcm_phs_classifier_entry)); if (pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule) { if (pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt) @@ -564,7 +665,8 @@ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 uiVcid) pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule = NULL; } - memset(&pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex], 0, sizeof(struct bcm_phs_classifier_entry)); + memset(&pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex], + 0, sizeof(struct bcm_phs_classifier_entry)); } } pstServiceFlowEntry->bUsed = false; @@ -595,12 +697,12 @@ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 uiVcid) * >0 Error. */ static ULONG PhsCompress(IN void *pvContext, - IN B_UINT16 uiVcid, - IN B_UINT16 uiClsId, - IN void *pvInputBuffer, - OUT void *pvOutputBuffer, - OUT UINT *pOldHeaderSize, - OUT UINT *pNewHeaderSize) + IN B_UINT16 uiVcid, + IN B_UINT16 uiClsId, + IN void *pvInputBuffer, + OUT void *pvOutputBuffer, + OUT UINT *pOldHeaderSize, + OUT UINT *pNewHeaderSize) { UINT nSFIndex = 0, nClsidIndex = 0; struct bcm_phs_entry *pstServiceFlowEntry = NULL; @@ -608,30 +710,36 @@ static ULONG PhsCompress(IN void *pvContext, struct bcm_phs_rule *pstPhsRule = NULL; ULONG lStatus = 0; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - struct bcm_phs_extension *pDeviceExtension = (struct bcm_phs_extension *)pvContext; + struct bcm_phs_extension *pDeviceExtension = + (struct bcm_phs_extension *)pvContext; if (pDeviceExtension == NULL) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "Invalid Device Extension\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, + "Invalid Device Extension\n"); lStatus = STATUS_PHS_NOCOMPRESSION; return lStatus; } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "Suppressing header\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, + "Suppressing header\n"); /* Retrieve the SFID Entry Index for requested Service Flow */ nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, uiVcid, &pstServiceFlowEntry); if (nSFIndex == PHS_INVALID_TABLE_INDEX) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "SFID Match Failed\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, + "SFID Match Failed\n"); lStatus = STATUS_PHS_NOCOMPRESSION; return lStatus; } nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable, - uiClsId, eActiveClassifierRuleContext, &pstClassifierEntry); + uiClsId, eActiveClassifierRuleContext, + &pstClassifierEntry); if (nClsidIndex == PHS_INVALID_TABLE_INDEX) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "No PHS Rule Defined For Classifier\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, + "No PHS Rule Defined For Classifier\n"); lStatus = STATUS_PHS_NOCOMPRESSION; return lStatus; } @@ -639,7 +747,8 @@ static ULONG PhsCompress(IN void *pvContext, /* get rule from SF id,Cls ID pair and proceed */ pstPhsRule = pstClassifierEntry->pstPhsRule; if (!ValidatePHSRuleComplete(pstPhsRule)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "PHS Rule Defined For Classifier But Not Complete\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, + "PHS Rule Defined For Classifier But Not Complete\n"); lStatus = STATUS_PHS_NOCOMPRESSION; return lStatus; } @@ -649,7 +758,8 @@ static ULONG PhsCompress(IN void *pvContext, (PUCHAR)pvOutputBuffer, pOldHeaderSize, pNewHeaderSize); if (lStatus == STATUS_PHS_COMPRESSED) { - pstPhsRule->PHSModifiedBytes += *pOldHeaderSize - *pNewHeaderSize - 1; + pstPhsRule->PHSModifiedBytes += + *pOldHeaderSize - *pNewHeaderSize - 1; pstPhsRule->PHSModifiedNumPackets++; } else pstPhsRule->PHSErrorNumPackets++; @@ -676,52 +786,64 @@ static ULONG PhsCompress(IN void *pvContext, * >0 Error. */ static ULONG PhsDeCompress(IN void *pvContext, - IN B_UINT16 uiVcid, - IN void *pvInputBuffer, - OUT void *pvOutputBuffer, - OUT UINT *pInHeaderSize, - OUT UINT *pOutHeaderSize) + IN B_UINT16 uiVcid, + IN void *pvInputBuffer, + OUT void *pvOutputBuffer, + OUT UINT *pInHeaderSize, + OUT UINT *pOutHeaderSize) { UINT nSFIndex = 0, nPhsRuleIndex = 0; struct bcm_phs_entry *pstServiceFlowEntry = NULL; struct bcm_phs_rule *pstPhsRule = NULL; UINT phsi; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - struct bcm_phs_extension *pDeviceExtension = (struct bcm_phs_extension *)pvContext; + struct bcm_phs_extension *pDeviceExtension = + (struct bcm_phs_extension *)pvContext; *pInHeaderSize = 0; if (pDeviceExtension == NULL) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, "Invalid Device Extension\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, + DBG_LVL_ALL, "Invalid Device Extension\n"); return ERR_PHS_INVALID_DEVICE_EXETENSION; } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, "Restoring header\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, + "Restoring header\n"); phsi = *((unsigned char *)(pvInputBuffer)); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, "PHSI To Be Used For restore : %x\n", phsi); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, + "PHSI To Be Used For restore : %x\n", phsi); if (phsi == UNCOMPRESSED_PACKET) return STATUS_PHS_NOCOMPRESSION; /* Retrieve the SFID Entry Index for requested Service Flow */ nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, - uiVcid, &pstServiceFlowEntry); + uiVcid, &pstServiceFlowEntry); if (nSFIndex == PHS_INVALID_TABLE_INDEX) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, "SFID Match Failed During Lookup\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, + DBG_LVL_ALL, + "SFID Match Failed During Lookup\n"); return ERR_SF_MATCH_FAIL; } - nPhsRuleIndex = GetPhsRuleEntry(pstServiceFlowEntry->pstClassifierTable, phsi, - eActiveClassifierRuleContext, &pstPhsRule); + nPhsRuleIndex = GetPhsRuleEntry(pstServiceFlowEntry->pstClassifierTable, + phsi, + eActiveClassifierRuleContext, + &pstPhsRule); if (nPhsRuleIndex == PHS_INVALID_TABLE_INDEX) { /* Phs Rule does not exist in active rules table. Lets try in the old rules table. */ nPhsRuleIndex = GetPhsRuleEntry(pstServiceFlowEntry->pstClassifierTable, - phsi, eOldClassifierRuleContext, &pstPhsRule); + phsi, + eOldClassifierRuleContext, + &pstPhsRule); if (nPhsRuleIndex == PHS_INVALID_TABLE_INDEX) return ERR_PHSRULE_MATCH_FAIL; } *pInHeaderSize = phs_decompress((PUCHAR)pvInputBuffer, - (PUCHAR)pvOutputBuffer, pstPhsRule, pOutHeaderSize); + (PUCHAR)pvOutputBuffer, + pstPhsRule, + pOutHeaderSize); pstPhsRule->PHSModifiedBytes += *pOutHeaderSize - *pInHeaderSize - 1; @@ -745,12 +867,15 @@ static void free_phs_serviceflow_rules(struct bcm_phs_table *psServiceFlowRulesT int i, j; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "=======>\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, + "=======>\n"); if (psServiceFlowRulesTable) { for (i = 0; i < MAX_SERVICEFLOWS; i++) { - struct bcm_phs_entry stServiceFlowEntry = psServiceFlowRulesTable->stSFList[i]; - struct bcm_phs_classifier_table *pstClassifierRulesTable = stServiceFlowEntry.pstClassifierTable; + struct bcm_phs_entry stServiceFlowEntry = + psServiceFlowRulesTable->stSFList[i]; + struct bcm_phs_classifier_table *pstClassifierRulesTable = + stServiceFlowEntry.pstClassifierTable; if (pstClassifierRulesTable) { for (j = 0; j < MAX_PHSRULE_PER_SF; j++) { @@ -777,7 +902,8 @@ static void free_phs_serviceflow_rules(struct bcm_phs_table *psServiceFlowRulesT } } kfree(pstClassifierRulesTable); - stServiceFlowEntry.pstClassifierTable = pstClassifierRulesTable = NULL; + stServiceFlowEntry.pstClassifierTable = + pstClassifierRulesTable = NULL; } } } @@ -809,15 +935,16 @@ static bool ValidatePHSRuleComplete(IN struct bcm_phs_rule *psPhsRule) } UINT GetServiceFlowEntry(IN struct bcm_phs_table *psServiceFlowTable, - IN B_UINT16 uiVcid, - struct bcm_phs_entry **ppstServiceFlowEntry) + IN B_UINT16 uiVcid, + struct bcm_phs_entry **ppstServiceFlowEntry) { int i; for (i = 0; i < MAX_SERVICEFLOWS; i++) { if (psServiceFlowTable->stSFList[i].bUsed) { if (psServiceFlowTable->stSFList[i].uiVcid == uiVcid) { - *ppstServiceFlowEntry = &psServiceFlowTable->stSFList[i]; + *ppstServiceFlowEntry = + &psServiceFlowTable->stSFList[i]; return i; } } @@ -828,8 +955,9 @@ UINT GetServiceFlowEntry(IN struct bcm_phs_table *psServiceFlowTable, } static UINT GetClassifierEntry(IN struct bcm_phs_classifier_table *pstClassifierTable, - IN B_UINT32 uiClsid, enum bcm_phs_classifier_context eClsContext, - OUT struct bcm_phs_classifier_entry **ppstClassifierEntry) + IN B_UINT32 uiClsid, + enum bcm_phs_classifier_context eClsContext, + OUT struct bcm_phs_classifier_entry **ppstClassifierEntry) { int i; struct bcm_phs_classifier_entry *psClassifierRules = NULL; @@ -837,9 +965,11 @@ static UINT GetClassifierEntry(IN struct bcm_phs_classifier_table *pstClassifier for (i = 0; i < MAX_PHSRULE_PER_SF; i++) { if (eClsContext == eActiveClassifierRuleContext) - psClassifierRules = &pstClassifierTable->stActivePhsRulesList[i]; + psClassifierRules = + &pstClassifierTable->stActivePhsRulesList[i]; else - psClassifierRules = &pstClassifierTable->stOldPhsRulesList[i]; + psClassifierRules = + &pstClassifierTable->stOldPhsRulesList[i]; if (psClassifierRules->bUsed) { if (psClassifierRules->uiClassifierRuleId == uiClsid) { @@ -854,17 +984,20 @@ static UINT GetClassifierEntry(IN struct bcm_phs_classifier_table *pstClassifier } static UINT GetPhsRuleEntry(IN struct bcm_phs_classifier_table *pstClassifierTable, - IN B_UINT32 uiPHSI, enum bcm_phs_classifier_context eClsContext, - OUT struct bcm_phs_rule **ppstPhsRule) + IN B_UINT32 uiPHSI, + enum bcm_phs_classifier_context eClsContext, + OUT struct bcm_phs_rule **ppstPhsRule) { int i; struct bcm_phs_classifier_entry *pstClassifierRule = NULL; for (i = 0; i < MAX_PHSRULE_PER_SF; i++) { if (eClsContext == eActiveClassifierRuleContext) - pstClassifierRule = &pstClassifierTable->stActivePhsRulesList[i]; + pstClassifierRule = + &pstClassifierTable->stActivePhsRulesList[i]; else - pstClassifierRule = &pstClassifierTable->stOldPhsRulesList[i]; + pstClassifierRule = + &pstClassifierTable->stOldPhsRulesList[i]; if (pstClassifierRule->bUsed) { if (pstClassifierRule->u8PHSI == uiPHSI) { @@ -878,10 +1011,11 @@ static UINT GetPhsRuleEntry(IN struct bcm_phs_classifier_table *pstClassifierTab return PHS_INVALID_TABLE_INDEX; } -static UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid, IN B_UINT16 uiClsId, - IN struct bcm_phs_table *psServiceFlowTable, - struct bcm_phs_rule *psPhsRule, - B_UINT8 u8AssociatedPHSI) +static UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid, + IN B_UINT16 uiClsId, + IN struct bcm_phs_table *psServiceFlowTable, + struct bcm_phs_rule *psPhsRule, + B_UINT8 u8AssociatedPHSI) { struct bcm_phs_classifier_table *psaClassifiertable = NULL; UINT uiStatus = 0; @@ -899,8 +1033,10 @@ static UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid, IN B_UINT16 uiC if (!bFreeEntryFound) return ERR_SFTABLE_FULL; - psaClassifiertable = psServiceFlowTable->stSFList[iSfIndex].pstClassifierTable; - uiStatus = CreateClassifierPHSRule(uiClsId, psaClassifiertable, psPhsRule, + psaClassifiertable = + psServiceFlowTable->stSFList[iSfIndex].pstClassifierTable; + uiStatus = + CreateClassifierPHSRule(uiClsId, psaClassifiertable, psPhsRule, eActiveClassifierRuleContext, u8AssociatedPHSI); if (uiStatus == PHS_SUCCESS) { /* Add entry at free index to the SF */ @@ -912,10 +1048,10 @@ static UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid, IN B_UINT16 uiC } static UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, - IN B_UINT16 uiClsId, - IN struct bcm_phs_entry *pstServiceFlowEntry, - struct bcm_phs_rule *psPhsRule, - B_UINT8 u8AssociatedPHSI) + IN B_UINT16 uiClsId, + IN struct bcm_phs_entry *pstServiceFlowEntry, + struct bcm_phs_rule *psPhsRule, + B_UINT8 u8AssociatedPHSI) { struct bcm_phs_classifier_entry *pstClassifierEntry = NULL; UINT uiStatus = PHS_SUCCESS; @@ -925,7 +1061,8 @@ static UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, psaClassifiertable = pstServiceFlowEntry->pstClassifierTable; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "==>"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, + "==>"); /* Check if the supplied Classifier already exists */ nClassifierIndex = GetClassifierEntry( @@ -941,9 +1078,9 @@ static UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, */ uiStatus = CreateClassifierPHSRule(uiClsId, psaClassifiertable, - psPhsRule, - eActiveClassifierRuleContext, - u8AssociatedPHSI); + psPhsRule, + eActiveClassifierRuleContext, + u8AssociatedPHSI); return uiStatus; } @@ -964,18 +1101,21 @@ static UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, if (psPhsRule->u8PHSFLength) { /* update PHSF */ memcpy(pstClassifierEntry->pstPhsRule->u8PHSF, - psPhsRule->u8PHSF, MAX_PHS_LENGTHS); + psPhsRule->u8PHSF, + MAX_PHS_LENGTHS); } if (psPhsRule->u8PHSFLength) { /* update PHSFLen */ - pstClassifierEntry->pstPhsRule->u8PHSFLength = psPhsRule->u8PHSFLength; + pstClassifierEntry->pstPhsRule->u8PHSFLength = + psPhsRule->u8PHSFLength; } if (psPhsRule->u8PHSMLength) { /* update PHSM */ memcpy(pstClassifierEntry->pstPhsRule->u8PHSM, - psPhsRule->u8PHSM, MAX_PHS_LENGTHS); + psPhsRule->u8PHSM, + MAX_PHS_LENGTHS); } if (psPhsRule->u8PHSMLength) { @@ -986,25 +1126,29 @@ static UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, if (psPhsRule->u8PHSS) { /* update PHSS */ - pstClassifierEntry->pstPhsRule->u8PHSS = psPhsRule->u8PHSS; + pstClassifierEntry->pstPhsRule->u8PHSS = + psPhsRule->u8PHSS; } /* update PHSV */ pstClassifierEntry->pstPhsRule->u8PHSV = psPhsRule->u8PHSV; } else { /* A new rule is being set for this classifier. */ - uiStatus = UpdateClassifierPHSRule(uiClsId, pstClassifierEntry, - psaClassifiertable, psPhsRule, u8AssociatedPHSI); + uiStatus = UpdateClassifierPHSRule(uiClsId, + pstClassifierEntry, + psaClassifiertable, + psPhsRule, + u8AssociatedPHSI); } return uiStatus; } static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, - struct bcm_phs_classifier_table *psaClassifiertable, - struct bcm_phs_rule *psPhsRule, - enum bcm_phs_classifier_context eClsContext, - B_UINT8 u8AssociatedPHSI) + struct bcm_phs_classifier_table *psaClassifiertable, + struct bcm_phs_rule *psPhsRule, + enum bcm_phs_classifier_context eClsContext, + B_UINT8 u8AssociatedPHSI) { UINT iClassifierIndex = 0; bool bFreeEntryFound = false; @@ -1012,7 +1156,8 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, UINT nStatus = PHS_SUCCESS; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "Inside CreateClassifierPHSRule"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, + "Inside CreateClassifierPHSRule"); if (psaClassifiertable == NULL) return ERR_INVALID_CLASSIFIERTABLE_FOR_SF; @@ -1023,9 +1168,10 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, * old rules table replace it. */ - iClassifierIndex = - GetClassifierEntry(psaClassifiertable, uiClsId, - eClsContext, &psClassifierRules); + iClassifierIndex = GetClassifierEntry(psaClassifiertable, + uiClsId, + eClsContext, + &psClassifierRules); if (iClassifierIndex != PHS_INVALID_TABLE_INDEX) { /* @@ -1061,8 +1207,10 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, if (psaClassifiertable->uiOldestPhsRuleIndex >= MAX_PHSRULE_PER_SF) psaClassifiertable->uiOldestPhsRuleIndex = 0; - iClassifierIndex = psaClassifiertable->uiOldestPhsRuleIndex; - psClassifierRules = &psaClassifiertable->stOldPhsRulesList[iClassifierIndex]; + iClassifierIndex = + psaClassifiertable->uiOldestPhsRuleIndex; + psClassifierRules = + &psaClassifiertable->stOldPhsRulesList[iClassifierIndex]; (psaClassifiertable->uiOldestPhsRuleIndex)++; } @@ -1072,7 +1220,9 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, if (psClassifierRules->pstPhsRule == NULL) { - psClassifierRules->pstPhsRule = kmalloc(sizeof(struct bcm_phs_rule), GFP_KERNEL); + psClassifierRules->pstPhsRule = + kmalloc(sizeof(struct bcm_phs_rule), + GFP_KERNEL); if (NULL == psClassifierRules->pstPhsRule) return ERR_PHSRULE_MEMALLOC_FAIL; @@ -1081,22 +1231,27 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, psClassifierRules->bUsed = TRUE; psClassifierRules->uiClassifierRuleId = uiClsId; psClassifierRules->u8PHSI = psPhsRule->u8PHSI; - psClassifierRules->bUnclassifiedPHSRule = psPhsRule->bUnclassifiedPHSRule; + psClassifierRules->bUnclassifiedPHSRule = + psPhsRule->bUnclassifiedPHSRule; /* Update The PHS rule */ - memcpy(psClassifierRules->pstPhsRule, psPhsRule, sizeof(struct bcm_phs_rule)); + memcpy(psClassifierRules->pstPhsRule, psPhsRule, + sizeof(struct bcm_phs_rule)); } else - nStatus = UpdateClassifierPHSRule(uiClsId, psClassifierRules, - psaClassifiertable, psPhsRule, u8AssociatedPHSI); + nStatus = UpdateClassifierPHSRule(uiClsId, + psClassifierRules, + psaClassifiertable, + psPhsRule, + u8AssociatedPHSI); return nStatus; } static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, - IN struct bcm_phs_classifier_entry *pstClassifierEntry, - struct bcm_phs_classifier_table *psaClassifiertable, - struct bcm_phs_rule *psPhsRule, - B_UINT8 u8AssociatedPHSI) + IN struct bcm_phs_classifier_entry *pstClassifierEntry, + struct bcm_phs_classifier_table *psaClassifiertable, + struct bcm_phs_rule *psPhsRule, + B_UINT8 u8AssociatedPHSI) { struct bcm_phs_rule *pstAddPhsRule = NULL; UINT nPhsRuleIndex = 0; @@ -1111,27 +1266,36 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, /* Step 2 Search if there is a PHS Rule with u8AssociatedPHSI in Classifier table for this SF */ nPhsRuleIndex = GetPhsRuleEntry(psaClassifiertable, u8AssociatedPHSI, - eActiveClassifierRuleContext, &pstAddPhsRule); + eActiveClassifierRuleContext, + &pstAddPhsRule); if (PHS_INVALID_TABLE_INDEX == nPhsRuleIndex) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nAdding New PHSRuleEntry For Classifier"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, + DBG_LVL_ALL, + "\nAdding New PHSRuleEntry For Classifier"); if (psPhsRule->u8PHSI == 0) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nError PHSI is Zero\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, + DBG_LVL_ALL, "\nError PHSI is Zero\n"); return ERR_PHS_INVALID_PHS_RULE; } /* Step 2.a PHS Rule Does Not Exist .Create New PHS Rule for uiClsId */ if (false == bPHSRuleOrphaned) { - pstClassifierEntry->pstPhsRule = kmalloc(sizeof(struct bcm_phs_rule), GFP_KERNEL); + pstClassifierEntry->pstPhsRule = + kmalloc(sizeof(struct bcm_phs_rule), + GFP_KERNEL); if (NULL == pstClassifierEntry->pstPhsRule) return ERR_PHSRULE_MEMALLOC_FAIL; } - memcpy(pstClassifierEntry->pstPhsRule, psPhsRule, sizeof(struct bcm_phs_rule)); + memcpy(pstClassifierEntry->pstPhsRule, psPhsRule, + sizeof(struct bcm_phs_rule)); } else { /* Step 2.b PHS Rule Exists Tie uiClsId with the existing PHS Rule */ - 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) { kfree(pstClassifierEntry->pstPhsRule); pstClassifierEntry->pstPhsRule = NULL; @@ -1143,12 +1307,15 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, pstClassifierEntry->u8PHSI = pstClassifierEntry->pstPhsRule->u8PHSI; pstClassifierEntry->uiClassifierRuleId = uiClsId; pstClassifierEntry->pstPhsRule->u8RefCnt++; - pstClassifierEntry->bUnclassifiedPHSRule = pstClassifierEntry->pstPhsRule->bUnclassifiedPHSRule; + pstClassifierEntry->bUnclassifiedPHSRule = + pstClassifierEntry->pstPhsRule->bUnclassifiedPHSRule; return PHS_SUCCESS; } -static bool DerefPhsRule(IN B_UINT16 uiClsId, struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *pstPhsRule) +static bool DerefPhsRule(IN B_UINT16 uiClsId, + struct bcm_phs_classifier_table *psaClassifiertable, + struct bcm_phs_rule *pstPhsRule) { if (pstPhsRule == NULL) return false; @@ -1172,7 +1339,8 @@ void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension) int i, j, k, l; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\n Dumping PHS Rules :\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, + "\n Dumping PHS Rules :\n"); for (i = 0; i < MAX_SERVICEFLOWS; i++) { @@ -1238,9 +1406,9 @@ void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension) * 0 -If PHS rule is NULL.If PHSI is 0 indicateing packet as uncompressed. */ static int phs_decompress(unsigned char *in_buf, - unsigned char *out_buf, - struct bcm_phs_rule *decomp_phs_rules, - UINT *header_size) + unsigned char *out_buf, + struct bcm_phs_rule *decomp_phs_rules, + UINT *header_size) { int phss, size = 0; struct bcm_phs_rule *tmp_memb; @@ -1251,7 +1419,8 @@ static int phs_decompress(unsigned char *in_buf, in_buf++; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, "====>\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, + "====>\n"); *header_size = 0; if (decomp_phs_rules == NULL) @@ -1278,11 +1447,15 @@ static int phs_decompress(unsigned char *in_buf, if (bit == SUPPRESS) { *out_buf = *phsf; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, "\nDECOMP:In phss %d phsf %d output %d", + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, + DBG_LVL_ALL, + "\nDECOMP:In phss %d phsf %d output %d", phss, *phsf, *out_buf); } else { *out_buf = *in_buf; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, "\nDECOMP:In phss %d input %d output %d", + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, + DBG_LVL_ALL, + "\nDECOMP:In phss %d input %d output %d", phss, *in_buf, *out_buf); in_buf++; size++; @@ -1333,7 +1506,8 @@ static int phs_compress(struct bcm_phs_rule *phs_rule, struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); if (phs_rule == NULL) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "\nphs_compress(): phs_rule null!"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, + "\nphs_compress(): phs_rule null!"); *out_buf = ZERO_PHSI; return STATUS_PHS_NOCOMPRESSION; } @@ -1351,10 +1525,13 @@ static int phs_compress(struct bcm_phs_rule *phs_rule, if (suppress == STATUS_PHS_COMPRESSED) { *old_addr = (unsigned char)phs_rule->u8PHSI; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "\nCOMP:In phs_compress phsi %d", phs_rule->u8PHSI); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, + "\nCOMP:In phs_compress phsi %d", + phs_rule->u8PHSI); } else { *old_addr = ZERO_PHSI; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "\nCOMP:In phs_compress PHSV Verification failed"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, + "\nCOMP:In phs_compress PHSV Verification failed"); } return suppress; @@ -1391,7 +1568,8 @@ static int verify_suppress_phsf(unsigned char *in_buffer, int bit, i = 0; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "\nCOMP:In verify_phsf PHSM - 0x%X", *phsm); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, + "\nCOMP:In verify_phsf PHSM - 0x%X", *phsm); if (phss > (*new_header_size)) phss = *new_header_size; @@ -1443,7 +1621,8 @@ static int verify_suppress_phsf(unsigned char *in_buffer, phsm++; } } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, "\nCOMP:In verify_phsf success"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL, + "\nCOMP:In verify_phsf success"); *new_header_size = size; return STATUS_PHS_COMPRESSED; }