netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Wise <swise@opengridcomputing.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: dsahern@gmail.com, stephen@networkplumber.org,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH v1 iproute2-next 3/4] rdma: add 'link add/delete' commands
Date: Tue, 26 Feb 2019 11:24:32 -0600	[thread overview]
Message-ID: <94c6a44c-6f08-ffe8-9798-a4faf14bd29a@opengridcomputing.com> (raw)
In-Reply-To: <20190223094311.GP23561@mtr-leonro.mtl.com>


On 2/23/2019 3:43 AM, Leon Romanovsky wrote:
> On Thu, Feb 21, 2019 at 08:19:12AM -0800, 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 <swise@opengridcomputing.com>
>> ---
>>  rdma/link.c  | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  rdma/rdma.h  |  1 +
>>  rdma/utils.c |  2 +-
>>  3 files changed, 69 insertions(+), 1 deletion(-)
>>
>> diff --git a/rdma/link.c b/rdma/link.c
>> index c064be627be2..afaf19663728 100644
>> --- a/rdma/link.c
>> +++ b/rdma/link.c
>> @@ -14,6 +14,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;
>>  }
>>
>> @@ -341,10 +344,74 @@ static int link_show(struct rd *rd)
>>  	return rd_exec_link(rd, link_one_show, true);
>>  }
>>
>> +static int link_add(struct rd *rd)
>> +{
>> +	char *name;
>> +	char *type = NULL;
>> +	char *dev = NULL;
>> +	uint32_t seq;
>> +
>> +	if (rd_no_arg(rd)) {
>> +		pr_err("No link name was supplied\n");
> I think that it is better to have instruction message and not error
> message: "Please provide ...".


Ok.  Perhaps a new utility rd_exec_require_link() can be created?


>> +		return -EINVAL;
>> +	}
>> +	name = rd_argv(rd);
>> +	rd_arg_inc(rd);
>> +	while (!rd_no_arg(rd)) {
>> +		if (rd_argv_match(rd, "type")) {
>> +			rd_arg_inc(rd);
>> +			type = rd_argv(rd);
>> +		} else if (rd_argv_match(rd, "netdev")) {
>> +			rd_arg_inc(rd);
>> +			dev = rd_argv(rd);
>> +		} else {
>> +			pr_err("Invalid parameter %s\n", rd_argv(rd));
>> +			return -EINVAL;
>> +		}
>> +		rd_arg_inc(rd);
> Please use chains of struct rd_cmd and rd_exec_cmd() instead of
> open-coding parser.


Ok.  Like your recently merged series did...


>> +	}
>> +	if (!type) {
>> +		pr_err("No type was supplied\n");
>> +		return -EINVAL;
> General parser handle it.


Ok.


>> +	}
>> +	if (!dev) {
>> +		pr_err("No net device was supplied\n");
>> +		return -EINVAL;
>> +	}
> rd_exec_require_dev() ???


Looks like I can use that.  I'll try it.


Thanks!


Steve.



  reply	other threads:[~2019-02-26 17:24 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-21 18:22 [PATCH v1 iproute2-next 0/4] Dynamic rdma link creation Steve Wise
2019-02-21 16:19 ` [PATCH v1 iproute2-next 1/4] rdma: add helper rd_sendrecv_msg() Steve Wise
2019-02-23  9:26   ` Leon Romanovsky
2019-02-23  9:31     ` Leon Romanovsky
2019-02-26 17:19       ` Steve Wise
2019-02-26 19:16         ` Leon Romanovsky
2019-02-26 19:55           ` Steve Wise
2019-02-26 19:55         ` David Ahern
2019-02-26 17:13     ` Steve Wise
2019-02-27 20:23       ` Steve Wise
2019-03-03 13:50         ` Leon Romanovsky
2019-03-04 14:13           ` Steve Wise
2019-03-06 21:50             ` Steve Wise
2019-03-07  8:33               ` Leon Romanovsky
2019-02-28 19:41     ` Steve Wise
2019-02-28 19:56       ` Leon Romanovsky
2019-02-28 20:10         ` Steve Wise
2019-02-21 16:19 ` [PATCH v1 iproute2-next 2/4] Sync up rdma_netlink.h Steve Wise
2019-02-21 18:56   ` Stephen Hemminger
2019-02-21 22:10     ` Leon Romanovsky
2019-02-21 23:11     ` Jason Gunthorpe
2019-02-23  9:28   ` Leon Romanovsky
2019-02-26 17:15     ` Steve Wise
2019-02-21 16:19 ` [PATCH v1 iproute2-next 3/4] rdma: add 'link add/delete' commands Steve Wise
2019-02-21 23:14   ` Jason Gunthorpe
2019-02-23  9:43   ` Leon Romanovsky
2019-02-26 17:24     ` Steve Wise [this message]
2019-02-27 21:18       ` Steve Wise
2019-02-21 16:19 ` [PATCH v1 iproute2-next 4/4] rdma: man page update for link add/delete Steve Wise

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=94c6a44c-6f08-ffe8-9798-a4faf14bd29a@opengridcomputing.com \
    --to=swise@opengridcomputing.com \
    --cc=dsahern@gmail.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).