diff mbox series

[for-next,4/4] RDMA/rxe: Remove rxe_link_layer()

Message ID 20200703153428.173758-5-kamalheib1@gmail.com (mailing list archive)
State Superseded
Headers show
Series RDMA/rxe: Cleanups and improvements | expand

Commit Message

Kamal Heib July 3, 2020, 3:34 p.m. UTC
Instead of return IB_LINK_LAYER_ETHERNET from rxe_link_layer return it
directly from get_link_layer callback and remove rxe_link_layer().

Fixes: 8700e3e7c485 ("Soft RoCE driver")
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/sw/rxe/rxe_loc.h   | 1 -
 drivers/infiniband/sw/rxe/rxe_net.c   | 5 -----
 drivers/infiniband/sw/rxe/rxe_verbs.c | 4 +---
 3 files changed, 1 insertion(+), 9 deletions(-)

Comments

Zhu Yanjun July 4, 2020, 4:18 a.m. UTC | #1
On Fri, Jul 3, 2020 at 11:35 PM Kamal Heib <kamalheib1@gmail.com> wrote:
>
> Instead of

return

returning?

 IB_LINK_LAYER_ETHERNET from rxe_link_layer return it
> directly from get_link_layer callback and remove rxe_link_layer().
>
> Fixes: 8700e3e7c485 ("Soft RoCE driver")
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_loc.h   | 1 -
>  drivers/infiniband/sw/rxe/rxe_net.c   | 5 -----
>  drivers/infiniband/sw/rxe/rxe_verbs.c | 4 +---
>  3 files changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h
> index 0688928cf2b1..39dc3bfa5d5d 100644
> --- a/drivers/infiniband/sw/rxe/rxe_loc.h
> +++ b/drivers/infiniband/sw/rxe/rxe_loc.h
> @@ -142,7 +142,6 @@ int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb);
>  struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
>                                 int paylen, struct rxe_pkt_info *pkt);
>  int rxe_prepare(struct rxe_pkt_info *pkt, struct sk_buff *skb, u32 *crc);
> -enum rdma_link_layer rxe_link_layer(struct rxe_dev *rxe, unsigned int port_num);
>  const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num);
>  struct device *rxe_dma_device(struct rxe_dev *rxe);
>  int rxe_mcast_add(struct rxe_dev *rxe, union ib_gid *mgid);
> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
> index 312c2fc961c0..0c3808611f95 100644
> --- a/drivers/infiniband/sw/rxe/rxe_net.c
> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
> @@ -520,11 +520,6 @@ const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num)
>         return rxe->ndev->name;
>  }
>
> -enum rdma_link_layer rxe_link_layer(struct rxe_dev *rxe, unsigned int port_num)
> -{
> -       return IB_LINK_LAYER_ETHERNET;
> -}
> -
>  int rxe_net_add(const char *ibdev_name, struct net_device *ndev)
>  {
>         int err;
> diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
> index ee80b8862db8..a3cf9bbe818d 100644
> --- a/drivers/infiniband/sw/rxe/rxe_verbs.c
> +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
> @@ -141,9 +141,7 @@ static int rxe_modify_port(struct ib_device *dev,
>  static enum rdma_link_layer rxe_get_link_layer(struct ib_device *dev,
>                                                u8 port_num)
>  {
> -       struct rxe_dev *rxe = to_rdev(dev);
> -
> -       return rxe_link_layer(rxe, port_num);
> +       return IB_LINK_LAYER_ETHERNET;
>  }
>
>  static int rxe_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata)
> --
> 2.25.4
>
Zhu Yanjun July 5, 2020, 1:49 a.m. UTC | #2
On Fri, Jul 3, 2020 at 11:35 PM Kamal Heib <kamalheib1@gmail.com> wrote:
>
> Instead of return IB_LINK_LAYER_ETHERNET from rxe_link_layer return it
> directly from get_link_layer callback and remove rxe_link_layer().
>
> Fixes: 8700e3e7c485 ("Soft RoCE driver")
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_loc.h   | 1 -
>  drivers/infiniband/sw/rxe/rxe_net.c   | 5 -----
>  drivers/infiniband/sw/rxe/rxe_verbs.c | 4 +---
>  3 files changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h
> index 0688928cf2b1..39dc3bfa5d5d 100644
> --- a/drivers/infiniband/sw/rxe/rxe_loc.h
> +++ b/drivers/infiniband/sw/rxe/rxe_loc.h
> @@ -142,7 +142,6 @@ int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb);
>  struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
>                                 int paylen, struct rxe_pkt_info *pkt);
>  int rxe_prepare(struct rxe_pkt_info *pkt, struct sk_buff *skb, u32 *crc);
> -enum rdma_link_layer rxe_link_layer(struct rxe_dev *rxe, unsigned int port_num);
>  const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num);
>  struct device *rxe_dma_device(struct rxe_dev *rxe);
>  int rxe_mcast_add(struct rxe_dev *rxe, union ib_gid *mgid);
> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
> index 312c2fc961c0..0c3808611f95 100644
> --- a/drivers/infiniband/sw/rxe/rxe_net.c
> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
> @@ -520,11 +520,6 @@ const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num)
>         return rxe->ndev->name;
>  }
>
> -enum rdma_link_layer rxe_link_layer(struct rxe_dev *rxe, unsigned int port_num)
> -{
> -       return IB_LINK_LAYER_ETHERNET;
> -}

