diff mbox series

[v4,1/1] linux-gen: pktio: ignore num_queues parameter if classifier enabled

Message ID 1508533209-9940-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v4,1/1] linux-gen: pktio: ignore num_queues parameter if classifier enabled | expand

Commit Message

Github ODP bot Oct. 20, 2017, 9 p.m. UTC
From: Maxim Uvarov <maxim.uvarov@linaro.org>


Api defines statemet:
  "When classifier is enabled in odp_pktin_queue_config() this
   value is ignored, otherwise at least one queue is required."
https://bugs.linaro.org/show_bug.cgi?id=3289

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
/** Email created from pull request 240 (muvarov:master_bug3289)
 ** https://github.com/Linaro/odp/pull/240
 ** Patch: https://github.com/Linaro/odp/pull/240.patch
 ** Base sha: 54228421977f94d9da752290540c6ec4dc5306a0
 ** Merge commit sha: a880959768abe7fc59e51fcc9520e723aeb09429
 **/
 platform/linux-generic/odp_packet_io.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index f972bb78f..0473483de 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -1228,13 +1228,13 @@  int odp_pktin_queue_config(odp_pktio_t pktio,
 	if (mode == ODP_PKTIN_MODE_DISABLED)
 		return 0;
 
-	num_queues = param->num_queues;
-
-	if (num_queues == 0) {
-		ODP_DBG("pktio %s: zero input queues\n", entry->s.name);
+	if (!param->classifier_enable && param->num_queues == 0) {
+		ODP_DBG("invalid num_queues for operation mode\n");
 		return -1;
 	}
 
+	num_queues = param->classifier_enable ? 1 : param->num_queues;
+
 	rc = odp_pktio_capability(pktio, &capa);
 	if (rc) {
 		ODP_DBG("pktio %s: unable to read capabilities\n",
@@ -1263,8 +1263,11 @@  int odp_pktin_queue_config(odp_pktio_t pktio,
 			snprintf(name, sizeof(name), "odp-pktin-%i-%i",
 				 pktio_id, i);
 
-			memcpy(&queue_param, &param->queue_param,
-			       sizeof(odp_queue_param_t));
+			if (param->classifier_enable)
+				odp_queue_param_init(&queue_param);
+			else
+				memcpy(&queue_param, &param->queue_param,
+				       sizeof(odp_queue_param_t));
 
 			queue_param.type = ODP_QUEUE_TYPE_PLAIN;