Staging: bcm: Replaced member accessing with variable
authorMatthias Beyer <mail@beyermatthias.de>
Fri, 23 May 2014 20:23:58 +0000 (22:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 May 2014 22:26:38 +0000 (07:26 +0900)
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/bcm/CmHost.c

index 918661937f1e1036aa2c1acdb74b619861ac8227..20e41742d4fe9fadfec2d4e76124302f39ca00b6 100644 (file)
@@ -249,12 +249,15 @@ static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stru
        /* UCHAR ucProtocolLength=0; */
        /* ULONG ulPhsStatus; */
 
+       struct bcm_packet_class_rules *pack_class_rule =
+               &psfCSType->cCPacketClassificationRule;
+
        if (Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value == 0 ||
                nClassifierIndex > (MAX_CLASSIFIERS-1))
                return;
 
        BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Storing Classifier Rule Index : %X",
-                       ntohs(psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex));
+                       ntohs(pack_class_rule->u16PacketClassificationRuleIndex));
 
        if (nClassifierIndex > MAX_CLASSIFIERS-1)
                return;
@@ -265,14 +268,14 @@ static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stru
                pstClassifierEntry->bIpv6Protocol = (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6) ? TRUE : false;
 
                /* Destinaiton Port */
-               pstClassifierEntry->ucDestPortRangeLength = psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength / 4;
+               pstClassifierEntry->ucDestPortRangeLength = pack_class_rule->u8ProtocolDestPortRangeLength / 4;
                BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Destination Port Range Length:0x%X ", pstClassifierEntry->ucDestPortRangeLength);
 