This is a wrapper function.

Zhu Yanjun
> -
>  int rxe_net_add(const char *ibdev_name, struct net_device *ndev)
>  {
>         int err;
> diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
> index ee80b8862db8..a3cf9bbe818d 100644
> --- a/drivers/infiniband/sw/rxe/rxe_verbs.c
> +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
> @@ -141,9 +141,7 @@ static int rxe_modify_port(struct ib_device *dev,
>  static enum rdma_link_layer rxe_get_link_layer(struct ib_device *dev,
>                                                u8 port_num)
>  {
> -       struct rxe_dev *rxe = to_rdev(dev);
> -
> -       return rxe_link_layer(rxe, port_num);
> +       return IB_LINK_LAYER_ETHERNET;
>  }
>
>  static int rxe_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata)
> --
> 2.25.4
>
Leon Romanovsky July 5, 2020, 7:46 a.m. UTC | #3
On Sun, Jul 05, 2020 at 09:49:31AM +0800, Zhu Yanjun wrote:
> On Fri, Jul 3, 2020 at 11:35 PM Kamal Heib <kamalheib1@gmail.com> wrote:
> >
> > Instead of return IB_LINK_LAYER_ETHERNET from rxe_link_layer return it
> > directly from get_link_layer callback and remove rxe_link_layer().
> >
> > Fixes: 8700e3e7c485 ("Soft RoCE driver")
> > Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> > ---
> >  drivers/infiniband/sw/rxe/rxe_loc.h   | 1 -
> >  drivers/infiniband/sw/rxe/rxe_net.c   | 5 -----
> >  drivers/infiniband/sw/rxe/rxe_verbs.c | 4 +---
> >  3 files changed, 1 insertion(+), 9 deletions(-)
> >
> > diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h
> > index 0688928cf2b1..39dc3bfa5d5d 100644
> > --- a/drivers/infiniband/sw/rxe/rxe_loc.h
> > +++ b/drivers/infiniband/sw/rxe/rxe_loc.h
> > @@ -142,7 +142,6 @@ int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb);
> >  struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
> >                                 int paylen, struct rxe_pkt_info *pkt);
> >  int rxe_prepare(struct rxe_pkt_info *pkt, struct sk_buff *skb, u32 *crc);
> > -enum rdma_link_layer rxe_link_layer(struct rxe_dev *rxe, unsigned int port_num);
> >  const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num);
> >  struct device *rxe_dma_device(struct rxe_dev *rxe);
> >  int rxe_mcast_add(struct rxe_dev *rxe, union ib_gid *mgid);
> > diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
> > index 312c2fc961c0..0c3808611f95 100644
> > --- a/drivers/infiniband/sw/rxe/rxe_net.c
> > +++ b/drivers/infiniband/sw/rxe/rxe_net.c
> > @@ -520,11 +520,6 @@ const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num)
> >         return rxe->ndev->name;
> >  }
> >
> > -enum rdma_link_layer rxe_link_layer(struct rxe_dev *rxe, unsigned int port_num)
> > -{
> > -       return IB_LINK_LAYER_ETHERNET;
> > -}
>
> This is a wrapper function.

