On Wed, Dec 05, 2018 at 07:14:20AM -0800, Steve Wise wrote: > Add support for the RDMA_NLDEV_CMD_NEWLINK/DELLINK messages which allow > dynamically adding new RXE links. Deprecate the old module options > for now. > > Cc: Moni Shoua <monis@xxxxxxxxxxxx> > Reviewed-by: Yanjun Zhu <yanjun.zhu@xxxxxxxxxx> > Signed-off-by: Steve Wise <swise@xxxxxxxxxxxxxxxxxxxxx> > --- > drivers/infiniband/sw/rxe/rxe.c | 66 +++++++++++++++++++++++++++++++++-- > drivers/infiniband/sw/rxe/rxe.h | 3 +- > drivers/infiniband/sw/rxe/rxe_net.c | 21 +++++++++-- > drivers/infiniband/sw/rxe/rxe_net.h | 2 +- > drivers/infiniband/sw/rxe/rxe_sysfs.c | 6 ++-- > drivers/infiniband/sw/rxe/rxe_verbs.c | 4 +-- > drivers/infiniband/sw/rxe/rxe_verbs.h | 2 +- > 7 files changed, 92 insertions(+), 12 deletions(-) > > diff --git a/drivers/infiniband/sw/rxe/rxe.c b/drivers/infiniband/sw/rxe/rxe.c > index 19d8e522b72b..b98141442cb2 100644 > --- a/drivers/infiniband/sw/rxe/rxe.c > +++ b/drivers/infiniband/sw/rxe/rxe.c > @@ -31,6 +31,7 @@ > * SOFTWARE. > */ > > +#include <rdma/rdma_netlink.h> > #include <net/addrconf.h> > #include "rxe.h" > #include "rxe_loc.h" > @@ -309,7 +310,7 @@ void rxe_set_mtu(struct rxe_dev *rxe, unsigned int ndev_mtu) > /* called by ifc layer to create new rxe device. > * The caller should allocate memory for rxe by calling ib_alloc_device. > */ > -int rxe_add(struct rxe_dev *rxe, unsigned int mtu) > +int rxe_add(struct rxe_dev *rxe, unsigned int mtu, const char *ibdev_name) > { > int err; > > @@ -321,7 +322,7 @@ int rxe_add(struct rxe_dev *rxe, unsigned int mtu) > > rxe_set_mtu(rxe, mtu); > > - err = rxe_register_device(rxe); > + err = rxe_register_device(rxe, ibdev_name); > if (err) > goto err1; > > @@ -332,6 +333,63 @@ int rxe_add(struct rxe_dev *rxe, unsigned int mtu) > return err; > } > > +static struct ib_device *rxe_newlink(const char *ibdev_name, > + const char *ndev_name) > +{ > + struct net_device *ndev = NULL; > + struct rxe_dev *rxe; > + int err = 0; > + > + ndev = dev_get_by_name(&init_net, ndev_name); > + if (!ndev) { > + pr_err("interface %s not found\n", ndev_name); > + err = -ENODEV; > + goto err; > + } > + > + rxe = net_to_rxe(ndev); > + if (rxe) { > + pr_err("already configured on %s\n", ndev_name); > + err = -EEXIST; > + rxe_dev_put(rxe); > + goto err; > + } Shouldn't the code above be part of core logic instead of being in driver? Thanks
Attachment:
signature.asc
Description: PGP signature