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 ED9A7A0540; Tue, 13 Dec 2022 10:29:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CF5D940395; Tue, 13 Dec 2022 10:29:31 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2075.outbound.protection.outlook.com [40.107.220.75]) by mails.dpdk.org (Postfix) with ESMTP id 88A3740146 for ; Tue, 13 Dec 2022 10:29:30 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ecD0PoW1zrAHCPgrec/YySOR3zLkRzDsRdBlwIXPLr/9IhcHgSml8q1q2gQbMb7sERMWh5Ep749lXaMmyljpOFqxzrbbQzCmxIVw6KDx/iT15RDOGWoUmYYlciRCJhDfLIpeKZ2TentNpyiFijsSaLS34exsAcZLDAGzZ4iQuuEZVER1SHRPmU4EtrqU8zXid9kYlObfqROV2bMBxmG6DCEtKdjRcT6Fr1aNLXqn7fVVAfmRpAmWIu3VFwUMr+t/O3VcrYjMaiEs+LTNVS+Cy7Bdzj4JOWS2ahbZhh+DqgzIripqpuvKTJnlJDmoi4Ey0tPtTyDE4co4oRvApbaGhw== 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=Jmj+1lFAdfwAv2EB+kKxedd5F1luq045kE188zW9fEE=; b=ed7rs/Cg1iTmXM09XzR0hHsvAstTvBnVrqSoS8kLpixH061tjM2dBmkV2CsFSI5IEWlNah0rVXXOlZ3RjqQg0L9H6i/xjqVjU6Jktd+BfEuPrEvnlS5XnoLIzT+0vzXVvhzDesNZZUzt+3UiIiWrsdhnH50VEp16VdhifAyXS9/QyCj2VG7KNDTZmWiJtESabOpI9tlMJ7HkZdJH8lEKNAzgFRSQ7OAZk4hsK7h3YCJujEysNbefiv4ThqIgPxUJZa3gki/QWX4RFGgCRqSsHdmlv32o/xlBWOJ+replbNURH2JMj61b1YSYA+kHE/1PQS0HS1rSH0LewMlhCgi6hw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=monjalon.net 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=Jmj+1lFAdfwAv2EB+kKxedd5F1luq045kE188zW9fEE=; b=ReQLf7NI/6Qj4zBhbhj7RV437jJmr4BhLH2p+YAPzQE8B6AZ0mSH3M8kMpEoRWCZ7hEJO7UVKtTEydYp9pcaDlS0VKkeOsGNHREnq3J9x9dnlZnIRvPEOtRPwprLvG7vxQUjE09Zokmwme33KtbblnmbUq6caqCCNU7DE19XEfgGz9LjQnRz8tzLMTHmebhJ+PUw7PdqEXVVfnKCSJrK92R8c3W4pmxKwtdNJ6Sa8jf8ehVbTWjPY4vfPCByQGxdoVyAuvP4bWO5WCtRSNsUcYEaKBIQyZieKA1jxsBtXOfo5qgnSfnZDkaSMYGdLq5Rmgeqsrbq2SdaXPZn9GrLgw== Received: from MW4PR04CA0228.namprd04.prod.outlook.com (2603:10b6:303:87::23) by CH2PR12MB4214.namprd12.prod.outlook.com (2603:10b6:610:aa::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19; Tue, 13 Dec 2022 09:29:28 +0000 Received: from CO1NAM11FT069.eop-nam11.prod.protection.outlook.com (2603:10b6:303:87:cafe::cb) by MW4PR04CA0228.outlook.office365.com (2603:10b6:303:87::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19 via Frontend Transport; Tue, 13 Dec 2022 09:29:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT069.mail.protection.outlook.com (10.13.174.129) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5901.21 via Frontend Transport; Tue, 13 Dec 2022 09:29:28 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 13 Dec 2022 01:29:12 -0800 Received: from nvidia.com (10.126.231.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; Tue, 13 Dec 2022 01:29:10 -0800 From: Alex Vesker To: , , , , Matan Azrad CC: , Subject: [PATCH] net/mlx5: add debug support for dumping all rte ports Date: Tue, 13 Dec 2022 11:28:49 +0200 Message-ID: <20221213092849.7889-1-valex@nvidia.com> X-Mailer: git-send-email 2.18.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.231.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: CO1NAM11FT069:EE_|CH2PR12MB4214:EE_ X-MS-Office365-Filtering-Correlation-Id: 69567bab-345d-4da1-0a0f-08dadcec8837 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3yFRS+QPv/xpU7ub7gnVn6PuNWeCmJaYnl3CwyR2ETtJOmLenpjCYSjLQpR/OSimosS865HDWTsNaXH4KBqm2XKLhExVDAZQDkiU2MEpmpzuudtqpicLipIRPVxGi+qQdQY6bWkXEguV+Gu2PPSC1J0wibxUgUgMHA0d+bxx4syIwoxaT4/2hJA3T8Ndi4qf6XhmCo1VWUmgE/IzHhzzNGXLxYwlvySSl0XH+pYhvCmnkxJcTzn9Rrxv0juhKuvRMILwbSeIWt489zglokoFdKSLzaBgQDgnyIJ1KTx6k0/n3f6+3WEi/lpM6vf/0giphn0FNC4ehJon3Qvj1dcbdLLeryXjQkmZ2MNpCgUgNw0itzqALa6xX+CssAVz3Dze3g4n277xBOdVjegO416Yx8/aUU8a9MiVe01vK5RwQ7pRj9m9GGSY166bJC91S+M91al+YaBED8pv41+p+obwGJ1/F+UBkLaazQFS5PStq0uuCtyaEUd7pYIO+x5pzvoHAXIGj1pMlR73k0xToXf24dgMH7l0IJ+77kU2bFfhExEoljLvdPW9uPXSjT61joTfStMArJq715qpTdqFcK9jZ3sdpY/iUTH07VMgRBXM2fuYfF+kjxc8xf/V/ZZMY8RGOb1G+s7+kOQk0XhZ83pTqVr1DjzlawJPhAL7qoSw3HSQpLgSwxr1JIT/YaXv0SA/2jrvBY45DwtwPZ9Ro4vO2w== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(396003)(39860400002)(346002)(136003)(376002)(451199015)(46966006)(36840700001)(40470700004)(7636003)(55016003)(36860700001)(83380400001)(356005)(40480700001)(86362001)(40460700003)(82740400003)(70206006)(426003)(8676002)(41300700001)(4326008)(70586007)(5660300002)(8936002)(316002)(6666004)(186003)(2906002)(7696005)(1076003)(107886003)(26005)(2616005)(47076005)(336012)(6286002)(16526019)(6636002)(54906003)(478600001)(82310400005)(110136005)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2022 09:29:28.1110 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69567bab-345d-4da1-0a0f-08dadcec8837 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT069.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4214 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(-) diff --git a/drivers/net/mlx5/linux/mlx5_socket.c b/drivers/net/mlx5/linux/mlx5_socket.c index 0e01aff0e7..ab1a8075f3 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; + } + + RTE_ETH_FOREACH_DEV(port_id) { + 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