Message ID | 20201101201542.2027568-12-leon@kernel.org (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [mlx5-next,v1,01/11] net/mlx5: Don't skip vport check | expand |
On 2020-11-01 10:15 PM, Leon Romanovsky wrote: > From: Leon Romanovsky <leonro@nvidia.com> > > Delete dead code. > > Signed-off-by: Leon Romanovsky <leonro@nvidia.com> > --- > drivers/infiniband/hw/mlx5/ib_rep.c | 31 +++++++---------------------- > drivers/infiniband/hw/mlx5/ib_rep.h | 31 ----------------------------- > 2 files changed, 7 insertions(+), 55 deletions(-) > > diff --git a/drivers/infiniband/hw/mlx5/ib_rep.c b/drivers/infiniband/hw/mlx5/ib_rep.c > index 9810bdd7f3bc..a1a9450ed92c 100644 > --- a/drivers/infiniband/hw/mlx5/ib_rep.c > +++ b/drivers/infiniband/hw/mlx5/ib_rep.c > @@ -13,7 +13,7 @@ mlx5_ib_set_vport_rep(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep) > struct mlx5_ib_dev *ibdev; > int vport_index; > > - ibdev = mlx5_ib_get_uplink_ibdev(dev->priv.eswitch); > + ibdev = mlx5_eswitch_uplink_get_proto_dev(dev->priv.eswitch, REP_IB); > vport_index = rep->vport_index; > > ibdev->port[vport_index].rep = rep; > @@ -74,6 +74,11 @@ mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep) > return ret; > } > > +static void *mlx5_ib_rep_to_dev(struct mlx5_eswitch_rep *rep) > +{ > + return rep->rep_data[REP_IB].priv; > +} > + > static void > mlx5_ib_vport_rep_unload(struct mlx5_eswitch_rep *rep) > { > @@ -91,40 +96,18 @@ mlx5_ib_vport_rep_unload(struct mlx5_eswitch_rep *rep) > __mlx5_ib_remove(dev, dev->profile, MLX5_IB_STAGE_MAX); > } > > -static void *mlx5_ib_vport_get_proto_dev(struct mlx5_eswitch_rep *rep) > -{ > - return mlx5_ib_rep_to_dev(rep); > -} > - > static const struct mlx5_eswitch_rep_ops rep_ops = { > .load = mlx5_ib_vport_rep_load, > .unload = mlx5_ib_vport_rep_unload, > - .get_proto_dev = mlx5_ib_vport_get_proto_dev, > + .get_proto_dev = mlx5_ib_rep_to_dev, > }; > > -struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw, > - u16 vport_num) > -{ > - return mlx5_eswitch_get_proto_dev(esw, vport_num, REP_IB); > -} > - > struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw, > u16 vport_num) > { > return mlx5_eswitch_get_proto_dev(esw, vport_num, REP_ETH); > } > > -struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw) > -{ > - return mlx5_eswitch_uplink_get_proto_dev(esw, REP_IB); > -} > - > -struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw, > - u16 vport_num) > -{ > - return mlx5_eswitch_vport_rep(esw, vport_num); > -} > - > struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev, > struct mlx5_ib_sq *sq, > u16 port) > diff --git a/drivers/infiniband/hw/mlx5/ib_rep.h b/drivers/infiniband/hw/mlx5/ib_rep.h > index 93f562735e89..ce1dcb105dbd 100644 > --- a/drivers/infiniband/hw/mlx5/ib_rep.h > +++ b/drivers/infiniband/hw/mlx5/ib_rep.h > @@ -12,11 +12,6 @@ > extern const struct mlx5_ib_profile raw_eth_profile; > > #ifdef CONFIG_MLX5_ESWITCH > -struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw, > - u16 vport_num); > -struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw); > -struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw, > - u16 vport_num); > int mlx5r_rep_init(void); > void mlx5r_rep_cleanup(void); > struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev, > @@ -25,26 +20,6 @@ struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev, > struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw, > u16 vport_num); > #else /* CONFIG_MLX5_ESWITCH */ > -static inline > -struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw, > - u16 vport_num) > -{ > - return NULL; > -} > - > -static inline > -struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw) > -{ > - return NULL; > -} > - > -static inline > -struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw, > - u16 vport_num) > -{ > - return NULL; > -} > - > static inline int mlx5r_rep_init(void) { return 0; } > static inline void mlx5r_rep_cleanup(void) {} > static inline > @@ -62,10 +37,4 @@ struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw, > return NULL; > } > #endif > - > -static inline > -struct mlx5_ib_dev *mlx5_ib_rep_to_dev(struct mlx5_eswitch_rep *rep) > -{ > - return rep->rep_data[REP_IB].priv; > -} > #endif /* __MLX5_IB_REP_H__ */ > -- > 2.28.0 > Reviewed-by: Roi Dayan <roid@nvidia.com>
diff --git a/drivers/infiniband/hw/mlx5/ib_rep.c b/drivers/infiniband/hw/mlx5/ib_rep.c index 9810bdd7f3bc..a1a9450ed92c 100644 --- a/drivers/infiniband/hw/mlx5/ib_rep.c +++ b/drivers/infiniband/hw/mlx5/ib_rep.c @@ -13,7 +13,7 @@ mlx5_ib_set_vport_rep(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep) struct mlx5_ib_dev *ibdev; int vport_index; - ibdev = mlx5_ib_get_uplink_ibdev(dev->priv.eswitch); + ibdev = mlx5_eswitch_uplink_get_proto_dev(dev->priv.eswitch, REP_IB); vport_index = rep->vport_index; ibdev->port[vport_index].rep = rep; @@ -74,6 +74,11 @@ mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep) return ret; } +static void *mlx5_ib_rep_to_dev(struct mlx5_eswitch_rep *rep) +{ + return rep->rep_data[REP_IB].priv; +} + static void mlx5_ib_vport_rep_unload(struct mlx5_eswitch_rep *rep) { @@ -91,40 +96,18 @@ mlx5_ib_vport_rep_unload(struct mlx5_eswitch_rep *rep) __mlx5_ib_remove(dev, dev->profile, MLX5_IB_STAGE_MAX); } -static void *mlx5_ib_vport_get_proto_dev(struct mlx5_eswitch_rep *rep) -{ - return mlx5_ib_rep_to_dev(rep); -} - static const struct mlx5_eswitch_rep_ops rep_ops = { .load = mlx5_ib_vport_rep_load, .unload = mlx5_ib_vport_rep_unload, - .get_proto_dev = mlx5_ib_vport_get_proto_dev, + .get_proto_dev = mlx5_ib_rep_to_dev, }; -struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw, - u16 vport_num) -{ - return mlx5_eswitch_get_proto_dev(esw, vport_num, REP_IB); -} - struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw, u16 vport_num) { return mlx5_eswitch_get_proto_dev(esw, vport_num, REP_ETH); } -struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw) -{ - return mlx5_eswitch_uplink_get_proto_dev(esw, REP_IB); -} - -struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw, - u16 vport_num) -{ - return mlx5_eswitch_vport_rep(esw, vport_num); -} - struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev, struct mlx5_ib_sq *sq, u16 port) diff --git a/drivers/infiniband/hw/mlx5/ib_rep.h b/drivers/infiniband/hw/mlx5/ib_rep.h index 93f562735e89..ce1dcb105dbd 100644 --- a/drivers/infiniband/hw/mlx5/ib_rep.h +++ b/drivers/infiniband/hw/mlx5/ib_rep.h @@ -12,11 +12,6 @@ extern const struct mlx5_ib_profile raw_eth_profile; #ifdef CONFIG_MLX5_ESWITCH -struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw, - u16 vport_num); -struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw); -struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw, - u16 vport_num); int mlx5r_rep_init(void); void mlx5r_rep_cleanup(void); struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev, @@ -25,26 +20,6 @@ struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev, struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw, u16 vport_num); #else /* CONFIG_MLX5_ESWITCH */ -static inline -struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw, - u16 vport_num) -{ - return NULL; -} - -static inline -struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw) -{ - return NULL; -} - -static inline -struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw, - u16 vport_num) -{ - return NULL; -} - static inline int mlx5r_rep_init(void) { return 0; } static inline void mlx5r_rep_cleanup(void) {} static inline @@ -62,10 +37,4 @@ struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw, return NULL; } #endif - -static inline -struct mlx5_ib_dev *mlx5_ib_rep_to_dev(struct mlx5_eswitch_rep *rep) -{ - return rep->rep_data[REP_IB].priv; -} #endif /* __MLX5_IB_REP_H__ */