Index: chromeos/drivers/ath6kl/miscdrv/credit_dist.c |
diff --git a/chromeos/drivers/ath6kl/miscdrv/credit_dist.c b/chromeos/drivers/ath6kl/miscdrv/credit_dist.c |
index 74426b8f710a11192f87e7a14fcae3e1345106c4..91316e0b109eb8f707e39855a34ff51b1452e39e 100644 |
--- a/chromeos/drivers/ath6kl/miscdrv/credit_dist.c |
+++ b/chromeos/drivers/ath6kl/miscdrv/credit_dist.c |
@@ -1,15 +1,19 @@ |
//------------------------------------------------------------------------------ |
// <copyright file="credit_dist.c" company="Atheros"> |
-// Copyright (c) 2004-2008 Atheros Corporation. All rights reserved. |
+// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. |
// |
-// This program is free software; you can redistribute it and/or modify |
-// it under the terms of the GNU General Public License version 2 as |
-// published by the Free Software Foundation; |
// |
-// Software distributed under the License is distributed on an "AS |
-// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
-// implied. See the License for the specific language governing |
-// rights and limitations under the License. |
+// Permission to use, copy, modify, and/or distribute this software for any |
+// purpose with or without fee is hereby granted, provided that the above |
+// copyright notice and this permission notice appear in all copies. |
+// |
+// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
+// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
+// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
+// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
+// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
+// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
+// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
// |
// |
//------------------------------------------------------------------------------ |
@@ -29,6 +33,7 @@ |
/********* CREDIT DISTRIBUTION FUNCTIONS ******************************************/ |
#define NO_VO_SERVICE 1 /* currently WMI only uses 3 data streams, so we leave VO service inactive */ |
+#define CONFIG_GIVE_LOW_PRIORITY_STREAMS_MIN_CREDITS 1 |
#ifdef NO_VO_SERVICE |
#define DATA_SVCS_USED 3 |
@@ -94,6 +99,20 @@ static void ar6000_credit_init(void *Context, |
/* set minimums for each endpoint */ |
pCurEpDist->TxCreditsMin = pCurEpDist->TxCreditsPerMaxMsg; |
+#ifdef CONFIG_GIVE_LOW_PRIORITY_STREAMS_MIN_CREDITS |
+ |
+ if (TotalCredits > 4) |
+ { |
+ if ((pCurEpDist->ServiceID == WMI_DATA_BK_SVC) || (pCurEpDist->ServiceID == WMI_DATA_BE_SVC)){ |
+ /* assign at least min credits to lower than VO priority services */ |
+ GiveCredits(pCredInfo,pCurEpDist,pCurEpDist->TxCreditsMin); |
+ /* force active */ |
+ SET_EP_ACTIVE(pCurEpDist); |
+ } |
+ } |
+ |
+#endif |
+ |
if (pCurEpDist->ServiceID == WMI_CONTROL_SVC) { |
/* give control service some credits */ |
GiveCredits(pCredInfo,pCurEpDist,pCurEpDist->TxCreditsMin); |
@@ -232,6 +251,14 @@ static void RedistributeCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, |
/* walk through the list and remove credits from inactive endpoints */ |
while (pCurEpDist != NULL) { |
+#ifdef CONFIG_GIVE_LOW_PRIORITY_STREAMS_MIN_CREDITS |
+ |
+ if ((pCurEpDist->ServiceID == WMI_DATA_BK_SVC) || (pCurEpDist->ServiceID == WMI_DATA_BE_SVC)) { |
+ /* force low priority streams to always be active to retain their minimum credit distribution */ |
+ SET_EP_ACTIVE(pCurEpDist); |
+ } |
+#endif |
+ |
if (pCurEpDist->ServiceID != WMI_CONTROL_SVC) { |
if (!IS_EP_ACTIVE(pCurEpDist)) { |
if (pCurEpDist->TxQueueDepth == 0) { |
@@ -272,6 +299,21 @@ static void SeekCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, |
break; |
} |
+#ifdef CONFIG_GIVE_LOW_PRIORITY_STREAMS_MIN_CREDITS |
+ if (pEPDist->ServiceID == WMI_DATA_VI_SVC) { |
+ if ((pEPDist->TxCreditsAssigned >= pEPDist->TxCreditsNorm)) { |
+ /* limit VI service from oversubscribing */ |
+ break; |
+ } |
+ } |
+ |
+ if (pEPDist->ServiceID == WMI_DATA_VO_SVC) { |
+ if ((pEPDist->TxCreditsAssigned >= pEPDist->TxCreditsNorm)) { |
+ /* limit VO service from oversubscribing */ |
+ break; |
+ } |
+ } |
+#else |
if (pEPDist->ServiceID == WMI_DATA_VI_SVC) { |
if ((pEPDist->TxCreditsAssigned >= pEPDist->TxCreditsNorm) || |
(pCredInfo->CurrentFreeCredits <= pEPDist->TxCreditsPerMaxMsg)) { |
@@ -289,6 +331,7 @@ static void SeekCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, |
break; |
} |
} |
+#endif |
/* for all other services, we follow a simple algorithm of |
* 1. checking the free pool for credits |