What does one-time used/one-line wrapper function give us?

Thanks
Kamal Heib July 5, 2020, 10:27 a.m. UTC | #4
On Sat, Jul 04, 2020 at 12:18:36PM +0800, Zhu Yanjun wrote:
> On Fri, Jul 3, 2020 at 11:35 PM Kamal Heib <kamalheib1@gmail.com> wrote:
> >
> > Instead of
> 
> return
> 
> returning?
>

I'll fix it in v2.

Thanks,
Kamal

>  IB_LINK_LAYER_ETHERNET from rxe_link_layer return it
> > directly from get_link_layer callback and remove rxe_link_layer().
> >
> > Fixes: 8700e3e7c485 ("Soft RoCE driver")
> > Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> > ---
> >  drivers/infiniband/sw/rxe/rxe_loc.h   | 1 -
> >  drivers/infiniband/sw/rxe/rxe_net.c   | 5 -----
> >  drivers/infiniband/sw/rxe/rxe_verbs.c | 4 +---
> >  3 files changed, 1 insertion(+), 9 deletions(-)
> >
> > diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h
> > index 0688928cf2b1..39dc3bfa5d5d 100644
> > --- a/drivers/infiniband/sw/rxe/rxe_loc.h
> > +++ b/drivers/infiniband/sw/rxe/rxe_loc.h
> > @@ -142,7 +142,6 @@ int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb);
> >  struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
> >                                 int paylen, struct rxe_pkt_info *pkt);
> >  int rxe_prepare(struct rxe_pkt_info *pkt, struct sk_buff *skb, u32 *crc);
> > -enum rdma_link_layer rxe_link_layer(struct rxe_dev *rxe, unsigned int port_num);
> >  const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num);
> >  struct device *rxe_dma_device(struct rxe_dev *rxe);
> >  int rxe_mcast_add(struct rxe_dev *rxe, union ib_gid *mgid);
> > diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
> > index 312c2fc961c0..0c3808611f95 100644
> > --- a/drivers/infiniband/sw/rxe/rxe_net.c
> > +++ b/drivers/infiniband/sw/rxe/rxe_net.c
> > @@ -520,11 +520,6 @@ const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num)
> >         return rxe->ndev->name;
> >  }
> >
> > -enum rdma_link_layer rxe_link_layer(struct rxe_dev *rxe, unsigned int port_num)
> > -{
> > -       return IB_LINK_LAYER_ETHERNET;
> > -}
> > -
> >  int rxe_net_add(const char *ibdev_name, struct net_device *ndev)
> >  {
> >         int err;
> > diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
> > index ee80b8862db8..a3cf9bbe818d 100644
> > --- a/drivers/infiniband/sw/rxe/rxe_verbs.c
> > +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
> > @@ -141,9 +141,7 @@ static int rxe_modify_port(struct ib_device *dev,
> >  static enum rdma_link_layer rxe_get_link_layer(struct ib_device *dev,
> >                                                u8 port_num)
> >  {
> > -       struct rxe_dev *rxe = to_rdev(dev);
> > -
> > -       return rxe_link_layer(rxe, port_num);
> > +       return IB_LINK_LAYER_ETHERNET;
> >  }
> >
> >  static int rxe_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata)
> > --
> > 2.25.4
> >
Kamal Heib July 5, 2020, 10:30 a.m. UTC | #5
On Sun, Jul 05, 2020 at 09:49:31AM +0800, Zhu Yanjun wrote:
> On Fri, Jul 3, 2020 at 11:35 PM Kamal Heib <kamalheib1@gmail.com> wrote:
> >
> > Instead of return IB_LINK_LAYER_ETHERNET from rxe_link_layer return it
> > directly from get_link_layer callback and remove rxe_link_layer().
> >
> > Fixes: 8700e3e7c485 ("Soft RoCE driver")
> > Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> > ---
> >  drivers/infiniband/sw/rxe/rxe_loc.h   | 1 -
> >  drivers/infiniband/sw/rxe/rxe_net.c   | 5 -----
> >  drivers/infiniband/sw/rxe/rxe_verbs.c | 4 +---
> >  3 files changed, 1 insertion(+), 9 deletions(-)
> >
> > diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h
> > index 0688928cf2b1..39dc3bfa5d5d 100644
> > --- a/drivers/infiniband/sw/rxe/rxe_loc.h
> > +++ b/drivers/infiniband/sw/rxe/rxe_loc.h
> > @@ -142,7 +142,6 @@ int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb);
> >  struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
> >                                 int paylen, struct rxe_pkt_info *pkt);
> >  int rxe_prepare(struct rxe_pkt_info *pkt, struct sk_buff *skb, u32 *crc);
> > -enum rdma_link_layer rxe_link_layer(struct rxe_dev *rxe, unsigned int port_num);
> >  const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num);
> >  struct device *rxe_dma_device(struct rxe_dev *rxe);
> >  int rxe_mcast_add(struct rxe_dev *rxe, union ib_gid *mgid);
> > diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
> > index 312c2fc961c0..0c3808611f95 100644
> > --- a/drivers/infiniband/sw/rxe/rxe_net.c
> > +++ b/drivers/infiniband/sw/rxe/rxe_net.c
> > @@ -520,11 +520,6 @@ const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num)
> >         return rxe->ndev->name;
> >  }
> >
> > -enum rdma_link_layer rxe_link_layer(struct rxe_dev *rxe, unsigned int port_num)
> > -{
> > -       return IB_LINK_LAYER_ETHERNET;
> > -}
> 
> This is a wrapper function.