-               if (psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength <= MAX_PORT_RANGE) {
+               if (pack_class_rule->u8ProtocolDestPortRangeLength <= MAX_PORT_RANGE) {
                        for (i = 0; i < (pstClassifierEntry->ucDestPortRangeLength); i++) {
-                               pstClassifierEntry->usDestPortRangeLo[i] = *((PUSHORT)(psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange+i));
+                               pstClassifierEntry->usDestPortRangeLo[i] = *((PUSHORT)(pack_class_rule->u8ProtocolDestPortRange+i));
                                pstClassifierEntry->usDestPortRangeHi[i] =
-                                       *((PUSHORT)(psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange+2+i));
+                                       *((PUSHORT)(pack_class_rule->u8ProtocolDestPortRange+2+i));
                                pstClassifierEntry->usDestPortRangeLo[i] = ntohs(pstClassifierEntry->usDestPortRangeLo[i]);
                                BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Destination Port Range Lo:0x%X ",
                                                pstClassifierEntry->usDestPortRangeLo[i]);
@@ -284,15 +287,15 @@ static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stru
 
                /* Source Port */
                BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Source Port Range Length:0x%X ",
-                               psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength);
-               if (psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength <= MAX_PORT_RANGE) {
-                       pstClassifierEntry->ucSrcPortRangeLength = psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength/4;
+                               pack_class_rule->u8ProtocolSourcePortRangeLength);
+               if (pack_class_rule->u8ProtocolSourcePortRangeLength <= MAX_PORT_RANGE) {
+                       pstClassifierEntry->ucSrcPortRangeLength = pack_class_rule->u8ProtocolSourcePortRangeLength/4;
                        for (i = 0; i < (pstClassifierEntry->ucSrcPortRangeLength); i++) {
                                pstClassifierEntry->usSrcPortRangeLo[i] =
-                                       *((PUSHORT)(psfCSType->cCPacketClassificationRule.
+                                       *((PUSHORT)(pack_class_rule->
                                                        u8ProtocolSourcePortRange+i));
                                pstClassifierEntry->usSrcPortRangeHi[i] =
-                                       *((PUSHORT)(psfCSType->cCPacketClassificationRule.
+                                       *((PUSHORT)(pack_class_rule->
                                                        u8ProtocolSourcePortRange+2+i));
                                pstClassifierEntry->usSrcPortRangeLo[i] =
                                        ntohs(pstClassifierEntry->usSrcPortRangeLo[i]);
@@ -304,8 +307,8 @@ static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stru
                /* Destination Ip Address and Mask */
                BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Ip Destination Parameters : ");
                CopyIpAddrToClassifier(pstClassifierEntry,
-                               psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength,
-                               psfCSType->cCPacketClassificationRule.u8IPDestinationAddress,
+                               pack_class_rule->u8IPDestinationAddressLength,
+                               pack_class_rule->u8IPDestinationAddress,
                                (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6) ?
                        TRUE : false, eDestIpAddress);
 
@@ -313,33 +316,33 @@ static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stru
                BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Ip Source Parameters : ");
 
                CopyIpAddrToClassifier(pstClassifierEntry,
-                               psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength,
-                               psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress,
+                               pack_class_rule->u8IPMaskedSourceAddressLength,
+                               pack_class_rule->u8IPMaskedSourceAddress,
                                (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6) ? TRUE : false,
                                eSrcIpAddress);
 
                /* TOS */
-               BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "TOS Length:0x%X ", psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength);
-               if (psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength == 3) {
-                       pstClassifierEntry->ucIPTypeOfServiceLength = psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength;
-                       pstClassifierEntry->ucTosLow = psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0];
-                       pstClassifierEntry->ucTosHigh = psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1];
-                       pstClassifierEntry->ucTosMask = psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2];
+               BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "TOS Length:0x%X ", pack_class_rule->u8IPTypeOfServiceLength);
+               if (pack_class_rule->u8IPTypeOfServiceLength == 3) {
+                       pstClassifierEntry->ucIPTypeOfServiceLength = pack_class_rule->u8IPTypeOfServiceLength;
+                       pstClassifierEntry->ucTosLow = pack_class_rule->u8IPTypeOfService[0];
+                       pstClassifierEntry->ucTosHigh = pack_class_rule->u8IPTypeOfService[1];
+                       pstClassifierEntry->ucTosMask = pack_class_rule->u8IPTypeOfService[2];
                        pstClassifierEntry->bTOSValid = TRUE;
                }
-               if (psfCSType->cCPacketClassificationRule.u8Protocol == 0) {
+               if (pack_class_rule->u8Protocol == 0) {
                        /* we didn't get protocol field filled in by the BS */
                        pstClassifierEntry->ucProtocolLength = 0;
                } else {
                        pstClassifierEntry->ucProtocolLength = 1; /* 1 valid protocol */
                }
 
-               pstClassifierEntry->ucProtocol[0] = psfCSType->cCPacketClassificationRule.u8Protocol;
-               pstClassifierEntry->u8ClassifierRulePriority = psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority;
+               pstClassifierEntry->ucProtocol[0] = pack_class_rule->u8Protocol;
+               pstClassifierEntry->u8ClassifierRulePriority = pack_class_rule->u8ClassifierRulePriority;
 
                /* store the classifier rule ID and set this classifier entry as valid */
                pstClassifierEntry->ucDirection = Adapter->PackInfo[uiSearchRuleIndex].ucDirection;
-               pstClassifierEntry->uiClassifierRuleIndex = ntohs(psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex);
+               pstClassifierEntry->uiClassifierRuleIndex = ntohs(pack_class_rule->u16PacketClassificationRuleIndex);
                pstClassifierEntry->usVCID_Value = Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value;
                pstClassifierEntry->ulSFID = Adapter->PackInfo[uiSearchRuleIndex].ulSFID;
                BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Search Index %d Dir: %d, Index: %d, Vcid: %d\n",
@@ -347,21 +350,21 @@ static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stru
                                pstClassifierEntry->uiClassifierRuleIndex,
                                pstClassifierEntry->usVCID_Value);
 
-               if (psfCSType->cCPacketClassificationRule.u8AssociatedPHSI)
-                       pstClassifierEntry->u8AssociatedPHSI = psfCSType->cCPacketClassificationRule.u8AssociatedPHSI;
+               if (pack_class_rule->u8AssociatedPHSI)
+                       pstClassifierEntry->u8AssociatedPHSI = pack_class_rule->u8AssociatedPHSI;
 
                /* Copy ETH CS Parameters */
-               pstClassifierEntry->ucEthCSSrcMACLen = (psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddressLength);
-               memcpy(pstClassifierEntry->au8EThCSSrcMAC, psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress, MAC_ADDRESS_SIZE);
-               memcpy(pstClassifierEntry->au8EThCSSrcMACMask, psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress + MAC_ADDRESS_SIZE, MAC_ADDRESS_SIZE);
-               pstClassifierEntry->ucEthCSDestMACLen = (psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
-               memcpy(pstClassifierEntry->au8EThCSDestMAC, psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress, MAC_ADDRESS_SIZE);
-               memcpy(pstClassifierEntry->au8EThCSDestMACMask, psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress + MAC_ADDRESS_SIZE, MAC_ADDRESS_SIZE);
-               pstClassifierEntry->ucEtherTypeLen = (psfCSType->cCPacketClassificationRule.u8EthertypeLength);
-               memcpy(pstClassifierEntry->au8EthCSEtherType, psfCSType->cCPacketClassificationRule.u8Ethertype, NUM_ETHERTYPE_BYTES);
-               memcpy(pstClassifierEntry->usUserPriority, &psfCSType->cCPacketClassificationRule.u16UserPriority, 2);
-               pstClassifierEntry->usVLANID = ntohs(psfCSType->cCPacketClassificationRule.u16VLANID);
-               pstClassifierEntry->usValidityBitMap = ntohs(psfCSType->cCPacketClassificationRule.u16ValidityBitMap);
+               pstClassifierEntry->ucEthCSSrcMACLen = (pack_class_rule->u8EthernetSourceMACAddressLength);
+               memcpy(pstClassifierEntry->au8EThCSSrcMAC, pack_class_rule->u8EthernetSourceMACAddress, MAC_ADDRESS_SIZE);
+               memcpy(pstClassifierEntry->au8EThCSSrcMACMask, pack_class_rule->u8EthernetSourceMACAddress + MAC_ADDRESS_SIZE, MAC_ADDRESS_SIZE);
+               pstClassifierEntry->ucEthCSDestMACLen = (pack_class_rule->u8EthernetDestMacAddressLength);
+               memcpy(pstClassifierEntry->au8EThCSDestMAC, pack_class_rule->u8EthernetDestMacAddress, MAC_ADDRESS_SIZE);
+               memcpy(pstClassifierEntry->au8EThCSDestMACMask, pack_class_rule->u8EthernetDestMacAddress + MAC_ADDRESS_SIZE, MAC_ADDRESS_SIZE);
+               pstClassifierEntry->ucEtherTypeLen = (pack_class_rule->u8EthertypeLength);
+               memcpy(pstClassifierEntry->au8EthCSEtherType, pack_class_rule->u8Ethertype, NUM_ETHERTYPE_BYTES);
+               memcpy(pstClassifierEntry->usUserPriority, &pack_class_rule->u16UserPriority, 2);
+               pstClassifierEntry->usVLANID = ntohs(pack_class_rule->u16VLANID);
+               pstClassifierEntry->usValidityBitMap = ntohs(pack_class_rule->u16ValidityBitMap);
 
                pstClassifierEntry->bUsed = TRUE;
        }