diff mbox series

[v1,1/1] fix: linux-gen: cls:requested number of queues ignored during hash

Message ID 1516636817-25024-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v1,1/1] fix: linux-gen: cls:requested number of queues ignored during hash | expand

Commit Message

Github ODP bot Jan. 22, 2018, 4 p.m. UTC
From: Balasubramanian Manoharan <bala.manoharan@linaro.org>


Fixes: https://bugs.linaro.org/show_bug.cgi?id=3578

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

---
/** Email created from pull request 417 (bala-manoharan:BUG3578)
 ** https://github.com/Linaro/odp/pull/417
 ** Patch: https://github.com/Linaro/odp/pull/417.patch
 ** Base sha: 3ce9d6ab16d064b0f83508e2f0b2e476d64b15e1
 ** Merge commit sha: 55477d89bb71a4393e8d1b2d518249de2cd6b12d
 **/
 platform/linux-generic/odp_classification.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c
index 5aa3b84a1..6dc19635d 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -251,7 +251,7 @@  odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t *param)
 				_odp_cls_update_hash_proto(cos,
 							   param->hash_proto);
 				tbl_index = cos->s.index * CLS_COS_QUEUE_MAX;
-				for (j = 0; j < CLS_COS_QUEUE_MAX; j++) {
+				for (j = 0; j < param->num_queue; j++) {
 					queue = odp_queue_create(NULL, &cos->s.
 								 queue_param);
 					if (queue == ODP_QUEUE_INVALID) {
@@ -994,7 +994,8 @@  int cls_classify_packet(pktio_entry_t *entry, const uint8_t *base,
 	hash = packet_rss_hash(pkt_hdr, cos->s.hash_proto, base);
 	/* CLS_COS_QUEUE_MAX is a power of 2 */
 	hash = hash & (CLS_COS_QUEUE_MAX - 1);
-	tbl_index = (cos->s.index * CLS_COS_QUEUE_MAX) + hash;
+	tbl_index = (cos->s.index * CLS_COS_QUEUE_MAX) + (hash %
+							  cos->s.num_queue);
 	pkt_hdr->dst_queue = queue_fn->from_ext(queue_grp_tbl->
 						s.queue[tbl_index]);
 	return 0;