From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id B2359A0524;
	Tue,  1 Jun 2021 14:01:31 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 4169E4111E;
	Tue,  1 Jun 2021 14:00:55 +0200 (CEST)
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by mails.dpdk.org (Postfix) with ESMTP id CA34040E78
 for <dev@dpdk.org>; Tue,  1 Jun 2021 14:00:53 +0200 (CEST)
IronPort-SDR: caZm20BT4SQO944K9SIY18PvW02GDO/4GJvIHORMu0akvJkUJ0DSPZmNXbk++KiDihpwI1xRiW
 +ubT4Cd4+RVQ==
X-IronPort-AV: E=McAfee;i="6200,9189,10001"; a="203528504"
X-IronPort-AV: E=Sophos;i="5.83,239,1616482800"; d="scan'208";a="203528504"
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 01 Jun 2021 05:00:53 -0700
IronPort-SDR: X1uRnl8qLXUmufsNEs95jShRHaq3bmjm5Zm8uokR16GIk/HrL6D8AqjcWGgv/O4OJ87/YcA+bI
 Bme+JS2aM7Yw==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.83,239,1616482800"; d="scan'208";a="549707053"
Received: from silpixa00399498.ir.intel.com (HELO
 silpixa00399498.ger.corp.intel.com) ([10.237.222.54])
 by fmsmga001.fm.intel.com with ESMTP; 01 Jun 2021 05:00:52 -0700
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org,
	David Hunt <david.hunt@intel.com>
Cc: ciara.loftus@intel.com
Date: Tue,  1 Jun 2021 12:00:36 +0000
Message-Id: <545b85cf2de1cf5f3dd5efd137f2f2ecd92ac2da.1622548381.git.anatoly.burakov@intel.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <cover.1622548381.git.anatoly.burakov@intel.com>
References: <cover.1622548381.git.anatoly.burakov@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v1 7/7] l3fwd-power: support multiqueue in PMD
 pmgmt modes
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Currently, l3fwd-power enforces the limitation of having one queue per
lcore. This is no longer necessary, so remove the limitation, and always
mark the last queue in qconf as the power save queue.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 examples/l3fwd-power/main.c | 39 +++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index f8dfed1634..3057c06936 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -2498,6 +2498,27 @@ mode_to_str(enum appmode mode)
 	}
 }
 
+static void
+pmd_pmgmt_set_up(unsigned int lcore, uint16_t portid, uint16_t qid, bool last)
+{
+	int ret;
+
+	ret = rte_power_ethdev_pmgmt_queue_enable(lcore, portid,
+			qid, pmgmt_type);
+	if (ret < 0)
+		rte_exit(EXIT_FAILURE,
+			"rte_power_ethdev_pmgmt_queue_enable: err=%d, port=%d\n",
+			ret, portid);
+
+	if (!last)
+		return;
+	ret = rte_power_ethdev_pmgmt_queue_set_power_save(lcore, portid, qid);
+	if (ret < 0)
+		rte_exit(EXIT_FAILURE,
+			"rte_power_ethdev_pmgmt_queue_set_power_save: err=%d, port=%d\n",
+			ret, portid);
+}
+
 int
 main(int argc, char **argv)
 {
@@ -2723,12 +2744,6 @@ main(int argc, char **argv)
 		printf("\nInitializing rx queues on lcore %u ... ", lcore_id );
 		fflush(stdout);
 
-		/* PMD power management mode can only do 1 queue per core */
-		if (app_mode == APP_MODE_PMD_MGMT && qconf->n_rx_queue > 1) {
-			rte_exit(EXIT_FAILURE,
-				"In PMD power management mode, only one queue per lcore is allowed\n");
-		}
-
 		/* init RX queues */
 		for(queue = 0; queue < qconf->n_rx_queue; ++queue) {
 			struct rte_eth_rxconf rxq_conf;
@@ -2767,15 +2782,9 @@ main(int argc, char **argv)
 						 "Fail to add ptype cb\n");
 			}
 
-			if (app_mode == APP_MODE_PMD_MGMT) {
-				ret = rte_power_ethdev_pmgmt_queue_enable(
-						lcore_id, portid, queueid,
-						pmgmt_type);
-				if (ret < 0)
-					rte_exit(EXIT_FAILURE,
-						"rte_power_ethdev_pmgmt_queue_enable: err=%d, port=%d\n",
-							ret, portid);
-			}
+			if (app_mode == APP_MODE_PMD_MGMT)
+				pmd_pmgmt_set_up(lcore_id, portid, queueid,
+					queue == (qconf->n_rx_queue - 1));
 		}
 	}
 
-- 
2.25.1