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 B846F429DC; Mon, 24 Apr 2023 16:30:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5A150427EE; Mon, 24 Apr 2023 16:30:15 +0200 (CEST) Received: from agw.arknetworks.am (agw.arknetworks.am [79.141.165.80]) by mails.dpdk.org (Postfix) with ESMTP id 0AE1C40FAE; Mon, 24 Apr 2023 16:30:14 +0200 (CEST) Received: from localhost.localdomain (unknown [78.109.78.86]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by agw.arknetworks.am (Postfix) with ESMTPSA id 2E068E0EE8; Mon, 24 Apr 2023 18:30:13 +0400 (+04) From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko , Ferruh Yigit , stable@dpdk.org, Andy Moreton , Denis Pryazhennikov Subject: [PATCH 1/2] common/sfc_efx/base: add API to drop MAE action resource IDs Date: Mon, 24 Apr 2023 18:30:45 +0400 Message-Id: <20230424143046.6487-1-ivan.malov@arknetworks.am> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 When the client driver (the DPDK one, for instance) parses user flow actions, it ends up with an action set specification. Next, in case there are any FW resource-backed actions, like COUNT or SET_DST_MAC, the driver allocates these resources and indicates their IDs in the action set specification. The API used to set these IDs checks that the current value of the target ID is INVALID, prior to the call. The latter check, however, prevents the driver from updating the IDs on port restart. When the port goes down, the driver frees the resources. When the port goes up, the driver reallocates them, tries to set the IDs in the specification and fails. In order to address the problem, add an API to drop the current resource IDs in the actions set specification. Fixes: 3907defa5bf0 ("common/sfc_efx/base: support adding encap action to a set") Cc: stable@dpdk.org Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Tested-by: Denis Pryazhennikov --- drivers/common/sfc_efx/base/efx.h | 14 ++++++++++++++ drivers/common/sfc_efx/base/efx_impl.h | 4 ++++ drivers/common/sfc_efx/base/efx_mae.c | 15 +++++++++++---- drivers/common/sfc_efx/version.map | 1 + 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 6028e08eb6..e4a5694ae2 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -4774,6 +4774,20 @@ efx_mae_action_set_fill_in_counter_id( __in efx_mae_actions_t *spec, __in const efx_counter_t *counter_idp); +/* + * Clears dangling FW object IDs (counter ID, for instance) in + * the action set specification. Useful for adapter restarts, + * when all MAE objects need to be reallocated by the driver. + * + * This method only clears the IDs in the specification. + * The driver is still responsible for keeping the IDs + * separately and freeing them when stopping the port. + */ +LIBEFX_API +extern void +efx_mae_action_set_clear_fw_rsrc_ids( + __in efx_mae_actions_t *spec); + /* Action set ID */ typedef struct efx_mae_aset_id_s { uint32_t id; diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index a48d4f6e04..bed4601715 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -1802,6 +1802,10 @@ typedef struct efx_mae_action_vlan_push_s { uint16_t emavp_tci_be; } efx_mae_action_vlan_push_t; +/* + * Helper efx_mae_action_set_clear_fw_rsrc_ids() is responsible + * to initialise every field in this structure to INVALID value. + */ typedef struct efx_mae_actions_rsrc_s { efx_mae_mac_id_t emar_dst_mac_id; efx_mae_mac_id_t emar_src_mac_id; diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c index 7732d99992..4c33471f28 100644 --- a/drivers/common/sfc_efx/base/efx_mae.c +++ b/drivers/common/sfc_efx/base/efx_mae.c @@ -1394,10 +1394,7 @@ efx_mae_action_set_spec_init( goto fail1; } - spec->ema_rsrc.emar_dst_mac_id.id = EFX_MAE_RSRC_ID_INVALID; - spec->ema_rsrc.emar_src_mac_id.id = EFX_MAE_RSRC_ID_INVALID; - spec->ema_rsrc.emar_eh_id.id = EFX_MAE_RSRC_ID_INVALID; - spec->ema_rsrc.emar_counter_id.id = EFX_MAE_RSRC_ID_INVALID; + efx_mae_action_set_clear_fw_rsrc_ids(spec); /* * Helpers which populate v2 actions must reject them when v2 is not @@ -3027,6 +3024,16 @@ efx_mae_action_set_fill_in_counter_id( return (rc); } + void +efx_mae_action_set_clear_fw_rsrc_ids( + __in efx_mae_actions_t *spec) +{ + spec->ema_rsrc.emar_dst_mac_id.id = EFX_MAE_RSRC_ID_INVALID; + spec->ema_rsrc.emar_src_mac_id.id = EFX_MAE_RSRC_ID_INVALID; + spec->ema_rsrc.emar_eh_id.id = EFX_MAE_RSRC_ID_INVALID; + spec->ema_rsrc.emar_counter_id.id = EFX_MAE_RSRC_ID_INVALID; +} + __checkReturn efx_rc_t efx_mae_counters_alloc( __in efx_nic_t *enp, diff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map index d36c3786fc..070de3ba54 100644 --- a/drivers/common/sfc_efx/version.map +++ b/drivers/common/sfc_efx/version.map @@ -90,6 +90,7 @@ INTERNAL { efx_mae_action_rule_insert; efx_mae_action_rule_remove; efx_mae_action_set_alloc; + efx_mae_action_set_clear_fw_rsrc_ids; efx_mae_action_set_fill_in_counter_id; efx_mae_action_set_fill_in_dst_mac_id; efx_mae_action_set_fill_in_eh_id; -- 2.17.1