diff options
Diffstat (limited to 'drivers/staging/bcm/CmHost.c')
-rw-r--r-- | drivers/staging/bcm/CmHost.c | 1231 |
1 files changed, 774 insertions, 457 deletions
diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 632f81a7c63f..fb1d932c5d79 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -13,7 +13,19 @@ enum E_CLASSIFIER_ACTION { eDeleteClassifier }; -static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, B_UINT16 tid); +static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, + B_UINT16 tid); +static void restore_endianess_of_pstClassifierEntry( + struct bcm_classifier_rule *pstClassifierEntry, + enum bcm_ipaddr_context eIpAddrContext); + +static void apply_phs_rule_to_all_classifiers( + register struct bcm_mini_adapter *Adapter, + register UINT uiSearchRuleIndex, + USHORT uVCID, + struct bcm_phs_rule *sPhsRule, + struct bcm_phs_rules *cPhsRule, + struct bcm_add_indication_alt *pstAddIndication); /************************************************************ * Function - SearchSfid @@ -67,13 +79,16 @@ static int SearchFreeSfid(struct bcm_mini_adapter *Adapter) * B_UINT16 uiClassifierID - The classifier ID to be searched * Return: int :Classifier table index of matching entry */ -static int SearchClsid(struct bcm_mini_adapter *Adapter, ULONG ulSFID, B_UINT16 uiClassifierID) +static int SearchClsid(struct bcm_mini_adapter *Adapter, + ULONG ulSFID, + B_UINT16 uiClassifierID) { int i; for (i = 0; i < MAX_CLASSIFIERS; i++) { if ((Adapter->astClassifierTable[i].bUsed) && - (Adapter->astClassifierTable[i].uiClassifierRuleIndex == uiClassifierID) && + (Adapter->astClassifierTable[i].uiClassifierRuleIndex + == uiClassifierID) && (Adapter->astClassifierTable[i].ulSFID == ulSFID)) return i; } @@ -98,7 +113,8 @@ static int SearchFreeClsid(struct bcm_mini_adapter *Adapter /**Adapter Context*/ return MAX_CLASSIFIERS+1; } -static VOID deleteSFBySfid(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIndex) +static VOID deleteSFBySfid(struct bcm_mini_adapter *Adapter, + UINT uiSearchRuleIndex) { /* deleting all the packet held in the SF */ flush_queue(Adapter, uiSearchRuleIndex); @@ -107,7 +123,8 @@ static VOID deleteSFBySfid(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIn DeleteAllClassifiersForSF(Adapter, uiSearchRuleIndex); /* Resetting only MIBS related entries in the SF */ - memset((PVOID)&Adapter->PackInfo[uiSearchRuleIndex], 0, sizeof(struct bcm_mibs_table)); + memset((PVOID)&Adapter->PackInfo[uiSearchRuleIndex], 0, + sizeof(struct bcm_mibs_table)); } static inline VOID @@ -125,70 +142,109 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, nSizeOfIPAddressInBytes = IPV6_ADDRESS_SIZEINBYTES; /* 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) : (TOTAL_MASKED_ADDRESS_IN_BYTES)) >= u8IpAddressLen) { + + union u_ip_address *st_dest_ip = + &pstClassifierEntry->stDestIpAddress; + + union u_ip_address *st_src_ip = + &pstClassifierEntry->stSrcIpAddress; + /* * checking both the mask and address togethor in Classification. * So length will be : TotalLengthInBytes/nSizeOfIPAddressInBytes * 2 * (nSizeOfIPAddressInBytes for address and nSizeOfIPAddressInBytes for mask) */ if (eIpAddrContext == eDestIpAddress) { - pstClassifierEntry->ucIPDestinationAddressLength = u8IpAddressLen/(nSizeOfIPAddressInBytes * 2); + pstClassifierEntry->ucIPDestinationAddressLength = + u8IpAddressLen/(nSizeOfIPAddressInBytes * 2); if (bIpVersion6) { - ptrClassifierIpAddress = pstClassifierEntry->stDestIpAddress.ucIpv6Address; - ptrClassifierIpMask = pstClassifierEntry->stDestIpAddress.ucIpv6Mask; + ptrClassifierIpAddress = + st_dest_ip->ucIpv6Address; + ptrClassifierIpMask = + st_dest_ip->ucIpv6Mask; } else { - ptrClassifierIpAddress = pstClassifierEntry->stDestIpAddress.ucIpv4Address; - ptrClassifierIpMask = pstClassifierEntry->stDestIpAddress.ucIpv4Mask; + ptrClassifierIpAddress = + st_dest_ip->ucIpv4Address; + ptrClassifierIpMask = + st_dest_ip->ucIpv4Mask; } } else if (eIpAddrContext == eSrcIpAddress) { - pstClassifierEntry->ucIPSourceAddressLength = u8IpAddressLen/(nSizeOfIPAddressInBytes * 2); + pstClassifierEntry->ucIPSourceAddressLength = + u8IpAddressLen/(nSizeOfIPAddressInBytes * 2); if (bIpVersion6) { - ptrClassifierIpAddress = pstClassifierEntry->stSrcIpAddress.ucIpv6Address; - ptrClassifierIpMask = pstClassifierEntry->stSrcIpAddress.ucIpv6Mask; + ptrClassifierIpAddress = + st_src_ip->ucIpv6Address; + ptrClassifierIpMask = st_src_ip->ucIpv6Mask; } else { - ptrClassifierIpAddress = pstClassifierEntry->stSrcIpAddress.ucIpv4Address; - ptrClassifierIpMask = pstClassifierEntry->stSrcIpAddress.ucIpv4Mask; + ptrClassifierIpAddress = + st_src_ip->ucIpv4Address; + ptrClassifierIpMask = st_src_ip->ucIpv4Mask; } } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Address Length:0x%X\n", pstClassifierEntry->ucIPDestinationAddressLength); - while ((u8IpAddressLen >= nSizeOfIPAddressInBytes) && (i < MAX_IP_RANGE_LENGTH)) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Address Length:0x%X\n", + pstClassifierEntry->ucIPDestinationAddressLength); + while ((u8IpAddressLen >= nSizeOfIPAddressInBytes) + && (i < MAX_IP_RANGE_LENGTH)) { memcpy(ptrClassifierIpAddress + (i * nSizeOfIPAddressInBytes), - (pu8IpAddressMaskSrc+(i*nSizeOfIPAddressInBytes*2)), + (pu8IpAddressMaskSrc + + (i * nSizeOfIPAddressInBytes * 2)), nSizeOfIPAddressInBytes); if (!bIpVersion6) { if (eIpAddrContext == eSrcIpAddress) { - pstClassifierEntry->stSrcIpAddress.ulIpv4Addr[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv4Addr[i]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Src Ip Address:0x%luX ", - pstClassifierEntry->stSrcIpAddress.ulIpv4Addr[i]); + st_src_ip->ulIpv4Addr[i] = + 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]); } else if (eIpAddrContext == eDestIpAddress) { - pstClassifierEntry->stDestIpAddress.ulIpv4Addr[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv4Addr[i]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Dest Ip Address:0x%luX ", - pstClassifierEntry->stDestIpAddress.ulIpv4Addr[i]); + st_dest_ip->ulIpv4Addr[i] = + 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]); } } u8IpAddressLen -= nSizeOfIPAddressInBytes; if (u8IpAddressLen >= nSizeOfIPAddressInBytes) { memcpy(ptrClassifierIpMask + (i * nSizeOfIPAddressInBytes), - (pu8IpAddressMaskSrc+nSizeOfIPAddressInBytes + - (i*nSizeOfIPAddressInBytes*2)), + (pu8IpAddressMaskSrc + + nSizeOfIPAddressInBytes + + (i * nSizeOfIPAddressInBytes * 2)), nSizeOfIPAddressInBytes); if (!bIpVersion6) { if (eIpAddrContext == eSrcIpAddress) { - pstClassifierEntry->stSrcIpAddress.ulIpv4Mask[i] = - ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv4Mask[i]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Src Ip Mask Address:0x%luX ", - pstClassifierEntry->stSrcIpAddress.ulIpv4Mask[i]); + 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 ", + st_src_ip->ulIpv4Mask[i]); } else if (eIpAddrContext == eDestIpAddress) { - pstClassifierEntry->stDestIpAddress.ulIpv4Mask[i] = - ntohl(pstClassifierEntry->stDestIpAddress.ulIpv4Mask[i]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Dest Ip Mask Address:0x%luX ", - pstClassifierEntry->stDestIpAddress.ulIpv4Mask[i]); + 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 ", + st_dest_ip->ulIpv4Mask[i]); } } u8IpAddressLen -= nSizeOfIPAddressInBytes; @@ -200,15 +256,10 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, } if (bIpVersion6) { /* Restore EndianNess of Struct */ - for (i = 0; i < MAX_IP_RANGE_LENGTH * 4; i++) { - if (eIpAddrContext == eSrcIpAddress) { - pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[i]); - pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[i]); - } else if (eIpAddrContext == eDestIpAddress) { - pstClassifierEntry->stDestIpAddress.ulIpv6Addr[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv6Addr[i]); - pstClassifierEntry->stDestIpAddress.ulIpv6Mask[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv6Mask[i]); - } - } + restore_endianess_of_pstClassifierEntry( + pstClassifierEntry, + eIpAddrContext + ); } } } @@ -216,16 +267,20 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, void ClearTargetDSXBuffer(struct bcm_mini_adapter *Adapter, B_UINT16 TID, bool bFreeAll) { int i; + struct bcm_targetdsx_buffer *curr_buf; for (i = 0; i < Adapter->ulTotalTargetBuffersAvailable; i++) { - if (Adapter->astTargetDsxBuffer[i].valid) + curr_buf = &Adapter->astTargetDsxBuffer[i]; + + if (curr_buf->valid) continue; - if ((bFreeAll) || (Adapter->astTargetDsxBuffer[i].tid == TID)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "ClearTargetDSXBuffer: found tid %d buffer cleared %lx\n", - TID, Adapter->astTargetDsxBuffer[i].ulTargetDsxBuffer); - Adapter->astTargetDsxBuffer[i].valid = 1; - Adapter->astTargetDsxBuffer[i].tid = 0; + if ((bFreeAll) || (curr_buf->tid == TID)) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "ClearTargetDSXBuffer: found tid %d buffer cleared %lx\n", + TID, curr_buf->ulTargetDsxBuffer); + curr_buf->valid = 1; + curr_buf->tid = 0; Adapter->ulFreeTargetBufferCnt++; } } @@ -235,7 +290,10 @@ void ClearTargetDSXBuffer(struct bcm_mini_adapter *Adapter, B_UINT16 TID, bool b * @ingroup ctrl_pkt_functions * copy classifier rule into the specified SF index */ -static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, struct bcm_convergence_types *psfCSType, UINT uiSearchRuleIndex, UINT nClassifierIndex) +static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, + struct bcm_convergence_types *psfCSType, + UINT uiSearchRuleIndex, + UINT nClassifierIndex) { struct bcm_classifier_rule *pstClassifierEntry = NULL; /* VOID *pvPhsContext = NULL; */ @@ -243,12 +301,16 @@ 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)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Storing Classifier Rule Index : %X", + ntohs(pack_class_rule->u16PacketClassificationRuleIndex)); if (nClassifierIndex > MAX_CLASSIFIERS-1) return; @@ -256,106 +318,152 @@ static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stru pstClassifierEntry = &Adapter->astClassifierTable[nClassifierIndex]; if (pstClassifierEntry) { /* Store if Ipv6 */ - pstClassifierEntry->bIpv6Protocol = (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6) ? TRUE : false; + pstClassifierEntry->bIpv6Protocol = + (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6) ? TRUE : false; /* Destinaiton Port */ - pstClassifierEntry->ucDestPortRangeLength = psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength / 4; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Destination Port Range Length:0x%X ", pstClassifierEntry->ucDestPortRangeLength); + 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)); - 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 ", + *((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]); - pstClassifierEntry->usDestPortRangeHi[i] = ntohs(pstClassifierEntry->usDestPortRangeHi[i]); + pstClassifierEntry->usDestPortRangeHi[i] = + ntohs(pstClassifierEntry->usDestPortRangeHi[i]); } } else { pstClassifierEntry->ucDestPortRangeLength = 0; } /* 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; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Source Port Range Length:0x%X ", + 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]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Source Port Range Lo:0x%X ", + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, + CONN_MSG, DBG_LVL_ALL, + "Source Port Range Lo:0x%X ", pstClassifierEntry->usSrcPortRangeLo[i]); - pstClassifierEntry->usSrcPortRangeHi[i] = ntohs(pstClassifierEntry->usSrcPortRangeHi[i]); + pstClassifierEntry->usSrcPortRangeHi[i] = + ntohs(pstClassifierEntry->usSrcPortRangeHi[i]); } } /* Destination Ip Address and Mask */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Ip Destination Parameters : "); + 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); /* Source Ip Address and Mask */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Ip Source Parameters : "); + 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->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", - uiSearchRuleIndex, pstClassifierEntry->ucDirection, + pstClassifierEntry->ucDirection = + Adapter->PackInfo[uiSearchRuleIndex].ucDirection; + 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", + uiSearchRuleIndex, + pstClassifierEntry->ucDirection, 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; } @@ -364,7 +472,8 @@ static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stru /* * @ingroup ctrl_pkt_functions */ -static inline VOID DeleteClassifierRuleFromSF(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIndex, UINT nClassifierIndex) +static inline VOID DeleteClassifierRuleFromSF(struct bcm_mini_adapter *Adapter, + UINT uiSearchRuleIndex, UINT nClassifierIndex) { struct bcm_classifier_rule *pstClassifierEntry = NULL; B_UINT16 u16PacketClassificationRuleIndex; @@ -380,22 +489,26 @@ static inline VOID DeleteClassifierRuleFromSF(struct bcm_mini_adapter *Adapter, if (usVCID == 0) return; - u16PacketClassificationRuleIndex = Adapter->astClassifierTable[nClassifierIndex].uiClassifierRuleIndex; + u16PacketClassificationRuleIndex = + Adapter->astClassifierTable[nClassifierIndex].uiClassifierRuleIndex; pstClassifierEntry = &Adapter->astClassifierTable[nClassifierIndex]; if (pstClassifierEntry) { pstClassifierEntry->bUsed = false; pstClassifierEntry->uiClassifierRuleIndex = 0; - memset(pstClassifierEntry, 0, sizeof(struct bcm_classifier_rule)); + memset(pstClassifierEntry, 0, + sizeof(struct bcm_classifier_rule)); /* Delete the PHS Rule for this classifier */ - PhsDeleteClassifierRule(&Adapter->stBCMPhsContext, usVCID, u16PacketClassificationRuleIndex); + PhsDeleteClassifierRule(&Adapter->stBCMPhsContext, usVCID, + u16PacketClassificationRuleIndex); } } /* * @ingroup ctrl_pkt_functions */ -VOID DeleteAllClassifiersForSF(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIndex) +VOID DeleteAllClassifiersForSF(struct bcm_mini_adapter *Adapter, + UINT uiSearchRuleIndex) { struct bcm_classifier_rule *pstClassifierEntry = NULL; int i; @@ -414,7 +527,8 @@ VOID DeleteAllClassifiersForSF(struct bcm_mini_adapter *Adapter, UINT uiSearchRu pstClassifierEntry = &Adapter->astClassifierTable[i]; if (pstClassifierEntry->bUsed) - DeleteClassifierRuleFromSF(Adapter, uiSearchRuleIndex, i); + DeleteClassifierRuleFromSF(Adapter, + uiSearchRuleIndex, i); } } @@ -441,324 +555,262 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* <Pointer int i; struct bcm_convergence_types *psfCSType = NULL; struct bcm_phs_rule sPhsRule; - USHORT uVCID = Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value; + struct bcm_packet_info *curr_packinfo = + &Adapter->PackInfo[uiSearchRuleIndex]; + USHORT uVCID = curr_packinfo->usVCID_Value; UINT UGIValue = 0; - Adapter->PackInfo[uiSearchRuleIndex].bValid = TRUE; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Search Rule Index = %d\n", uiSearchRuleIndex); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "%s: SFID= %x ", __func__, ntohl(psfLocalSet->u32SFID)); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Updating Queue %d", uiSearchRuleIndex); + curr_packinfo->bValid = TRUE; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Search Rule Index = %d\n", uiSearchRuleIndex); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "%s: SFID= %x ", __func__, ntohl(psfLocalSet->u32SFID)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Updating Queue %d", uiSearchRuleIndex); ulSFID = ntohl(psfLocalSet->u32SFID); /* Store IP Version used */ /* Get The Version Of IP used (IPv6 or IPv4) from CSSpecification field of SF */ - Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = 0; - Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = 0; + curr_packinfo->bIPCSSupport = 0; + curr_packinfo->bEthCSSupport = 0; /* Enable IP/ETh CS Support As Required */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "CopyToAdapter : u8CSSpecification : %X\n", psfLocalSet->u8CSSpecification); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "CopyToAdapter : u8CSSpecification : %X\n", + psfLocalSet->u8CSSpecification); switch (psfLocalSet->u8CSSpecification) { case eCSPacketIPV4: - { - Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS; + curr_packinfo->bIPCSSupport = IPV4_CS; break; - } case eCSPacketIPV6: - { - Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV6_CS; + curr_packinfo->bIPCSSupport = IPV6_CS; break; - } case eCS802_3PacketEthernet: case eCS802_1QPacketVLAN: - { - Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3; + curr_packinfo->bEthCSSupport = ETH_CS_802_3; break; - } case eCSPacketIPV4Over802_1QVLAN: case eCSPacketIPV4Over802_3Ethernet: - { - Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS; - Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3; + curr_packinfo->bIPCSSupport = IPV4_CS; + curr_packinfo->bEthCSSupport = ETH_CS_802_3; break; - } case eCSPacketIPV6Over802_1QVLAN: case eCSPacketIPV6Over802_3Ethernet: - { - Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV6_CS; - Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3; + curr_packinfo->bIPCSSupport = IPV6_CS; + curr_packinfo->bEthCSSupport = ETH_CS_802_3; break; - } default: - { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Error in value of CS Classification.. setting default to IP CS\n"); - Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Error in value of CS Classification.. setting default to IP CS\n"); + curr_packinfo->bIPCSSupport = IPV4_CS; break; } - } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "CopyToAdapter : Queue No : %X ETH CS Support : %X , IP CS Support : %X\n", + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "CopyToAdapter : Queue No : %X ETH CS Support : %X , IP CS Support : %X\n", uiSearchRuleIndex, - Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport, - Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport); + curr_packinfo->bEthCSSupport, + curr_packinfo->bIPCSSupport); /* Store IP Version used */ /* Get The Version Of IP used (IPv6 or IPv4) from CSSpecification field of SF */ - if (Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport == IPV6_CS) - Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion = IPV6; + if (curr_packinfo->bIPCSSupport == IPV6_CS) + curr_packinfo->ucIpVersion = IPV6; else - Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion = IPV4; + curr_packinfo->ucIpVersion = IPV4; /* To ensure that the ETH CS code doesn't gets executed if the BS doesn't supports ETH CS */ if (!Adapter->bETHCSEnabled) - Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = 0; + curr_packinfo->bEthCSSupport = 0; if (psfLocalSet->u8ServiceClassNameLength > 0 && psfLocalSet->u8ServiceClassNameLength < 32) - memcpy(Adapter->PackInfo[uiSearchRuleIndex].ucServiceClassName, psfLocalSet->u8ServiceClassName, psfLocalSet->u8ServiceClassNameLength); + memcpy(curr_packinfo->ucServiceClassName, + psfLocalSet->u8ServiceClassName, + psfLocalSet->u8ServiceClassNameLength); - Adapter->PackInfo[uiSearchRuleIndex].u8QueueType = psfLocalSet->u8ServiceFlowSchedulingType; + curr_packinfo->u8QueueType = psfLocalSet->u8ServiceFlowSchedulingType; - if (Adapter->PackInfo[uiSearchRuleIndex].u8QueueType == BE && Adapter->PackInfo[uiSearchRuleIndex].ucDirection) + if (curr_packinfo->u8QueueType == BE && curr_packinfo->ucDirection) Adapter->usBestEffortQueueIndex = uiSearchRuleIndex; - Adapter->PackInfo[uiSearchRuleIndex].ulSFID = ntohl(psfLocalSet->u32SFID); + curr_packinfo->ulSFID = ntohl(psfLocalSet->u32SFID); - Adapter->PackInfo[uiSearchRuleIndex].u8TrafficPriority = psfLocalSet->u8TrafficPriority; + curr_packinfo->u8TrafficPriority = psfLocalSet->u8TrafficPriority; /* copy all the classifier in the Service Flow param structure */ for (i = 0; i < psfLocalSet->u8TotalClassifiers; i++) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Classifier index =%d", i); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Classifier index =%d", i); psfCSType = &psfLocalSet->cConvergenceSLTypes[i]; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Classifier index =%d", i); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Classifier index =%d", i); if (psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority) - Adapter->PackInfo[uiSearchRuleIndex].bClassifierPriority = TRUE; + curr_packinfo->bClassifierPriority = TRUE; if (psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority) - Adapter->PackInfo[uiSearchRuleIndex].bClassifierPriority = TRUE; + curr_packinfo->bClassifierPriority = TRUE; if (ucDsxType == DSA_ACK) { eClassifierAction = eAddClassifier; } else if (ucDsxType == DSC_ACK) { switch (psfCSType->u8ClassfierDSCAction) { case 0: /* DSC Add Classifier */ - { eClassifierAction = eAddClassifier; - } - break; + break; case 1: /* DSC Replace Classifier */ - { eClassifierAction = eReplaceClassifier; - } - break; + break; case 2: /* DSC Delete Classifier */ - { eClassifierAction = eDeleteClassifier; - } - break; + break; default: - { eClassifierAction = eInvalidClassifierAction; } - } } u16PacketClassificationRuleIndex = ntohs(psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex); switch (eClassifierAction) { case eAddClassifier: - { /* Get a Free Classifier Index From Classifier table for this SF to add the Classifier */ /* Contained in this message */ - nClassifierIndex = SearchClsid(Adapter, ulSFID, u16PacketClassificationRuleIndex); + nClassifierIndex = SearchClsid(Adapter, + ulSFID, + u16PacketClassificationRuleIndex); if (nClassifierIndex > MAX_CLASSIFIERS) { nClassifierIndex = SearchFreeClsid(Adapter); if (nClassifierIndex > MAX_CLASSIFIERS) { /* Failed To get a free Entry */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Error Failed To get a free Classifier Entry"); + BCM_DEBUG_PRINT(Adapter, + DBG_TYPE_OTHERS, + CONN_MSG, + DBG_LVL_ALL, + "Error Failed To get a free Classifier Entry"); break; } /* Copy the Classifier Rule for this service flow into our Classifier table maintained per SF. */ - CopyClassifierRuleToSF(Adapter, psfCSType, uiSearchRuleIndex, nClassifierIndex); + CopyClassifierRuleToSF(Adapter, psfCSType, + uiSearchRuleIndex, + nClassifierIndex); } else { /* This Classifier Already Exists and it is invalid to Add Classifier with existing PCRI */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, + CONN_MSG, + DBG_LVL_ALL, "CopyToAdapter: Error The Specified Classifier Already Exists and attempted To Add Classifier with Same PCRI : 0x%x\n", u16PacketClassificationRuleIndex); } - } - break; + break; case eReplaceClassifier: - { /* Get the Classifier Index From Classifier table for this SF and replace existing Classifier */ /* with the new classifier Contained in this message */ - nClassifierIndex = SearchClsid(Adapter, ulSFID, u16PacketClassificationRuleIndex); + nClassifierIndex = SearchClsid(Adapter, ulSFID, + u16PacketClassificationRuleIndex); if (nClassifierIndex > MAX_CLASSIFIERS) { /* Failed To search the classifier */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Error Search for Classifier To be replaced failed"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, + CONN_MSG, DBG_LVL_ALL, + "Error Search for Classifier To be replaced failed"); break; } /* Copy the Classifier Rule for this service flow into our Classifier table maintained per SF. */ - CopyClassifierRuleToSF(Adapter, psfCSType, uiSearchRuleIndex, nClassifierIndex); - } - break; + CopyClassifierRuleToSF(Adapter, psfCSType, + uiSearchRuleIndex, nClassifierIndex); + break; case eDeleteClassifier: - { /* Get the Classifier Index From Classifier table for this SF and replace existing Classifier */ /* with the new classifier Contained in this message */ - nClassifierIndex = SearchClsid(Adapter, ulSFID, u16PacketClassificationRuleIndex); + nClassifierIndex = SearchClsid(Adapter, ulSFID, + u16PacketClassificationRuleIndex); if (nClassifierIndex > MAX_CLASSIFIERS) { /* Failed To search the classifier */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Error Search for Classifier To be deleted failed"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, + CONN_MSG, DBG_LVL_ALL, + "Error Search for Classifier To be deleted failed"); break; } /* Delete This classifier */ - DeleteClassifierRuleFromSF(Adapter, uiSearchRuleIndex, nClassifierIndex); - } - break; + DeleteClassifierRuleFromSF(Adapter, uiSearchRuleIndex, + nClassifierIndex); + break; default: - { /* Invalid Action for classifier */ break; } - } } /* Repeat parsing Classification Entries to process PHS Rules */ for (i = 0; i < psfLocalSet->u8TotalClassifiers; i++) { psfCSType = &psfLocalSet->cConvergenceSLTypes[i]; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "psfCSType->u8PhsDSCAction : 0x%x\n", psfCSType->u8PhsDSCAction); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "psfCSType->u8PhsDSCAction : 0x%x\n", + psfCSType->u8PhsDSCAction); switch (psfCSType->u8PhsDSCAction) { case eDeleteAllPHSRules: - { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Deleting All PHS Rules For VCID: 0x%X\n", uVCID); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, + DBG_LVL_ALL, + "Deleting All PHS Rules For VCID: 0x%X\n", + uVCID); /* Delete All the PHS rules for this Service flow */ PhsDeleteSFRules(&Adapter->stBCMPhsContext, uVCID); break; - } case eDeletePHSRule: - { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "PHS DSC Action = Delete PHS Rule\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, + DBG_LVL_ALL, + "PHS DSC Action = Delete PHS Rule\n"); if (psfCSType->cPhsRule.u8PHSI) - PhsDeletePHSRule(&Adapter->stBCMPhsContext, uVCID, psfCSType->cCPacketClassificationRule.u8AssociatedPHSI); + PhsDeletePHSRule(&Adapter->stBCMPhsContext, + uVCID, + psfCSType->cCPacketClassificationRule.u8AssociatedPHSI); break; - } default: - { if (ucDsxType == DSC_ACK) { /* BCM_DEBUG_PRINT(CONN_MSG,("Invalid PHS DSC Action For DSC\n",psfCSType->cPhsRule.u8PHSI)); */ break; /* FOr DSC ACK Case PHS DSC Action must be in valid set */ } - } /* Proceed To Add PHS rule for DSA_ACK case even if PHS DSC action is unspecified */ /* No Break Here . Intentionally! */ case eAddPHSRule: case eSetPHSRule: - { if (psfCSType->cPhsRule.u8PHSI) { /* Apply This PHS Rule to all classifiers whose Associated PHSI Match */ - unsigned int uiClassifierIndex = 0; - if (pstAddIndication->u8Direction == UPLINK_DIR) { - for (uiClassifierIndex = 0; uiClassifierIndex < MAX_CLASSIFIERS; uiClassifierIndex++) { - if ((Adapter->astClassifierTable[uiClassifierIndex].bUsed) && - (Adapter->astClassifierTable[uiClassifierIndex].ulSFID == Adapter->PackInfo[uiSearchRuleIndex].ulSFID) && - (Adapter->astClassifierTable[uiClassifierIndex].u8AssociatedPHSI == psfCSType->cPhsRule.u8PHSI)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, - "Adding PHS Rule For Classifier: 0x%x cPhsRule.u8PHSI: 0x%x\n", - Adapter->astClassifierTable[uiClassifierIndex].uiClassifierRuleIndex, - psfCSType->cPhsRule.u8PHSI); - /* Update The PHS Rule for this classifier as Associated PHSI id defined */ - - /* Copy the PHS Rule */ - sPhsRule.u8PHSI = psfCSType->cPhsRule.u8PHSI; - sPhsRule.u8PHSFLength = psfCSType->cPhsRule.u8PHSFLength; - sPhsRule.u8PHSMLength = psfCSType->cPhsRule.u8PHSMLength; - sPhsRule.u8PHSS = psfCSType->cPhsRule.u8PHSS; - sPhsRule.u8PHSV = psfCSType->cPhsRule.u8PHSV; - memcpy(sPhsRule.u8PHSF, psfCSType->cPhsRule.u8PHSF, MAX_PHS_LENGTHS); - memcpy(sPhsRule.u8PHSM, psfCSType->cPhsRule.u8PHSM, MAX_PHS_LENGTHS); - sPhsRule.u8RefCnt = 0; - sPhsRule.bUnclassifiedPHSRule = false; - sPhsRule.PHSModifiedBytes = 0; - sPhsRule.PHSModifiedNumPackets = 0; - sPhsRule.PHSErrorNumPackets = 0; - - /* bPHSRuleAssociated = TRUE; */ - /* Store The PHS Rule for this classifier */ - - PhsUpdateClassifierRule( - &Adapter->stBCMPhsContext, - uVCID, - Adapter->astClassifierTable[uiClassifierIndex].uiClassifierRuleIndex, - &sPhsRule, - Adapter->astClassifierTable[uiClassifierIndex].u8AssociatedPHSI); - - /* Update PHS Rule For the Classifier */ - if (sPhsRule.u8PHSI) { - Adapter->astClassifierTable[uiClassifierIndex].u32PHSRuleID = sPhsRule.u8PHSI; - memcpy(&Adapter->astClassifierTable[uiClassifierIndex].sPhsRule, &sPhsRule, sizeof(struct bcm_phs_rule)); - } - } - } - } else { - /* Error PHS Rule specified in signaling could not be applied to any classifier */ - - /* Copy the PHS Rule */ - sPhsRule.u8PHSI = psfCSType->cPhsRule.u8PHSI; - sPhsRule.u8PHSFLength = psfCSType->cPhsRule.u8PHSFLength; - sPhsRule.u8PHSMLength = psfCSType->cPhsRule.u8PHSMLength; - sPhsRule.u8PHSS = psfCSType->cPhsRule.u8PHSS; - sPhsRule.u8PHSV = psfCSType->cPhsRule.u8PHSV; - memcpy(sPhsRule.u8PHSF, psfCSType->cPhsRule.u8PHSF, MAX_PHS_LENGTHS); - memcpy(sPhsRule.u8PHSM, psfCSType->cPhsRule.u8PHSM, MAX_PHS_LENGTHS); - sPhsRule.u8RefCnt = 0; - sPhsRule.bUnclassifiedPHSRule = TRUE; - sPhsRule.PHSModifiedBytes = 0; - sPhsRule.PHSModifiedNumPackets = 0; - sPhsRule.PHSErrorNumPackets = 0; - /* Store The PHS Rule for this classifier */ - - /* - * Passing the argument u8PHSI instead of clsid. Because for DL with no classifier rule, - * clsid will be zero hence we can't have multiple PHS rules for the same SF. - * To support multiple PHS rule, passing u8PHSI. - */ - PhsUpdateClassifierRule( - &Adapter->stBCMPhsContext, + apply_phs_rule_to_all_classifiers(Adapter, + uiSearchRuleIndex, uVCID, - sPhsRule.u8PHSI, &sPhsRule, - sPhsRule.u8PHSI); - } + &psfCSType->cPhsRule, + pstAddIndication); } - } - break; + break; } } if (psfLocalSet->u32MaxSustainedTrafficRate == 0) { /* No Rate Limit . Set Max Sustained Traffic Rate to Maximum */ - Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate = WIMAX_MAX_ALLOWED_RATE; + curr_packinfo->uiMaxAllowedRate = WIMAX_MAX_ALLOWED_RATE; } else if (ntohl(psfLocalSet->u32MaxSustainedTrafficRate) > WIMAX_MAX_ALLOWED_RATE) { /* Too large Allowed Rate specified. Limiting to Wi Max Allowed rate */ - Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate = WIMAX_MAX_ALLOWED_RATE; + curr_packinfo->uiMaxAllowedRate = WIMAX_MAX_ALLOWED_RATE; } else { - Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate = ntohl(psfLocalSet->u32MaxSustainedTrafficRate); + curr_packinfo->uiMaxAllowedRate = + ntohl(psfLocalSet->u32MaxSustainedTrafficRate); } - Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency = ntohl(psfLocalSet->u32MaximumLatency); - if (Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency == 0) /* 0 should be treated as infinite */ - Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency = MAX_LATENCY_ALLOWED; + curr_packinfo->uiMaxLatency = ntohl(psfLocalSet->u32MaximumLatency); + if (curr_packinfo->uiMaxLatency == 0) /* 0 should be treated as infinite */ + curr_packinfo->uiMaxLatency = MAX_LATENCY_ALLOWED; - if ((Adapter->PackInfo[uiSearchRuleIndex].u8QueueType == ERTPS || - Adapter->PackInfo[uiSearchRuleIndex].u8QueueType == UGS)) + if ((curr_packinfo->u8QueueType == ERTPS || + curr_packinfo->u8QueueType == UGS)) UGIValue = ntohs(psfLocalSet->u16UnsolicitedGrantInterval); if (UGIValue == 0) @@ -770,42 +822,45 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* <Pointer * The extra amount of token is to ensure that a large amount of jitter won't have loss in throughput... * In case of non-UGI based connection, 200 frames worth of data is the max token count at host... */ - Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize = - (DEFAULT_UGI_FACTOR*Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate*UGIValue)/1000; + curr_packinfo->uiMaxBucketSize = + (DEFAULT_UGI_FACTOR*curr_packinfo->uiMaxAllowedRate*UGIValue)/1000; - if (Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize < WIMAX_MAX_MTU*8) { + if (curr_packinfo->uiMaxBucketSize < WIMAX_MAX_MTU*8) { UINT UGIFactor = 0; /* Special Handling to ensure the biggest size of packet can go out from host to FW as follows: * 1. Any packet from Host to FW can go out in different packet size. * 2. So in case the Bucket count is smaller than MTU, the packets of size (Size > TokenCount), will get dropped. * 3. We can allow packets of MaxSize from Host->FW that can go out from FW in multiple SDUs by fragmentation at Wimax Layer */ - UGIFactor = (Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency/UGIValue + 1); + UGIFactor = (curr_packinfo->uiMaxLatency/UGIValue + 1); if (UGIFactor > DEFAULT_UGI_FACTOR) - Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize = - (UGIFactor*Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate*UGIValue)/1000; + curr_packinfo->uiMaxBucketSize = + (UGIFactor*curr_packinfo->uiMaxAllowedRate*UGIValue)/1000; - if (Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize > WIMAX_MAX_MTU*8) - Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize = WIMAX_MAX_MTU*8; + if (curr_packinfo->uiMaxBucketSize > WIMAX_MAX_MTU*8) + curr_packinfo->uiMaxBucketSize = WIMAX_MAX_MTU*8; } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "LAT: %d, UGI: %d\n", Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency, UGIValue); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "uiMaxAllowedRate: 0x%x, u32MaxSustainedTrafficRate: 0x%x ,uiMaxBucketSize: 0x%x", - Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate, + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "LAT: %d, UGI: %d\n", curr_packinfo->uiMaxLatency, + UGIValue); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "uiMaxAllowedRate: 0x%x, u32MaxSustainedTrafficRate: 0x%x ,uiMaxBucketSize: 0x%x", + curr_packinfo->uiMaxAllowedRate, ntohl(psfLocalSet->u32MaxSustainedTrafficRate), - Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize); + curr_packinfo->uiMaxBucketSize); /* copy the extended SF Parameters to Support MIBS */ CopyMIBSExtendedSFParameters(Adapter, psfLocalSet, uiSearchRuleIndex); /* store header suppression enabled flag per SF */ - Adapter->PackInfo[uiSearchRuleIndex].bHeaderSuppressionEnabled = + curr_packinfo->bHeaderSuppressionEnabled = !(psfLocalSet->u8RequesttransmissionPolicy & MASK_DISABLE_HEADER_SUPPRESSION); - kfree(Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication); - Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication = pstAddIndication; + kfree(curr_packinfo->pstSFIndication); + curr_packinfo->pstSFIndication = pstAddIndication; /* Re Sort the SF list in PackInfo according to Traffic Priority */ SortPackInfo(Adapter); @@ -815,7 +870,8 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* <Pointer */ SortClassifiers(Adapter); DumpPhsRules(&Adapter->stBCMPhsContext); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "%s <=====", __func__); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "%s <=====", __func__); } /*********************************************************************** @@ -1197,123 +1253,179 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) for (nIndex = 0; nIndex < nCurClassifierCnt; nIndex++) { struct bcm_convergence_types *psfCSType = NULL; + struct bcm_packet_class_rules *clsRule = NULL; - psfCSType = &pstAddIndication->sfActiveSet.cConvergenceSLTypes[nIndex]; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " CCPacketClassificationRuleSI====>"); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ClassifierRulePriority: 0x%X ", - psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPTypeOfServiceLength: 0x%X ", - psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPTypeOfService[3]: 0x%X ,0x%X ,0x%X ", - psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0], - psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1], - psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2]); + psfCSType = &pstAddIndication->sfActiveSet.cConvergenceSLTypes[nIndex]; + clsRule = &psfCSType->cCPacketClassificationRule; + + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, " CCPacketClassificationRuleSI====>"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, " u8ClassifierRulePriority: 0x%X ", + clsRule->u8ClassifierRulePriority); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, " u8IPTypeOfServiceLength: 0x%X ", + clsRule->u8IPTypeOfServiceLength); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8IPTypeOfService[3]: 0x%X ,0x%X ,0x%X ", + clsRule->u8IPTypeOfService[0], + clsRule->u8IPTypeOfService[1], + clsRule->u8IPTypeOfService[2]); for (uiLoopIndex = 0; uiLoopIndex < 1; uiLoopIndex++) - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8Protocol: 0x%X ", psfCSType->cCPacketClassificationRule.u8Protocol); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8Protocol: 0x%X ", + clsRule->u8Protocol); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPMaskedSourceAddressLength: 0x%X ", - psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + "u8IPMaskedSourceAddressLength: 0x%X ", + clsRule->u8IPMaskedSourceAddressLength); for (uiLoopIndex = 0; uiLoopIndex < 32; uiLoopIndex++) - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPMaskedSourceAddress[32]: 0x%X ", - psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress[uiLoopIndex]); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + "u8IPMaskedSourceAddress[32]: 0x%X ", + clsRule->u8IPMaskedSourceAddress[uiLoopIndex]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPDestinationAddressLength: 0x%02X ", - psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + "u8IPDestinationAddressLength: 0x%02X ", + clsRule->u8IPDestinationAddressLength); for (uiLoopIndex = 0; uiLoopIndex < 32; uiLoopIndex++) - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPDestinationAddress[32]:0x%X ", - psfCSType->cCPacketClassificationRule.u8IPDestinationAddress[uiLoopIndex]); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8IPDestinationAddress[32]:0x%X ", + clsRule->u8IPDestinationAddress[uiLoopIndex]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ProtocolSourcePortRangeLength: 0x%X ", - psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8ProtocolSourcePortRangeLength: 0x%X ", + clsRule->u8ProtocolSourcePortRangeLength); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ProtocolSourcePortRange[4]: 0x%X ,0x%X ,0x%X ,0x%X ", - psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[0], - psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[1], - psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[2], - psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[3]); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8ProtocolSourcePortRange[4]: 0x%X ,0x%X ,0x%X ,0x%X ", + clsRule->u8ProtocolSourcePortRange[0], + clsRule->u8ProtocolSourcePortRange[1], + clsRule->u8ProtocolSourcePortRange[2], + clsRule->u8ProtocolSourcePortRange[3]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ProtocolDestPortRangeLength: 0x%X ", - psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ProtocolDestPortRange[4]: 0x%X ,0x%X ,0x%X ,0x%X ", - psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[0], - psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[1], - psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[2], - psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[3]); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8ProtocolDestPortRangeLength: 0x%X ", + clsRule->u8ProtocolDestPortRangeLength); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8ProtocolDestPortRange[4]: 0x%X ,0x%X ,0x%X ,0x%X ", + clsRule->u8ProtocolDestPortRange[0], + clsRule->u8ProtocolDestPortRange[1], + clsRule->u8ProtocolDestPortRange[2], + clsRule->u8ProtocolDestPortRange[3]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8EthernetDestMacAddressLength: 0x%X ", - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8EthernetDestMacAddress[6]: 0x%X ,0x%X ,0x%X ,0x%X ,0x%X ,0x%X", - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[0], - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[1], - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[2], - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[3], - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[4], - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[5]); - - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8EthernetSourceMACAddressLength: 0x%X ", - psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthernetSourceMACAddress[6]: 0x%X ,0x%X ,0x%X ,0x%X ,0x%X ,0x%X", - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[0], - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[1], - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[2], - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[3], - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[4], - psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[5]); - - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8EthertypeLength: 0x%X ", - psfCSType->cCPacketClassificationRule.u8EthertypeLength); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8Ethertype[3]: 0x%X ,0x%X ,0x%X ", - psfCSType->cCPacketClassificationRule.u8Ethertype[0], - psfCSType->cCPacketClassificationRule.u8Ethertype[1], - psfCSType->cCPacketClassificationRule.u8Ethertype[2]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16UserPriority: 0x%X ", - psfCSType->cCPacketClassificationRule.u16UserPriority); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16VLANID: 0x%X ", psfCSType->cCPacketClassificationRule.u16VLANID); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8AssociatedPHSI: 0x%X ", psfCSType->cCPacketClassificationRule.u8AssociatedPHSI); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16PacketClassificationRuleIndex:0x%X ", - psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8EthernetDestMacAddressLength: 0x%X ", + clsRule->u8EthernetDestMacAddressLength); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8EthernetDestMacAddress[6]: 0x%X ,0x%X ,0x%X ,0x%X ,0x%X ,0x%X", + clsRule->u8EthernetDestMacAddress[0], + clsRule->u8EthernetDestMacAddress[1], + clsRule->u8EthernetDestMacAddress[2], + clsRule->u8EthernetDestMacAddress[3], + clsRule->u8EthernetDestMacAddress[4], + clsRule->u8EthernetDestMacAddress[5]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8VendorSpecificClassifierParamLength:0x%X ", - psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParamLength); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8VendorSpecificClassifierParam[1]:0x%X ", - psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParam[0]); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8EthernetSourceMACAddressLength: 0x%X ", + clsRule->u8EthernetDestMacAddressLength); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + "u8EthernetSourceMACAddress[6]: 0x%X ,0x%X ,0x%X ,0x%X ,0x%X ,0x%X", + clsRule->u8EthernetSourceMACAddress[0], + clsRule->u8EthernetSourceMACAddress[1], + clsRule->u8EthernetSourceMACAddress[2], + clsRule->u8EthernetSourceMACAddress[3], + clsRule->u8EthernetSourceMACAddress[4], + clsRule->u8EthernetSourceMACAddress[5]); + + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, " u8EthertypeLength: 0x%X ", + clsRule->u8EthertypeLength); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8Ethertype[3]: 0x%X ,0x%X ,0x%X ", + clsRule->u8Ethertype[0], + clsRule->u8Ethertype[1], + clsRule->u8Ethertype[2]); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, " u16UserPriority: 0x%X ", + clsRule->u16UserPriority); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, " u16VLANID: 0x%X ", + clsRule->u16VLANID); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, " u8AssociatedPHSI: 0x%X ", + clsRule->u8AssociatedPHSI); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u16PacketClassificationRuleIndex:0x%X ", + clsRule->u16PacketClassificationRuleIndex); + + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8VendorSpecificClassifierParamLength:0x%X ", + clsRule->u8VendorSpecificClassifierParamLength); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8VendorSpecificClassifierParam[1]:0x%X ", + clsRule->u8VendorSpecificClassifierParam[0]); #ifdef VERSION_D5 - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPv6FlowLableLength: 0x%X ", - psfCSType->cCPacketClassificationRule.u8IPv6FlowLableLength); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPv6FlowLable[6]: 0x%X ,0x%X ,0x%X ,0x%X ,0x%X ,0x%X ", - psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[0], - psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[1], - psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[2], - psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[3], - psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[4], - psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[5]); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, " u8IPv6FlowLableLength: 0x%X ", + clsRule->u8IPv6FlowLableLength); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8IPv6FlowLable[6]: 0x%X ,0x%X ,0x%X ,0x%X ,0x%X ,0x%X ", + clsRule->u8IPv6FlowLable[0], + clsRule->u8IPv6FlowLable[1], + clsRule->u8IPv6FlowLable[2], + clsRule->u8IPv6FlowLable[3], + clsRule->u8IPv6FlowLable[4], + clsRule->u8IPv6FlowLable[5]); #endif } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " bValid: 0x%X", pstAddIndication->sfActiveSet.bValid); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, + " bValid: 0x%X", pstAddIndication->sfActiveSet.bValid); } -static inline ULONG RestoreSFParam(struct bcm_mini_adapter *Adapter, ULONG ulAddrSFParamSet, PUCHAR pucDestBuffer) +static inline ULONG RestoreSFParam(struct bcm_mini_adapter *Adapter, + ULONG ulAddrSFParamSet, PUCHAR pucDestBuffer) { UINT nBytesToRead = sizeof(struct bcm_connect_mgr_params); if (ulAddrSFParamSet == 0 || NULL == pucDestBuffer) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Got Param address as 0!!"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Got Param address as 0!!"); return 0; } ulAddrSFParamSet = ntohl(ulAddrSFParamSet); /* Read out the SF Param Set At the indicated Location */ - if (rdm(Adapter, ulAddrSFParamSet, (PUCHAR)pucDestBuffer, nBytesToRead) < 0) + if (rdm(Adapter, ulAddrSFParamSet,(PUCHAR)pucDestBuffer, nBytesToRead) < 0) return STATUS_FAILURE; return 1; } -static ULONG StoreSFParam(struct bcm_mini_adapter *Adapter, PUCHAR pucSrcBuffer, ULONG ulAddrSFParamSet) +static ULONG StoreSFParam(struct bcm_mini_adapter *Adapter, PUCHAR pucSrcBuffer, + ULONG ulAddrSFParamSet) { UINT nBytesToWrite = sizeof(struct bcm_connect_mgr_params); int ret = 0; @@ -1323,13 +1435,15 @@ static ULONG StoreSFParam(struct bcm_mini_adapter *Adapter, PUCHAR pucSrcBuffer, ret = wrm(Adapter, ulAddrSFParamSet, (u8 *)pucSrcBuffer, nBytesToWrite); if (ret < 0) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "%s:%d WRM failed", __func__, __LINE__); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "%s:%d WRM failed", __func__, __LINE__); return ret; } return 1; } -ULONG StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, PVOID pvBuffer, UINT *puBufferLength) +ULONG StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, + PVOID pvBuffer, UINT *puBufferLength) { struct bcm_add_indication_alt *pstAddIndicationAlt = NULL; struct bcm_add_indication *pstAddIndication = NULL; @@ -1363,13 +1477,15 @@ ULONG StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, PVOID pvBu } /* For DSA_REQ, only up to "psfAuthorizedSet" parameter should be accessed by driver! */ - pstAddIndication = kmalloc(sizeof(struct bcm_add_indication), GFP_KERNEL); + pstAddIndication = kmalloc(sizeof(struct bcm_add_indication), + GFP_KERNEL); if (pstAddIndication == NULL) return 0; /* AUTHORIZED SET */ pstAddIndication->psfAuthorizedSet = (struct bcm_connect_mgr_params *) - GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID); + GetNextTargetBufferLocation(Adapter, + pstAddIndicationAlt->u16TID); if (!pstAddIndication->psfAuthorizedSet) { kfree(pstAddIndication); return 0; @@ -1382,7 +1498,9 @@ ULONG StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, PVOID pvBu } /* this can't possibly be right */ - pstAddIndication->psfAuthorizedSet = (struct bcm_connect_mgr_params *)ntohl((ULONG)pstAddIndication->psfAuthorizedSet); + pstAddIndication->psfAuthorizedSet = + (struct bcm_connect_mgr_params *) ntohl( + (ULONG)pstAddIndication->psfAuthorizedSet); if (pstAddIndicationAlt->u8Type == DSA_REQ) { struct bcm_add_request AddRequest; @@ -1411,31 +1529,39 @@ ULONG StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, PVOID pvBu /* ADMITTED SET */ pstAddIndication->psfAdmittedSet = (struct bcm_connect_mgr_params *) - GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID); + GetNextTargetBufferLocation(Adapter, + pstAddIndicationAlt->u16TID); if (!pstAddIndication->psfAdmittedSet) { kfree(pstAddIndication); return 0; } - if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfAdmittedSet, (ULONG)pstAddIndication->psfAdmittedSet) != 1) { + if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfAdmittedSet, + (ULONG)pstAddIndication->psfAdmittedSet) != 1) { kfree(pstAddIndication); return 0; } - pstAddIndication->psfAdmittedSet = (struct bcm_connect_mgr_params *)ntohl((ULONG)pstAddIndication->psfAdmittedSet); + pstAddIndication->psfAdmittedSet = + (struct bcm_connect_mgr_params *) ntohl( + (ULONG) pstAddIndication->psfAdmittedSet); /* ACTIVE SET */ pstAddIndication->psfActiveSet = (struct bcm_connect_mgr_params *) - GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID); + GetNextTargetBufferLocation(Adapter, + pstAddIndicationAlt->u16TID); if (!pstAddIndication->psfActiveSet) { kfree(pstAddIndication); return 0; } - if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfActiveSet, (ULONG)pstAddIndication->psfActiveSet) != 1) { + if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfActiveSet, + (ULONG)pstAddIndication->psfActiveSet) != 1) { kfree(pstAddIndication); return 0; } - pstAddIndication->psfActiveSet = (struct bcm_connect_mgr_params *)ntohl((ULONG)pstAddIndication->psfActiveSet); + pstAddIndication->psfActiveSet = + (struct bcm_connect_mgr_params *) ntohl( + (ULONG)pstAddIndication->psfActiveSet); (*puBufferLength) = sizeof(struct bcm_add_indication); *(struct bcm_add_indication *)pvBuffer = *pstAddIndication; @@ -1444,40 +1570,63 @@ ULONG StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, PVOID pvBu } static inline struct bcm_add_indication_alt -*RestoreCmControlResponseMessage(register struct bcm_mini_adapter *Adapter, register PVOID pvBuffer) +*RestoreCmControlResponseMessage(register struct bcm_mini_adapter *Adapter, + register PVOID pvBuffer) { ULONG ulStatus = 0; struct bcm_add_indication *pstAddIndication = NULL; struct bcm_add_indication_alt *pstAddIndicationDest = NULL; pstAddIndication = pvBuffer; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "=====>"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "=====>"); if ((pstAddIndication->u8Type == DSD_REQ) || (pstAddIndication->u8Type == DSD_RSP) || (pstAddIndication->u8Type == DSD_ACK)) return pvBuffer; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Inside RestoreCmControlResponseMessage "); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Inside RestoreCmControlResponseMessage "); /* * Need to Allocate memory to contain the SUPER Large structures * Our driver can't create these structures on Stack :( */ - pstAddIndicationDest = kmalloc(sizeof(struct bcm_add_indication_alt), GFP_KERNEL); + pstAddIndicationDest = kmalloc(sizeof(struct bcm_add_indication_alt), + GFP_KERNEL); if (pstAddIndicationDest) { - memset(pstAddIndicationDest, 0, sizeof(struct bcm_add_indication_alt)); + memset(pstAddIndicationDest, 0, + sizeof(struct bcm_add_indication_alt)); } else { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Failed to allocate memory for SF Add Indication Structure "); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, + DBG_LVL_ALL, + "Failed to allocate memory for SF Add Indication Structure "); return NULL; } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-u8Type : 0x%X", pstAddIndication->u8Type); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-u8Direction : 0x%X", pstAddIndication->eConnectionDir); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-u8TID : 0x%X", ntohs(pstAddIndication->u16TID)); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-u8CID : 0x%X", ntohs(pstAddIndication->u16CID)); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-u16VCID : 0x%X", ntohs(pstAddIndication->u16VCID)); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-autorized set loc : %p", pstAddIndication->psfAuthorizedSet); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-admitted set loc : %p", pstAddIndication->psfAdmittedSet); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-Active set loc : %p", pstAddIndication->psfActiveSet); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "AddIndication-u8Type : 0x%X", + pstAddIndication->u8Type); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "AddIndication-u8Direction : 0x%X", + pstAddIndication->eConnectionDir); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "AddIndication-u8TID : 0x%X", + ntohs(pstAddIndication->u16TID)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "AddIndication-u8CID : 0x%X", + ntohs(pstAddIndication->u16CID)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "AddIndication-u16VCID : 0x%X", + ntohs(pstAddIndication->u16VCID)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "AddIndication-autorized set loc : %p", + pstAddIndication->psfAuthorizedSet); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "AddIndication-admitted set loc : %p", + pstAddIndication->psfAdmittedSet); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "AddIndication-Active set loc : %p", + pstAddIndication->psfActiveSet); pstAddIndicationDest->u8Type = pstAddIndication->u8Type; pstAddIndicationDest->u8Direction = pstAddIndication->eConnectionDir; @@ -1486,39 +1635,60 @@ static inline struct bcm_add_indication_alt pstAddIndicationDest->u16VCID = pstAddIndication->u16VCID; pstAddIndicationDest->u8CC = pstAddIndication->u8CC; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Restoring Active Set "); - ulStatus = RestoreSFParam(Adapter, (ULONG)pstAddIndication->psfActiveSet, (PUCHAR)&pstAddIndicationDest->sfActiveSet); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Restoring Active Set "); + ulStatus = RestoreSFParam(Adapter, + (ULONG)pstAddIndication->psfActiveSet, + (PUCHAR)&pstAddIndicationDest->sfActiveSet); if (ulStatus != 1) goto failed_restore_sf_param; if (pstAddIndicationDest->sfActiveSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF) - pstAddIndicationDest->sfActiveSet.u8TotalClassifiers = MAX_CLASSIFIERS_IN_SF; - - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Restoring Admitted Set "); - ulStatus = RestoreSFParam(Adapter, (ULONG)pstAddIndication->psfAdmittedSet, (PUCHAR)&pstAddIndicationDest->sfAdmittedSet); + pstAddIndicationDest->sfActiveSet.u8TotalClassifiers = + MAX_CLASSIFIERS_IN_SF; + + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Restoring Admitted Set "); + ulStatus = RestoreSFParam(Adapter, + (ULONG)pstAddIndication->psfAdmittedSet, + (PUCHAR)&pstAddIndicationDest->sfAdmittedSet); if (ulStatus != 1) goto failed_restore_sf_param; if (pstAddIndicationDest->sfAdmittedSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF) - pstAddIndicationDest->sfAdmittedSet.u8TotalClassifiers = MAX_CLASSIFIERS_IN_SF; - - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Restoring Authorized Set "); - ulStatus = RestoreSFParam(Adapter, (ULONG)pstAddIndication->psfAuthorizedSet, (PUCHAR)&pstAddIndicationDest->sfAuthorizedSet); + pstAddIndicationDest->sfAdmittedSet.u8TotalClassifiers = + MAX_CLASSIFIERS_IN_SF; + + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Restoring Authorized Set "); + ulStatus = RestoreSFParam(Adapter, + (ULONG)pstAddIndication->psfAuthorizedSet, + (PUCHAR)&pstAddIndicationDest->sfAuthorizedSet); if (ulStatus != 1) goto failed_restore_sf_param; if (pstAddIndicationDest->sfAuthorizedSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF) - pstAddIndicationDest->sfAuthorizedSet.u8TotalClassifiers = MAX_CLASSIFIERS_IN_SF; - - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Dumping the whole raw packet"); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "============================================================"); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, " pstAddIndicationDest->sfActiveSet size %zx %p", sizeof(*pstAddIndicationDest), pstAddIndicationDest); - /* BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, (unsigned char *)pstAddIndicationDest, sizeof(*pstAddIndicationDest)); */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "============================================================"); + pstAddIndicationDest->sfAuthorizedSet.u8TotalClassifiers = + MAX_CLASSIFIERS_IN_SF; + + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Dumping the whole raw packet"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "============================================================"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + " pstAddIndicationDest->sfActiveSet size %zx %p", + sizeof(*pstAddIndicationDest), pstAddIndicationDest); + /* BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_OTHERS, CONN_MSG, + * DBG_LVL_ALL, (unsigned char *)pstAddIndicationDest, + * sizeof(*pstAddIndicationDest)); + */ + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "============================================================"); return pstAddIndicationDest; failed_restore_sf_param: kfree(pstAddIndicationDest); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<====="); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "<====="); return NULL; } @@ -1530,31 +1700,44 @@ ULONG SetUpTargetDsxBuffers(struct bcm_mini_adapter *Adapter) int Status; if (!Adapter) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Adapter was NULL!!!"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Adapter was NULL!!!"); return 0; } if (Adapter->astTargetDsxBuffer[0].ulTargetDsxBuffer) return 1; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Size of Each DSX Buffer(Also size of connection manager parameters): %zx ", sizeof(struct bcm_connect_mgr_params)); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Reading DSX buffer From Target location %x ", DSX_MESSAGE_EXCHANGE_BUFFER); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Size of Each DSX Buffer(Also size of connection manager parameters): %zx ", + sizeof(struct bcm_connect_mgr_params)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Reading DSX buffer From Target location %x ", + DSX_MESSAGE_EXCHANGE_BUFFER); - Status = rdmalt(Adapter, DSX_MESSAGE_EXCHANGE_BUFFER, (PUINT)&ulTargetDsxBuffersBase, sizeof(UINT)); + Status = rdmalt(Adapter, DSX_MESSAGE_EXCHANGE_BUFFER, + (PUINT)&ulTargetDsxBuffersBase, sizeof(UINT)); if (Status < 0) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "RDM failed!!"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "RDM failed!!"); return 0; } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Base Address Of DSX Target Buffer : 0x%lx", ulTargetDsxBuffersBase); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Tgt Buffer is Now %lx :", ulTargetDsxBuffersBase); - ulCntTargetBuffers = DSX_MESSAGE_EXCHANGE_BUFFER_SIZE / sizeof(struct bcm_connect_mgr_params); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Base Address Of DSX Target Buffer : 0x%lx", + ulTargetDsxBuffersBase); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Tgt Buffer is Now %lx :", ulTargetDsxBuffersBase); + ulCntTargetBuffers = DSX_MESSAGE_EXCHANGE_BUFFER_SIZE / + sizeof(struct bcm_connect_mgr_params); Adapter->ulTotalTargetBuffersAvailable = ulCntTargetBuffers > MAX_TARGET_DSX_BUFFERS ? MAX_TARGET_DSX_BUFFERS : ulCntTargetBuffers; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, " Total Target DSX Buffer setup %lx ", Adapter->ulTotalTargetBuffersAvailable); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + " Total Target DSX Buffer setup %lx ", + Adapter->ulTotalTargetBuffersAvailable); for (i = 0; i < Adapter->ulTotalTargetBuffersAvailable; i++) { Adapter->astTargetDsxBuffer[i].ulTargetDsxBuffer = ulTargetDsxBuffersBase; @@ -1569,12 +1752,14 @@ ULONG SetUpTargetDsxBuffers(struct bcm_mini_adapter *Adapter) return 1; } -static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, B_UINT16 tid) +static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, + B_UINT16 tid) { ULONG dsx_buf; ULONG idx, max_try; - if ((Adapter->ulTotalTargetBuffersAvailable == 0) || (Adapter->ulFreeTargetBufferCnt == 0)) { + if ((Adapter->ulTotalTargetBuffersAvailable == 0) + || (Adapter->ulFreeTargetBufferCnt == 0)) { ClearTargetDSXBuffer(Adapter, tid, false); return 0; } @@ -1587,7 +1772,9 @@ static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, B_UIN } if (max_try == 0) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "\n GetNextTargetBufferLocation : Error No Free Target DSX Buffers FreeCnt : %lx ", Adapter->ulFreeTargetBufferCnt); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "\n GetNextTargetBufferLocation : Error No Free Target DSX Buffers FreeCnt : %lx ", + Adapter->ulFreeTargetBufferCnt); ClearTargetDSXBuffer(Adapter, tid, false); return 0; } @@ -1598,7 +1785,9 @@ static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, B_UIN Adapter->ulFreeTargetBufferCnt--; idx = (idx+1)%Adapter->ulTotalTargetBuffersAvailable; Adapter->ulCurrentTargetBuffer = idx; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "GetNextTargetBufferLocation :Returning address %lx tid %d\n", dsx_buf, tid); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "GetNextTargetBufferLocation :Returning address %lx tid %d\n", + dsx_buf, tid); return dsx_buf; } @@ -1609,7 +1798,8 @@ int AllocAdapterDsxBuffer(struct bcm_mini_adapter *Adapter) * Need to Allocate memory to contain the SUPER Large structures * Our driver can't create these structures on Stack */ - Adapter->caDsxReqResp = kmalloc(sizeof(struct bcm_add_indication_alt)+LEADER_SIZE, GFP_KERNEL); + Adapter->caDsxReqResp = kmalloc(sizeof(struct bcm_add_indication_alt) + + LEADER_SIZE, GFP_KERNEL); if (!Adapter->caDsxReqResp) return -ENOMEM; @@ -1867,29 +2057,37 @@ bool CmControlResponseMessage(struct bcm_mini_adapter *Adapter, /* <Pointer to return TRUE; } -int get_dsx_sf_data_to_application(struct bcm_mini_adapter *Adapter, UINT uiSFId, void __user *user_buffer) +int get_dsx_sf_data_to_application(struct bcm_mini_adapter *Adapter, + UINT uiSFId, void __user *user_buffer) { int status = 0; struct bcm_packet_info *psSfInfo = NULL; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "status =%d", status); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "status =%d", status); status = SearchSfid(Adapter, uiSFId); if (status >= NO_OF_QUEUES) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SFID %d not present in queue !!!", uiSFId); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "SFID %d not present in queue !!!", uiSFId); return -EINVAL; } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "status =%d", status); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "status =%d", status); psSfInfo = &Adapter->PackInfo[status]; - if (psSfInfo->pstSFIndication && copy_to_user(user_buffer, - psSfInfo->pstSFIndication, sizeof(struct bcm_add_indication_alt))) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "copy to user failed SFID %d, present in queue !!!", uiSFId); + if (psSfInfo->pstSFIndication + && copy_to_user(user_buffer, psSfInfo->pstSFIndication, + sizeof(struct bcm_add_indication_alt))) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "copy to user failed SFID %d, present in queue !!!", + uiSFId); status = -EFAULT; return status; } return STATUS_SUCCESS; } -VOID OverrideServiceFlowParams(struct bcm_mini_adapter *Adapter, PUINT puiBuffer) +VOID OverrideServiceFlowParams(struct bcm_mini_adapter *Adapter, + PUINT puiBuffer) { B_UINT32 u32NumofSFsinMsg = ntohl(*(puiBuffer + 1)); struct bcm_stim_sfhostnotify *pHostInfo = NULL; @@ -1897,7 +2095,8 @@ VOID OverrideServiceFlowParams(struct bcm_mini_adapter *Adapter, PUINT puiBuffer ULONG ulSFID = 0; puiBuffer += 2; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "u32NumofSFsinMsg: 0x%x\n", u32NumofSFsinMsg); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "u32NumofSFsinMsg: 0x%x\n", u32NumofSFsinMsg); while (u32NumofSFsinMsg != 0 && u32NumofSFsinMsg < NO_OF_QUEUES) { u32NumofSFsinMsg--; @@ -1906,31 +2105,149 @@ VOID OverrideServiceFlowParams(struct bcm_mini_adapter *Adapter, PUINT puiBuffer ulSFID = ntohl(pHostInfo->SFID); uiSearchRuleIndex = SearchSfid(Adapter, ulSFID); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SFID: 0x%lx\n", ulSFID); - - if (uiSearchRuleIndex >= NO_OF_QUEUES || uiSearchRuleIndex == HiPriority) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "The SFID <%lx> doesn't exist in host entry or is Invalid\n", ulSFID); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "SFID: 0x%lx\n", ulSFID); + + if (uiSearchRuleIndex >= NO_OF_QUEUES + || uiSearchRuleIndex == HiPriority) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, + DBG_LVL_ALL, + "The SFID <%lx> doesn't exist in host entry or is Invalid\n", + ulSFID); continue; } if (pHostInfo->RetainSF == false) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Going to Delete SF"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, + DBG_LVL_ALL, "Going to Delete SF"); deleteSFBySfid(Adapter, uiSearchRuleIndex); } else { - Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value = ntohs(pHostInfo->VCID); - Adapter->PackInfo[uiSearchRuleIndex].usCID = ntohs(pHostInfo->newCID); - Adapter->PackInfo[uiSearchRuleIndex].bActive = false; + struct bcm_packet_info *packinfo = + &Adapter->PackInfo[uiSearchRuleIndex]; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "pHostInfo->QoSParamSet: 0x%x\n", pHostInfo->QoSParamSet); + packinfo->usVCID_Value = ntohs(pHostInfo->VCID); + packinfo->usCID = ntohs(pHostInfo->newCID); + packinfo->bActive = false; + + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, + DBG_LVL_ALL, + "pHostInfo->QoSParamSet: 0x%x\n", + pHostInfo->QoSParamSet); if (pHostInfo->QoSParamSet & 0x1) - Adapter->PackInfo[uiSearchRuleIndex].bAuthorizedSet = TRUE; + packinfo->bAuthorizedSet = TRUE; if (pHostInfo->QoSParamSet & 0x2) - Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet = TRUE; + packinfo->bAdmittedSet = TRUE; if (pHostInfo->QoSParamSet & 0x4) { - Adapter->PackInfo[uiSearchRuleIndex].bActiveSet = TRUE; - Adapter->PackInfo[uiSearchRuleIndex].bActive = TRUE; + packinfo->bActiveSet = TRUE; + packinfo->bActive = TRUE; + } + } + } +} + +static void restore_endianess_of_pstClassifierEntry( + struct bcm_classifier_rule *pstClassifierEntry, + enum bcm_ipaddr_context eIpAddrContext) +{ + int i; + union u_ip_address *stSrc = &pstClassifierEntry->stSrcIpAddress; + union u_ip_address *stDest = &pstClassifierEntry->stDestIpAddress; + + for (i = 0; i < MAX_IP_RANGE_LENGTH * 4; i++) { + if (eIpAddrContext == eSrcIpAddress) { + stSrc->ulIpv6Addr[i] = ntohl(stSrc->ulIpv6Addr[i]); + stSrc->ulIpv6Mask[i] = ntohl(stSrc->ulIpv6Mask[i]); + } else if (eIpAddrContext == eDestIpAddress) { + stDest->ulIpv6Addr[i] = ntohl(stDest->ulIpv6Addr[i]); + stDest->ulIpv6Mask[i] = ntohl(stDest->ulIpv6Mask[i]); + } + } +} + +static void apply_phs_rule_to_all_classifiers( + register struct bcm_mini_adapter *Adapter, /* <Pointer to the Adapter structure */ + register UINT uiSearchRuleIndex, /* <Index of Queue, to which this data belongs */ + USHORT uVCID, + struct bcm_phs_rule *sPhsRule, + struct bcm_phs_rules *cPhsRule, + struct bcm_add_indication_alt *pstAddIndication) +{ + unsigned int uiClassifierIndex = 0; + struct bcm_classifier_rule *curr_classifier = NULL; + + if (pstAddIndication->u8Direction == UPLINK_DIR) { + for (uiClassifierIndex = 0; uiClassifierIndex < MAX_CLASSIFIERS; uiClassifierIndex++) { + curr_classifier = + &Adapter->astClassifierTable[uiClassifierIndex]; + if ((curr_classifier->bUsed) && + (curr_classifier->ulSFID == Adapter->PackInfo[uiSearchRuleIndex].ulSFID) && + (curr_classifier->u8AssociatedPHSI == cPhsRule->u8PHSI)) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Adding PHS Rule For Classifier: 0x%x cPhsRule.u8PHSI: 0x%x\n", + curr_classifier->uiClassifierRuleIndex, + cPhsRule->u8PHSI); + /* Update The PHS Rule for this classifier as Associated PHSI id defined */ + + /* Copy the PHS Rule */ + sPhsRule->u8PHSI = cPhsRule->u8PHSI; + sPhsRule->u8PHSFLength = cPhsRule->u8PHSFLength; + sPhsRule->u8PHSMLength = cPhsRule->u8PHSMLength; + sPhsRule->u8PHSS = cPhsRule->u8PHSS; + sPhsRule->u8PHSV = cPhsRule->u8PHSV; + memcpy(sPhsRule->u8PHSF, cPhsRule->u8PHSF, MAX_PHS_LENGTHS); + memcpy(sPhsRule->u8PHSM, cPhsRule->u8PHSM, MAX_PHS_LENGTHS); + sPhsRule->u8RefCnt = 0; + sPhsRule->bUnclassifiedPHSRule = false; + sPhsRule->PHSModifiedBytes = 0; + sPhsRule->PHSModifiedNumPackets = 0; + sPhsRule->PHSErrorNumPackets = 0; + + /* bPHSRuleAssociated = TRUE; */ + /* Store The PHS Rule for this classifier */ + + PhsUpdateClassifierRule( + &Adapter->stBCMPhsContext, + uVCID, + curr_classifier->uiClassifierRuleIndex, + sPhsRule, + curr_classifier->u8AssociatedPHSI); + + /* Update PHS Rule For the Classifier */ + if (sPhsRule->u8PHSI) { + curr_classifier->u32PHSRuleID = sPhsRule->u8PHSI; + memcpy(&curr_classifier->sPhsRule, sPhsRule, sizeof(struct bcm_phs_rule)); + } } } + } else { + /* Error PHS Rule specified in signaling could not be applied to any classifier */ + + /* Copy the PHS Rule */ + sPhsRule->u8PHSI = cPhsRule->u8PHSI; + sPhsRule->u8PHSFLength = cPhsRule->u8PHSFLength; + sPhsRule->u8PHSMLength = cPhsRule->u8PHSMLength; + sPhsRule->u8PHSS = cPhsRule->u8PHSS; + sPhsRule->u8PHSV = cPhsRule->u8PHSV; + memcpy(sPhsRule->u8PHSF, cPhsRule->u8PHSF, MAX_PHS_LENGTHS); + memcpy(sPhsRule->u8PHSM, cPhsRule->u8PHSM, MAX_PHS_LENGTHS); + sPhsRule->u8RefCnt = 0; + sPhsRule->bUnclassifiedPHSRule = TRUE; + sPhsRule->PHSModifiedBytes = 0; + sPhsRule->PHSModifiedNumPackets = 0; + sPhsRule->PHSErrorNumPackets = 0; + /* Store The PHS Rule for this classifier */ + + /* + * Passing the argument u8PHSI instead of clsid. Because for DL with no classifier rule, + * clsid will be zero hence we can't have multiple PHS rules for the same SF. + * To support multiple PHS rule, passing u8PHSI. + */ + PhsUpdateClassifierRule( + &Adapter->stBCMPhsContext, + uVCID, + sPhsRule->u8PHSI, + sPhsRule, + sPhsRule->u8PHSI); } } |