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