[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <49e12978-c00b-4937-bc89-424ec1ed4960@nvidia.com>
Date: Wed, 8 Jan 2025 13:55:54 +0200
From: Moshe Shemesh <moshe@...dia.com>
To: Przemek Kitszel <przemyslaw.kitszel@...el.com>, Tariq Toukan
<tariqt@...dia.com>
CC: <netdev@...r.kernel.org>, Saeed Mahameed <saeedm@...dia.com>, Gal Pressman
<gal@...dia.com>, Leon Romanovsky <leonro@...dia.com>, Mark Bloch
<mbloch@...dia.com>, Yevgeny Kliteynik <kliteyn@...dia.com>, "David S.
Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Eric Dumazet <edumazet@...gle.com>, Andrew Lunn
<andrew+netdev@...n.ch>
Subject: Re: [PATCH net-next 04/13] net/mlx5: fs, add HWS actions pool
On 1/7/2025 1:36 PM, Przemek Kitszel wrote:
>
> On 1/7/25 07:06, Tariq Toukan wrote:
>> From: Moshe Shemesh <moshe@...dia.com>
>>
>> The HW Steering actions pool will help utilize the option in HW Steering
>> to share steering actions among different rules.
>>
>> Create pool on root namespace creation and add few HW Steering actions
>> that don't depend on the steering rule itself and thus can be shared
>> between rules, created on same namespace: tag, pop_vlan, push_vlan,
>> drop, decap l2.
>>
>> Signed-off-by: Moshe Shemesh <moshe@...dia.com>
>> Reviewed-by: Yevgeny Kliteynik <kliteyn@...dia.com>
>> Reviewed-by: Mark Bloch <mbloch@...dia.com>
>> Signed-off-by: Tariq Toukan <tariqt@...dia.com>
>> ---
>> .../mellanox/mlx5/core/steering/hws/fs_hws.c | 58 +++++++++++++++++++
>> .../mellanox/mlx5/core/steering/hws/fs_hws.h | 9 +++
>> 2 files changed, 67 insertions(+)
>>
>> diff --git
>> a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
>> b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
>> index c8064bc8a86c..eeaf4a84aafc 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
>> @@ -9,9 +9,60 @@
>> #define MLX5HWS_CTX_MAX_NUM_OF_QUEUES 16
>> #define MLX5HWS_CTX_QUEUE_SIZE 256
>>
>> +static int init_hws_actions_pool(struct mlx5_fs_hws_context *fs_ctx)
>> +{
>> + u32 flags = MLX5HWS_ACTION_FLAG_HWS_FDB |
>> MLX5HWS_ACTION_FLAG_SHARED;
>> + struct mlx5_fs_hws_actions_pool *hws_pool = &fs_ctx->hws_pool;
>> + struct mlx5hws_action_reformat_header reformat_hdr = {};
>> + struct mlx5hws_context *ctx = fs_ctx->hws_ctx;
>> + enum mlx5hws_action_type action_type;
>> +
>> + hws_pool->tag_action = mlx5hws_action_create_tag(ctx, flags);
>> + if (!hws_pool->tag_action)
>> + return -ENOMEM;
>> + hws_pool->pop_vlan_action = mlx5hws_action_create_pop_vlan(ctx,
>> flags);
>> + if (!hws_pool->pop_vlan_action)
>> + goto destroy_tag;
>> + hws_pool->push_vlan_action =
>> mlx5hws_action_create_push_vlan(ctx, flags);
>> + if (!hws_pool->push_vlan_action)
>> + goto destroy_pop_vlan;
>> + hws_pool->drop_action = mlx5hws_action_create_dest_drop(ctx,
>> flags);
>> + if (!hws_pool->drop_action)
>> + goto destroy_push_vlan;
>> + action_type = MLX5HWS_ACTION_TYP_REFORMAT_TNL_L2_TO_L2;
>> + hws_pool->decapl2_action =
>> + mlx5hws_action_create_reformat(ctx, action_type, 1,
>> + &reformat_hdr, 0, flags);
>> + if (!hws_pool->decapl2_action)
>> + goto destroy_drop;
>> + return 0;
>> +
>> +destroy_drop:
>> + mlx5hws_action_destroy(hws_pool->drop_action);
>> +destroy_push_vlan:
>> + mlx5hws_action_destroy(hws_pool->push_vlan_action);
>> +destroy_pop_vlan:
>> + mlx5hws_action_destroy(hws_pool->pop_vlan_action);
>> +destroy_tag:
>> + mlx5hws_action_destroy(hws_pool->tag_action);
>> + return -ENOMEM;
>
> I would expect to get -ENOMEM only on k*alloc() family failures, but
> your set of helpers does much more than just attempt to allocate memory.
> -ENOSPC?
OK
Powered by blists - more mailing lists