Patchwork [Open-FCoE,6/8] fcoemon: Add a force legacy mode option

login
register
mail settings
Submitter Robert Love
Date March 5, 2013, 6:30 p.m.
Message ID <20130305183014.21625.15064.stgit@fritz>
Download mbox | patch
Permalink /patch/7/
State Accepted
Headers show

Comments

Robert Love - March 5, 2013, 6:30 p.m.
Add an option to fcoemon to force it to use the
legacy kernel interfaces.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Tested-by: Marcus Dennis <marcusx.e.dennis@intel.com>
---
 doc/fcoemon.8   |   22 ++++++++++++++++++----
 doc/fcoemon.txt |    6 +++++-
 fcoemon.c       |   16 +++++++++++-----
 3 files changed, 34 insertions(+), 10 deletions(-)

Patch

diff --git a/doc/fcoemon.8 b/doc/fcoemon.8
index 4323244..9aa3d66 100644
--- a/doc/fcoemon.8
+++ b/doc/fcoemon.8
@@ -1,13 +1,22 @@ 
 '\" t
 .\"     Title: fcoemon
 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\"      Date: 01/16/2012
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\"      Date: 10/08/2012
 .\"    Manual: Open-FCoE Tools
 .\"    Source: Open-FCoE
 .\"  Language: English
 .\"
-.TH "FCOEMON" "8" "01/16/2012" "Open\-FCoE" "Open\-FCoE Tools"
+.TH "FCOEMON" "8" "10/08/2012" "Open\-FCoE" "Open\-FCoE Tools"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el       .ds Aq '
 .\" -----------------------------------------------------------------
 .\" * set default formatting
 .\" -----------------------------------------------------------------
@@ -20,7 +29,7 @@ 
 fcoemon \- Open\-FCoE service daemon
 .SH "SYNOPSIS"
 .sp
-\fBfcoemon\fR [\-f|\-\-foreground] [\-d|\-\-debug] [\-s|\-\-syslog]
+\fBfcoemon\fR [\-f|\-\-foreground] [\-l|\-\-legacy] [\-d|\-\-debug] [\-s|\-\-syslog]
 .sp
 \fBfcoemon\fR \-h|\-\-help
 .sp
@@ -50,6 +59,11 @@  in the foreground\&.
 Enable debugging messages\&.
 .RE
 .PP
+\fB\-l\fR, \fB\-\-legacy\fR
+.RS 4
+Force fcoemon to use the legacy /sys/modlue/libfcoe/parameters/ interface\&. The default is to use the newer /sys/bus/fcoe/ interfaces if they are available\&.
+.RE
+.PP
 \fB\-s\fR, \fB\-\-syslog\fR
 .RS 4
 Use syslogd for logging\&. The default behavior is to log to stdout and stderr\&.
diff --git a/doc/fcoemon.txt b/doc/fcoemon.txt
index 9dc9ba2..f2f2ad3 100644
--- a/doc/fcoemon.txt
+++ b/doc/fcoemon.txt
@@ -19,7 +19,7 @@  fcoemon - Open-FCoE service daemon
 
 SYNOPSIS
 --------
-*fcoemon* [-f|--foreground] [-d|--debug] [-s|--syslog]
+*fcoemon* [-f|--foreground] [-l|--legacy] [-d|--debug] [-s|--syslog]
 
 *fcoemon* -h|--help
 
@@ -55,6 +55,10 @@  OPTIONS
 	Run *fcoemon* in the foreground.
 *-d*, *--debug*::
 	Enable debugging messages.
+*-l*, *--legacy*::
+	Force fcoemon to use the legacy /sys/modlue/libfcoe/parameters/
+	interface. The default is to use the newer /sys/bus/fcoe/ interfaces
+	if they are available.
 *-s*, *--syslog*::
 	Use syslogd for logging. The default behavior is to log to stdout
 	and stderr.
diff --git a/fcoemon.c b/fcoemon.c
index a7e3ae5..d7022ee 100644
--- a/fcoemon.c
+++ b/fcoemon.c
@@ -102,6 +102,7 @@ 
 #define CFG_IF_VAR_AUTOVLAN    "AUTO_VLAN"
 
 
+static bool force_legacy;
 static sigset_t block_sigset;
 
 void fcm_vlan_disc_timeout(void *arg);
@@ -301,6 +302,7 @@  static void clear_dcbd_info(struct fcm_netif *ff);
  */
 static struct option fcm_options[] = {
 	{"debug", 0, NULL, 'd'},
+	{"legacy", 0, NULL, 'l'},
 	{"syslog", 0, NULL, 's'},
 	{"exec", 1, NULL, 'e'},
 	{"foreground", 0, NULL, 'f'},
@@ -1729,12 +1731,12 @@  static void fcm_fcoe_init(void)
 	if (fcm_read_config_files())
 		exit(1);
 
-	if (!access(FCOE_BUS_CREATE, F_OK)) {
-		FCM_LOG_DBG("Using /sys/bus/fcoe interfaces\n");
-		libfcoe_control = &libfcoe_bus_tmpl;
-	} else {
+	if (force_legacy || access(FCOE_BUS_CREATE, F_OK)) {
 		FCM_LOG_DBG("Using libfcoe module parameter interfaces\n");
 		libfcoe_control = &libfcoe_module_tmpl;
+	} else {
+		FCM_LOG_DBG("Using /sys/bus/fcoe interfaces\n");
+		libfcoe_control = &libfcoe_bus_tmpl;
 	}
 }
 
@@ -2949,6 +2951,7 @@  static void fcm_usage(void)
 	printf("Usage: %s\n"
 	       "\t [-f|--foreground]\n"
 	       "\t [-d|--debug]\n"
+	       "\t [-l|--legacy]\n"
 	       "\t [-s|--syslog]\n"
 	       "\t [-v|--version]\n"
 	       "\t [-h|--help]\n\n", progname);
@@ -3348,7 +3351,7 @@  int main(int argc, char **argv)
 	sa_log_flags = 0;
 	openlog(sa_log_prefix, LOG_CONS, LOG_DAEMON);
 
-	while ((c = getopt_long(argc, argv, "fdhsv",
+	while ((c = getopt_long(argc, argv, "fdhlsv",
 				fcm_options, NULL)) != -1) {
 		switch (c) {
 		case 'f':
@@ -3358,6 +3361,9 @@  int main(int argc, char **argv)
 			fcoe_config.debug = 1;
 			enable_debug_log(1);
 			break;
+		case 'l':
+			force_legacy = true;
+			break;
 		case 's':
 			fcoe_config.use_syslog = 1;
 			enable_syslog(1);