diff options
author | Vu Pham <vuhuong@mellanox.com> | 2020-02-28 16:10:34 -0800 |
---|---|---|
committer | Saeed Mahameed <saeedm@mellanox.com> | 2020-05-27 18:13:49 -0700 |
commit | 133dcfc577eaec6538db4ebd8b9205b361f59018 (patch) | |
tree | 3618f02cd9da645a0feee85871039e1668ac1684 /drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c | |
parent | d97555e1452943264295cd3c1f066474bc3660dd (diff) | |
download | linux-stable-133dcfc577eaec6538db4ebd8b9205b361f59018.tar.gz linux-stable-133dcfc577eaec6538db4ebd8b9205b361f59018.tar.bz2 linux-stable-133dcfc577eaec6538db4ebd8b9205b361f59018.zip |
net/mlx5: E-Switch, Alloc and free unique metadata for match
Introduce infrastructure to create unique metadata for match
for vport without depending on vport_num. Vport uses its
default metadata for match in standalone configuration but
will share a different unique "bond_metadata" for match with
other vports in bond configuration.
Using ida to generate unique metadata for match for vports
in default and bond configurations.
Introduce APIs to generate, free metadata for match.
Introduce APIs to set vport's bond_metadata and replace its
ingress acl rules with bond_metatada.
Signed-off-by: Vu Pham <vuhuong@mellanox.com>
Reviewed-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c index 1bae549f3fa7..4e55d7225a26 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c @@ -291,3 +291,32 @@ void esw_acl_ingress_ofld_cleanup(struct mlx5_eswitch *esw, esw_acl_ingress_ofld_groups_destroy(vport); esw_acl_ingress_table_destroy(vport); } + +/* Caller must hold rtnl_lock */ +int mlx5_esw_acl_ingress_vport_bond_update(struct mlx5_eswitch *esw, u16 vport_num, + u32 metadata) +{ + struct mlx5_vport *vport = mlx5_eswitch_get_vport(esw, vport_num); + int err; + + if (WARN_ON_ONCE(IS_ERR(vport))) { + esw_warn(esw->dev, "vport(%d) invalid!\n", vport_num); + err = PTR_ERR(vport); + goto out; + } + + esw_acl_ingress_ofld_rules_destroy(esw, vport); + + vport->metadata = metadata ? metadata : vport->default_metadata; + + /* Recreate ingress acl rules with vport->metadata */ + err = esw_acl_ingress_ofld_rules_create(esw, vport); + if (err) + goto out; + + return 0; + +out: + vport->metadata = vport->default_metadata; + return err; +} |