From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CE413A04DD; Tue, 20 Oct 2020 11:27:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 32AD5D013; Tue, 20 Oct 2020 11:14:50 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 87B81C80A for ; Tue, 20 Oct 2020 11:14:11 +0200 (CEST) Received: from mx1-us1.ppe-hosted.com (unknown [10.7.65.61]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 593A460064 for ; Tue, 20 Oct 2020 09:14:11 +0000 (UTC) Received: from us4-mdac16-56.ut7.mdlocal (unknown [10.7.64.50]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 5844D8009E for ; Tue, 20 Oct 2020 09:14:11 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.7.66.41]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id C4CD680052 for ; Tue, 20 Oct 2020 09:14:10 +0000 (UTC) Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 78EF44C0071 for ; Tue, 20 Oct 2020 09:14:10 +0000 (UTC) Received: from ukex01.SolarFlarecom.com (10.17.10.4) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 20 Oct 2020 10:14:00 +0100 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 20 Oct 2020 10:14:00 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id 09K9E0am028418; Tue, 20 Oct 2020 10:14:00 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 46CE51613AB; Tue, 20 Oct 2020 10:14:00 +0100 (BST) From: Andrew Rybchenko To: CC: Ivan Malov Date: Tue, 20 Oct 2020 10:13:07 +0100 Message-ID: <1603185222-14831-28-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1603185222-14831-1-git-send-email-arybchenko@solarflare.com> References: <1603183709-23420-1-git-send-email-arybchenko@solarflare.com> <1603185222-14831-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.6.1012-25736.003 X-TM-AS-Result: No-2.796200-8.000000-10 X-TMASE-MatchedRID: Dii45QCc2NPH5iAYeUHi/ttuAjgC5ilXaeMaKzvXUpljLp8Cm8vwF12O RX0B8+qTT1fsjZmF+qzm9S/0eIQUb+ox2xGkyLxhfJy8LojR0kjr3E41VlKsfSWNjqqHuDcwYX+ IyAfItNG327df8AumkfVfwaij2mkDcj8zE1EjtSTJ1E/nrJFED6LwP+jjbL9KGlfXMQvierdnj1 T6aiJbiTxOxTEbgyTygDLqnrRlXrZ8nn9tnqel2MZW5ai5WKly6A5JxZfWar4OVYgg/wEijrUop RlZNGnwxxjQ24oPSXZfZjHUNbp9+QKViM8Od6AtdUpw8qdCaF3hb3AVhSCVwQpZzc5ufJRN8Oyc cFNBL2TKhETi2//sjuP9Cb59K8ACZrS+A8PszW/U9h9N881NSQ== X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.796200-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25736.003 X-MDID: 1603185251-R4mvpC396F6u X-PPE-DISP: 1603185251;R4mvpC396F6u Subject: [dpdk-dev] [PATCH v2 27/62] common/sfc_efx/base: support adding VLAN PUSH action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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: Ivan Malov MAE supports pushing two tags, so this action can be requested once or twice. Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx.h | 7 ++ drivers/common/sfc_efx/base/efx_impl.h | 12 +++ drivers/common/sfc_efx/base/efx_mae.c | 86 ++++++++++++++++++- .../sfc_efx/rte_common_sfc_efx_version.map | 1 + 4 files changed, 105 insertions(+), 1 deletion(-) diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 17bfc6fdfd..193ffff14c 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -4171,6 +4171,13 @@ extern __checkReturn efx_rc_t efx_mae_action_set_populate_vlan_pop( __in efx_mae_actions_t *spec); +LIBEFX_API +extern __checkReturn efx_rc_t +efx_mae_action_set_populate_vlan_push( + __in efx_mae_actions_t *spec, + __in uint16_t tpid_be, + __in uint16_t tci_be); + LIBEFX_API extern __checkReturn efx_rc_t efx_mae_action_set_populate_deliver( diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index abd7f78cc2..cefbcac93e 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -1702,6 +1702,7 @@ struct efx_mae_match_spec_s { typedef enum efx_mae_action_e { /* These actions are strictly ordered. */ EFX_MAE_ACTION_VLAN_POP, + EFX_MAE_ACTION_VLAN_PUSH, /* DELIVER is always the last action. */ EFX_MAE_ACTION_DELIVER, @@ -1712,11 +1713,22 @@ typedef enum efx_mae_action_e { /* MAE VLAN_POP action can handle 1 or 2 tags. */ #define EFX_MAE_VLAN_POP_MAX_NTAGS (2) +/* MAE VLAN_PUSH action can handle 1 or 2 tags. */ +#define EFX_MAE_VLAN_PUSH_MAX_NTAGS (2) + +typedef struct efx_mae_action_vlan_push_s { + uint16_t emavp_tpid_be; + uint16_t emavp_tci_be; +} efx_mae_action_vlan_push_t; + typedef struct efx_mae_actions_s { /* Bitmap of actions in spec, indexed by action type */ uint32_t emass_actions; unsigned int emass_n_vlan_tags_to_pop; + unsigned int emass_n_vlan_tags_to_push; + efx_mae_action_vlan_push_t emass_vlan_push_descs[ + EFX_MAE_VLAN_PUSH_MAX_NTAGS]; efx_mport_sel_t emass_deliver_mport; } efx_mae_actions_t; diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c index 0465ddf923..b631487645 100644 --- a/drivers/common/sfc_efx/base/efx_mae.c +++ b/drivers/common/sfc_efx/base/efx_mae.c @@ -677,6 +677,44 @@ efx_mae_action_set_add_vlan_pop( return (rc); } +static __checkReturn efx_rc_t +efx_mae_action_set_add_vlan_push( + __in efx_mae_actions_t *spec, + __in size_t arg_size, + __in_bcount(arg_size) const uint8_t *arg) +{ + unsigned int n_tags = spec->emass_n_vlan_tags_to_push; + efx_rc_t rc; + + if (arg_size != sizeof (*spec->emass_vlan_push_descs)) { + rc = EINVAL; + goto fail1; + } + + if (arg == NULL) { + rc = EINVAL; + goto fail2; + } + + if (n_tags == EFX_MAE_VLAN_PUSH_MAX_NTAGS) { + rc = ENOTSUP; + goto fail3; + } + + memcpy(&spec->emass_vlan_push_descs[n_tags], arg, arg_size); + ++(spec->emass_n_vlan_tags_to_push); + + return (0); + +fail3: + EFSYS_PROBE(fail3); +fail2: + EFSYS_PROBE(fail2); +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} + static __checkReturn efx_rc_t efx_mae_action_set_add_deliver( __in efx_mae_actions_t *spec, @@ -716,6 +754,9 @@ static const efx_mae_action_desc_t efx_mae_actions[EFX_MAE_NACTIONS] = { [EFX_MAE_ACTION_VLAN_POP] = { .emad_add = efx_mae_action_set_add_vlan_pop }, + [EFX_MAE_ACTION_VLAN_PUSH] = { + .emad_add = efx_mae_action_set_add_vlan_push + }, [EFX_MAE_ACTION_DELIVER] = { .emad_add = efx_mae_action_set_add_deliver } @@ -723,10 +764,12 @@ static const efx_mae_action_desc_t efx_mae_actions[EFX_MAE_NACTIONS] = { static const uint32_t efx_mae_action_ordered_map = (1U << EFX_MAE_ACTION_VLAN_POP) | + (1U << EFX_MAE_ACTION_VLAN_PUSH) | (1U << EFX_MAE_ACTION_DELIVER); static const uint32_t efx_mae_action_repeat_map = - (1U << EFX_MAE_ACTION_VLAN_POP); + (1U << EFX_MAE_ACTION_VLAN_POP) | + (1U << EFX_MAE_ACTION_VLAN_PUSH); /* * Add an action to an action set. @@ -808,6 +851,22 @@ efx_mae_action_set_populate_vlan_pop( EFX_MAE_ACTION_VLAN_POP, 0, NULL)); } + __checkReturn efx_rc_t +efx_mae_action_set_populate_vlan_push( + __in efx_mae_actions_t *spec, + __in uint16_t tpid_be, + __in uint16_t tci_be) +{ + efx_mae_action_vlan_push_t action; + const uint8_t *arg = (const uint8_t *)&action; + + action.emavp_tpid_be = tpid_be; + action.emavp_tci_be = tci_be; + + return (efx_mae_action_set_spec_populate(spec, + EFX_MAE_ACTION_VLAN_PUSH, sizeof (action), arg)); +} + __checkReturn efx_rc_t efx_mae_action_set_populate_deliver( __in efx_mae_actions_t *spec, @@ -975,6 +1034,31 @@ efx_mae_action_set_alloc( MCDI_IN_SET_DWORD_FIELD(req, MAE_ACTION_SET_ALLOC_IN_FLAGS, MAE_ACTION_SET_ALLOC_IN_VLAN_POP, spec->emass_n_vlan_tags_to_pop); + if (spec->emass_n_vlan_tags_to_push > 0) { + unsigned int outer_tag_idx; + + MCDI_IN_SET_DWORD_FIELD(req, MAE_ACTION_SET_ALLOC_IN_FLAGS, + MAE_ACTION_SET_ALLOC_IN_VLAN_PUSH, + spec->emass_n_vlan_tags_to_push); + + if (spec->emass_n_vlan_tags_to_push == + EFX_MAE_VLAN_PUSH_MAX_NTAGS) { + MCDI_IN_SET_WORD(req, + MAE_ACTION_SET_ALLOC_IN_VLAN1_PROTO_BE, + spec->emass_vlan_push_descs[0].emavp_tpid_be); + MCDI_IN_SET_WORD(req, + MAE_ACTION_SET_ALLOC_IN_VLAN1_TCI_BE, + spec->emass_vlan_push_descs[0].emavp_tci_be); + } + + outer_tag_idx = spec->emass_n_vlan_tags_to_push - 1; + + MCDI_IN_SET_WORD(req, MAE_ACTION_SET_ALLOC_IN_VLAN0_PROTO_BE, + spec->emass_vlan_push_descs[outer_tag_idx].emavp_tpid_be); + MCDI_IN_SET_WORD(req, MAE_ACTION_SET_ALLOC_IN_VLAN0_TCI_BE, + spec->emass_vlan_push_descs[outer_tag_idx].emavp_tci_be); + } + MCDI_IN_SET_DWORD(req, MAE_ACTION_SET_ALLOC_IN_DELIVER, spec->emass_deliver_mport.sel); diff --git a/drivers/common/sfc_efx/rte_common_sfc_efx_version.map b/drivers/common/sfc_efx/rte_common_sfc_efx_version.map index 41c14c6451..be11b6ad3c 100644 --- a/drivers/common/sfc_efx/rte_common_sfc_efx_version.map +++ b/drivers/common/sfc_efx/rte_common_sfc_efx_version.map @@ -91,6 +91,7 @@ INTERNAL { efx_mae_action_set_free; efx_mae_action_set_populate_deliver; efx_mae_action_set_populate_vlan_pop; + efx_mae_action_set_populate_vlan_push; efx_mae_action_set_spec_fini; efx_mae_action_set_spec_init; efx_mae_action_set_specs_equal; -- 2.17.1