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 1FAA2A0547; Thu, 29 Apr 2021 11:56:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2FD0D41309; Thu, 29 Apr 2021 11:56:28 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2075.outbound.protection.outlook.com [40.107.237.75]) by mails.dpdk.org (Postfix) with ESMTP id E910C41302 for ; Thu, 29 Apr 2021 11:56:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NehKSmJtgmysnm77Lp4KNeNkFdv3/rsGhO23UUtEgNbVYhTpKg+mCw3h6qZ99kZF1sw1gqWIFITSPo8U/3Zvfcpgw45JpdvSA0bZnxD+IuPWmXeVMxOpieT6ceIIql8s4lfqFaAiDNDid8pRwKjmAte9xZznheEpZ/KGNLloGswWbFg0ip+qewA5x81yoMcHhaLD7GeOVx1JZqcasVTokXjg3poCVWGHzkilfud8Ee7EmaWECsflFZEnmIvaAZGgkCp1+abfrPi9YJDh14qKE971/gXcIY5KUmO+f+rZqRqsVVzQ5bYU9E9OjyUwu/AIhS/g8PWW5ADucB9UVCwImw== 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=606fS8PEUxEgo78xx39hRJLxFWh9V/unrveI3ROF4aU=; b=W0xCCh2NVDrm2LzyDEpXbaFr140AR7P2iCCwtCER0V+8SwbRhVjlAUk879lfxBfQJsxbNw2/ef0raLR/6K+ndgvmXfF9HxvdNcixprLr+KcxvOihc4cFuYg2E92XpNfcHXzZXlcxBHQfJ6rKLd2dX4d27uGwEV7fB9+FG3Fwsg6gBqGDOT2BkfTVxeQOHyezXd+wci8zGVB50Uu0OrtqFiyxDIiboSN8/YYqhPKtvC/aLFNfMj2530XGSYF6KkbM58HEvkd1szKN1sy0XfOSnnMbSVjiXYY5t7kEe7GBpGgVP4h8QNbRfbWWYE0oji0CMSr8898TGieHUPSXWzM8gA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.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=606fS8PEUxEgo78xx39hRJLxFWh9V/unrveI3ROF4aU=; b=qKZjPxEDzWq/hGTp9yya2BkYBW0esgF28LZbGssv7rj/XqJGNP9kOCkDxds+5jGWAxBxSA1eGG8P0+2jTIrfbuTKhN6IMLHHZDxK2haboVqGcCd1SuN3PHoA7UuLTA0dSbG3DIdZFNIBX9ccoFXiDB6IzLIknbYLybYyoW60lLl87oyqL61Ig4cnsKRGWUuifjtarlJqN2qsExCx7V13IiEwjAYyWI4alT6iXYl1BShO678Ajr1IENzIhWAVYzjjFmLmd7KwymcgJ+vEYhZMH6WwawZQPe0prKzmElYlCCg7jHDr4+YXeq7h3Fo3jAxMUOx6S372tOBIuxp92KH3yQ== Received: from BN8PR04CA0063.namprd04.prod.outlook.com (2603:10b6:408:d4::37) by CH2PR12MB5018.namprd12.prod.outlook.com (2603:10b6:610:65::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.25; Thu, 29 Apr 2021 09:56:23 +0000 Received: from BN8NAM11FT007.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::53) by BN8PR04CA0063.outlook.office365.com (2603:10b6:408:d4::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27 via Frontend Transport; Thu, 29 Apr 2021 09:56:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.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 BN8NAM11FT007.mail.protection.outlook.com (10.13.177.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4087.32 via Frontend Transport; Thu, 29 Apr 2021 09:56:23 +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 09:56:21 +0000 From: Viacheslav Ovsiienko To: CC: , , , Michael Baum Date: Thu, 29 Apr 2021 12:55:40 +0300 Message-ID: <20210429095542.7800-4-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20210429095542.7800-1-viacheslavo@nvidia.com> References: <20210426124250.42771-1-michaelba@nvidia.com> <20210429095542.7800-1-viacheslavo@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: a43b48b0-c5e8-40b1-dd93-08d90af50c1f X-MS-TrafficTypeDiagnostic: CH2PR12MB5018: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:556; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9fHnmtzmTlm0GzBPuKhhO1HX9Cg4SKOZPFDROl0sk1tu4B0XEBT8BWUPe5RwRtOPleckrWqRzXVjE0eGfnJO+Dr0VnLTQKosCGGLFT9Yc5hnjlPd+iyOLX5g31vzHlfDUOizkJFHucwt0Na+lEhn/nnEO5MbCH9VTyl76T1OciVyal/XHhqX8sZnvj94wXH8PqrtxqromA3UhH9kU9YN1XLUBBulnuN2tDdp3HPoZHvWmTUws/fpZXXgGY0LkdUnrvhza4rMED1fa22icC/iMMUE8yF0++Gl2kjzFQadLwI05Vro5o5wgM/9VkeSJIjgFykz1X+5sIjs22gIgCgEM7CTqnOjOm0ScydLcJIEXjZ87pBQcv9qeW18UaZcUhHtar4SbiKNAwuSLPs8T+I4gpZEckSEZVlmI35B4LM2EkkNLGcJ4A11jpbnkGGUaXFyNAWPnKxlY/kWOdSv3hRQVTazapkR3ESxjirljr1XXEHeIYAh1G+XaN1F/xiLvj/vuB9HN6NslAiIVlA5t9ZMKlSfg9yNQAJPvGV97hXu5728dg6Z7SbN3jOHHQpSOOo5k2vb7Hul2MykfPotF0zpYDPifvkCtqBYq+waODYQaTZnZ7l1WZKa+axng1ceYqus9ZerLjjLHq8uejKfRSo1ptF+308nVEKMiYHtGCrXpZ0= 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)(346002)(376002)(136003)(36840700001)(46966006)(83380400001)(2616005)(36906005)(8936002)(54906003)(2906002)(86362001)(1076003)(336012)(7636003)(6666004)(426003)(47076005)(36756003)(4326008)(82740400003)(70206006)(36860700001)(478600001)(26005)(7696005)(107886003)(356005)(16526019)(8676002)(5660300002)(82310400003)(70586007)(55016002)(6286002)(186003)(6916009)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2021 09:56:23.3937 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a43b48b0-c5e8-40b1-dd93-08d90af50c1f 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: BN8NAM11FT007.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB5018 Subject: [dpdk-dev] [PATCH v2 3/5] app/testpmd: support indirect counter action query 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" From: Michael Baum Counter action query was implemented as part of flow query, but was not implemented as part of indirect action query. This patch adds the required implementation. Signed-off-by: Michael Baum Acked-by: Matan Azrad --- app/test-pmd/config.c | 145 ++++++++++++++++++++++-------------------- 1 file changed, 77 insertions(+), 68 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index a9805cc198..bedbfcbb7b 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1618,90 +1618,99 @@ port_action_handle_query(portid_t port_id, uint32_t id) { struct rte_flow_error error; struct port_indirect_action *pia; - uint64_t default_data; - void *data = NULL; - int ret = 0; + union { + struct rte_flow_query_count count; + struct rte_flow_query_age age; + struct rte_flow_action_conntrack ct; + } query; pia = action_get_by_id(port_id, id); if (!pia) return -EINVAL; switch (pia->type) { case RTE_FLOW_ACTION_TYPE_AGE: - data = &default_data; + case RTE_FLOW_ACTION_TYPE_COUNT: break; default: - printf("Indirect action %u (type: %d) on port %u doesn't" - " support query\n", id, pia->type, port_id); - return -1; + printf("Indirect action %u (type: %d) on port %u doesn't support query\n", + id, pia->type, port_id); + return -ENOTSUP; } - if (rte_flow_action_handle_query(port_id, pia->handle, data, &error)) - ret = port_flow_complain(&error); + /* Poisoning to make sure PMDs update it in case of error. */ + memset(&error, 0x55, sizeof(error)); + memset(&query, 0, sizeof(query)); + if (rte_flow_action_handle_query(port_id, pia->handle, &query, &error)) + return port_flow_complain(&error); switch (pia->type) { case RTE_FLOW_ACTION_TYPE_AGE: - if (!ret) { - struct rte_flow_query_age *resp = data; - - printf("AGE:\n" - " aged: %u\n" - " sec_since_last_hit_valid: %u\n" - " sec_since_last_hit: %" PRIu32 "\n", - resp->aged, - resp->sec_since_last_hit_valid, - resp->sec_since_last_hit); - } - data = NULL; + printf("Indirect AGE action:\n" + " aged: %u\n" + " sec_since_last_hit_valid: %u\n" + " sec_since_last_hit: %" PRIu32 "\n", + query.age.aged, + query.age.sec_since_last_hit_valid, + query.age.sec_since_last_hit); + break; + case RTE_FLOW_ACTION_TYPE_COUNT: + printf("Indirect COUNT action:\n" + " hits_set: %u\n" + " bytes_set: %u\n" + " hits: %" PRIu64 "\n" + " bytes: %" PRIu64 "\n", + query.count.hits_set, + query.count.bytes_set, + query.count.hits, + query.count.bytes); break; case RTE_FLOW_ACTION_TYPE_CONNTRACK: - if (!ret) { - struct rte_flow_action_conntrack *ct = data; - - printf("Conntrack Context:\n" - " Peer: %u, Flow dir: %s, Enable: %u\n" - " Live: %u, SACK: %u, CACK: %u\n" - " Packet dir: %s, Liberal: %u, State: %u\n" - " Factor: %u, Retrans: %u, TCP flags: %u\n" - " Last Seq: %u, Last ACK: %u\n" - " Last Win: %u, Last End: %u\n", - ct->peer_port, - ct->is_original_dir ? "Original" : "Reply", - ct->enable, ct->live_connection, - ct->selective_ack, ct->challenge_ack_passed, - ct->last_direction ? "Original" : "Reply", - ct->liberal_mode, ct->state, - ct->max_ack_window, ct->retransmission_limit, - ct->last_index, ct->last_seq, ct->last_ack, - ct->last_window, ct->last_end); - printf(" Original Dir:\n" - " scale: %u, fin: %u, ack seen: %u\n" - " unacked data: %u\n Sent end: %u," - " Reply end: %u, Max win: %u, Max ACK: %u\n", - ct->original_dir.scale, - ct->original_dir.close_initiated, - ct->original_dir.last_ack_seen, - ct->original_dir.data_unacked, - ct->original_dir.sent_end, - ct->original_dir.reply_end, - ct->original_dir.max_win, - ct->original_dir.max_ack); - printf(" Reply Dir:\n" - " scale: %u, fin: %u, ack seen: %u\n" - " unacked data: %u\n Sent end: %u," - " Reply end: %u, Max win: %u, Max ACK: %u\n", - ct->reply_dir.scale, - ct->reply_dir.close_initiated, - ct->reply_dir.last_ack_seen, - ct->reply_dir.data_unacked, - ct->reply_dir.sent_end, ct->reply_dir.reply_end, - ct->reply_dir.max_win, ct->reply_dir.max_ack); - } - data = NULL; + printf("Conntrack Context:\n" + " Peer: %u, Flow dir: %s, Enable: %u\n" + " Live: %u, SACK: %u, CACK: %u\n" + " Packet dir: %s, Liberal: %u, State: %u\n" + " Factor: %u, Retrans: %u, TCP flags: %u\n" + " Last Seq: %u, Last ACK: %u\n" + " Last Win: %u, Last End: %u\n", + query.ct.peer_port, + query.ct.is_original_dir ? "Original" : "Reply", + query.ct.enable, query.ct.live_connection, + query.ct.selective_ack, query.ct.challenge_ack_passed, + query.ct.last_direction ? "Original" : "Reply", + query.ct.liberal_mode, query.ct.state, + query.ct.max_ack_window, query.ct.retransmission_limit, + query.ct.last_index, query.ct.last_seq, + query.ct.last_ack, query.ct.last_window, + query.ct.last_end); + printf(" Original Dir:\n" + " scale: %u, fin: %u, ack seen: %u\n" + " unacked data: %u\n Sent end: %u," + " Reply end: %u, Max win: %u, Max ACK: %u\n", + query.ct.original_dir.scale, + query.ct.original_dir.close_initiated, + query.ct.original_dir.last_ack_seen, + query.ct.original_dir.data_unacked, + query.ct.original_dir.sent_end, + query.ct.original_dir.reply_end, + query.ct.original_dir.max_win, + query.ct.original_dir.max_ack); + printf(" Reply Dir:\n" + " scale: %u, fin: %u, ack seen: %u\n" + " unacked data: %u\n Sent end: %u," + " Reply end: %u, Max win: %u, Max ACK: %u\n", + query.ct.reply_dir.scale, + query.ct.reply_dir.close_initiated, + query.ct.reply_dir.last_ack_seen, + query.ct.reply_dir.data_unacked, + query.ct.reply_dir.sent_end, + query.ct.reply_dir.reply_end, + query.ct.reply_dir.max_win, + query.ct.reply_dir.max_ack); break; default: - printf("Indirect action %u (type: %d) on port %u doesn't" - " support query\n", id, pia->type, port_id); - ret = -1; + printf("Indirect action %u (type: %d) on port %u doesn't support query\n", + id, pia->type, port_id); + break; } - return ret; + return 0; } static struct port_flow_tunnel * -- 2.18.1