From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B01CC77B73 for ; Wed, 12 Apr 2023 04:08:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229752AbjDLEId (ORCPT ); Wed, 12 Apr 2023 00:08:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229651AbjDLEIZ (ORCPT ); Wed, 12 Apr 2023 00:08:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D44854ECD for ; Tue, 11 Apr 2023 21:08:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B556262DAE for ; Wed, 12 Apr 2023 04:08:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14609C433EF; Wed, 12 Apr 2023 04:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681272490; bh=vcijwLJLYxksmAzd2HY6o0VW0kdGSFz/N1Mh45n+HNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a5+EZf/xSl9h47H+35JwsfoAIVXksLfHWp/We0YiOZYmtj9VDLMVTLqEXyXf0EYtF OG3c9tAYlXcrvxbVTuscKQ25F8e2aDHZnl8dZSpMtExyWU0tDkqDOe2lQfJWjEVwd7 YPpMq+F35ucp4M5ZM9p8PpvADlRSweN0FMGXgEUfpo/AbO1tf1a+iOVzUQD4KSasES MeavoVbog3bHgu7jKCfMJFjOhnXV8OaCpEk8IxNiWh8TD+3fcLozQ1cHGu18CuYpxR QiYM3lCdjDuscCyLpvtpvUwwt0dWKt7Ohwjq8bFsM7If4ssAZ2Ppx01rlDxSqA4QED hfSjTsmloutWA== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Yevgeny Kliteynik , Alex Vesker Subject: [net-next 11/15] net/mlx5: DR, Set counter ID on the last STE for STEv1 TX Date: Tue, 11 Apr 2023 21:07:48 -0700 Message-Id: <20230412040752.14220-12-saeed@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230412040752.14220-1-saeed@kernel.org> References: <20230412040752.14220-1-saeed@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Yevgeny Kliteynik In STEv1 counter action can be set either by filling counter ID on STE, in which case it is executed before other actions on this STE, or as a single action, in which case it is executed in accordance with the actions order. FW steering on STEv1 devices implements counter as counter ID on STE, and this counter is set on the last STE. Fix SMFS to be consistent with this behaviour - move TX counter to the last STE, this way the counter will include all actions of the previous STEs that might have changed packet headers length, e.g. encap, vlan push, etc. Signed-off-by: Yevgeny Kliteynik Reviewed-by: Alex Vesker Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c index 084145f18084..27cc6931bbde 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c @@ -604,9 +604,6 @@ void dr_ste_v1_set_actions_tx(struct mlx5dr_domain *dmn, allow_modify_hdr = false; } - if (action_type_set[DR_ACTION_TYP_CTR]) - dr_ste_v1_set_counter_id(last_ste, attr->ctr_id); - if (action_type_set[DR_ACTION_TYP_MODIFY_HDR]) { if (!allow_modify_hdr || action_sz < DR_STE_ACTION_DOUBLE_SZ) { dr_ste_v1_arr_init_next_match(&last_ste, added_stes, @@ -724,6 +721,10 @@ void dr_ste_v1_set_actions_tx(struct mlx5dr_domain *dmn, attr->range.max); } + /* set counter ID on the last STE to adhere to DMFS behavior */ + if (action_type_set[DR_ACTION_TYP_CTR]) + dr_ste_v1_set_counter_id(last_ste, attr->ctr_id); + dr_ste_v1_set_hit_gvmi(last_ste, attr->hit_gvmi); dr_ste_v1_set_hit_addr(last_ste, attr->final_icm_addr, 1); } -- 2.39.2