Skip to content
Permalink
Browse files
more wip
  • Loading branch information
pmachata committed Aug 19, 2020
1 parent 4f02d30 commit 9695d59b85070316a2336212a26addeff39f3c56
Show file tree
Hide file tree
Showing 7 changed files with 238 additions and 114 deletions.
@@ -614,27 +614,25 @@ static int mlxsw_sp_port_change_mtu(struct net_device *dev, int mtu)

pb = orig_pb;
pb.mtu = mtu;
mlxsw_sp_pbs_autoresize(mlxsw_sp_port, &pb);
err = mlxsw_sp_pbs_autoresize(mlxsw_sp_port, &pb);
if (err) {
netdev_err(dev, "Failed to configure port's headroom for PFC\n");
return err;
}

err = mlxsw_sp_pbs_configure(mlxsw_sp_port, &pb);
if (err) {
netdev_err(dev, "Failed to configure port's headroom for PFC\n");
return err;
}

err = mlxsw_sp_span_port_mtu_update(mlxsw_sp_port, mtu);
if (err)
goto err_span_port_mtu_update;

err = mlxsw_sp_port_mtu_set(mlxsw_sp_port, mtu);
if (err)
goto err_port_mtu_set;
dev->mtu = mtu;
return 0;

err_port_mtu_set:
mlxsw_sp_span_port_mtu_update(mlxsw_sp_port, dev->mtu);
err_span_port_mtu_update:
mlxsw_sp_pbs_configure(mlxsw_sp_port, &orig_pb);
return err;
}
@@ -1567,7 +1565,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
INIT_DELAYED_WORK(&mlxsw_sp_port->ptp.shaper_dw,
mlxsw_sp->ptp_ops->shaper_work);
INIT_DELAYED_WORK(&mlxsw_sp_port->span.speed_update_dw,
mlxsw_sp_span_speed_update_work);
mlxsw_sp_pb_speed_update_work);

mlxsw_sp->ports[local_port] = mlxsw_sp_port;
err = register_netdev(dev);
@@ -2692,6 +2690,7 @@ static int mlxsw_sp1_init(struct mlxsw_core *mlxsw_core,
mlxsw_sp->mac_mask = mlxsw_sp1_mac_mask;
mlxsw_sp->rif_ops_arr = mlxsw_sp1_rif_ops_arr;
mlxsw_sp->sb_vals = &mlxsw_sp1_sb_vals;
mlxsw_sp->sb_ops = &mlxsw_sp1_sb_ops;
mlxsw_sp->port_type_speed_ops = &mlxsw_sp1_port_type_speed_ops;
mlxsw_sp->ptp_ops = &mlxsw_sp1_ptp_ops;
mlxsw_sp->span_ops = &mlxsw_sp1_span_ops;
@@ -2720,6 +2719,7 @@ static int mlxsw_sp2_init(struct mlxsw_core *mlxsw_core,
mlxsw_sp->mac_mask = mlxsw_sp2_mac_mask;
mlxsw_sp->rif_ops_arr = mlxsw_sp2_rif_ops_arr;
mlxsw_sp->sb_vals = &mlxsw_sp2_sb_vals;
mlxsw_sp->sb_ops = &mlxsw_sp2_sb_ops;
mlxsw_sp->port_type_speed_ops = &mlxsw_sp2_port_type_speed_ops;
mlxsw_sp->ptp_ops = &mlxsw_sp2_ptp_ops;
mlxsw_sp->span_ops = &mlxsw_sp2_span_ops;
@@ -2746,6 +2746,7 @@ static int mlxsw_sp3_init(struct mlxsw_core *mlxsw_core,
mlxsw_sp->mac_mask = mlxsw_sp2_mac_mask;
mlxsw_sp->rif_ops_arr = mlxsw_sp2_rif_ops_arr;
mlxsw_sp->sb_vals = &mlxsw_sp2_sb_vals;
mlxsw_sp->sb_ops = &mlxsw_sp3_sb_ops;
mlxsw_sp->port_type_speed_ops = &mlxsw_sp2_port_type_speed_ops;
mlxsw_sp->ptp_ops = &mlxsw_sp2_ptp_ops;
mlxsw_sp->span_ops = &mlxsw_sp3_span_ops;
@@ -125,6 +125,7 @@ struct mlxsw_sp_mr_tcam_ops;
struct mlxsw_sp_acl_rulei_ops;
struct mlxsw_sp_acl_tcam_ops;
struct mlxsw_sp_nve_ops;
struct mlxsw_sp_sb_ops;
struct mlxsw_sp_sb_vals;
struct mlxsw_sp_port_type_speed_ops;
struct mlxsw_sp_ptp_state;
@@ -171,6 +172,7 @@ struct mlxsw_sp {
const struct mlxsw_sp_nve_ops **nve_ops_arr;
const struct mlxsw_sp_rif_ops **rif_ops_arr;
const struct mlxsw_sp_sb_vals *sb_vals;
const struct mlxsw_sp_sb_ops *sb_ops;
const struct mlxsw_sp_port_type_speed_ops *port_type_speed_ops;
const struct mlxsw_sp_ptp_ops *ptp_ops;
const struct mlxsw_sp_span_ops *span_ops;
@@ -315,9 +317,7 @@ struct mlxsw_sp_port {
struct mlxsw_sp_ptp_port_stats stats;
} ptp;
u8 split_base_local_port;
struct {
struct delayed_work speed_update_dw;
} span;
struct delayed_work speed_update_dw;
struct mlxsw_sp_pb *pb;
};

@@ -463,11 +463,17 @@ enum mlxsw_sp_pb_manual_level {
};

struct mlxsw_sp_pb {
/* Headroom configuration. */
struct mlxsw_sp_pb_buffer buffer[MLXSW_SP_PB_COUNT];
u32 int_buf_size_cells;
u8 prio2buffer[IEEE_8021Q_MAX_PRIORITIES];

/* Source configuration. */
enum mlxsw_sp_pb_manual_level manual_level;
int delay_bytes;
int mtu;
enum mlxsw_sp_pb_manual_level manual_level;
u32 speed;
bool int_buf;
};

int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp);
@@ -511,12 +517,15 @@ u32 mlxsw_sp_cells_bytes(const struct mlxsw_sp *mlxsw_sp, u32 cells);
u32 mlxsw_sp_bytes_cells(const struct mlxsw_sp *mlxsw_sp, u32 bytes);
u32 mlxsw_sp_sb_max_headroom_cells(const struct mlxsw_sp *mlxsw_sp);
int mlxsw_sp_pbs_configure(struct mlxsw_sp_port *mlxsw_sp_port, const struct mlxsw_sp_pb *pb);
void mlxsw_sp_pbs_autoresize(const struct mlxsw_sp_port *mlxsw_sp_port,
struct mlxsw_sp_pb *pb);
int mlxsw_sp_pbs_autoresize(struct mlxsw_sp_port *mlxsw_sp_port, struct mlxsw_sp_pb *pb);

extern const struct mlxsw_sp_sb_vals mlxsw_sp1_sb_vals;
extern const struct mlxsw_sp_sb_vals mlxsw_sp2_sb_vals;

extern const struct mlxsw_sp_sb_ops mlxsw_sp1_sb_ops;
extern const struct mlxsw_sp_sb_ops mlxsw_sp2_sb_ops;
extern const struct mlxsw_sp_sb_ops mlxsw_sp3_sb_ops;

/* spectrum_switchdev.c */
int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp);
void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp);

0 comments on commit 9695d59

Please sign in to comment.