From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
netdev@vger.kernel.org, Jianbo Liu <jianbol@nvidia.com>,
Roi Dayan <roid@nvidia.com>
Subject: [net-next 12/15] net/mlx5e: configure meter in flow action
Date: Wed, 13 Jul 2022 15:58:56 -0700 [thread overview]
Message-ID: <20220713225859.401241-13-saeed@kernel.org> (raw)
In-Reply-To: <20220713225859.401241-1-saeed@kernel.org>
From: Jianbo Liu <jianbol@nvidia.com>
After police action is parsed, set meter data in flow action,
so they can be used when adding FTE.
Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
.../mellanox/mlx5/core/eswitch_offloads.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 85b3aa4d7955..da1959caae41 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -512,6 +512,20 @@ esw_cleanup_dests(struct mlx5_eswitch *esw,
}
}
+static void
+esw_setup_meter(struct mlx5_flow_attr *attr, struct mlx5_flow_act *flow_act)
+{
+ struct mlx5e_flow_meter_handle *meter;
+
+ meter = attr->meter_attr.meter;
+ flow_act->exe_aso.type = attr->exe_aso_type;
+ flow_act->exe_aso.object_id = meter->obj_id;
+ flow_act->exe_aso.flow_meter.meter_idx = meter->idx;
+ flow_act->exe_aso.flow_meter.init_color = MLX5_FLOW_METER_COLOR_GREEN;
+ /* use metadata reg 5 for packet color */
+ flow_act->exe_aso.return_reg_id = 5;
+}
+
struct mlx5_flow_handle *
mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
struct mlx5_flow_spec *spec,
@@ -579,6 +593,10 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
flow_act.modify_hdr = attr->modify_hdr;
+ if ((flow_act.action & MLX5_FLOW_CONTEXT_ACTION_EXECUTE_ASO) &&
+ attr->exe_aso_type == MLX5_EXE_ASO_FLOW_METER)
+ esw_setup_meter(attr, &flow_act);
+
if (split) {
fwd_attr.chain = attr->chain;
fwd_attr.prio = attr->prio;
--
2.36.1
next prev parent reply other threads:[~2022-07-13 23:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-13 22:58 [pull request][net-next 00/15] mlx5 updates 2022-07-13 Saeed Mahameed
2022-07-13 22:58 ` [net-next 01/15] net/mlx5: Use the bitmap API to allocate bitmaps Saeed Mahameed
2022-07-15 5:20 ` patchwork-bot+netdevbpf
2022-07-13 22:58 ` [net-next 02/15] net/mlx5: Introduce ifc bits for using software vhca id Saeed Mahameed
2022-07-13 22:58 ` [net-next 03/15] net/mlx5: Use software VHCA id when it's supported Saeed Mahameed
2022-07-13 22:58 ` [net-next 04/15] net/mlx5: Expose vnic diagnostic counters for eswitch managed vports Saeed Mahameed
2022-07-13 22:58 ` [net-next 05/15] net/mlx5: debugfs, Add num of in-use FW command interface slots Saeed Mahameed
2022-07-13 22:58 ` [net-next 06/15] net/mlx5: Bridge, refactor groups sizes and indices Saeed Mahameed
2022-07-13 22:58 ` [net-next 07/15] net/mlx5: Bridge, rename filter fg to vlan_filter Saeed Mahameed
2022-07-13 22:58 ` [net-next 08/15] net/mlx5: Bridge, extract VLAN push/pop actions creation Saeed Mahameed
2022-07-13 22:58 ` [net-next 09/15] net/mlx5: Bridge, implement infrastructure for VLAN protocol change Saeed Mahameed
2022-07-13 22:58 ` [net-next 10/15] net/mlx5: Bridge, implement QinQ support Saeed Mahameed
2022-07-13 22:58 ` [net-next 11/15] net/mlx5e: Removed useless code in function Saeed Mahameed
2022-07-13 22:58 ` Saeed Mahameed [this message]
2022-07-13 22:58 ` [net-next 13/15] net/mlx5e: Extend flower police validation Saeed Mahameed
2022-07-13 22:58 ` [net-next 14/15] net/mlx5e: Move the LRO-XSK check to mlx5e_fix_features Saeed Mahameed
2022-07-13 22:58 ` [net-next 15/15] net/mlx5e: Remove the duplicating check for striding RQ when enabling LRO Saeed Mahameed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220713225859.401241-13-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jianbol@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=roid@nvidia.com \
--cc=saeedm@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).