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 A0B9DA034C; Wed, 21 Dec 2022 11:11:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3ECF640A7A; Wed, 21 Dec 2022 11:11:06 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2082.outbound.protection.outlook.com [40.107.244.82]) by mails.dpdk.org (Postfix) with ESMTP id 7949640698 for ; Wed, 21 Dec 2022 11:11:04 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kCbQ/ySFGLc4X+h1unmx9SklagE2fsfPVymmDNeHD/4kevkRj/PEHEj6YwhyY/5WagW4hSwRouoPYARyQI79cCEuBK6u16SXMFlN2y1yalC6DSdvLrtO2gVQzJoWqbc/pLiXPG8oZdbAcSxg0HRs7xTpQ79rpF2wCFAyTGU5SUinRUaZpWTzOyS08cges9SnbZSPakXDnU2RO6FUBh8xXA4LFgUTiRJeBRWyj9yai6x3I17O3FijkwUiM6+I5r27qBJh+tD9Zeqct2w3q6J1sBXYrcwQglRsqBF2V4IID6VW0n2GlR0HwdaDYSqJ0sYfFloFHSBOFJGnprmFhTb+SA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vWqUldYjVE6IVKJG3paCuUKl4jJ2MJUxxPozp/5iYzQ=; b=UQSkrk50wTd9PZRLXHztxYzWnBPrm1mjXxyeGxBbbr+1jBy4/C3d13K4U40s2E6qeHj5mAK5H/A9SSuTA8pXVa8WeE19TQQKuck7ygPqBtcb+t5imA0LZEgkYJNOMQ/+oOg7HmLY7e1BJbfk/h51Z4efoZDYcY1bCumZqVH+3+yHMXvwd99Y+9Q7jEASPH7jUdx31tblRp/htv27RLOQ+DJ7NqhJtNBajg4yqijp3rt3nrdIaI41AtTDwxa79y0IueW44s36WUG60Co7N/Q2pvjT5PiYCFqNy3EMOFOLgnwAl4Ol1ruL1FVj23ufrQ+jFNW8J8iSt1F865sArnm3EA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject 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=vWqUldYjVE6IVKJG3paCuUKl4jJ2MJUxxPozp/5iYzQ=; b=kq7JMQFJSYbTegBKq79385VF63vzbLn5TAp5NiVisnhsrXfOP8GZBYOsBBmr2zPC2D3vXS76acq5dRloQ/krrJjn0EAKKX49jkrK0hyHBM2enXwIYRP1irMAfF0Y9MuDN/1wFoN5GPhXaejT+D4i1LFQzzsQebI1zCxA5zOxNDWJr9FqU5T3i0zUckeHLYhvn9WPMpFMWH1U33A0n3M3WFb+watqUadvBPwSm6EopP65uiq2jbjbCY36Nj3W0TOZvrxRxuIKYaTajXEKWR9LKAQHXwDLmYNpLm72fFp1ZlIJqtWe3oqMIgtaKIZi+w0dIQ5B01WMvDXa7sEEk4kTwA== Received: from BN9PR03CA0532.namprd03.prod.outlook.com (2603:10b6:408:131::27) by DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 10:11:02 +0000 Received: from BN8NAM11FT061.eop-nam11.prod.protection.outlook.com (2603:10b6:408:131:cafe::f7) by BN9PR03CA0532.outlook.office365.com (2603:10b6:408:131::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Wed, 21 Dec 2022 10:11:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT061.mail.protection.outlook.com (10.13.177.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.10 via Frontend Transport; Wed, 21 Dec 2022 10:11:00 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 21 Dec 2022 02:10:51 -0800 Received: from nvidia.com (10.126.230.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 21 Dec 2022 02:10:49 -0800 From: Alex Vesker To: CC: , , Subject: [PATCH v2] net/mlx5: add debug support for dumping all rte ports Date: Wed, 21 Dec 2022 12:10:01 +0200 Message-ID: <20221221101001.21255-1-valex@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20221213092849.7889-1-valex@nvidia.com> References: <20221213092849.7889-1-valex@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT061:EE_|DM4PR12MB5229:EE_ X-MS-Office365-Filtering-Correlation-Id: 90d1edcd-879b-4b4f-a51c-08dae33ba93e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iIWFWqqvP/PXlHtaA66013I8/EGPvt3DJ1PWgGDtP1oVXoPHoYUV/XZub2z0y+hwqe/Xz+jMIeHFg0vmuLmJwWALm6XveLwWKR6mNNQngbOOXDtuCsjpdj/owIumRpWpHB362ezks02VTaX7JEuPwSPharf0mysnHYeJ/r8fybnjyUdMM6m2QxXSVkfEhIE97Cv3aYAAbqr6e3Tz/EoH9ro7lE7Js395LWXeFvAhMdSdiTnJFzrH0/zBREHLZvmN+ZWLxEdsY62DB6ozE+yUP0LMZLhKmojz4LS93b4I0V/HogDMFI37UJQ4Ae2YEnWIv4XRZFPR4EMskqumDud2cVULeTLL29nPGrYZx+mmSfJI7LgSZuDmhM5B/IHNf/FkiGFrGku57UXo8OCjYZ20vE1NyCppyXk9yQtjNgrxZDCb08gnfJRKs92UBNzayFpKlhcKXNsrjPTOQQ9BiVA5BCKdzhJrtHDsJoIz+IhaEROTfjZhZ++g6jh/TrISyda/VnJpMVQpMWw/T4+gMVdNlqEJoKfnO4BtY4d5gxNCmnJnLjGCGf6pNC3Lx91zcCaUxPb3QLnWPsFbCj7ZAIg8Bw+hmVG3/sJ0qnAinxvVLdV/L7YFKvRD2eQkhYxe3cxr9Dbgt0j3aa+hvV7hBrDfRlv44d/StzuWj+2k9Ws2qbSmgdUsemxeA6Xvxy/4/XbzV0uiKzzMGYQeAnGULJFu1A== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39860400002)(136003)(346002)(451199015)(40470700004)(46966006)(36840700001)(70586007)(4326008)(40460700003)(8676002)(70206006)(316002)(5660300002)(36756003)(86362001)(8936002)(41300700001)(7696005)(2616005)(186003)(6666004)(82310400005)(107886003)(16526019)(6286002)(1076003)(26005)(47076005)(426003)(83380400001)(36860700001)(336012)(356005)(55016003)(54906003)(7636003)(478600001)(82740400003)(6916009)(40480700001)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 10:11:00.6189 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90d1edcd-879b-4b4f-a51c-08dae33ba93e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT061.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5229 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 Add a special value max_uint16 to request dump of all rte ethernet ports. This is useful for collecting the full info from all the ports in a single dump. Signed-off-by: Alex Vesker Reviewed-by: Ori Kam --- drivers/net/mlx5/linux/mlx5_socket.c | 39 ++++++++++++++++++---------- 1 file changed, 26 insertions(+), 13 deletions(-) v2: Fix iteration function to use only mlx5 devices diff --git a/drivers/net/mlx5/linux/mlx5_socket.c b/drivers/net/mlx5/linux/mlx5_socket.c index 0e01aff0e7..6ce0e59643 100644 --- a/drivers/net/mlx5/linux/mlx5_socket.c +++ b/drivers/net/mlx5/linux/mlx5_socket.c @@ -21,6 +21,7 @@ /* PMD socket service for tools. */ #define MLX5_SOCKET_PATH "/var/tmp/dpdk_net_mlx5_%d" +#define MLX5_ALL_PORT_IDS 0xffff int server_socket = -1; /* Unix socket for primary process. */ struct rte_intr_handle *server_intr_handle; /* Interrupt handler. */ @@ -35,7 +36,7 @@ mlx5_pmd_socket_handle(void *cb __rte_unused) int ret; struct cmsghdr *cmsg = NULL; uint32_t data[MLX5_SENDMSG_MAX / sizeof(uint32_t)]; - uint64_t flow_ptr = 0; + struct rte_flow *flow_ptr = NULL; uint8_t buf[CMSG_SPACE(sizeof(int))] = { 0 }; struct iovec io = { .iov_base = data, @@ -92,25 +93,37 @@ mlx5_pmd_socket_handle(void *cb __rte_unused) dump_req = (struct mlx5_flow_dump_req *)msg.msg_iov->iov_base; if (dump_req) { port_id = dump_req->port_id; - flow_ptr = dump_req->flow_id; + flow_ptr = (struct rte_flow *)((uintptr_t)dump_req->flow_id); } else { DRV_LOG(WARNING, "Invalid message"); goto error; } - if (!rte_eth_dev_is_valid_port(port_id)) { - DRV_LOG(WARNING, "Invalid port %u", port_id); - goto error; + if (port_id == MLX5_ALL_PORT_IDS) { + /* Dump all port ids */ + if (flow_ptr) { + DRV_LOG(WARNING, "Flow ptr unsupported with given port id"); + goto error; + } + + MLX5_ETH_FOREACH_DEV(port_id, NULL) { + dev = &rte_eth_devices[port_id]; + ret = mlx5_flow_dev_dump(dev, NULL, file, &err); + if (ret) + break; + } + } else { + /* Dump single port id */ + if (!rte_eth_dev_is_valid_port(port_id)) { + DRV_LOG(WARNING, "Invalid port %u", port_id); + goto error; + } + + /* Dump flow */ + dev = &rte_eth_devices[port_id]; + ret = mlx5_flow_dev_dump(dev, flow_ptr, file, &err); } - /* Dump flow. */ - dev = &rte_eth_devices[port_id]; - if (flow_ptr == 0) - ret = mlx5_flow_dev_dump(dev, NULL, file, NULL); - else - ret = mlx5_flow_dev_dump(dev, - (struct rte_flow *)((uintptr_t)flow_ptr), file, &err); - /* Set-up the ancillary data and reply. */ msg.msg_controllen = 0; msg.msg_control = NULL; -- 2.18.1