fcoemon: Quiet log messages on netlink errors

fcoemon gets some expected netlink errors in some cases. Put those
messages out only for debugging and make those messages more useful.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
fcoemon: Replace printf with proper logging call

A printf was mistakenly put where a logging call should have been.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
fcoe-utils: Unload FCoE modules on service stop

Initscript now removes ${SUPPORTED_DRIVERS} and libfc on 'stop force',
properly cleaning up after itself.

Signed-off-by: Petr Sabata <contyk@redhat.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
fcoemon: Handle encapsulated vlan replies

Some switches encapsulate the vlan discovery replies in a vlan 0 tag and
the vlan tag may or may not be stripped by the ethx device. Update the
parsing logic to skip over the vlan header and point to the correct
start of the FIP header.

Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
fcping: fix -h not taking the correct WWPN

This fixes the following:

fcping -h 20:00:00:1b:21:3c:9d:db -F 0xfffffc
FCoE interface 20:00:00:1b:21:3c:9d:db not found

The fp_parse_wwn() is expecting either a string of u64 or a mac addr string, not
the wwn 8 byte string, so we parse it twice to get the 2 byte prefix and then
the mac addr and format a wwn. Also added some check against length of mac and
wwn string.

This will now takes both the following:
fcping -h 00:00:1b:21:3c:9d:db -F 0xfffffc
fcping -h 20:00:00:00:1b:21:3c:9d:db -F 0xfffffc

Signed-off-by: Yi Zou <yi.zou@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
fcoeadm: Increase clif timeout to a reasonably large value

During testing we routinely hit "internal error" messages when working
with a number of ports = 1024 and when the kernel is busy. Although the
operation completes successfully, the message is confusing to the user.
Increase the timeout to 30s to allow normal workloads to finish without
error. This is a select timeout and will not cause long waits if the
command completes early since select will return.

Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
fipvlan: fix auto mode for bonding device

The fipvlan discovery can be sent out to the master bond but will come back on
the active slave, where the slave interface as tracked by fipvlan interfaces
list still thinks it's not IFF_RUNNING and no FIP VLAN DISC is sent. Rather,
we will not populate the bonding master to the list, but allow FIP VLAN DISC
to be sent over all slaves. Also correctly check if the FIP VLAN DISC is
already sent on an interface to avoid repeated sending the same frame. Another
check is added via lookup_fcf() to avoid populate already discovered FCFs.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
fcoe-utils: Fix formatting issue in printf

Fix a minor formatting issue in printf to allow printing of u32 values
correctly.

Signed-off-by: Neerav Parikh <Neerav.Parikh@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
fcoe-utils: Support for displaying >2TB drive

Adds support for displaying >2TB drive information in
fcoeadm.

fcoeadm display command issues HBA_ScsiReadCapacity()
with a buffer of size equal to that of the Scsi Read
Capacity (10) command's response data.
With this patch fcoeadm will re-issue HBA_ScsiReadCapacity()
when the first call returns 0xffffffff as the returned LBA.
The second call will be made with buffer of size equal to
that of Scsi Read Capacity (16) command's response data.

[
fix the following warning to use PRIu32/64 for u_int32/64_t
data types as C99:
fcoeadm_display.c:848:2: warning: format ‘%llu’ expects type ‘long long unsigned
int’, but argument 2 has type ‘u_int64_t’

so include <inttypes.h> and use PRIuN

-yi
]

Signed-off-by: Neerav Parikh <Neerav.Parikh@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
fcoemon: fix and enhance init script status response

Make the fcoe init script provide more useful information when used for
status.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
fcoemon: fix the logging of fc host netlink event

The currently logging for scsi netlink message for fc host event is not helpful
at all. Add proper logging of the event type and its translations that match the
kernel scsi_transport_fc, so the log can actually be interpreted and used for
debugging. Move ARRAY_SIZE into the common fcoemon header so all can use and
remove repeated defines of it in several other places.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
fcoemon: return EFCOECONN instead of ENOACTION on create if port exists

Return the correct rc as EFCOECONN when the interface is already created to get
the right logging message other than the confusing "No action was taken".

Signed-off-by: Yi Zou <yi.zou@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
fcoemon: Print unexpected msg type warning only if debug enabled

fcoemon does not support the CEE type of dcbx messages. On cards that
support the CEE flavor of dcbx, we constantly see the warning when
configuration changes. Convert it to a DBG message to unclutter the log.

Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
fcoe-utils: Clarify behavior of FCoE instances created by fipvlan

FCoE instances are not allowed to be controlled by fcoeadm. They cannot
be destroyed, reset or even scanned by fcoeadm. They can, however, be
monitored by fcoeadm. This patch tries to clarify this behavior in the
documentation.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
fcoe-utils: Add a dependency on libhbalinux v1.0.13

libhbalinux now supports SCSI READ CAPACITY (16) commands.
As of the upcoming version of fcoe-utils, fcoeadm will make
use of these commands. fcoe-utils now needs to depend on
libhbalinux v1.0.13 or greater to ensure that this new
command is supported by libhbalinux.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
fcoe-utils: Increment fcoe-utils version from 1.0.20 to 1.0.21

Signed-off-by: Robert Love <robert.w.love@intel.com>
fipvlan: Start network interfaces before starting FIP

It doesn't really make any sense to ignore inactive
devices; the user has already specified which interfaces
fipvlan should test.
So instead we should be activating the interfaces before
sending any FIP request. If nothing has been received
we can always tear down the interface afterwards.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Robert Love <robert.w.love@intel.com>
fipvlan: Add -f/--suffix option for interface names.

Add a -f/--suffix option to specify a suffix to be appended
to the interface name. The default is changed to devname.vlan,
instead of devname.vlan-fcoe .

Signed-off-by: Ankit Jain <jankit@novell.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Robert Love <robert.w.love@intel.com>
fipvlan: Add '--debug' option

fipvlan has an internal 'debug' option, which provides additional
information. So we should add a switch '--debug' to allow this
option to set from the command line.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Improve logging for netlink messages

When receiving netlink events we should improve the logging to
figure out what exactly went wrong here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Robert Love <robert.w.love@intel.com>