Commit e86bd61e authored by Matthias Beyer's avatar Matthias Beyer Committed by Greg Kroah-Hartman

Staging: bcm: PHSModule.c: Shortened lines

This patch shortenes all lines where possible without code refactoring,
as well as comment lines. It does not change the wording of comments.
Signed-off-by: default avatarMatthias Beyer <mail@beyermatthias.de>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3be738ad
...@@ -110,9 +110,11 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -110,9 +110,11 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
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 = Adapter->stPhsTxContextInfo.ucaHdrSuppressionInBuf; PUCHAR pucPHSPktHdrInBuf =
Adapter->stPhsTxContextInfo.ucaHdrSuppressionInBuf;
/* Pointer to PHS OUT Hdr Buffer */ /* Pointer to PHS OUT Hdr Buffer */
PUCHAR pucPHSPktHdrOutBuf = Adapter->stPhsTxContextInfo.ucaHdrSuppressionOutBuf; PUCHAR pucPHSPktHdrOutBuf =
Adapter->stPhsTxContextInfo.ucaHdrSuppressionOutBuf;
UINT usPacketType; UINT usPacketType;
UINT BytesToRemove = 0; UINT BytesToRemove = 0;
bool bPHSI = 0; bool bPHSI = 0;
...@@ -144,8 +146,10 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -144,8 +146,10 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
(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
* Suppress only if IP Header and PHS Enabled For the Service Flow * 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)) &&
...@@ -183,7 +187,8 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -183,7 +187,8 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
"PHS Sending packet Compressed"); "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;
...@@ -240,7 +245,8 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter, ...@@ -240,7 +245,8 @@ 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;
} }
...@@ -321,11 +327,12 @@ void DumpFullPacket(UCHAR *pBuf, UINT nPktLen) ...@@ -321,11 +327,12 @@ void DumpFullPacket(UCHAR *pBuf, UINT 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
* PHS rules. * and 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 successful. * TRUE(1) -If allocation of memory was successful.
...@@ -438,7 +445,8 @@ ULONG PhsUpdateClassifierRule(IN void *pvContext, ...@@ -438,7 +445,8 @@ ULONG PhsUpdateClassifierRule(IN void *pvContext,
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; struct bcm_phs_extension *pDeviceExtension =
(struct bcm_phs_extension *)pvContext;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,
"PHS With Corr2 Changes\n"); "PHS With Corr2 Changes\n");
...@@ -555,7 +563,9 @@ ULONG PhsDeletePHSRule(IN void *pvContext, ...@@ -555,7 +563,9 @@ ULONG PhsDeletePHSRule(IN void *pvContext,
* 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)
{ {
UINT nSFIndex = 0, nClsidIndex = 0; UINT nSFIndex = 0, nClsidIndex = 0;
struct bcm_phs_entry *pstServiceFlowEntry = NULL; struct bcm_phs_entry *pstServiceFlowEntry = NULL;
...@@ -702,13 +712,18 @@ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 uiVcid) ...@@ -702,13 +712,18 @@ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 uiVcid)
* 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
* IN UINT uiClsId - The Classifier ID to which current packet header compression applies. * packet header compression applies.
* IN void *pvInputBuffer - The Input buffer containg packet header data * IN UINT uiClsId - The Classifier ID to which current packet
* IN void *pvOutputBuffer - The output buffer returned by this function after PHS * header compression applies.
* IN UINT *pOldHeaderSize - The actual size of the header before PHS * IN void *pvInputBuffer - The Input buffer containg packet header
* IN UINT *pNewHeaderSize - The new size of the header after applying PHS * data
* 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 *pNewHeaderSize - The new size of the header after applying
* PHS
* *
* Return Value: * Return Value:
* *
...@@ -797,11 +812,15 @@ static ULONG PhsCompress(IN void *pvContext, ...@@ -797,11 +812,15 @@ static ULONG PhsCompress(IN void *pvContext,
* 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
* IN void *pvInputBuffer - The Input buffer containg suppressed packet header data * packet header restoration applies.
* OUT void *pvOutputBuffer - The output buffer returned by this function after restoration * IN void *pvInputBuffer - The Input buffer containg suppressed
* OUT UINT *pHeaderSize - The packet header size after restoration is returned in this parameter. * packet header data
* 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.
* *
* Return Value: * Return Value:
* *
...@@ -854,7 +873,8 @@ static ULONG PhsDeCompress(IN void *pvContext, ...@@ -854,7 +873,8 @@ static ULONG PhsDeCompress(IN void *pvContext,
eActiveClassifierRuleContext, eActiveClassifierRuleContext,
&pstPhsRule); &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, phsi,
eOldClassifierRuleContext, eOldClassifierRuleContext,
...@@ -877,7 +897,8 @@ static ULONG PhsDeCompress(IN void *pvContext, ...@@ -877,7 +897,8 @@ static ULONG PhsDeCompress(IN void *pvContext,
/* /*
* 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.
...@@ -1093,7 +1114,8 @@ static UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, ...@@ -1093,7 +1114,8 @@ static 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
*/ */
...@@ -1114,8 +1136,8 @@ static UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, ...@@ -1114,8 +1136,8 @@ static UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid,
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
* rule update them. * PHS 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) {
...@@ -1223,7 +1245,8 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1223,7 +1245,8 @@ 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;
...@@ -1284,7 +1307,8 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1284,7 +1307,8 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId,
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, eActiveClassifierRuleContext,
&pstAddPhsRule); &pstAddPhsRule);
...@@ -1300,7 +1324,8 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1300,7 +1324,8 @@ 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 = pstClassifierEntry->pstPhsRule =
...@@ -1312,7 +1337,8 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, ...@@ -1312,7 +1337,8 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId,
memcpy(pstClassifierEntry->pstPhsRule, psPhsRule, memcpy(pstClassifierEntry->pstPhsRule, psPhsRule,
sizeof(struct bcm_phs_rule)); 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, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH,
DBG_LVL_ALL, DBG_LVL_ALL,
"\nTying Classifier to Existing PHS Rule"); "\nTying Classifier to Existing PHS Rule");
...@@ -1436,14 +1462,17 @@ void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension) ...@@ -1436,14 +1462,17 @@ void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension)
* *
* 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
* decomp_phs_rules - ptr to PHS rule. * header is copied.
* header_size - ptr to field which holds the phss or phsf_length. * decomp_phs_rules - ptr to PHS rule.
* 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
* header. * incoming packet 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.
*/ */
static int phs_decompress(unsigned char *in_buf, static int phs_decompress(unsigned char *in_buf,
unsigned char *out_buf, unsigned char *out_buf,
...@@ -1468,7 +1497,8 @@ static int phs_decompress(unsigned char *in_buf, ...@@ -1468,7 +1497,8 @@ static int phs_decompress(unsigned char *in_buf,
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;
*/ */
phss = tmp_memb->u8PHSS; phss = tmp_memb->u8PHSS;
...@@ -1479,7 +1509,8 @@ static int phs_decompress(unsigned char *in_buf, ...@@ -1479,7 +1509,8 @@ static int phs_decompress(unsigned char *in_buf,
phss = MAX_PHS_LENGTHS; phss = MAX_PHS_LENGTHS;
/* /*
* BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP: * 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)); * 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)) {
...@@ -1518,22 +1549,25 @@ static int phs_decompress(unsigned char *in_buf, ...@@ -1518,22 +1549,25 @@ static int phs_decompress(unsigned char *in_buf,
/* /*
* 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.
* that it will verify the fields to be suppressed with the corresponding fields in the * Before that it will verify the fields to be suppressed with the corresponding
* phsf. For verification it checks the phsv field of PHS rule. If set and verification * fields in the phsf. For verification it checks the phsv field of PHS rule.
* succeeds it suppresses the field.If any one static field is found different none of * If set and verification succeeds it suppresses the field.If any one static
* the static fields are suppressed then the packet is sent as uncompressed packet with * field is found different none of the static fields are suppressed then the
* phsi=0. * packet is sent as uncompressed packet with 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
* 0 -If PHS rule is NULL.If PHSV field is not set.If the verification fails. * dynamic fields
* 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,
...@@ -1588,13 +1622,14 @@ static int phs_compress(struct bcm_phs_rule *phs_rule, ...@@ -1588,13 +1622,14 @@ static int phs_compress(struct bcm_phs_rule *phs_rule,
* 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
* 0 -Packet has failed the verification. * fields.
* 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,
......
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