Merge branch 'mlxsw-fixes'
Jiri Pirko says: ==================== mlxsw: couple of fixes Couple of unrelated fixes for mlxsw. --- v1->v2: -patch 2: - rebase on top of current -net tree - removed forgotten empty line -patch 3: - new patch -patch 4: - new patch ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
b739012bdc
|
@ -107,20 +107,20 @@ static const struct mlxsw_afk_element_info mlxsw_afk_element_infos[] = {
|
|||
MLXSW_AFK_ELEMENT_INFO_U32(VID, 0x10, 8, 12),
|
||||
MLXSW_AFK_ELEMENT_INFO_U32(PCP, 0x10, 20, 3),
|
||||
MLXSW_AFK_ELEMENT_INFO_U32(TCP_FLAGS, 0x10, 23, 9),
|
||||
MLXSW_AFK_ELEMENT_INFO_U32(IP_TTL_, 0x14, 0, 8),
|
||||
MLXSW_AFK_ELEMENT_INFO_U32(IP_ECN, 0x14, 9, 2),
|
||||
MLXSW_AFK_ELEMENT_INFO_U32(IP_DSCP, 0x14, 11, 6),
|
||||
MLXSW_AFK_ELEMENT_INFO_U32(SRC_IP4, 0x18, 0, 32),
|
||||
MLXSW_AFK_ELEMENT_INFO_U32(DST_IP4, 0x1C, 0, 32),
|
||||
MLXSW_AFK_ELEMENT_INFO_BUF(SRC_IP6_HI, 0x18, 8),
|
||||
MLXSW_AFK_ELEMENT_INFO_BUF(SRC_IP6_LO, 0x20, 8),
|
||||
MLXSW_AFK_ELEMENT_INFO_BUF(DST_IP6_HI, 0x28, 8),
|
||||
MLXSW_AFK_ELEMENT_INFO_BUF(DST_IP6_LO, 0x30, 8),
|
||||
MLXSW_AFK_ELEMENT_INFO_U32(DST_L4_PORT, 0x14, 0, 16),
|
||||
MLXSW_AFK_ELEMENT_INFO_U32(SRC_L4_PORT, 0x14, 16, 16),
|
||||
MLXSW_AFK_ELEMENT_INFO_U32(IP_TTL_, 0x18, 0, 8),
|
||||
MLXSW_AFK_ELEMENT_INFO_U32(IP_ECN, 0x18, 9, 2),
|
||||
MLXSW_AFK_ELEMENT_INFO_U32(IP_DSCP, 0x18, 11, 6),
|
||||
MLXSW_AFK_ELEMENT_INFO_U32(SRC_IP4, 0x20, 0, 32),
|
||||
MLXSW_AFK_ELEMENT_INFO_U32(DST_IP4, 0x24, 0, 32),
|
||||
MLXSW_AFK_ELEMENT_INFO_BUF(SRC_IP6_HI, 0x20, 8),
|
||||
MLXSW_AFK_ELEMENT_INFO_BUF(SRC_IP6_LO, 0x28, 8),
|
||||
MLXSW_AFK_ELEMENT_INFO_BUF(DST_IP6_HI, 0x30, 8),
|
||||
MLXSW_AFK_ELEMENT_INFO_BUF(DST_IP6_LO, 0x38, 8),
|
||||
};
|
||||
|
||||
#define MLXSW_AFK_ELEMENT_STORAGE_SIZE 0x38
|
||||
#define MLXSW_AFK_ELEMENT_STORAGE_SIZE 0x40
|
||||
|
||||
struct mlxsw_afk_element_inst { /* element instance in actual block */
|
||||
const struct mlxsw_afk_element_info *info;
|
||||
|
|
|
@ -1459,6 +1459,7 @@ mlxsw_sp_port_vlan_create(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid)
|
|||
}
|
||||
|
||||
mlxsw_sp_port_vlan->mlxsw_sp_port = mlxsw_sp_port;
|
||||
mlxsw_sp_port_vlan->ref_count = 1;
|
||||
mlxsw_sp_port_vlan->vid = vid;
|
||||
list_add(&mlxsw_sp_port_vlan->list, &mlxsw_sp_port->vlans_list);
|
||||
|
||||
|
@ -1486,8 +1487,10 @@ mlxsw_sp_port_vlan_get(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid)
|
|||
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
|
||||
|
||||
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port, vid);
|
||||
if (mlxsw_sp_port_vlan)
|
||||
if (mlxsw_sp_port_vlan) {
|
||||
mlxsw_sp_port_vlan->ref_count++;
|
||||
return mlxsw_sp_port_vlan;
|
||||
}
|
||||
|
||||
return mlxsw_sp_port_vlan_create(mlxsw_sp_port, vid);
|
||||
}
|
||||
|
@ -1496,6 +1499,9 @@ void mlxsw_sp_port_vlan_put(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan)
|
|||
{
|
||||
struct mlxsw_sp_fid *fid = mlxsw_sp_port_vlan->fid;
|
||||
|
||||
if (--mlxsw_sp_port_vlan->ref_count != 0)
|
||||
return;
|
||||
|
||||
if (mlxsw_sp_port_vlan->bridge_port)
|
||||
mlxsw_sp_port_vlan_bridge_leave(mlxsw_sp_port_vlan);
|
||||
else if (fid)
|
||||
|
@ -4207,13 +4213,12 @@ static struct devlink_resource_ops mlxsw_sp_resource_kvd_hash_double_ops = {
|
|||
.size_validate = mlxsw_sp_resource_kvd_hash_double_size_validate,
|
||||
};
|
||||
|
||||
static struct devlink_resource_size_params mlxsw_sp_kvd_size_params;
|
||||
static struct devlink_resource_size_params mlxsw_sp_linear_size_params;
|
||||
static struct devlink_resource_size_params mlxsw_sp_hash_single_size_params;
|
||||
static struct devlink_resource_size_params mlxsw_sp_hash_double_size_params;
|
||||
|
||||
static void
|
||||
mlxsw_sp_resource_size_params_prepare(struct mlxsw_core *mlxsw_core)
|
||||
mlxsw_sp_resource_size_params_prepare(struct mlxsw_core *mlxsw_core,
|
||||
struct devlink_resource_size_params *kvd_size_params,
|
||||
struct devlink_resource_size_params *linear_size_params,
|
||||
struct devlink_resource_size_params *hash_double_size_params,
|
||||
struct devlink_resource_size_params *hash_single_size_params)
|
||||
{
|
||||
u32 single_size_min = MLXSW_CORE_RES_GET(mlxsw_core,
|
||||
KVD_SINGLE_MIN_SIZE);
|
||||
|
@ -4222,37 +4227,35 @@ mlxsw_sp_resource_size_params_prepare(struct mlxsw_core *mlxsw_core)
|
|||
u32 kvd_size = MLXSW_CORE_RES_GET(mlxsw_core, KVD_SIZE);
|
||||
u32 linear_size_min = 0;
|
||||
|
||||
/* KVD top resource */
|
||||
mlxsw_sp_kvd_size_params.size_min = kvd_size;
|
||||
mlxsw_sp_kvd_size_params.size_max = kvd_size;
|
||||
mlxsw_sp_kvd_size_params.size_granularity = MLXSW_SP_KVD_GRANULARITY;
|
||||
mlxsw_sp_kvd_size_params.unit = DEVLINK_RESOURCE_UNIT_ENTRY;
|
||||
|
||||
/* Linear part init */
|
||||
mlxsw_sp_linear_size_params.size_min = linear_size_min;
|
||||
mlxsw_sp_linear_size_params.size_max = kvd_size - single_size_min -
|
||||
double_size_min;
|
||||
mlxsw_sp_linear_size_params.size_granularity = MLXSW_SP_KVD_GRANULARITY;
|
||||
mlxsw_sp_linear_size_params.unit = DEVLINK_RESOURCE_UNIT_ENTRY;
|
||||
|
||||
/* Hash double part init */
|
||||
mlxsw_sp_hash_double_size_params.size_min = double_size_min;
|
||||
mlxsw_sp_hash_double_size_params.size_max = kvd_size - single_size_min -
|
||||
linear_size_min;
|
||||
mlxsw_sp_hash_double_size_params.size_granularity = MLXSW_SP_KVD_GRANULARITY;
|
||||
mlxsw_sp_hash_double_size_params.unit = DEVLINK_RESOURCE_UNIT_ENTRY;
|
||||
|
||||
/* Hash single part init */
|
||||
mlxsw_sp_hash_single_size_params.size_min = single_size_min;
|
||||
mlxsw_sp_hash_single_size_params.size_max = kvd_size - double_size_min -
|
||||
linear_size_min;
|
||||
mlxsw_sp_hash_single_size_params.size_granularity = MLXSW_SP_KVD_GRANULARITY;
|
||||
mlxsw_sp_hash_single_size_params.unit = DEVLINK_RESOURCE_UNIT_ENTRY;
|
||||
devlink_resource_size_params_init(kvd_size_params, kvd_size, kvd_size,
|
||||
MLXSW_SP_KVD_GRANULARITY,
|
||||
DEVLINK_RESOURCE_UNIT_ENTRY);
|
||||
devlink_resource_size_params_init(linear_size_params, linear_size_min,
|
||||
kvd_size - single_size_min -
|
||||
double_size_min,
|
||||
MLXSW_SP_KVD_GRANULARITY,
|
||||
DEVLINK_RESOURCE_UNIT_ENTRY);
|
||||
devlink_resource_size_params_init(hash_double_size_params,
|
||||
double_size_min,
|
||||
kvd_size - single_size_min -
|
||||
linear_size_min,
|
||||
MLXSW_SP_KVD_GRANULARITY,
|
||||
DEVLINK_RESOURCE_UNIT_ENTRY);
|
||||
devlink_resource_size_params_init(hash_single_size_params,
|
||||
single_size_min,
|
||||
kvd_size - double_size_min -
|
||||
linear_size_min,
|
||||
MLXSW_SP_KVD_GRANULARITY,
|
||||
DEVLINK_RESOURCE_UNIT_ENTRY);
|
||||
}
|
||||
|
||||
static int mlxsw_sp_resources_register(struct mlxsw_core *mlxsw_core)
|
||||
{
|
||||
struct devlink *devlink = priv_to_devlink(mlxsw_core);
|
||||
struct devlink_resource_size_params hash_single_size_params;
|
||||
struct devlink_resource_size_params hash_double_size_params;
|
||||
struct devlink_resource_size_params linear_size_params;
|
||||
struct devlink_resource_size_params kvd_size_params;
|
||||
u32 kvd_size, single_size, double_size, linear_size;
|
||||
const struct mlxsw_config_profile *profile;
|
||||
int err;
|
||||
|
@ -4261,13 +4264,17 @@ static int mlxsw_sp_resources_register(struct mlxsw_core *mlxsw_core)
|
|||
if (!MLXSW_CORE_RES_VALID(mlxsw_core, KVD_SIZE))
|
||||
return -EIO;
|
||||
|
||||
mlxsw_sp_resource_size_params_prepare(mlxsw_core);
|
||||
mlxsw_sp_resource_size_params_prepare(mlxsw_core, &kvd_size_params,
|
||||
&linear_size_params,
|
||||
&hash_double_size_params,
|
||||
&hash_single_size_params);
|
||||
|
||||
kvd_size = MLXSW_CORE_RES_GET(mlxsw_core, KVD_SIZE);
|
||||
err = devlink_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD,
|
||||
true, kvd_size,
|
||||
MLXSW_SP_RESOURCE_KVD,
|
||||
DEVLINK_RESOURCE_ID_PARENT_TOP,
|
||||
&mlxsw_sp_kvd_size_params,
|
||||
&kvd_size_params,
|
||||
&mlxsw_sp_resource_kvd_ops);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -4277,7 +4284,7 @@ static int mlxsw_sp_resources_register(struct mlxsw_core *mlxsw_core)
|
|||
false, linear_size,
|
||||
MLXSW_SP_RESOURCE_KVD_LINEAR,
|
||||
MLXSW_SP_RESOURCE_KVD,
|
||||
&mlxsw_sp_linear_size_params,
|
||||
&linear_size_params,
|
||||
&mlxsw_sp_resource_kvd_linear_ops);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -4291,7 +4298,7 @@ static int mlxsw_sp_resources_register(struct mlxsw_core *mlxsw_core)
|
|||
false, double_size,
|
||||
MLXSW_SP_RESOURCE_KVD_HASH_DOUBLE,
|
||||
MLXSW_SP_RESOURCE_KVD,
|
||||
&mlxsw_sp_hash_double_size_params,
|
||||
&hash_double_size_params,
|
||||
&mlxsw_sp_resource_kvd_hash_double_ops);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -4301,7 +4308,7 @@ static int mlxsw_sp_resources_register(struct mlxsw_core *mlxsw_core)
|
|||
false, single_size,
|
||||
MLXSW_SP_RESOURCE_KVD_HASH_SINGLE,
|
||||
MLXSW_SP_RESOURCE_KVD,
|
||||
&mlxsw_sp_hash_single_size_params,
|
||||
&hash_single_size_params,
|
||||
&mlxsw_sp_resource_kvd_hash_single_ops);
|
||||
if (err)
|
||||
return err;
|
||||
|
|
|
@ -211,6 +211,7 @@ struct mlxsw_sp_port_vlan {
|
|||
struct list_head list;
|
||||
struct mlxsw_sp_port *mlxsw_sp_port;
|
||||
struct mlxsw_sp_fid *fid;
|
||||
unsigned int ref_count;
|
||||
u16 vid;
|
||||
struct mlxsw_sp_bridge_port *bridge_port;
|
||||
struct list_head bridge_vlan_node;
|
||||
|
|
|
@ -112,11 +112,11 @@ static const int mlxsw_sp_sfgc_bc_packet_types[MLXSW_REG_SFGC_TYPE_MAX] = {
|
|||
[MLXSW_REG_SFGC_TYPE_UNREGISTERED_MULTICAST_NON_IP] = 1,
|
||||
[MLXSW_REG_SFGC_TYPE_IPV4_LINK_LOCAL] = 1,
|
||||
[MLXSW_REG_SFGC_TYPE_IPV6_ALL_HOST] = 1,
|
||||
[MLXSW_REG_SFGC_TYPE_UNREGISTERED_MULTICAST_IPV6] = 1,
|
||||
};
|
||||
|
||||
static const int mlxsw_sp_sfgc_mc_packet_types[MLXSW_REG_SFGC_TYPE_MAX] = {
|
||||
[MLXSW_REG_SFGC_TYPE_UNREGISTERED_MULTICAST_IPV4] = 1,
|
||||
[MLXSW_REG_SFGC_TYPE_UNREGISTERED_MULTICAST_IPV6] = 1,
|
||||
};
|
||||
|
||||
static const int *mlxsw_sp_packet_type_sfgc_types[] = {
|
||||
|
|
|
@ -257,6 +257,18 @@ struct devlink_resource_size_params {
|
|||
enum devlink_resource_unit unit;
|
||||
};
|
||||
|
||||
static inline void
|
||||
devlink_resource_size_params_init(struct devlink_resource_size_params *size_params,
|
||||
u64 size_min, u64 size_max,
|
||||
u64 size_granularity,
|
||||
enum devlink_resource_unit unit)
|
||||
{
|
||||
size_params->size_min = size_min;
|
||||
size_params->size_max = size_max;
|
||||
size_params->size_granularity = size_granularity;
|
||||
size_params->unit = unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* struct devlink_resource - devlink resource
|
||||
* @name: name of the resource
|
||||
|
@ -278,7 +290,7 @@ struct devlink_resource {
|
|||
u64 size_new;
|
||||
bool size_valid;
|
||||
struct devlink_resource *parent;
|
||||
struct devlink_resource_size_params *size_params;
|
||||
struct devlink_resource_size_params size_params;
|
||||
struct list_head list;
|
||||
struct list_head resource_list;
|
||||
const struct devlink_resource_ops *resource_ops;
|
||||
|
@ -402,7 +414,7 @@ int devlink_resource_register(struct devlink *devlink,
|
|||
u64 resource_size,
|
||||
u64 resource_id,
|
||||
u64 parent_resource_id,
|
||||
struct devlink_resource_size_params *size_params,
|
||||
const struct devlink_resource_size_params *size_params,
|
||||
const struct devlink_resource_ops *resource_ops);
|
||||
void devlink_resources_unregister(struct devlink *devlink,
|
||||
struct devlink_resource *resource);
|
||||
|
@ -556,7 +568,7 @@ devlink_resource_register(struct devlink *devlink,
|
|||
u64 resource_size,
|
||||
u64 resource_id,
|
||||
u64 parent_resource_id,
|
||||
struct devlink_resource_size_params *size_params,
|
||||
const struct devlink_resource_size_params *size_params,
|
||||
const struct devlink_resource_ops *resource_ops)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
@ -2379,7 +2379,7 @@ devlink_resource_size_params_put(struct devlink_resource *resource,
|
|||
{
|
||||
struct devlink_resource_size_params *size_params;
|
||||
|
||||
size_params = resource->size_params;
|
||||
size_params = &resource->size_params;
|
||||
if (nla_put_u64_64bit(skb, DEVLINK_ATTR_RESOURCE_SIZE_GRAN,
|
||||
size_params->size_granularity, DEVLINK_ATTR_PAD) ||
|
||||
nla_put_u64_64bit(skb, DEVLINK_ATTR_RESOURCE_SIZE_MAX,
|
||||
|
@ -3156,7 +3156,7 @@ int devlink_resource_register(struct devlink *devlink,
|
|||
u64 resource_size,
|
||||
u64 resource_id,
|
||||
u64 parent_resource_id,
|
||||
struct devlink_resource_size_params *size_params,
|
||||
const struct devlink_resource_size_params *size_params,
|
||||
const struct devlink_resource_ops *resource_ops)
|
||||
{
|
||||
struct devlink_resource *resource;
|
||||
|
@ -3199,7 +3199,8 @@ int devlink_resource_register(struct devlink *devlink,
|
|||
resource->id = resource_id;
|
||||
resource->resource_ops = resource_ops;
|
||||
resource->size_valid = true;
|
||||
resource->size_params = size_params;
|
||||
memcpy(&resource->size_params, size_params,
|
||||
sizeof(resource->size_params));
|
||||
INIT_LIST_HEAD(&resource->resource_list);
|
||||
list_add_tail(&resource->list, resource_list);
|
||||
out:
|
||||
|
|
Loading…
Reference in New Issue