File 0009-fcoemon.c-Add-a-check-to-verify-if-dcbd-is-to-be-ini.patch of Package fcoe-utils.3610

From 0b4e0a99af9e0103c7b25cc3c7997c18bdc46bf4 Mon Sep 17 00:00:00 2001
From: "Milan P. Gandhi" <mgandhi@redhat.com>
Date: Mon, 28 Mar 2016 12:52:12 +0000
Subject: fcoemon.c: Add a check to verify if dcbd is to be initialized, else
 do not try to connect to dcbd/lldpad

Some of the FCoE capable adapters e.g. BCM57810 network interfaces
has DCBX/LLDP client on-chip, and kernel documentation recommends
to keep software based DCBX/LLDP clients (e.g. lldpad) disabled.
https://www.kernel.org/doc/Documentation/scsi/bnx2fc.txt

It was found that, if lldpad is disabled while using above interfaces,
then fcoemon shows following errors every 10 seconds:

fcoemon: error 111 Connection refused
fcoemon: Failed to connect to lldpad

Below patch checks each interface configuration in /etc/fcoe/cfg-ethX
file to verify if there is at least 1 interface with DCB_REQUIRED flag
set to yes and will try to initialize dcbd only if there is at least 1
interface with DCB_REQUIRED="yes", else fcoemon will not try to
initialize dcbd or connect to lldpad, thus eliminating above errors:

X-Git-commit: 0231b0c71464af17a0cf392e55174c97a5986640
Signed-off-by: Milan P. Gandhi <mgandhi@redhat.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Tested-by: Laurence Oberman <loberman@redhat.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
---
 fcoemon.c | 7 ++++++-
 fcoemon.h | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/fcoemon.c b/fcoemon.c
index b5f4d71..6fe50a2 100644
--- a/fcoemon.c
+++ b/fcoemon.c
@@ -557,6 +557,9 @@ static int fcm_read_config_files(void)
 		if (!strncasecmp(val, "yes", 3) && rc == 1)
 			next->dcb_required = 1;
 
+		if (next->dcb_required == 1 && fcoe_config.dcb_init == 0)
+			fcoe_config.dcb_init = 1;
+
 		/* AUTO_VLAN */
 		rc = fcm_read_config_variable(file, val, sizeof(val),
 					      fp, CFG_IF_VAR_AUTOVLAN);
@@ -3774,7 +3777,9 @@ int main(int argc, char **argv)
 	if (rc != 0)
 		goto err_cleanup;
 
-	fcm_dcbd_init();
+	if (fcoe_config.dcb_init)
+		fcm_dcbd_init();
+
 	rc = fcm_srv_create(&srv_info);
 	if (rc != 0)
 		goto err_cleanup;
diff --git a/fcoemon.h b/fcoemon.h
index 3869bae..0e0e6a2 100644
--- a/fcoemon.h
+++ b/fcoemon.h
@@ -25,6 +25,7 @@
 struct fcoe_config {
 	int debug;
 	int use_syslog;
+	int dcb_init;
 	struct fcoe_port *port;
 } fcoe_config;
 
-- 
2.6.6