/**
-@file Qos.C
-This file contains the routines related to Quality of Service.
+ * @file Qos.C
+ * This file contains the routines related to Quality of Service.
*/
#include "headers.h"
return false;
}
/**
-@ingroup tx_functions
-Compares IPV4 Ip address and port number
-@return Queue Index.
+ * @ingroup tx_functions
+ * Compares IPV4 Ip address and port number
+ * @return Queue Index.
*/
static USHORT IpVersion4(struct bcm_mini_adapter *Adapter,
struct iphdr *iphd,
pstClassifierRule->ucDirection,
pstClassifierRule->usVCID_Value);
- //Checking classifier validity
+ /* Checking classifier validity */
if (!pstClassifierRule->bUsed || pstClassifierRule->ucDirection == DOWNLINK_DIR)
break;
if (pstClassifierRule->bIpv6Protocol)
break;
- //**************Checking IP header parameter**************************//
+ /* Checking IP header parameter */
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Trying to match Source IP Address");
if (!MatchSrcIpAddress(pstClassifierRule, iphd->saddr))
break;
break;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Protocol Matched");
- //if protocol is not TCP or UDP then no need of comparing source port and destination port
+ /*
+ * if protocol is not TCP or UDP then no
+ * need of comparing source port and destination port
+ */
if (iphd->protocol != TCP && iphd->protocol != UDP) {
bClassificationSucceed = TRUE;
break;
}
- //******************Checking Transport Layer Header field if present *****************//
+ /* Checking Transport Layer Header field if present */
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Source Port %04x",
(iphd->protocol == UDP) ? xprt_hdr->uhdr.source : xprt_hdr->thdr.source);
/**
-@ingroup tx_functions
-This function checks if the max queue size for a queue
-is less than number of bytes in the queue. If so -
-drops packets from the Head till the number of bytes is
-less than or equal to max queue size for the queue.
-*/
+ * @ingroup tx_functions
+ * This function checks if the max queue size for a queue
+ * is less than number of bytes in the queue. If so -
+ * drops packets from the Head till the number of bytes is
+ * less than or equal to max queue size for the queue.
+ */
static VOID PruneQueue(struct bcm_mini_adapter *Adapter, INT iIndex)
{
struct sk_buff* PacketToDrop = NULL;
DEQUEUEPACKET(Adapter->PackInfo[iIndex].FirstTxQueue,
Adapter->PackInfo[iIndex].LastTxQueue);
- /// update current bytes and packets count
+ /* update current bytes and packets count */
Adapter->PackInfo[iIndex].uiCurrentBytesOnHost -=
PacketToDrop->len;
Adapter->PackInfo[iIndex].uiCurrentPacketsOnHost--;
- /// update dropped bytes and packets counts
+ /* update dropped bytes and packets counts */
Adapter->PackInfo[iIndex].uiDroppedCountBytes += PacketToDrop->len;
Adapter->PackInfo[iIndex].uiDroppedCountPackets++;
dev_kfree_skb(PacketToDrop);
/* Free the skb */
dev_kfree_skb(PacketToDrop);
- /// update current bytes and packets count
+ /* update current bytes and packets count */
Adapter->PackInfo[iQIndex].uiCurrentBytesOnHost -= uiTotalPacketLength;
Adapter->PackInfo[iQIndex].uiCurrentPacketsOnHost--;
- /// update dropped bytes and packets counts
+ /* update dropped bytes and packets counts */
Adapter->PackInfo[iQIndex].uiDroppedCountBytes += uiTotalPacketLength;
Adapter->PackInfo[iQIndex].uiDroppedCountPackets++;
bFragmentedPkt = TRUE;
if (bFragmentedPkt) {
- //Fragmented Packet. Get Frag Classifier Entry.
+ /* Fragmented Packet. Get Frag Classifier Entry. */
pstClassifierRule = GetFragIPClsEntry(Adapter, pIpHeader->id, pIpHeader->saddr);
if (pstClassifierRule) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "It is next Fragmented pkt");
bClassificationSucceed = TRUE;
}
if (!(ntohs(pIpHeader->frag_off) & IP_MF)) {
- //Fragmented Last packet . Remove Frag Classifier Entry
+ /* Fragmented Last packet . Remove Frag Classifier Entry */
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "This is the last fragmented Pkt");
DelFragIPClsEntry(Adapter, pIpHeader->id, pIpHeader->saddr);
}
for (uiLoopIndex = MAX_CLASSIFIERS - 1; uiLoopIndex >= 0; uiLoopIndex--) {
if (bClassificationSucceed)
break;
- //Iterate through all classifiers which are already in order of priority
- //to classify the packet until match found
+ /*
+ * Iterate through all classifiers which are already in order of priority
+ * to classify the packet until match found
+ */
do {
if (false == Adapter->astClassifierTable[uiLoopIndex].bUsed) {
bClassificationSucceed = false;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Adapter->PackInfo[%d].bvalid=True\n", uiLoopIndex);
if (0 == Adapter->astClassifierTable[uiLoopIndex].ucDirection) {
- bClassificationSucceed = false;//cannot be processed for classification.
- break; // it is a down link connection
+ bClassificationSucceed = false; /* cannot be processed for classification. */
+ break; /* it is a down link connection */
}
pstClassifierRule = &Adapter->astClassifierTable[uiLoopIndex];
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ClassifyPacket : Ethernet CS Classification Failed\n");
break;
}
- } else { // No ETH Supported on this SF
+ } else { /* No ETH Supported on this SF */
if (eEthOtherFrame != stEthCsPktInfo.eNwpktEthFrameType) {
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");
bClassificationSucceed = false;
if (bClassificationSucceed == TRUE) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "CF id : %d, SF ID is =%lu", pstClassifierRule->uiClassifierRuleIndex, pstClassifierRule->ulSFID);
- //Store The matched Classifier in SKB
+ /* Store The matched Classifier in SKB */
*((UINT32*)(skb->cb)+SKB_CB_CLASSIFICATION_OFFSET) = pstClassifierRule->uiClassifierRuleIndex;
if ((TCP == pIpHeader->protocol) && !bFragmentedPkt && (ETH_AND_IP_HEADER_LEN + TCP_HEADER_LEN <= skb->len)) {
IpHeaderLength = pIpHeader->ihl;
usIndex = SearchSfid(Adapter, pstClassifierRule->ulSFID);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "index is =%d", usIndex);
- //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.
+ /*
+ * 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.
+ */
if (bFragmentedPkt && (usCurrFragment == 0)) {
- //First Fragment of Fragmented Packet. Create Frag CLS Entry
+ /*
+ * First Fragment of Fragmented Packet.
+ * Create Frag CLS Entry
+ */
struct bcm_fragmented_packet_info stFragPktInfo;
stFragPktInfo.bUsed = TRUE;
stFragPktInfo.ulSrcIpAddress = pIpHeader->saddr;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "%s CLS UserPrio:%x CLS VLANID:%x\n", __func__, ntohs(*((USHORT *)pstClassifierRule->usUserPriority)), pstClassifierRule->usVLANID);
- /* In case FW didn't receive the TLV, the priority field should be ignored */
+ /*
+ * In case FW didn't receive the TLV,
+ * the priority field should be ignored
+ */
if (pstClassifierRule->usValidityBitMap & (1<<PKT_CLASSIFICATION_USER_PRIORITY_VALID)) {
if (pstEthCsPktInfo->eNwpktEthFrameType != eEth802QVLANFrame)
return false;
return false;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ETH CS DestMAC Matched\n");
- //classify on ETHType/802.2SAP TLV
+ /* classify on ETHType/802.2SAP TLV */
bClassificationSucceed = EthCSMatchEThTypeSAP(pstClassifierRule, skb, pstEthCsPktInfo);
if (!bClassificationSucceed)
return false;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "ETH CS EthType/802.2SAP Matched\n");
- //classify on 802.1VLAN Header Parameters
-
+ /* classify on 802.1VLAN Header Parameters */
bClassificationSucceed = EthCSMatchVLANRules(pstClassifierRule, skb, pstEthCsPktInfo);
if (!bClassificationSucceed)
return false;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "EthCSGetPktInfo : Eth Hdr Type : %X\n", u16Etype);
if (u16Etype > 0x5dc) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "EthCSGetPktInfo : ETH2 Frame\n");
- //ETH2 Frame
+ /* ETH2 Frame */
if (u16Etype == ETHERNET_FRAMETYPE_802QVLAN) {
- //802.1Q VLAN Header
+ /* 802.1Q VLAN Header */
pstEthCsPktInfo->eNwpktEthFrameType = eEth802QVLANFrame;
u16Etype = ((struct bcm_eth_q_frame *)pvEthPayload)->EthType;
//((ETH_CS_802_Q_FRAME*)pvEthPayload)->UserPriority
u16Etype = ntohs(u16Etype);
}
} else {
- //802.2 LLC
+ /* 802.2 LLC */
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "802.2 LLC Frame\n");
pstEthCsPktInfo->eNwpktEthFrameType = eEth802LLCFrame;
pstEthCsPktInfo->ucDSAP = ((struct bcm_eth_llc_frame *)pvEthPayload)->DSAP;
if (pstEthCsPktInfo->ucDSAP == 0xAA && ((struct bcm_eth_llc_frame *)pvEthPayload)->SSAP == 0xAA) {
- //SNAP Frame
+ /* SNAP Frame */
pstEthCsPktInfo->eNwpktEthFrameType = eEth802LLCSNAPFrame;
u16Etype = ((struct bcm_eth_llc_snap_frame *)pvEthPayload)->usEtherType;
}