Skip to content

Commit cf1e1a8

Browse files
okt-imalovferruhy
authored andcommitted
net/sfc: invalidate dangling MAE flow action FW resource IDs
When reinserting a flow (on port restart, for instance) FW resource IDs found in the action set specification need to be invalidated so that the new (reallocated) FW resource IDs can be accepted by libefx again. Fixes: 1bbd1ec ("net/sfc: support action VXLAN encap in MAE backend") Cc: stable@dpdk.org Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am> Reviewed-by: Andy Moreton <amoreton@xilinx.com> Tested-by: Denis Pryazhennikov <denis.pryazhennikov@arknetworks.am> Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
1 parent 3409e0f commit cf1e1a8

File tree

6 files changed

+33
-4
lines changed

6 files changed

+33
-4
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ Deepak Khandelwal <deepak.khandelwal@intel.com>
301301
Deepak Kumar Jain <deepak.k.jain@intel.com>
302302
Deirdre O'Connor <deirdre.o.connor@intel.com>
303303
Dekel Peled <dekelp@nvidia.com> <dekelp@mellanox.com>
304+
Denis Pryazhennikov <denis.pryazhennikov@arknetworks.am>
304305
Dennis Marinus <dmarinus@amazon.com>
305306
Derek Chickles <derek.chickles@caviumnetworks.com>
306307
Des O Dea <des.j.o.dea@intel.com>

drivers/common/sfc_efx/base/efx.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4748,6 +4748,20 @@ efx_mae_action_set_fill_in_counter_id(
47484748
__in efx_mae_actions_t *spec,
47494749
__in const efx_counter_t *counter_idp);
47504750

4751+
/*
4752+
* Clears dangling FW object IDs (counter ID, for instance) in
4753+
* the action set specification. Useful for adapter restarts,
4754+
* when all MAE objects need to be reallocated by the driver.
4755+
*
4756+
* This method only clears the IDs in the specification.
4757+
* The driver is still responsible for keeping the IDs
4758+
* separately and freeing them when stopping the port.
4759+
*/
4760+
LIBEFX_API
4761+
extern void
4762+
efx_mae_action_set_clear_fw_rsrc_ids(
4763+
__in efx_mae_actions_t *spec);
4764+
47514765
/* Action set ID */
47524766
typedef struct efx_mae_aset_id_s {
47534767
uint32_t id;

drivers/common/sfc_efx/base/efx_impl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,6 +1800,10 @@ typedef struct efx_mae_action_vlan_push_s {
18001800
uint16_t emavp_tci_be;
18011801
} efx_mae_action_vlan_push_t;
18021802

1803+
/*
1804+
* Helper efx_mae_action_set_clear_fw_rsrc_ids() is responsible
1805+
* to initialise every field in this structure to INVALID value.
1806+
*/
18031807
typedef struct efx_mae_actions_rsrc_s {
18041808
efx_mae_mac_id_t emar_dst_mac_id;
18051809
efx_mae_mac_id_t emar_src_mac_id;

drivers/common/sfc_efx/base/efx_mae.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,10 +1394,7 @@ efx_mae_action_set_spec_init(
13941394
goto fail1;
13951395
}
13961396

1397-
spec->ema_rsrc.emar_dst_mac_id.id = EFX_MAE_RSRC_ID_INVALID;
1398-
spec->ema_rsrc.emar_src_mac_id.id = EFX_MAE_RSRC_ID_INVALID;
1399-
spec->ema_rsrc.emar_eh_id.id = EFX_MAE_RSRC_ID_INVALID;
1400-
spec->ema_rsrc.emar_counter_id.id = EFX_MAE_RSRC_ID_INVALID;
1397+
efx_mae_action_set_clear_fw_rsrc_ids(spec);
14011398

14021399
/*
14031400
* Helpers which populate v2 actions must reject them when v2 is not
@@ -3027,6 +3024,16 @@ efx_mae_action_set_fill_in_counter_id(
30273024
return (rc);
30283025
}
30293026

3027+
void
3028+
efx_mae_action_set_clear_fw_rsrc_ids(
3029+
__in efx_mae_actions_t *spec)
3030+
{
3031+
spec->ema_rsrc.emar_dst_mac_id.id = EFX_MAE_RSRC_ID_INVALID;
3032+
spec->ema_rsrc.emar_src_mac_id.id = EFX_MAE_RSRC_ID_INVALID;
3033+
spec->ema_rsrc.emar_eh_id.id = EFX_MAE_RSRC_ID_INVALID;
3034+
spec->ema_rsrc.emar_counter_id.id = EFX_MAE_RSRC_ID_INVALID;
3035+
}
3036+
30303037
__checkReturn efx_rc_t
30313038
efx_mae_counters_alloc(
30323039
__in efx_nic_t *enp,

drivers/common/sfc_efx/version.map

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ INTERNAL {
8989
efx_mae_action_rule_insert;
9090
efx_mae_action_rule_remove;
9191
efx_mae_action_set_alloc;
92+
efx_mae_action_set_clear_fw_rsrc_ids;
9293
efx_mae_action_set_fill_in_counter_id;
9394
efx_mae_action_set_fill_in_dst_mac_id;
9495
efx_mae_action_set_fill_in_eh_id;

drivers/net/sfc/sfc_mae.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,8 @@ sfc_mae_action_set_disable(struct sfc_adapter *sa,
11801180
}
11811181

11821182
if (fw_rsrc->refcnt == 1) {
1183+
efx_mae_action_set_clear_fw_rsrc_ids(action_set->spec);
1184+
11831185
rc = efx_mae_action_set_free(sa->nic, &fw_rsrc->aset_id);
11841186
if (rc == 0) {
11851187
sfc_dbg(sa, "disabled action_set=%p with AS_ID=0x%08x",

0 commit comments

Comments
 (0)