Skip to content

Commit aecd9d1

Browse files
mosheshemesh2kuba-moo
authored andcommitted
net/mlx5: fs, add HWS packet reformat API function
Add packet reformat alloc and dealloc API functions to provide packet reformat actions for steering rules. Add HWS action pools for each of the following packet reformat types: - decapl3: decapsulate l3 tunnel to l2 - encapl2: encapsulate l2 to tunnel l2 - encapl3: encapsulate l2 to tunnel l3 - insert_hdr: insert header In addition cache remove header action for remove vlan header as this is currently the only use case of remove header action in the driver. Signed-off-by: Moshe Shemesh <[email protected]> Reviewed-by: Yevgeny Kliteynik <[email protected]> Reviewed-by: Mark Bloch <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c7e62a7 commit aecd9d1

File tree

10 files changed

+598
-11
lines changed

10 files changed

+598
-11
lines changed

drivers/net/ethernet/mellanox/mlx5/core/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ mlx5_core-$(CONFIG_MLX5_HW_STEERING) += steering/hws/cmd.o \
152152
steering/hws/debug.o \
153153
steering/hws/vport.o \
154154
steering/hws/bwc_complex.o \
155+
steering/hws/fs_hws_pools.o \
155156
steering/hws/fs_hws.o
156157

157158
#

drivers/net/ethernet/mellanox/mlx5/core/fs_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ struct mlx5_pkt_reformat {
7575
enum mlx5_flow_resource_owner owner;
7676
union {
7777
struct mlx5_fs_dr_action fs_dr_action;
78+
struct mlx5_fs_hws_action fs_hws_action;
7879
u32 id;
7980
};
8081
};

drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,8 @@ static void mlx5_fc_init(struct mlx5_fc *counter, struct mlx5_fc_bulk *bulk,
449449
counter->id = id;
450450
}
451451

452-
static struct mlx5_fs_bulk *mlx5_fc_bulk_create(struct mlx5_core_dev *dev)
452+
static struct mlx5_fs_bulk *mlx5_fc_bulk_create(struct mlx5_core_dev *dev,
453+
void *pool_ctx)
453454
{
454455
enum mlx5_fc_bulk_alloc_bitmask alloc_bitmask;
455456
struct mlx5_fc_bulk *fc_bulk;
@@ -518,7 +519,7 @@ static const struct mlx5_fs_pool_ops mlx5_fc_pool_ops = {
518519
static void
519520
mlx5_fc_pool_init(struct mlx5_fs_pool *fc_pool, struct mlx5_core_dev *dev)
520521
{
521-
mlx5_fs_pool_init(fc_pool, dev, &mlx5_fc_pool_ops);
522+
mlx5_fs_pool_init(fc_pool, dev, &mlx5_fc_pool_ops, NULL);
522523
}
523524

524525
static void mlx5_fc_pool_cleanup(struct mlx5_fs_pool *fc_pool)

drivers/net/ethernet/mellanox/mlx5/core/fs_pool.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ static int mlx5_fs_bulk_release_index(struct mlx5_fs_bulk *fs_bulk, int index)
5656
}
5757

5858
void mlx5_fs_pool_init(struct mlx5_fs_pool *pool, struct mlx5_core_dev *dev,
59-
const struct mlx5_fs_pool_ops *ops)
59+
const struct mlx5_fs_pool_ops *ops, void *pool_ctx)
6060
{
6161
WARN_ON_ONCE(!ops || !ops->bulk_destroy || !ops->bulk_create ||
6262
!ops->update_threshold);
6363
pool->dev = dev;
64+
pool->pool_ctx = pool_ctx;
6465
mutex_init(&pool->pool_lock);
6566
INIT_LIST_HEAD(&pool->fully_used);
6667
INIT_LIST_HEAD(&pool->partially_used);
@@ -91,7 +92,7 @@ mlx5_fs_pool_alloc_new_bulk(struct mlx5_fs_pool *fs_pool)
9192
struct mlx5_core_dev *dev = fs_pool->dev;
9293
struct mlx5_fs_bulk *new_bulk;
9394

94-
new_bulk = fs_pool->ops->bulk_create(dev);
95+
new_bulk = fs_pool->ops->bulk_create(dev, fs_pool->pool_ctx);
9596
if (new_bulk)
9697
fs_pool->available_units += new_bulk->bulk_len;
9798
fs_pool->ops->update_threshold(fs_pool);

drivers/net/ethernet/mellanox/mlx5/core/fs_pool.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ struct mlx5_fs_pool;
2121

2222
struct mlx5_fs_pool_ops {
2323
int (*bulk_destroy)(struct mlx5_core_dev *dev, struct mlx5_fs_bulk *bulk);
24-
struct mlx5_fs_bulk * (*bulk_create)(struct mlx5_core_dev *dev);
24+
struct mlx5_fs_bulk * (*bulk_create)(struct mlx5_core_dev *dev,
25+
void *pool_ctx);
2526
void (*update_threshold)(struct mlx5_fs_pool *pool);
2627
};
2728

@@ -44,7 +45,7 @@ void mlx5_fs_bulk_cleanup(struct mlx5_fs_bulk *fs_bulk);
4445
int mlx5_fs_bulk_get_free_amount(struct mlx5_fs_bulk *bulk);
4546

4647
void mlx5_fs_pool_init(struct mlx5_fs_pool *pool, struct mlx5_core_dev *dev,
47-
const struct mlx5_fs_pool_ops *ops);
48+
const struct mlx5_fs_pool_ops *ops, void *pool_ctx);
4849
void mlx5_fs_pool_cleanup(struct mlx5_fs_pool *pool);
4950
int mlx5_fs_pool_acquire_index(struct mlx5_fs_pool *fs_pool,
5051
struct mlx5_fs_pool_index *pool_index);

0 commit comments

Comments
 (0)