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