From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8E53DA0547; Thu, 29 Apr 2021 16:55:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 396D6410DD; Thu, 29 Apr 2021 16:55:38 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2078.outbound.protection.outlook.com [40.107.92.78]) by mails.dpdk.org (Postfix) with ESMTP id 5B72C406FF for ; Thu, 29 Apr 2021 16:55:36 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lEPdeqcCp4jPf0Kc+oOXUi4xq/7wQcecp70MVxLqhEjp/jBtfUZoKx2Eco5PEHoA9iKNDorcoS9BvDz0FHc1F4hvNULN6xG/o1AOU24R8CdOw//4+LTTtfWlN5GB8s4tNkHYRVEqD+BVxyfaZ4VpolAw9dxJBU7mskDzNpxzxjmcZusqkyGuA5i8Dbu4MCXvgDmgl+zl+GrAlyApwFIJQPmMsNEAb56lM8jCscp7DmhXRMlxJEXGIMOFaKDK9hVqDo0+zp2+HuVzuzK9XxBDdLfhu4oXnRdRPeSa7MH9/BHNI3zd6baB2NKH+9Dd4Lrgh3vANQt8n2PLumaB8fzMcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Plezu0eUDuDumELe6X5O74gx61YkWdZO5rthM3HW3sA=; b=QG7MdgF/fGcLAw4a0nzcE8KCl4iVruvv1+8MZXJNACYLZ36qRZY5CyMHz2lSWted6o/aw5MrVHAvEODuj1CAkOVUN8WNf9Ffxb5D7gaqav1P/x97lX1UEBaqpx+Lh1quvARjBLxZMhe3ynxL5klepxN8oyDQHK8Fd7j1J2ZMCXdMb7qs8AvoeDAByv7cufa9rQOgSbG54gxY7tySsVjoVPWWlrPkE0+SDWHW5MsUkEteGTBNXVip3zLYUmXSHzkibsIGWozy5M2NvzWeytSh+23nUX3uHCrKhvuU3YNxhav3AYxXJSEKlg+3+vkLwHmcfTJuoypJvi2FLal/F/TEHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=ericsson.com smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Plezu0eUDuDumELe6X5O74gx61YkWdZO5rthM3HW3sA=; b=ZYFZ3q38twc+EiCkidNvfNg7YSX/s+JmH6giv1Dy3TzgkpErI/UEkMbSrXWLt0kh0zvorn30Q8xVHVSnrrZdt6j9UC77kjbgWIXBEo0H+R1Jm+57NnOX6xnU8L4kQeFwTwhaw7HpaNe9/kFHEfsCep1mp2C1G6r3Ls6RmXnXA7xbRS487QhRuW+EDMXPqW5idYZglYruIg1MLiiBh/wLA3Sk6FZXhjcw3XeRykN3A5So8ZrKXy1dQsC1ts1Wa50B4+Wn0l0x9f23+vq7ph21cRcN01lXjyyawGS75dwph8ZfTWvEPR9fxEJ5vpqnUvizFrMThb3MXq8yq5DiV8tl9g== Received: from MW4PR04CA0165.namprd04.prod.outlook.com (2603:10b6:303:85::20) by BN6PR12MB1298.namprd12.prod.outlook.com (2603:10b6:404:17::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21; Thu, 29 Apr 2021 14:55:34 +0000 Received: from CO1NAM11FT037.eop-nam11.prod.protection.outlook.com (2603:10b6:303:85:cafe::3a) by MW4PR04CA0165.outlook.office365.com (2603:10b6:303:85::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.25 via Frontend Transport; Thu, 29 Apr 2021 14:55:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; ericsson.com; dkim=none (message not signed) header.d=none;ericsson.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT037.mail.protection.outlook.com (10.13.174.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4087.27 via Frontend Transport; Thu, 29 Apr 2021 14:55:33 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 29 Apr 2021 14:55:31 +0000 From: Alexander Kozyrev To: CC: , , , Date: Thu, 29 Apr 2021 17:55:18 +0300 Message-ID: <20210429145518.20999-1-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20210408032554.20255-1-akozyrev@nvidia.com> References: <20210408032554.20255-1-akozyrev@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d36fd894-dbf5-4d6b-b1e6-08d90b1ed74c X-MS-TrafficTypeDiagnostic: BN6PR12MB1298: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E6QaSoLqArBcLUubzuA2/pYSX0N+3lkGRN/spRz95f2K7Gk7DnBO+2h9vRuGBGi+8hGxDv5ORrdwO7fI14UIv+wFe8RiNnqEZfyg9UR2PfZjtAxTC4RG8hKnJWv5RQmRZQYOG/RSlDLDhmI21xXWbbbclcetEgtRJacspA/9phtdEY7C+fwEgi77EPXFxR35qJVqCZcNKCa9x6ouMkmUPo5lijmH9kemZ0mNH1i7WYrnyp2lRzfPuRC5+GRYwWi3hTvBlCP//BgD2GWtHaJyIrKnBXGuJFiif2VzYSMuRUN2I2Z5GpPcMssejJTQxEGZR41LPwEMSwr142RmKP6MtwDhfx+wpSfULkavPJaPZyc+9wXwTpvczK3hHia+JSNvOzar6Y0t5FCZUFKHPGV9JtHWgvATRcykLmn0upOE6ftc4O8ISanGfYaL2UOIRMxhbtQ+Sy1f59/bdkuMBDvUhZH470baCx9XtfVsorbOAThe7oCGurG3i5FzwR/G48m/d6JwXphi9A6LTnOrC9mn19VYKSW3KPfaBdeTjy+M535XjN9Ko7FLLh+yNLFuownHoju5TwpUdB31AU3UPqFXcuH46V3belIBvnuJ5X0blK3Zew1OeStUDY+L7Ob4we41TeCbtIuqCGtxgJFoGn/CIUuV1YyBhSZ1yYSumDGcCIeBK9QkII47hAYxCxEBEHDA X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(396003)(376002)(136003)(346002)(46966006)(36840700001)(54906003)(16526019)(36756003)(82740400003)(36906005)(26005)(186003)(8936002)(4326008)(70586007)(86362001)(55016002)(316002)(6286002)(7636003)(1076003)(356005)(70206006)(82310400003)(2616005)(336012)(478600001)(2906002)(6666004)(5660300002)(47076005)(83380400001)(8676002)(426003)(6916009)(7696005)(36860700001)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2021 14:55:33.7528 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d36fd894-dbf5-4d6b-b1e6-08d90b1ed74c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT037.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1298 Subject: [dpdk-dev] [PATCH v3] net/mlx5: add power monitoring support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Support the PMD power management API in MLX5 driver. The monitor policy of this API puts a CPU core to sleep until a data in some monitored memory address is changed by the NIC. Implement the get_monitor_addr function to return an address of a CQE owner bit to monitor the arrival of a new packet. Signed-off-by: Alexander Kozyrev --- doc/guides/rel_notes/release_21_05.rst | 1 + drivers/net/mlx5/mlx5.c | 2 ++ drivers/net/mlx5/mlx5_rx.c | 19 +++++++++++++++++++ drivers/net/mlx5/mlx5_rx.h | 1 + 4 files changed, 23 insertions(+) diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst index 133a0dbbf2..6957c5420f 100644 --- a/doc/guides/rel_notes/release_21_05.rst +++ b/doc/guides/rel_notes/release_21_05.rst @@ -165,6 +165,7 @@ New Features * Added support for pre-defined meter policy API. * Added support for ASO (Advanced Steering Operation) meter. * Added support for ASO metering by PPS (packet per second). + * Added support for the monitor policy of Power Management API. * **Updated NXP DPAA driver.** diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 19ffa16769..8cd6f1eaee 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1615,6 +1615,7 @@ const struct eth_dev_ops mlx5_dev_ops = { .hairpin_queue_peer_update = mlx5_hairpin_queue_peer_update, .hairpin_queue_peer_bind = mlx5_hairpin_queue_peer_bind, .hairpin_queue_peer_unbind = mlx5_hairpin_queue_peer_unbind, + .get_monitor_addr = mlx5_get_monitor_addr, }; /* Available operations from secondary process. */ @@ -1699,6 +1700,7 @@ const struct eth_dev_ops mlx5_dev_ops_isolate = { .hairpin_queue_peer_update = mlx5_hairpin_queue_peer_update, .hairpin_queue_peer_bind = mlx5_hairpin_queue_peer_bind, .hairpin_queue_peer_unbind = mlx5_hairpin_queue_peer_unbind, + .get_monitor_addr = mlx5_get_monitor_addr, }; /** diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c index e9fcb522e2..6cd71a44eb 100644 --- a/drivers/net/mlx5/mlx5_rx.c +++ b/drivers/net/mlx5/mlx5_rx.c @@ -269,6 +269,25 @@ mlx5_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id) return rx_queue_count(rxq); } +int mlx5_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc) +{ + struct mlx5_rxq_data *rxq = rx_queue; + const unsigned int cqe_num = 1 << rxq->cqe_n; + const unsigned int cqe_mask = cqe_num - 1; + const uint16_t idx = rxq->cq_ci & cqe_num; + volatile struct mlx5_cqe *cqe = &(*rxq->cqes)[rxq->cq_ci & cqe_mask]; + + if (unlikely(rxq->cqes == NULL)) { + rte_errno = EINVAL; + return -rte_errno; + } + pmc->addr = &cqe->op_own; + pmc->val = !!idx; + pmc->mask = MLX5_CQE_OWNER_MASK; + pmc->size = sizeof(uint8_t); + return 0; +} + /** * Translate RX completion flags to packet type. * diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h index d5a2de84d1..1b264e5994 100644 --- a/drivers/net/mlx5/mlx5_rx.h +++ b/drivers/net/mlx5/mlx5_rx.h @@ -263,6 +263,7 @@ void mlx5_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_rxq_info *qinfo); int mlx5_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, struct rte_eth_burst_mode *mode); +int mlx5_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc); /* Vectorized version of mlx5_rx.c */ int mlx5_rxq_check_vec_support(struct mlx5_rxq_data *rxq_data); -- 2.18.1