Commit 14b3a406 authored by Kevin McKinney's avatar Kevin McKinney Committed by Greg Kroah-Hartman

Staging: bcm: Properly format comments in PHSModule.c

This patch properly formats comments, and removes
them as needed in PHSModule.c.
Signed-off-by: default avatarKevin McKinney <klmckinney1@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6949387e
...@@ -46,22 +46,22 @@ static ULONG PhsDeCompress(void *pvContext, ...@@ -46,22 +46,22 @@ static ULONG PhsDeCompress(void *pvContext,
#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
identify PHS rule to be applied. * identify PHS rule to be applied.
B_UINT16 uiClassifierRuleID - Classifier Rule ID * B_UINT16 uiClassifierRuleID - Classifier Rule ID
BOOLEAN bHeaderSuppressionEnabled - indicates if header suprression is enabled for SF. * BOOLEAN bHeaderSuppressionEnabled - indicates if header suprression is enabled for SF.
*
Return: STATUS_SUCCESS - If the send was successful. * Return: STATUS_SUCCESS - If the send was successful.
Other - If an error occurred. * Other - If an error occurred.
*/ */
int PHSTransmit(struct bcm_mini_adapter *Adapter, int PHSTransmit(struct bcm_mini_adapter *Adapter,
struct sk_buff **pPacket, struct sk_buff **pPacket,
...@@ -71,7 +71,7 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -71,7 +71,7 @@ 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;
...@@ -92,14 +92,14 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -92,14 +92,14 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
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
...@@ -108,8 +108,10 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -108,8 +108,10 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
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. /*
// Suppress only if IP Header and PHS Enabled For the Service Flow * Step 2 Suppress Header using PHS and fill into intermediate ucaPHSPktHdrOutBuf.
* 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)) {
...@@ -156,7 +158,7 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -156,7 +158,7 @@ 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)) {
...@@ -166,7 +168,11 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -166,7 +168,11 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
} }
skb_push(Packet, 1); skb_push(Packet, 1);
// CAUTION: The MAC Header is getting corrupted here for IP CS - can be saved by copying 14 Bytes. not needed .... hence corrupting it. /*
* CAUTION: The MAC Header is getting corrupted
* here for IP CS - can be saved by copying 14
* Bytes. not needed .... hence corrupting it.
*/
*(Packet->data + BytesToRemove) = bPHSI; *(Packet->data + BytesToRemove) = bPHSI;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -179,7 +185,7 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -179,7 +185,7 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
} }
} }
//BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"PHSTransmit : Dumping data packet After PHS"); /* BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,"PHSTransmit : Dumping data packet After PHS"); */
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -203,7 +209,7 @@ int PHSReceive(struct bcm_mini_adapter *Adapter, ...@@ -203,7 +209,7 @@ int PHSReceive(struct bcm_mini_adapter *Adapter,
pucInBuff = packet->data; pucInBuff = packet->data;
//Restore PHS suppressed header /* Restore PHS suppressed header */
nStandardPktHdrLen = packet->len; nStandardPktHdrLen = packet->len;
ulPhsStatus = PhsDeCompress(&Adapter->stBCMPhsContext, ulPhsStatus = PhsDeCompress(&Adapter->stBCMPhsContext,
usVcid, usVcid,
...@@ -248,19 +254,19 @@ void DumpFullPacket(UCHAR *pBuf, UINT nPktLen) ...@@ -248,19 +254,19 @@ void DumpFullPacket(UCHAR *pBuf, UINT nPktLen)
BCM_DEBUG_PRINT_BUFFER(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, pBuf, nPktLen); BCM_DEBUG_PRINT_BUFFER(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, pBuf, nPktLen);
} }
//----------------------------------------------------------------------------- /*
// Procedure: phs_init * Procedure: phs_init
// *
// Description: This routine is responsible for allocating memory for classifier and * Description: This routine is responsible for allocating memory for classifier and
// PHS rules. * PHS rules.
// *
// Arguments: * Arguments:
// pPhsdeviceExtension - ptr to Device extension containing PHS Classifier rules and PHS Rules , RX, TX buffer etc * pPhsdeviceExtension - ptr to Device extension containing PHS Classifier rules and PHS Rules , RX, TX buffer etc
// *
// Returns: * Returns:
// TRUE(1) -If allocation of memory was success full. * TRUE(1) -If allocation of memory was success full.
// FALSE -If allocation of memory fails. * 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; int i;
...@@ -327,25 +333,24 @@ int PhsCleanup(IN struct bcm_phs_extension *pPHSDeviceExt) ...@@ -327,25 +333,24 @@ int PhsCleanup(IN struct bcm_phs_extension *pPHSDeviceExt)
return 0; return 0;
} }
//PHS functions /*
/*++ * PHS functions
PhsUpdateClassifierRule * PhsUpdateClassifierRule
*
Routine Description: * Routine Description:
Exported function to add or modify a PHS Rule. * Exported function to add or modify a PHS Rule.
*
Arguments: * Arguments:
IN void* pvContext - PHS Driver Specific Context * IN void* pvContext - PHS Driver Specific Context
IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rule applies * IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rule applies
IN B_UINT16 uiClsId - The Classifier ID within the Service Flow for which the PHS rule applies. * IN B_UINT16 uiClsId - The Classifier ID within the Service Flow for which the PHS rule applies.
IN struct bcm_phs_rule *psPhsRule - The PHS Rule strcuture to be added to the PHS Rule table. * IN struct bcm_phs_rule *psPhsRule - The PHS Rule strcuture to be added to the PHS Rule table.
*
Return Value: * Return Value:
*
0 if successful, * 0 if successful,
>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 ,
...@@ -386,24 +391,22 @@ ULONG PhsUpdateClassifierRule(IN void *pvContext, ...@@ -386,24 +391,22 @@ ULONG PhsUpdateClassifierRule(IN void *pvContext,
return lStatus; return lStatus;
} }
/*++ /*
PhsDeletePHSRule * PhsDeletePHSRule
*
Routine Description: * Routine Description:
Deletes the specified phs Rule within Vcid * Deletes the specified phs Rule within Vcid
*
Arguments: * Arguments:
IN void* pvContext - PHS Driver Specific Context * IN void* pvContext - PHS Driver Specific Context
IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rule applies * IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rule applies
IN B_UINT8 u8PHSI - the PHS Index identifying PHS rule to be deleted. * IN B_UINT8 u8PHSI - the PHS Index identifying PHS rule to be deleted.
*
Return Value: * Return Value:
*
0 if successful, * 0 if successful,
>0 Error. * >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)
{ {
ULONG lStatus = 0; ULONG lStatus = 0;
...@@ -416,7 +419,7 @@ ULONG PhsDeletePHSRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT8 u8PHSI ...@@ -416,7 +419,7 @@ ULONG PhsDeletePHSRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT8 u8PHSI
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) { if (pDeviceExtension) {
//Retrieve the SFID Entry Index for requested Service Flow /* 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) { if (nSFIndex == PHS_INVALID_TABLE_INDEX) {
...@@ -446,23 +449,22 @@ ULONG PhsDeletePHSRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT8 u8PHSI ...@@ -446,23 +449,22 @@ ULONG PhsDeletePHSRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT8 u8PHSI
return lStatus; return lStatus;
} }
/*++ /*
PhsDeleteClassifierRule * PhsDeleteClassifierRule
*
Routine Description: * Routine Description:
Exported function to Delete a PHS Rule for the SFID,CLSID Pair. * Exported function to Delete a PHS Rule for the SFID,CLSID Pair.
*
Arguments: * Arguments:
IN void* pvContext - PHS Driver Specific Context * IN void* pvContext - PHS Driver Specific Context
IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rule applies * IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rule applies
IN B_UINT16 uiClsId - The Classifier ID within the Service Flow for which the PHS rule applies. * IN B_UINT16 uiClsId - The Classifier ID within the Service Flow for which the PHS rule applies.
*
Return Value: * Return Value:
*
0 if successful, * 0 if successful,
>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;
...@@ -473,7 +475,7 @@ ULONG PhsDeleteClassifierRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT1 ...@@ -473,7 +475,7 @@ ULONG PhsDeleteClassifierRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT1
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->pstServiceFlowPhsRulesTable, uiVcid, &pstServiceFlowEntry); nSFIndex = GetServiceFlowEntry(pDeviceExtension->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");
...@@ -505,22 +507,21 @@ ULONG PhsDeleteClassifierRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT1 ...@@ -505,22 +507,21 @@ ULONG PhsDeleteClassifierRule(IN void *pvContext, IN B_UINT16 uiVcid, IN B_UINT1
return lStatus; return lStatus;
} }
/*++ /*
PhsDeleteSFRules * PhsDeleteSFRules
*
Routine Description: * Routine Description:
Exported function to Delete a all PHS Rules for the SFID. * Exported function to Delete a all PHS Rules for the SFID.
*
Arguments: * Arguments:
IN void* pvContext - PHS Driver Specific Context * IN void* pvContext - PHS Driver Specific Context
IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rules need to be deleted * IN B_UINT16 uiVcid - The Service Flow ID for which the PHS rules need to be deleted
*
Return Value: * Return Value:
*
0 if successful, * 0 if successful,
>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;
...@@ -533,7 +534,7 @@ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 uiVcid) ...@@ -533,7 +534,7 @@ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 uiVcid)
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) { 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) {
...@@ -575,27 +576,26 @@ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 uiVcid) ...@@ -575,27 +576,26 @@ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 uiVcid)
return lStatus; return lStatus;
} }
/*++ /*
PhsCompress * PhsCompress
*
Routine Description: * Routine Description:
Exported function to compress the data using PHS. * Exported function to compress the data using PHS.
*
Arguments: * Arguments:
IN void* pvContext - PHS Driver Specific Context. * IN void* pvContext - PHS Driver Specific Context.
IN B_UINT16 uiVcid - The Service Flow ID to which current packet header compression applies. * IN B_UINT16 uiVcid - The Service Flow ID to which current packet header compression applies.
IN UINT uiClsId - The Classifier ID to which current packet header compression applies. * IN UINT uiClsId - The Classifier ID to which current packet header compression applies.
IN void *pvInputBuffer - The Input buffer containg packet header data * IN void *pvInputBuffer - The Input buffer containg packet header data
IN void *pvOutputBuffer - The output buffer returned by this function after PHS * IN void *pvOutputBuffer - The output buffer returned by this function after PHS
IN UINT *pOldHeaderSize - The actual size of the header before PHS * IN UINT *pOldHeaderSize - The actual size of the header before PHS
IN UINT *pNewHeaderSize - The new size of the header after applying PHS * IN UINT *pNewHeaderSize - The new size of the header after applying PHS
*
Return Value: * Return Value:
*
0 if successful, * 0 if successful,
>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,
...@@ -620,7 +620,7 @@ ULONG PhsCompress(IN void *pvContext, ...@@ -620,7 +620,7 @@ ULONG PhsCompress(IN void *pvContext,
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) {
...@@ -638,7 +638,7 @@ ULONG PhsCompress(IN void *pvContext, ...@@ -638,7 +638,7 @@ ULONG PhsCompress(IN void *pvContext,
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");
...@@ -646,7 +646,7 @@ ULONG PhsCompress(IN void *pvContext, ...@@ -646,7 +646,7 @@ ULONG PhsCompress(IN void *pvContext,
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);
...@@ -659,25 +659,24 @@ ULONG PhsCompress(IN void *pvContext, ...@@ -659,25 +659,24 @@ ULONG PhsCompress(IN void *pvContext,
return lStatus; return lStatus;
} }
/*++ /*
PhsDeCompress * PhsDeCompress
*
Routine Description: * Routine Description:
Exported function to restore the packet header in Rx path. * Exported function to restore the packet header in Rx path.
*
Arguments: * Arguments:
IN void* pvContext - PHS Driver Specific Context. * IN void* pvContext - PHS Driver Specific Context.
IN B_UINT16 uiVcid - The Service Flow ID to which current packet header restoration applies. * IN B_UINT16 uiVcid - The Service Flow ID to which current packet header restoration applies.
IN void *pvInputBuffer - The Input buffer containg suppressed packet header data * IN void *pvInputBuffer - The Input buffer containg suppressed packet header data
OUT void *pvOutputBuffer - The output buffer returned by this function after restoration * OUT void *pvOutputBuffer - The output buffer returned by this function after restoration
OUT UINT *pHeaderSize - The packet header size after restoration is returned in this parameter. * OUT UINT *pHeaderSize - The packet header size after restoration is returned in this parameter.
*
Return Value: * Return Value:
*
0 if successful, * 0 if successful,
>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,
...@@ -705,7 +704,7 @@ ULONG PhsDeCompress(IN void *pvContext, ...@@ -705,7 +704,7 @@ ULONG PhsDeCompress(IN void *pvContext,
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) {
...@@ -716,7 +715,7 @@ ULONG PhsDeCompress(IN void *pvContext, ...@@ -716,7 +715,7 @@ ULONG PhsDeCompress(IN void *pvContext,
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)
...@@ -732,18 +731,17 @@ ULONG PhsDeCompress(IN void *pvContext, ...@@ -732,18 +731,17 @@ ULONG PhsDeCompress(IN void *pvContext,
return STATUS_PHS_COMPRESSED; return STATUS_PHS_COMPRESSED;
} }
//----------------------------------------------------------------------------- /*
// Procedure: free_phs_serviceflow_rules * Procedure: free_phs_serviceflow_rules
// *
// Description: This routine is responsible for freeing memory allocated for PHS rules. * Description: This routine is responsible for freeing memory allocated for PHS rules.
// *
// Arguments: * Arguments:
// rules - ptr to S_SERVICEFLOW_TABLE structure. * rules - ptr to S_SERVICEFLOW_TABLE structure.
// *
// Returns: * Returns:
// Does not return any value. * Does not return any value.
//----------------------------------------------------------------------------- */
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;
...@@ -794,17 +792,17 @@ static BOOLEAN ValidatePHSRuleComplete(IN struct bcm_phs_rule *psPhsRule) ...@@ -794,17 +792,17 @@ 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;
...@@ -892,7 +890,7 @@ UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid, IN B_UINT16 uiClsId, ...@@ -892,7 +890,7 @@ UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid, IN B_UINT16 uiClsId,
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;
...@@ -907,7 +905,7 @@ UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid, IN B_UINT16 uiClsId, ...@@ -907,7 +905,7 @@ UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid, IN B_UINT16 uiClsId,
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;
psServiceFlowTable->stSFList[iSfIndex].uiVcid = uiVcid; psServiceFlowTable->stSFList[iSfIndex].uiVcid = uiVcid;
} }
...@@ -940,9 +938,9 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, ...@@ -940,9 +938,9 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid,
if (nClassifierIndex == PHS_INVALID_TABLE_INDEX) { 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, psPhsRule,
...@@ -952,53 +950,51 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, ...@@ -952,53 +950,51 @@ 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;
/* /*
This rule already exists if any fields are changed for this PHS * This rule already exists if any fields are changed for this PHS
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 = psPhsRule->u8PHSFLength; pstClassifierEntry->pstPhsRule->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;
} }
//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);
} }
...@@ -1024,8 +1020,10 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1024,8 +1020,10 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId,
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 /*
old rules table replace it. */ * If An Old Entry for this classifier ID already exists in the
* old rules table replace it.
*/
iClassifierIndex = iClassifierIndex =
GetClassifierEntry(psaClassifiertable, uiClsId, GetClassifierEntry(psaClassifiertable, uiClsId,
...@@ -1033,17 +1031,15 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1033,17 +1031,15 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId,
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
Lets replace the old classifier with the new one. * Lets replace the old classifier with the new one.
*/ */
bFreeEntryFound = TRUE; bFreeEntryFound = TRUE;
} }
} }
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)
...@@ -1063,7 +1059,7 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1063,7 +1059,7 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId,
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 >= MAX_PHSRULE_PER_SF) if (psaClassifiertable->uiOldestPhsRuleIndex >= MAX_PHSRULE_PER_SF)
psaClassifiertable->uiOldestPhsRuleIndex = 0; psaClassifiertable->uiOldestPhsRuleIndex = 0;
...@@ -1111,11 +1107,11 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1111,11 +1107,11 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId,
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) {
...@@ -1127,7 +1123,7 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1127,7 +1123,7 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId,
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);
...@@ -1136,7 +1132,7 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1136,7 +1132,7 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId,
} }
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);
...@@ -1163,9 +1159,11 @@ static BOOLEAN DerefPhsRule(IN B_UINT16 uiClsId, struct bcm_phs_classifier_tabl ...@@ -1163,9 +1159,11 @@ static BOOLEAN DerefPhsRule(IN B_UINT16 uiClsId, struct bcm_phs_classifier_tabl
pstPhsRule->u8RefCnt--; pstPhsRule->u8RefCnt--;
if (0 == pstPhsRule->u8RefCnt) { if (0 == pstPhsRule->u8RefCnt) {
/*if(pstPhsRule->u8PHSI) /*
//Store the currently active rule into the old rules list * if(pstPhsRule->u8PHSI)
CreateClassifierPHSRule(uiClsId,psaClassifiertable,pstPhsRule,eOldClassifierRuleContext,pstPhsRule->u8PHSI);*/ * Store the currently active rule into the old rules list
* CreateClassifierPHSRule(uiClsId,psaClassifiertable,pstPhsRule,eOldClassifierRuleContext,pstPhsRule->u8PHSI);
*/
return TRUE; return TRUE;
} else } else
return FALSE; return FALSE;
...@@ -1225,23 +1223,22 @@ void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension) ...@@ -1225,23 +1223,22 @@ void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension)
} }
} }
//----------------------------------------------------------------------------- /*
// Procedure: phs_decompress * Procedure: phs_decompress
// *
// Description: This routine restores the static fields within the packet. * Description: This routine restores the static fields within the packet.
// *
// Arguments: * Arguments:
// in_buf - ptr to incoming packet buffer. * in_buf - ptr to incoming packet buffer.
// out_buf - ptr to output buffer where the suppressed header is copied. * out_buf - ptr to output buffer where the suppressed header is copied.
// decomp_phs_rules - ptr to PHS rule. * decomp_phs_rules - ptr to PHS rule.
// header_size - ptr to field which holds the phss or phsf_length. * header_size - ptr to field which holds the phss or phsf_length.
// *
// Returns: * Returns:
// size -The number of bytes of dynamic fields present with in the incoming packet * size -The number of bytes of dynamic fields present with in the incoming packet
// header. * header.
// 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, int phs_decompress(unsigned char *in_buf,
unsigned char *out_buf, unsigned char *out_buf,
struct bcm_phs_rule *decomp_phs_rules, struct bcm_phs_rule *decomp_phs_rules,
...@@ -1263,8 +1260,10 @@ int phs_decompress(unsigned char *in_buf, ...@@ -1263,8 +1260,10 @@ int phs_decompress(unsigned char *in_buf,
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)); /*
//*header_size = tmp_memb->u8PHSFLength; * 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;
*/
phss = tmp_memb->u8PHSS; phss = tmp_memb->u8PHSS;
phsf = tmp_memb->u8PHSF; phsf = tmp_memb->u8PHSF;
phsm = tmp_memb->u8PHSM; phsm = tmp_memb->u8PHSM;
...@@ -1272,7 +1271,10 @@ int phs_decompress(unsigned char *in_buf, ...@@ -1272,7 +1271,10 @@ int phs_decompress(unsigned char *in_buf,
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);
...@@ -1302,26 +1304,26 @@ int phs_decompress(unsigned char *in_buf, ...@@ -1302,26 +1304,26 @@ int phs_decompress(unsigned char *in_buf,
return size; return size;
} }
//----------------------------------------------------------------------------- /*
// Procedure: phs_compress * Procedure: phs_compress
// *
// Description: This routine suppresses the static fields within the packet.Before * Description: This routine suppresses the static fields within the packet.Before
// that it will verify the fields to be suppressed with the corresponding fields in the * that it will verify the fields to be suppressed with the corresponding fields in the
// phsf. For verification it checks the phsv field of PHS rule. If set and verification * phsf. For verification it checks the phsv field of PHS rule. If set and verification
// succeeds it suppresses the field.If any one static field is found different none of * succeeds it suppresses the field.If any one static field is found different none of
// the static fields are suppressed then the packet is sent as uncompressed packet with * the static fields are suppressed then the packet is sent as uncompressed packet with
// phsi=0. * phsi=0.
// *
// Arguments: * Arguments:
// phs_rule - ptr to PHS rule. * phs_rule - ptr to PHS rule.
// in_buf - ptr to incoming packet buffer. * in_buf - ptr to incoming packet buffer.
// out_buf - ptr to output buffer where the suppressed header is copied. * out_buf - ptr to output buffer where the suppressed header is copied.
// header_size - ptr to field which holds the phss. * header_size - ptr to field which holds the phss.
// *
// Returns: * Returns:
// 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, static int phs_compress(struct bcm_phs_rule *phs_rule,
unsigned char *in_buf, unsigned char *in_buf,
unsigned char *out_buf, unsigned char *out_buf,
...@@ -1343,7 +1345,7 @@ static int phs_compress(struct bcm_phs_rule *phs_rule, ...@@ -1343,7 +1345,7 @@ static int phs_compress(struct bcm_phs_rule *phs_rule,
else else
*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->u8PHSM, phs_rule->u8PHSS,
...@@ -1360,26 +1362,25 @@ static int phs_compress(struct bcm_phs_rule *phs_rule, ...@@ -1360,26 +1362,25 @@ static int phs_compress(struct bcm_phs_rule *phs_rule,
return suppress; return suppress;
} }
//----------------------------------------------------------------------------- /*
// Procedure: verify_suppress_phsf * Procedure: verify_suppress_phsf
// *
// Description: This routine verifies the fields of the packet and if all the * Description: This routine verifies the fields of the packet and if all the
// static fields are equal it adds the phsi of that PHS rule.If any static * static fields are equal it adds the phsi of that PHS rule.If any static
// field differs it woun't suppress any field. * field differs it woun't suppress any field.
// *
// Arguments: * Arguments:
// rules_set - ptr to classifier_rules. * rules_set - ptr to classifier_rules.
// in_buffer - ptr to incoming packet buffer. * in_buffer - ptr to incoming packet buffer.
// out_buffer - ptr to output buffer where the suppressed header is copied. * out_buffer - ptr to output buffer where the suppressed header is copied.
// phsf - ptr to phsf. * phsf - ptr to phsf.
// phsm - ptr to phsm. * phsm - ptr to phsm.
// phss - variable holding phss. * phss - variable holding phss.
// *
// Returns: * Returns:
// 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 -Packet has failed the verification. * 0 -Packet has failed the verification.
//----------------------------------------------------------------------------- */
static int verify_suppress_phsf(unsigned char *in_buffer, static int verify_suppress_phsf(unsigned char *in_buffer,
unsigned char *out_buffer, unsigned char *out_buffer,
unsigned char *phsf, unsigned char *phsf,
......
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