beceem: get rid of unnecessary inline usage
[linux-2.6-microblaze.git] / drivers / staging / bcm / CmHost.c
1 /************************************************************
2 *                       CMHOST.C
3 *       This file contains the routines for handling Connnection
4 *       Management.
5 ************************************************************/
6
7 //#define CONN_MSG
8 #include "headers.h"
9
10 typedef enum _E_CLASSIFIER_ACTION
11 {
12         eInvalidClassifierAction,
13         eAddClassifier,
14         eReplaceClassifier,
15         eDeleteClassifier
16 }E_CLASSIFIER_ACTION;
17
18
19 /************************************************************
20 * Function        -     SearchSfid
21 *
22 * Description - This routinue would search QOS queues having
23 *                               specified SFID as input parameter.
24 *
25 * Parameters  - Adapter: Pointer to the Adapter structure
26 *                               uiSfid : Given SFID for matching
27 *
28 * Returns         - Queue index for this SFID(If matched)
29                                 Else Invalid Queue Index(If Not matched)
30 ************************************************************/
31 INT SearchSfid(PMINI_ADAPTER Adapter,UINT uiSfid)
32 {
33         INT     iIndex=0;
34         for(iIndex=(NO_OF_QUEUES-1); iIndex>=0; iIndex--)
35                 if(Adapter->PackInfo[iIndex].ulSFID==uiSfid)
36                         return iIndex;
37         return NO_OF_QUEUES+1;
38 }
39
40 /***************************************************************
41 * Function        -     SearchFreeSfid
42 *
43 * Description - This routinue would search Free available SFID.
44 *
45 * Parameter   - Adapter: Pointer to the Adapter structure
46 *
47 * Returns         - Queue index for the free SFID
48 *                               Else returns Invalid Index.
49 ****************************************************************/
50 static INT SearchFreeSfid(PMINI_ADAPTER Adapter)
51 {
52         UINT    uiIndex=0;
53
54         for(uiIndex=0; uiIndex < (NO_OF_QUEUES-1); uiIndex++)
55                 if(Adapter->PackInfo[uiIndex].ulSFID==0)
56                         return uiIndex;
57         return NO_OF_QUEUES+1;
58 }
59
60 int SearchVcid(PMINI_ADAPTER Adapter,unsigned short usVcid)
61 {
62         int iIndex=0;
63
64         for(iIndex=(NO_OF_QUEUES-1);iIndex>=0;iIndex--)
65                 if(Adapter->PackInfo[iIndex].usVCID_Value == usVcid)
66                         return iIndex;
67         return NO_OF_QUEUES+1;
68
69 }
70
71
72 /*
73 Function:                               SearchClsid
74 Description:                    This routinue would search Classifier  having specified ClassifierID as input parameter
75 Input parameters:               PMINI_ADAPTER Adapter - Adapter Context
76                         unsigned int uiSfid   - The SF in which the classifier is to searched
77                                                 B_UINT16  uiClassifierID - The classifier ID to be searched
78 Return:                                 int :Classifier table index of matching entry
79 */
80
81 static int SearchClsid(PMINI_ADAPTER Adapter,ULONG ulSFID,B_UINT16  uiClassifierID)
82 {
83         unsigned int uiClassifierIndex = 0;
84         for(uiClassifierIndex=0;uiClassifierIndex<MAX_CLASSIFIERS;uiClassifierIndex++)
85         {
86                 if((Adapter->astClassifierTable[uiClassifierIndex].bUsed) &&
87                         (Adapter->astClassifierTable[uiClassifierIndex].uiClassifierRuleIndex == uiClassifierID)&&
88                         (Adapter->astClassifierTable[uiClassifierIndex].ulSFID == ulSFID))
89                         return uiClassifierIndex;
90         }
91         return MAX_CLASSIFIERS+1;
92 }
93
94 /**
95 @ingroup ctrl_pkt_functions
96 This routinue would search Free available Classifier entry in classifier table.
97 @return free Classifier Entry index in classifier table for specified SF
98 */
99 static int SearchFreeClsid(PMINI_ADAPTER Adapter /**Adapter Context*/
100                                                 )
101 {
102         unsigned int uiClassifierIndex = 0;
103         for(uiClassifierIndex=0;uiClassifierIndex<MAX_CLASSIFIERS;uiClassifierIndex++)
104         {
105                 if(!Adapter->astClassifierTable[uiClassifierIndex].bUsed)
106                         return uiClassifierIndex;
107         }
108         return MAX_CLASSIFIERS+1;
109 }
110
111 VOID deleteSFBySfid(PMINI_ADAPTER Adapter, UINT uiSearchRuleIndex)
112 {
113         //deleting all the packet held in the SF
114         flush_queue(Adapter,uiSearchRuleIndex);
115
116         //Deleting the all classifiers for this SF
117         DeleteAllClassifiersForSF(Adapter,uiSearchRuleIndex);
118
119         //Resetting only MIBS related entries in the SF
120         memset((PVOID)&Adapter->PackInfo[uiSearchRuleIndex], 0, sizeof(S_MIBS_SERVICEFLOW_TABLE));
121 }
122
123 static inline VOID
124 CopyIpAddrToClassifier(S_CLASSIFIER_RULE *pstClassifierEntry ,
125                         B_UINT8 u8IpAddressLen , B_UINT8 *pu8IpAddressMaskSrc ,
126                         BOOLEAN bIpVersion6 , E_IPADDR_CONTEXT eIpAddrContext)
127 {
128         UINT    ucLoopIndex=0;
129         UINT    nSizeOfIPAddressInBytes = IP_LENGTH_OF_ADDRESS;
130         UCHAR   *ptrClassifierIpAddress = NULL;
131         UCHAR   *ptrClassifierIpMask = NULL;
132     PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
133
134         if(bIpVersion6)
135         {
136                 nSizeOfIPAddressInBytes = IPV6_ADDRESS_SIZEINBYTES;
137         }
138         //Destination Ip Address
139         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Ip Address Range Length:0x%X ",
140                                 u8IpAddressLen);
141         if((bIpVersion6?(IPV6_ADDRESS_SIZEINBYTES * MAX_IP_RANGE_LENGTH * 2):
142                         (TOTAL_MASKED_ADDRESS_IN_BYTES)) >= u8IpAddressLen)
143         {
144                 /*
145                 //checking both the mask and address togethor in Classification.
146                 //So length will be : TotalLengthInBytes/nSizeOfIPAddressInBytes * 2
147                 //(nSizeOfIPAddressInBytes for address and nSizeOfIPAddressInBytes for mask)
148                 */
149                 if(eIpAddrContext == eDestIpAddress)
150                 {
151                         pstClassifierEntry->ucIPDestinationAddressLength =
152                                         u8IpAddressLen/(nSizeOfIPAddressInBytes * 2);
153                         if(bIpVersion6)
154                         {
155                                 ptrClassifierIpAddress =
156                                         pstClassifierEntry->stDestIpAddress.ucIpv6Address;
157                                 ptrClassifierIpMask =
158                                         pstClassifierEntry->stDestIpAddress.ucIpv6Mask;
159                         }
160                         else
161                         {
162                                 ptrClassifierIpAddress =
163                                         pstClassifierEntry->stDestIpAddress.ucIpv4Address;
164                                 ptrClassifierIpMask =
165                                         pstClassifierEntry->stDestIpAddress.ucIpv4Mask;
166                         }
167                 }
168                 else if(eIpAddrContext == eSrcIpAddress)
169                 {
170                         pstClassifierEntry->ucIPSourceAddressLength =
171                                         u8IpAddressLen/(nSizeOfIPAddressInBytes * 2);
172                         if(bIpVersion6)
173                         {
174                                 ptrClassifierIpAddress =
175                                         pstClassifierEntry->stSrcIpAddress.ucIpv6Address;
176                                 ptrClassifierIpMask =
177                                         pstClassifierEntry->stSrcIpAddress.ucIpv6Mask;
178                         }
179                         else
180                         {
181                                 ptrClassifierIpAddress =
182                                         pstClassifierEntry->stSrcIpAddress.ucIpv4Address;
183                                 ptrClassifierIpMask =
184                                         pstClassifierEntry->stSrcIpAddress.ucIpv4Mask;
185                         }
186                 }
187                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Address Length:0x%X \n",
188                                 pstClassifierEntry->ucIPDestinationAddressLength);
189                 while((u8IpAddressLen>= nSizeOfIPAddressInBytes) &&
190                                 (ucLoopIndex < MAX_IP_RANGE_LENGTH))
191                 {
192                         memcpy(ptrClassifierIpAddress +
193                                 (ucLoopIndex * nSizeOfIPAddressInBytes),
194                                 (pu8IpAddressMaskSrc+(ucLoopIndex*nSizeOfIPAddressInBytes*2)),
195                                 nSizeOfIPAddressInBytes);
196                         if(!bIpVersion6)
197                         {
198                                 if(eIpAddrContext == eSrcIpAddress)
199                                 {
200                                         pstClassifierEntry->stSrcIpAddress.ulIpv4Addr[ucLoopIndex]=
201                                                 ntohl(pstClassifierEntry->stSrcIpAddress.
202                                                                 ulIpv4Addr[ucLoopIndex]);
203                                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Src Ip Address:0x%luX ",pstClassifierEntry->stSrcIpAddress.ulIpv4Addr[ucLoopIndex]);
204                                 }
205                                 else if(eIpAddrContext == eDestIpAddress)
206                                 {
207                                         pstClassifierEntry->stDestIpAddress.ulIpv4Addr[ucLoopIndex]=                                            ntohl(pstClassifierEntry->stDestIpAddress.
208                                                                 ulIpv4Addr[ucLoopIndex]);
209                                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Dest Ip Address:0x%luX ",pstClassifierEntry->stDestIpAddress.ulIpv4Addr[ucLoopIndex]);
210                                 }
211                         }
212                         u8IpAddressLen-=nSizeOfIPAddressInBytes;
213                         if(u8IpAddressLen >= nSizeOfIPAddressInBytes)
214                         {
215                                 memcpy(ptrClassifierIpMask +
216                                         (ucLoopIndex * nSizeOfIPAddressInBytes),
217                                         (pu8IpAddressMaskSrc+nSizeOfIPAddressInBytes +
218                                         (ucLoopIndex*nSizeOfIPAddressInBytes*2)),
219                                         nSizeOfIPAddressInBytes);
220                                 if(!bIpVersion6)
221                                 {
222                                         if(eIpAddrContext == eSrcIpAddress)
223                                         {
224                                                 pstClassifierEntry->stSrcIpAddress.
225                                                                                         ulIpv4Mask[ucLoopIndex]=
226                                                                 ntohl(pstClassifierEntry->stSrcIpAddress.
227                                                                                         ulIpv4Mask[ucLoopIndex]);
228                                                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Src Ip Mask Address:0x%luX ",pstClassifierEntry->stSrcIpAddress.ulIpv4Mask[ucLoopIndex]);
229                                         }
230                                         else if(eIpAddrContext == eDestIpAddress)
231                                         {
232                                                 pstClassifierEntry->stDestIpAddress.
233                                                                                 ulIpv4Mask[ucLoopIndex] =
234                                                                         ntohl(pstClassifierEntry->stDestIpAddress.
235                                                                                         ulIpv4Mask[ucLoopIndex]);
236                                                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Dest Ip Mask Address:0x%luX ",pstClassifierEntry->stDestIpAddress.ulIpv4Mask[ucLoopIndex]);
237                                         }
238                                 }
239                                 u8IpAddressLen-=nSizeOfIPAddressInBytes;
240                         }
241                         if(0==u8IpAddressLen)
242                         {
243                                 pstClassifierEntry->bDestIpValid=TRUE;
244                         }
245                         ucLoopIndex++;
246                 }
247                 if(bIpVersion6)
248                 {
249                         //Restore EndianNess of Struct
250                         for(ucLoopIndex =0 ; ucLoopIndex < MAX_IP_RANGE_LENGTH * 4 ;
251                                         ucLoopIndex++)
252                         {
253                                 if(eIpAddrContext == eSrcIpAddress)
254                                 {
255                                         pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[ucLoopIndex]=
256                                                         ntohl(pstClassifierEntry->stSrcIpAddress.
257                                                         ulIpv6Addr[ucLoopIndex]);
258                                         pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[ucLoopIndex]=                                                     ntohl(pstClassifierEntry->stSrcIpAddress.
259                                                         ulIpv6Mask[ucLoopIndex]);
260                                 }
261                                 else if(eIpAddrContext == eDestIpAddress)
262                                 {
263                                         pstClassifierEntry->stDestIpAddress.ulIpv6Addr[ucLoopIndex]=                                                    ntohl(pstClassifierEntry->stDestIpAddress.
264                                                         ulIpv6Addr[ucLoopIndex]);
265                                         pstClassifierEntry->stDestIpAddress.ulIpv6Mask[ucLoopIndex]=                                                    ntohl(pstClassifierEntry->stDestIpAddress.
266                                                         ulIpv6Mask[ucLoopIndex]);
267                                 }
268                         }
269                 }
270         }
271 }
272
273
274 void ClearTargetDSXBuffer(PMINI_ADAPTER Adapter,B_UINT16 TID,BOOLEAN bFreeAll)
275 {
276     ULONG ulIndex;
277         for(ulIndex=0; ulIndex < Adapter->ulTotalTargetBuffersAvailable; ulIndex++)
278         {
279                 if(Adapter->astTargetDsxBuffer[ulIndex].valid)
280                         continue;
281         if ((bFreeAll) || (Adapter->astTargetDsxBuffer[ulIndex].tid == TID)){
282                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "ClearTargetDSXBuffer: found tid %d buffer cleared %lx\n",
283                                 TID, Adapter->astTargetDsxBuffer[ulIndex].ulTargetDsxBuffer);
284                         Adapter->astTargetDsxBuffer[ulIndex].valid=1;
285                         Adapter->astTargetDsxBuffer[ulIndex].tid=0;
286                         Adapter->ulFreeTargetBufferCnt++;
287         }
288         }
289 }
290
291 /**
292 @ingroup ctrl_pkt_functions
293 copy classifier rule into the specified SF index
294 */
295 static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter,stConvergenceSLTypes  *psfCSType,UINT uiSearchRuleIndex,UINT nClassifierIndex)
296 {
297         S_CLASSIFIER_RULE *pstClassifierEntry = NULL;
298         //VOID *pvPhsContext = NULL;
299         UINT    ucLoopIndex=0;
300         //UCHAR   ucProtocolLength=0;
301         //ULONG   ulPhsStatus;
302
303
304         if(Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value == 0 ||
305                 nClassifierIndex > (MAX_CLASSIFIERS-1))
306                 return;
307
308
309         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Storing Classifier Rule Index : %X",ntohs(psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex));
310
311         if(nClassifierIndex > MAX_CLASSIFIERS-1)
312                 return;
313
314         pstClassifierEntry = &Adapter->astClassifierTable[nClassifierIndex];
315         if(pstClassifierEntry)
316         {
317                 //Store if Ipv6
318                 pstClassifierEntry->bIpv6Protocol =
319                 (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6)?TRUE:FALSE;
320
321                 //Destinaiton Port
322                 pstClassifierEntry->ucDestPortRangeLength=psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength/4;
323                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Destination Port Range Length:0x%X ",pstClassifierEntry->ucDestPortRangeLength);
324                 if(     MAX_PORT_RANGE >= psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength)
325                 {
326                         for(ucLoopIndex=0;ucLoopIndex<(pstClassifierEntry->ucDestPortRangeLength);ucLoopIndex++)
327                         {
328                                 pstClassifierEntry->usDestPortRangeLo[ucLoopIndex] =
329                                         *((PUSHORT)(psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange+ucLoopIndex));
330                                 pstClassifierEntry->usDestPortRangeHi[ucLoopIndex] =
331                                         *((PUSHORT)(psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange+2+ucLoopIndex));
332                                 pstClassifierEntry->usDestPortRangeLo[ucLoopIndex]=ntohs(pstClassifierEntry->usDestPortRangeLo[ucLoopIndex]);
333                                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Destination Port Range Lo:0x%X ",pstClassifierEntry->usDestPortRangeLo[ucLoopIndex]);
334                                 pstClassifierEntry->usDestPortRangeHi[ucLoopIndex]=ntohs(pstClassifierEntry->usDestPortRangeHi[ucLoopIndex]);
335                         }
336                 }
337                 else
338                 {
339                         pstClassifierEntry->ucDestPortRangeLength=0;
340                 }
341                 //Source Port
342                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Source Port Range Length:0x%X ",psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength);
343                 if(MAX_PORT_RANGE >=
344                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength)
345                 {
346                         pstClassifierEntry->ucSrcPortRangeLength =
347                                 psfCSType->cCPacketClassificationRule.
348                                                 u8ProtocolSourcePortRangeLength/4;
349                         for(ucLoopIndex = 0; ucLoopIndex <
350                                 (pstClassifierEntry->ucSrcPortRangeLength); ucLoopIndex++)
351                         {
352                                 pstClassifierEntry->usSrcPortRangeLo[ucLoopIndex] =
353                                                 *((PUSHORT)(psfCSType->cCPacketClassificationRule.
354                                                         u8ProtocolSourcePortRange+ucLoopIndex));
355                                 pstClassifierEntry->usSrcPortRangeHi[ucLoopIndex] =
356                                                 *((PUSHORT)(psfCSType->cCPacketClassificationRule.
357                                                         u8ProtocolSourcePortRange+2+ucLoopIndex));
358                                 pstClassifierEntry->usSrcPortRangeLo[ucLoopIndex] =
359                                         ntohs(pstClassifierEntry->usSrcPortRangeLo[ucLoopIndex]);
360                                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Source Port Range Lo:0x%X ",pstClassifierEntry->usSrcPortRangeLo[ucLoopIndex]);
361                                 pstClassifierEntry->usSrcPortRangeHi[ucLoopIndex]=ntohs(pstClassifierEntry->usSrcPortRangeHi[ucLoopIndex]);
362                         }
363                 }
364                 //Destination Ip Address and Mask
365                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Ip Destination Parameters : ");
366
367                 CopyIpAddrToClassifier(pstClassifierEntry,
368                    psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength,
369                    psfCSType->cCPacketClassificationRule.u8IPDestinationAddress,
370                    (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6)?
371                         TRUE:FALSE, eDestIpAddress);
372
373                 //Source Ip Address and Mask
374                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Ip Source Parameters : ");
375
376                 CopyIpAddrToClassifier(pstClassifierEntry,
377                 psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength,
378                 psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress,
379                 (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6)?TRUE:FALSE,
380                 eSrcIpAddress);
381
382                 //TOS
383                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"TOS Length:0x%X ",psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength);
384                 if(3 == psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength)
385                 {
386                         pstClassifierEntry->ucIPTypeOfServiceLength =
387                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength;
388                         pstClassifierEntry->ucTosLow =
389                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0];
390                         pstClassifierEntry->ucTosHigh =
391                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1];
392                         pstClassifierEntry->ucTosMask =
393                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2];
394                         pstClassifierEntry->bTOSValid = TRUE;
395                 }
396                 if(psfCSType->cCPacketClassificationRule.u8Protocol == 0)
397                 {
398                         //we didnt get protocol field filled in by the BS
399                         pstClassifierEntry->ucProtocolLength=0;
400                 }
401                 else
402                 {
403                         pstClassifierEntry->ucProtocolLength=1;// 1 valid protocol
404                 }
405
406                 pstClassifierEntry->ucProtocol[0] =
407                         psfCSType->cCPacketClassificationRule.u8Protocol;
408
409                 pstClassifierEntry->u8ClassifierRulePriority =
410                         psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority;
411
412                 //store the classifier rule ID and set this classifier entry as valid
413                 pstClassifierEntry->ucDirection =
414                         Adapter->PackInfo[uiSearchRuleIndex].ucDirection;
415                 pstClassifierEntry->uiClassifierRuleIndex = ntohs(psfCSType->
416                                 cCPacketClassificationRule.u16PacketClassificationRuleIndex);
417                 pstClassifierEntry->usVCID_Value =
418                         Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value;
419                 pstClassifierEntry->ulSFID =
420                         Adapter->PackInfo[uiSearchRuleIndex].ulSFID;
421                 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Search Index %d Dir: %d, Index: %d, Vcid: %d\n",
422                         uiSearchRuleIndex, pstClassifierEntry->ucDirection,
423                         pstClassifierEntry->uiClassifierRuleIndex,
424                         pstClassifierEntry->usVCID_Value);
425
426                 if(psfCSType->cCPacketClassificationRule.u8AssociatedPHSI)
427                 {
428                         pstClassifierEntry->u8AssociatedPHSI = psfCSType->cCPacketClassificationRule.u8AssociatedPHSI;
429                 }
430
431                 //Copy ETH CS Parameters
432                 pstClassifierEntry->ucEthCSSrcMACLen = (psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddressLength);
433                 memcpy(pstClassifierEntry->au8EThCSSrcMAC,psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress,MAC_ADDRESS_SIZE);
434                 memcpy(pstClassifierEntry->au8EThCSSrcMACMask,psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress+MAC_ADDRESS_SIZE,MAC_ADDRESS_SIZE);
435                 pstClassifierEntry->ucEthCSDestMACLen = (psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
436                 memcpy(pstClassifierEntry->au8EThCSDestMAC,psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress,MAC_ADDRESS_SIZE);
437                 memcpy(pstClassifierEntry->au8EThCSDestMACMask,psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress+MAC_ADDRESS_SIZE,MAC_ADDRESS_SIZE);
438                 pstClassifierEntry->ucEtherTypeLen = (psfCSType->cCPacketClassificationRule.u8EthertypeLength);
439                 memcpy(pstClassifierEntry->au8EthCSEtherType,psfCSType->cCPacketClassificationRule.u8Ethertype,NUM_ETHERTYPE_BYTES);
440                 memcpy(pstClassifierEntry->usUserPriority, &psfCSType->cCPacketClassificationRule.u16UserPriority, 2);
441                 pstClassifierEntry->usVLANID = ntohs(psfCSType->cCPacketClassificationRule.u16VLANID);
442                 pstClassifierEntry->usValidityBitMap = ntohs(psfCSType->cCPacketClassificationRule.u16ValidityBitMap);
443
444                 pstClassifierEntry->bUsed = TRUE;
445         }
446 }
447
448
449 /**
450 @ingroup ctrl_pkt_functions
451 */
452 static inline VOID DeleteClassifierRuleFromSF(PMINI_ADAPTER Adapter,UINT uiSearchRuleIndex,UINT nClassifierIndex)
453 {
454         S_CLASSIFIER_RULE *pstClassifierEntry = NULL;
455         B_UINT16  u16PacketClassificationRuleIndex;
456         USHORT    usVCID;
457         //VOID *pvPhsContext = NULL;
458         //ULONG ulPhsStatus;
459
460         usVCID = Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value;
461
462         if(nClassifierIndex > MAX_CLASSIFIERS-1)
463                 return;
464
465         if(usVCID == 0)
466                 return;
467
468         u16PacketClassificationRuleIndex = Adapter->astClassifierTable[nClassifierIndex].uiClassifierRuleIndex;
469
470
471         pstClassifierEntry = &Adapter->astClassifierTable[nClassifierIndex];
472         if(pstClassifierEntry)
473         {
474                 pstClassifierEntry->bUsed = FALSE;
475                 pstClassifierEntry->uiClassifierRuleIndex = 0;
476                 memset(pstClassifierEntry,0,sizeof(S_CLASSIFIER_RULE));
477
478                 //Delete the PHS Rule for this classifier
479                 PhsDeleteClassifierRule(
480                                 &Adapter->stBCMPhsContext,
481                                 usVCID,
482                                 u16PacketClassificationRuleIndex);
483         }
484 }
485
486 /**
487 @ingroup ctrl_pkt_functions
488 */
489 VOID DeleteAllClassifiersForSF(PMINI_ADAPTER Adapter,UINT uiSearchRuleIndex)
490 {
491         S_CLASSIFIER_RULE *pstClassifierEntry = NULL;
492         UINT nClassifierIndex;
493         //B_UINT16  u16PacketClassificationRuleIndex;
494         USHORT    ulVCID;
495         //VOID    *pvPhsContext = NULL;
496         //ULONG    ulPhsStatus;
497
498         ulVCID = Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value;
499
500         if(ulVCID == 0)
501                 return;
502
503
504         for(nClassifierIndex =0 ; nClassifierIndex < MAX_CLASSIFIERS ; nClassifierIndex++)
505         {
506                 if(Adapter->astClassifierTable[nClassifierIndex].usVCID_Value == ulVCID)
507                 {
508                         pstClassifierEntry = &Adapter->astClassifierTable[nClassifierIndex];
509                         if(pstClassifierEntry->bUsed)
510                         {
511                                 DeleteClassifierRuleFromSF(Adapter,uiSearchRuleIndex,nClassifierIndex);
512                         }
513                 }
514         }
515
516         //Delete All Phs Rules Associated with this SF
517         PhsDeleteSFRules(
518                         &Adapter->stBCMPhsContext,
519                         ulVCID);
520
521 }
522
523
524 /**
525 This routinue  copies the Connection Management
526 related data into the Adapter structure.
527 @ingroup ctrl_pkt_functions
528 */
529
530 static VOID CopyToAdapter( register PMINI_ADAPTER Adapter,              /**<Pointer to the Adapter structure*/
531                                         register pstServiceFlowParamSI psfLocalSet,     /**<Pointer to the ServiceFlowParamSI structure*/
532                                         register UINT uiSearchRuleIndex,                        /**<Index of Queue, to which this data belongs*/
533                                         register UCHAR ucDsxType,
534                                         stLocalSFAddIndicationAlt *pstAddIndication)
535 {
536         //UCHAR   ucProtocolLength=0;
537         ULONG   ulSFID;
538         UINT    nClassifierIndex = 0;
539         E_CLASSIFIER_ACTION eClassifierAction = eInvalidClassifierAction;
540         B_UINT16  u16PacketClassificationRuleIndex=0;
541         UINT     nIndex=0;
542         stConvergenceSLTypes *psfCSType = NULL;
543         S_PHS_RULE sPhsRule;
544         USHORT uVCID = Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value;
545         UINT UGIValue = 0;
546
547
548         Adapter->PackInfo[uiSearchRuleIndex].bValid=TRUE;
549         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Search Rule Index = %d\n", uiSearchRuleIndex);
550         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"%s: SFID= %x ",__FUNCTION__, ntohl(psfLocalSet->u32SFID));
551         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Updating Queue %d",uiSearchRuleIndex);
552
553         ulSFID = ntohl(psfLocalSet->u32SFID);
554         //Store IP Version used
555         //Get The Version Of IP used (IPv6 or IPv4) from CSSpecification field of SF
556
557         Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = 0;
558         Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = 0;
559
560         /*Enable IP/ETh CS Support As Required*/
561         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"CopyToAdapter : u8CSSpecification : %X\n",psfLocalSet->u8CSSpecification);
562         switch(psfLocalSet->u8CSSpecification)
563         {
564                 case eCSPacketIPV4:
565                 {
566                         Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS;
567                         break;
568                 }
569                 case eCSPacketIPV6:
570                 {
571                         Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV6_CS;
572                         break;
573                 }
574
575                 case eCS802_3PacketEthernet:
576                 case eCS802_1QPacketVLAN:
577                 {
578                         Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3;
579                         break;
580                 }
581
582                 case eCSPacketIPV4Over802_1QVLAN:
583                 case eCSPacketIPV4Over802_3Ethernet:
584                 {
585                         Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS;
586                         Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3;
587                         break;
588                 }
589
590                 case eCSPacketIPV6Over802_1QVLAN:
591                 case eCSPacketIPV6Over802_3Ethernet:
592                 {
593                         Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV6_CS;
594                         Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3;
595                         break;
596                 }
597
598                 default:
599                 {
600             BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Error in value of CS Classification.. setting default to IP CS\n");
601                         Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS;
602                         break;
603                 }
604         }
605
606     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",
607                 uiSearchRuleIndex,
608                 Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport,
609                 Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport);
610
611         //Store IP Version used
612         //Get The Version Of IP used (IPv6 or IPv4) from CSSpecification field of SF
613         if(Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport == IPV6_CS)
614         {
615                 Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion = IPV6;
616         }
617         else
618         {
619                 Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion = IPV4;
620         }
621
622         /* To ensure that the ETH CS code doesn't gets executed if the BS doesn't supports ETH CS */
623         if(!Adapter->bETHCSEnabled)
624                 Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = 0;
625
626         if(psfLocalSet->u8ServiceClassNameLength > 0 &&
627                         psfLocalSet->u8ServiceClassNameLength < 32)
628         {
629                 memcpy(Adapter->PackInfo[uiSearchRuleIndex].ucServiceClassName,
630                         psfLocalSet->u8ServiceClassName,
631                         psfLocalSet->u8ServiceClassNameLength);
632         }
633         Adapter->PackInfo[uiSearchRuleIndex].u8QueueType =
634                         psfLocalSet->u8ServiceFlowSchedulingType;
635
636         if(Adapter->PackInfo[uiSearchRuleIndex].u8QueueType==BE &&
637                         Adapter->PackInfo[uiSearchRuleIndex].ucDirection)
638         {
639                 Adapter->usBestEffortQueueIndex=uiSearchRuleIndex;
640         }
641
642         Adapter->PackInfo[uiSearchRuleIndex].ulSFID = ntohl(psfLocalSet->u32SFID);
643
644         Adapter->PackInfo[uiSearchRuleIndex].u8TrafficPriority = psfLocalSet->u8TrafficPriority;
645
646         //copy all the classifier in the Service Flow param  structure
647         for(nIndex=0; nIndex<psfLocalSet->u8TotalClassifiers; nIndex++)
648         {
649                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Classifier index =%d",nIndex);
650                 psfCSType =  &psfLocalSet->cConvergenceSLTypes[nIndex];
651                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Classifier index =%d",nIndex);
652
653                 if(psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority)
654                 {
655                         Adapter->PackInfo[uiSearchRuleIndex].bClassifierPriority=TRUE;
656                 }
657
658                 if(psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority)
659                 {
660                         Adapter->PackInfo[uiSearchRuleIndex].bClassifierPriority=TRUE;
661                 }
662
663
664                 if(ucDsxType== DSA_ACK)
665                 {
666                         eClassifierAction = eAddClassifier;
667                 }
668                 else if(ucDsxType == DSC_ACK)
669                 {
670                         switch(psfCSType->u8ClassfierDSCAction)
671                         {
672                         case 0://DSC Add Classifier
673                         {
674                                 eClassifierAction = eAddClassifier;
675                         }
676                         break;
677                         case 1://DSC Replace Classifier
678                         {
679                                 eClassifierAction = eReplaceClassifier;
680                         }
681                         break;
682                         case 2://DSC Delete Classifier
683                         {
684                                 eClassifierAction = eDeleteClassifier;
685
686                         }
687                         break;
688                         default:
689                         {
690                                 eClassifierAction = eInvalidClassifierAction;
691                         }
692                         }
693                 }
694
695                 u16PacketClassificationRuleIndex = ntohs(psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex);
696
697                 switch(eClassifierAction)
698                 {
699                 case eAddClassifier:
700                 {
701                         //Get a Free Classifier Index From Classifier table for this SF to add the Classifier
702                         //Contained in this message
703                         nClassifierIndex = SearchClsid(Adapter,ulSFID,u16PacketClassificationRuleIndex);
704
705                         if(nClassifierIndex > MAX_CLASSIFIERS)
706                         {
707                                 nClassifierIndex = SearchFreeClsid(Adapter);
708                                 if(nClassifierIndex > MAX_CLASSIFIERS)
709                                 {
710                                         //Failed To get a free Entry
711                                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Error Failed To get a free Classifier Entry");
712                                         break;
713                                 }
714                                 //Copy the Classifier Rule for this service flow into our Classifier table maintained per SF.
715                                 CopyClassifierRuleToSF(Adapter,psfCSType,uiSearchRuleIndex,nClassifierIndex);
716                         }
717
718                         else
719                         {
720                                 //This Classifier Already Exists and it is invalid to Add Classifier with existing PCRI
721                                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"CopyToAdapter : Error The Specified Classifier Already Exists \
722                                                 and attempted To Add Classifier with Same PCRI : 0x%x\n", u16PacketClassificationRuleIndex);
723                         }
724                 }
725                 break;
726
727                 case eReplaceClassifier:
728                 {
729                                 //Get the Classifier Index From Classifier table for this SF and replace existing  Classifier
730                                 //with the new classifier Contained in this message
731                         nClassifierIndex = SearchClsid(Adapter,ulSFID,u16PacketClassificationRuleIndex);
732                         if(nClassifierIndex > MAX_CLASSIFIERS)
733                         {
734                                 //Failed To search the classifier
735                                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Error Search for Classifier To be replaced failed");
736                                 break;
737                         }
738                         //Copy the Classifier Rule for this service flow into our Classifier table maintained per SF.
739                         CopyClassifierRuleToSF(Adapter,psfCSType,uiSearchRuleIndex,nClassifierIndex);
740                 }
741                 break;
742
743                 case eDeleteClassifier:
744                 {
745                                 //Get the Classifier Index From Classifier table for this SF and replace existing  Classifier
746                                 //with the new classifier Contained in this message
747                         nClassifierIndex = SearchClsid(Adapter,ulSFID,u16PacketClassificationRuleIndex);
748                         if(nClassifierIndex > MAX_CLASSIFIERS)
749                         {
750                                 //Failed To search the classifier
751                                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Error Search for Classifier To be deleted failed");
752                                 break;
753                         }
754
755                         //Delete This classifier
756                         DeleteClassifierRuleFromSF(Adapter,uiSearchRuleIndex,nClassifierIndex);
757                 }
758                 break;
759
760                 default:
761                 {
762                         //Invalid Action for classifier
763                         break;
764                 }
765                 }
766         }
767
768         //Repeat parsing Classification Entries to process PHS Rules
769         for(nIndex=0; nIndex < psfLocalSet->u8TotalClassifiers; nIndex++)
770         {
771                 psfCSType =  &psfLocalSet->cConvergenceSLTypes[nIndex];
772
773                 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "psfCSType->u8PhsDSCAction : 0x%x\n",
774                                 psfCSType->u8PhsDSCAction );
775
776                 switch (psfCSType->u8PhsDSCAction)
777                 {
778                 case eDeleteAllPHSRules:
779                 {
780                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Deleting All PHS Rules For VCID: 0x%X\n",uVCID);
781
782                         //Delete All the PHS rules for this Service flow
783
784                         PhsDeleteSFRules(
785                                 &Adapter->stBCMPhsContext,
786                                 uVCID);
787
788                         break;
789                 }
790                 case eDeletePHSRule:
791                 {
792                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"PHS DSC Action = Delete PHS Rule \n");
793
794                         if(psfCSType->cPhsRule.u8PHSI)
795                         {
796                                 PhsDeletePHSRule(
797                                         &Adapter->stBCMPhsContext,
798                                         uVCID,
799                                         psfCSType->cCPacketClassificationRule.u8AssociatedPHSI);
800                         }
801                         else
802                         {
803                                 //BCM_DEBUG_PRINT(CONN_MSG,("Error CPHSRule.PHSI is ZERO \n"));
804                         }
805                         break;
806                 }
807                 default :
808                 {
809                         if(ucDsxType == DSC_ACK)
810                         {
811                                 //BCM_DEBUG_PRINT(CONN_MSG,("Invalid PHS DSC Action For DSC \n",psfCSType->cPhsRule.u8PHSI));
812                                 break; //FOr DSC ACK Case PHS DSC Action must be in valid set
813                         }
814                 }
815                 //Proceed To Add PHS rule for DSA_ACK case even if PHS DSC action is unspecified
816                 //No Break Here . Intentionally!
817
818                 case eAddPHSRule:
819                 case eSetPHSRule:
820                 {
821                         if(psfCSType->cPhsRule.u8PHSI)
822                         {
823                                 //Apply This PHS Rule to all classifiers whose Associated PHSI Match
824                                 unsigned int uiClassifierIndex = 0;
825                                 if(pstAddIndication->u8Direction == UPLINK_DIR )
826                                 {
827                                         for(uiClassifierIndex=0;uiClassifierIndex<MAX_CLASSIFIERS;uiClassifierIndex++)
828                                         {
829                                                 if((Adapter->astClassifierTable[uiClassifierIndex].bUsed) &&
830                                                         (Adapter->astClassifierTable[uiClassifierIndex].ulSFID == Adapter->PackInfo[uiSearchRuleIndex].ulSFID) &&
831                                                         (Adapter->astClassifierTable[uiClassifierIndex].u8AssociatedPHSI == psfCSType->cPhsRule.u8PHSI))
832                                                 {
833                                                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Adding  PHS Rule For  Classifier : 0x%x cPhsRule.u8PHSI : 0x%x\n",
834                                                                 Adapter->astClassifierTable[uiClassifierIndex].uiClassifierRuleIndex,
835                                                                 psfCSType->cPhsRule.u8PHSI);
836                                                         //Update The PHS Rule for this classifier as Associated PHSI id defined
837
838                                                         //Copy the PHS Rule
839                                                         sPhsRule.u8PHSI =  psfCSType->cPhsRule.u8PHSI;
840                                                         sPhsRule.u8PHSFLength =  psfCSType->cPhsRule.u8PHSFLength;
841                                                         sPhsRule.u8PHSMLength = psfCSType->cPhsRule.u8PHSMLength;
842                                                         sPhsRule.u8PHSS = psfCSType->cPhsRule.u8PHSS;
843                                                         sPhsRule.u8PHSV = psfCSType->cPhsRule.u8PHSV;
844                                                         memcpy(sPhsRule.u8PHSF,psfCSType->cPhsRule.u8PHSF,MAX_PHS_LENGTHS);
845                                                         memcpy(sPhsRule.u8PHSM,psfCSType->cPhsRule.u8PHSM,MAX_PHS_LENGTHS);
846                                                         sPhsRule.u8RefCnt = 0;
847                                                         sPhsRule.bUnclassifiedPHSRule = FALSE;
848                                                         sPhsRule.PHSModifiedBytes = 0;
849                                                         sPhsRule.PHSModifiedNumPackets = 0;
850                                                         sPhsRule.PHSErrorNumPackets = 0;
851
852                                                         //bPHSRuleAssociated = TRUE;
853                                                         //Store The PHS Rule for this classifier
854
855                                                         PhsUpdateClassifierRule(
856                                                                 &Adapter->stBCMPhsContext,
857                                                                 uVCID,
858                                                                 Adapter->astClassifierTable[uiClassifierIndex].uiClassifierRuleIndex,
859                                                                 &sPhsRule,
860                                                                 Adapter->astClassifierTable[uiClassifierIndex].u8AssociatedPHSI);
861
862                                                         //Update PHS Rule For the Classifier
863                                                         if(sPhsRule.u8PHSI)
864                                                         {
865                                                                 Adapter->astClassifierTable[uiClassifierIndex].u32PHSRuleID = sPhsRule.u8PHSI;
866                                                                 memcpy(&Adapter->astClassifierTable[uiClassifierIndex].sPhsRule,&sPhsRule,sizeof(S_PHS_RULE));
867                                                         }
868
869                                                 }
870                                         }
871                                 }
872                                 else
873                                 {
874                                         //Error PHS Rule specified in signaling could not be applied to any classifier
875
876                                                 //Copy the PHS Rule
877                                                 sPhsRule.u8PHSI =  psfCSType->cPhsRule.u8PHSI;
878                                                 sPhsRule.u8PHSFLength =  psfCSType->cPhsRule.u8PHSFLength;
879                                                 sPhsRule.u8PHSMLength = psfCSType->cPhsRule.u8PHSMLength;
880                                                 sPhsRule.u8PHSS = psfCSType->cPhsRule.u8PHSS;
881                                                 sPhsRule.u8PHSV = psfCSType->cPhsRule.u8PHSV;
882                                                 memcpy(sPhsRule.u8PHSF,psfCSType->cPhsRule.u8PHSF,MAX_PHS_LENGTHS);
883                                                 memcpy(sPhsRule.u8PHSM,psfCSType->cPhsRule.u8PHSM,MAX_PHS_LENGTHS);
884                                                 sPhsRule.u8RefCnt = 0;
885                                                 sPhsRule.bUnclassifiedPHSRule = TRUE;
886                                                 sPhsRule.PHSModifiedBytes = 0;
887                                                 sPhsRule.PHSModifiedNumPackets = 0;
888                                                 sPhsRule.PHSErrorNumPackets = 0;
889                                                 //Store The PHS Rule for this classifier
890
891                                                 /*
892                                                         Passing the argument u8PHSI instead of clsid. Because for DL with no classifier rule,
893                                                         clsid will be zero hence we cant have multiple PHS rules for the same SF.
894                                                         To support multiple PHS rule, passing u8PHSI.
895                                                 */
896
897                                                 PhsUpdateClassifierRule(
898                                                         &Adapter->stBCMPhsContext,
899                                                         uVCID,
900                                                         sPhsRule.u8PHSI,
901                                                         &sPhsRule,
902                                                         sPhsRule.u8PHSI);
903
904                                 }
905
906                         }
907                 }
908                 break;
909                 }
910         }
911
912         if(psfLocalSet->u32MaxSustainedTrafficRate == 0 )
913         {
914                 //No Rate Limit . Set Max Sustained Traffic Rate to Maximum
915                 Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate =
916                         WIMAX_MAX_ALLOWED_RATE;
917
918         }
919         else if (ntohl(psfLocalSet->u32MaxSustainedTrafficRate) >
920                         WIMAX_MAX_ALLOWED_RATE)
921         {
922                 //Too large Allowed Rate specified. Limiting to Wi Max  Allowed rate
923                 Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate =
924                         WIMAX_MAX_ALLOWED_RATE;
925         }
926         else
927         {
928                 Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate =
929                         ntohl(psfLocalSet->u32MaxSustainedTrafficRate);
930         }
931
932         Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency = ntohl(psfLocalSet->u32MaximumLatency);
933
934         if(Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency == 0) /* 0 should be treated as infinite */
935                 Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency = MAX_LATENCY_ALLOWED;
936
937
938         if(( Adapter->PackInfo[uiSearchRuleIndex].u8QueueType == ERTPS ||
939                         Adapter->PackInfo[uiSearchRuleIndex].u8QueueType == UGS ) )
940                         UGIValue = ntohs(psfLocalSet->u16UnsolicitedGrantInterval);
941
942         if(UGIValue == 0)
943                 UGIValue = DEFAULT_UG_INTERVAL;
944
945         /*
946         For UGI based connections...
947         DEFAULT_UGI_FACTOR*UGIInterval worth of data is the max token count at host...
948         The extra amount of token is to ensure that a large amount of jitter won't have loss in throughput...
949         In case of non-UGI based connection, 200 frames worth of data is the max token count at host...
950         */
951
952         Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize =
953         (DEFAULT_UGI_FACTOR*Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate*UGIValue)/1000;
954
955         if(Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize < WIMAX_MAX_MTU*8)
956         {
957                 UINT UGIFactor = 0;
958                 /* Special Handling to ensure the biggest size of packet can go out from host to FW as follows:
959                 1. Any packet from Host to FW can go out in different packet size.
960                 2. So in case the Bucket count is smaller than MTU, the packets of size (Size > TokenCount), will get dropped.
961                 3. We can allow packets of MaxSize from Host->FW that can go out from FW in multiple SDUs by fragmentation at Wimax Layer
962                 */
963                 UGIFactor = (Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency/UGIValue + 1);
964
965                 if(UGIFactor > DEFAULT_UGI_FACTOR)
966                 Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize =
967                 (UGIFactor*Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate*UGIValue)/1000;
968
969                 if(Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize > WIMAX_MAX_MTU*8)
970                         Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize = WIMAX_MAX_MTU*8;
971         }
972
973
974         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"LAT: %d, UGI: %d \n", Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency, UGIValue);
975         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"uiMaxAllowedRate: 0x%x, u32MaxSustainedTrafficRate: 0x%x ,uiMaxBucketSize: 0x%x",
976                 Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate,
977                 ntohl(psfLocalSet->u32MaxSustainedTrafficRate),
978                 Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize);
979
980         //copy the extended SF Parameters to Support MIBS
981         CopyMIBSExtendedSFParameters(Adapter,psfLocalSet,uiSearchRuleIndex);
982
983         //store header suppression enabled flag per SF
984         Adapter->PackInfo[uiSearchRuleIndex].bHeaderSuppressionEnabled =
985                         !(psfLocalSet->u8RequesttransmissionPolicy &
986                                 MASK_DISABLE_HEADER_SUPPRESSION);
987
988         if(Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication)
989         {
990                 kfree(Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication);
991                 Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication = NULL;
992         }
993         Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication = pstAddIndication;
994
995         //Re Sort the SF list in PackInfo according to Traffic Priority
996         SortPackInfo(Adapter);
997
998         /* Re Sort the Classifier Rules table and re - arrange
999                 according to Classifier Rule Priority */
1000         SortClassifiers(Adapter);
1001
1002         DumpPhsRules(&Adapter->stBCMPhsContext);
1003
1004         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"%s <=====", __FUNCTION__);
1005 }
1006
1007
1008 /***********************************************************************
1009 * Function        -     DumpCmControlPacket
1010 *
1011 * Description - This routinue Dumps the Contents of the AddIndication
1012 *                               Structure in the Connection Management Control Packet
1013 *
1014 * Parameter   - pvBuffer: Pointer to the buffer containing the
1015 *                               AddIndication data.
1016 *
1017 * Returns         - None
1018 *************************************************************************/
1019 static VOID DumpCmControlPacket(PVOID pvBuffer)
1020 {
1021         UINT                                    uiLoopIndex;
1022         UINT                    nIndex;
1023         stLocalSFAddIndicationAlt  *pstAddIndication;
1024         UINT                    nCurClassifierCnt;
1025     PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
1026
1027         pstAddIndication = (stLocalSFAddIndicationAlt *)pvBuffer;
1028         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "======>");
1029
1030         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8Type           : 0x%X",pstAddIndication->u8Type);
1031         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8Direction      : 0x%X",pstAddIndication->u8Direction);
1032         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16TID: 0x%X", ntohs(pstAddIndication->u16TID));
1033         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16CID            : 0x%X",ntohs(pstAddIndication->u16CID));
1034         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16VCID           : 0x%X",ntohs(pstAddIndication->u16VCID));
1035
1036         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " AuthorizedSet--->");
1037
1038         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32SFID          : 0x%X",htonl(pstAddIndication->sfAuthorizedSet.u32SFID));
1039         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16CID           : 0x%X",htons(pstAddIndication->sfAuthorizedSet.u16CID));
1040         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ServiceClassNameLength : 0x%X",
1041                 pstAddIndication->sfAuthorizedSet.u8ServiceClassNameLength);
1042
1043         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ServiceClassName                : 0x%X ,0x%X , 0x%X, 0x%X, 0x%X, 0x%X",
1044                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[0],
1045                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[1],
1046                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[2],
1047                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[3],
1048                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[4],
1049                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[5]);
1050
1051         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8MBSService             : 0x%X",
1052                 pstAddIndication->sfAuthorizedSet.u8MBSService);
1053         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8QosParamSet            : 0x%X",
1054                 pstAddIndication->sfAuthorizedSet.u8QosParamSet);
1055         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8TrafficPriority : 0x%X, %p",
1056                 pstAddIndication->sfAuthorizedSet.u8TrafficPriority, &pstAddIndication->sfAuthorizedSet.u8TrafficPriority);
1057
1058         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MaxSustainedTrafficRate       : 0x%X 0x%p",
1059                 pstAddIndication->sfAuthorizedSet.u32MaxSustainedTrafficRate,
1060                         &pstAddIndication->sfAuthorizedSet.u32MaxSustainedTrafficRate);
1061
1062         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32MaxTrafficBurst                        : 0x%X",
1063                 pstAddIndication->sfAuthorizedSet.u32MaxTrafficBurst);
1064         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32MinReservedTrafficRate : 0x%X",
1065                 pstAddIndication->sfAuthorizedSet.u32MinReservedTrafficRate);
1066 #if 0
1067         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MinimumTolerableTrafficRate   : 0x%X",
1068                 pstAddIndication->sfAuthorizedSet.u32MinimumTolerableTrafficRate);
1069         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32RequesttransmissionPolicy     : 0x%X",
1070                 pstAddIndication->sfAuthorizedSet.u32RequesttransmissionPolicy);
1071 #endif
1072         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8VendorSpecificQoSParamLength    : 0x%X",
1073                 pstAddIndication->sfAuthorizedSet.u8VendorSpecificQoSParamLength);
1074         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8VendorSpecificQoSParam          : 0x%X",
1075                 pstAddIndication->sfAuthorizedSet.u8VendorSpecificQoSParam[0]);
1076         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ServiceFlowSchedulingType               : 0x%X",
1077                 pstAddIndication->sfAuthorizedSet.u8ServiceFlowSchedulingType);
1078         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32ToleratedJitter                                : 0x%X",
1079                 pstAddIndication->sfAuthorizedSet.u32ToleratedJitter);
1080     BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MaximumLatency                            : 0x%X",
1081                 pstAddIndication->sfAuthorizedSet.u32MaximumLatency);
1082         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8FixedLengthVSVariableLengthSDUIndicator: 0x%X",
1083                 pstAddIndication->sfAuthorizedSet.u8FixedLengthVSVariableLengthSDUIndicator);
1084
1085         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8SDUSize                         : 0x%X",
1086                 pstAddIndication->sfAuthorizedSet.u8SDUSize);
1087         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16TargetSAID                    : 0x%X",
1088                 pstAddIndication->sfAuthorizedSet.u16TargetSAID);
1089         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ARQEnable                              : 0x%X",
1090                 pstAddIndication->sfAuthorizedSet.u8ARQEnable);
1091         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQWindowSize          : 0x%X",
1092                 pstAddIndication->sfAuthorizedSet.u16ARQWindowSize);
1093         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQRetryTxTimeOut      : 0x%X",
1094                 pstAddIndication->sfAuthorizedSet.u16ARQRetryTxTimeOut);
1095         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQRetryRxTimeOut     : 0x%X",
1096                 pstAddIndication->sfAuthorizedSet.u16ARQRetryRxTimeOut);
1097         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQBlockLifeTime               : 0x%X",
1098                 pstAddIndication->sfAuthorizedSet.u16ARQBlockLifeTime);
1099         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQSyncLossTimeOut    : 0x%X",
1100                 pstAddIndication->sfAuthorizedSet.u16ARQSyncLossTimeOut);
1101         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ARQDeliverInOrder              : 0x%X",
1102                 pstAddIndication->sfAuthorizedSet.u8ARQDeliverInOrder);
1103         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQRxPurgeTimeOut     : 0x%X",
1104                 pstAddIndication->sfAuthorizedSet.u16ARQRxPurgeTimeOut);
1105         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQBlockSize                  : 0x%X",
1106                 pstAddIndication->sfAuthorizedSet.u16ARQBlockSize);
1107         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8CSSpecification                : 0x%X",
1108                 pstAddIndication->sfAuthorizedSet.u8CSSpecification);
1109         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8TypeOfDataDeliveryService      : 0x%X",
1110                 pstAddIndication->sfAuthorizedSet.u8TypeOfDataDeliveryService);
1111         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16SDUInterArrivalTime   : 0x%X",
1112                 pstAddIndication->sfAuthorizedSet.u16SDUInterArrivalTime);
1113         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16TimeBase                              : 0x%X",
1114                 pstAddIndication->sfAuthorizedSet.u16TimeBase);
1115         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8PagingPreference               : 0x%X",
1116                 pstAddIndication->sfAuthorizedSet.u8PagingPreference);
1117         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16UnsolicitedPollingInterval            : 0x%X",
1118                 pstAddIndication->sfAuthorizedSet.u16UnsolicitedPollingInterval);
1119 #if 0
1120         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "MBSZoneIdentifierassignmentLength        : 0x%X",
1121                 pstAddIndication->sfAuthorizedSet.MBSZoneIdentifierassignmentLength);
1122         for(uiLoopIndex=0; uiLoopIndex < MAX_STRING_LEN; uiLoopIndex++)
1123                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "MBSZoneIdentifierassignment : 0x%X",
1124                         pstAddIndication->sfAuthorizedSet.MBSZoneIdentifierassignment[uiLoopIndex]);
1125 #endif
1126
1127         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "sfAuthorizedSet.u8HARQChannelMapping %x  %x %x ",
1128                                 *(unsigned int*)pstAddIndication->sfAuthorizedSet.u8HARQChannelMapping,
1129                                 *(unsigned int*)&pstAddIndication->sfAuthorizedSet.u8HARQChannelMapping[4],
1130                         *(USHORT*) &pstAddIndication->sfAuthorizedSet.u8HARQChannelMapping[8]);
1131         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8TrafficIndicationPreference    : 0x%X",
1132                 pstAddIndication->sfAuthorizedSet.u8TrafficIndicationPreference);
1133
1134         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " Total Classifiers Recieved              : 0x%X",pstAddIndication->sfAuthorizedSet.u8TotalClassifiers);
1135
1136         nCurClassifierCnt = pstAddIndication->sfAuthorizedSet.u8TotalClassifiers;
1137
1138         if(nCurClassifierCnt > MAX_CLASSIFIERS_IN_SF)
1139         {
1140                 nCurClassifierCnt = MAX_CLASSIFIERS_IN_SF;
1141         }
1142         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "pstAddIndication->sfAuthorizedSet.bValid %d", pstAddIndication->sfAuthorizedSet.bValid);
1143         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "pstAddIndication->sfAuthorizedSet.u16MacOverhead %x", pstAddIndication->sfAuthorizedSet.u16MacOverhead);
1144         if(!pstAddIndication->sfAuthorizedSet.bValid)
1145                 pstAddIndication->sfAuthorizedSet.bValid=1;
1146         for(nIndex = 0 ; nIndex < nCurClassifierCnt ; nIndex++)
1147         {
1148                 stConvergenceSLTypes *psfCSType = NULL;
1149                 psfCSType =  &pstAddIndication->sfAuthorizedSet.cConvergenceSLTypes[nIndex];
1150
1151                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "psfCSType = %p", psfCSType);
1152                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "CCPacketClassificationRuleSI====>");
1153
1154                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ClassifierRulePriority         :0x%X ",
1155                         psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority);
1156                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPTypeOfServiceLength                  :0x%X ",
1157                         psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength);
1158
1159                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPTypeOfService[3]                     :0x%X ,0x%X ,0x%X ",
1160                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0],
1161                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1],
1162                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2]);
1163 #if 0
1164
1165                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "u8ProtocolLength                             :0x%X ",
1166                         psfCSType->cCPacketClassificationRule.u8ProtocolLength);
1167 #endif
1168
1169                 for(uiLoopIndex=0; uiLoopIndex < 1; uiLoopIndex++)
1170                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8Protocol : 0x%02X ",
1171                         psfCSType->cCPacketClassificationRule.u8Protocol);
1172
1173                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPMaskedSourceAddressLength    :0x%X ",
1174                         psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength);
1175
1176                 for(uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++)
1177                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPMaskedSourceAddress[32]      : 0x%02X ",
1178                         psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress[uiLoopIndex]);
1179
1180                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPDestinationAddressLength : 0x%X ",
1181                         psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength);
1182
1183                 for(uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++)
1184                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPDestinationAddress[32] : 0x%02X ",
1185                         psfCSType->cCPacketClassificationRule.u8IPDestinationAddress[uiLoopIndex]);
1186
1187                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolSourcePortRangeLength:0x%X ",
1188                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength);
1189                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolSourcePortRange[4]: 0x%02X ,0x%02X ,0x%02X ,0x%02X ",
1190                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[0],
1191                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[1],
1192                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[2],
1193                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[3]);
1194
1195                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolDestPortRangeLength : 0x%02X ",
1196                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength);
1197                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolDestPortRange[4]: 0x%02X ,0x%02X ,0x%02X ,0x%02X ",
1198                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[0],
1199                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[1],
1200                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[2],
1201                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[3]);
1202
1203                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetDestMacAddressLength : 0x%02X ",
1204                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1205
1206                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetDestMacAddress[6] : 0x %02X %02X %02X %02X %02X %02X",
1207                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[0],
1208                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[1],
1209                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[2],
1210                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[3],
1211                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[4],
1212                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[5]);
1213
1214                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetSourceMACAddressLength : 0x%02X ",
1215                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1216
1217                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetSourceMACAddress[6] : 0x %02X %02X %02X %02X %02X %02X",
1218                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[0],
1219                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[1],
1220                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[2],
1221                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[3],
1222                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[4],
1223                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[5]);
1224
1225                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthertypeLength        : 0x%02X ",
1226                         psfCSType->cCPacketClassificationRule.u8EthertypeLength);
1227                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8Ethertype[3] : 0x%02X ,0x%02X ,0x%02X ",
1228                         psfCSType->cCPacketClassificationRule.u8Ethertype[0],
1229                         psfCSType->cCPacketClassificationRule.u8Ethertype[1],
1230                         psfCSType->cCPacketClassificationRule.u8Ethertype[2]);
1231
1232                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16UserPriority          : 0x%X ",
1233                         psfCSType->cCPacketClassificationRule.u16UserPriority);
1234
1235                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16VLANID                        : 0x%X ",
1236                         psfCSType->cCPacketClassificationRule.u16VLANID);
1237
1238                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8AssociatedPHSI : 0x%02X ",
1239                         psfCSType->cCPacketClassificationRule.u8AssociatedPHSI);
1240
1241                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16PacketClassificationRuleIndex : 0x%X ",
1242                         psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex);
1243
1244                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificClassifierParamLength    : 0x%X ",
1245                         psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParamLength);
1246
1247                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificClassifierParam[1]               : 0x%X ",
1248                         psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParam[0]);
1249 #ifdef VERSION_D5
1250                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPv6FlowLableLength                            :0x%X ",
1251                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLableLength);
1252                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPv6FlowLable[6] : 0x %02X %02X %02X %02X %02X %02X ",
1253                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[0],
1254                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[1],
1255                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[2],
1256                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[3],
1257                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[4],
1258                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[5]);
1259 #endif
1260         }
1261
1262         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "bValid           : 0x%02X",pstAddIndication->sfAuthorizedSet.bValid);
1263
1264         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "AdmittedSet--->");
1265         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32SFID          : 0x%X",pstAddIndication->sfAdmittedSet.u32SFID);
1266         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16CID           : 0x%X",pstAddIndication->sfAdmittedSet.u16CID);
1267         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ServiceClassNameLength : 0x%X",
1268                 pstAddIndication->sfAdmittedSet.u8ServiceClassNameLength);
1269         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ServiceClassName                       : 0x %02X %02X %02X %02X %02X %02X",
1270                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[0],
1271                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[1],
1272                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[2],
1273                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[3],
1274                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[4],
1275                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[5]);
1276
1277         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8MBSService                             : 0x%02X",
1278                         pstAddIndication->sfAdmittedSet.u8MBSService);
1279         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8QosParamSet                            : 0x%02X",
1280                         pstAddIndication->sfAdmittedSet.u8QosParamSet);
1281         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8TrafficPriority                        : 0x%02X",
1282                         pstAddIndication->sfAdmittedSet.u8TrafficPriority);
1283 #if 0
1284         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "u32MaxSustainedTrafficRate   : 0x%02X",
1285                         ntohl(pstAddIndication->sfAdmittedSet.u32MaxSustainedTrafficRate));
1286         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "u32MinimumTolerableTrafficRate       : 0x%X",
1287                 pstAddIndication->sfAdmittedSet.u32MinimumTolerableTrafficRate);
1288         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "u32RequesttransmissionPolicy : 0x%X",
1289                 pstAddIndication->sfAdmittedSet.u32RequesttransmissionPolicy);
1290 #endif
1291         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MaxTrafficBurst                       : 0x%X",
1292                         pstAddIndication->sfAdmittedSet.u32MaxTrafficBurst);
1293         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MinReservedTrafficRate        : 0x%X",
1294                 pstAddIndication->sfAdmittedSet.u32MinReservedTrafficRate);
1295
1296         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificQoSParamLength   : 0x%02X",
1297                 pstAddIndication->sfAdmittedSet.u8VendorSpecificQoSParamLength);
1298         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificQoSParam         : 0x%02X",
1299                 pstAddIndication->sfAdmittedSet.u8VendorSpecificQoSParam[0]);
1300         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ServiceFlowSchedulingType              : 0x%02X",
1301                 pstAddIndication->sfAdmittedSet.u8ServiceFlowSchedulingType);
1302
1303         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32ToleratedJitter                               : 0x%X",
1304                 pstAddIndication->sfAdmittedSet.u32ToleratedJitter);
1305     BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MaximumLatency                            : 0x%X",
1306                 pstAddIndication->sfAdmittedSet.u32MaximumLatency);
1307
1308         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8FixedLengthVSVariableLengthSDUIndicator: 0x%02X",
1309                 pstAddIndication->sfAdmittedSet.u8FixedLengthVSVariableLengthSDUIndicator);
1310         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8SDUSize                        : 0x%02X",
1311                 pstAddIndication->sfAdmittedSet.u8SDUSize);
1312         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16TargetSAID            : 0x%02X",
1313                 pstAddIndication->sfAdmittedSet.u16TargetSAID);
1314         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ARQEnable                      : 0x%02X",
1315                 pstAddIndication->sfAdmittedSet.u8ARQEnable);
1316
1317         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQWindowSize         : 0x%X",
1318                 pstAddIndication->sfAdmittedSet.u16ARQWindowSize);
1319         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQRetryTxTimeOut     : 0x%X",
1320                 pstAddIndication->sfAdmittedSet.u16ARQRetryTxTimeOut);
1321         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQRetryRxTimeOut     : 0x%X",
1322                 pstAddIndication->sfAdmittedSet.u16ARQRetryRxTimeOut);
1323         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQBlockLifeTime              : 0x%X",
1324                 pstAddIndication->sfAdmittedSet.u16ARQBlockLifeTime);
1325         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQSyncLossTimeOut    : 0x%X",
1326                 pstAddIndication->sfAdmittedSet.u16ARQSyncLossTimeOut);
1327
1328         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ARQDeliverInOrder              : 0x%02X",
1329                 pstAddIndication->sfAdmittedSet.u8ARQDeliverInOrder);
1330         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQRxPurgeTimeOut     : 0x%X",
1331                 pstAddIndication->sfAdmittedSet.u16ARQRxPurgeTimeOut);
1332         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQBlockSize                  : 0x%X",
1333                 pstAddIndication->sfAdmittedSet.u16ARQBlockSize);
1334         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8CSSpecification                : 0x%02X",
1335                 pstAddIndication->sfAdmittedSet.u8CSSpecification);
1336         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8TypeOfDataDeliveryService      : 0x%02X",
1337                 pstAddIndication->sfAdmittedSet.u8TypeOfDataDeliveryService);
1338         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16SDUInterArrivalTime   : 0x%X",
1339                 pstAddIndication->sfAdmittedSet.u16SDUInterArrivalTime);
1340         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16TimeBase                              : 0x%X",
1341                 pstAddIndication->sfAdmittedSet.u16TimeBase);
1342         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8PagingPreference               : 0x%X",
1343                 pstAddIndication->sfAdmittedSet.u8PagingPreference);
1344 #if 0
1345         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "MBSZoneIdentifierassignmentLength        : 0x%X",
1346                 pstAddIndication->sfAdmittedSet.MBSZoneIdentifierassignmentLength);
1347         for(uiLoopIndex=0; uiLoopIndex < MAX_STRING_LEN; uiLoopIndex++)
1348                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "MBSZoneIdentifierassignment : 0x%X",
1349         pstAddIndication->sfAdmittedSet.MBSZoneIdentifierassignment[uiLoopIndex]);
1350 #endif
1351
1352
1353         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8TrafficIndicationPreference    : 0x%02X",
1354                 pstAddIndication->sfAdmittedSet.u8TrafficIndicationPreference);
1355
1356         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " Total Classifiers Recieved              : 0x%X",pstAddIndication->sfAdmittedSet.u8TotalClassifiers);
1357
1358         nCurClassifierCnt = pstAddIndication->sfAdmittedSet.u8TotalClassifiers;
1359
1360         if(nCurClassifierCnt > MAX_CLASSIFIERS_IN_SF)
1361         {
1362                 nCurClassifierCnt = MAX_CLASSIFIERS_IN_SF;
1363         }
1364
1365
1366         for(nIndex = 0 ; nIndex < nCurClassifierCnt ; nIndex++)
1367         {
1368
1369                 stConvergenceSLTypes *psfCSType = NULL;
1370                 psfCSType =  &pstAddIndication->sfAdmittedSet.cConvergenceSLTypes[nIndex];
1371
1372                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " CCPacketClassificationRuleSI====>");
1373
1374                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ClassifierRulePriority :0x%02X ",
1375                         psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority);
1376                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPTypeOfServiceLength          :0x%02X",
1377                         psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength);
1378
1379                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPTypeOfService[3]             :0x%02X %02X %02X",
1380                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0],
1381                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1],
1382                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2]);
1383 #if 0
1384
1385                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolLength                 :0x%02X ",
1386                         psfCSType->cCPacketClassificationRule.u8ProtocolLength);
1387 #endif
1388                 for(uiLoopIndex=0; uiLoopIndex < 1; uiLoopIndex++)
1389                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8Protocol: 0x%02X ",
1390                         psfCSType->cCPacketClassificationRule.u8Protocol);
1391
1392                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPMaskedSourceAddressLength    :0x%02X ",
1393                         psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength);
1394
1395                 for(uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++)
1396                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPMaskedSourceAddress[32] : 0x%02X ",
1397                         psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress[uiLoopIndex]);
1398
1399                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPDestinationAddressLength     : 0x%02X ",
1400                         psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength);
1401
1402                 for(uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++)
1403                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPDestinationAddress[32] : 0x%02X ",
1404                         psfCSType->cCPacketClassificationRule.u8IPDestinationAddress[uiLoopIndex]);
1405
1406                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolSourcePortRangeLength  : 0x%02X ",
1407                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength);
1408
1409                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolSourcePortRange[4] : 0x %02X %02X %02X %02X ",
1410                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[0],
1411                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[1],
1412                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[2],
1413                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[3]);
1414
1415                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolDestPortRangeLength : 0x%02X ",
1416                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength);
1417
1418                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolDestPortRange[4] : 0x %02X %02X %02X %02X ",
1419                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[0],
1420                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[1],
1421                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[2],
1422                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[3]);
1423
1424                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetDestMacAddressLength : 0x%02X ",
1425                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1426
1427                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetDestMacAddress[6] : 0x %02X %02X %02X %02X %02X %02X",
1428                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[0],
1429                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[1],
1430                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[2],
1431                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[3],
1432                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[4],
1433                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[5]);
1434
1435                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetSourceMACAddressLength : 0x%02X ",
1436                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1437
1438                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetSourceMACAddress[6] : 0x %02X %02X %02X %02X %02X %02X",
1439                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[0],
1440                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[1],
1441                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[2],
1442                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[3],
1443                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[4],
1444                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[5]);
1445
1446                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthertypeLength        : 0x%02X ",
1447                         psfCSType->cCPacketClassificationRule.u8EthertypeLength);
1448                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8Ethertype[3]           : 0x%02X %02X %02X",
1449                         psfCSType->cCPacketClassificationRule.u8Ethertype[0],
1450                         psfCSType->cCPacketClassificationRule.u8Ethertype[1],
1451                         psfCSType->cCPacketClassificationRule.u8Ethertype[2]);
1452
1453                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16UserPriority  : 0x%X ",
1454                         psfCSType->cCPacketClassificationRule.u16UserPriority);
1455                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16VLANID                        : 0x%X ",
1456                         psfCSType->cCPacketClassificationRule.u16VLANID);
1457                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8AssociatedPHSI : 0x%02X ",
1458                         psfCSType->cCPacketClassificationRule.u8AssociatedPHSI);
1459                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16PacketClassificationRuleIndex : 0x%X ",
1460                         psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex);
1461
1462                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificClassifierParamLength    : 0x%02X",
1463                         psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParamLength);
1464                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificClassifierParam[1]       : 0x%02X ",
1465                         psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParam[0]);
1466 #ifdef VERSION_D5
1467                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPv6FlowLableLength                            : 0x%X ",
1468                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLableLength);
1469                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPv6FlowLable[6]       : 0x %02X %02X %02X %02X %02X %02X ",
1470                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[0],
1471                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[1],
1472                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[2],
1473                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[3],
1474                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[4],
1475                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[5]);
1476 #endif
1477         }
1478
1479         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "bValid           : 0x%X",pstAddIndication->sfAdmittedSet.bValid);
1480
1481         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " ActiveSet--->");
1482         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32SFID          : 0x%X",pstAddIndication->sfActiveSet.u32SFID);
1483         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16CID           : 0x%X",pstAddIndication->sfActiveSet.u16CID);
1484
1485         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ServiceClassNameLength : 0x%X",
1486                 pstAddIndication->sfActiveSet.u8ServiceClassNameLength);
1487
1488         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ServiceClassName               : 0x %02X %02X %02X %02X %02X %02X",
1489                 pstAddIndication->sfActiveSet.u8ServiceClassName[0],
1490                 pstAddIndication->sfActiveSet.u8ServiceClassName[1],
1491                 pstAddIndication->sfActiveSet.u8ServiceClassName[2],
1492                 pstAddIndication->sfActiveSet.u8ServiceClassName[3],
1493                 pstAddIndication->sfActiveSet.u8ServiceClassName[4],
1494                 pstAddIndication->sfActiveSet.u8ServiceClassName[5]);
1495
1496         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8MBSService                             : 0x%02X",
1497                 pstAddIndication->sfActiveSet.u8MBSService);
1498         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8QosParamSet                            : 0x%02X",
1499                 pstAddIndication->sfActiveSet.u8QosParamSet);
1500         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8TrafficPriority                        : 0x%02X",
1501                 pstAddIndication->sfActiveSet.u8TrafficPriority);
1502 #if 0
1503         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "u32MaxSustainedTrafficRate   : 0x%02X",
1504                 ntohl(pstAddIndication->sfActiveSet.u32MaxSustainedTrafficRate));
1505 #endif
1506         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MaxTrafficBurst                       : 0x%X",
1507                 pstAddIndication->sfActiveSet.u32MaxTrafficBurst);
1508         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MinReservedTrafficRate        : 0x%X",
1509                 pstAddIndication->sfActiveSet.u32MinReservedTrafficRate);
1510 #if 0
1511         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "u32MinimumTolerableTrafficRate       : 0x%X",
1512                 pstAddIndication->sfActiveSet.u32MinimumTolerableTrafficRate);
1513         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "u32RequesttransmissionPolicy : 0x%X",
1514                 pstAddIndication->sfActiveSet.u32RequesttransmissionPolicy);
1515 #endif
1516         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificQoSParamLength   : 0x%02X",
1517                 pstAddIndication->sfActiveSet.u8VendorSpecificQoSParamLength);
1518         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificQoSParam         : 0x%02X",
1519                 pstAddIndication->sfActiveSet.u8VendorSpecificQoSParam[0]);
1520         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ServiceFlowSchedulingType              : 0x%02X",
1521                 pstAddIndication->sfActiveSet.u8ServiceFlowSchedulingType);
1522
1523         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32ToleratedJitter                               : 0x%X",
1524                 pstAddIndication->sfActiveSet.u32ToleratedJitter);
1525     BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MaximumLatency                            : 0x%X",
1526                 pstAddIndication->sfActiveSet.u32MaximumLatency);
1527
1528         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8FixedLengthVSVariableLengthSDUIndicator: 0x%02X",
1529            pstAddIndication->sfActiveSet.u8FixedLengthVSVariableLengthSDUIndicator);
1530
1531         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8SDUSize                                : 0x%X",
1532                 pstAddIndication->sfActiveSet.u8SDUSize);
1533         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16TargetSAID                   : 0x%X",
1534                 pstAddIndication->sfActiveSet.u16TargetSAID);
1535         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8ARQEnable                     : 0x%X",
1536                 pstAddIndication->sfActiveSet.u8ARQEnable);
1537         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16ARQWindowSize                : 0x%X",
1538                 pstAddIndication->sfActiveSet.u16ARQWindowSize);
1539         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16ARQRetryTxTimeOut    : 0x%X",
1540                 pstAddIndication->sfActiveSet.u16ARQRetryTxTimeOut);
1541         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16ARQRetryRxTimeOut    : 0x%X",
1542                 pstAddIndication->sfActiveSet.u16ARQRetryRxTimeOut);
1543         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16ARQBlockLifeTime     : 0x%X",
1544                 pstAddIndication->sfActiveSet.u16ARQBlockLifeTime);
1545         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16ARQSyncLossTimeOut   : 0x%X",
1546                 pstAddIndication->sfActiveSet.u16ARQSyncLossTimeOut);
1547         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8ARQDeliverInOrder     : 0x%X",
1548                 pstAddIndication->sfActiveSet.u8ARQDeliverInOrder);
1549         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16ARQRxPurgeTimeOut    : 0x%X",
1550                 pstAddIndication->sfActiveSet.u16ARQRxPurgeTimeOut);
1551         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16ARQBlockSize         : 0x%X",
1552                 pstAddIndication->sfActiveSet.u16ARQBlockSize);
1553         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8CSSpecification               : 0x%X",
1554                 pstAddIndication->sfActiveSet.u8CSSpecification);
1555         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8TypeOfDataDeliveryService     : 0x%X",
1556                 pstAddIndication->sfActiveSet.u8TypeOfDataDeliveryService);
1557         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16SDUInterArrivalTime  : 0x%X",
1558                 pstAddIndication->sfActiveSet.u16SDUInterArrivalTime);
1559         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16TimeBase                     : 0x%X",
1560                 pstAddIndication->sfActiveSet.u16TimeBase);
1561         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8PagingPreference              : 0x%X",
1562                 pstAddIndication->sfActiveSet.u8PagingPreference);
1563 #if 0
1564         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " MBSZoneIdentifierassignmentLength       : 0x%X",
1565                 pstAddIndication->sfActiveSet.MBSZoneIdentifierassignmentLength);
1566         for(uiLoopIndex=0; uiLoopIndex < MAX_STRING_LEN; uiLoopIndex++)
1567                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " MBSZoneIdentifierassignment : 0x%X",
1568                 pstAddIndication->sfActiveSet.MBSZoneIdentifierassignment[uiLoopIndex]);
1569 #endif
1570
1571
1572         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8TrafficIndicationPreference   : 0x%X",
1573                 pstAddIndication->sfActiveSet.u8TrafficIndicationPreference);
1574
1575         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " Total Classifiers Recieved              : 0x%X",pstAddIndication->sfActiveSet.u8TotalClassifiers);
1576
1577         nCurClassifierCnt = pstAddIndication->sfActiveSet.u8TotalClassifiers;
1578
1579         if(nCurClassifierCnt > MAX_CLASSIFIERS_IN_SF)
1580         {
1581                 nCurClassifierCnt = MAX_CLASSIFIERS_IN_SF;
1582         }
1583
1584         for(nIndex = 0 ; nIndex < nCurClassifierCnt ; nIndex++)
1585         {
1586
1587                 stConvergenceSLTypes *psfCSType = NULL;
1588                 psfCSType =  &pstAddIndication->sfActiveSet.cConvergenceSLTypes[nIndex];
1589
1590
1591                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " CCPacketClassificationRuleSI====>");
1592
1593                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8ClassifierRulePriority                :0x%X ",
1594                         psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority);
1595                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8IPTypeOfServiceLength         :0x%X ",
1596                         psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength);
1597
1598                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8IPTypeOfService[3]                    :0x%X ,0x%X ,0x%X ",
1599                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0],
1600                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1],
1601                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2]);
1602 #if 0
1603
1604                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  " u8ProtocolLength                            :0x%X ",
1605                         psfCSType->cCPacketClassificationRule.u8ProtocolLength);
1606 #endif
1607                 for(uiLoopIndex=0; uiLoopIndex < 1; uiLoopIndex++)
1608                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8Protocol      : 0x%X ",
1609                         psfCSType->cCPacketClassificationRule.u8Protocol);
1610
1611                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPMaskedSourceAddressLength    :0x%X ",
1612                         psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength);
1613
1614                 for(uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++)
1615                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPMaskedSourceAddress[32]:0x%X ",
1616                         psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress[uiLoopIndex]);
1617
1618                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPDestinationAddressLength : 0x%02X ",
1619                         psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength);
1620
1621                 for(uiLoopIndex=0;uiLoopIndex<32;uiLoopIndex++)
1622                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8IPDestinationAddress[32]:0x%X ",
1623                         psfCSType->cCPacketClassificationRule.u8IPDestinationAddress[uiLoopIndex]);
1624
1625                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8ProtocolSourcePortRangeLength:0x%X ",
1626                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength);
1627
1628                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8ProtocolSourcePortRange[4]:0x%X ,0x%X ,0x%X ,0x%X ",
1629                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[0],
1630                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[1],
1631                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[2],
1632                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[3]);
1633
1634                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8ProtocolDestPortRangeLength:0x%X ",
1635                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength);
1636
1637                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8ProtocolDestPortRange[4]:0x%X ,0x%X ,0x%X ,0x%X ",
1638                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[0],
1639                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[1],
1640                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[2],
1641                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[3]);
1642
1643                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8EthernetDestMacAddressLength:0x%X ",
1644                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1645
1646                 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",
1647                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[0],
1648                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[1],
1649                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[2],
1650                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[3],
1651                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[4],
1652                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[5]);
1653
1654                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8EthernetSourceMACAddressLength:0x%X ",
1655                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1656
1657                 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",
1658                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[0],
1659                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[1],
1660                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[2],
1661                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[3],
1662                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[4],
1663                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[5]);
1664
1665                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8EthertypeLength              :0x%X ",
1666                         psfCSType->cCPacketClassificationRule.u8EthertypeLength);
1667                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8Ethertype[3]                 :0x%X ,0x%X ,0x%X ",
1668                         psfCSType->cCPacketClassificationRule.u8Ethertype[0],
1669                         psfCSType->cCPacketClassificationRule.u8Ethertype[1],
1670                         psfCSType->cCPacketClassificationRule.u8Ethertype[2]);
1671                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16UserPriority                :0x%X ",
1672                         psfCSType->cCPacketClassificationRule.u16UserPriority);
1673                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16VLANID                      :0x%X ",
1674                         psfCSType->cCPacketClassificationRule.u16VLANID);
1675                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8AssociatedPHSI               :0x%X ",
1676                         psfCSType->cCPacketClassificationRule.u8AssociatedPHSI);
1677                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16PacketClassificationRuleIndex:0x%X ",
1678                         psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex);
1679
1680                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8VendorSpecificClassifierParamLength:0x%X ",
1681                         psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParamLength);
1682                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8VendorSpecificClassifierParam[1]:0x%X ",
1683                         psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParam[0]);
1684 #ifdef VERSION_D5
1685                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8IPv6FlowLableLength                           :0x%X ",
1686                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLableLength);
1687                 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 ",
1688                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[0],
1689                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[1],
1690                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[2],
1691                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[3],
1692                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[4],
1693                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[5]);
1694 #endif
1695         }
1696
1697         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " bValid                  : 0x%X",pstAddIndication->sfActiveSet.bValid);
1698
1699 }
1700
1701 static inline ULONG RestoreSFParam(PMINI_ADAPTER Adapter, ULONG ulAddrSFParamSet,PUCHAR pucDestBuffer)
1702 {
1703         UINT  nBytesToRead = sizeof(stServiceFlowParamSI);
1704
1705         if(ulAddrSFParamSet == 0 || NULL == pucDestBuffer)
1706         {
1707                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "Got Param address as 0!!");
1708                 return 0;
1709         }
1710         ulAddrSFParamSet = ntohl(ulAddrSFParamSet);
1711         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  " RestoreSFParam: Total Words of DSX Message To Read: 0x%zx  From Target At : 0x%lx ",
1712                                 nBytesToRead/sizeof(ULONG),ulAddrSFParamSet);
1713         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "sizeof(stServiceFlowParamSI) = %zx", sizeof(stServiceFlowParamSI));
1714
1715         //Read out the SF Param Set At the indicated Location
1716         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "nBytesToRead = %x", nBytesToRead);
1717         if(rdm(Adapter, ulAddrSFParamSet, (PUCHAR)pucDestBuffer, nBytesToRead) < 0)
1718                 return STATUS_FAILURE;
1719
1720         return 1;
1721 }
1722
1723
1724 static ULONG StoreSFParam(PMINI_ADAPTER Adapter,PUCHAR pucSrcBuffer,ULONG  ulAddrSFParamSet)
1725 {
1726     UINT        nBytesToWrite = sizeof(stServiceFlowParamSI);
1727         UINT    uiRetVal =0;
1728
1729         if(ulAddrSFParamSet == 0 || NULL == pucSrcBuffer)
1730         {
1731                 return 0;
1732         }
1733         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  " StoreSFParam: Total Words of DSX Message To Write: 0x%zX  To Target At : 0x%lX ",(nBytesToWrite/sizeof(ULONG)),ulAddrSFParamSet);
1734
1735         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "WRM  with %x bytes",nBytesToWrite);
1736
1737         uiRetVal = wrm(Adapter,ulAddrSFParamSet,(PUCHAR)pucSrcBuffer, nBytesToWrite);
1738         if(uiRetVal < 0) {
1739                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "%s:%d WRM failed",__FUNCTION__, __LINE__);
1740                 return uiRetVal;
1741         }
1742         return 1;
1743 }
1744
1745 ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter,PVOID pvBuffer,UINT *puBufferLength)
1746 {
1747         stLocalSFAddIndicationAlt *pstAddIndicationAlt = NULL;
1748         stLocalSFAddIndication *  pstAddIndication = NULL;
1749         stLocalSFDeleteRequest *pstDeletionRequest;
1750         UINT uiSearchRuleIndex;
1751         ULONG ulSFID;
1752
1753         pstAddIndicationAlt = (stLocalSFAddIndicationAlt *)(pvBuffer);
1754
1755         /*
1756         *       In case of DSD Req By MS, we should immediately delete this SF so that
1757         *       we can stop the further classifying the pkt for this SF.
1758         */
1759         if(pstAddIndicationAlt->u8Type == DSD_REQ)
1760         {
1761                 pstDeletionRequest = (stLocalSFDeleteRequest *)pvBuffer;
1762
1763                 ulSFID = ntohl(pstDeletionRequest->u32SFID);
1764                 uiSearchRuleIndex=SearchSfid(Adapter,ulSFID);
1765
1766                 if(uiSearchRuleIndex < NO_OF_QUEUES)
1767                 {
1768                         deleteSFBySfid(Adapter,uiSearchRuleIndex);
1769                         Adapter->u32TotalDSD++;
1770                 }
1771                 return 1;
1772         }
1773
1774
1775         if(     (pstAddIndicationAlt->u8Type == DSD_RSP) ||
1776                 (pstAddIndicationAlt->u8Type == DSD_ACK))
1777         {
1778                 //No Special handling send the message as it is
1779                 return 1;
1780         }
1781         // For DSA_REQ, only upto "psfAuthorizedSet" parameter should be accessed by driver!
1782
1783         pstAddIndication=(stLocalSFAddIndication *)kmalloc(sizeof(*pstAddIndication), GFP_KERNEL);
1784         if(NULL==pstAddIndication)
1785                 return 0;
1786
1787         /* AUTHORIZED SET */
1788         pstAddIndication->psfAuthorizedSet = (stServiceFlowParamSI *)
1789                         GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID);
1790         if(!pstAddIndication->psfAuthorizedSet)
1791                 return 0;
1792
1793         if(StoreSFParam(Adapter,(PUCHAR)&pstAddIndicationAlt->sfAuthorizedSet,
1794                                 (ULONG)pstAddIndication->psfAuthorizedSet)!= 1)
1795                 return 0;
1796
1797         /* this can't possibly be right */
1798         pstAddIndication->psfAuthorizedSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfAuthorizedSet);
1799
1800         if(pstAddIndicationAlt->u8Type == DSA_REQ)
1801         {
1802                 stLocalSFAddRequest AddRequest;
1803
1804                 AddRequest.u8Type = pstAddIndicationAlt->u8Type;
1805                 AddRequest.eConnectionDir = pstAddIndicationAlt->u8Direction;
1806                 AddRequest.u16TID = pstAddIndicationAlt->u16TID;
1807                 AddRequest.u16CID = pstAddIndicationAlt->u16CID;
1808                 AddRequest.u16VCID = pstAddIndicationAlt->u16VCID;
1809                 AddRequest.psfParameterSet =pstAddIndication->psfAuthorizedSet ;
1810                 (*puBufferLength) = sizeof(stLocalSFAddRequest);
1811                 memcpy(pvBuffer,&AddRequest,sizeof(stLocalSFAddRequest));
1812                 return 1;
1813         }
1814
1815         // Since it's not DSA_REQ, we can access all field in pstAddIndicationAlt
1816
1817         //We need to extract the structure from the buffer and pack it differently
1818
1819         pstAddIndication->u8Type = pstAddIndicationAlt->u8Type;
1820         pstAddIndication->eConnectionDir= pstAddIndicationAlt->u8Direction ;
1821         pstAddIndication->u16TID = pstAddIndicationAlt->u16TID;
1822         pstAddIndication->u16CID = pstAddIndicationAlt->u16CID;
1823         pstAddIndication->u16VCID = pstAddIndicationAlt->u16VCID;
1824         pstAddIndication->u8CC = pstAddIndicationAlt->u8CC;
1825
1826         /* ADMITTED SET */
1827         pstAddIndication->psfAdmittedSet = (stServiceFlowParamSI *)
1828                 GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID);
1829         if(!pstAddIndication->psfAdmittedSet)
1830                 return 0;
1831         if(StoreSFParam(Adapter,(PUCHAR)&pstAddIndicationAlt->sfAdmittedSet,(ULONG)pstAddIndication->psfAdmittedSet) != 1)
1832                 return 0;
1833
1834         pstAddIndication->psfAdmittedSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfAdmittedSet);
1835
1836
1837         /* ACTIVE SET */
1838         pstAddIndication->psfActiveSet = (stServiceFlowParamSI *)
1839                 GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID);
1840         if(!pstAddIndication->psfActiveSet)
1841                 return 0;
1842         if(StoreSFParam(Adapter,(PUCHAR)&pstAddIndicationAlt->sfActiveSet,(ULONG)pstAddIndication->psfActiveSet) != 1)
1843                 return 0;
1844
1845         pstAddIndication->psfActiveSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfActiveSet);
1846
1847         (*puBufferLength) = sizeof(stLocalSFAddIndication);
1848         *(stLocalSFAddIndication *)pvBuffer = *pstAddIndication;
1849         kfree(pstAddIndication);
1850         return 1;
1851 }
1852
1853
1854 static inline stLocalSFAddIndicationAlt
1855 *RestoreCmControlResponseMessage(register PMINI_ADAPTER Adapter,register PVOID pvBuffer)
1856 {
1857         ULONG ulStatus=0;
1858         stLocalSFAddIndication *pstAddIndication = NULL;
1859         stLocalSFAddIndicationAlt *pstAddIndicationDest = NULL;
1860         pstAddIndication = (stLocalSFAddIndication *)(pvBuffer);
1861
1862         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "=====>" );
1863         if ((pstAddIndication->u8Type == DSD_REQ) ||
1864                 (pstAddIndication->u8Type == DSD_RSP) ||
1865                 (pstAddIndication->u8Type == DSD_ACK))
1866         {
1867                 return (stLocalSFAddIndicationAlt *)pvBuffer;
1868         }
1869
1870         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Inside RestoreCmControlResponseMessage ");
1871         /*
1872         //Need to Allocate memory to contain the SUPER Large structures
1873         //Our driver cant create these structures on Stack :(
1874         */
1875         pstAddIndicationDest=kmalloc(sizeof(stLocalSFAddIndicationAlt), GFP_KERNEL);
1876
1877         if(pstAddIndicationDest)
1878         {
1879                 memset(pstAddIndicationDest,0,sizeof(stLocalSFAddIndicationAlt));
1880         }
1881         else
1882         {
1883                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Failed to allocate memory for SF Add Indication Structure ");
1884                 return NULL;
1885         }
1886         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-u8Type : 0x%X",pstAddIndication->u8Type);
1887         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-u8Direction : 0x%X",pstAddIndication->eConnectionDir);
1888         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-u8TID : 0x%X",ntohs(pstAddIndication->u16TID));
1889         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-u8CID : 0x%X",ntohs(pstAddIndication->u16CID));
1890         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-u16VCID : 0x%X",ntohs(pstAddIndication->u16VCID));
1891         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-autorized set loc : %p",pstAddIndication->psfAuthorizedSet);
1892         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-admitted set loc : %p",pstAddIndication->psfAdmittedSet);
1893         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-Active set loc : %p",pstAddIndication->psfActiveSet);
1894
1895         pstAddIndicationDest->u8Type = pstAddIndication->u8Type;
1896         pstAddIndicationDest->u8Direction = pstAddIndication->eConnectionDir;
1897         pstAddIndicationDest->u16TID = pstAddIndication->u16TID;
1898         pstAddIndicationDest->u16CID = pstAddIndication->u16CID;
1899         pstAddIndicationDest->u16VCID = pstAddIndication->u16VCID;
1900         pstAddIndicationDest->u8CC = pstAddIndication->u8CC;
1901
1902         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "Restoring Active Set ");
1903         ulStatus=RestoreSFParam(Adapter,(ULONG)pstAddIndication->psfActiveSet, (PUCHAR)&pstAddIndicationDest->sfActiveSet);
1904         if(ulStatus != 1)
1905         {
1906                 goto failed_restore_sf_param;
1907         }
1908         if(pstAddIndicationDest->sfActiveSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF)
1909                 pstAddIndicationDest->sfActiveSet.u8TotalClassifiers = MAX_CLASSIFIERS_IN_SF;
1910
1911         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "Restoring Admitted Set ");
1912         ulStatus=RestoreSFParam(Adapter,(ULONG)pstAddIndication->psfAdmittedSet,(PUCHAR)&pstAddIndicationDest->sfAdmittedSet);
1913         if(ulStatus != 1)
1914         {
1915                 goto failed_restore_sf_param;
1916         }
1917         if(pstAddIndicationDest->sfAdmittedSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF)
1918                 pstAddIndicationDest->sfAdmittedSet.u8TotalClassifiers = MAX_CLASSIFIERS_IN_SF;
1919
1920         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "Restoring Authorized Set ");
1921         ulStatus=RestoreSFParam(Adapter,(ULONG)pstAddIndication->psfAuthorizedSet,(PUCHAR)&pstAddIndicationDest->sfAuthorizedSet);
1922         if(ulStatus != 1)
1923         {
1924                 goto failed_restore_sf_param;
1925         }
1926         if(pstAddIndicationDest->sfAuthorizedSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF)
1927                 pstAddIndicationDest->sfAuthorizedSet.u8TotalClassifiers = MAX_CLASSIFIERS_IN_SF;
1928
1929         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Dumping the whole raw packet");
1930         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "============================================================");
1931         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, " pstAddIndicationDest->sfActiveSet size  %zx %p", sizeof(*pstAddIndicationDest), pstAddIndicationDest);
1932         //BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, (unsigned char *)pstAddIndicationDest, sizeof(*pstAddIndicationDest));
1933         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "============================================================");
1934         return pstAddIndicationDest;
1935 failed_restore_sf_param:
1936         kfree(pstAddIndicationDest);
1937         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<=====" );
1938         return NULL;
1939 }
1940
1941 ULONG SetUpTargetDsxBuffers(PMINI_ADAPTER Adapter)
1942 {
1943         ULONG ulTargetDsxBuffersBase = 0;
1944         ULONG ulCntTargetBuffers;
1945         ULONG ulIndex=0;
1946         int Status;
1947
1948         if (!Adapter) {
1949                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Adapter was NULL!!!");
1950                 return 0;
1951         }
1952
1953         if(Adapter->astTargetDsxBuffer[0].ulTargetDsxBuffer)
1954                 return 1;
1955
1956         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Size of Each DSX Buffer(Also size of ServiceFlowParamSI): %zx ",sizeof(stServiceFlowParamSI));
1957         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Reading DSX buffer From Target location %x ",DSX_MESSAGE_EXCHANGE_BUFFER);
1958
1959         Status = rdmalt(Adapter, DSX_MESSAGE_EXCHANGE_BUFFER,
1960                                         (PUINT)&ulTargetDsxBuffersBase, sizeof(UINT));
1961         if(Status < 0)
1962         {
1963                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "RDM failed!!");
1964                 return 0;
1965         }
1966
1967         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Base Address Of DSX  Target Buffer : 0x%lx",ulTargetDsxBuffersBase);
1968
1969         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "Tgt Buffer is Now %lx :",ulTargetDsxBuffersBase);
1970
1971         ulCntTargetBuffers = DSX_MESSAGE_EXCHANGE_BUFFER_SIZE/sizeof(stServiceFlowParamSI);
1972
1973         Adapter->ulTotalTargetBuffersAvailable =
1974                 ulCntTargetBuffers > MAX_TARGET_DSX_BUFFERS ?
1975                 MAX_TARGET_DSX_BUFFERS : ulCntTargetBuffers;
1976
1977         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, " Total Target DSX Buffer setup %lx ",Adapter->ulTotalTargetBuffersAvailable);
1978
1979         for(ulIndex=0; ulIndex < Adapter->ulTotalTargetBuffersAvailable ; ulIndex++)
1980         {
1981                 Adapter->astTargetDsxBuffer[ulIndex].ulTargetDsxBuffer = ulTargetDsxBuffersBase;
1982                 Adapter->astTargetDsxBuffer[ulIndex].valid=1;
1983                 Adapter->astTargetDsxBuffer[ulIndex].tid=0;
1984                 ulTargetDsxBuffersBase+=sizeof(stServiceFlowParamSI);
1985                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "  Target DSX Buffer %lx setup at 0x%lx",
1986                         ulIndex, Adapter->astTargetDsxBuffer[ulIndex].ulTargetDsxBuffer);
1987         }
1988         Adapter->ulCurrentTargetBuffer = 0;
1989         Adapter->ulFreeTargetBufferCnt = Adapter->ulTotalTargetBuffersAvailable;
1990         return 1;
1991 }
1992
1993 ULONG GetNextTargetBufferLocation(PMINI_ADAPTER Adapter,B_UINT16 tid)
1994 {
1995         ULONG  ulTargetDSXBufferAddress;
1996         ULONG  ulTargetDsxBufferIndexToUse,ulMaxTry;
1997
1998         if((Adapter->ulTotalTargetBuffersAvailable == 0)||
1999                         (Adapter->ulFreeTargetBufferCnt == 0))
2000         {
2001         ClearTargetDSXBuffer(Adapter,tid,FALSE);
2002                 return 0;
2003         }
2004
2005     ulTargetDsxBufferIndexToUse = Adapter->ulCurrentTargetBuffer;
2006     ulMaxTry = Adapter->ulTotalTargetBuffersAvailable;
2007         while((ulMaxTry)&&(Adapter->astTargetDsxBuffer[ulTargetDsxBufferIndexToUse].valid != 1))
2008         {
2009                  ulTargetDsxBufferIndexToUse = (ulTargetDsxBufferIndexToUse+1)%
2010                                         Adapter->ulTotalTargetBuffersAvailable;
2011                  ulMaxTry--;
2012         }
2013
2014         if(ulMaxTry==0)
2015         {
2016                 BCM_DEBUG_PRINT (Adapter, DBG_TYPE_PRINTK, 0, 0, "\n GetNextTargetBufferLocation : Error No Free Target DSX Buffers FreeCnt : %lx ",Adapter->ulFreeTargetBufferCnt);
2017                 ClearTargetDSXBuffer(Adapter,tid,FALSE);
2018                 return 0;
2019         }
2020
2021
2022         ulTargetDSXBufferAddress =
2023                 Adapter->astTargetDsxBuffer[ulTargetDsxBufferIndexToUse].ulTargetDsxBuffer;
2024         Adapter->astTargetDsxBuffer[ulTargetDsxBufferIndexToUse].valid=0;
2025         Adapter->astTargetDsxBuffer[ulTargetDsxBufferIndexToUse].tid=tid;
2026         Adapter->ulFreeTargetBufferCnt--;
2027
2028
2029         ulTargetDsxBufferIndexToUse =
2030                 (ulTargetDsxBufferIndexToUse+1)%Adapter->ulTotalTargetBuffersAvailable;
2031         Adapter->ulCurrentTargetBuffer = ulTargetDsxBufferIndexToUse;
2032         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "GetNextTargetBufferLocation :Returning address %lx tid %d\n",
2033                 ulTargetDSXBufferAddress,tid);
2034         return ulTargetDSXBufferAddress;
2035 }
2036
2037
2038 INT AllocAdapterDsxBuffer(PMINI_ADAPTER Adapter)
2039 {
2040         /*
2041         //Need to Allocate memory to contain the SUPER Large structures
2042         //Our driver cant create these structures on Stack
2043         */
2044         Adapter->caDsxReqResp=kmalloc(sizeof(stLocalSFAddIndicationAlt)+LEADER_SIZE, GFP_KERNEL);
2045         if(!Adapter->caDsxReqResp)
2046                 return -ENOMEM;
2047         return 0;
2048 }
2049
2050 INT FreeAdapterDsxBuffer(PMINI_ADAPTER Adapter)
2051 {
2052         if(Adapter->caDsxReqResp)
2053         {
2054                 kfree(Adapter->caDsxReqResp);
2055         }
2056         return 0;
2057
2058 }
2059 /**
2060 @ingroup ctrl_pkt_functions
2061 This routinue would process the Control responses
2062 for the Connection Management.
2063 @return   - Queue index for the free SFID else returns Invalid Index.
2064 */
2065 BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter,  /**<Pointer to the Adapter structure*/
2066                                                                                         PVOID pvBuffer /**Starting Address of the Buffer, that contains the AddIndication Data*/
2067                                                                                         )
2068 {
2069         stServiceFlowParamSI                    *psfLocalSet=NULL;
2070         stLocalSFAddIndicationAlt               *pstAddIndication = NULL;
2071         stLocalSFChangeIndicationAlt    *pstChangeIndication = NULL;
2072         PLEADER                                                 pLeader=NULL;
2073         /*
2074         //Otherwise the message contains a target address from where we need to
2075         //read out the rest of the service flow param structure
2076         */
2077         if((pstAddIndication = RestoreCmControlResponseMessage(Adapter,pvBuffer))
2078                         == NULL)
2079         {
2080                 ClearTargetDSXBuffer(Adapter,((stLocalSFAddIndication *)pvBuffer)->u16TID, FALSE);
2081                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_PRINTK, 0, 0, "Error in restoring Service Flow param structure from DSx message");
2082                 return FALSE;
2083         }
2084
2085         DumpCmControlPacket(pstAddIndication);
2086         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "====>");
2087         pLeader = (PLEADER)Adapter->caDsxReqResp;
2088
2089         pLeader->Status =CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ;
2090         pLeader->Vcid = 0;
2091
2092         ClearTargetDSXBuffer(Adapter,pstAddIndication->u16TID,FALSE);
2093     BCM_DEBUG_PRINT (Adapter, DBG_TYPE_PRINTK, 0, 0, "### TID RECEIVED %d\n",pstAddIndication->u16TID);
2094         switch(pstAddIndication->u8Type)
2095         {
2096                 case DSA_REQ:
2097                 {
2098                         pLeader->PLength = sizeof(stLocalSFAddIndicationAlt);
2099                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Sending DSA Response....\n");
2100                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "SENDING DSA RESPONSE TO MAC %d", pLeader->PLength );
2101                         *((stLocalSFAddIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))
2102                                                 = *pstAddIndication;
2103                         ((stLocalSFAddIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSA_RSP;
2104
2105                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  " VCID = %x", ntohs(pstAddIndication->u16VCID));
2106                         CopyBufferToControlPacket(Adapter,(PVOID)Adapter->caDsxReqResp);
2107                         kfree(pstAddIndication);
2108                 }
2109                 break;
2110                 case DSA_RSP:
2111                 {
2112                         pLeader->PLength = sizeof(stLocalSFAddIndicationAlt);
2113                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SENDING DSA ACK TO MAC %d",
2114                                 pLeader->PLength);
2115                         *((stLocalSFAddIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))
2116                                                 = *pstAddIndication;
2117                         ((stLocalSFAddIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSA_ACK;
2118
2119                 }//no break here..we should go down.
2120                 case DSA_ACK:
2121                 {
2122                         UINT uiSearchRuleIndex=0;
2123                         struct timeval tv = {0};
2124                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "VCID:0x%X",
2125                                 ntohs(pstAddIndication->u16VCID));
2126             uiSearchRuleIndex=SearchFreeSfid(Adapter);
2127             BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"uiSearchRuleIndex:0x%X ",
2128                                 uiSearchRuleIndex);
2129                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Direction:0x%X ",
2130                                 pstAddIndication->u8Direction);
2131                         if((uiSearchRuleIndex< NO_OF_QUEUES) )
2132                         {
2133                                 Adapter->PackInfo[uiSearchRuleIndex].ucDirection =
2134                                         pstAddIndication->u8Direction;
2135                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "bValid:0x%X ",
2136                                         pstAddIndication->sfActiveSet.bValid);
2137                                 if(pstAddIndication->sfActiveSet.bValid==TRUE)
2138                                 {
2139                                         Adapter->PackInfo[uiSearchRuleIndex].bActiveSet=TRUE;
2140                                 }
2141                                 if(pstAddIndication->sfAuthorizedSet.bValid==TRUE)
2142                                 {
2143                                         Adapter->PackInfo[uiSearchRuleIndex].bAuthorizedSet=TRUE;
2144                                 }
2145                                 if(pstAddIndication->sfAdmittedSet.bValid==TRUE)
2146                                 {
2147                                         Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet=TRUE;
2148                                 }
2149                                 if(FALSE == pstAddIndication->sfActiveSet.bValid)
2150                                 {
2151                                         Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE;
2152                                         Adapter->PackInfo[uiSearchRuleIndex].bActivateRequestSent = FALSE;
2153                                         if(pstAddIndication->sfAdmittedSet.bValid)
2154                                         {
2155                                                 psfLocalSet = &pstAddIndication->sfAdmittedSet;
2156                                         }
2157                                         else if(pstAddIndication->sfAuthorizedSet.bValid)
2158                                         {
2159                                                 psfLocalSet = &pstAddIndication->sfAuthorizedSet;
2160                                         }
2161                                 }
2162                                 else
2163                                 {
2164                                         psfLocalSet = &pstAddIndication->sfActiveSet;
2165                                         Adapter->PackInfo[uiSearchRuleIndex].bActive=TRUE;
2166                                 }
2167
2168                                 if(!psfLocalSet)
2169                                 {
2170                                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "No set is valid\n");
2171                                         Adapter->PackInfo[uiSearchRuleIndex].bActive=FALSE;
2172                     Adapter->PackInfo[uiSearchRuleIndex].bValid=FALSE;
2173                                         Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value=0;
2174                                         kfree(pstAddIndication);
2175                                 }
2176
2177                                 else if(psfLocalSet->bValid && (pstAddIndication->u8CC == 0))
2178                                 {
2179                                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "DSA ACK");
2180                                         Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value =
2181                                                 ntohs(pstAddIndication->u16VCID);
2182                                         Adapter->PackInfo[uiSearchRuleIndex].usCID =
2183                                                 ntohs(pstAddIndication->u16CID);
2184
2185                                         if(UPLINK_DIR == pstAddIndication->u8Direction)
2186                                                 atomic_set(&Adapter->PackInfo[uiSearchRuleIndex].uiPerSFTxResourceCount, DEFAULT_PERSFCOUNT);
2187                                         CopyToAdapter(Adapter,psfLocalSet,uiSearchRuleIndex,
2188                                                                 DSA_ACK, pstAddIndication);
2189                                         // don't free pstAddIndication
2190
2191                                         /* Inside CopyToAdapter, Sorting of all the SFs take place.
2192                                             Hence any access to the newly added SF through uiSearchRuleIndex is invalid.
2193                                             SHOULD BE STRICTLY AVOIDED.
2194                                         */
2195 //                                      *(PULONG)(((PUCHAR)pvBuffer)+1)=psfLocalSet->u32SFID;
2196                                         memcpy((((PUCHAR)pvBuffer)+1), &psfLocalSet->u32SFID, 4);
2197
2198                                         if(pstAddIndication->sfActiveSet.bValid == TRUE)
2199                                         {
2200                                                 if(UPLINK_DIR == pstAddIndication->u8Direction)
2201                                                 {
2202                                                         if(!Adapter->LinkUpStatus)
2203                                                         {
2204                                                                 netif_carrier_on(Adapter->dev);
2205                                                         netif_start_queue(Adapter->dev);
2206                                                                 Adapter->LinkUpStatus = 1;
2207                                                                 do_gettimeofday(&tv);
2208
2209                                                                 atomic_set(&Adapter->TxPktAvail, 1);
2210                                                                 wake_up(&Adapter->tx_packet_wait_queue);
2211                                                                 Adapter->liTimeSinceLastNetEntry = tv.tv_sec;
2212                                                                 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "============Tx Service Flow Created!");
2213                                                         }
2214                                                 }
2215                                         }
2216                                 }
2217
2218                                 else
2219                                 {
2220                                         Adapter->PackInfo[uiSearchRuleIndex].bActive=FALSE;
2221                     Adapter->PackInfo[uiSearchRuleIndex].bValid=FALSE;
2222                                         Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value=0;
2223                                         kfree(pstAddIndication);
2224                                 }
2225                         }
2226                         else
2227                         {
2228                                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_PRINTK, 0, 0, "DSA ACK did not get valid SFID");
2229                                 kfree(pstAddIndication);
2230                                 return FALSE;
2231                         }
2232                 }
2233                 break;
2234                 case DSC_REQ:
2235                 {
2236                         pLeader->PLength = sizeof(stLocalSFChangeIndicationAlt);
2237                         pstChangeIndication     = (stLocalSFChangeIndicationAlt*)pstAddIndication;
2238                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SENDING DSC RESPONSE TO MAC %d", pLeader->PLength);
2239
2240                         *((stLocalSFChangeIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE])) = *pstChangeIndication;
2241                         ((stLocalSFChangeIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSC_RSP;
2242
2243                         CopyBufferToControlPacket(Adapter,(PVOID)Adapter->caDsxReqResp);
2244                         kfree(pstAddIndication);
2245                 }
2246                 break;
2247                 case DSC_RSP:
2248                 {
2249                         pLeader->PLength = sizeof(stLocalSFChangeIndicationAlt);
2250                         pstChangeIndication     = (stLocalSFChangeIndicationAlt*)pstAddIndication;
2251                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SENDING DSC ACK TO MAC %d", pLeader->PLength);
2252                         *((stLocalSFChangeIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE])) = *pstChangeIndication;
2253                         ((stLocalSFChangeIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSC_ACK;
2254                 }
2255                 case DSC_ACK:
2256                 {
2257                         UINT uiSearchRuleIndex=0;
2258
2259                         pstChangeIndication = (stLocalSFChangeIndicationAlt *)pstAddIndication;
2260                         uiSearchRuleIndex=SearchSfid(Adapter,ntohl(pstChangeIndication->sfActiveSet.u32SFID));
2261                         if(uiSearchRuleIndex > NO_OF_QUEUES-1)
2262                         {
2263                                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_PRINTK, 0, 0, "SF doesn't exist for which DSC_ACK is received");
2264                         }
2265                         if((uiSearchRuleIndex < NO_OF_QUEUES))
2266                         {
2267                                 Adapter->PackInfo[uiSearchRuleIndex].ucDirection = pstChangeIndication->u8Direction;
2268                                 if(pstChangeIndication->sfActiveSet.bValid==TRUE)
2269                                 {
2270                                         Adapter->PackInfo[uiSearchRuleIndex].bActiveSet=TRUE;
2271                                 }
2272                                 if(pstChangeIndication->sfAuthorizedSet.bValid==TRUE)
2273                                 {
2274                                         Adapter->PackInfo[uiSearchRuleIndex].bAuthorizedSet=TRUE;
2275                                 }
2276                                 if(pstChangeIndication->sfAdmittedSet.bValid==TRUE)
2277                                 {
2278                                         Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet=TRUE;
2279                                 }
2280
2281                                 if(FALSE==pstChangeIndication->sfActiveSet.bValid)
2282                                 {
2283                                         Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE;
2284                                         Adapter->PackInfo[uiSearchRuleIndex].bActivateRequestSent = FALSE;
2285                                         if(pstChangeIndication->sfAdmittedSet.bValid)
2286                                         {
2287                                                 psfLocalSet = &pstChangeIndication->sfAdmittedSet;
2288                                         }
2289                                         else if(pstChangeIndication->sfAuthorizedSet.bValid)
2290                                         {
2291                                                 psfLocalSet = &pstChangeIndication->sfAuthorizedSet;
2292                                         }
2293                                 }
2294
2295                                 else
2296                                 {
2297                                         psfLocalSet = &pstChangeIndication->sfActiveSet;
2298                                         Adapter->PackInfo[uiSearchRuleIndex].bActive=TRUE;
2299                                 }
2300                                 if(psfLocalSet->bValid && (pstChangeIndication->u8CC == 0))
2301                                 {
2302                                         Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value =
2303                                                 ntohs(pstChangeIndication->u16VCID);
2304                                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "CC field is %d bvalid = %d\n",
2305                                                         pstChangeIndication->u8CC, psfLocalSet->bValid);
2306                                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "VCID= %d\n", ntohs(pstChangeIndication->u16VCID));
2307                                         Adapter->PackInfo[uiSearchRuleIndex].usCID =
2308                                                 ntohs(pstChangeIndication->u16CID);
2309                                         CopyToAdapter(Adapter,psfLocalSet,uiSearchRuleIndex,
2310                                                                 DSC_ACK, pstAddIndication);
2311
2312                                         *(PULONG)(((PUCHAR)pvBuffer)+1)=psfLocalSet->u32SFID;
2313                                 }
2314                                 else if(pstChangeIndication->u8CC == 6)
2315                                 {
2316                                         deleteSFBySfid(Adapter,uiSearchRuleIndex);
2317                                         kfree(pstAddIndication);
2318                                 }
2319                         }
2320                         else
2321                         {
2322                                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_PRINTK, 0, 0, "DSC ACK did not get valid SFID");
2323                                 kfree(pstAddIndication);
2324                                 return FALSE;
2325                         }
2326                 }
2327                 break;
2328                 case DSD_REQ:
2329                 {
2330                         UINT uiSearchRuleIndex;
2331                         ULONG ulSFID;
2332
2333                         pLeader->PLength = sizeof(stLocalSFDeleteIndication);
2334                         *((stLocalSFDeleteIndication*)&(Adapter->caDsxReqResp[LEADER_SIZE])) = *((stLocalSFDeleteIndication*)pstAddIndication);
2335
2336                         ulSFID = ntohl(((stLocalSFDeleteIndication*)pstAddIndication)->u32SFID);
2337                         uiSearchRuleIndex=SearchSfid(Adapter,ulSFID);
2338                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "DSD - Removing connection %x",uiSearchRuleIndex);
2339
2340                         if(uiSearchRuleIndex < NO_OF_QUEUES)
2341                         {
2342                                 //Delete All Classifiers Associated with this SFID
2343                                 deleteSFBySfid(Adapter,uiSearchRuleIndex);
2344                                 Adapter->u32TotalDSD++;
2345                         }
2346
2347                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SENDING DSD RESPONSE TO MAC");
2348                         ((stLocalSFDeleteIndication*)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSD_RSP;
2349                         CopyBufferToControlPacket(Adapter,(PVOID)Adapter->caDsxReqResp);
2350                 }
2351                 case DSD_RSP:
2352                 {
2353                         //Do nothing as SF has already got Deleted
2354                 }
2355                 break;
2356         case DSD_ACK:
2357                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "DSD ACK Rcd, let App handle it\n");
2358                         break;
2359         default:
2360                 kfree(pstAddIndication);
2361                 return FALSE ;
2362         }
2363         return TRUE;
2364 }
2365
2366 int get_dsx_sf_data_to_application(PMINI_ADAPTER Adapter, UINT uiSFId, void __user *user_buffer)
2367 {
2368         int status = 0;
2369         struct _packet_info *psSfInfo=NULL;
2370         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "status =%d",status);
2371         status = SearchSfid(Adapter, uiSFId);
2372         if (status >= NO_OF_QUEUES) {
2373                 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SFID %d not present in queue !!!", uiSFId );
2374                 return -EINVAL;
2375         }
2376         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "status =%d",status);
2377         psSfInfo=&Adapter->PackInfo[status];
2378         if(psSfInfo->pstSFIndication && copy_to_user(user_buffer,
2379                 psSfInfo->pstSFIndication, sizeof(stLocalSFAddIndicationAlt)))
2380         {
2381                 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "copy to user failed SFID %d, present in queue !!!", uiSFId );
2382                 status = -EFAULT;
2383                 return status;
2384         }
2385         return STATUS_SUCCESS;
2386 }
2387
2388 VOID OverrideServiceFlowParams(PMINI_ADAPTER Adapter,PUINT puiBuffer)
2389 {
2390         B_UINT32 u32NumofSFsinMsg    = ntohl(*(puiBuffer + 1));
2391         stIM_SFHostNotify *pHostInfo = NULL;
2392         UINT uiSearchRuleIndex       = 0;
2393         ULONG ulSFID                 = 0;
2394
2395         puiBuffer+=2;
2396
2397         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "u32NumofSFsinMsg: 0x%x\n",u32NumofSFsinMsg);
2398
2399         while(u32NumofSFsinMsg != 0 && u32NumofSFsinMsg < NO_OF_QUEUES)
2400         {
2401                 u32NumofSFsinMsg--;
2402                 pHostInfo = (stIM_SFHostNotify *)puiBuffer;
2403                 puiBuffer = (PUINT)(pHostInfo + 1);
2404
2405                 ulSFID = ntohl(pHostInfo->SFID);
2406                 uiSearchRuleIndex=SearchSfid(Adapter,ulSFID);
2407                 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"SFID: 0x%lx\n",ulSFID);
2408
2409                 if(uiSearchRuleIndex >= NO_OF_QUEUES || uiSearchRuleIndex == HiPriority)
2410                 {
2411                         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);
2412                         continue;
2413                 }
2414
2415                 if(pHostInfo->RetainSF == FALSE)
2416                 {
2417                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Going to Delete SF");
2418                         deleteSFBySfid(Adapter,uiSearchRuleIndex);
2419                 }
2420                 else
2421                 {
2422
2423                         Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value = ntohs(pHostInfo->VCID);
2424                         Adapter->PackInfo[uiSearchRuleIndex].usCID = ntohs(pHostInfo->newCID);
2425                         Adapter->PackInfo[uiSearchRuleIndex].bActive=FALSE;
2426
2427                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"pHostInfo->QoSParamSet: 0x%x\n",pHostInfo->QoSParamSet);
2428
2429                         if(pHostInfo->QoSParamSet & 0x1)
2430                                 Adapter->PackInfo[uiSearchRuleIndex].bAuthorizedSet =TRUE;
2431                         if(pHostInfo->QoSParamSet & 0x2)
2432                                 Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet =TRUE;
2433                         if(pHostInfo->QoSParamSet & 0x4)
2434                         {
2435                                 Adapter->PackInfo[uiSearchRuleIndex].bActiveSet =TRUE;
2436                                 Adapter->PackInfo[uiSearchRuleIndex].bActive=TRUE;
2437                         }
2438                 }
2439         }
2440 }
2441
2442
2443