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 0FB88A0548; Mon, 26 Apr 2021 14:43:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7765C411C4; Mon, 26 Apr 2021 14:43:25 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2065.outbound.protection.outlook.com [40.107.236.65]) by mails.dpdk.org (Postfix) with ESMTP id A11F4411C4 for ; Mon, 26 Apr 2021 14:43:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jLuuLNhNzHQGsTpK36su45g4N6BqXxO+MklgHcn9Sr/XpfvdVJ/qN6/XHBytMKWfS4NOKHENluUzgQRfXt5yOGoHzNjOUpj2GBrw92hQU2qo2P3FmZB9SQxo6u/oqmBVjfmjq3p8jevVDl+ThWm0wr1yFfPqKRgePUdfUxfGeHTPBL/1rwCBumpXVvWrS2UCvF0u8mRhPMjGM33uiADrUaVOa2IVYZbd0oXY9LiIK551Q2VkZuDBKLTKyXiToSx0cdazwfdi6ew1B83EQ+3ugWEndDINvAOLG0F4V+7HQkJ7NQcIUoBrTwHhBy7hA8An/2XE3FqpShHlNfbesUc+tA== 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=KmPmZXYLMxXsCp6KvhuuAAdY5Z543NPJGxFfzqRVlyA=; b=OgK3s/XVjcLVAKpAICAzRPUkXoeQ9bXBFFVQT9nUmXCn4EoB0FJfRLfO4EqrskXatn5Bswpg/A1tVkkENHlorte57lz0LTOp7Ht52czpI9vN6dGEfNu4zEhviVVJz1+oQMiP85B6rOCWFqlRlqJ9wJKqg6lNOUTS5gUJpZ+8Q6K8jFzBDh9iaYd4HrVM7p6EuPwMHcJhzY27ptOTjnHx7SL7B/ipaCBTINu0WoGRHLPT4k3AlXF566RAbaf09HZHL1Uj+Xyl4Xdbt2nWJp9EHtMv3XJXR72s/q+KvLM2zt32QKEBVOvLec69TrgRZWjmZY0R2zHNt+EGeUwG+r6Zdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org 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=KmPmZXYLMxXsCp6KvhuuAAdY5Z543NPJGxFfzqRVlyA=; b=FdSmKvmqmjq5V8ituGxHrWN+F7vvqHLNaw411GtWdJlNXZC+pxjqB87mHlny2YvH/WJcwsDG1OylRE81/mqrCWkL1GZNOjOTVUpUMtfXgYiSgZ++GoL/IWMPieVUB6UaptfBN3MDk0ZQPj6cNf546fM4gTZqv2CHqujlHrzsURGnWICFDkz+AqbZFd98awKv6jOnvftnwh8bguXx57DQ8Uh8ibCanQ8yp+uvSqqEZSty/tl1lby5GpzUmh9iXO+wTOAWr0iydVe49DEUYn59fzdCHGALAdalKaQA+7VqLN0VT8XnuDu2QhNN/aX8EP1XGyhIf3z51zt9GCF4wJQjwg== Received: from DM6PR02CA0041.namprd02.prod.outlook.com (2603:10b6:5:177::18) by DM5PR12MB1881.namprd12.prod.outlook.com (2603:10b6:3:10f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.23; Mon, 26 Apr 2021 12:43:21 +0000 Received: from DM6NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:5:177:cafe::fa) by DM6PR02CA0041.outlook.office365.com (2603:10b6:5:177::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Mon, 26 Apr 2021 12:43:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 DM6NAM11FT039.mail.protection.outlook.com (10.13.172.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4065.21 via Frontend Transport; Mon, 26 Apr 2021 12:43:21 +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; Mon, 26 Apr 2021 12:43:19 +0000 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko Date: Mon, 26 Apr 2021 15:42:48 +0300 Message-ID: <20210426124250.42771-4-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210426124250.42771-1-michaelba@nvidia.com> References: <20210426124250.42771-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: 5390762f-c7ee-434f-f808-08d908b0dff3 X-MS-TrafficTypeDiagnostic: DM5PR12MB1881: 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: 1zz/1SaLPNvOCln2Cvmgjf5TpHgC81XyhfvxN9AHO2L7tQgmekMV/n0gFwjCYYuVMVZB15J5IhQwgcmjHC8oDlHAjEx/Q78qwSkVtlcX3Q+xNW6MUiij71jXN9BSDWX32Fu93jHW/BQ+Xpgh4tG+ChptpVDgJ5MG64U84hOEgOMNtrxHOA0x292KCZYfV7JQS+/gfZ4zPWP2NrgCpyaJQ30zJ2hWs/X6P4+HM+bcesJza4xEAIGmWJAaCpYDM/+tTQRPV3V4oXYKRngDlMHYPxTroNxRmpXKCRSFqNciKCwSW/GGoGNzYLFDleYjrOOT5cpv2QXfcT0y8aBA2PLI0YCH1KcyVW3J2DKvnsmKa47pP5zzXK3KzZBhzMK5ylqPTua4bEwxlGAzG6h6U915aqES5MHC583d6h91NveaZrh3wOvSoa48fomNADnQePwECJqzk7ZOQ9juxO5vGR/77UlEC4MtbT0BSZ5ZpEK9KTSku+I2y5i1qsfIQ6orO6TaYvrJW+fhGgyXuQtaWNazbRzA6p8evA6TVUmkVKB8E1ctI0PGF/in+s19HY3/rGb9StqZEUIDCHqBcM0V4u1xBMbIigEsM9fmmGSUKSbzYkZ/aky8luXZUW/XIf30ErnzPWFNUjRA7YeMikCH5WSOfG4q8CTbCOY1nql0J1EvreI= 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)(346002)(396003)(136003)(39860400002)(376002)(36840700001)(46966006)(336012)(478600001)(70206006)(6666004)(55016002)(7636003)(8936002)(356005)(36756003)(8676002)(82310400003)(82740400003)(26005)(2906002)(54906003)(86362001)(316002)(1076003)(36906005)(6286002)(6916009)(83380400001)(36860700001)(70586007)(47076005)(107886003)(5660300002)(4326008)(2616005)(7696005)(16526019)(186003)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2021 12:43:21.3090 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5390762f-c7ee-434f-f808-08d908b0dff3 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: DM6NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1881 Subject: [dpdk-dev] [PATCH 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" 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 a9805cc..bedbfcb 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1618,90 +1618,99 @@ struct rte_flow_action_handle * { 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 * -- 1.8.3.1