Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 506da6a6 authored by Matthias Beyer's avatar Matthias Beyer Committed by Greg Kroah-Hartman
Browse files

Staging: bcm: IPv6Protocol.c: Line length fixes

parent dca9fe7b
Loading
Loading
Loading
Loading
+60 −33
Original line number Diff line number Diff line
@@ -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,7 +174,8 @@ 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,
@@ -195,7 +198,8 @@ 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)),
	ucNextProtocolAboveIP = GetIpv6ProtocolPorts((UCHAR *)(pcIpHeader +
						     sizeof(struct bcm_ipv6_hdr)),
						     &ushSrcPort,
						     &ushDestPort,
						     pstIpv6Header->usPayloadLength,
@@ -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));
			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]);
	}