Commit 6c259f4f authored by Kevin McKinney's avatar Kevin McKinney Committed by Greg Kroah-Hartman

Staging: bcm: Fix all white space issues in PHSModule.c

This patch fixes all white space issues in
PHSModule.c as reported by checkpatch.pl.
Signed-off-by: default avatarKevin McKinney <klmckinney1@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6d8a94e6
#include "headers.h" #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 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 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 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 UpdateClassifierPHSRule(B_UINT16 uiClsId, struct bcm_phs_classifier_entry *pstClassifierEntry, struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *psPhsRule, B_UINT8 u8AssociatedPHSI);
...@@ -12,52 +12,46 @@ static BOOLEAN ValidatePHSRuleComplete(struct bcm_phs_rule *psPhsRule); ...@@ -12,52 +12,46 @@ static BOOLEAN ValidatePHSRuleComplete(struct bcm_phs_rule *psPhsRule);
static BOOLEAN DerefPhsRule(B_UINT16 uiClsId, struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *pstPhsRule); static BOOLEAN 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 void free_phs_serviceflow_rules(struct bcm_phs_table *psServiceFlowRulesTable);
static int phs_compress(struct bcm_phs_rule *phs_members, unsigned char *in_buf, 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 ); 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, static int phs_decompress(unsigned char *in_buf, unsigned char *out_buf,
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); struct bcm_phs_rule *phs_rules, UINT *header_size);
static ULONG PhsCompress(void *pvContext,
static ULONG PhsCompress(void* pvContext,
B_UINT16 uiVcid, B_UINT16 uiVcid,
B_UINT16 uiClsId, B_UINT16 uiClsId,
void *pvInputBuffer, void *pvInputBuffer,
void *pvOutputBuffer, void *pvOutputBuffer,
UINT *pOldHeaderSize, UINT *pOldHeaderSize,
UINT *pNewHeaderSize ); UINT *pNewHeaderSize);
static ULONG PhsDeCompress(void* pvContext, static ULONG PhsDeCompress(void *pvContext,
B_UINT16 uiVcid, B_UINT16 uiVcid,
void *pvInputBuffer, void *pvInputBuffer,
void *pvOutputBuffer, void *pvOutputBuffer,
UINT *pInHeaderSize, UINT *pInHeaderSize,
UINT *pOutHeaderSize); UINT *pOutHeaderSize);
#define IN #define IN
#define OUT #define OUT
/* /*
Function: PHSTransmit Function: PHSTransmit
Description: This routine handle PHS(Payload Header Suppression for Tx path. Description: This routine handle PHS(Payload Header Suppression for Tx path.
It extracts a fragment of the NDIS_PACKET containing the header It extracts a fragment of the NDIS_PACKET containing the header
to be suppressed. It then suppresses the header by invoking PHS exported compress routine. to be suppressed. It then suppresses the header by invoking PHS exported compress routine.
The header data after suppression is copied back to the NDIS_PACKET. The header data after suppression is copied back to the NDIS_PACKET.
Input parameters: IN struct bcm_mini_adapter *Adapter - Miniport Adapter Context Input parameters: IN struct bcm_mini_adapter *Adapter - Miniport Adapter Context
IN Packet - NDIS packet containing data to be transmitted IN Packet - NDIS packet containing data to be transmitted
IN USHORT Vcid - vcid pertaining to connection on which the packet is being sent.Used to IN USHORT Vcid - vcid pertaining to connection on which the packet is being sent.Used to
...@@ -77,42 +71,37 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -77,42 +71,37 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
UINT *PacketLen, UINT *PacketLen,
UCHAR bEthCSSupport) UCHAR bEthCSSupport)
{ {
//PHS Sepcific //PHS Sepcific
UINT unPHSPktHdrBytesCopied = 0; UINT unPHSPktHdrBytesCopied = 0;
UINT unPhsOldHdrSize = 0; UINT unPhsOldHdrSize = 0;
UINT unPHSNewPktHeaderLen = 0; UINT unPHSNewPktHeaderLen = 0;
/* Pointer to PHS IN Hdr Buffer */ /* Pointer to PHS IN Hdr Buffer */
PUCHAR pucPHSPktHdrInBuf = PUCHAR pucPHSPktHdrInBuf = Adapter->stPhsTxContextInfo.ucaHdrSuppressionInBuf;
Adapter->stPhsTxContextInfo.ucaHdrSuppressionInBuf;
/* Pointer to PHS OUT Hdr Buffer */ /* Pointer to PHS OUT Hdr Buffer */
PUCHAR pucPHSPktHdrOutBuf = PUCHAR pucPHSPktHdrOutBuf = Adapter->stPhsTxContextInfo.ucaHdrSuppressionOutBuf;
Adapter->stPhsTxContextInfo.ucaHdrSuppressionOutBuf;
UINT usPacketType; UINT usPacketType;
UINT BytesToRemove=0; UINT BytesToRemove = 0;
BOOLEAN bPHSI = 0; BOOLEAN bPHSI = 0;
LONG ulPhsStatus = 0; LONG ulPhsStatus = 0;
UINT numBytesCompressed = 0; UINT numBytesCompressed = 0;
struct sk_buff *newPacket = NULL; struct sk_buff *newPacket = NULL;
struct sk_buff *Packet = *pPacket; 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) if (!bEthCSSupport)
BytesToRemove=ETH_HLEN; BytesToRemove = ETH_HLEN;
/* /*
Accumulate the header upto the size we support suppression Accumulate the header upto the size we support suppression
from NDIS packet from NDIS packet
*/ */
usPacketType=((struct ethhdr *)(Packet->data))->h_proto; usPacketType = ((struct ethhdr *)(Packet->data))->h_proto;
pucPHSPktHdrInBuf = Packet->data + BytesToRemove; pucPHSPktHdrInBuf = Packet->data + BytesToRemove;
//considering data after ethernet header //considering data after ethernet header
if((*PacketLen - BytesToRemove) < MAX_PHS_LENGTHS) if ((*PacketLen - BytesToRemove) < MAX_PHS_LENGTHS)
{ {
unPHSPktHdrBytesCopied = (*PacketLen - BytesToRemove); unPHSPktHdrBytesCopied = (*PacketLen - BytesToRemove);
} }
else else
...@@ -120,20 +109,16 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -120,20 +109,16 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
unPHSPktHdrBytesCopied = MAX_PHS_LENGTHS; unPHSPktHdrBytesCopied = MAX_PHS_LENGTHS;
} }
if( (unPHSPktHdrBytesCopied > 0 ) && if ((unPHSPktHdrBytesCopied > 0) &&
(unPHSPktHdrBytesCopied <= MAX_PHS_LENGTHS)) (unPHSPktHdrBytesCopied <= MAX_PHS_LENGTHS))
{ {
// Step 2 Suppress Header using PHS and fill into intermediate ucaPHSPktHdrOutBuf. // Step 2 Suppress Header using PHS and fill into intermediate ucaPHSPktHdrOutBuf.
// Suppress only if IP Header and PHS Enabled For the Service Flow // Suppress only if IP Header and PHS Enabled For the Service Flow
if(((usPacketType == ETHERNET_FRAMETYPE_IPV4) || if (((usPacketType == ETHERNET_FRAMETYPE_IPV4) ||
(usPacketType == ETHERNET_FRAMETYPE_IPV6)) && (usPacketType == ETHERNET_FRAMETYPE_IPV6)) &&
(bHeaderSuppressionEnabled)) (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; unPHSNewPktHeaderLen = unPHSPktHdrBytesCopied;
ulPhsStatus = PhsCompress(&Adapter->stBCMPhsContext, ulPhsStatus = PhsCompress(&Adapter->stBCMPhsContext,
Vcid, Vcid,
...@@ -142,24 +127,25 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -142,24 +127,25 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
pucPHSPktHdrOutBuf, pucPHSPktHdrOutBuf,
&unPhsOldHdrSize, &unPhsOldHdrSize,
&unPHSNewPktHeaderLen); &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); 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) if (unPHSNewPktHeaderLen == unPhsOldHdrSize)
{ {
if( ulPhsStatus == STATUS_PHS_COMPRESSED) if (ulPhsStatus == STATUS_PHS_COMPRESSED)
bPHSI = *pucPHSPktHdrOutBuf; bPHSI = *pucPHSPktHdrOutBuf;
ulPhsStatus = STATUS_PHS_NOCOMPRESSION; ulPhsStatus = STATUS_PHS_NOCOMPRESSION;
} }
if( ulPhsStatus == STATUS_PHS_COMPRESSED) 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)) if (skb_cloned(Packet))
{ {
newPacket = skb_copy(Packet, GFP_ATOMIC); newPacket = skb_copy(Packet, GFP_ATOMIC);
if(newPacket == NULL) if (newPacket == NULL)
return STATUS_FAILURE; return STATUS_FAILURE;
dev_kfree_skb(Packet); dev_kfree_skb(Packet);
...@@ -167,7 +153,7 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -167,7 +153,7 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
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(pucPHSPktHdrInBuf + numBytesCompressed, pucPHSPktHdrOutBuf, unPHSNewPktHeaderLen + PHSI_LEN);
memcpy(Packet->data + numBytesCompressed, Packet->data, BytesToRemove); memcpy(Packet->data + numBytesCompressed, Packet->data, BytesToRemove);
...@@ -175,15 +161,14 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -175,15 +161,14 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
else 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_headroom(Packet) > 0))
{ {
if(skb_cow(Packet, 1)) 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; return STATUS_FAILURE;
} }
} }
...@@ -196,9 +181,9 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -196,9 +181,9 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
} }
else else
{ {
if(!bHeaderSuppressionEnabled) 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; return STATUS_SUCCESS;
...@@ -219,11 +204,12 @@ int PHSReceive(struct bcm_mini_adapter *Adapter, ...@@ -219,11 +204,12 @@ int PHSReceive(struct bcm_mini_adapter *Adapter,
u32 nStandardPktHdrLen = 0; u32 nStandardPktHdrLen = 0;
u32 nTotalsuppressedPktHdrBytes = 0; u32 nTotalsuppressedPktHdrBytes = 0;
int ulPhsStatus = 0; int ulPhsStatus = 0;
PUCHAR pucInBuff = NULL ; PUCHAR pucInBuff = NULL;
UINT TotalBytesAdded = 0; UINT TotalBytesAdded = 0;
if(!bHeaderSuppressionEnabled)
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; return ulPhsStatus;
} }
...@@ -238,10 +224,10 @@ int PHSReceive(struct bcm_mini_adapter *Adapter, ...@@ -238,10 +224,10 @@ int PHSReceive(struct bcm_mini_adapter *Adapter,
&nTotalsuppressedPktHdrBytes, &nTotalsuppressedPktHdrBytes,
&nStandardPktHdrLen); &nStandardPktHdrLen);
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nSuppressed PktHdrLen : 0x%x Restored PktHdrLen : 0x%x", BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, "\nSuppressed PktHdrLen : 0x%x Restored PktHdrLen : 0x%x",
nTotalsuppressedPktHdrBytes,nStandardPktHdrLen); nTotalsuppressedPktHdrBytes, nStandardPktHdrLen);
if(ulPhsStatus != STATUS_PHS_COMPRESSED) if (ulPhsStatus != STATUS_PHS_COMPRESSED)
{ {
skb_pull(packet, 1); skb_pull(packet, 1);
return STATUS_SUCCESS; return STATUS_SUCCESS;
...@@ -249,15 +235,15 @@ int PHSReceive(struct bcm_mini_adapter *Adapter, ...@@ -249,15 +235,15 @@ int PHSReceive(struct bcm_mini_adapter *Adapter,
else else
{ {
TotalBytesAdded = nStandardPktHdrLen - nTotalsuppressedPktHdrBytes - PHSI_LEN; TotalBytesAdded = nStandardPktHdrLen - nTotalsuppressedPktHdrBytes - PHSI_LEN;
if(TotalBytesAdded) if (TotalBytesAdded)
{ {
if(skb_headroom(packet) >= (SKB_RESERVE_ETHERNET_HEADER + TotalBytesAdded)) if (skb_headroom(packet) >= (SKB_RESERVE_ETHERNET_HEADER + TotalBytesAdded))
skb_push(packet, TotalBytesAdded); skb_push(packet, TotalBytesAdded);
else else
{ {
if(skb_cow(packet, skb_headroom(packet) + TotalBytesAdded)) 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; return STATUS_FAILURE;
} }
...@@ -271,11 +257,12 @@ int PHSReceive(struct bcm_mini_adapter *Adapter, ...@@ -271,11 +257,12 @@ int PHSReceive(struct bcm_mini_adapter *Adapter,
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
void DumpFullPacket(UCHAR *pBuf,UINT nPktLen) void DumpFullPacket(UCHAR *pBuf, UINT nPktLen)
{ {
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 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);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -295,65 +282,60 @@ int phs_init(struct bcm_phs_extension *pPhsdeviceExtension, struct bcm_mini_adap ...@@ -295,65 +282,60 @@ int phs_init(struct bcm_phs_extension *pPhsdeviceExtension, struct bcm_mini_adap
{ {
int i; int i;
struct bcm_phs_table *pstServiceFlowTable; struct bcm_phs_table *pstServiceFlowTable;
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nPHS:phs_init function ");
if(pPhsdeviceExtension->pstServiceFlowPhsRulesTable) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "\nPHS:phs_init function");
if (pPhsdeviceExtension->pstServiceFlowPhsRulesTable)
return -EINVAL; return -EINVAL;
pPhsdeviceExtension->pstServiceFlowPhsRulesTable = pPhsdeviceExtension->pstServiceFlowPhsRulesTable = kzalloc(sizeof(struct bcm_phs_table), GFP_KERNEL);
kzalloc(sizeof(struct bcm_phs_table), GFP_KERNEL);
if(!pPhsdeviceExtension->pstServiceFlowPhsRulesTable) 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; return -ENOMEM;
} }
pstServiceFlowTable = pPhsdeviceExtension->pstServiceFlowPhsRulesTable; pstServiceFlowTable = pPhsdeviceExtension->pstServiceFlowPhsRulesTable;
for(i=0;i<MAX_SERVICEFLOWS;i++) for (i = 0; i < MAX_SERVICEFLOWS; i++)
{ {
struct bcm_phs_entry sServiceFlow = pstServiceFlowTable->stSFList[i]; struct bcm_phs_entry sServiceFlow = pstServiceFlowTable->stSFList[i];
sServiceFlow.pstClassifierTable = kzalloc(sizeof(struct bcm_phs_classifier_table), GFP_KERNEL); sServiceFlow.pstClassifierTable = kzalloc(sizeof(struct bcm_phs_classifier_table), GFP_KERNEL);
if(!sServiceFlow.pstClassifierTable) 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-> free_phs_serviceflow_rules(pPhsdeviceExtension->pstServiceFlowPhsRulesTable);
pstServiceFlowPhsRulesTable);
pPhsdeviceExtension->pstServiceFlowPhsRulesTable = NULL; pPhsdeviceExtension->pstServiceFlowPhsRulesTable = NULL;
return -ENOMEM; return -ENOMEM;
} }
} }
pPhsdeviceExtension->CompressedTxBuffer = kmalloc(PHS_BUFFER_SIZE, GFP_KERNEL); pPhsdeviceExtension->CompressedTxBuffer = kmalloc(PHS_BUFFER_SIZE, GFP_KERNEL);
if (pPhsdeviceExtension->CompressedTxBuffer == NULL)
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); free_phs_serviceflow_rules(pPhsdeviceExtension->pstServiceFlowPhsRulesTable);
pPhsdeviceExtension->pstServiceFlowPhsRulesTable = NULL; pPhsdeviceExtension->pstServiceFlowPhsRulesTable = NULL;
return -ENOMEM; return -ENOMEM;
} }
pPhsdeviceExtension->UnCompressedRxBuffer = kmalloc(PHS_BUFFER_SIZE, GFP_KERNEL); pPhsdeviceExtension->UnCompressedRxBuffer = kmalloc(PHS_BUFFER_SIZE, GFP_KERNEL);
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");
kfree(pPhsdeviceExtension->CompressedTxBuffer); 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;
} }
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; return STATUS_SUCCESS;
} }
int PhsCleanup(IN struct bcm_phs_extension *pPHSDeviceExt) int PhsCleanup(IN struct bcm_phs_extension *pPHSDeviceExt)
{ {
if(pPHSDeviceExt->pstServiceFlowPhsRulesTable) if (pPHSDeviceExt->pstServiceFlowPhsRulesTable)
{ {
free_phs_serviceflow_rules(pPHSDeviceExt->pstServiceFlowPhsRulesTable); free_phs_serviceflow_rules(pPHSDeviceExt->pstServiceFlowPhsRulesTable);
pPHSDeviceExt->pstServiceFlowPhsRulesTable = NULL; pPHSDeviceExt->pstServiceFlowPhsRulesTable = NULL;
...@@ -368,8 +350,6 @@ int PhsCleanup(IN struct bcm_phs_extension *pPHSDeviceExt) ...@@ -368,8 +350,6 @@ int PhsCleanup(IN struct bcm_phs_extension *pPHSDeviceExt)
return 0; return 0;
} }
//PHS functions //PHS functions
/*++ /*++
PhsUpdateClassifierRule PhsUpdateClassifierRule
...@@ -389,41 +369,36 @@ Return Value: ...@@ -389,41 +369,36 @@ Return Value:
>0 Error. >0 Error.
--*/ --*/
ULONG PhsUpdateClassifierRule(IN void* pvContext, ULONG PhsUpdateClassifierRule(IN void *pvContext,
IN B_UINT16 uiVcid , IN B_UINT16 uiVcid ,
IN B_UINT16 uiClsId , IN B_UINT16 uiClsId ,
IN struct bcm_phs_rule *psPhsRule, IN struct bcm_phs_rule *psPhsRule,
IN B_UINT8 u8AssociatedPHSI) IN B_UINT8 u8AssociatedPHSI)
{ {
ULONG lStatus =0; ULONG lStatus = 0;
UINT nSFIndex =0 ; UINT nSFIndex = 0;
struct bcm_phs_entry *pstServiceFlowEntry = NULL; struct bcm_phs_entry *pstServiceFlowEntry = NULL;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 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");
if (pDeviceExtension == NULL)
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");
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; return ERR_PHS_INVALID_DEVICE_EXETENSION;
} }
if (u8AssociatedPHSI == 0)
if(u8AssociatedPHSI == 0)
{ {
return ERR_PHS_INVALID_PHS_RULE; return ERR_PHS_INVALID_PHS_RULE;
} }
/* Retrieve the SFID Entry Index for requested Service Flow */ /* Retrieve the SFID Entry Index for requested Service Flow */
nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable,
uiVcid,&pstServiceFlowEntry); uiVcid, &pstServiceFlowEntry);
if(nSFIndex == PHS_INVALID_TABLE_INDEX) if (nSFIndex == PHS_INVALID_TABLE_INDEX)
{ {
/* This is a new SF. Create a mapping entry for this */ /* This is a new SF. Create a mapping entry for this */
lStatus = CreateSFToClassifierRuleMapping(uiVcid, uiClsId, lStatus = CreateSFToClassifierRuleMapping(uiVcid, uiClsId,
...@@ -456,51 +431,49 @@ Return Value: ...@@ -456,51 +431,49 @@ Return Value:
--*/ --*/
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)
{ {
ULONG lStatus =0; ULONG lStatus = 0;
UINT nSFIndex =0, nClsidIndex =0 ; UINT nSFIndex = 0, nClsidIndex = 0;
struct bcm_phs_entry *pstServiceFlowEntry = NULL; struct bcm_phs_entry *pstServiceFlowEntry = NULL;
struct bcm_phs_classifier_table *pstClassifierRulesTable = NULL; struct bcm_phs_classifier_table *pstClassifierRulesTable = NULL;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 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");
struct bcm_phs_extension *pDeviceExtension= (struct bcm_phs_extension *)pvContext; if (pDeviceExtension)
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "======>\n");
if(pDeviceExtension)
{ {
//Retrieve the SFID Entry Index for requested Service Flow //Retrieve the SFID Entry Index for requested Service Flow
nSFIndex = GetServiceFlowEntry(pDeviceExtension nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, uiVcid, &pstServiceFlowEntry);
->pstServiceFlowPhsRulesTable,uiVcid,&pstServiceFlowEntry);
if(nSFIndex == PHS_INVALID_TABLE_INDEX) 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; return ERR_SF_MATCH_FAIL;
} }
pstClassifierRulesTable=pstServiceFlowEntry->pstClassifierTable; pstClassifierRulesTable = pstServiceFlowEntry->pstClassifierTable;
if(pstClassifierRulesTable) if (pstClassifierRulesTable)
{ {
for(nClsidIndex=0;nClsidIndex<MAX_PHSRULE_PER_SF;nClsidIndex++) for (nClsidIndex = 0; nClsidIndex < MAX_PHSRULE_PER_SF; nClsidIndex++)
{ {
if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].bUsed && pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule) if (pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].bUsed && pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule)
{ {
if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8PHSI == u8PHSI) { if (pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8PHSI == u8PHSI)
if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt) {
if (pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt--; pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt--;
if(0 == pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
if (0 == pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule); kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule);
memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0, memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0,
sizeof(struct bcm_phs_classifier_entry)); sizeof(struct bcm_phs_classifier_entry));
} }
} }
} }
} }
} }
return lStatus; return lStatus;
} }
...@@ -522,45 +495,44 @@ Return Value: ...@@ -522,45 +495,44 @@ Return Value:
>0 Error. >0 Error.
--*/ --*/
ULONG PhsDeleteClassifierRule(IN void* pvContext,IN B_UINT16 uiVcid ,IN B_UINT16 uiClsId) ULONG PhsDeleteClassifierRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT16 uiClsId)
{ {
ULONG lStatus =0; ULONG lStatus = 0;
UINT nSFIndex =0, nClsidIndex =0 ; UINT nSFIndex = 0, nClsidIndex = 0;
struct bcm_phs_entry *pstServiceFlowEntry = NULL; struct bcm_phs_entry *pstServiceFlowEntry = NULL;
struct bcm_phs_classifier_entry *pstClassifierEntry = NULL; struct bcm_phs_classifier_entry *pstClassifierEntry = NULL;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 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) if (pDeviceExtension)
{ {
//Retrieve the SFID Entry Index for requested Service Flow //Retrieve the SFID Entry Index for requested Service Flow
nSFIndex = GetServiceFlowEntry(pDeviceExtension nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, uiVcid, &pstServiceFlowEntry);
->pstServiceFlowPhsRulesTable, uiVcid, &pstServiceFlowEntry); if (nSFIndex == PHS_INVALID_TABLE_INDEX)
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; return ERR_SF_MATCH_FAIL;
} }
nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable, nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable,
uiClsId, eActiveClassifierRuleContext, &pstClassifierEntry); uiClsId, eActiveClassifierRuleContext, &pstClassifierEntry);
if((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule)) if ((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule))
{ {
if(pstClassifierEntry->pstPhsRule) if (pstClassifierEntry->pstPhsRule)
{ {
if(pstClassifierEntry->pstPhsRule->u8RefCnt) if (pstClassifierEntry->pstPhsRule->u8RefCnt)
pstClassifierEntry->pstPhsRule->u8RefCnt--; pstClassifierEntry->pstPhsRule->u8RefCnt--;
if(0==pstClassifierEntry->pstPhsRule->u8RefCnt)
kfree(pstClassifierEntry->pstPhsRule);
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, nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable,
uiClsId,eOldClassifierRuleContext,&pstClassifierEntry); uiClsId, eOldClassifierRuleContext, &pstClassifierEntry);
if((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule)) if ((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule))
{ {
kfree(pstClassifierEntry->pstPhsRule); kfree(pstClassifierEntry->pstPhsRule);
memset(pstClassifierEntry, 0, sizeof(struct bcm_phs_classifier_entry)); memset(pstClassifierEntry, 0, sizeof(struct bcm_phs_classifier_entry));
...@@ -585,71 +557,64 @@ Return Value: ...@@ -585,71 +557,64 @@ Return Value:
>0 Error. >0 Error.
--*/ --*/
ULONG PhsDeleteSFRules(IN void* pvContext,IN B_UINT16 uiVcid) ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 uiVcid)
{ {
ULONG lStatus = 0;
ULONG lStatus =0; UINT nSFIndex = 0, nClsidIndex = 0;
UINT nSFIndex =0, nClsidIndex =0 ;
struct bcm_phs_entry *pstServiceFlowEntry = NULL; struct bcm_phs_entry *pstServiceFlowEntry = NULL;
struct bcm_phs_classifier_table *pstClassifierRulesTable = NULL; struct bcm_phs_classifier_table *pstClassifierRulesTable = NULL;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 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");
if(pDeviceExtension) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "====>\n");
if (pDeviceExtension)
{ {
//Retrieve the SFID Entry Index for requested Service Flow //Retrieve the SFID Entry Index for requested Service Flow
nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable,
uiVcid,&pstServiceFlowEntry); uiVcid, &pstServiceFlowEntry);
if(nSFIndex == PHS_INVALID_TABLE_INDEX) 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; return ERR_SF_MATCH_FAIL;
} }
pstClassifierRulesTable=pstServiceFlowEntry->pstClassifierTable; pstClassifierRulesTable = pstServiceFlowEntry->pstClassifierTable;
if(pstClassifierRulesTable) if (pstClassifierRulesTable)
{ {
for(nClsidIndex=0;nClsidIndex<MAX_PHSRULE_PER_SF;nClsidIndex++) for (nClsidIndex = 0; nClsidIndex < MAX_PHSRULE_PER_SF; nClsidIndex++)
{ {
if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule) if (pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule)
{ {
if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] if (pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
.pstPhsRule->u8RefCnt) pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt--;
pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex]
.pstPhsRule->u8RefCnt--; if (0 == pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
if(0==pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex]
.pstPhsRule->u8RefCnt)
kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule); kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule);
pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex]
.pstPhsRule = NULL; 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)
{ {
if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] if (pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
.pstPhsRule->u8RefCnt) pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt--;
pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex]
.pstPhsRule->u8RefCnt--; if (0 == pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt)
if(0 == pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] kfree(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule);
.pstPhsRule->u8RefCnt)
kfree(pstClassifierRulesTable pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule = NULL;
->stOldPhsRulesList[nClsidIndex].pstPhsRule);
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; pstServiceFlowEntry->bUsed = FALSE;
pstServiceFlowEntry->uiVcid = 0; pstServiceFlowEntry->uiVcid = 0;
} }
return lStatus; return lStatus;
} }
/*++ /*++
PhsCompress PhsCompress
...@@ -671,73 +636,65 @@ Return Value: ...@@ -671,73 +636,65 @@ Return Value:
>0 Error. >0 Error.
--*/ --*/
ULONG PhsCompress(IN void* pvContext, ULONG PhsCompress(IN void *pvContext,
IN B_UINT16 uiVcid, IN B_UINT16 uiVcid,
IN B_UINT16 uiClsId, IN B_UINT16 uiClsId,
IN void *pvInputBuffer, IN void *pvInputBuffer,
OUT void *pvOutputBuffer, OUT void *pvOutputBuffer,
OUT UINT *pOldHeaderSize, OUT UINT *pOldHeaderSize,
OUT UINT *pNewHeaderSize ) OUT UINT *pNewHeaderSize)
{ {
UINT nSFIndex =0, nClsidIndex =0 ; UINT nSFIndex = 0, nClsidIndex = 0;
struct bcm_phs_entry *pstServiceFlowEntry = NULL; struct bcm_phs_entry *pstServiceFlowEntry = NULL;
struct bcm_phs_classifier_entry *pstClassifierEntry = NULL; struct bcm_phs_classifier_entry *pstClassifierEntry = NULL;
struct bcm_phs_rule *pstPhsRule = NULL; struct bcm_phs_rule *pstPhsRule = NULL;
ULONG lStatus =0; ULONG lStatus = 0;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
struct bcm_phs_extension *pDeviceExtension = (struct bcm_phs_extension *)pvContext;
if (pDeviceExtension == NULL)
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 ; lStatus = STATUS_PHS_NOCOMPRESSION;
return lStatus; 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 //Retrieve the SFID Entry Index for requested Service Flow
nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable,
uiVcid,&pstServiceFlowEntry); uiVcid, &pstServiceFlowEntry);
if(nSFIndex == PHS_INVALID_TABLE_INDEX) 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 ; lStatus = STATUS_PHS_NOCOMPRESSION;
return lStatus; return lStatus;
} }
nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable, nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable,
uiClsId,eActiveClassifierRuleContext,&pstClassifierEntry); uiClsId, eActiveClassifierRuleContext, &pstClassifierEntry);
if(nClsidIndex == PHS_INVALID_TABLE_INDEX) 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 ; lStatus = STATUS_PHS_NOCOMPRESSION;
return lStatus; return lStatus;
} }
//get rule from SF id,Cls ID pair and proceed //get rule from SF id,Cls ID pair and proceed
pstPhsRule = pstClassifierEntry->pstPhsRule; pstPhsRule = pstClassifierEntry->pstPhsRule;
if (!ValidatePHSRuleComplete(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 ; lStatus = STATUS_PHS_NOCOMPRESSION;
return lStatus; return lStatus;
} }
//Compress Packet //Compress Packet
lStatus = phs_compress(pstPhsRule,(PUCHAR)pvInputBuffer, lStatus = phs_compress(pstPhsRule, (PUCHAR)pvInputBuffer,
(PUCHAR)pvOutputBuffer, pOldHeaderSize,pNewHeaderSize); (PUCHAR)pvOutputBuffer, pOldHeaderSize, pNewHeaderSize);
if(lStatus == STATUS_PHS_COMPRESSED) if (lStatus == STATUS_PHS_COMPRESSED)
{ {
pstPhsRule->PHSModifiedBytes += *pOldHeaderSize - *pNewHeaderSize - 1; pstPhsRule->PHSModifiedBytes += *pOldHeaderSize - *pNewHeaderSize - 1;
pstPhsRule->PHSModifiedNumPackets++; pstPhsRule->PHSModifiedNumPackets++;
...@@ -767,63 +724,60 @@ Return Value: ...@@ -767,63 +724,60 @@ Return Value:
>0 Error. >0 Error.
--*/ --*/
ULONG PhsDeCompress(IN void* pvContext, ULONG PhsDeCompress(IN void *pvContext,
IN B_UINT16 uiVcid, IN B_UINT16 uiVcid,
IN void *pvInputBuffer, IN void *pvInputBuffer,
OUT void *pvOutputBuffer, OUT void *pvOutputBuffer,
OUT UINT *pInHeaderSize, OUT UINT *pInHeaderSize,
OUT UINT *pOutHeaderSize ) OUT UINT *pOutHeaderSize)
{ {
UINT nSFIndex =0, nPhsRuleIndex =0 ; UINT nSFIndex = 0, nPhsRuleIndex = 0;
struct bcm_phs_entry *pstServiceFlowEntry = NULL; struct bcm_phs_entry *pstServiceFlowEntry = NULL;
struct bcm_phs_rule *pstPhsRule = NULL; struct bcm_phs_rule *pstPhsRule = NULL;
UINT phsi; UINT phsi;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
struct bcm_phs_extension *pDeviceExtension= struct bcm_phs_extension *pDeviceExtension = (struct bcm_phs_extension *)pvContext;
(struct bcm_phs_extension *)pvContext;
*pInHeaderSize = 0; *pInHeaderSize = 0;
if (pDeviceExtension == NULL)
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; 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)); 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 ) if (phsi == UNCOMPRESSED_PACKET)
{ {
return STATUS_PHS_NOCOMPRESSION; return STATUS_PHS_NOCOMPRESSION;
} }
//Retrieve the SFID Entry Index for requested Service Flow //Retrieve the SFID Entry Index for requested Service Flow
nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable,
uiVcid,&pstServiceFlowEntry); uiVcid, &pstServiceFlowEntry);
if(nSFIndex == PHS_INVALID_TABLE_INDEX) 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; return ERR_SF_MATCH_FAIL;
} }
nPhsRuleIndex = GetPhsRuleEntry(pstServiceFlowEntry->pstClassifierTable,phsi, nPhsRuleIndex = GetPhsRuleEntry(pstServiceFlowEntry->pstClassifierTable, phsi,
eActiveClassifierRuleContext,&pstPhsRule); eActiveClassifierRuleContext, &pstPhsRule);
if(nPhsRuleIndex == PHS_INVALID_TABLE_INDEX) if (nPhsRuleIndex == PHS_INVALID_TABLE_INDEX)
{ {
//Phs Rule does not exist in active rules table. Lets try in the old rules table. //Phs Rule does not exist in active rules table. Lets try in the old rules table.
nPhsRuleIndex = GetPhsRuleEntry(pstServiceFlowEntry->pstClassifierTable, nPhsRuleIndex = GetPhsRuleEntry(pstServiceFlowEntry->pstClassifierTable,
phsi,eOldClassifierRuleContext,&pstPhsRule); phsi, eOldClassifierRuleContext, &pstPhsRule);
if(nPhsRuleIndex == PHS_INVALID_TABLE_INDEX) if (nPhsRuleIndex == PHS_INVALID_TABLE_INDEX)
{ {
return ERR_PHSRULE_MATCH_FAIL; return ERR_PHSRULE_MATCH_FAIL;
} }
} }
*pInHeaderSize = phs_decompress((PUCHAR)pvInputBuffer, *pInHeaderSize = phs_decompress((PUCHAR)pvInputBuffer,
(PUCHAR)pvOutputBuffer,pstPhsRule,pOutHeaderSize); (PUCHAR)pvOutputBuffer, pstPhsRule, pOutHeaderSize);
pstPhsRule->PHSModifiedBytes += *pOutHeaderSize - *pInHeaderSize - 1; pstPhsRule->PHSModifiedBytes += *pOutHeaderSize - *pInHeaderSize - 1;
...@@ -831,7 +785,6 @@ ULONG PhsDeCompress(IN void* pvContext, ...@@ -831,7 +785,6 @@ ULONG PhsDeCompress(IN void* pvContext,
return STATUS_PHS_COMPRESSED; return STATUS_PHS_COMPRESSED;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Procedure: free_phs_serviceflow_rules // Procedure: free_phs_serviceflow_rules
// //
...@@ -846,43 +799,41 @@ ULONG PhsDeCompress(IN void* pvContext, ...@@ -846,43 +799,41 @@ ULONG PhsDeCompress(IN void* pvContext,
static void free_phs_serviceflow_rules(struct bcm_phs_table *psServiceFlowRulesTable) static void free_phs_serviceflow_rules(struct bcm_phs_table *psServiceFlowRulesTable)
{ {
int i,j; int i, j;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 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)
if (psServiceFlowRulesTable)
{ {
for(i=0;i<MAX_SERVICEFLOWS;i++) for (i = 0; i < MAX_SERVICEFLOWS; i++)
{ {
struct bcm_phs_entry stServiceFlowEntry = struct bcm_phs_entry stServiceFlowEntry = psServiceFlowRulesTable->stSFList[i];
psServiceFlowRulesTable->stSFList[i]; struct bcm_phs_classifier_table *pstClassifierRulesTable = stServiceFlowEntry.pstClassifierTable;
struct bcm_phs_classifier_table *pstClassifierRulesTable =
stServiceFlowEntry.pstClassifierTable;
if(pstClassifierRulesTable) if (pstClassifierRulesTable)
{ {
for(j=0;j<MAX_PHSRULE_PER_SF;j++) for (j = 0; j < MAX_PHSRULE_PER_SF; j++)
{ {
if(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule) if (pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule)
{ {
if(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule if (pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule->u8RefCnt)
->u8RefCnt) pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule->u8RefCnt--;
pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule
->u8RefCnt--; if (0 == pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule->u8RefCnt)
if(0==pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule
->u8RefCnt)
kfree(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule); kfree(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule);
pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule = NULL; pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule = NULL;
} }
if(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule)
if (pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule)
{ {
if(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule if (pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule->u8RefCnt)
->u8RefCnt) pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule->u8RefCnt--;
pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule
->u8RefCnt--; if (0 == pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule->u8RefCnt)
if(0==pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule
->u8RefCnt)
kfree(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule); kfree(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule);
pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule = NULL; pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule = NULL;
} }
} }
...@@ -896,29 +847,28 @@ static void free_phs_serviceflow_rules(struct bcm_phs_table *psServiceFlowRulesT ...@@ -896,29 +847,28 @@ static void free_phs_serviceflow_rules(struct bcm_phs_table *psServiceFlowRulesT
psServiceFlowRulesTable = NULL; psServiceFlowRulesTable = NULL;
} }
static BOOLEAN ValidatePHSRuleComplete(IN struct bcm_phs_rule *psPhsRule) static BOOLEAN ValidatePHSRuleComplete(IN struct bcm_phs_rule *psPhsRule)
{ {
if(psPhsRule) if (psPhsRule)
{ {
if(!psPhsRule->u8PHSI) if (!psPhsRule->u8PHSI)
{ {
// PHSI is not valid // PHSI is not valid
return FALSE; return FALSE;
} }
if(!psPhsRule->u8PHSS) if (!psPhsRule->u8PHSS)
{ {
//PHSS Is Undefined //PHSS Is Undefined
return FALSE; return FALSE;
} }
//Check if PHSF is defines for the PHS Rule //Check if PHSF is defines for the PHS Rule
if(!psPhsRule->u8PHSFLength) // If any part of PHSF is valid then Rule contains valid PHSF if (!psPhsRule->u8PHSFLength) // If any part of PHSF is valid then Rule contains valid PHSF
{ {
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
else else
...@@ -928,14 +878,16 @@ static BOOLEAN ValidatePHSRuleComplete(IN struct bcm_phs_rule *psPhsRule) ...@@ -928,14 +878,16 @@ static BOOLEAN ValidatePHSRuleComplete(IN struct bcm_phs_rule *psPhsRule)
} }
UINT GetServiceFlowEntry(IN struct bcm_phs_table *psServiceFlowTable, 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; int i;
for(i=0;i<MAX_SERVICEFLOWS;i++)
for (i = 0; i < MAX_SERVICEFLOWS; i++)
{ {
if(psServiceFlowTable->stSFList[i].bUsed) if (psServiceFlowTable->stSFList[i].bUsed)
{ {
if(psServiceFlowTable->stSFList[i].uiVcid == uiVcid) if (psServiceFlowTable->stSFList[i].uiVcid == uiVcid)
{ {
*ppstServiceFlowEntry = &psServiceFlowTable->stSFList[i]; *ppstServiceFlowEntry = &psServiceFlowTable->stSFList[i];
return i; return i;
...@@ -947,17 +899,16 @@ UINT GetServiceFlowEntry(IN struct bcm_phs_table *psServiceFlowTable, ...@@ -947,17 +899,16 @@ UINT GetServiceFlowEntry(IN struct bcm_phs_table *psServiceFlowTable,
return PHS_INVALID_TABLE_INDEX; return PHS_INVALID_TABLE_INDEX;
} }
UINT GetClassifierEntry(IN struct bcm_phs_classifier_table *pstClassifierTable, UINT GetClassifierEntry(IN struct bcm_phs_classifier_table *pstClassifierTable,
IN B_UINT32 uiClsid, enum bcm_phs_classifier_context eClsContext, IN B_UINT32 uiClsid, enum bcm_phs_classifier_context eClsContext,
OUT struct bcm_phs_classifier_entry **ppstClassifierEntry) OUT struct bcm_phs_classifier_entry **ppstClassifierEntry)
{ {
int i; int i;
struct bcm_phs_classifier_entry *psClassifierRules = NULL; struct bcm_phs_classifier_entry *psClassifierRules = NULL;
for(i=0;i<MAX_PHSRULE_PER_SF;i++)
{
if(eClsContext == eActiveClassifierRuleContext) for (i = 0; i < MAX_PHSRULE_PER_SF; i++)
{
if (eClsContext == eActiveClassifierRuleContext)
{ {
psClassifierRules = &pstClassifierTable->stActivePhsRulesList[i]; psClassifierRules = &pstClassifierTable->stActivePhsRulesList[i];
} }
...@@ -966,15 +917,14 @@ UINT GetClassifierEntry(IN struct bcm_phs_classifier_table *pstClassifierTable, ...@@ -966,15 +917,14 @@ UINT GetClassifierEntry(IN struct bcm_phs_classifier_table *pstClassifierTable,
psClassifierRules = &pstClassifierTable->stOldPhsRulesList[i]; psClassifierRules = &pstClassifierTable->stOldPhsRulesList[i];
} }
if(psClassifierRules->bUsed) if (psClassifierRules->bUsed)
{ {
if(psClassifierRules->uiClassifierRuleId == uiClsid) if (psClassifierRules->uiClassifierRuleId == uiClsid)
{ {
*ppstClassifierEntry = psClassifierRules; *ppstClassifierEntry = psClassifierRules;
return i; return i;
} }
} }
} }
*ppstClassifierEntry = NULL; *ppstClassifierEntry = NULL;
...@@ -987,9 +937,10 @@ static UINT GetPhsRuleEntry(IN struct bcm_phs_classifier_table *pstClassifierTab ...@@ -987,9 +937,10 @@ static UINT GetPhsRuleEntry(IN struct bcm_phs_classifier_table *pstClassifierTab
{ {
int i; int i;
struct bcm_phs_classifier_entry *pstClassifierRule = NULL; struct bcm_phs_classifier_entry *pstClassifierRule = NULL;
for(i=0;i<MAX_PHSRULE_PER_SF;i++)
for (i = 0; i < MAX_PHSRULE_PER_SF; i++)
{ {
if(eClsContext == eActiveClassifierRuleContext) if (eClsContext == eActiveClassifierRuleContext)
{ {
pstClassifierRule = &pstClassifierTable->stActivePhsRulesList[i]; pstClassifierRule = &pstClassifierTable->stActivePhsRulesList[i];
} }
...@@ -997,48 +948,48 @@ static UINT GetPhsRuleEntry(IN struct bcm_phs_classifier_table *pstClassifierTab ...@@ -997,48 +948,48 @@ static UINT GetPhsRuleEntry(IN struct bcm_phs_classifier_table *pstClassifierTab
{ {
pstClassifierRule = &pstClassifierTable->stOldPhsRulesList[i]; pstClassifierRule = &pstClassifierTable->stOldPhsRulesList[i];
} }
if(pstClassifierRule->bUsed)
if (pstClassifierRule->bUsed)
{ {
if(pstClassifierRule->u8PHSI == uiPHSI) if (pstClassifierRule->u8PHSI == uiPHSI)
{ {
*ppstPhsRule = pstClassifierRule->pstPhsRule; *ppstPhsRule = pstClassifierRule->pstPhsRule;
return i; return i;
} }
} }
} }
*ppstPhsRule = NULL; *ppstPhsRule = NULL;
return PHS_INVALID_TABLE_INDEX; return PHS_INVALID_TABLE_INDEX;
} }
UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid,IN B_UINT16 uiClsId, UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid, IN B_UINT16 uiClsId,
IN struct bcm_phs_table *psServiceFlowTable, struct bcm_phs_rule *psPhsRule, IN struct bcm_phs_table *psServiceFlowTable,
struct bcm_phs_rule *psPhsRule,
B_UINT8 u8AssociatedPHSI) B_UINT8 u8AssociatedPHSI)
{ {
struct bcm_phs_classifier_table *psaClassifiertable = NULL; struct bcm_phs_classifier_table *psaClassifiertable = NULL;
UINT uiStatus = 0; UINT uiStatus = 0;
int iSfIndex; int iSfIndex;
BOOLEAN bFreeEntryFound =FALSE; BOOLEAN bFreeEntryFound = FALSE;
//Check for a free entry in SFID table //Check for a free entry in SFID table
for(iSfIndex=0;iSfIndex < MAX_SERVICEFLOWS;iSfIndex++) for (iSfIndex = 0; iSfIndex < MAX_SERVICEFLOWS; iSfIndex++)
{ {
if(!psServiceFlowTable->stSFList[iSfIndex].bUsed) if (!psServiceFlowTable->stSFList[iSfIndex].bUsed)
{ {
bFreeEntryFound = TRUE; bFreeEntryFound = TRUE;
break; break;
} }
} }
if(!bFreeEntryFound) if (!bFreeEntryFound)
return ERR_SFTABLE_FULL; return ERR_SFTABLE_FULL;
psaClassifiertable = psServiceFlowTable->stSFList[iSfIndex].pstClassifierTable; psaClassifiertable = psServiceFlowTable->stSFList[iSfIndex].pstClassifierTable;
uiStatus = CreateClassifierPHSRule(uiClsId,psaClassifiertable,psPhsRule, uiStatus = CreateClassifierPHSRule(uiClsId, psaClassifiertable, psPhsRule,
eActiveClassifierRuleContext,u8AssociatedPHSI); eActiveClassifierRuleContext, u8AssociatedPHSI);
if(uiStatus == PHS_SUCCESS) if (uiStatus == PHS_SUCCESS)
{ {
//Add entry at free index to the SF //Add entry at free index to the SF
psServiceFlowTable->stSFList[iSfIndex].bUsed = TRUE; psServiceFlowTable->stSFList[iSfIndex].bUsed = TRUE;
...@@ -1046,35 +997,42 @@ UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid,IN B_UINT16 uiClsId, ...@@ -1046,35 +997,42 @@ UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid,IN B_UINT16 uiClsId,
} }
return uiStatus; return uiStatus;
} }
UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid,
IN B_UINT16 uiClsId,IN struct bcm_phs_entry *pstServiceFlowEntry, IN B_UINT16 uiClsId,
struct bcm_phs_rule *psPhsRule, B_UINT8 u8AssociatedPHSI) IN struct bcm_phs_entry *pstServiceFlowEntry,
struct bcm_phs_rule *psPhsRule,
B_UINT8 u8AssociatedPHSI)
{ {
struct bcm_phs_classifier_entry *pstClassifierEntry = NULL; struct bcm_phs_classifier_entry *pstClassifierEntry = NULL;
UINT uiStatus =PHS_SUCCESS; UINT uiStatus = PHS_SUCCESS;
UINT nClassifierIndex = 0; UINT nClassifierIndex = 0;
struct bcm_phs_classifier_table *psaClassifiertable = NULL; struct bcm_phs_classifier_table *psaClassifiertable = NULL;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
psaClassifiertable = pstServiceFlowEntry->pstClassifierTable; 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 */ /* Check if the supplied Classifier already exists */
nClassifierIndex =GetClassifierEntry( nClassifierIndex = GetClassifierEntry(
pstServiceFlowEntry->pstClassifierTable,uiClsId, pstServiceFlowEntry->pstClassifierTable,
eActiveClassifierRuleContext,&pstClassifierEntry); uiClsId,
if(nClassifierIndex == PHS_INVALID_TABLE_INDEX) eActiveClassifierRuleContext,
&pstClassifierEntry);
if (nClassifierIndex == PHS_INVALID_TABLE_INDEX)
{ {
/* /*
The Classifier doesn't exist. So its a new classifier being added. The Classifier doesn't exist. So its a new classifier being added.
Add new entry to associate PHS Rule to the Classifier Add new entry to associate PHS Rule to the Classifier
*/ */
uiStatus = CreateClassifierPHSRule(uiClsId,psaClassifiertable, uiStatus = CreateClassifierPHSRule(uiClsId, psaClassifiertable,
psPhsRule,eActiveClassifierRuleContext,u8AssociatedPHSI); psPhsRule,
eActiveClassifierRuleContext,
u8AssociatedPHSI);
return uiStatus; return uiStatus;
} }
...@@ -1082,9 +1040,10 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, ...@@ -1082,9 +1040,10 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid,
The Classifier exists.The PHS Rule for this classifier The Classifier exists.The PHS Rule for this classifier
is being modified is being modified
*/ */
if(pstClassifierEntry->u8PHSI == psPhsRule->u8PHSI)
if (pstClassifierEntry->u8PHSI == psPhsRule->u8PHSI)
{ {
if(pstClassifierEntry->pstPhsRule == NULL) if (pstClassifierEntry->pstPhsRule == NULL)
return ERR_PHS_INVALID_PHS_RULE; return ERR_PHS_INVALID_PHS_RULE;
/* /*
...@@ -1092,31 +1051,34 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, ...@@ -1092,31 +1051,34 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid,
rule update them. rule update them.
*/ */
/* If any part of PHSF is valid then we update PHSF */ /* If any part of PHSF is valid then we update PHSF */
if(psPhsRule->u8PHSFLength) if (psPhsRule->u8PHSFLength)
{ {
//update PHSF //update PHSF
memcpy(pstClassifierEntry->pstPhsRule->u8PHSF, memcpy(pstClassifierEntry->pstPhsRule->u8PHSF,
psPhsRule->u8PHSF , MAX_PHS_LENGTHS); psPhsRule->u8PHSF, MAX_PHS_LENGTHS);
} }
if(psPhsRule->u8PHSFLength)
if (psPhsRule->u8PHSFLength)
{ {
//update PHSFLen //update PHSFLen
pstClassifierEntry->pstPhsRule->u8PHSFLength = pstClassifierEntry->pstPhsRule->u8PHSFLength = psPhsRule->u8PHSFLength;
psPhsRule->u8PHSFLength;
} }
if(psPhsRule->u8PHSMLength)
if (psPhsRule->u8PHSMLength)
{ {
//update PHSM //update PHSM
memcpy(pstClassifierEntry->pstPhsRule->u8PHSM, memcpy(pstClassifierEntry->pstPhsRule->u8PHSM,
psPhsRule->u8PHSM, MAX_PHS_LENGTHS); psPhsRule->u8PHSM, MAX_PHS_LENGTHS);
} }
if(psPhsRule->u8PHSMLength)
if (psPhsRule->u8PHSMLength)
{ {
//update PHSM Len //update PHSM Len
pstClassifierEntry->pstPhsRule->u8PHSMLength = pstClassifierEntry->pstPhsRule->u8PHSMLength =
psPhsRule->u8PHSMLength; psPhsRule->u8PHSMLength;
} }
if(psPhsRule->u8PHSS)
if (psPhsRule->u8PHSS)
{ {
//update PHSS //update PHSS
pstClassifierEntry->pstPhsRule->u8PHSS = psPhsRule->u8PHSS; pstClassifierEntry->pstPhsRule->u8PHSS = psPhsRule->u8PHSS;
...@@ -1124,46 +1086,48 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, ...@@ -1124,46 +1086,48 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid,
//update PHSV //update PHSV
pstClassifierEntry->pstPhsRule->u8PHSV = psPhsRule->u8PHSV; pstClassifierEntry->pstPhsRule->u8PHSV = psPhsRule->u8PHSV;
} }
else else
{ {
/* /*
A new rule is being set for this classifier. A new rule is being set for this classifier.
*/ */
uiStatus=UpdateClassifierPHSRule( uiClsId, pstClassifierEntry, uiStatus = UpdateClassifierPHSRule(uiClsId, pstClassifierEntry,
psaClassifiertable, psPhsRule, u8AssociatedPHSI); psaClassifiertable, psPhsRule, u8AssociatedPHSI);
} }
return uiStatus; return uiStatus;
} }
static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId,
struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *psPhsRule, struct bcm_phs_classifier_table *psaClassifiertable,
enum bcm_phs_classifier_context eClsContext,B_UINT8 u8AssociatedPHSI) struct bcm_phs_rule *psPhsRule,
enum bcm_phs_classifier_context eClsContext,
B_UINT8 u8AssociatedPHSI)
{ {
UINT iClassifierIndex = 0; UINT iClassifierIndex = 0;
BOOLEAN bFreeEntryFound = FALSE; BOOLEAN bFreeEntryFound = FALSE;
struct bcm_phs_classifier_entry *psClassifierRules = NULL; struct bcm_phs_classifier_entry *psClassifierRules = NULL;
UINT nStatus = PHS_SUCCESS; UINT nStatus = PHS_SUCCESS;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,"Inside CreateClassifierPHSRule");
if(psaClassifiertable == NULL) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, "Inside CreateClassifierPHSRule");
if (psaClassifiertable == NULL)
{ {
return ERR_INVALID_CLASSIFIERTABLE_FOR_SF; return ERR_INVALID_CLASSIFIERTABLE_FOR_SF;
} }
if(eClsContext == eOldClassifierRuleContext) if (eClsContext == eOldClassifierRuleContext)
{ {
/* If An Old Entry for this classifier ID already exists in the /* If An Old Entry for this classifier ID already exists in the
old rules table replace it. */ old rules table replace it. */
iClassifierIndex = iClassifierIndex =
GetClassifierEntry(psaClassifiertable, uiClsId, GetClassifierEntry(psaClassifiertable, uiClsId,
eClsContext,&psClassifierRules); eClsContext, &psClassifierRules);
if(iClassifierIndex != PHS_INVALID_TABLE_INDEX)
if (iClassifierIndex != PHS_INVALID_TABLE_INDEX)
{ {
/* /*
The Classifier already exists in the old rules table The Classifier already exists in the old rules table
...@@ -1173,26 +1137,24 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1173,26 +1137,24 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId,
} }
} }
if(!bFreeEntryFound) if (!bFreeEntryFound)
{ {
/* /*
Continue to search for a free location to add the rule Continue to search for a free location to add the rule
*/ */
for(iClassifierIndex = 0; iClassifierIndex < for (iClassifierIndex = 0; iClassifierIndex <
MAX_PHSRULE_PER_SF; iClassifierIndex++) MAX_PHSRULE_PER_SF; iClassifierIndex++)
{ {
if(eClsContext == eActiveClassifierRuleContext) if (eClsContext == eActiveClassifierRuleContext)
{ {
psClassifierRules = psClassifierRules = &psaClassifiertable->stActivePhsRulesList[iClassifierIndex];
&psaClassifiertable->stActivePhsRulesList[iClassifierIndex];
} }
else else
{ {
psClassifierRules = psClassifierRules = &psaClassifiertable->stOldPhsRulesList[iClassifierIndex];
&psaClassifiertable->stOldPhsRulesList[iClassifierIndex];
} }
if(!psClassifierRules->bUsed) if (!psClassifierRules->bUsed)
{ {
bFreeEntryFound = TRUE; bFreeEntryFound = TRUE;
break; break;
...@@ -1200,36 +1162,34 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1200,36 +1162,34 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId,
} }
} }
if(!bFreeEntryFound) if (!bFreeEntryFound)
{ {
if(eClsContext == eActiveClassifierRuleContext) if (eClsContext == eActiveClassifierRuleContext)
{ {
return ERR_CLSASSIFIER_TABLE_FULL; return ERR_CLSASSIFIER_TABLE_FULL;
} }
else else
{ {
//Lets replace the oldest rule if we are looking in old Rule table //Lets replace the oldest rule if we are looking in old Rule table
if(psaClassifiertable->uiOldestPhsRuleIndex >= if (psaClassifiertable->uiOldestPhsRuleIndex >= MAX_PHSRULE_PER_SF)
MAX_PHSRULE_PER_SF)
{ {
psaClassifiertable->uiOldestPhsRuleIndex =0; psaClassifiertable->uiOldestPhsRuleIndex = 0;
} }
iClassifierIndex = psaClassifiertable->uiOldestPhsRuleIndex; iClassifierIndex = psaClassifiertable->uiOldestPhsRuleIndex;
psClassifierRules = psClassifierRules = &psaClassifiertable->stOldPhsRulesList[iClassifierIndex];
&psaClassifiertable->stOldPhsRulesList[iClassifierIndex];
(psaClassifiertable->uiOldestPhsRuleIndex)++; (psaClassifiertable->uiOldestPhsRuleIndex)++;
} }
} }
if(eClsContext == eOldClassifierRuleContext) if (eClsContext == eOldClassifierRuleContext)
{ {
if(psClassifierRules->pstPhsRule == NULL) 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) if (NULL == psClassifierRules->pstPhsRule)
return ERR_PHSRULE_MEMALLOC_FAIL; return ERR_PHSRULE_MEMALLOC_FAIL;
} }
...@@ -1239,69 +1199,70 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1239,69 +1199,70 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId,
psClassifierRules->bUnclassifiedPHSRule = psPhsRule->bUnclassifiedPHSRule; psClassifierRules->bUnclassifiedPHSRule = psPhsRule->bUnclassifiedPHSRule;
/* Update The PHS rule */ /* Update The PHS rule */
memcpy(psClassifierRules->pstPhsRule, memcpy(psClassifierRules->pstPhsRule, psPhsRule, sizeof(struct bcm_phs_rule));
psPhsRule, sizeof(struct bcm_phs_rule));
} }
else else
{ {
nStatus = UpdateClassifierPHSRule(uiClsId,psClassifierRules, nStatus = UpdateClassifierPHSRule(uiClsId, psClassifierRules,
psaClassifiertable,psPhsRule,u8AssociatedPHSI); psaClassifiertable, psPhsRule, u8AssociatedPHSI);
} }
return nStatus; return nStatus;
} }
static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId,
IN struct bcm_phs_classifier_entry *pstClassifierEntry, IN struct bcm_phs_classifier_entry *pstClassifierEntry,
struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *psPhsRule, struct bcm_phs_classifier_table *psaClassifiertable,
struct bcm_phs_rule *psPhsRule,
B_UINT8 u8AssociatedPHSI) B_UINT8 u8AssociatedPHSI)
{ {
struct bcm_phs_rule *pstAddPhsRule = NULL; struct bcm_phs_rule *pstAddPhsRule = NULL;
UINT nPhsRuleIndex = 0; UINT nPhsRuleIndex = 0;
BOOLEAN bPHSRuleOrphaned = FALSE; BOOLEAN bPHSRuleOrphaned = FALSE;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
psPhsRule->u8RefCnt =0;
psPhsRule->u8RefCnt = 0;
/* Step 1 Deref Any Exisiting PHS Rule in this classifier Entry*/ /* Step 1 Deref Any Exisiting PHS Rule in this classifier Entry*/
bPHSRuleOrphaned = DerefPhsRule( uiClsId, psaClassifiertable, bPHSRuleOrphaned = DerefPhsRule(uiClsId, psaClassifiertable,
pstClassifierEntry->pstPhsRule); pstClassifierEntry->pstPhsRule);
//Step 2 Search if there is a PHS Rule with u8AssociatedPHSI in Classifier table for this SF //Step 2 Search if there is a PHS Rule with u8AssociatedPHSI in Classifier table for this SF
nPhsRuleIndex =GetPhsRuleEntry(psaClassifiertable,u8AssociatedPHSI, nPhsRuleIndex = GetPhsRuleEntry(psaClassifiertable, u8AssociatedPHSI,
eActiveClassifierRuleContext, &pstAddPhsRule); eActiveClassifierRuleContext, &pstAddPhsRule);
if(PHS_INVALID_TABLE_INDEX == nPhsRuleIndex) 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) 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; return ERR_PHS_INVALID_PHS_RULE;
} }
//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 = kmalloc(sizeof(struct bcm_phs_rule), GFP_KERNEL); pstClassifierEntry->pstPhsRule = kmalloc(sizeof(struct bcm_phs_rule), GFP_KERNEL);
if(NULL == pstClassifierEntry->pstPhsRule) if (NULL == pstClassifierEntry->pstPhsRule)
{ {
return ERR_PHSRULE_MEMALLOC_FAIL; return ERR_PHSRULE_MEMALLOC_FAIL;
} }
} }
memcpy(pstClassifierEntry->pstPhsRule, psPhsRule, sizeof(struct bcm_phs_rule)); memcpy(pstClassifierEntry->pstPhsRule, psPhsRule, sizeof(struct bcm_phs_rule));
} }
else else
{ {
//Step 2.b PHS Rule Exists Tie uiClsId with the existing PHS Rule //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) if (bPHSRuleOrphaned)
{ {
kfree(pstClassifierEntry->pstPhsRule); kfree(pstClassifierEntry->pstPhsRule);
pstClassifierEntry->pstPhsRule = NULL; pstClassifierEntry->pstPhsRule = NULL;
} }
pstClassifierEntry->pstPhsRule = pstAddPhsRule; pstClassifierEntry->pstPhsRule = pstAddPhsRule;
} }
pstClassifierEntry->bUsed = TRUE; pstClassifierEntry->bUsed = TRUE;
pstClassifierEntry->u8PHSI = pstClassifierEntry->pstPhsRule->u8PHSI; pstClassifierEntry->u8PHSI = pstClassifierEntry->pstPhsRule->u8PHSI;
pstClassifierEntry->uiClassifierRuleId = uiClsId; pstClassifierEntry->uiClassifierRuleId = uiClsId;
...@@ -1309,16 +1270,17 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1309,16 +1270,17 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId,
pstClassifierEntry->bUnclassifiedPHSRule = pstClassifierEntry->pstPhsRule->bUnclassifiedPHSRule; pstClassifierEntry->bUnclassifiedPHSRule = pstClassifierEntry->pstPhsRule->bUnclassifiedPHSRule;
return PHS_SUCCESS; return PHS_SUCCESS;
} }
static BOOLEAN DerefPhsRule(IN B_UINT16 uiClsId, struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *pstPhsRule) static BOOLEAN DerefPhsRule(IN B_UINT16 uiClsId, struct bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *pstPhsRule)
{ {
if(pstPhsRule==NULL) if (pstPhsRule == NULL)
return FALSE; return FALSE;
if(pstPhsRule->u8RefCnt)
if (pstPhsRule->u8RefCnt)
pstPhsRule->u8RefCnt--; pstPhsRule->u8RefCnt--;
if(0==pstPhsRule->u8RefCnt)
if (0 == pstPhsRule->u8RefCnt)
{ {
/*if(pstPhsRule->u8PHSI) /*if(pstPhsRule->u8PHSI)
//Store the currently active rule into the old rules list //Store the currently active rule into the old rules list
...@@ -1333,55 +1295,59 @@ static BOOLEAN DerefPhsRule(IN B_UINT16 uiClsId, struct bcm_phs_classifier_tabl ...@@ -1333,55 +1295,59 @@ static BOOLEAN DerefPhsRule(IN B_UINT16 uiClsId, struct bcm_phs_classifier_tabl
void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension) void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension)
{ {
int i,j,k,l; int i, j, k, l;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 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");
for(i=0;i<MAX_SERVICEFLOWS;i++) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\n Dumping PHS Rules :\n");
for (i = 0; i < MAX_SERVICEFLOWS; i++)
{ {
struct bcm_phs_entry stServFlowEntry = struct bcm_phs_entry stServFlowEntry =
pDeviceExtension->pstServiceFlowPhsRulesTable->stSFList[i]; pDeviceExtension->pstServiceFlowPhsRulesTable->stSFList[i];
if(stServFlowEntry.bUsed) if (stServFlowEntry.bUsed)
{ {
for(j=0;j<MAX_PHSRULE_PER_SF;j++) for (j = 0; j < MAX_PHSRULE_PER_SF; j++)
{ {
for(l=0;l<2;l++) for (l = 0; l < 2; l++)
{ {
struct bcm_phs_classifier_entry stClsEntry; struct bcm_phs_classifier_entry stClsEntry;
if(l==0)
if (l == 0)
{ {
stClsEntry = stServFlowEntry.pstClassifierTable->stActivePhsRulesList[j]; stClsEntry = stServFlowEntry.pstClassifierTable->stActivePhsRulesList[j];
if(stClsEntry.bUsed) if (stClsEntry.bUsed)
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n Active PHS Rule : \n"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n Active PHS Rule :\n");
} }
else else
{ {
stClsEntry = stServFlowEntry.pstClassifierTable->stOldPhsRulesList[j]; stClsEntry = stServFlowEntry.pstClassifierTable->stOldPhsRulesList[j];
if(stClsEntry.bUsed) if (stClsEntry.bUsed)
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n Old PHS Rule : \n"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n Old PHS Rule :\n");
} }
if(stClsEntry.bUsed) if (stClsEntry.bUsed)
{ {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\n VCID : %#X", stServFlowEntry.uiVcid);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n ClassifierID : %#X", stClsEntry.uiClassifierRuleId);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSRuleID : %#X", stClsEntry.u8PHSI);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n****************PHS Rule********************\n");
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSI : %#X", stClsEntry.pstPhsRule->u8PHSI);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSFLength : %#X ", stClsEntry.pstPhsRule->u8PHSFLength);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSF : ");
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\n VCID : %#X",stServFlowEntry.uiVcid); for (k = 0 ; k < stClsEntry.pstPhsRule->u8PHSFLength; k++)
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n ClassifierID : %#X",stClsEntry.uiClassifierRuleId);
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSRuleID : %#X",stClsEntry.u8PHSI);
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n****************PHS Rule********************\n");
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSI : %#X",stClsEntry.pstPhsRule->u8PHSI);
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSFLength : %#X ",stClsEntry.pstPhsRule->u8PHSFLength);
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSF : ");
for(k=0;k<stClsEntry.pstPhsRule->u8PHSFLength;k++)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "%#X ",stClsEntry.pstPhsRule->u8PHSF[k]); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "%#X ", stClsEntry.pstPhsRule->u8PHSF[k]);
} }
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSMLength : %#X",stClsEntry.pstPhsRule->u8PHSMLength); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSMLength : %#X", stClsEntry.pstPhsRule->u8PHSMLength);
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSM :"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSM :");
for(k=0;k<stClsEntry.pstPhsRule->u8PHSMLength;k++)
for (k = 0; k < stClsEntry.pstPhsRule->u8PHSMLength; k++)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "%#X ",stClsEntry.pstPhsRule->u8PHSM[k]); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "%#X ", stClsEntry.pstPhsRule->u8PHSM[k]);
} }
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSS : %#X ",stClsEntry.pstPhsRule->u8PHSS); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSS : %#X ", stClsEntry.pstPhsRule->u8PHSS);
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSV : %#X",stClsEntry.pstPhsRule->u8PHSV); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), "\n PHSV : %#X", stClsEntry.pstPhsRule->u8PHSV);
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\n********************************************\n"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\n********************************************\n");
} }
} }
} }
...@@ -1389,7 +1355,6 @@ void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension) ...@@ -1389,7 +1355,6 @@ void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension)
} }
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Procedure: phs_decompress // Procedure: phs_decompress
// //
...@@ -1407,23 +1372,26 @@ void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension) ...@@ -1407,23 +1372,26 @@ void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension)
// 0 -If PHS rule is NULL.If PHSI is 0 indicateing packet as uncompressed. // 0 -If PHS rule is NULL.If PHSI is 0 indicateing packet as uncompressed.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, int phs_decompress(unsigned char *in_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; int phss, size = 0;
struct bcm_phs_rule *tmp_memb; struct bcm_phs_rule *tmp_memb;
int bit,i=0; int bit, i = 0;
unsigned char *phsf,*phsm; unsigned char *phsf, *phsm;
int in_buf_len = *header_size-1; int in_buf_len = *header_size - 1;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
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; *header_size = 0;
if((decomp_phs_rules == NULL )) if ((decomp_phs_rules == NULL))
return 0; return 0;
tmp_memb = decomp_phs_rules; tmp_memb = decomp_phs_rules;
//BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI 1 %d",phsi)); //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI 1 %d",phsi));
//*header_size = tmp_memb->u8PHSFLength; //*header_size = tmp_memb->u8PHSFLength;
...@@ -1431,24 +1399,25 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, ...@@ -1431,24 +1399,25 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf,
phsf = tmp_memb->u8PHSF; phsf = tmp_memb->u8PHSF;
phsm = tmp_memb->u8PHSM; phsm = tmp_memb->u8PHSM;
if(phss > MAX_PHS_LENGTHS) if (phss > MAX_PHS_LENGTHS)
phss = MAX_PHS_LENGTHS; phss = MAX_PHS_LENGTHS;
//BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI %d phss %d index %d",phsi,phss,index)); //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI %d phss %d index %d",phsi,phss,index));
while((phss > 0) && (size < in_buf_len)) while ((phss > 0) && (size < in_buf_len))
{ {
bit = ((*phsm << i)& SUPPRESS); bit = ((*phsm << i) & SUPPRESS);
if(bit == SUPPRESS) if (bit == SUPPRESS)
{ {
*out_buf = *phsf; *out_buf = *phsf;
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phss %d phsf %d ouput %d", BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, "\nDECOMP:In phss %d phsf %d ouput %d",
phss,*phsf,*out_buf); phss, *phsf, *out_buf);
} }
else else
{ {
*out_buf = *in_buf; *out_buf = *in_buf;
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phss %d input %d ouput %d", BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_RECEIVE, DBG_LVL_ALL, "\nDECOMP:In phss %d input %d ouput %d",
phss,*in_buf,*out_buf); phss, *in_buf, *out_buf);
in_buf++; in_buf++;
size++; size++;
} }
...@@ -1456,20 +1425,18 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, ...@@ -1456,20 +1425,18 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf,
phsf++; phsf++;
phss--; phss--;
i++; i++;
*header_size=*header_size + 1; *header_size = *header_size + 1;
if(i > MAX_NO_BIT) if (i > MAX_NO_BIT)
{ {
i=0; i = 0;
phsm++; phsm++;
} }
} }
return size; return size;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Procedure: phs_compress // Procedure: phs_compress
// //
...@@ -1490,21 +1457,24 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, ...@@ -1490,21 +1457,24 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf,
// size-The number of bytes copied into the output buffer i.e dynamic fields // size-The number of bytes copied into the output buffer i.e dynamic fields
// 0 -If PHS rule is NULL.If PHSV field is not set.If the verification fails. // 0 -If PHS rule is NULL.If PHSV field is not set.If the verification fails.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static int phs_compress(struct bcm_phs_rule *phs_rule, unsigned char *in_buf static int phs_compress(struct bcm_phs_rule *phs_rule,
,unsigned char *out_buf,UINT *header_size,UINT *new_header_size) unsigned char *in_buf,
unsigned char *out_buf,
UINT *header_size,
UINT *new_header_size)
{ {
unsigned char *old_addr = out_buf; unsigned char *old_addr = out_buf;
int suppress = 0; int suppress = 0;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
if(phs_rule == NULL)
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; *out_buf = ZERO_PHSI;
return STATUS_PHS_NOCOMPRESSION; return STATUS_PHS_NOCOMPRESSION;
} }
if (phs_rule->u8PHSS <= *new_header_size)
if(phs_rule->u8PHSS <= *new_header_size)
{ {
*header_size = phs_rule->u8PHSS; *header_size = phs_rule->u8PHSS;
} }
...@@ -1512,25 +1482,27 @@ static int phs_compress(struct bcm_phs_rule *phs_rule, unsigned char *in_buf ...@@ -1512,25 +1482,27 @@ static int phs_compress(struct bcm_phs_rule *phs_rule, unsigned char *in_buf
{ {
*header_size = *new_header_size; *header_size = *new_header_size;
} }
//To copy PHSI //To copy PHSI
out_buf++; out_buf++;
suppress = verify_suppress_phsf(in_buf,out_buf,phs_rule->u8PHSF, suppress = verify_suppress_phsf(in_buf, out_buf, phs_rule->u8PHSF,
phs_rule->u8PHSM, phs_rule->u8PHSS, phs_rule->u8PHSV,new_header_size); phs_rule->u8PHSM, phs_rule->u8PHSS,
phs_rule->u8PHSV, new_header_size);
if(suppress == STATUS_PHS_COMPRESSED) if (suppress == STATUS_PHS_COMPRESSED)
{ {
*old_addr = (unsigned char)phs_rule->u8PHSI; *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 else
{ {
*old_addr = ZERO_PHSI; *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; return suppress;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Procedure: verify_suppress_phsf // Procedure: verify_suppress_phsf
// //
...@@ -1551,61 +1523,81 @@ static int phs_compress(struct bcm_phs_rule *phs_rule, unsigned char *in_buf ...@@ -1551,61 +1523,81 @@ static int phs_compress(struct bcm_phs_rule *phs_rule, unsigned char *in_buf
// 0 -Packet has failed the verification. // 0 -Packet has failed the verification.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static int verify_suppress_phsf(unsigned char *in_buffer,unsigned char *out_buffer, static int verify_suppress_phsf(unsigned char *in_buffer,
unsigned char *phsf,unsigned char *phsm,unsigned int phss, unsigned char *out_buffer,
unsigned int phsv,UINT* new_header_size) unsigned char *phsf,
unsigned char *phsm,
unsigned int phss,
unsigned int phsv,
UINT *new_header_size)
{ {
unsigned int size=0; unsigned int size = 0;
int bit,i=0; int bit, i = 0;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); 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)) if (phss > (*new_header_size))
{ {
phss=*new_header_size; phss = *new_header_size;
} }
while(phss > 0)
while (phss > 0)
{ {
bit = ((*phsm << i)& SUPPRESS); bit = ((*phsm << i) & SUPPRESS);
if(bit == SUPPRESS) if (bit == SUPPRESS)
{ {
if (*in_buffer != *phsf)
if(*in_buffer != *phsf)
{ {
if(phsv == VERIFY) if (phsv == VERIFY)
{ {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In verify_phsf failed for field %d buf %d phsf %d",phss,*in_buffer,*phsf); BCM_DEBUG_PRINT(Adapter,
DBG_TYPE_OTHERS,
PHS_SEND,
DBG_LVL_ALL,
"\nCOMP:In verify_phsf failed for field %d buf %d phsf %d",
phss,
*in_buffer,
*phsf);
return STATUS_PHS_NOCOMPRESSION; return STATUS_PHS_NOCOMPRESSION;
} }
} }
else else
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In verify_phsf success for field %d buf %d phsf %d",phss,*in_buffer,*phsf); BCM_DEBUG_PRINT(Adapter,
DBG_TYPE_OTHERS,
PHS_SEND,
DBG_LVL_ALL,
"\nCOMP:In verify_phsf success for field %d buf %d phsf %d",
phss,
*in_buffer,
*phsf);
} }
else else
{ {
*out_buffer = *in_buffer; *out_buffer = *in_buffer;
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"\nCOMP:In copying_header input %d out %d",*in_buffer,*out_buffer); BCM_DEBUG_PRINT(Adapter,
DBG_TYPE_OTHERS,
PHS_SEND,
DBG_LVL_ALL,
"\nCOMP:In copying_header input %d out %d",
*in_buffer,
*out_buffer);
out_buffer++; out_buffer++;
size++; size++;
} }
in_buffer++; in_buffer++;
phsf++; phsf++;
phss--; phss--;
i++; i++;
if(i > MAX_NO_BIT)
if (i > MAX_NO_BIT)
{ {
i=0; i = 0;
phsm++; 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; *new_header_size = size;
return STATUS_PHS_COMPRESSED; return STATUS_PHS_COMPRESSED;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment