Qos.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856
  1. /**
  2. @file Qos.C
  3. This file contains the routines related to Quality of Service.
  4. */
  5. #include "headers.h"
  6. static void EThCSGetPktInfo(PMINI_ADAPTER Adapter,PVOID pvEthPayload,PS_ETHCS_PKT_INFO pstEthCsPktInfo);
  7. static BOOLEAN EThCSClassifyPkt(PMINI_ADAPTER Adapter,struct sk_buff* skb,PS_ETHCS_PKT_INFO pstEthCsPktInfo,S_CLASSIFIER_RULE *pstClassifierRule, B_UINT8 EthCSCupport);
  8. static USHORT IpVersion4(PMINI_ADAPTER Adapter, struct iphdr *iphd,
  9. S_CLASSIFIER_RULE *pstClassifierRule );
  10. static VOID PruneQueue(PMINI_ADAPTER Adapter, INT iIndex);
  11. /*******************************************************************
  12. * Function - MatchSrcIpAddress()
  13. *
  14. * Description - Checks whether the Source IP address from the packet
  15. * matches with that of Queue.
  16. *
  17. * Parameters - pstClassifierRule: Pointer to the packet info structure.
  18. * - ulSrcIP : Source IP address from the packet.
  19. *
  20. * Returns - TRUE(If address matches) else FAIL .
  21. *********************************************************************/
  22. BOOLEAN MatchSrcIpAddress(S_CLASSIFIER_RULE *pstClassifierRule,ULONG ulSrcIP)
  23. {
  24. UCHAR ucLoopIndex=0;
  25. PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
  26. ulSrcIP=ntohl(ulSrcIP);
  27. if(0 == pstClassifierRule->ucIPSourceAddressLength)
  28. return TRUE;
  29. for(ucLoopIndex=0; ucLoopIndex < (pstClassifierRule->ucIPSourceAddressLength);ucLoopIndex++)
  30. {
  31. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Src Ip Address Mask:0x%x PacketIp:0x%x and Classification:0x%x", (UINT)pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex], (UINT)ulSrcIP, (UINT)pstClassifierRule->stSrcIpAddress.ulIpv6Addr[ucLoopIndex]);
  32. if((pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex] & ulSrcIP)==
  33. (pstClassifierRule->stSrcIpAddress.ulIpv4Addr[ucLoopIndex] & pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex] ))
  34. {
  35. return TRUE;
  36. }
  37. }
  38. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Src Ip Address Not Matched");
  39. return FALSE;
  40. }
  41. /*******************************************************************
  42. * Function - MatchDestIpAddress()
  43. *
  44. * Description - Checks whether the Destination IP address from the packet
  45. * matches with that of Queue.
  46. *
  47. * Parameters - pstClassifierRule: Pointer to the packet info structure.
  48. * - ulDestIP : Destination IP address from the packet.
  49. *
  50. * Returns - TRUE(If address matches) else FAIL .
  51. *********************************************************************/
  52. BOOLEAN MatchDestIpAddress(S_CLASSIFIER_RULE *pstClassifierRule,ULONG ulDestIP)
  53. {
  54. UCHAR ucLoopIndex=0;
  55. PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
  56. ulDestIP=ntohl(ulDestIP);
  57. if(0 == pstClassifierRule->ucIPDestinationAddressLength)
  58. return TRUE;
  59. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Destination Ip Address 0x%x 0x%x 0x%x ", (UINT)ulDestIP, (UINT)pstClassifierRule->stDestIpAddress.ulIpv4Mask[ucLoopIndex], (UINT)pstClassifierRule->stDestIpAddress.ulIpv4Addr[ucLoopIndex]);
  60. for(ucLoopIndex=0;ucLoopIndex<(pstClassifierRule->ucIPDestinationAddressLength);ucLoopIndex++)
  61. {
  62. if((pstClassifierRule->stDestIpAddress.ulIpv4Mask[ucLoopIndex] & ulDestIP)==
  63. (pstClassifierRule->stDestIpAddress.ulIpv4Addr[ucLoopIndex] & pstClassifierRule->stDestIpAddress.ulIpv4Mask[ucLoopIndex]))
  64. {
  65. return TRUE;
  66. }
  67. }
  68. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Destination Ip Address Not Matched");
  69. return FALSE;
  70. }
  71. /************************************************************************
  72. * Function - MatchTos()
  73. *
  74. * Description - Checks the TOS from the packet matches with that of queue.
  75. *
  76. * Parameters - pstClassifierRule : Pointer to the packet info structure.
  77. * - ucTypeOfService: TOS from the packet.
  78. *
  79. * Returns - TRUE(If address matches) else FAIL.
  80. **************************************************************************/
  81. BOOLEAN MatchTos(S_CLASSIFIER_RULE *pstClassifierRule,UCHAR ucTypeOfService)
  82. {
  83. PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
  84. if( 3 != pstClassifierRule->ucIPTypeOfServiceLength )
  85. return TRUE;
  86. if(((pstClassifierRule->ucTosMask & ucTypeOfService)<=pstClassifierRule->ucTosHigh) && ((pstClassifierRule->ucTosMask & ucTypeOfService)>=pstClassifierRule->ucTosLow))
  87. {
  88. return TRUE;
  89. }
  90. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Type Of Service Not Matched");
  91. return FALSE;
  92. }
  93. /***************************************************************************
  94. * Function - MatchProtocol()
  95. *
  96. * Description - Checks the protocol from the packet matches with that of queue.
  97. *
  98. * Parameters - pstClassifierRule: Pointer to the packet info structure.
  99. * - ucProtocol : Protocol from the packet.
  100. *
  101. * Returns - TRUE(If address matches) else FAIL.
  102. ****************************************************************************/
  103. BOOLEAN MatchProtocol(S_CLASSIFIER_RULE *pstClassifierRule,UCHAR ucProtocol)
  104. {
  105. UCHAR ucLoopIndex=0;
  106. PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
  107. if(0 == pstClassifierRule->ucProtocolLength)
  108. return TRUE;
  109. for(ucLoopIndex=0;ucLoopIndex<pstClassifierRule->ucProtocolLength;ucLoopIndex++)
  110. {
  111. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Protocol:0x%X Classification Protocol:0x%X",ucProtocol,pstClassifierRule->ucProtocol[ucLoopIndex]);
  112. if(pstClassifierRule->ucProtocol[ucLoopIndex]==ucProtocol)
  113. {
  114. return TRUE;
  115. }
  116. }
  117. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Protocol Not Matched");
  118. return FALSE;
  119. }
  120. /***********************************************************************
  121. * Function - MatchSrcPort()
  122. *
  123. * Description - Checks, Source port from the packet matches with that of queue.
  124. *
  125. * Parameters - pstClassifierRule: Pointer to the packet info structure.
  126. * - ushSrcPort : Source port from the packet.
  127. *
  128. * Returns - TRUE(If address matches) else FAIL.
  129. ***************************************************************************/
  130. BOOLEAN MatchSrcPort(S_CLASSIFIER_RULE *pstClassifierRule,USHORT ushSrcPort)
  131. {
  132. UCHAR ucLoopIndex=0;
  133. PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
  134. if(0 == pstClassifierRule->ucSrcPortRangeLength)
  135. return TRUE;
  136. for(ucLoopIndex=0;ucLoopIndex<pstClassifierRule->ucSrcPortRangeLength;ucLoopIndex++)
  137. {
  138. if(ushSrcPort <= pstClassifierRule->usSrcPortRangeHi[ucLoopIndex] &&
  139. ushSrcPort >= pstClassifierRule->usSrcPortRangeLo[ucLoopIndex])
  140. {
  141. return TRUE;
  142. }
  143. }
  144. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Src Port: %x Not Matched ",ushSrcPort);
  145. return FALSE;
  146. }
  147. /***********************************************************************
  148. * Function - MatchDestPort()
  149. *
  150. * Description - Checks, Destination port from packet matches with that of queue.
  151. *
  152. * Parameters - pstClassifierRule: Pointer to the packet info structure.
  153. * - ushDestPort : Destination port from the packet.
  154. *
  155. * Returns - TRUE(If address matches) else FAIL.
  156. ***************************************************************************/
  157. BOOLEAN MatchDestPort(S_CLASSIFIER_RULE *pstClassifierRule,USHORT ushDestPort)
  158. {
  159. UCHAR ucLoopIndex=0;
  160. PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
  161. if(0 == pstClassifierRule->ucDestPortRangeLength)
  162. return TRUE;
  163. for(ucLoopIndex=0;ucLoopIndex<pstClassifierRule->ucDestPortRangeLength;ucLoopIndex++)
  164. {
  165. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Matching Port:0x%X 0x%X 0x%X",ushDestPort,pstClassifierRule->usDestPortRangeLo[ucLoopIndex],pstClassifierRule->usDestPortRangeHi[ucLoopIndex]);
  166. if(ushDestPort <= pstClassifierRule->usDestPortRangeHi[ucLoopIndex] &&
  167. ushDestPort >= pstClassifierRule->usDestPortRangeLo[ucLoopIndex])
  168. {
  169. return TRUE;
  170. }
  171. }
  172. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Dest Port: %x Not Matched",ushDestPort);
  173. return FALSE;
  174. }
  175. /**
  176. @ingroup tx_functions
  177. Compares IPV4 Ip address and port number
  178. @return Queue Index.
  179. */
  180. static USHORT IpVersion4(PMINI_ADAPTER Adapter,
  181. struct iphdr *iphd,
  182. S_CLASSIFIER_RULE *pstClassifierRule )
  183. {
  184. xporthdr *xprt_hdr=NULL;
  185. BOOLEAN bClassificationSucceed=FALSE;
  186. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "========>");
  187. xprt_hdr=(xporthdr *)((PUCHAR)iphd + sizeof(struct iphdr));
  188. do {
  189. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Trying to see Direction = %d %d",
  190. pstClassifierRule->ucDirection,
  191. pstClassifierRule->usVCID_Value);
  192. //Checking classifier validity
  193. if(!pstClassifierRule->bUsed || pstClassifierRule->ucDirection == DOWNLINK_DIR)
  194. {
  195. bClassificationSucceed = FALSE;
  196. break;
  197. }
  198. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "is IPv6 check!");
  199. if(pstClassifierRule->bIpv6Protocol)
  200. break;
  201. //**************Checking IP header parameter**************************//
  202. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Trying to match Source IP Address");
  203. if(FALSE == (bClassificationSucceed =
  204. MatchSrcIpAddress(pstClassifierRule, iphd->saddr)))
  205. break;
  206. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Source IP Address Matched");
  207. if(FALSE == (bClassificationSucceed =
  208. MatchDestIpAddress(pstClassifierRule, iphd->daddr)))
  209. break;
  210. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Destination IP Address Matched");
  211. if(FALSE == (bClassificationSucceed =
  212. MatchTos(pstClassifierRule, iphd->tos)))
  213. {
  214. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "TOS Match failed\n");
  215. break;
  216. }
  217. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "TOS Matched");
  218. if(FALSE == (bClassificationSucceed =
  219. MatchProtocol(pstClassifierRule,iphd->protocol)))
  220. break;
  221. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Protocol Matched");
  222. //if protocol is not TCP or UDP then no need of comparing source port and destination port
  223. if(iphd->protocol!=TCP && iphd->protocol!=UDP)
  224. break;
  225. //******************Checking Transport Layer Header field if present *****************//
  226. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Source Port %04x",
  227. (iphd->protocol==UDP)?xprt_hdr->uhdr.source:xprt_hdr->thdr.source);
  228. if(FALSE == (bClassificationSucceed =
  229. MatchSrcPort(pstClassifierRule,
  230. ntohs((iphd->protocol == UDP)?
  231. xprt_hdr->uhdr.source:xprt_hdr->thdr.source))))
  232. break;
  233. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Src Port Matched");
  234. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Destination Port %04x",
  235. (iphd->protocol==UDP)?xprt_hdr->uhdr.dest:
  236. xprt_hdr->thdr.dest);
  237. if(FALSE == (bClassificationSucceed =
  238. MatchDestPort(pstClassifierRule,
  239. ntohs((iphd->protocol == UDP)?
  240. xprt_hdr->uhdr.dest:xprt_hdr->thdr.dest))))
  241. break;
  242. } while(0);
  243. if(TRUE==bClassificationSucceed)
  244. {
  245. INT iMatchedSFQueueIndex = 0;
  246. iMatchedSFQueueIndex = SearchSfid(Adapter,pstClassifierRule->ulSFID);
  247. if(iMatchedSFQueueIndex >= NO_OF_QUEUES)
  248. {
  249. bClassificationSucceed = FALSE;
  250. }
  251. else
  252. {
  253. if(FALSE == Adapter->PackInfo[iMatchedSFQueueIndex].bActive)
  254. {
  255. bClassificationSucceed = FALSE;
  256. }
  257. }
  258. }
  259. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "IpVersion4 <==========");
  260. return bClassificationSucceed;
  261. }
  262. VOID PruneQueueAllSF(PMINI_ADAPTER Adapter)
  263. {
  264. UINT iIndex = 0;
  265. for(iIndex = 0; iIndex < HiPriority; iIndex++)
  266. {
  267. if(!Adapter->PackInfo[iIndex].bValid)
  268. continue;
  269. PruneQueue(Adapter, iIndex);
  270. }
  271. }
  272. /**
  273. @ingroup tx_functions
  274. This function checks if the max queue size for a queue
  275. is less than number of bytes in the queue. If so -
  276. drops packets from the Head till the number of bytes is
  277. less than or equal to max queue size for the queue.
  278. */
  279. static VOID PruneQueue(PMINI_ADAPTER Adapter, INT iIndex)
  280. {
  281. struct sk_buff* PacketToDrop=NULL;
  282. struct net_device_stats *netstats;
  283. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, PRUNE_QUEUE, DBG_LVL_ALL, "=====> Index %d",iIndex);
  284. if(iIndex == HiPriority)
  285. return;
  286. if(!Adapter || (iIndex < 0) || (iIndex > HiPriority))
  287. return;
  288. /* To Store the netdevice statistic */
  289. netstats = &Adapter->dev->stats;
  290. spin_lock_bh(&Adapter->PackInfo[iIndex].SFQueueLock);
  291. while(1)
  292. // while((UINT)Adapter->PackInfo[iIndex].uiCurrentPacketsOnHost >
  293. // SF_MAX_ALLOWED_PACKETS_TO_BACKUP)
  294. {
  295. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, PRUNE_QUEUE, DBG_LVL_ALL, "uiCurrentBytesOnHost:%x uiMaxBucketSize :%x",
  296. Adapter->PackInfo[iIndex].uiCurrentBytesOnHost,
  297. Adapter->PackInfo[iIndex].uiMaxBucketSize);
  298. PacketToDrop = Adapter->PackInfo[iIndex].FirstTxQueue;
  299. if(PacketToDrop == NULL)
  300. break;
  301. if((Adapter->PackInfo[iIndex].uiCurrentPacketsOnHost < SF_MAX_ALLOWED_PACKETS_TO_BACKUP) &&
  302. ((1000*(jiffies - *((B_UINT32 *)(PacketToDrop->cb)+SKB_CB_LATENCY_OFFSET))/HZ) <= Adapter->PackInfo[iIndex].uiMaxLatency))
  303. break;
  304. if(PacketToDrop)
  305. {
  306. if (netif_msg_tx_err(Adapter))
  307. pr_info(PFX "%s: tx queue %d overlimit\n",
  308. Adapter->dev->name, iIndex);
  309. netstats->tx_dropped++;
  310. DEQUEUEPACKET(Adapter->PackInfo[iIndex].FirstTxQueue,
  311. Adapter->PackInfo[iIndex].LastTxQueue);
  312. /// update current bytes and packets count
  313. Adapter->PackInfo[iIndex].uiCurrentBytesOnHost -=
  314. PacketToDrop->len;
  315. Adapter->PackInfo[iIndex].uiCurrentPacketsOnHost--;
  316. /// update dropped bytes and packets counts
  317. Adapter->PackInfo[iIndex].uiDroppedCountBytes += PacketToDrop->len;
  318. Adapter->PackInfo[iIndex].uiDroppedCountPackets++;
  319. dev_kfree_skb(PacketToDrop);
  320. }
  321. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, PRUNE_QUEUE, DBG_LVL_ALL, "Dropped Bytes:%x Dropped Packets:%x",
  322. Adapter->PackInfo[iIndex].uiDroppedCountBytes,
  323. Adapter->PackInfo[iIndex].uiDroppedCountPackets);
  324. atomic_dec(&Adapter->TotalPacketCount);
  325. }
  326. spin_unlock_bh(&Adapter->PackInfo[iIndex].SFQueueLock);
  327. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, PRUNE_QUEUE, DBG_LVL_ALL, "TotalPacketCount:%x",
  328. atomic_read(&Adapter->TotalPacketCount));
  329. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, PRUNE_QUEUE, DBG_LVL_ALL, "<=====");
  330. }
  331. VOID flush_all_queues(PMINI_ADAPTER Adapter)
  332. {
  333. INT iQIndex;
  334. UINT uiTotalPacketLength;
  335. struct sk_buff* PacketToDrop=NULL;
  336. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "=====>");
  337. // down(&Adapter->data_packet_queue_lock);
  338. for(iQIndex=LowPriority; iQIndex<HiPriority; iQIndex++)
  339. {
  340. struct net_device_stats *netstats = &Adapter->dev->stats;
  341. spin_lock_bh(&Adapter->PackInfo[iQIndex].SFQueueLock);
  342. while(Adapter->PackInfo[iQIndex].FirstTxQueue)
  343. {
  344. PacketToDrop = Adapter->PackInfo[iQIndex].FirstTxQueue;
  345. if(PacketToDrop)
  346. {
  347. uiTotalPacketLength = PacketToDrop->len;
  348. netstats->tx_dropped++;
  349. }
  350. else
  351. uiTotalPacketLength = 0;
  352. DEQUEUEPACKET(Adapter->PackInfo[iQIndex].FirstTxQueue,
  353. Adapter->PackInfo[iQIndex].LastTxQueue);
  354. /* Free the skb */
  355. dev_kfree_skb(PacketToDrop);
  356. /// update current bytes and packets count
  357. Adapter->PackInfo[iQIndex].uiCurrentBytesOnHost -= uiTotalPacketLength;
  358. Adapter->PackInfo[iQIndex].uiCurrentPacketsOnHost--;
  359. /// update dropped bytes and packets counts
  360. Adapter->PackInfo[iQIndex].uiDroppedCountBytes += uiTotalPacketLength;
  361. Adapter->PackInfo[iQIndex].uiDroppedCountPackets++;
  362. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "Dropped Bytes:%x Dropped Packets:%x",
  363. Adapter->PackInfo[iQIndex].uiDroppedCountBytes,
  364. Adapter->PackInfo[iQIndex].uiDroppedCountPackets);
  365. atomic_dec(&Adapter->TotalPacketCount);
  366. }
  367. spin_unlock_bh(&Adapter->PackInfo[iQIndex].SFQueueLock);
  368. }
  369. // up(&Adapter->data_packet_queue_lock);
  370. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "<=====");
  371. }
  372. USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb)
  373. {
  374. INT uiLoopIndex=0;
  375. S_CLASSIFIER_RULE *pstClassifierRule = NULL;
  376. S_ETHCS_PKT_INFO stEthCsPktInfo;
  377. PVOID pvEThPayload = NULL;
  378. struct iphdr *pIpHeader = NULL;
  379. INT uiSfIndex=0;
  380. USHORT usIndex=Adapter->usBestEffortQueueIndex;
  381. BOOLEAN bFragmentedPkt=FALSE,bClassificationSucceed=FALSE;
  382. USHORT usCurrFragment =0;
  383. PTCP_HEADER pTcpHeader;
  384. UCHAR IpHeaderLength;
  385. UCHAR TcpHeaderLength;
  386. pvEThPayload = skb->data;
  387. *((UINT32*) (skb->cb) +SKB_CB_TCPACK_OFFSET ) = 0;
  388. EThCSGetPktInfo(Adapter,pvEThPayload,&stEthCsPktInfo);
  389. switch(stEthCsPktInfo.eNwpktEthFrameType)
  390. {
  391. case eEth802LLCFrame:
  392. {
  393. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ClassifyPacket : 802LLCFrame\n");
  394. pIpHeader = pvEThPayload + sizeof(ETH_CS_802_LLC_FRAME);
  395. break;
  396. }
  397. case eEth802LLCSNAPFrame:
  398. {
  399. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ClassifyPacket : 802LLC SNAP Frame\n");
  400. pIpHeader = pvEThPayload + sizeof(ETH_CS_802_LLC_SNAP_FRAME);
  401. break;
  402. }
  403. case eEth802QVLANFrame:
  404. {
  405. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ClassifyPacket : 802.1Q VLANFrame\n");
  406. pIpHeader = pvEThPayload + sizeof(ETH_CS_802_Q_FRAME);
  407. break;
  408. }
  409. case eEthOtherFrame:
  410. {
  411. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ClassifyPacket : ETH Other Frame\n");
  412. pIpHeader = pvEThPayload + sizeof(ETH_CS_ETH2_FRAME);
  413. break;
  414. }
  415. default:
  416. {
  417. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ClassifyPacket : Unrecognized ETH Frame\n");
  418. pIpHeader = pvEThPayload + sizeof(ETH_CS_ETH2_FRAME);
  419. break;
  420. }
  421. }
  422. if(stEthCsPktInfo.eNwpktIPFrameType == eIPv4Packet)
  423. {
  424. usCurrFragment = (ntohs(pIpHeader->frag_off) & IP_OFFSET);
  425. if((ntohs(pIpHeader->frag_off) & IP_MF) || usCurrFragment)
  426. bFragmentedPkt = TRUE;
  427. if(bFragmentedPkt)
  428. {
  429. //Fragmented Packet. Get Frag Classifier Entry.
  430. pstClassifierRule = GetFragIPClsEntry(Adapter,pIpHeader->id, pIpHeader->saddr);
  431. if(pstClassifierRule)
  432. {
  433. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL,"It is next Fragmented pkt");
  434. bClassificationSucceed=TRUE;
  435. }
  436. if(!(ntohs(pIpHeader->frag_off) & IP_MF))
  437. {
  438. //Fragmented Last packet . Remove Frag Classifier Entry
  439. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL,"This is the last fragmented Pkt");
  440. DelFragIPClsEntry(Adapter,pIpHeader->id, pIpHeader->saddr);
  441. }
  442. }
  443. }
  444. for(uiLoopIndex = MAX_CLASSIFIERS - 1; uiLoopIndex >= 0; uiLoopIndex--)
  445. {
  446. if(bClassificationSucceed)
  447. break;
  448. //Iterate through all classifiers which are already in order of priority
  449. //to classify the packet until match found
  450. do
  451. {
  452. if(FALSE==Adapter->astClassifierTable[uiLoopIndex].bUsed)
  453. {
  454. bClassificationSucceed=FALSE;
  455. break;
  456. }
  457. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Adapter->PackInfo[%d].bvalid=True\n",uiLoopIndex);
  458. if(0 == Adapter->astClassifierTable[uiLoopIndex].ucDirection)
  459. {
  460. bClassificationSucceed=FALSE;//cannot be processed for classification.
  461. break; // it is a down link connection
  462. }
  463. pstClassifierRule = &Adapter->astClassifierTable[uiLoopIndex];
  464. uiSfIndex = SearchSfid(Adapter,pstClassifierRule->ulSFID);
  465. if (uiSfIndex >= NO_OF_QUEUES) {
  466. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Queue Not Valid. SearchSfid for this classifier Failed\n");
  467. break;
  468. }
  469. if(Adapter->PackInfo[uiSfIndex].bEthCSSupport)
  470. {
  471. if(eEthUnsupportedFrame==stEthCsPktInfo.eNwpktEthFrameType)
  472. {
  473. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, " ClassifyPacket : Packet Not a Valid Supported Ethernet Frame \n");
  474. bClassificationSucceed = FALSE;
  475. break;
  476. }
  477. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Performing ETH CS Classification on Classifier Rule ID : %x Service Flow ID : %lx\n",pstClassifierRule->uiClassifierRuleIndex,Adapter->PackInfo[uiSfIndex].ulSFID);
  478. bClassificationSucceed = EThCSClassifyPkt(Adapter,skb,&stEthCsPktInfo,pstClassifierRule, Adapter->PackInfo[uiSfIndex].bEthCSSupport);
  479. if(!bClassificationSucceed)
  480. {
  481. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ClassifyPacket : Ethernet CS Classification Failed\n");
  482. break;
  483. }
  484. }
  485. else // No ETH Supported on this SF
  486. {
  487. if(eEthOtherFrame != stEthCsPktInfo.eNwpktEthFrameType)
  488. {
  489. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, " ClassifyPacket : Packet Not a 802.3 Ethernet Frame... hence not allowed over non-ETH CS SF \n");
  490. bClassificationSucceed = FALSE;
  491. break;
  492. }
  493. }
  494. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Proceeding to IP CS Clasification");
  495. if(Adapter->PackInfo[uiSfIndex].bIPCSSupport)
  496. {
  497. if(stEthCsPktInfo.eNwpktIPFrameType == eNonIPPacket)
  498. {
  499. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, " ClassifyPacket : Packet is Not an IP Packet \n");
  500. bClassificationSucceed = FALSE;
  501. break;
  502. }
  503. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Dump IP Header : \n");
  504. DumpFullPacket((PUCHAR)pIpHeader,20);
  505. if(stEthCsPktInfo.eNwpktIPFrameType == eIPv4Packet)
  506. bClassificationSucceed = IpVersion4(Adapter,pIpHeader,pstClassifierRule);
  507. else if(stEthCsPktInfo.eNwpktIPFrameType == eIPv6Packet)
  508. bClassificationSucceed = IpVersion6(Adapter,pIpHeader,pstClassifierRule);
  509. }
  510. }while(0);
  511. }
  512. if(bClassificationSucceed == TRUE)
  513. {
  514. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "CF id : %d, SF ID is =%lu",pstClassifierRule->uiClassifierRuleIndex, pstClassifierRule->ulSFID);
  515. //Store The matched Classifier in SKB
  516. *((UINT32*)(skb->cb)+SKB_CB_CLASSIFICATION_OFFSET) = pstClassifierRule->uiClassifierRuleIndex;
  517. if((TCP == pIpHeader->protocol ) && !bFragmentedPkt && (ETH_AND_IP_HEADER_LEN + TCP_HEADER_LEN <= skb->len) )
  518. {
  519. IpHeaderLength = pIpHeader->ihl;
  520. pTcpHeader = (PTCP_HEADER)(((PUCHAR)pIpHeader)+(IpHeaderLength*4));
  521. TcpHeaderLength = GET_TCP_HEADER_LEN(pTcpHeader->HeaderLength);
  522. if((pTcpHeader->ucFlags & TCP_ACK) &&
  523. (ntohs(pIpHeader->tot_len) == (IpHeaderLength*4)+(TcpHeaderLength*4)))
  524. {
  525. *((UINT32*) (skb->cb) +SKB_CB_TCPACK_OFFSET ) = TCP_ACK;
  526. }
  527. }
  528. usIndex = SearchSfid(Adapter, pstClassifierRule->ulSFID);
  529. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "index is =%d", usIndex);
  530. //If this is the first fragment of a Fragmented pkt, add this CF. Only This CF should be used for all other fragment of this Pkt.
  531. if(bFragmentedPkt && (usCurrFragment == 0))
  532. {
  533. //First Fragment of Fragmented Packet. Create Frag CLS Entry
  534. S_FRAGMENTED_PACKET_INFO stFragPktInfo;
  535. stFragPktInfo.bUsed = TRUE;
  536. stFragPktInfo.ulSrcIpAddress = pIpHeader->saddr;
  537. stFragPktInfo.usIpIdentification = pIpHeader->id;
  538. stFragPktInfo.pstMatchedClassifierEntry = pstClassifierRule;
  539. stFragPktInfo.bOutOfOrderFragment = FALSE;
  540. AddFragIPClsEntry(Adapter,&stFragPktInfo);
  541. }
  542. }
  543. if(bClassificationSucceed)
  544. return usIndex;
  545. else
  546. return INVALID_QUEUE_INDEX;
  547. }
  548. static BOOLEAN EthCSMatchSrcMACAddress(S_CLASSIFIER_RULE *pstClassifierRule,PUCHAR Mac)
  549. {
  550. UINT i=0;
  551. PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
  552. if(pstClassifierRule->ucEthCSSrcMACLen==0)
  553. return TRUE;
  554. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "%s \n",__FUNCTION__);
  555. for(i=0;i<MAC_ADDRESS_SIZE;i++)
  556. {
  557. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "SRC MAC[%x] = %x ClassifierRuleSrcMAC = %x Mask : %x\n",i,Mac[i],pstClassifierRule->au8EThCSSrcMAC[i],pstClassifierRule->au8EThCSSrcMACMask[i]);
  558. if((pstClassifierRule->au8EThCSSrcMAC[i] & pstClassifierRule->au8EThCSSrcMACMask[i])!=
  559. (Mac[i] & pstClassifierRule->au8EThCSSrcMACMask[i]))
  560. return FALSE;
  561. }
  562. return TRUE;
  563. }
  564. static BOOLEAN EthCSMatchDestMACAddress(S_CLASSIFIER_RULE *pstClassifierRule,PUCHAR Mac)
  565. {
  566. UINT i=0;
  567. PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
  568. if(pstClassifierRule->ucEthCSDestMACLen==0)
  569. return TRUE;
  570. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "%s \n",__FUNCTION__);
  571. for(i=0;i<MAC_ADDRESS_SIZE;i++)
  572. {
  573. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "SRC MAC[%x] = %x ClassifierRuleSrcMAC = %x Mask : %x\n",i,Mac[i],pstClassifierRule->au8EThCSDestMAC[i],pstClassifierRule->au8EThCSDestMACMask[i]);
  574. if((pstClassifierRule->au8EThCSDestMAC[i] & pstClassifierRule->au8EThCSDestMACMask[i])!=
  575. (Mac[i] & pstClassifierRule->au8EThCSDestMACMask[i]))
  576. return FALSE;
  577. }
  578. return TRUE;
  579. }
  580. static BOOLEAN EthCSMatchEThTypeSAP(S_CLASSIFIER_RULE *pstClassifierRule,struct sk_buff* skb,PS_ETHCS_PKT_INFO pstEthCsPktInfo)
  581. {
  582. PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
  583. if((pstClassifierRule->ucEtherTypeLen==0)||
  584. (pstClassifierRule->au8EthCSEtherType[0] == 0))
  585. return TRUE;
  586. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "%s SrcEtherType:%x CLS EtherType[0]:%x\n",__FUNCTION__,pstEthCsPktInfo->usEtherType,pstClassifierRule->au8EthCSEtherType[0]);
  587. if(pstClassifierRule->au8EthCSEtherType[0] == 1)
  588. {
  589. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "%s CLS EtherType[1]:%x EtherType[2]:%x\n",__FUNCTION__,pstClassifierRule->au8EthCSEtherType[1],pstClassifierRule->au8EthCSEtherType[2]);
  590. if(memcmp(&pstEthCsPktInfo->usEtherType,&pstClassifierRule->au8EthCSEtherType[1],2)==0)
  591. return TRUE;
  592. else
  593. return FALSE;
  594. }
  595. if(pstClassifierRule->au8EthCSEtherType[0] == 2)
  596. {
  597. if(eEth802LLCFrame != pstEthCsPktInfo->eNwpktEthFrameType)
  598. return FALSE;
  599. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "%s EthCS DSAP:%x EtherType[2]:%x\n",__FUNCTION__,pstEthCsPktInfo->ucDSAP,pstClassifierRule->au8EthCSEtherType[2]);
  600. if(pstEthCsPktInfo->ucDSAP == pstClassifierRule->au8EthCSEtherType[2])
  601. return TRUE;
  602. else
  603. return FALSE;
  604. }
  605. return FALSE;
  606. }
  607. static BOOLEAN EthCSMatchVLANRules(S_CLASSIFIER_RULE *pstClassifierRule,struct sk_buff* skb,PS_ETHCS_PKT_INFO pstEthCsPktInfo)
  608. {
  609. BOOLEAN bClassificationSucceed = FALSE;
  610. USHORT usVLANID;
  611. B_UINT8 uPriority = 0;
  612. PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
  613. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "%s CLS UserPrio:%x CLS VLANID:%x\n",__FUNCTION__,ntohs(*((USHORT *)pstClassifierRule->usUserPriority)),pstClassifierRule->usVLANID);
  614. /* In case FW didn't receive the TLV, the priority field should be ignored */
  615. if(pstClassifierRule->usValidityBitMap & (1<<PKT_CLASSIFICATION_USER_PRIORITY_VALID))
  616. {
  617. if(pstEthCsPktInfo->eNwpktEthFrameType!=eEth802QVLANFrame)
  618. return FALSE;
  619. uPriority = (ntohs(*(USHORT *)(skb->data + sizeof(ETH_HEADER_STRUC))) & 0xF000) >> 13;
  620. if((uPriority >= pstClassifierRule->usUserPriority[0]) && (uPriority <= pstClassifierRule->usUserPriority[1]))
  621. bClassificationSucceed = TRUE;
  622. if(!bClassificationSucceed)
  623. return FALSE;
  624. }
  625. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ETH CS 802.1 D User Priority Rule Matched\n");
  626. bClassificationSucceed = FALSE;
  627. if(pstClassifierRule->usValidityBitMap & (1<<PKT_CLASSIFICATION_VLANID_VALID))
  628. {
  629. if(pstEthCsPktInfo->eNwpktEthFrameType!=eEth802QVLANFrame)
  630. return FALSE;
  631. usVLANID = ntohs(*(USHORT *)(skb->data + sizeof(ETH_HEADER_STRUC))) & 0xFFF;
  632. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "%s Pkt VLANID %x Priority: %d\n",__FUNCTION__,usVLANID, uPriority);
  633. if(usVLANID == ((pstClassifierRule->usVLANID & 0xFFF0) >> 4))
  634. bClassificationSucceed = TRUE;
  635. if(!bClassificationSucceed)
  636. return FALSE;
  637. }
  638. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ETH CS 802.1 Q VLAN ID Rule Matched\n");
  639. return TRUE;
  640. }
  641. static BOOLEAN EThCSClassifyPkt(PMINI_ADAPTER Adapter,struct sk_buff* skb,
  642. PS_ETHCS_PKT_INFO pstEthCsPktInfo,
  643. S_CLASSIFIER_RULE *pstClassifierRule,
  644. B_UINT8 EthCSCupport)
  645. {
  646. BOOLEAN bClassificationSucceed = FALSE;
  647. bClassificationSucceed = EthCSMatchSrcMACAddress(pstClassifierRule,((ETH_HEADER_STRUC *)(skb->data))->au8SourceAddress);
  648. if(!bClassificationSucceed)
  649. return FALSE;
  650. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ETH CS SrcMAC Matched\n");
  651. bClassificationSucceed = EthCSMatchDestMACAddress(pstClassifierRule,((ETH_HEADER_STRUC*)(skb->data))->au8DestinationAddress);
  652. if(!bClassificationSucceed)
  653. return FALSE;
  654. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ETH CS DestMAC Matched\n");
  655. //classify on ETHType/802.2SAP TLV
  656. bClassificationSucceed = EthCSMatchEThTypeSAP(pstClassifierRule,skb,pstEthCsPktInfo);
  657. if(!bClassificationSucceed)
  658. return FALSE;
  659. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ETH CS EthType/802.2SAP Matched\n");
  660. //classify on 802.1VLAN Header Parameters
  661. bClassificationSucceed = EthCSMatchVLANRules(pstClassifierRule,skb,pstEthCsPktInfo);
  662. if(!bClassificationSucceed)
  663. return FALSE;
  664. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ETH CS 802.1 VLAN Rules Matched\n");
  665. return bClassificationSucceed;
  666. }
  667. static void EThCSGetPktInfo(PMINI_ADAPTER Adapter,PVOID pvEthPayload,
  668. PS_ETHCS_PKT_INFO pstEthCsPktInfo)
  669. {
  670. USHORT u16Etype = ntohs(((ETH_HEADER_STRUC*)pvEthPayload)->u16Etype);
  671. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "EthCSGetPktInfo : Eth Hdr Type : %X\n",u16Etype);
  672. if(u16Etype > 0x5dc)
  673. {
  674. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "EthCSGetPktInfo : ETH2 Frame \n");
  675. //ETH2 Frame
  676. if(u16Etype == ETHERNET_FRAMETYPE_802QVLAN)
  677. {
  678. //802.1Q VLAN Header
  679. pstEthCsPktInfo->eNwpktEthFrameType = eEth802QVLANFrame;
  680. u16Etype = ((ETH_CS_802_Q_FRAME*)pvEthPayload)->EthType;
  681. //((ETH_CS_802_Q_FRAME*)pvEthPayload)->UserPriority
  682. }
  683. else
  684. {
  685. pstEthCsPktInfo->eNwpktEthFrameType = eEthOtherFrame;
  686. u16Etype = ntohs(u16Etype);
  687. }
  688. }
  689. else
  690. {
  691. //802.2 LLC
  692. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "802.2 LLC Frame \n");
  693. pstEthCsPktInfo->eNwpktEthFrameType = eEth802LLCFrame;
  694. pstEthCsPktInfo->ucDSAP = ((ETH_CS_802_LLC_FRAME*)pvEthPayload)->DSAP;
  695. if(pstEthCsPktInfo->ucDSAP == 0xAA && ((ETH_CS_802_LLC_FRAME*)pvEthPayload)->SSAP == 0xAA)
  696. {
  697. //SNAP Frame
  698. pstEthCsPktInfo->eNwpktEthFrameType = eEth802LLCSNAPFrame;
  699. u16Etype = ((ETH_CS_802_LLC_SNAP_FRAME*)pvEthPayload)->usEtherType;
  700. }
  701. }
  702. if(u16Etype == ETHERNET_FRAMETYPE_IPV4)
  703. pstEthCsPktInfo->eNwpktIPFrameType = eIPv4Packet;
  704. else if(u16Etype == ETHERNET_FRAMETYPE_IPV6)
  705. pstEthCsPktInfo->eNwpktIPFrameType = eIPv6Packet;
  706. else
  707. pstEthCsPktInfo->eNwpktIPFrameType = eNonIPPacket;
  708. pstEthCsPktInfo->usEtherType = ((ETH_HEADER_STRUC*)pvEthPayload)->u16Etype;
  709. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "EthCsPktInfo->eNwpktIPFrameType : %x\n",pstEthCsPktInfo->eNwpktIPFrameType);
  710. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "EthCsPktInfo->eNwpktEthFrameType : %x\n",pstEthCsPktInfo->eNwpktEthFrameType);
  711. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "EthCsPktInfo->usEtherType : %x\n",pstEthCsPktInfo->usEtherType);
  712. }