Re: [PATCH v2 iproute2-next 3/4] rdma: add 'link add/delete' commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 1, 2019 at 1:37 AM Leon Romanovsky <leon@xxxxxxxxxx> wrote:
>
> On Tue, Mar 26, 2019 at 02:18:29PM -0500, Steve Wise wrote:
> > Add new 'link' subcommand 'add' and 'delete' to allow binding a soft-rdma
> > device to a netdev interface.
> >
> > EG:
> >
> > rdma link add rxe_eth0 type rxe netdev eth0
> > rdma link delete rxe_eth0
> >
> > Signed-off-by: Steve Wise <larrystevenwise@xxxxxxxxx>
> > ---
> >  rdma/link.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  rdma/rdma.h |  2 ++
> >  2 files changed, 85 insertions(+)
> >
> > diff --git a/rdma/link.c b/rdma/link.c
> > index 89e81b84..982c2b16 100644
> > --- a/rdma/link.c
> > +++ b/rdma/link.c
> > @@ -9,6 +9,9 @@
> >  static int link_help(struct rd *rd)
> >  {
> >       pr_out("Usage: %s link show [DEV/PORT_INDEX]\n", rd->filename);
> > +     pr_out("Usage: %s link add NAME type TYPE netdev NETDEV\n",
> > +            rd->filename);
> > +     pr_out("Usage: %s link delete NAME\n", rd->filename);
> >       return 0;
> >  }
> >
> > @@ -336,10 +339,90 @@ static int link_show(struct rd *rd)
> >       return rd_exec_link(rd, link_one_show, true);
> >  }
> >
> > +static int link_add_netdev(struct rd *rd)
> > +{
> > +     rd->link_netdev = rd_argv(rd);
> > +     rd_arg_inc(rd);
> > +     return 0;
> > +}
> > +
> > +static int link_add_type(struct rd *rd)
> > +{
> > +     const struct rd_cmd cmds[] = {
> > +             { NULL,         link_help},
> > +             { "netdev",     link_add_netdev},
> > +             { 0 }
> > +     };
> > +     rd->link_type = rd_argv(rd);
> > +     rd_arg_inc(rd);
> > +     return rd_exec_cmd(rd, cmds, "parameter");
> > +}
> > +
> > +static int link_add(struct rd *rd)
> > +{
> > +     const struct rd_cmd cmds[] = {
> > +             { NULL,         link_help},
> > +             { "type",       link_add_type},
> > +             { 0 }
> > +     };
> > +
> > +     uint32_t seq;
> > +     char *name;
> > +     int ret;
> > +
> > +     if (rd_no_arg(rd)) {
> > +             pr_err("Please provide a link name to add.\n");
> > +             return -EINVAL;
> > +     }
> > +     name = rd_argv(rd);
> > +     rd_arg_inc(rd);
> > +
> > +     ret = rd_exec_cmd(rd, cmds, "parameter");
> > +     if (ret)
> > +             return ret;
> > +
> > +     if (!rd->link_type) {
> > +             pr_err("Please provide a link type name.\n");
> > +             return -EINVAL;
> > +     }
> > +     if (!rd->link_netdev) {
> > +             pr_err("Please provide a net device name.\n");
> > +             return -EINVAL;
> > +     }
>
> After a little bit more thinking, the checks above are supposed to be
> part of rd_exec_cmd() execution of chains. E.g if (!rd->link_type) needs
> to be inside link_add_type().
>

Ok.  I'll respin and add your reviewed-by tags.

Thanks,
Steve



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux