forked from luck/tmp_suning_uos_patched
mlxsw: spectrum: Track NVE type at FIDs
A follow-up patch will add support for replay and for clearing of offload marks. These are NVE type-sensitive operations, and to be able to dispatch them properly, a FID needs to know what NVE type is attached to it. Therefore, track the NVE type at struct mlxsw_sp_fid. Extend mlxsw_sp_fid_vni_set() to take it as an argument, and add mlxsw_sp_fid_nve_type(). Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
43920edf3b
commit
2a36c12520
|
@ -81,6 +81,10 @@ enum mlxsw_sp_fid_type {
|
|||
MLXSW_SP_FID_TYPE_MAX,
|
||||
};
|
||||
|
||||
enum mlxsw_sp_nve_type {
|
||||
MLXSW_SP_NVE_TYPE_VXLAN,
|
||||
};
|
||||
|
||||
struct mlxsw_sp_mid {
|
||||
struct list_head list;
|
||||
unsigned char addr[ETH_ALEN];
|
||||
|
@ -745,6 +749,8 @@ bool mlxsw_sp_fid_lag_vid_valid(const struct mlxsw_sp_fid *fid);
|
|||
struct mlxsw_sp_fid *mlxsw_sp_fid_lookup_by_index(struct mlxsw_sp *mlxsw_sp,
|
||||
u16 fid_index);
|
||||
int mlxsw_sp_fid_nve_ifindex(const struct mlxsw_sp_fid *fid, int *nve_ifindex);
|
||||
int mlxsw_sp_fid_nve_type(const struct mlxsw_sp_fid *fid,
|
||||
enum mlxsw_sp_nve_type *p_type);
|
||||
struct mlxsw_sp_fid *mlxsw_sp_fid_lookup_by_vni(struct mlxsw_sp *mlxsw_sp,
|
||||
__be32 vni);
|
||||
int mlxsw_sp_fid_vni(const struct mlxsw_sp_fid *fid, __be32 *vni);
|
||||
|
@ -752,7 +758,8 @@ int mlxsw_sp_fid_nve_flood_index_set(struct mlxsw_sp_fid *fid,
|
|||
u32 nve_flood_index);
|
||||
void mlxsw_sp_fid_nve_flood_index_clear(struct mlxsw_sp_fid *fid);
|
||||
bool mlxsw_sp_fid_nve_flood_index_is_set(const struct mlxsw_sp_fid *fid);
|
||||
int mlxsw_sp_fid_vni_set(struct mlxsw_sp_fid *fid, __be32 vni, int nve_ifindex);
|
||||
int mlxsw_sp_fid_vni_set(struct mlxsw_sp_fid *fid, enum mlxsw_sp_nve_type type,
|
||||
__be32 vni, int nve_ifindex);
|
||||
void mlxsw_sp_fid_vni_clear(struct mlxsw_sp_fid *fid);
|
||||
bool mlxsw_sp_fid_vni_is_set(const struct mlxsw_sp_fid *fid);
|
||||
int mlxsw_sp_fid_flood_set(struct mlxsw_sp_fid *fid,
|
||||
|
@ -823,10 +830,6 @@ extern const struct mlxsw_sp_mr_tcam_ops mlxsw_sp1_mr_tcam_ops;
|
|||
extern const struct mlxsw_sp_mr_tcam_ops mlxsw_sp2_mr_tcam_ops;
|
||||
|
||||
/* spectrum_nve.c */
|
||||
enum mlxsw_sp_nve_type {
|
||||
MLXSW_SP_NVE_TYPE_VXLAN,
|
||||
};
|
||||
|
||||
struct mlxsw_sp_nve_params {
|
||||
enum mlxsw_sp_nve_type type;
|
||||
__be32 vni;
|
||||
|
|
|
@ -30,6 +30,7 @@ struct mlxsw_sp_fid {
|
|||
struct rhash_head ht_node;
|
||||
|
||||
struct rhash_head vni_ht_node;
|
||||
enum mlxsw_sp_nve_type nve_type;
|
||||
__be32 vni;
|
||||
u32 nve_flood_index;
|
||||
int nve_ifindex;
|
||||
|
@ -151,6 +152,17 @@ int mlxsw_sp_fid_nve_ifindex(const struct mlxsw_sp_fid *fid, int *nve_ifindex)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int mlxsw_sp_fid_nve_type(const struct mlxsw_sp_fid *fid,
|
||||
enum mlxsw_sp_nve_type *p_type)
|
||||
{
|
||||
if (!fid->vni_valid)
|
||||
return -EINVAL;
|
||||
|
||||
*p_type = fid->nve_type;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct mlxsw_sp_fid *mlxsw_sp_fid_lookup_by_vni(struct mlxsw_sp *mlxsw_sp,
|
||||
__be32 vni)
|
||||
{
|
||||
|
@ -211,7 +223,8 @@ bool mlxsw_sp_fid_nve_flood_index_is_set(const struct mlxsw_sp_fid *fid)
|
|||
return fid->nve_flood_index_valid;
|
||||
}
|
||||
|
||||
int mlxsw_sp_fid_vni_set(struct mlxsw_sp_fid *fid, __be32 vni, int nve_ifindex)
|
||||
int mlxsw_sp_fid_vni_set(struct mlxsw_sp_fid *fid, enum mlxsw_sp_nve_type type,
|
||||
__be32 vni, int nve_ifindex)
|
||||
{
|
||||
struct mlxsw_sp_fid_family *fid_family = fid->fid_family;
|
||||
const struct mlxsw_sp_fid_ops *ops = fid_family->ops;
|
||||
|
@ -221,6 +234,7 @@ int mlxsw_sp_fid_vni_set(struct mlxsw_sp_fid *fid, __be32 vni, int nve_ifindex)
|
|||
if (WARN_ON(!ops->vni_set || fid->vni_valid))
|
||||
return -EINVAL;
|
||||
|
||||
fid->nve_type = type;
|
||||
fid->nve_ifindex = nve_ifindex;
|
||||
fid->vni = vni;
|
||||
err = rhashtable_lookup_insert_fast(&mlxsw_sp->fid_core->vni_ht,
|
||||
|
|
|
@ -817,7 +817,8 @@ int mlxsw_sp_nve_fid_enable(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_fid *fid,
|
|||
return err;
|
||||
}
|
||||
|
||||
err = mlxsw_sp_fid_vni_set(fid, params->vni, params->dev->ifindex);
|
||||
err = mlxsw_sp_fid_vni_set(fid, params->type, params->vni,
|
||||
params->dev->ifindex);
|
||||
if (err) {
|
||||
NL_SET_ERR_MSG_MOD(extack, "Failed to set VNI on FID");
|
||||
goto err_fid_vni_set;
|
||||
|
|
Loading…
Reference in New Issue
Block a user