diff mbox series

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

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

Commit Message

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


hash queues are created based on application configuration
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: b122176ee59494dd957f0f5ff41d4b55a1477e13
 ** Merge commit sha: 55477d89bb71a4393e8d1b2d518249de2cd6b12d
 **/
 platform/linux-generic/odp_classification.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c
index 5aa3b84a1..9b871c281 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -214,7 +214,7 @@  static void _odp_cls_update_hash_proto(cos_t *cos,
 
 odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t *param)
 {
-	int i, j;
+	uint32_t i, j;
 	odp_queue_t queue;
 	odp_cls_drop_t drop_policy;
 	cos_t *cos;
@@ -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;