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

Staging: bcm: Shortened lines in CopyIpAddrToClassifier()

Signed-off-by: default avatarMatthias Beyer <mail@beyermatthias.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 780eb92c
...@@ -136,7 +136,8 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, ...@@ -136,7 +136,8 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry,
nSizeOfIPAddressInBytes = IPV6_ADDRESS_SIZEINBYTES; nSizeOfIPAddressInBytes = IPV6_ADDRESS_SIZEINBYTES;
/* Destination Ip Address */ /* Destination Ip Address */
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Ip Address Range Length:0x%X ", u8IpAddressLen); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,
"Ip Address Range Length:0x%X ", u8IpAddressLen);
if ((bIpVersion6 ? (IPV6_ADDRESS_SIZEINBYTES * MAX_IP_RANGE_LENGTH * 2) : if ((bIpVersion6 ? (IPV6_ADDRESS_SIZEINBYTES * MAX_IP_RANGE_LENGTH * 2) :
(TOTAL_MASKED_ADDRESS_IN_BYTES)) >= u8IpAddressLen) { (TOTAL_MASKED_ADDRESS_IN_BYTES)) >= u8IpAddressLen) {
...@@ -152,39 +153,61 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, ...@@ -152,39 +153,61 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry,
* (nSizeOfIPAddressInBytes for address and nSizeOfIPAddressInBytes for mask) * (nSizeOfIPAddressInBytes for address and nSizeOfIPAddressInBytes for mask)
*/ */
if (eIpAddrContext == eDestIpAddress) { if (eIpAddrContext == eDestIpAddress) {
pstClassifierEntry->ucIPDestinationAddressLength = u8IpAddressLen/(nSizeOfIPAddressInBytes * 2); pstClassifierEntry->ucIPDestinationAddressLength =
u8IpAddressLen/(nSizeOfIPAddressInBytes * 2);
if (bIpVersion6) { if (bIpVersion6) {
ptrClassifierIpAddress = st_dest_ip->ucIpv6Address; ptrClassifierIpAddress =
ptrClassifierIpMask = st_dest_ip->ucIpv6Mask; st_dest_ip->ucIpv6Address;
ptrClassifierIpMask =
st_dest_ip->ucIpv6Mask;
} else { } else {
ptrClassifierIpAddress = st_dest_ip->ucIpv4Address; ptrClassifierIpAddress =
ptrClassifierIpMask = st_dest_ip->ucIpv4Mask; st_dest_ip->ucIpv4Address;
ptrClassifierIpMask =
st_dest_ip->ucIpv4Mask;
} }
} else if (eIpAddrContext == eSrcIpAddress) { } else if (eIpAddrContext == eSrcIpAddress) {
pstClassifierEntry->ucIPSourceAddressLength = u8IpAddressLen/(nSizeOfIPAddressInBytes * 2); pstClassifierEntry->ucIPSourceAddressLength =
u8IpAddressLen/(nSizeOfIPAddressInBytes * 2);
if (bIpVersion6) { if (bIpVersion6) {
ptrClassifierIpAddress = st_src_ip->ucIpv6Address; ptrClassifierIpAddress =
st_src_ip->ucIpv6Address;
ptrClassifierIpMask = st_src_ip->ucIpv6Mask; ptrClassifierIpMask = st_src_ip->ucIpv6Mask;
} else { } else {
ptrClassifierIpAddress = st_src_ip->ucIpv4Address; ptrClassifierIpAddress =
st_src_ip->ucIpv4Address;
ptrClassifierIpMask = st_src_ip->ucIpv4Mask; ptrClassifierIpMask = st_src_ip->ucIpv4Mask;
} }
} }
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Address Length:0x%X\n", pstClassifierEntry->ucIPDestinationAddressLength); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,
while ((u8IpAddressLen >= nSizeOfIPAddressInBytes) && (i < MAX_IP_RANGE_LENGTH)) { "Address Length:0x%X\n",
pstClassifierEntry->ucIPDestinationAddressLength);
while ((u8IpAddressLen >= nSizeOfIPAddressInBytes)
&& (i < MAX_IP_RANGE_LENGTH)) {
memcpy(ptrClassifierIpAddress + memcpy(ptrClassifierIpAddress +
(i * nSizeOfIPAddressInBytes), (i * nSizeOfIPAddressInBytes),
(pu8IpAddressMaskSrc+(i*nSizeOfIPAddressInBytes*2)), (pu8IpAddressMaskSrc
+ (i * nSizeOfIPAddressInBytes * 2)),
nSizeOfIPAddressInBytes); nSizeOfIPAddressInBytes);
if (!bIpVersion6) { if (!bIpVersion6) {
if (eIpAddrContext == eSrcIpAddress) { if (eIpAddrContext == eSrcIpAddress) {
st_src_ip->ulIpv4Addr[i] = ntohl(st_src_ip->ulIpv4Addr[i]); st_src_ip->ulIpv4Addr[i] =
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Src Ip Address:0x%luX ", ntohl(st_src_ip->ulIpv4Addr[i]);
BCM_DEBUG_PRINT(Adapter,
DBG_TYPE_OTHERS,
CONN_MSG,
DBG_LVL_ALL,
"Src Ip Address:0x%luX ",
st_src_ip->ulIpv4Addr[i]); st_src_ip->ulIpv4Addr[i]);
} else if (eIpAddrContext == eDestIpAddress) { } else if (eIpAddrContext == eDestIpAddress) {
st_dest_ip->ulIpv4Addr[i] = ntohl(st_dest_ip->ulIpv4Addr[i]); st_dest_ip->ulIpv4Addr[i] =
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Dest Ip Address:0x%luX ", ntohl(st_dest_ip->ulIpv4Addr[i]);
BCM_DEBUG_PRINT(Adapter,
DBG_TYPE_OTHERS,
CONN_MSG,
DBG_LVL_ALL,
"Dest Ip Address:0x%luX ",
st_dest_ip->ulIpv4Addr[i]); st_dest_ip->ulIpv4Addr[i]);
} }
} }
...@@ -192,20 +215,29 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, ...@@ -192,20 +215,29 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry,
if (u8IpAddressLen >= nSizeOfIPAddressInBytes) { if (u8IpAddressLen >= nSizeOfIPAddressInBytes) {
memcpy(ptrClassifierIpMask + memcpy(ptrClassifierIpMask +
(i * nSizeOfIPAddressInBytes), (i * nSizeOfIPAddressInBytes),
(pu8IpAddressMaskSrc+nSizeOfIPAddressInBytes + (pu8IpAddressMaskSrc
(i*nSizeOfIPAddressInBytes*2)), + nSizeOfIPAddressInBytes
+ (i * nSizeOfIPAddressInBytes * 2)),
nSizeOfIPAddressInBytes); nSizeOfIPAddressInBytes);
if (!bIpVersion6) { if (!bIpVersion6) {
if (eIpAddrContext == eSrcIpAddress) { if (eIpAddrContext == eSrcIpAddress) {
st_src_ip->ulIpv4Mask[i] = st_src_ip->ulIpv4Mask[i] =
ntohl(st_src_ip->ulIpv4Mask[i]); ntohl(st_src_ip->ulIpv4Mask[i]);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Src Ip Mask Address:0x%luX ", BCM_DEBUG_PRINT(Adapter,
DBG_TYPE_OTHERS,
CONN_MSG,
DBG_LVL_ALL,
"Src Ip Mask Address:0x%luX ",
st_src_ip->ulIpv4Mask[i]); st_src_ip->ulIpv4Mask[i]);
} else if (eIpAddrContext == eDestIpAddress) { } else if (eIpAddrContext == eDestIpAddress) {
st_dest_ip->ulIpv4Mask[i] = st_dest_ip->ulIpv4Mask[i] =
ntohl(st_dest_ip->ulIpv4Mask[i]); ntohl(st_dest_ip->ulIpv4Mask[i]);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Dest Ip Mask Address:0x%luX ", BCM_DEBUG_PRINT(Adapter,
DBG_TYPE_OTHERS,
CONN_MSG,
DBG_LVL_ALL,
"Dest Ip Mask Address:0x%luX ",
st_dest_ip->ulIpv4Mask[i]); st_dest_ip->ulIpv4Mask[i]);
} }
} }
......
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