Correct, but it's used only once.
So, I don't see the point of having it.

Thanks,
Kamal

> 
> Zhu Yanjun
> > -
> >  int rxe_net_add(const char *ibdev_name, struct net_device *ndev)
> >  {
> >         int err;
> > diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
> > index ee80b8862db8..a3cf9bbe818d 100644
> > --- a/drivers/infiniband/sw/rxe/rxe_verbs.c
> > +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
> > @@ -141,9 +141,7 @@ static int rxe_modify_port(struct ib_device *dev,
> >  static enum rdma_link_layer rxe_get_link_layer(struct ib_device *dev,
> >                                                u8 port_num)
> >  {
> > -       struct rxe_dev *rxe = to_rdev(dev);
> > -
> > -       return rxe_link_layer(rxe, port_num);
> > +       return IB_LINK_LAYER_ETHERNET;
> >  }
> >
> >  static int rxe_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata)
> > --
> > 2.25.4
> >
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h
index 0688928cf2b1..39dc3bfa5d5d 100644
--- a/drivers/infiniband/sw/rxe/rxe_loc.h
+++ b/drivers/infiniband/sw/rxe/rxe_loc.h
@@ -142,7 +142,6 @@  int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb);
 struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
 				int paylen, struct rxe_pkt_info *pkt);
 int rxe_prepare(struct rxe_pkt_info *pkt, struct sk_buff *skb, u32 *crc);
-enum rdma_link_layer rxe_link_layer(struct rxe_dev *rxe, unsigned int port_num);
 const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num);
 struct device *rxe_dma_device(struct rxe_dev *rxe);
 int rxe_mcast_add(struct rxe_dev *rxe, union ib_gid *mgid);
diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
index 312c2fc961c0..0c3808611f95 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -520,11 +520,6 @@  const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num)
 	return rxe->ndev->name;
 }
 
-enum rdma_link_layer rxe_link_layer(struct rxe_dev *rxe, unsigned int port_num)
-{
-	return IB_LINK_LAYER_ETHERNET;
-}
-
 int rxe_net_add(const char *ibdev_name, struct net_device *ndev)
 {
 	int err;
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index ee80b8862db8..a3cf9bbe818d 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -141,9 +141,7 @@  static int rxe_modify_port(struct ib_device *dev,
 static enum rdma_link_layer rxe_get_link_layer(struct ib_device *dev,
 					       u8 port_num)
 {
-	struct rxe_dev *rxe = to_rdev(dev);
-
-	return rxe_link_layer(rxe, port_num);
+	return IB_LINK_LAYER_ETHERNET;
 }
 
 static int rxe_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata)