Преглед изворни кода

qcacmn: Fix bucket calculation in NAPI case

Take care of corner case when normlized value is just
one more than QCA_NAPI_BUDGET and add normlized to debug prints.

Change-Id: Ife2010b0ada534a487639dbb780e24445d98c045
CRs-Fixed: 2286601
Venkateswara Swamy Bandaru пре 6 година
родитељ
комит
33b1bdd1b6
1 измењених фајлова са 6 додато и 3 уклоњено
  1. 6 3
      hif/src/hif_napi.c

+ 6 - 3
hif/src/hif_napi.c

@@ -932,11 +932,14 @@ int hif_napi_poll(struct hif_opaque_softc *hif_ctx,
 		normalized = (rc / napi_info->scale);
 		if (normalized == 0)
 			normalized++;
-		bucket = normalized / (QCA_NAPI_BUDGET / QCA_NAPI_NUM_BUCKETS);
+		bucket = (normalized - 1) /
+				(QCA_NAPI_BUDGET / QCA_NAPI_NUM_BUCKETS);
 		if (bucket >= QCA_NAPI_NUM_BUCKETS) {
 			bucket = QCA_NAPI_NUM_BUCKETS - 1;
-			HIF_ERROR("Bad bucket#(%d) > QCA_NAPI_NUM_BUCKETS(%d)",
-				bucket, QCA_NAPI_NUM_BUCKETS);
+			HIF_ERROR("Bad bucket#(%d) > QCA_NAPI_NUM_BUCKETS(%d)"
+					" normalized %d, napi budget %d",
+					bucket, QCA_NAPI_NUM_BUCKETS,
+					normalized, QCA_NAPI_BUDGET);
 		}
 		napi_info->stats[cpu].napi_budget_uses[bucket]++;
 	} else {