diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2014-07-29 12:48:34 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-31 00:13:24 (GMT) |
commit | 506da6a6f138e9702efc8a9075610768b067524c (patch) | |
tree | cfccb5c7cf8771697db3f7fdc801dab98d3974a2 /drivers | |
parent | dca9fe7b2cbbf14a259c7b24e23a0fb88bfde59b (diff) | |
download | linux-506da6a6f138e9702efc8a9075610768b067524c.tar.xz |
Staging: bcm: IPv6Protocol.c: Line length fixes
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/bcm/IPv6Protocol.c | 93 |
1 files changed, 60 insertions, 33 deletions
diff --git a/drivers/staging/bcm/IPv6Protocol.c b/drivers/staging/bcm/IPv6Protocol.c index 01ad11f..27f3f41 100644 --- a/drivers/staging/bcm/IPv6Protocol.c +++ b/drivers/staging/bcm/IPv6Protocol.c @@ -151,7 +151,9 @@ static UCHAR GetIpv6ProtocolPorts(UCHAR *pucPayload, USHORT *pusSrcPort, ucHeaderType = ucNextHeader; while (!bDone) { pucNextHeader = GetNextIPV6ChainedHeader(&pIpv6HdrScanContext, - &ucHeaderType, &bDone, &usPayloadLength); + &ucHeaderType, + &bDone, + &usPayloadLength); if (bDone) { if ((ucHeaderType == TCP_HEADER_TYPE) || (ucHeaderType == UDP_HEADER_TYPE)) { @@ -172,11 +174,12 @@ static UCHAR GetIpv6ProtocolPorts(UCHAR *pucPayload, USHORT *pusSrcPort, /* - * Arg 1 struct bcm_mini_adapter *Adapter is a pointer ot the driver contorl structure + * Arg 1 struct bcm_mini_adapter *Adapter is a pointer ot the driver control + * structure * Arg 2 PVOID pcIpHeader is a pointer to the IP header of the packet */ USHORT IpVersion6(struct bcm_mini_adapter *Adapter, PVOID pcIpHeader, - struct bcm_classifier_rule *pstClassifierRule) + struct bcm_classifier_rule *pstClassifierRule) { USHORT ushDestPort = 0; USHORT ushSrcPort = 0; @@ -195,11 +198,12 @@ USHORT IpVersion6(struct bcm_mini_adapter *Adapter, PVOID pcIpHeader, * Try to get the next higher layer protocol * and the Ports Nos if TCP or UDP */ - ucNextProtocolAboveIP = GetIpv6ProtocolPorts((UCHAR *)(pcIpHeader + sizeof(struct bcm_ipv6_hdr)), - &ushSrcPort, - &ushDestPort, - pstIpv6Header->usPayloadLength, - pstIpv6Header->ucNextHeader); + ucNextProtocolAboveIP = GetIpv6ProtocolPorts((UCHAR *)(pcIpHeader + + sizeof(struct bcm_ipv6_hdr)), + &ushSrcPort, + &ushDestPort, + pstIpv6Header->usPayloadLength, + pstIpv6Header->ucNextHeader); do { if (pstClassifierRule->ucDirection == 0) { @@ -219,12 +223,12 @@ USHORT IpVersion6(struct bcm_mini_adapter *Adapter, PVOID pcIpHeader, } bClassificationSucceed = MatchSrcIpv6Address(pstClassifierRule, - pstIpv6Header); + pstIpv6Header); if (!bClassificationSucceed) break; bClassificationSucceed = MatchDestIpv6Address(pstClassifierRule, - pstIpv6Header); + pstIpv6Header); if (!bClassificationSucceed) break; @@ -234,7 +238,7 @@ USHORT IpVersion6(struct bcm_mini_adapter *Adapter, PVOID pcIpHeader, * Chain of IPv6 prot headers */ bClassificationSucceed = MatchProtocol(pstClassifierRule, - ucNextProtocolAboveIP); + ucNextProtocolAboveIP); if (!bClassificationSucceed) break; @@ -248,7 +252,7 @@ USHORT IpVersion6(struct bcm_mini_adapter *Adapter, PVOID pcIpHeader, DBG_LVL_ALL, "\nIPv6 Source Port:%x\n", ntohs(ushSrcPort)); bClassificationSucceed = MatchSrcPort(pstClassifierRule, - ntohs(ushSrcPort)); + ntohs(ushSrcPort)); if (!bClassificationSucceed) break; @@ -257,21 +261,24 @@ USHORT IpVersion6(struct bcm_mini_adapter *Adapter, PVOID pcIpHeader, /* Match Dest Port */ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, - DBG_LVL_ALL, "\nIPv6 Destination Port:%x\n", + DBG_LVL_ALL, + "\nIPv6 Destination Port:%x\n", ntohs(ushDestPort)); bClassificationSucceed = MatchDestPort(pstClassifierRule, - ntohs(ushDestPort)); + ntohs(ushDestPort)); if (!bClassificationSucceed) break; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, - DBG_LVL_ALL, "\nIPv6 Dest Port Matched"); + DBG_LVL_ALL, + "\nIPv6 Dest Port Matched"); } } while (0); if (bClassificationSucceed == TRUE) { INT iMatchedSFQueueIndex = 0; - iMatchedSFQueueIndex = SearchSfid(Adapter, pstClassifierRule->ulSFID); + iMatchedSFQueueIndex = SearchSfid(Adapter, + pstClassifierRule->ulSFID); if ((iMatchedSFQueueIndex >= NO_OF_QUEUES) || (Adapter->PackInfo[iMatchedSFQueueIndex].bActive == false)) bClassificationSucceed = false; @@ -295,7 +302,8 @@ static bool MatchSrcIpv6Address(struct bcm_classifier_rule *pstClassifierRule, * This is the no. of Src Addresses ie Range of IP Addresses contained * in the classifier rule for which we need to match */ - UINT uiCountIPSrcAddresses = (UINT)pstClassifierRule->ucIPSourceAddressLength; + UINT uiCountIPSrcAddresses = + (UINT)pstClassifierRule->ucIPSourceAddressLength; if (uiCountIPSrcAddresses == 0) @@ -303,10 +311,15 @@ static bool MatchSrcIpv6Address(struct bcm_classifier_rule *pstClassifierRule, /* First Convert the Ip Address in the packet to Host Endian order */ - for (uiIpv6AddIndex = 0; uiIpv6AddIndex < uiIpv6AddrNoLongWords; uiIpv6AddIndex++) - aulSrcIP[uiIpv6AddIndex] = ntohl(pstIpv6Header->ulSrcIpAddress[uiIpv6AddIndex]); - - for (uiLoopIndex = 0; uiLoopIndex < uiCountIPSrcAddresses; uiLoopIndex += uiIpv6AddrNoLongWords) { + for (uiIpv6AddIndex = 0; + uiIpv6AddIndex < uiIpv6AddrNoLongWords; + uiIpv6AddIndex++) + aulSrcIP[uiIpv6AddIndex] = + ntohl(pstIpv6Header->ulSrcIpAddress[uiIpv6AddIndex]); + + for (uiLoopIndex = 0; + uiLoopIndex < uiCountIPSrcAddresses; + uiLoopIndex += uiIpv6AddrNoLongWords) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\n Src Ipv6 Address In Received Packet :\n "); DumpIpv6Address(aulSrcIP); @@ -317,9 +330,12 @@ static bool MatchSrcIpv6Address(struct bcm_classifier_rule *pstClassifierRule, "\n Src Ipv6 Address In Classifier Rule :\n"); DumpIpv6Address(&src_addr->ulIpv6Addr[uiLoopIndex]); - for (uiIpv6AddIndex = 0; uiIpv6AddIndex < uiIpv6AddrNoLongWords; uiIpv6AddIndex++) { - if ((src_addr->ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & aulSrcIP[uiIpv6AddIndex]) - != src_addr->ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) { + for (uiIpv6AddIndex = 0; + uiIpv6AddIndex < uiIpv6AddrNoLongWords; + uiIpv6AddIndex++) { + if ((src_addr->ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & + aulSrcIP[uiIpv6AddIndex]) != + src_addr->ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) { /* * Match failed for current Ipv6 Address * Try next Ipv6 Address @@ -354,17 +370,23 @@ static bool MatchDestIpv6Address(struct bcm_classifier_rule *pstClassifierRule, * ie Range of IP Addresses contained in the classifier rule * for which we need to match */ - UINT uiCountIPDestinationAddresses = (UINT)pstClassifierRule->ucIPDestinationAddressLength; + UINT uiCountIPDestinationAddresses = + (UINT)pstClassifierRule->ucIPDestinationAddressLength; if (uiCountIPDestinationAddresses == 0) return TRUE; /* First Convert the Ip Address in the packet to Host Endian order */ - for (uiIpv6AddIndex = 0; uiIpv6AddIndex < uiIpv6AddrNoLongWords; uiIpv6AddIndex++) - aulDestIP[uiIpv6AddIndex] = ntohl(pstIpv6Header->ulDestIpAddress[uiIpv6AddIndex]); - - for (uiLoopIndex = 0; uiLoopIndex < uiCountIPDestinationAddresses; uiLoopIndex += uiIpv6AddrNoLongWords) { + for (uiIpv6AddIndex = 0; + uiIpv6AddIndex < uiIpv6AddrNoLongWords; + uiIpv6AddIndex++) + aulDestIP[uiIpv6AddIndex] = + ntohl(pstIpv6Header->ulDestIpAddress[uiIpv6AddIndex]); + + for (uiLoopIndex = 0; + uiLoopIndex < uiCountIPDestinationAddresses; + uiLoopIndex += uiIpv6AddrNoLongWords) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\n Destination Ipv6 Address In Received Packet :\n "); DumpIpv6Address(aulDestIP); @@ -375,9 +397,12 @@ static bool MatchDestIpv6Address(struct bcm_classifier_rule *pstClassifierRule, "\n Destination Ipv6 Address In Classifier Rule :\n"); DumpIpv6Address(&dest_addr->ulIpv6Addr[uiLoopIndex]); - for (uiIpv6AddIndex = 0; uiIpv6AddIndex < uiIpv6AddrNoLongWords; uiIpv6AddIndex++) { - if ((dest_addr->ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & aulDestIP[uiIpv6AddIndex]) - != dest_addr->ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) { + for (uiIpv6AddIndex = 0; + uiIpv6AddIndex < uiIpv6AddrNoLongWords; + uiIpv6AddIndex++) { + if ((dest_addr->ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & + aulDestIP[uiIpv6AddIndex]) != + dest_addr->ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) { /* * Match failed for current Ipv6 Address. * Try next Ipv6 Address @@ -404,7 +429,9 @@ VOID DumpIpv6Address(ULONG *puIpv6Address) UINT uiIpv6AddIndex = 0; struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - for (uiIpv6AddIndex = 0; uiIpv6AddIndex < uiIpv6AddrNoLongWords; uiIpv6AddIndex++) { + for (uiIpv6AddIndex = 0; + uiIpv6AddIndex < uiIpv6AddrNoLongWords; + uiIpv6AddIndex++) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, ":%lx", puIpv6Address[uiIpv6AddIndex]); } |