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 5485743745 for ; Tue, 19 Dec 2023 14:11:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 16EB8402DE; Tue, 19 Dec 2023 14:11:17 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2064.outbound.protection.outlook.com [40.107.223.64]) by mails.dpdk.org (Postfix) with ESMTP id DCE2640283 for ; Tue, 19 Dec 2023 14:11:15 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gfQxjNcsN+Z3M2hDxzSm8eb9QzAb1qg6qvH3l2UzJxsrXGy83fKAzpNHNcrrk875AZr7SqmEu6Y6e/yAbjmMOeVnmTcHL53Y1gdNiOhCGC9xCrBrDVO/MoVg5rQ3RneK86sVZ0pQcXtNoUv3jRGi4TeNSQqsLuW3uLjtWA91y1sVB0sfAc/0FyzQbJl/Te9wyAd4TwB5o67XOADlT3utD8gfHhyNGY+9Wf4w16xQ4XoeDQW0F/TBfINtHLxSh/EzAj6Y6WhoNKpw148uR+3+dWvi1SoHoR1Y/UI5U2MyBPE5dgiwx0dRRdDziPq2SCeWfN+7fqyA5t3yBbutlKIDNg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3YCYCLWmJWBpFPov+RYo1XxC1tbmQReRUP4h0E7oTYU=; b=oPppbBWBoCTz8swsDSPyJnf2ejDeJP9u+3WXTij/vmINkhXcUiwHeNhMPRRKGGexgfqKNtiLgzbMXJYYORZYgQ7pmSiXyuEyesq58u0dpbD5H5TKMkuz2wqqYfNUXIWafBeAXYb4NgAjZ+95NOjc9xs+B+oo2tG14/CFGyiR82hO2l0b62SVPUwBU1gQUM8GIFunrY6XtkjkJsHSCHti2SCGkE0RBYOnCjZBB1ZotOvUUw5vsWt3dUrGvqhOhm2skMq1I6olg0av0VpAtsOewxFB+P2fkhgo12sWycdFlTLEIhAn539hijQE3hTCUcSA8oQtxBV3F9E6uMrrGYbXBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; 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=3YCYCLWmJWBpFPov+RYo1XxC1tbmQReRUP4h0E7oTYU=; b=VkRRDbBfoqATwIZqLWjIPgE5pBAT2mlnxZdo+qp1LHw+dvyxw5rUb9kLRUEmZNrWLRgcBrYdIRZ2aJgR765HnShR7iGsBeQputGVQptPYIpAa1/9m/WFCaQ4+lffDgoPhYORpbWrLBtV6Xiray2lGXuMU/GjJZwq8o0Bh6Xra5MJnDujN0H3wQiH1UG7/ln89N7Kl6Gfg8LadBQEdXZi7HGVXdcugWpt6eC0V+urmfUVrfeabe6n4bmfCDBwFfJjxtPifjaXwucw43P4FcTwZfckiheQcNLd/sXdVqIwp+osNYAu7o/Oy0MLuNpb5o+BBUdHSA0IcHpKbGx//aDG7Q== Received: from DM4PR12MB5373.namprd12.prod.outlook.com (2603:10b6:5:39d::14) by MN2PR12MB4455.namprd12.prod.outlook.com (2603:10b6:208:265::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.18; Tue, 19 Dec 2023 13:11:13 +0000 Received: from DM4PR12MB5373.namprd12.prod.outlook.com ([fe80::6e12:5648:d8f4:ab2d]) by DM4PR12MB5373.namprd12.prod.outlook.com ([fe80::6e12:5648:d8f4:ab2d%4]) with mapi id 15.20.7091.034; Tue, 19 Dec 2023 13:11:12 +0000 From: "Xueming(Steven) Li" To: Bing Zhao CC: "stable@dpdk.org" , Suanming Mou Subject: RE: [PATCH 22.11] net/mlx5: fix LACP redirection in Rx domain Thread-Topic: [PATCH 22.11] net/mlx5: fix LACP redirection in Rx domain Thread-Index: AQHaMZORd6vPf2PrsEaJuF/p+gsvNLCwllxA Date: Tue, 19 Dec 2023 13:11:12 +0000 Message-ID: References: <20231218092047.437188-1-bingz@nvidia.com> In-Reply-To: <20231218092047.437188-1-bingz@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM4PR12MB5373:EE_|MN2PR12MB4455:EE_ x-ms-office365-filtering-correlation-id: 90f3d4f9-2cf9-4435-8ad6-08dc0093f9b3 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: BkXWLz8WrQmzlOGSq1HC+NkklbTYUh7gnqpuAf035g3R7e9o4gN7wVqIlzZRoFiX8fi5S+MRDePACqU2IU4V/zjwl8GAgs7q9D/Hz5d8I/E62fkO5wQ6/JoyvyGk9Hh0QmTEQNKb3FjAr1cghB8feJZXvM9W5XpbMOn3d6KP7VK7mNmuufCuFxyXCwNfCMhiohfMwhJDn363mG7IRQduJpZl/SPo+I0Wy5rJQV/w/REZm3/+K8wSU1XUjPVW7t9vd6ZIusbF2i4qO6YkWN0MPsLlXrerQOiel6sTwBIYN+CTzUkPzOHW3kuGDl+Y0REfs9IyAZrjevToDv7lv27XXRXfzs3dfJFdRiMxBfjkSO/T8ItgLGVTreCMjguyiCSppsIi3TcFtNgbzRrHc6k46lGgyTUMctqO7+kwcPLup2AIh1JaMecgNSRL9G8smlsNphDXBENaUXFGarQwyV6CrsnVVlGkm7UA8e9YW3Ty5VdAP8oupz3wZpLFj/+oOIWuibr+Fk/5T96pL4OmEqY2GfyrG03h0K4ULGJWYCG1L+lDPbnhy0edA2WXzR/dkQQV1SSogK51IAYwO6gCPkTHzmv92qr6riGESYweVyDBqeJS6V+0Zw+8ucIYc/oTFuXb1FBbySF+7AsbU9H+jD05B9Qx9JZRpydeKqY++KlMzM8= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5373.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(39860400002)(136003)(376002)(396003)(346002)(230922051799003)(230273577357003)(230173577357003)(64100799003)(186009)(451199024)(1800799012)(52536014)(6862004)(4326008)(107886003)(8676002)(316002)(8936002)(30864003)(41300700001)(33656002)(2906002)(83380400001)(38070700009)(26005)(5660300002)(55016003)(86362001)(38100700002)(7696005)(122000001)(478600001)(53546011)(6506007)(71200400001)(6636002)(54906003)(66476007)(64756008)(9686003)(66446008)(66556008)(76116006)(66946007)(579004); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?pAaSW0RTxUcOIvymSj5c5/O3Kabc0hgFGBkc3prshYh73cixZk9F0LV9rg8L?= =?us-ascii?Q?hhnsZwZHJjtrGp7+0TZS7qmEPE4SkX36vVsEogdA0Dp8zNHRL3/d72ReqOOn?= =?us-ascii?Q?Foz6uYawxQBSZ9wbPrRcodeXHoJrJxU3erMmrqUnpYBfR9SUgRuE6qNiW449?= =?us-ascii?Q?0Gj9NscnH/qvJion99yb2S9dWM3xFJmGL/Rvu4Y7opL0O0yjv5mw/8uhEoGG?= =?us-ascii?Q?0RPsOL73uUYnoXWr6wByhFLbOaeJra3wUzMenzFxScMT9HAhGKUROI7psxtj?= =?us-ascii?Q?2b88wpNHfQFew7nw7UarcUyXXzY28bOzTvka2JxyIxpqtJit/jlVSL1Ahi+s?= =?us-ascii?Q?srARZlhWvk5lo0uRFTe1tvsDN64TjoQBylO0j8dECMP2UCuI2Zisp8+x+PVf?= =?us-ascii?Q?13jezlONq6xJIaENIqD8GSJ+XPBf4AOXjLi7GBqBSxzWVXaAV5CAoBbFuXC/?= =?us-ascii?Q?qv+svdrWYiEr694B0aCB9BCn3Lzl4YZ+HcNfBxebvwkVkF6EIYZ47lEYY9kZ?= =?us-ascii?Q?3S8CeoPk1vaYpEpmR9OKmNvmsIfyJV5wu7pNJLOHv8LQiia3bC73h8zs73V9?= =?us-ascii?Q?ZEwLYPp/f6Ctw21dfTXwvHIVC3oCDaCOl9zx0zsYqFfIBhcFpyQVDN4Mts7A?= =?us-ascii?Q?zQumqj7nQnBPKtYVFOBCeEQeLSm6vH4JBcgNIT+z/BlI5r7/8K7JnVP8Grx2?= =?us-ascii?Q?yz2wNS7PWr0WAUwy4fL7ArVJlaGzmJi+XZ6vcixgT/9Tqp0J6ciLoE0U9WIP?= =?us-ascii?Q?3DMUDBH2jyJ+i3gY+Ewbac64EsmnVzPacld7+p/owk64CTTHxZatv7QPZbeo?= =?us-ascii?Q?fu7zdbpcO0OpSRe7aB+u1xMRuNqRxa2wdbtbyBGgaqKz21S9oGxsZheTYxp7?= =?us-ascii?Q?u/wVpTEfJZMxl/r5GMAFoN8p5AO8s7YeowlDvdvpnxbjUIciM3n46VKAe4F/?= =?us-ascii?Q?ryWLY5HCByDv5Zu5wmCrGBWop+SuuW1XASauOZUcLZSEyGMjTQnZ7N8VaLCc?= =?us-ascii?Q?y47uB2PLap9VpMb4CQkqdQeQMS5SQwYJW/JFKOurmsWqinSN6kCR4t8q74/J?= =?us-ascii?Q?r9w6vzs7nfouOulRiI6tNTK8jfygQKwvJBsuBDZCjcnDAThvkuocCF/tHAvR?= =?us-ascii?Q?mYLbemXwp+HFFtQdc7HHWIgtD9VCG4aR+ZD5Vaevcly/h9h+LBArJnc830Vx?= =?us-ascii?Q?8LPbPKLBMpS9O7o5ME4jBVsgEs5PXtON88L0/QVtj3O1XxEgVvn72EaQUSkf?= =?us-ascii?Q?vNcPdMba4bse9t3EcQkKJh+vGTlj/QpjdF9HKdl08qWUfhlKlyCRyWGXxgWR?= =?us-ascii?Q?IOVr6eJC0/y47gGuguHuciRgy+/8X5B8TzhNRbZiRySMdIFfVsJFLnwzayfE?= =?us-ascii?Q?uRryAG6ly1ZpwEPV5nWm+Rlh3IRkYcOK/nQe5HOjlT+v0SIZq8lhuDdFKAXT?= =?us-ascii?Q?+2FgE3I0nwVrPnDlPUTGe5qSE5RwkyaaXRPUGH5xr/PXBWncxfURK92NOovH?= =?us-ascii?Q?TOueaRtdIHqMEvEAIG36exhLF3+frM/psZy9ptoAvmTKm2IN5MAQmyliTd89?= =?us-ascii?Q?FZt/SQwpqVh19thorRN7oWewseeJIlGvvoS66paI?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90f3d4f9-2cf9-4435-8ad6-08dc0093f9b3 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Dec 2023 13:11:12.9098 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0zIffPUx77UXG9vNQGBSjIHPJDPm1EEh3SFFZPeLWrgynoTGfrfXUbcx4GcCeldJIsG3SI70lMzuD24nYMyPeQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4455 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi Bing, Applied to 22.11 LTS branch, thanks for the backporting! > -----Original Message----- > From: Bing Zhao > Sent: 12/18/2023 17:21 > To: Xueming(Steven) Li > Cc: stable@dpdk.org; Suanming Mou > Subject: [PATCH 22.11] net/mlx5: fix LACP redirection in Rx domain >=20 > [ upstream commit 49dffadf4b0c4ad1292ffc877b33109cd35ffce4 ] >=20 > When the "lacp_by_user" is not set from the application in bond mode, the= LACP > traffic should be handled by the kernel driver by default. >=20 > This commit adds the missing support in the template API when "dv_flow_en= =3D2". > The behavior will be the same as that in the DV mode with "dv_flow_en=3D1= ". The > LACP packets will be redirected to the kernel when starting the steering = in the > NIC Rx domain. >=20 > With this commit, the DEFAULT_MISS action usage is refactored a bit. > In the HWS, one unique action can be created with supported bits set in t= he "flag" > per port. The *ROOT_FDB and *HWS_FDB flag bits will only be set when the = port > is in switchdev mode and working as the E-Switch manager proxy port. The = SF/VF > and all other representors won't have the FDB flag bits when creating the > DEFAULT_MISS action. >=20 > Fixes: 9fa7c1cddb85 ("net/mlx5: create control flow rules with HWS") > Cc: stable@dpdk.org >=20 > Signed-off-by: Bing Zhao > Acked-by: Suanming Mou > --- > drivers/net/mlx5/linux/mlx5_os.c | 8 +- > drivers/net/mlx5/mlx5.h | 3 + > drivers/net/mlx5/mlx5_flow.h | 1 + > drivers/net/mlx5/mlx5_flow_hw.c | 247 ++++++++++++++++++++++++++++++- > drivers/net/mlx5/mlx5_trigger.c | 3 + > 5 files changed, 253 insertions(+), 9 deletions(-) >=20 > diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/ml= x5_os.c > index 438b832a40..28bf7211e4 100644 > --- a/drivers/net/mlx5/linux/mlx5_os.c > +++ b/drivers/net/mlx5/linux/mlx5_os.c > @@ -474,6 +474,10 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv) > err =3D mlx5_alloc_table_hash_list(priv); > if (err) > goto error; > + sh->default_miss_action =3D > + mlx5_glue->dr_create_flow_action_default_miss(); > + if (!sh->default_miss_action) > + DRV_LOG(WARNING, "Default miss action is not supported."); > if (priv->sh->config.dv_flow_en =3D=3D 2) > return 0; > /* The resources below are only valid with DV support. */ @@ -597,10 > +601,6 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv) >=20 > __mlx5_discovery_misc5_cap(priv); > #endif /* HAVE_MLX5DV_DR */ > - sh->default_miss_action =3D > - mlx5_glue->dr_create_flow_action_default_miss(); > - if (!sh->default_miss_action) > - DRV_LOG(WARNING, "Default miss action is not supported."); > LIST_INIT(&sh->shared_rxqs); > return 0; > error: > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index > ba7c4441e5..96a269ccd0 100644 > --- a/drivers/net/mlx5/mlx5.h > +++ b/drivers/net/mlx5/mlx5.h > @@ -1735,6 +1735,7 @@ struct mlx5_priv { > struct rte_flow_template_table *hw_esw_sq_miss_tbl; > struct rte_flow_template_table *hw_esw_zero_tbl; > struct rte_flow_template_table *hw_tx_meta_cpy_tbl; > + struct rte_flow_template_table *hw_lacp_rx_tbl; > struct rte_flow_pattern_template *hw_tx_repr_tagging_pt; > struct rte_flow_actions_template *hw_tx_repr_tagging_at; > struct rte_flow_template_table *hw_tx_repr_tagging_tbl; @@ -1814,6 > +1815,8 @@ struct mlx5_priv { > struct mlx5dr_action *hw_drop[2]; > /* HW steering global tag action. */ > struct mlx5dr_action *hw_tag[2]; > + /* HW steering global default miss action. */ > + struct mlx5dr_action *hw_def_miss; > /* HW steering create ongoing rte flow table list header. */ > LIST_HEAD(flow_hw_tbl_ongo, rte_flow_template_table) > flow_hw_tbl_ongo; > struct mlx5_indexed_pool *acts_ipool; /* Action data indexed pool. */ > diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h = index > 1192735750..eb87f84166 100644 > --- a/drivers/net/mlx5/mlx5_flow.h > +++ b/drivers/net/mlx5/mlx5_flow.h > @@ -2587,6 +2587,7 @@ int mlx5_flow_hw_esw_destroy_sq_miss_flow(struct > rte_eth_dev *dev, int mlx5_flow_hw_esw_create_default_jump_flow(struct > rte_eth_dev *dev); int > mlx5_flow_hw_create_tx_default_mreg_copy_flow(struct rte_eth_dev *dev); > int mlx5_flow_hw_tx_repr_matching_flow(struct rte_eth_dev *dev, uint32_t = sqn, > bool external); > +int mlx5_flow_hw_lacp_rx_flow(struct rte_eth_dev *dev); > int mlx5_flow_actions_validate(struct rte_eth_dev *dev, > const struct rte_flow_actions_template_attr *attr, > const struct rte_flow_action actions[], diff --git > a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index > 28d0bbecc4..6b889e9f81 100644 > --- a/drivers/net/mlx5/mlx5_flow_hw.c > +++ b/drivers/net/mlx5/mlx5_flow_hw.c > @@ -1363,7 +1363,7 @@ __flow_hw_actions_translate(struct rte_eth_dev > *dev, > else > type =3D MLX5DR_TABLE_TYPE_NIC_RX; > for (; !actions_end; actions++, masks++) { > - switch (actions->type) { > + switch ((int)actions->type) { > case RTE_FLOW_ACTION_TYPE_INDIRECT: > action_pos =3D at->actions_off[actions - at->actions]; > if (!attr->group) { > @@ -1667,6 +1667,16 @@ __flow_hw_actions_translate(struct rte_eth_dev > *dev, > action_pos)) > goto err; > break; > + case MLX5_RTE_FLOW_ACTION_TYPE_DEFAULT_MISS: > + /* Internal, can be skipped. */ > + if (!!attr->group) { > + DRV_LOG(ERR, "DEFAULT MISS action is only" > + " supported in root table."); > + goto err; > + } > + action_pos =3D at->actions_off[actions - at->actions]; > + acts->rule_acts[action_pos].action =3D priv- > >hw_def_miss; > + break; > case RTE_FLOW_ACTION_TYPE_END: > actions_end =3D true; > break; > @@ -3869,6 +3879,34 @@ flow_hw_validate_action_push_vlan(struct > rte_eth_dev *dev, #undef X_FIELD } >=20 > +static int > +flow_hw_validate_action_default_miss(struct rte_eth_dev *dev, > + const struct rte_flow_actions_template_attr > *attr, > + uint64_t action_flags, > + struct rte_flow_error *error) > +{ > + /* > + * The private DEFAULT_MISS action is used internally for LACP in contr= ol > + * flows. So this validation can be ignored. It can be kept right now s= ince > + * the validation will be done only once. > + */ > + struct mlx5_priv *priv =3D dev->data->dev_private; > + > + if (!attr->ingress || attr->egress || attr->transfer) > + return rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > + "DEFAULT MISS is only supported in > ingress."); > + if (!priv->hw_def_miss) > + return rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > + "DEFAULT MISS action does not > exist."); > + if (action_flags & MLX5_FLOW_FATE_ACTIONS) > + return rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > + "DEFAULT MISS should be the only > termination."); > + return 0; > +} > + > static int > mlx5_flow_hw_actions_validate(struct rte_eth_dev *dev, > const struct rte_flow_actions_template_attr *attr, > @@ -3902,7 +3940,7 @@ mlx5_flow_hw_actions_validate(struct rte_eth_dev > *dev, >=20 > RTE_FLOW_ERROR_TYPE_ACTION, > action, > "mask type does not match > action type"); > - switch (action->type) { > + switch ((int)action->type) { > case RTE_FLOW_ACTION_TYPE_VOID: > break; > case RTE_FLOW_ACTION_TYPE_INDIRECT: > @@ -4028,6 +4066,13 @@ mlx5_flow_hw_actions_validate(struct rte_eth_dev > *dev, > case RTE_FLOW_ACTION_TYPE_END: > actions_end =3D true; > break; > + case MLX5_RTE_FLOW_ACTION_TYPE_DEFAULT_MISS: > + ret =3D flow_hw_validate_action_default_miss(dev, attr, > + action_flags, > error); > + if (ret < 0) > + return ret; > + action_flags |=3D MLX5_FLOW_ACTION_DEFAULT_MISS; > + break; > default: > return rte_flow_error_set(error, ENOTSUP, >=20 > RTE_FLOW_ERROR_TYPE_ACTION, > @@ -4047,8 +4092,7 @@ flow_hw_actions_validate(struct rte_eth_dev *dev, > const struct rte_flow_action masks[], > struct rte_flow_error *error) > { > - return mlx5_flow_hw_actions_validate(dev, attr, actions, masks, NULL, > - error); > + return mlx5_flow_hw_actions_validate(dev, attr, actions, masks, NULL, > +error); > } >=20 >=20 > @@ -4149,7 +4193,7 @@ flow_hw_dr_actions_template_create(struct > rte_flow_actions_template *at) >=20 > if (curr_off >=3D MLX5_HW_MAX_ACTS) > goto err_actions_num; > - switch (at->actions[i].type) { > + switch ((int)at->actions[i].type) { > case RTE_FLOW_ACTION_TYPE_VOID: > break; > case RTE_FLOW_ACTION_TYPE_INDIRECT: > @@ -4227,6 +4271,10 @@ flow_hw_dr_actions_template_create(struct > rte_flow_actions_template *at) > } > at->actions_off[i] =3D cnt_off; > break; > + case MLX5_RTE_FLOW_ACTION_TYPE_DEFAULT_MISS: > + at->actions_off[i] =3D curr_off; > + action_types[curr_off++] =3D > MLX5DR_ACTION_TYP_MISS; > + break; > default: > type =3D mlx5_hw_dr_action_types[at->actions[i].type]; > at->actions_off[i] =3D curr_off; > @@ -5747,6 +5795,42 @@ > flow_hw_create_tx_default_mreg_copy_pattern_template(struct rte_eth_dev > *dev, > return flow_hw_pattern_template_create(dev, &tx_pa_attr, eth_all, > error); } >=20 > +/* > + * Creating a flow pattern template with all LACP packets matching, > +only for NIC > + * ingress domain. > + * > + * @param dev > + * Pointer to Ethernet device. > + * @param error > + * Pointer to error structure. > + * > + * @return > + * Pointer to flow pattern template on success, NULL otherwise. > + */ > +static struct rte_flow_pattern_template * > +flow_hw_create_lacp_rx_pattern_template(struct rte_eth_dev *dev, struct > +rte_flow_error *error) { > + struct rte_flow_pattern_template_attr pa_attr =3D { > + .relaxed_matching =3D 0, > + .ingress =3D 1, > + }; > + struct rte_flow_item_eth lacp_mask =3D { > + .dst.addr_bytes =3D "\x00\x00\x00\x00\x00\x00", > + .src.addr_bytes =3D "\x00\x00\x00\x00\x00\x00", > + .type =3D 0xFFFF, > + }; > + struct rte_flow_item eth_all[] =3D { > + [0] =3D { > + .type =3D RTE_FLOW_ITEM_TYPE_ETH, > + .mask =3D &lacp_mask, > + }, > + [1] =3D { > + .type =3D RTE_FLOW_ITEM_TYPE_END, > + }, > + }; > + return flow_hw_pattern_template_create(dev, &pa_attr, eth_all, error); > +} > + > /** > * Creates a flow actions template with modify field action and masked j= ump > action. > * Modify field action sets the least significant bit of REG_C_0 (usable= by user- > space) @@ -6013,6 +6097,38 @@ > flow_hw_create_tx_default_mreg_copy_actions_template(struct rte_eth_dev > *dev, > masks, error); > } >=20 > +/* > + * Creating an actions template to use default miss to re-route packets > +to the > + * kernel driver stack. > + * On root table, only DEFAULT_MISS action can be used. > + * > + * @param dev > + * Pointer to Ethernet device. > + * @param error > + * Pointer to error structure. > + * > + * @return > + * Pointer to flow actions template on success, NULL otherwise. > + */ > +static struct rte_flow_actions_template * > +flow_hw_create_lacp_rx_actions_template(struct rte_eth_dev *dev, struct > +rte_flow_error *error) { > + struct rte_flow_actions_template_attr act_attr =3D { > + .ingress =3D 1, > + }; > + const struct rte_flow_action actions[] =3D { > + [0] =3D { > + .type =3D (enum rte_flow_action_type) > + > MLX5_RTE_FLOW_ACTION_TYPE_DEFAULT_MISS, > + }, > + [1] =3D { > + .type =3D RTE_FLOW_ACTION_TYPE_END, > + }, > + }; > + > + return flow_hw_actions_template_create(dev, &act_attr, actions, > +actions, error); } > + > /** > * Creates a control flow table used to transfer traffic from E-Switch M= anager > * and TX queues from group 0 to group 1. > @@ -6171,6 +6287,43 @@ flow_hw_create_ctrl_jump_table(struct rte_eth_dev > *dev, > return flow_hw_table_create(dev, &cfg, &it, 1, &at, 1, error); } >=20 > +/* > + * Create a table on the root group to for the LACP traffic redirecting. > + * > + * @param dev > + * Pointer to Ethernet device. > + * @param it > + * Pointer to flow pattern template. > + * @param at > + * Pointer to flow actions template. > + * > + * @return > + * Pointer to flow table on success, NULL otherwise. > + */ > +static struct rte_flow_template_table * > +flow_hw_create_lacp_rx_table(struct rte_eth_dev *dev, > + struct rte_flow_pattern_template *it, > + struct rte_flow_actions_template *at, > + struct rte_flow_error *error) > +{ > + struct rte_flow_template_table_attr attr =3D { > + .flow_attr =3D { > + .group =3D 0, > + .priority =3D 0, > + .ingress =3D 1, > + .egress =3D 0, > + .transfer =3D 0, > + }, > + .nb_flows =3D 1, > + }; > + struct mlx5_flow_template_table_cfg cfg =3D { > + .attr =3D attr, > + .external =3D false, > + }; > + > + return flow_hw_table_create(dev, &cfg, &it, 1, &at, 1, error); } > + > /** > * Creates a set of flow tables used to create control flows used > * when E-Switch is engaged. > @@ -6191,10 +6344,12 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev > *dev, struct rte_flow_error *error > struct rte_flow_pattern_template *regc_sq_items_tmpl =3D NULL; > struct rte_flow_pattern_template *port_items_tmpl =3D NULL; > struct rte_flow_pattern_template *tx_meta_items_tmpl =3D NULL; > + struct rte_flow_pattern_template *lacp_rx_items_tmpl =3D NULL; > struct rte_flow_actions_template *regc_jump_actions_tmpl =3D NULL; > struct rte_flow_actions_template *port_actions_tmpl =3D NULL; > struct rte_flow_actions_template *jump_one_actions_tmpl =3D NULL; > struct rte_flow_actions_template *tx_meta_actions_tmpl =3D NULL; > + struct rte_flow_actions_template *lacp_rx_actions_tmpl =3D NULL; > uint32_t xmeta =3D priv->sh->config.dv_xmeta_en; > uint32_t repr_matching =3D priv->sh->config.repr_matching; > int ret; > @@ -6290,6 +6445,28 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev *dev= , > struct rte_flow_error *error > goto err; > } > } > + /* Create LACP default miss table. */ > + if (!priv->sh->config.lacp_by_user && priv->pf_bond >=3D 0) { > + lacp_rx_items_tmpl =3D > flow_hw_create_lacp_rx_pattern_template(dev, error); > + if (!lacp_rx_items_tmpl) { > + DRV_LOG(ERR, "port %u failed to create pattern > template" > + " for LACP Rx traffic", dev->data->port_id); > + goto err; > + } > + lacp_rx_actions_tmpl =3D > flow_hw_create_lacp_rx_actions_template(dev, error); > + if (!lacp_rx_actions_tmpl) { > + DRV_LOG(ERR, "port %u failed to create actions > template" > + " for LACP Rx traffic", dev->data->port_id); > + goto err; > + } > + priv->hw_lacp_rx_tbl =3D flow_hw_create_lacp_rx_table(dev, > lacp_rx_items_tmpl, > + > lacp_rx_actions_tmpl, error); > + if (!priv->hw_lacp_rx_tbl) { > + DRV_LOG(ERR, "port %u failed to create template table > for" > + " for LACP Rx traffic", dev->data->port_id); > + goto err; > + } > + } > return 0; > err: > /* Do not overwrite the rte_errno. */ > @@ -6298,6 +6475,10 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev *dev= , > struct rte_flow_error *error > ret =3D rte_flow_error_set(error, EINVAL, >=20 > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, > "Failed to create control tables."); > + if (priv->hw_tx_meta_cpy_tbl) { > + flow_hw_table_destroy(dev, priv->hw_tx_meta_cpy_tbl, NULL); > + priv->hw_tx_meta_cpy_tbl =3D NULL; > + } > if (priv->hw_esw_zero_tbl) { > flow_hw_table_destroy(dev, priv->hw_esw_zero_tbl, NULL); > priv->hw_esw_zero_tbl =3D NULL; > @@ -6310,6 +6491,8 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev *dev, > struct rte_flow_error *error > flow_hw_table_destroy(dev, priv->hw_esw_sq_miss_root_tbl, > NULL); > priv->hw_esw_sq_miss_root_tbl =3D NULL; > } > + if (lacp_rx_actions_tmpl) > + flow_hw_actions_template_destroy(dev, lacp_rx_actions_tmpl, > NULL); > if (tx_meta_actions_tmpl) > flow_hw_actions_template_destroy(dev, tx_meta_actions_tmpl, > NULL); > if (jump_one_actions_tmpl) > @@ -6318,6 +6501,8 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev *dev, > struct rte_flow_error *error > flow_hw_actions_template_destroy(dev, port_actions_tmpl, > NULL); > if (regc_jump_actions_tmpl) > flow_hw_actions_template_destroy(dev, > regc_jump_actions_tmpl, NULL); > + if (lacp_rx_items_tmpl) > + flow_hw_pattern_template_destroy(dev, lacp_rx_items_tmpl, > NULL); > if (tx_meta_items_tmpl) > flow_hw_pattern_template_destroy(dev, tx_meta_items_tmpl, > NULL); > if (port_items_tmpl) > @@ -6881,6 +7066,7 @@ flow_hw_configure(struct rte_eth_dev *dev, > struct rte_flow_queue_attr ctrl_queue_attr =3D {0}; > bool is_proxy =3D !!(priv->sh->config.dv_esw_en && priv->master); > int ret =3D 0; > + uint32_t action_flags; >=20 > if (!port_attr || !nb_queue || !queue_attr) { > rte_errno =3D EINVAL; > @@ -7030,6 +7216,20 @@ flow_hw_configure(struct rte_eth_dev *dev, > if (ret) > goto err; > } > + /* > + * DEFAULT_MISS action have different behaviors in different domains. > + * In FDB, it will steering the packets to the E-switch manager. > + * In NIC Rx root, it will steering the packet to the kernel driver sta= ck. > + * An action with all bits set in the flag can be created and the HWS > + * layer will translate it properly when being used in different rules. > + */ > + action_flags =3D MLX5DR_ACTION_FLAG_ROOT_RX | > MLX5DR_ACTION_FLAG_HWS_RX | > + MLX5DR_ACTION_FLAG_ROOT_TX | > MLX5DR_ACTION_FLAG_HWS_TX; > + if (is_proxy) > + action_flags |=3D (MLX5DR_ACTION_FLAG_ROOT_FDB | > MLX5DR_ACTION_FLAG_HWS_FDB); > + priv->hw_def_miss =3D mlx5dr_action_create_default_miss(priv->dr_ctx, > action_flags); > + if (!priv->hw_def_miss) > + goto err; > if (is_proxy) { > ret =3D flow_hw_create_vport_actions(priv); > if (ret) { > @@ -9052,6 +9252,43 @@ mlx5_flow_hw_tx_repr_matching_flow(struct > rte_eth_dev *dev, uint32_t sqn, bool e > items, 0, actions, 0, &flow_info, > external); } >=20 > +int > +mlx5_flow_hw_lacp_rx_flow(struct rte_eth_dev *dev) { > + struct mlx5_priv *priv =3D dev->data->dev_private; > + struct rte_flow_item_eth lacp_item =3D { > + .type =3D RTE_BE16(RTE_ETHER_TYPE_SLOW), > + }; > + struct rte_flow_item eth_lacp[] =3D { > + [0] =3D { > + .type =3D RTE_FLOW_ITEM_TYPE_ETH, > + .spec =3D &lacp_item, > + .mask =3D &lacp_item, > + }, > + [1] =3D { > + .type =3D RTE_FLOW_ITEM_TYPE_END, > + }, > + }; > + struct rte_flow_action miss_action[] =3D { > + [0] =3D { > + .type =3D (enum rte_flow_action_type) > + > MLX5_RTE_FLOW_ACTION_TYPE_DEFAULT_MISS, > + }, > + [1] =3D { > + .type =3D RTE_FLOW_ACTION_TYPE_END, > + }, > + }; > + struct mlx5_hw_ctrl_flow_info flow_info =3D { > + .type =3D MLX5_HW_CTRL_FLOW_TYPE_LACP_RX, > + }; > + > + MLX5_ASSERT(priv->master); > + if (!priv->dr_ctx || !priv->hw_lacp_rx_tbl) > + return 0; > + return flow_hw_create_ctrl_flow(dev, dev, priv->hw_lacp_rx_tbl, > eth_lacp, 0, > + miss_action, 0, &flow_info, false); } > + > static uint32_t > __calc_pattern_flags(const enum mlx5_flow_ctrl_rx_eth_pattern_type > eth_pattern_type) { diff --git a/drivers/net/mlx5/mlx5_trigger.c > b/drivers/net/mlx5/mlx5_trigger.c index c6742cb47e..b12a1dc1c7 100644 > --- a/drivers/net/mlx5/mlx5_trigger.c > +++ b/drivers/net/mlx5/mlx5_trigger.c > @@ -1524,6 +1524,9 @@ mlx5_traffic_enable_hws(struct rte_eth_dev *dev) > } > if (priv->isolated) > return 0; > + if (!priv->sh->config.lacp_by_user && priv->pf_bond >=3D 0) > + if (mlx5_flow_hw_lacp_rx_flow(dev)) > + goto error; > if (dev->data->promiscuous) > flags |=3D MLX5_CTRL_PROMISCUOUS; > if (dev->data->all_multicast) > -- > 2.34.1