diff mbox series

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

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

Commit Message

Github ODP bot Jan. 25, 2018, 6 a.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: 984686b0763495c6dd97d2094f292fc7e01937d0
 ** Merge commit sha: 53e499743be4ea7803ed86b78eb3e8b35b1f87d1
 **/
 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 668b41eb1..e924a9c61 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -221,7 +221,7 @@  static inline void _cls_queue_unwind(uint32_t tbl_index, uint32_t j)
 
 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;
@@ -258,7 +258,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 = i * 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) {
@@ -1003,7 +1003,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;