From: Hannes Reinecke <h...@suse.de> Add option '--link-retry' to modify the number of link retries. And decrease the default number of retries to 20.
Signed-off-by: Hannes Reinecke <h...@suse.de> Signed-off-by: Robert Love <robert.w.l...@intel.com> --- doc/fipvlan.8 | 9 ++++++++- doc/fipvlan.txt | 7 ++++++- fipvlan.c | 11 +++++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/doc/fipvlan.8 b/doc/fipvlan.8 index 641632c..ba9daf7 100644 --- a/doc/fipvlan.8 +++ b/doc/fipvlan.8 @@ -22,7 +22,8 @@ fipvlan \- Fibre Channel over Ethernet VLAN Discovery .sp \fBfipvlan\fR [\-c|\-\-create] [\-s|\-\-start] \fIinterfaces\fR .sp -\fBfipvlan\fR \-a|\-\-auto [\-c|\-\-create] [\-d|\-\-debug] [\-s|\-\-start] +\fBfipvlan\fR \-a|\-\-auto [\-c|\-\-create] [\-d|\-\-debug] +[\-s|\-\-start] [\-l|\-\-link-retry <num>] .sp \fBfipvlan\fR \-h|\-\-help .sp @@ -77,6 +78,12 @@ initiator on discovered FCoE VLANs Append the specified string \fI<suffix string>\fR to VLAN interface names. .RE .PP +\fB\-l\fR, \fB\-\-link-retry \fI<number of retries>\fR +.RS 4 +Retry check for link up up to \fI<number of retries>\fR times. The +link state is retried every 500 ms. The default is 20. +.RE +.PP \fB\-h\fR, \fB\-\-help\fR .RS 4 Display a help message with basic usage instructions diff --git a/doc/fipvlan.txt b/doc/fipvlan.txt index ed1ad4f..fc63536 100644 --- a/doc/fipvlan.txt +++ b/doc/fipvlan.txt @@ -21,7 +21,8 @@ SYNOPSIS -------- *fipvlan* [-c|--create] [-s|--start] _interfaces_ -*fipvlan* -a|--auto [-c|--create] [-d|--debug] [-s|--start] +*fipvlan* -a|--auto [-c|--create] [-d|--debug] + [-s|--start] [-l|--link-retry _count_] *fipvlan* -h|--help @@ -66,6 +67,10 @@ OPTIONS *-f*, *--suffix* _suffix_:: Append the specified string _suffix_ to VLAN interface names. +*-l*, *--link-retry* _count_:: + Retry check for link up to _count_ times. The link state is + checked every 500 ms. The default number of retries is 20. + *-h*, *--help*:: Display a help message with basic usage instructions diff --git a/fipvlan.c b/fipvlan.c index 2eb0bed..4152caf 100644 --- a/fipvlan.c +++ b/fipvlan.c @@ -64,6 +64,7 @@ struct { bool create; bool start; bool debug; + int link_retry; char suffix[256]; } config = { .namev = NULL, @@ -71,6 +72,7 @@ struct { .automode = false, .create = false, .debug = false, + .link_retry = 20, .suffix = "", }; @@ -406,7 +408,7 @@ void rtnl_recv_newlink(struct nlmsghdr *nh) /* command line arguments */ -#define GETOPT_STR "acdf:shv" +#define GETOPT_STR "acdf:l:shv" static const struct option long_options[] = { { "auto", no_argument, NULL, 'a' }, @@ -414,6 +416,7 @@ static const struct option long_options[] = { { "start", no_argument, NULL, 's' }, { "debug", no_argument, NULL, 'd' }, { "suffix", required_argument, NULL, 'f' }, + { "link-retry", required_argument, NULL, 'l' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'v' }, { NULL, 0, NULL, 0 } @@ -429,6 +432,7 @@ static void help(int status) " -d, --debug Enable debugging output\n" " -s, --start Start FCoE login automatically\n" " -f, --suffix Append the suffix to VLAN interface name\n" + " -l, --link-retry Number of retries for link up\n" " -h, --help Display this help and exit\n" " -v, --version Display version information and exit\n", exe); @@ -461,6 +465,9 @@ void parse_cmdline(int argc, char **argv) if (optarg && strlen(optarg)) strncpy(config.suffix, optarg, 256); break; + case 'l': + config.link_retry = strtoul(optarg, NULL, 10); + break; case 'h': help(0); break; @@ -691,7 +698,7 @@ void do_vlan_discovery(void) int skipped = 0; retry: skipped += send_vlan_requests(); - if (skipped && skip_retry_count++ < 30) { + if (skipped && skip_retry_count++ < config.link_retry) { FIP_LOG_DBG("waiting for IFF_RUNNING [%d]\n", skip_retry_count); recv_loop(500); skipped = 0; _______________________________________________ devel mailing list devel@open-fcoe.org https://lists.open-fcoe.org/mailman/listinfo/devel