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