bool counter_egress_valid;
};
+struct mlxsw_sp_rif_subport {
+ struct mlxsw_sp_rif common;
+ union {
+ u16 system_port;
+ u16 lag_id;
+ };
+ u16 vid;
+ bool lag;
+};
+
static unsigned int *
mlxsw_sp_rif_p_counter_get(struct mlxsw_sp_rif *rif,
enum mlxsw_sp_rif_counter_dir dir)
static struct mlxsw_sp_rif *
mlxsw_sp_rif_alloc(u16 rif_index, u16 vr_id, struct net_device *l3_dev,
- struct mlxsw_sp_fid *f)
+ struct mlxsw_sp_fid *f, bool is_subport)
{
+ size_t size = is_subport ? sizeof(struct mlxsw_sp_rif_subport) :
+ sizeof(struct mlxsw_sp_rif);
struct mlxsw_sp_rif *rif;
- rif = kzalloc(sizeof(*rif), GFP_KERNEL);
+ rif = kzalloc(size, GFP_KERNEL);
if (!rif)
return NULL;
{
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port;
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
+ struct mlxsw_sp_rif_subport *rif_subport;
u32 tb_id = l3mdev_fib_table(l3_dev);
struct mlxsw_sp_vr *vr;
struct mlxsw_sp_fid *f;
goto err_vr_get;
}
- rif = mlxsw_sp_rif_alloc(rif_index, vr->id, l3_dev, f);
+ rif = mlxsw_sp_rif_alloc(rif_index, vr->id, l3_dev, f, true);
if (!rif) {
err = -ENOMEM;
goto err_rif_alloc;
}
+ rif_subport = container_of(rif, struct mlxsw_sp_rif_subport, common);
+ rif_subport->vid = mlxsw_sp_port_vlan->vid;
+ if (mlxsw_sp_port->lagged) {
+ rif_subport->lag = true;
+ rif_subport->lag_id = mlxsw_sp_port->lag_id;
+ } else {
+ rif_subport->lag = false;
+ rif_subport->system_port = mlxsw_sp_port->local_port;
+ }
+
err = mlxsw_sp_port_vlan_rif_sp_op(mlxsw_sp_port_vlan, vr->id, l3_dev,
rif_index, true);
if (err)
if (err)
goto err_port_flood_set;
- rif = mlxsw_sp_rif_alloc(rif_index, vr->id, l3_dev, f);
+ rif = mlxsw_sp_rif_alloc(rif_index, vr->id, l3_dev, f, false);
if (!rif) {
err = -ENOMEM;
goto err_rif_alloc;