* [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32
@ 2009-09-18 22:48 Robert Love
2009-09-18 22:48 ` [PATCH 01/24] libfc: lport: fix minor documentation errors Robert Love
` (23 more replies)
0 siblings, 24 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:48 UTC (permalink / raw)
To: James.Bottomley, linux-scsi
The following series implements the following changes-
1) Use of FCoE netdev changes
- Use of the FCoE MTU and FCoE enable/disable functionality
in netdev. The dependency for these patches was recently
merged into mainline through net-next so there is no need
for a post-merge tree.
2) New callback from libfc to LLDs
- Callback when the FCID on a local port is changed. This
allows LLDs (fcoe and fnic) to gather the FCID, timeout
values and assigned MAC address.
3) FIP support for fnic
- Adds support for FCoE Initialization Protocol to the
fnic driver.
4) Miscellaneous fixes and improvements...
5) Update MAINTAINERS file.
These patches are built on scsi-misc.git + Vasu's queue_depth
patches submitted to linux-scsi + the 35 previously submitted
libfc, libfcoe and fcoe patches that have not yet been committed
to scsi-misc.
---
Joe Eykholt (15):
libfc: register FC4 features with the FC switch
fnic: Add FIP support to the fnic driver
libfcoe: fcoe: simplify receive FLOGI response
libfc: add host number to lport link up/down messages.
libfc: add set_fid function to libfc template
libfc: fix fc_els_resp_type to correct display of CT responses
libfc: fix symbolic name registrations smashing skb data
libfc: fix RNN_ID smashing skb payload
libfcoe: don't send ELS in FIP mode if no FCF selected
libfc: don't WARN_ON in lport_timeout for RESET state
libfcoe: FIP should report link to libfc whether selected or not
libfcoe: fip: allow FIP receive to be called from IRQ.
libfcoe: fip: use SCSI host number to identify debug messages.
libfcoe: Allow FIP to be disabled by the driver
libfc: lport: fix minor documentation errors
Mike Christie (1):
fcoe: initialize return value in fcoe_destroy
Robert Love (1):
MAINTAINERS: Update for libfc, libfcoe, fcoe
Vasu Dev (3):
libfc: removes unused disc_work and ex_list
libfc: adds missing exch release for accepted RRQ
libfc: removes initializing fc_cpu_order and fc_cpu_mask per lport
Yi Zou (3):
fcoe: Call ndo_fcoe_enable/disable to turn FCoE feature on/off in LLD
fcoe: Use NETIF_F_FCOE_MTU flag to set up max frame size (lport->mfs)
fcoe: remove extra function decalrations
john fastabend (1):
fcoe: add check to fail gracefully in bonding mode
MAINTAINERS | 11 +
drivers/scsi/Kconfig | 2
drivers/scsi/fcoe/fcoe.c | 58 +++--
drivers/scsi/fcoe/fcoe.h | 6
drivers/scsi/fcoe/libfcoe.c | 142 ++++++------
drivers/scsi/fnic/fnic.h | 23 +-
drivers/scsi/fnic/fnic_fcs.c | 499 ++++++++++++++++++++---------------------
drivers/scsi/fnic/fnic_main.c | 71 +++---
drivers/scsi/fnic/fnic_res.c | 5
drivers/scsi/fnic/fnic_res.h | 50 ++++
drivers/scsi/fnic/fnic_scsi.c | 73 +++---
drivers/scsi/fnic/vnic_scsi.h | 1
drivers/scsi/libfc/fc_elsct.c | 41 +++
drivers/scsi/libfc/fc_exch.c | 37 ++-
drivers/scsi/libfc/fc_lport.c | 89 +++++--
include/scsi/fc/fc_fcp.h | 6
include/scsi/fc/fc_ns.h | 13 +
include/scsi/fc_encode.h | 30 ++
include/scsi/libfc.h | 23 ++
include/scsi/libfcoe.h | 5
20 files changed, 693 insertions(+), 492 deletions(-)
--
//Rob
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 01/24] libfc: lport: fix minor documentation errors
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
@ 2009-09-18 22:48 ` Robert Love
2009-09-18 22:48 ` [PATCH 02/24] libfcoe: Allow FIP to be disabled by the driver Robert Love
` (22 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:48 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Joe Eykholt, Robert Love
From: Joe Eykholt <jeykholt@cisco.com>
Fix minor errors.
A debug message said an RLIR was received instead of ECHO.
"Expected" was misspelled in several places.
Fix a type cast from u32 to __be32.
Rob, Some of these may have been also taken care of in your
other doc cleanup patch. Feel free to fold them in.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/libfc/fc_lport.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index a80c61a..278fb04 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -385,7 +385,7 @@ static void fc_lport_add_fc4_type(struct fc_lport *lport, enum fc_fh_type type)
* @fp: The RLIR request frame
* @lport: Fibre Channel local port recieving the RLIR
*
- * Locking Note: The lport lock is exected to be held before calling
+ * Locking Note: The lport lock is expected to be held before calling
* this function.
*/
static void fc_lport_recv_rlir_req(struct fc_seq *sp, struct fc_frame *fp,
@@ -404,7 +404,7 @@ static void fc_lport_recv_rlir_req(struct fc_seq *sp, struct fc_frame *fp,
* @fp: ECHO request frame
* @lport: The local port recieving the ECHO
*
- * Locking Note: The lport lock is exected to be held before calling
+ * Locking Note: The lport lock is expected to be held before calling
* this function.
*/
static void fc_lport_recv_echo_req(struct fc_seq *sp, struct fc_frame *in_fp,
@@ -417,7 +417,7 @@ static void fc_lport_recv_echo_req(struct fc_seq *sp, struct fc_frame *in_fp,
void *dp;
u32 f_ctl;
- FC_LPORT_DBG(lport, "Received RLIR request while in state %s\n",
+ FC_LPORT_DBG(lport, "Received ECHO request while in state %s\n",
fc_lport_state(lport));
len = fr_len(in_fp) - sizeof(struct fc_frame_header);
@@ -430,7 +430,7 @@ static void fc_lport_recv_echo_req(struct fc_seq *sp, struct fc_frame *in_fp,
if (fp) {
dp = fc_frame_payload_get(fp, len);
memcpy(dp, pp, len);
- *((u32 *)dp) = htonl(ELS_LS_ACC << 24);
+ *((__be32 *)dp) = htonl(ELS_LS_ACC << 24);
sp = lport->tt.seq_start_next(sp);
f_ctl = FC_FC_EX_CTX | FC_FC_LAST_SEQ | FC_FC_END_SEQ;
fc_fill_fc_hdr(fp, FC_RCTL_ELS_REP, ep->did, ep->sid,
@@ -441,12 +441,12 @@ static void fc_lport_recv_echo_req(struct fc_seq *sp, struct fc_frame *in_fp,
}
/**
- * fc_lport_recv_echo_req() - Handle received Request Node ID data request
+ * fc_lport_recv_rnid_req() - Handle received Request Node ID data request
* @sp: The sequence in the RNID exchange
* @fp: The RNID request frame
* @lport: The local port recieving the RNID
*
- * Locking Note: The lport lock is exected to be held before calling
+ * Locking Note: The lport lock is expected to be held before calling
* this function.
*/
static void fc_lport_recv_rnid_req(struct fc_seq *sp, struct fc_frame *in_fp,
@@ -742,7 +742,7 @@ static void fc_lport_enter_ready(struct fc_lport *lport)
* Accept it with the common service parameters indicating our N port.
* Set up to do a PLOGI if we have the higher-number WWPN.
*
- * Locking Note: The lport lock is exected to be held before calling
+ * Locking Note: The lport lock is expected to be held before calling
* this function.
*/
static void fc_lport_recv_flogi_req(struct fc_seq *sp_in,
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 02/24] libfcoe: Allow FIP to be disabled by the driver
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
2009-09-18 22:48 ` [PATCH 01/24] libfc: lport: fix minor documentation errors Robert Love
@ 2009-09-18 22:48 ` Robert Love
2009-09-18 22:49 ` [PATCH 03/24] libfcoe: fip: use SCSI host number to identify debug messages Robert Love
` (21 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:48 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Joe Eykholt, Robert Love
From: Joe Eykholt <jeykholt@cisco.com>
Allow FIP to be disabled by the driver for devices
that want to use libfcoe in non-FIP mode.
The driver merely sets the fcoe_ctlr mode to the state which
should be entered when the link comes up. The default is auto.
No change is needed for fcoe.c which uses auto mode.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/libfcoe.c | 6 ++++--
include/scsi/libfcoe.h | 2 ++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index a563c99..b1e4d25 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -110,6 +110,7 @@ static inline int fcoe_ctlr_fcf_usable(struct fcoe_fcf *fcf)
void fcoe_ctlr_init(struct fcoe_ctlr *fip)
{
fip->state = FIP_ST_LINK_WAIT;
+ fip->mode = FIP_ST_AUTO;
INIT_LIST_HEAD(&fip->fcfs);
spin_lock_init(&fip->lock);
fip->flogi_oxid = FC_XID_UNKNOWN;
@@ -262,11 +263,12 @@ void fcoe_ctlr_link_up(struct fcoe_ctlr *fip)
spin_unlock_bh(&fip->lock);
fc_linkup(fip->lp);
} else if (fip->state == FIP_ST_LINK_WAIT) {
- fip->state = FIP_ST_AUTO;
+ fip->state = fip->mode;
fip->last_link = 1;
fip->link = 1;
spin_unlock_bh(&fip->lock);
- LIBFCOE_FIP_DBG("%s", "setting AUTO mode.\n");
+ if (fip->state == FIP_ST_AUTO)
+ LIBFCOE_FIP_DBG("%s", "setting AUTO mode.\n");
fc_linkup(fip->lp);
fcoe_ctlr_solicit(fip, NULL);
} else
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 76d08c9..2344a00 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -55,6 +55,7 @@ enum fip_state {
/**
* struct fcoe_ctlr - FCoE Controller and FIP state
* @state: internal FIP state for network link and FIP or non-FIP mode.
+ * @mode: LLD-selected mode.
* @lp: &fc_lport: libfc local port.
* @sel_fcf: currently selected FCF, or NULL.
* @fcfs: list of discovered FCFs.
@@ -89,6 +90,7 @@ enum fip_state {
*/
struct fcoe_ctlr {
enum fip_state state;
+ enum fip_state mode;
struct fc_lport *lp;
struct fcoe_fcf *sel_fcf;
struct list_head fcfs;
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 03/24] libfcoe: fip: use SCSI host number to identify debug messages.
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
2009-09-18 22:48 ` [PATCH 01/24] libfc: lport: fix minor documentation errors Robert Love
2009-09-18 22:48 ` [PATCH 02/24] libfcoe: Allow FIP to be disabled by the driver Robert Love
@ 2009-09-18 22:49 ` Robert Love
2009-09-18 22:49 ` [PATCH 04/24] libfcoe: fip: allow FIP receive to be called from IRQ Robert Love
` (20 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:49 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Joe Eykholt, Robert Love
From: Joe Eykholt <jeykholt@cisco.com>
Use scsi host number to identify debug messages.
Previously, no instance information was given, so if multiple
ports were active, it became confusing.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/libfcoe.c | 47 ++++++++++++++++++++++++-------------------
1 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index b1e4d25..6c5c0d6 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -75,9 +75,10 @@ do { \
LIBFCOE_CHECK_LOGGING(LIBFCOE_LOGGING, \
printk(KERN_INFO "libfcoe: " fmt, ##args);)
-#define LIBFCOE_FIP_DBG(fmt, args...) \
+#define LIBFCOE_FIP_DBG(fip, fmt, args...) \
LIBFCOE_CHECK_LOGGING(LIBFCOE_FIP_LOGGING, \
- printk(KERN_INFO "fip: " fmt, ##args);)
+ printk(KERN_INFO "host%d: fip: " fmt, \
+ (fip)->lp->host->host_no, ##args);)
/**
* fcoe_ctlr_mtu_valid() - Check if a FCF's MTU is valid
@@ -268,7 +269,7 @@ void fcoe_ctlr_link_up(struct fcoe_ctlr *fip)
fip->link = 1;
spin_unlock_bh(&fip->lock);
if (fip->state == FIP_ST_AUTO)
- LIBFCOE_FIP_DBG("%s", "setting AUTO mode.\n");
+ LIBFCOE_FIP_DBG(fip, "%s", "setting AUTO mode.\n");
fc_linkup(fip->lp);
fcoe_ctlr_solicit(fip, NULL);
} else
@@ -605,13 +606,15 @@ static void fcoe_ctlr_age_fcfs(struct fcoe_ctlr *fip)
/**
* fcoe_ctlr_parse_adv() - Decode a FIP advertisement into a new FCF entry
+ * @fip: The FCoE controller receiving the advertisement
* @skb: The received FIP advertisement frame
* @fcf: The resulting FCF entry
*
* Returns zero on a valid parsed advertisement,
* otherwise returns non zero value.
*/
-static int fcoe_ctlr_parse_adv(struct sk_buff *skb, struct fcoe_fcf *fcf)
+static int fcoe_ctlr_parse_adv(struct fcoe_ctlr *fip,
+ struct sk_buff *skb, struct fcoe_fcf *fcf)
{
struct fip_header *fiph;
struct fip_desc *desc = NULL;
@@ -650,7 +653,7 @@ static int fcoe_ctlr_parse_adv(struct sk_buff *skb, struct fcoe_fcf *fcf)
((struct fip_mac_desc *)desc)->fd_mac,
ETH_ALEN);
if (!is_valid_ether_addr(fcf->fcf_mac)) {
- LIBFCOE_FIP_DBG("Invalid MAC address "
+ LIBFCOE_FIP_DBG(fip, "Invalid MAC address "
"in FIP adv\n");
return -EINVAL;
}
@@ -684,7 +687,7 @@ static int fcoe_ctlr_parse_adv(struct sk_buff *skb, struct fcoe_fcf *fcf)
case FIP_DT_LOGO:
case FIP_DT_ELP:
default:
- LIBFCOE_FIP_DBG("unexpected descriptor type %x "
+ LIBFCOE_FIP_DBG(fip, "unexpected descriptor type %x "
"in FIP adv\n", desc->fip_dtype);
/* standard says ignore unknown descriptors >= 128 */
if (desc->fip_dtype < FIP_DT_VENDOR_BASE)
@@ -701,7 +704,7 @@ static int fcoe_ctlr_parse_adv(struct sk_buff *skb, struct fcoe_fcf *fcf)
return 0;
len_err:
- LIBFCOE_FIP_DBG("FIP length error in descriptor type %x len %zu\n",
+ LIBFCOE_FIP_DBG(fip, "FIP length error in descriptor type %x len %zu\n",
desc->fip_dtype, dlen);
return -EINVAL;
}
@@ -720,7 +723,7 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb)
int first = 0;
int mtu_valid;
- if (fcoe_ctlr_parse_adv(skb, &new))
+ if (fcoe_ctlr_parse_adv(fip, skb, &new))
return;
spin_lock_bh(&fip->lock);
@@ -766,7 +769,7 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb)
mtu_valid = fcoe_ctlr_mtu_valid(fcf);
fcf->time = jiffies;
if (!found) {
- LIBFCOE_FIP_DBG("New FCF for fab %llx map %x val %d\n",
+ LIBFCOE_FIP_DBG(fip, "New FCF for fab %llx map %x val %d\n",
fcf->fabric_name, fcf->fc_map, mtu_valid);
}
@@ -845,7 +848,7 @@ static void fcoe_ctlr_recv_els(struct fcoe_ctlr *fip, struct sk_buff *skb)
((struct fip_mac_desc *)desc)->fd_mac,
ETH_ALEN);
if (!is_valid_ether_addr(granted_mac)) {
- LIBFCOE_FIP_DBG("Invalid MAC address "
+ LIBFCOE_FIP_DBG(fip, "Invalid MAC address "
"in FIP ELS\n");
goto drop;
}
@@ -865,7 +868,7 @@ static void fcoe_ctlr_recv_els(struct fcoe_ctlr *fip, struct sk_buff *skb)
els_dtype = desc->fip_dtype;
break;
default:
- LIBFCOE_FIP_DBG("unexpected descriptor type %x "
+ LIBFCOE_FIP_DBG(fip, "unexpected descriptor type %x "
"in FIP adv\n", desc->fip_dtype);
/* standard says ignore unknown descriptors >= 128 */
if (desc->fip_dtype < FIP_DT_VENDOR_BASE)
@@ -904,7 +907,7 @@ static void fcoe_ctlr_recv_els(struct fcoe_ctlr *fip, struct sk_buff *skb)
return;
len_err:
- LIBFCOE_FIP_DBG("FIP length error in descriptor type %x len %zu\n",
+ LIBFCOE_FIP_DBG(fip, "FIP length error in descriptor type %x len %zu\n",
desc->fip_dtype, dlen);
drop:
kfree_skb(skb);
@@ -931,7 +934,7 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip,
struct fc_lport *lport = fip->lp;
u32 desc_mask;
- LIBFCOE_FIP_DBG("Clear Virtual Link received\n");
+ LIBFCOE_FIP_DBG(fip, "Clear Virtual Link received\n");
if (!fcf)
return;
if (!fcf || !fc_host_port_id(lport->host))
@@ -990,9 +993,10 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip,
* reset only if all required descriptors were present and valid.
*/
if (desc_mask) {
- LIBFCOE_FIP_DBG("missing descriptors mask %x\n", desc_mask);
+ LIBFCOE_FIP_DBG(fip, "missing descriptors mask %x\n",
+ desc_mask);
} else {
- LIBFCOE_FIP_DBG("performing Clear Virtual Link\n");
+ LIBFCOE_FIP_DBG(fip, "performing Clear Virtual Link\n");
fcoe_ctlr_reset(fip, FIP_ST_ENABLED);
}
}
@@ -1051,7 +1055,7 @@ static int fcoe_ctlr_recv_handler(struct fcoe_ctlr *fip, struct sk_buff *skb)
fip->map_dest = 0;
fip->state = FIP_ST_ENABLED;
state = FIP_ST_ENABLED;
- LIBFCOE_FIP_DBG("Using FIP mode\n");
+ LIBFCOE_FIP_DBG(fip, "Using FIP mode\n");
}
spin_unlock_bh(&fip->lock);
if (state != FIP_ST_ENABLED)
@@ -1086,11 +1090,11 @@ static void fcoe_ctlr_select(struct fcoe_ctlr *fip)
struct fcoe_fcf *best = NULL;
list_for_each_entry(fcf, &fip->fcfs, list) {
- LIBFCOE_FIP_DBG("consider FCF for fab %llx VFID %d map %x "
+ LIBFCOE_FIP_DBG(fip, "consider FCF for fab %llx VFID %d map %x "
"val %d\n", fcf->fabric_name, fcf->vfid,
fcf->fc_map, fcoe_ctlr_mtu_valid(fcf));
if (!fcoe_ctlr_fcf_usable(fcf)) {
- LIBFCOE_FIP_DBG("FCF for fab %llx map %x %svalid "
+ LIBFCOE_FIP_DBG(fip, "FCF for fab %llx map %x %svalid "
"%savailable\n", fcf->fabric_name,
fcf->fc_map, (fcf->flags & FIP_FL_SOL)
? "" : "in", (fcf->flags & FIP_FL_AVAIL)
@@ -1104,7 +1108,7 @@ static void fcoe_ctlr_select(struct fcoe_ctlr *fip)
if (fcf->fabric_name != best->fabric_name ||
fcf->vfid != best->vfid ||
fcf->fc_map != best->fc_map) {
- LIBFCOE_FIP_DBG("Conflicting fabric, VFID, "
+ LIBFCOE_FIP_DBG(fip, "Conflicting fabric, VFID, "
"or FC-MAP\n");
return;
}
@@ -1293,7 +1297,8 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *fip, struct fc_lport *lport,
return -EINVAL;
}
fip->state = FIP_ST_NON_FIP;
- LIBFCOE_FIP_DBG("received FLOGI LS_ACC using non-FIP mode\n");
+ LIBFCOE_FIP_DBG(fip,
+ "received FLOGI LS_ACC using non-FIP mode\n");
/*
* FLOGI accepted.
@@ -1320,7 +1325,7 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *fip, struct fc_lport *lport,
memcpy(fip->dest_addr, sa, ETH_ALEN);
fip->map_dest = 0;
if (fip->state == FIP_ST_NON_FIP)
- LIBFCOE_FIP_DBG("received FLOGI REQ, "
+ LIBFCOE_FIP_DBG(fip, "received FLOGI REQ, "
"using non-FIP mode\n");
fip->state = FIP_ST_NON_FIP;
}
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 04/24] libfcoe: fip: allow FIP receive to be called from IRQ.
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (2 preceding siblings ...)
2009-09-18 22:49 ` [PATCH 03/24] libfcoe: fip: use SCSI host number to identify debug messages Robert Love
@ 2009-09-18 22:49 ` Robert Love
2009-09-18 22:49 ` [PATCH 05/24] libfcoe: FIP should report link to libfc whether selected or not Robert Love
` (19 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:49 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Joe Eykholt, Robert Love
From: Joe Eykholt <jeykholt@cisco.com>
FIP's fcoe_ctlr_recv() function was previously only called from
the soft IRQ in FCoE. It's not performance critical and is more
convenient for some drivers to call it from the IRQ level. Just
Change to use skb_queue()/dequeue() which uses spinlock_irqsave
instead of separate locking with _bh locks.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/libfcoe.c | 17 ++++-------------
1 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index 6c5c0d6..6480dcf 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -157,9 +157,7 @@ static void fcoe_ctlr_reset_fcfs(struct fcoe_ctlr *fip)
void fcoe_ctlr_destroy(struct fcoe_ctlr *fip)
{
cancel_work_sync(&fip->recv_work);
- spin_lock_bh(&fip->fip_recv_list.lock);
- __skb_queue_purge(&fip->fip_recv_list);
- spin_unlock_bh(&fip->fip_recv_list.lock);
+ skb_queue_purge(&fip->fip_recv_list);
spin_lock_bh(&fip->lock);
fip->state = FIP_ST_DISABLED;
@@ -1006,13 +1004,11 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip,
* @fip: The FCoE controller that received the packet
* @skb: The received FIP packet
*
- * This is called from NET_RX_SOFTIRQ.
+ * This may be called from either NET_RX_SOFTIRQ or IRQ.
*/
void fcoe_ctlr_recv(struct fcoe_ctlr *fip, struct sk_buff *skb)
{
- spin_lock_bh(&fip->fip_recv_list.lock);
- __skb_queue_tail(&fip->fip_recv_list, skb);
- spin_unlock_bh(&fip->fip_recv_list.lock);
+ skb_queue_tail(&fip->fip_recv_list, skb);
schedule_work(&fip->recv_work);
}
EXPORT_SYMBOL(fcoe_ctlr_recv);
@@ -1252,13 +1248,8 @@ static void fcoe_ctlr_recv_work(struct work_struct *recv_work)
struct sk_buff *skb;
fip = container_of(recv_work, struct fcoe_ctlr, recv_work);
- spin_lock_bh(&fip->fip_recv_list.lock);
- while ((skb = __skb_dequeue(&fip->fip_recv_list))) {
- spin_unlock_bh(&fip->fip_recv_list.lock);
+ while ((skb = skb_dequeue(&fip->fip_recv_list)))
fcoe_ctlr_recv_handler(fip, skb);
- spin_lock_bh(&fip->fip_recv_list.lock);
- }
- spin_unlock_bh(&fip->fip_recv_list.lock);
}
/**
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 05/24] libfcoe: FIP should report link to libfc whether selected or not
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (3 preceding siblings ...)
2009-09-18 22:49 ` [PATCH 04/24] libfcoe: fip: allow FIP receive to be called from IRQ Robert Love
@ 2009-09-18 22:49 ` Robert Love
2009-09-18 22:49 ` [PATCH 06/24] libfc: don't WARN_ON in lport_timeout for RESET state Robert Love
` (18 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:49 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Joe Eykholt, Robert Love
From: Joe Eykholt <jeykholt@cisco.com>
The fnic driver with FIP is reporting link up, even though it's down.
When the interface is shut down by the switch, we receive a clear
virtual link, and set the state reported to libfc as down, although
we still report it up. Clearly wrong. That causes the subsequent
link down event not to be reported, and /sys shows the host "Online".
Currently, in FIP mode, if an FCF times out, then link to libfc
is reported as down, to stop FLOGIs. That interferes with the LLD
link down being reported.
Users really need to know the physical link information, to diagnose
cabling issues, so physical link status should be reported to libfc.
If the selected FCF needs to be reported, that should be done
separately, in a later patch.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/libfcoe.c | 60 ++++++++++++++++++++++---------------------
include/scsi/libfcoe.h | 1 +
2 files changed, 31 insertions(+), 30 deletions(-)
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index 6480dcf..1ee2350 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -278,38 +278,16 @@ EXPORT_SYMBOL(fcoe_ctlr_link_up);
/**
* fcoe_ctlr_reset() - Reset a FCoE controller
* @fip: The FCoE controller to reset
- * @new_state: The FIP state to be entered
- *
- * Returns non-zero if the link was up and now isn't.
*/
-static int fcoe_ctlr_reset(struct fcoe_ctlr *fip, enum fip_state new_state)
+static void fcoe_ctlr_reset(struct fcoe_ctlr *fip)
{
- struct fc_lport *lport = fip->lp;
- int link_dropped;
-
- spin_lock_bh(&fip->lock);
fcoe_ctlr_reset_fcfs(fip);
del_timer(&fip->timer);
- fip->state = new_state;
fip->ctlr_ka_time = 0;
fip->port_ka_time = 0;
fip->sol_time = 0;
fip->flogi_oxid = FC_XID_UNKNOWN;
fip->map_dest = 0;
- fip->last_link = 0;
- link_dropped = fip->link;
- fip->link = 0;
- spin_unlock_bh(&fip->lock);
-
- if (link_dropped)
- fc_linkdown(lport);
-
- if (new_state == FIP_ST_ENABLED) {
- fcoe_ctlr_solicit(fip, NULL);
- fc_linkup(lport);
- link_dropped = 0;
- }
- return link_dropped;
}
/**
@@ -323,7 +301,20 @@ static int fcoe_ctlr_reset(struct fcoe_ctlr *fip, enum fip_state new_state)
*/
int fcoe_ctlr_link_down(struct fcoe_ctlr *fip)
{
- return fcoe_ctlr_reset(fip, FIP_ST_LINK_WAIT);
+ int link_dropped;
+
+ LIBFCOE_FIP_DBG(fip, "link down.\n");
+ spin_lock_bh(&fip->lock);
+ fcoe_ctlr_reset(fip);
+ link_dropped = fip->link;
+ fip->link = 0;
+ fip->last_link = 0;
+ fip->state = FIP_ST_LINK_WAIT;
+ spin_unlock_bh(&fip->lock);
+
+ if (link_dropped)
+ fc_linkdown(fip->lp);
+ return link_dropped;
}
EXPORT_SYMBOL(fcoe_ctlr_link_down);
@@ -995,7 +986,13 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip,
desc_mask);
} else {
LIBFCOE_FIP_DBG(fip, "performing Clear Virtual Link\n");
- fcoe_ctlr_reset(fip, FIP_ST_ENABLED);
+
+ spin_lock_bh(&fip->lock);
+ fcoe_ctlr_reset(fip);
+ spin_unlock_bh(&fip->lock);
+
+ fc_lport_reset(fip->lp);
+ fcoe_ctlr_solicit(fip, NULL);
}
}
@@ -1153,15 +1150,14 @@ static void fcoe_ctlr_timeout(unsigned long arg)
fip->port_ka_time = jiffies +
msecs_to_jiffies(FIP_VN_KA_PERIOD);
fip->ctlr_ka_time = jiffies + sel->fka_period;
- fip->link = 1;
} else {
printk(KERN_NOTICE "libfcoe: host%d: "
"FIP Fibre-Channel Forwarder timed out. "
"Starting FCF discovery.\n",
fip->lp->host->host_no);
- fip->link = 0;
+ fip->reset_req = 1;
+ schedule_work(&fip->link_work);
}
- schedule_work(&fip->link_work);
}
if (sel) {
@@ -1206,20 +1202,24 @@ static void fcoe_ctlr_link_work(struct work_struct *work)
u8 *mac;
int link;
int last_link;
+ int reset;
fip = container_of(work, struct fcoe_ctlr, link_work);
spin_lock_bh(&fip->lock);
last_link = fip->last_link;
link = fip->link;
fip->last_link = link;
+ reset = fip->reset_req;
+ fip->reset_req = 0;
spin_unlock_bh(&fip->lock);
if (last_link != link) {
if (link)
fc_linkup(fip->lp);
else
- fcoe_ctlr_reset(fip, FIP_ST_LINK_WAIT);
- }
+ fc_linkdown(fip->lp);
+ } else if (reset && link)
+ fc_lport_reset(fip->lp);
if (fip->send_ctlr_ka) {
fip->send_ctlr_ka = 0;
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 2344a00..e38ffa0 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -108,6 +108,7 @@ struct fcoe_ctlr {
u8 flogi_count;
u8 link;
u8 last_link;
+ u8 reset_req;
u8 map_dest;
u8 spma;
u8 send_ctlr_ka;
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 06/24] libfc: don't WARN_ON in lport_timeout for RESET state
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (4 preceding siblings ...)
2009-09-18 22:49 ` [PATCH 05/24] libfcoe: FIP should report link to libfc whether selected or not Robert Love
@ 2009-09-18 22:49 ` Robert Love
2009-09-18 22:49 ` [PATCH 07/24] libfcoe: don't send ELS in FIP mode if no FCF selected Robert Love
` (17 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:49 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Joe Eykholt, Robert Love
From: Joe Eykholt <jeykholt@cisco.com>
It's possible and harmless to get FLOGI timeouts
while in RESET state. Don't do a WARN_ON in that case.
Also, split out the other WARN_ONs in fc_lport_timeout, so
we can tell which one is hit by its line number.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/libfc/fc_lport.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 278fb04..97e8a35 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -1275,10 +1275,13 @@ static void fc_lport_timeout(struct work_struct *work)
switch (lport->state) {
case LPORT_ST_DISABLED:
+ WARN_ON(1);
+ break;
case LPORT_ST_READY:
- case LPORT_ST_RESET:
WARN_ON(1);
break;
+ case LPORT_ST_RESET:
+ break;
case LPORT_ST_FLOGI:
fc_lport_enter_flogi(lport);
break;
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 07/24] libfcoe: don't send ELS in FIP mode if no FCF selected
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (5 preceding siblings ...)
2009-09-18 22:49 ` [PATCH 06/24] libfc: don't WARN_ON in lport_timeout for RESET state Robert Love
@ 2009-09-18 22:49 ` Robert Love
2009-09-18 22:49 ` [PATCH 08/24] fcoe: remove extra function decalrations Robert Love
` (16 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:49 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Joe Eykholt, Robert Love
From: Joe Eykholt <jeykholt@cisco.com>
If link is up, but no FCF is selected, don't send any ELS frames.
This came up when an fnic received a multicast advertisement but
no solitited advertisments, so no FCF was selected. It tried
to send FLOGIs anyway.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/libfcoe.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index 1ee2350..062ad15 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -501,6 +501,8 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr *fip, struct fc_lport *lport,
if (fip->state == FIP_ST_NON_FIP)
return 0;
+ if (!fip->sel_fcf)
+ goto drop;
switch (op) {
case ELS_FLOGI:
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 08/24] fcoe: remove extra function decalrations
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (6 preceding siblings ...)
2009-09-18 22:49 ` [PATCH 07/24] libfcoe: don't send ELS in FIP mode if no FCF selected Robert Love
@ 2009-09-18 22:49 ` Robert Love
2009-09-18 22:49 ` [PATCH 09/24] libfc: removes initializing fc_cpu_order and fc_cpu_mask per lport Robert Love
` (15 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:49 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Yi Zou, Robert Love
From: Yi Zou <yi.zou@intel.com>
Remove the two extra function decalartions in fcoe.c.
Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/fcoe.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index c3d5364..27fcfdc 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -102,9 +102,6 @@ static int fcoe_cpu_callback(struct notifier_block *, unsigned long, void *);
static int fcoe_create(const char *, struct kernel_param *);
static int fcoe_destroy(const char *, struct kernel_param *);
-static u8 *fcoe_get_src_mac(struct fc_lport *);
-static void fcoe_destroy_work(struct work_struct *);
-
static struct fc_seq *fcoe_elsct_send(struct fc_lport *,
u32 did, struct fc_frame *,
unsigned int op,
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 09/24] libfc: removes initializing fc_cpu_order and fc_cpu_mask per lport
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (7 preceding siblings ...)
2009-09-18 22:49 ` [PATCH 08/24] fcoe: remove extra function decalrations Robert Love
@ 2009-09-18 22:49 ` Robert Love
2009-09-18 22:49 ` [PATCH 10/24] libfc: adds missing exch release for accepted RRQ Robert Love
` (14 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:49 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Vasu Dev, Robert Love
From: Vasu Dev <vasu.dev@intel.com>
Initializing these libfc globals per lport could mess up exch
allocation/free for existing lport.
So this patch moves their initialization to fc_setup_exch_mgr
so that these globals gets initialized only once for libfc.
Reported-by: Alex Lyakas <alexl@mellanox.co.il>
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/libfc/fc_exch.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index dec61e5..d58111f 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -2303,6 +2303,20 @@ int fc_exch_init(struct fc_lport *lport)
if (!lport->tt.seq_exch_abort)
lport->tt.seq_exch_abort = fc_seq_exch_abort;
+ return 0;
+}
+EXPORT_SYMBOL(fc_exch_init);
+
+/**
+ * fc_setup_exch_mgr() - Setup an exchange manager
+ */
+int fc_setup_exch_mgr()
+{
+ fc_em_cachep = kmem_cache_create("libfc_em", sizeof(struct fc_exch),
+ 0, SLAB_HWCACHE_ALIGN, NULL);
+ if (!fc_em_cachep)
+ return -ENOMEM;
+
/*
* Initialize fc_cpu_mask and fc_cpu_order. The
* fc_cpu_mask is set for nr_cpu_ids rounded up
@@ -2327,19 +2341,6 @@ int fc_exch_init(struct fc_lport *lport)
return 0;
}
-EXPORT_SYMBOL(fc_exch_init);
-
-/**
- * fc_setup_exch_mgr() - Setup an exchange manager
- */
-int fc_setup_exch_mgr()
-{
- fc_em_cachep = kmem_cache_create("libfc_em", sizeof(struct fc_exch),
- 0, SLAB_HWCACHE_ALIGN, NULL);
- if (!fc_em_cachep)
- return -ENOMEM;
- return 0;
-}
/**
* fc_destroy_exch_mgr() - Destroy an exchange manager
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 10/24] libfc: adds missing exch release for accepted RRQ
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (8 preceding siblings ...)
2009-09-18 22:49 ` [PATCH 09/24] libfc: removes initializing fc_cpu_order and fc_cpu_mask per lport Robert Love
@ 2009-09-18 22:49 ` Robert Love
2009-09-18 22:49 ` [PATCH 11/24] libfc: removes unused disc_work and ex_list Robert Love
` (13 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:49 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Vasu Dev, Robert Love
From: Vasu Dev <vasu.dev@intel.com>
Adds missing exch release when RRQ is accepted by calling
fc_seq_ls_acc. Adds common exch release for fc_exch_els_rrq
by use of out label.
Reported-by: Alex Lyakas <alexl@mellanox.co.il>
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/libfc/fc_exch.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index d58111f..d157976 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -1979,7 +1979,7 @@ retry:
*/
static void fc_exch_els_rrq(struct fc_seq *sp, struct fc_frame *fp)
{
- struct fc_exch *ep; /* request or subject exchange */
+ struct fc_exch *ep = NULL; /* request or subject exchange */
struct fc_els_rrq *rp;
u32 sid;
u16 xid;
@@ -2029,15 +2029,16 @@ static void fc_exch_els_rrq(struct fc_seq *sp, struct fc_frame *fp)
* Send LS_ACC.
*/
fc_seq_ls_acc(sp);
- fc_frame_free(fp);
- return;
+ goto out;
unlock_reject:
spin_unlock_bh(&ep->ex_lock);
- fc_exch_release(ep); /* drop hold from fc_exch_find */
reject:
fc_seq_ls_rjt(sp, ELS_RJT_LOGIC, explan);
+out:
fc_frame_free(fp);
+ if (ep)
+ fc_exch_release(ep); /* drop hold from fc_exch_find */
}
/**
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 11/24] libfc: removes unused disc_work and ex_list
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (9 preceding siblings ...)
2009-09-18 22:49 ` [PATCH 10/24] libfc: adds missing exch release for accepted RRQ Robert Love
@ 2009-09-18 22:49 ` Robert Love
2009-09-18 22:50 ` [PATCH 12/24] fcoe: Use NETIF_F_FCOE_MTU flag to set up max frame size (lport->mfs) Robert Love
` (12 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:49 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Vasu Dev, Robert Love
From: Vasu Dev <vasu.dev@intel.com>
Reported-by: Alex Lyakas <alexl@mellanox.co.il>
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/libfc/fc_exch.c | 1 -
include/scsi/libfc.h | 1 -
2 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index d157976..6e4adb8 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -90,7 +90,6 @@ struct fc_exch_mgr {
struct kref kref;
u16 min_xid;
u16 max_xid;
- struct list_head ex_list;
mempool_t *ep_pool;
u16 pool_max_index;
struct fc_exch_pool *pool;
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index b375dd5..0889c0e 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -821,7 +821,6 @@ struct fc_lport {
struct mutex lp_mutex;
struct list_head list;
struct delayed_work retry_work;
- struct delayed_work disc_work;
};
/*
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 12/24] fcoe: Use NETIF_F_FCOE_MTU flag to set up max frame size (lport->mfs)
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (10 preceding siblings ...)
2009-09-18 22:49 ` [PATCH 11/24] libfc: removes unused disc_work and ex_list Robert Love
@ 2009-09-18 22:50 ` Robert Love
2009-09-18 22:50 ` [PATCH 13/24] fcoe: Call ndo_fcoe_enable/disable to turn FCoE feature on/off in LLD Robert Love
` (11 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:50 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Yi Zou, Robert Love
From: Yi Zou <yi.zou@intel.com>
Add a define of FCOE_MTU as 2158 bytes and use FCOE_MTU when the LLD is found
to support NETIF_F_FCOE_MTU. The lport->mfs is then calculated out of the
2158 FCOE_MTU. Otherwise, we stick with the netdev->mtu, i.e., LAN MTU. Also,
change the notification on NETDEV_CHANGEMTU event to bypass changing mfs when
LAN MTU is changed if NETIF_F_FCOE_MTU is supported.
Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/fcoe.c | 10 ++++++++--
drivers/scsi/fcoe/fcoe.h | 6 ++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 27fcfdc..c104ad6 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -536,8 +536,12 @@ static int fcoe_netdev_config(struct fc_lport *lport, struct net_device *netdev)
* user-configured limit. If the MFS is too low, fcoe_link_ok()
* will return 0, so do this first.
*/
- mfs = netdev->mtu - (sizeof(struct fcoe_hdr) +
- sizeof(struct fcoe_crc_eof));
+ mfs = netdev->mtu;
+ if (netdev->features & NETIF_F_FCOE_MTU) {
+ mfs = FCOE_MTU;
+ FCOE_NETDEV_DBG(netdev, "Supports FCOE_MTU of %d bytes\n", mfs);
+ }
+ mfs -= (sizeof(struct fcoe_hdr) + sizeof(struct fcoe_crc_eof));
if (fc_set_mfs(lport, mfs))
return -EINVAL;
@@ -1717,6 +1721,8 @@ static int fcoe_device_notification(struct notifier_block *notifier,
case NETDEV_CHANGE:
break;
case NETDEV_CHANGEMTU:
+ if (netdev->features & NETIF_F_FCOE_MTU)
+ break;
mfs = netdev->mtu - (sizeof(struct fcoe_hdr) +
sizeof(struct fcoe_crc_eof));
if (mfs >= FC_MIN_MAX_FRAME)
diff --git a/drivers/scsi/fcoe/fcoe.h b/drivers/scsi/fcoe/fcoe.h
index fc2da8a..c69b2c5 100644
--- a/drivers/scsi/fcoe/fcoe.h
+++ b/drivers/scsi/fcoe/fcoe.h
@@ -40,6 +40,12 @@
#define FCOE_MIN_XID 0x0000 /* the min xid supported by fcoe_sw */
#define FCOE_MAX_XID 0x0FFF /* the max xid supported by fcoe_sw */
+/*
+ * Max MTU for FCoE: 14 (FCoE header) + 24 (FC header) + 2112 (max FC payload)
+ * + 4 (FC CRC) + 4 (FCoE trailer) = 2158 bytes
+ */
+#define FCOE_MTU 2158
+
unsigned int fcoe_debug_logging;
module_param_named(debug_logging, fcoe_debug_logging, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels");
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 13/24] fcoe: Call ndo_fcoe_enable/disable to turn FCoE feature on/off in LLD
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (11 preceding siblings ...)
2009-09-18 22:50 ` [PATCH 12/24] fcoe: Use NETIF_F_FCOE_MTU flag to set up max frame size (lport->mfs) Robert Love
@ 2009-09-18 22:50 ` Robert Love
2009-09-18 22:50 ` [PATCH 14/24] fcoe: initialize return value in fcoe_destroy Robert Love
` (10 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:50 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Yi Zou, Robert Love
From: Yi Zou <yi.zou@intel.com>
Calls ndo_fcoe_enabled() of the associated netdev upon creating the FCoE
instance to make sure LLD has all necessary resources allocated and setup
properly before passing FCoE traffic. Similarly, calls ndo_fcoe_disable()
upon destroying the FCoE instance on the associated netdev to allow the LLD
to release all allocated resources for FCoE.
Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/fcoe.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index c104ad6..49d46a8 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -250,9 +250,18 @@ static int fcoe_interface_setup(struct fcoe_interface *fcoe,
struct fcoe_ctlr *fip = &fcoe->ctlr;
struct netdev_hw_addr *ha;
u8 flogi_maddr[ETH_ALEN];
+ const struct net_device_ops *ops;
fcoe->netdev = netdev;
+ /* Let LLD initialize for FCoE */
+ ops = netdev->netdev_ops;
+ if (ops->ndo_fcoe_enable) {
+ if (ops->ndo_fcoe_enable(netdev))
+ FCOE_NETDEV_DBG(netdev, "Failed to enable FCoE"
+ " specific feature for LLD.\n");
+ }
+
/* Do not support for bonding device */
if ((netdev->priv_flags & IFF_MASTER_ALB) ||
(netdev->priv_flags & IFF_SLAVE_INACTIVE) ||
@@ -348,6 +357,7 @@ void fcoe_interface_cleanup(struct fcoe_interface *fcoe)
struct net_device *netdev = fcoe->netdev;
struct fcoe_ctlr *fip = &fcoe->ctlr;
u8 flogi_maddr[ETH_ALEN];
+ const struct net_device_ops *ops;
/*
* Don't listen for Ethernet packets anymore.
@@ -365,6 +375,14 @@ void fcoe_interface_cleanup(struct fcoe_interface *fcoe)
if (fip->spma)
dev_unicast_delete(netdev, fip->ctl_src_addr);
dev_mc_delete(netdev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
+
+ /* Tell the LLD we are done w/ FCoE */
+ ops = netdev->netdev_ops;
+ if (ops->ndo_fcoe_disable) {
+ if (ops->ndo_fcoe_disable(netdev))
+ FCOE_NETDEV_DBG(netdev, "Failed to disable FCoE"
+ " specific feature for LLD.\n");
+ }
}
/**
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 14/24] fcoe: initialize return value in fcoe_destroy
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (12 preceding siblings ...)
2009-09-18 22:50 ` [PATCH 13/24] fcoe: Call ndo_fcoe_enable/disable to turn FCoE feature on/off in LLD Robert Love
@ 2009-09-18 22:50 ` Robert Love
2009-09-18 22:50 ` [PATCH 15/24] fcoe: add check to fail gracefully in bonding mode Robert Love
` (9 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:50 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Mike Christie, Robert Love
From: Mike Christie <michaelc@cs.wisc.edu>
When doing echo ethX > /sys..../destroy I am getting
errors when the tear down succeeds. It looks like the
reason for this is because the rc var is not getting set
when the destruction works. This just sets it to zero.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/fcoe.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 49d46a8..0a3affd 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -1804,7 +1804,7 @@ static int fcoe_destroy(const char *buffer, struct kernel_param *kp)
{
struct fcoe_interface *fcoe;
struct net_device *netdev;
- int rc;
+ int rc = 0;
mutex_lock(&fcoe_config_mutex);
#ifdef CONFIG_FCOE_MODULE
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 15/24] fcoe: add check to fail gracefully in bonding mode
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (13 preceding siblings ...)
2009-09-18 22:50 ` [PATCH 14/24] fcoe: initialize return value in fcoe_destroy Robert Love
@ 2009-09-18 22:50 ` Robert Love
2009-09-18 22:50 ` [PATCH 16/24] libfc: fix RNN_ID smashing skb payload Robert Love
` (8 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:50 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: John Fastabend, Robert Love
From: john fastabend <john.r.fastabend@intel.com>
This patch adds a check to fail gracefully when the netdevice
is bonded. Previously, the error was detected but the stack
would continue to load. This resulted in a partially enabled
fcoe intance and errors when the fcoe instance was destroy.
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/fcoe.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 0a3affd..d8a5169 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -266,6 +266,7 @@ static int fcoe_interface_setup(struct fcoe_interface *fcoe,
if ((netdev->priv_flags & IFF_MASTER_ALB) ||
(netdev->priv_flags & IFF_SLAVE_INACTIVE) ||
(netdev->priv_flags & IFF_MASTER_8023AD)) {
+ FCOE_NETDEV_DBG(netdev, "Bonded interfaces not supported\n");
return -EOPNOTSUPP;
}
@@ -323,6 +324,7 @@ static int fcoe_interface_setup(struct fcoe_interface *fcoe,
static struct fcoe_interface *fcoe_interface_create(struct net_device *netdev)
{
struct fcoe_interface *fcoe;
+ int err;
fcoe = kzalloc(sizeof(*fcoe), GFP_KERNEL);
if (!fcoe) {
@@ -341,7 +343,13 @@ static struct fcoe_interface *fcoe_interface_create(struct net_device *netdev)
fcoe->ctlr.update_mac = fcoe_update_src_mac;
fcoe->ctlr.get_src_addr = fcoe_get_src_mac;
- fcoe_interface_setup(fcoe, netdev);
+ err = fcoe_interface_setup(fcoe, netdev);
+ if (err) {
+ fcoe_ctlr_destroy(&fcoe->ctlr);
+ kfree(fcoe);
+ dev_put(netdev);
+ return NULL;
+ }
return fcoe;
}
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 16/24] libfc: fix RNN_ID smashing skb payload
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (14 preceding siblings ...)
2009-09-18 22:50 ` [PATCH 15/24] fcoe: add check to fail gracefully in bonding mode Robert Love
@ 2009-09-18 22:50 ` Robert Love
2009-09-18 22:50 ` [PATCH 17/24] libfc: fix symbolic name registrations smashing skb data Robert Love
` (7 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:50 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Joe Eykholt, Robert Love
From: Joe Eykholt <jeykholt@cisco.com>
The code that filled in the name server RNN_ID (register node name)
request had somehow gotten a line in it from the RFT_ID code
which copies 32 bytes of data over the relatively short payload.
This caused some corruption and hangs.
Simply deleted the extraneous line.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
include/scsi/fc_encode.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index 9afcbb9..c8968d3 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -134,7 +134,6 @@ static inline int fc_ct_fill(struct fc_lport *lport,
ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id));
hton24(ct->payload.rn.fr_fid.fp_fid,
fc_host_port_id(lport->host));
- ct->payload.rft.fts = lport->fcts;
put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn);
break;
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 17/24] libfc: fix symbolic name registrations smashing skb data
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (15 preceding siblings ...)
2009-09-18 22:50 ` [PATCH 16/24] libfc: fix RNN_ID smashing skb payload Robert Love
@ 2009-09-18 22:50 ` Robert Love
2009-09-18 22:50 ` [PATCH 18/24] libfc: fix fc_els_resp_type to correct display of CT responses Robert Love
` (6 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:50 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Joe Eykholt, Robert Love
From: Joe Eykholt <jeykholt@cisco.com>
The strncpy for RSPN_ID and RSNN_NN requests was padding
past the allocated frame size.
Get the string length before filling in the ct header.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
include/scsi/fc_encode.h | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index c8968d3..ab2260c 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -111,6 +111,7 @@ static inline int fc_ct_fill(struct fc_lport *lport,
enum fc_fh_type *fh_type)
{
struct fc_ct_req *ct;
+ size_t len;
switch (op) {
case FC_NS_GPN_FT:
@@ -138,22 +139,22 @@ static inline int fc_ct_fill(struct fc_lport *lport,
break;
case FC_NS_RSPN_ID:
- ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn));
+ len = strnlen(fc_host_symbolic_name(lport->host), 255);
+ ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len);
hton24(ct->payload.spn.fr_fid.fp_fid,
fc_host_port_id(lport->host));
strncpy(ct->payload.spn.fr_name,
- fc_host_symbolic_name(lport->host), 255);
- ct->payload.spn.fr_name_len =
- strnlen(ct->payload.spn.fr_name, 255);
+ fc_host_symbolic_name(lport->host), len);
+ ct->payload.spn.fr_name_len = len;
break;
case FC_NS_RSNN_NN:
- ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn));
+ len = strnlen(fc_host_symbolic_name(lport->host), 255);
+ ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn) + len);
put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn);
strncpy(ct->payload.snn.fr_name,
- fc_host_symbolic_name(lport->host), 255);
- ct->payload.snn.fr_name_len =
- strnlen(ct->payload.snn.fr_name, 255);
+ fc_host_symbolic_name(lport->host), len);
+ ct->payload.snn.fr_name_len = len;
break;
default:
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 18/24] libfc: fix fc_els_resp_type to correct display of CT responses
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (16 preceding siblings ...)
2009-09-18 22:50 ` [PATCH 17/24] libfc: fix symbolic name registrations smashing skb data Robert Love
@ 2009-09-18 22:50 ` Robert Love
2009-09-18 22:50 ` [PATCH 19/24] libfc: add set_fid function to libfc template Robert Love
` (5 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:50 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Joe Eykholt, Robert Love
From: Joe Eykholt <jeykholt@cisco.com>
Local port debug messages were using fc_els_resp_type() which showed
all CT responses as rejects.
Handle CT responses correctly based by inspecting fh_type.
I decided not to rename the function to keep the patch smaller.
We could call it just fc_resp_type() or fc_elsct_resp_type().
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/libfc/fc_elsct.c | 41 +++++++++++++++++++++++++++++++++++------
1 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/libfc/fc_elsct.c b/drivers/scsi/libfc/fc_elsct.c
index 59183fb..9999719 100644
--- a/drivers/scsi/libfc/fc_elsct.c
+++ b/drivers/scsi/libfc/fc_elsct.c
@@ -88,6 +88,9 @@ EXPORT_SYMBOL(fc_elsct_init);
const char *fc_els_resp_type(struct fc_frame *fp)
{
const char *msg;
+ struct fc_frame_header *fh;
+ struct fc_ct_hdr *ct;
+
if (IS_ERR(fp)) {
switch (-PTR_ERR(fp)) {
case FC_NO_ERR:
@@ -104,15 +107,41 @@ const char *fc_els_resp_type(struct fc_frame *fp)
break;
}
} else {
- switch (fc_frame_payload_op(fp)) {
- case ELS_LS_ACC:
- msg = "accept";
+ fh = fc_frame_header_get(fp);
+ switch (fh->fh_type) {
+ case FC_TYPE_ELS:
+ switch (fc_frame_payload_op(fp)) {
+ case ELS_LS_ACC:
+ msg = "accept";
+ break;
+ case ELS_LS_RJT:
+ msg = "reject";
+ break;
+ default:
+ msg = "response unknown ELS";
+ break;
+ }
break;
- case ELS_LS_RJT:
- msg = "reject";
+ case FC_TYPE_CT:
+ ct = fc_frame_payload_get(fp, sizeof(*ct));
+ if (ct) {
+ switch (ntohs(ct->ct_cmd)) {
+ case FC_FS_ACC:
+ msg = "CT accept";
+ break;
+ case FC_FS_RJT:
+ msg = "CT reject";
+ break;
+ default:
+ msg = "response unknown CT";
+ break;
+ }
+ } else {
+ msg = "short CT response";
+ }
break;
default:
- msg = "response unknown ELS";
+ msg = "response not ELS or CT";
break;
}
}
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 19/24] libfc: add set_fid function to libfc template
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (17 preceding siblings ...)
2009-09-18 22:50 ` [PATCH 18/24] libfc: fix fc_els_resp_type to correct display of CT responses Robert Love
@ 2009-09-18 22:50 ` Robert Love
2009-09-18 22:50 ` [PATCH 20/24] libfc: add host number to lport link up/down messages Robert Love
` (4 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:50 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Joe Eykholt, Robert Love
From: Joe Eykholt <jeykholt@cisco.com>
This is to notify the LLD when an FC_ID is assigned to the local port.
The fnic driver needs to push the assigned FC_ID to firmware.
It currently does this by intercepting the FLOGI responses, and
in order to make that code more common with FIP and NPIV, it
makes more sense to wait until the local port has completely
handled the FLOGI or FDISC response. Also, when we fix
point-to-point FC_ID assignment, we'll need this callback as well.
Add a call to the libfc template, which is called whenever
the local port FC_ID is being assigned. It defaults to
fc_lport_set_fid(), supplied by libfc.
As additional benefit of this function, the LLD may determine
the MAC address that caused the change by looking at the received frame.
We also print the assigned port ID as long as it isn't 0.
Setting port ID to 0 happens often in reset while retrying FLOGI,
and would be uninteresting. This replaces the previous message
which didn't identify the host adapter instance.
patch v2 note: changed one word in a comment. "intercepted" -> "provided".
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/libfc/fc_lport.c | 34 +++++++++++++++++++++++++++-------
include/scsi/libfc.h | 20 ++++++++++++++++++++
2 files changed, 47 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 97e8a35..2f0d2ab 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -733,6 +733,27 @@ static void fc_lport_enter_ready(struct fc_lport *lport)
}
/**
+ * fc_lport_set_port_id() - set the local port Port ID
+ * @lport: The local port which will have its Port ID set.
+ * @port_id: The new port ID.
+ * @fp: The frame containing the incoming request, or NULL.
+ *
+ * Locking Note: The lport lock is expected to be held before calling
+ * this function.
+ */
+static void fc_lport_set_port_id(struct fc_lport *lport, u32 port_id,
+ struct fc_frame *fp)
+{
+ if (port_id)
+ printk(KERN_INFO "host%d: Assigned Port ID %6x\n",
+ lport->host->host_no, port_id);
+
+ fc_host_port_id(lport->host) = port_id;
+ if (lport->tt.lport_set_port_id)
+ lport->tt.lport_set_port_id(lport, port_id, fp);
+}
+
+/**
* fc_lport_recv_flogi_req() - Receive a FLOGI request
* @sp_in: The sequence the FLOGI is on
* @rx_fp: The FLOGI frame
@@ -790,7 +811,7 @@ static void fc_lport_recv_flogi_req(struct fc_seq *sp_in,
remote_fid = FC_LOCAL_PTP_FID_HI;
}
- fc_host_port_id(lport->host) = local_fid;
+ fc_lport_set_port_id(lport, local_fid, rx_fp);
fp = fc_frame_alloc(lport, sizeof(*flp));
if (fp) {
@@ -926,7 +947,9 @@ static void fc_lport_reset_locked(struct fc_lport *lport)
lport->tt.exch_mgr_reset(lport, 0, 0);
fc_host_fabric_name(lport->host) = 0;
- fc_host_port_id(lport->host) = 0;
+
+ if (fc_host_port_id(lport->host))
+ fc_lport_set_port_id(lport, 0, NULL);
}
/**
@@ -1428,11 +1451,6 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
fh = fc_frame_header_get(fp);
did = ntoh24(fh->fh_d_id);
if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) {
-
- printk(KERN_INFO "libfc: Assigned FID (%6x) in FLOGI response\n",
- did);
- fc_host_port_id(lport->host) = did;
-
flp = fc_frame_payload_get(fp, sizeof(*flp));
if (flp) {
mfs = ntohs(flp->fl_csp.sp_bb_data) &
@@ -1452,6 +1470,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
if (e_d_tov > lport->e_d_tov)
lport->e_d_tov = e_d_tov;
lport->r_a_tov = 2 * e_d_tov;
+ fc_lport_set_port_id(lport, did, fp);
printk(KERN_INFO "libfc: Port (%6x) entered "
"point to point mode\n", did);
fc_lport_ptp_setup(lport, ntoh24(fh->fh_s_id),
@@ -1464,6 +1483,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
lport->r_a_tov = r_a_tov;
fc_host_fabric_name(lport->host) =
get_unaligned_be64(&flp->fl_wwnn);
+ fc_lport_set_port_id(lport, did, fp);
fc_lport_enter_dns(lport);
}
}
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 0889c0e..62ee644 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -585,6 +585,26 @@ struct libfc_function_template {
int (*lport_reset)(struct fc_lport *);
/*
+ * Set the local port FC_ID.
+ *
+ * This may be provided by the LLD to allow it to be
+ * notified when the local port is assigned a FC-ID.
+ *
+ * The frame, if non-NULL, is the incoming frame with the
+ * FLOGI LS_ACC or FLOGI, and may contain the granted MAC
+ * address for the LLD. The frame pointer may be NULL if
+ * no MAC is associated with this assignment (LOGO or PLOGI).
+ *
+ * If FC_ID is non-zero, r_a_tov and e_d_tov must be valid.
+ *
+ * Note: this is called with the local port mutex held.
+ *
+ * STATUS: OPTIONAL
+ */
+ void (*lport_set_port_id)(struct fc_lport *, u32 port_id,
+ struct fc_frame *);
+
+ /*
* Create a remote port with a given port ID
*
* STATUS: OPTIONAL
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 20/24] libfc: add host number to lport link up/down messages.
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (18 preceding siblings ...)
2009-09-18 22:50 ` [PATCH 19/24] libfc: add set_fid function to libfc template Robert Love
@ 2009-09-18 22:50 ` Robert Love
2009-09-18 22:50 ` [PATCH 21/24] libfcoe: fcoe: simplify receive FLOGI response Robert Love
` (3 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:50 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Joe Eykholt, Robert Love
From: Joe Eykholt <jeykholt@cisco.com>
The libfc link up/down messages don't indicate which port is changing.
The Port ID will often be 0.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/libfc/fc_lport.c | 24 ++++++++++++++----------
1 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 2f0d2ab..58c145c 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -568,8 +568,8 @@ void __fc_linkup(struct fc_lport *lport)
*/
void fc_linkup(struct fc_lport *lport)
{
- printk(KERN_INFO "libfc: Link up on port (%6x)\n",
- fc_host_port_id(lport->host));
+ printk(KERN_INFO "host%d: libfc: Link up on port (%6x)\n",
+ lport->host->host_no, fc_host_port_id(lport->host));
mutex_lock(&lport->lp_mutex);
__fc_linkup(lport);
@@ -598,8 +598,8 @@ void __fc_linkdown(struct fc_lport *lport)
*/
void fc_linkdown(struct fc_lport *lport)
{
- printk(KERN_INFO "libfc: Link down on port (%6x)\n",
- fc_host_port_id(lport->host));
+ printk(KERN_INFO "host%d: libfc: Link down on port (%6x)\n",
+ lport->host->host_no, fc_host_port_id(lport->host));
mutex_lock(&lport->lp_mutex);
__fc_linkdown(lport);
@@ -699,8 +699,9 @@ void fc_lport_disc_callback(struct fc_lport *lport, enum fc_disc_event event)
FC_LPORT_DBG(lport, "Discovery succeeded\n");
break;
case DISC_EV_FAILED:
- printk(KERN_ERR "libfc: Discovery failed for port (%6x)\n",
- fc_host_port_id(lport->host));
+ printk(KERN_ERR "host%d: libfc: "
+ "Discovery failed for port (%6x)\n",
+ lport->host->host_no, fc_host_port_id(lport->host));
mutex_lock(&lport->lp_mutex);
fc_lport_enter_reset(lport);
mutex_unlock(&lport->lp_mutex);
@@ -791,8 +792,9 @@ static void fc_lport_recv_flogi_req(struct fc_seq *sp_in,
goto out;
remote_wwpn = get_unaligned_be64(&flp->fl_wwpn);
if (remote_wwpn == lport->wwpn) {
- printk(KERN_WARNING "libfc: Received FLOGI from port "
- "with same WWPN %llx\n", remote_wwpn);
+ printk(KERN_WARNING "host%d: libfc: Received FLOGI from port "
+ "with same WWPN %llx\n",
+ lport->host->host_no, remote_wwpn);
goto out;
}
FC_LPORT_DBG(lport, "FLOGI from port WWPN %llx\n", remote_wwpn);
@@ -1471,8 +1473,10 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
lport->e_d_tov = e_d_tov;
lport->r_a_tov = 2 * e_d_tov;
fc_lport_set_port_id(lport, did, fp);
- printk(KERN_INFO "libfc: Port (%6x) entered "
- "point to point mode\n", did);
+ printk(KERN_INFO "host%d: libfc: "
+ "Port (%6x) entered "
+ "point-to-point mode\n",
+ lport->host->host_no, did);
fc_lport_ptp_setup(lport, ntoh24(fh->fh_s_id),
get_unaligned_be64(
&flp->fl_wwpn),
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 21/24] libfcoe: fcoe: simplify receive FLOGI response
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (19 preceding siblings ...)
2009-09-18 22:50 ` [PATCH 20/24] libfc: add host number to lport link up/down messages Robert Love
@ 2009-09-18 22:50 ` Robert Love
2009-09-18 22:50 ` [PATCH 22/24] fnic: Add FIP support to the fnic driver Robert Love
` (2 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:50 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Joe Eykholt, Robert Love
From: Joe Eykholt <jeykholt@cisco.com>
There was a locking problem where the fip->lock was held during
the call to update_mac(). The rtnl_lock() must be taken before
the fip->lock, not the other way around. This fixes that.
Now that fcoe_ctlr_recv_flog() is called only from the response handler
to a FLOGI request, some checking can be eliminated. Instead of calling
update_mac(), just fill in the granted_mac address for the passed-in
frame (skb).
Eliminate the passed-in source MAC address since it is also in the skb.
Also, in fcoe, call fcoe_set_src_mac() directly instead of going thru
the fip function pointer. This will generate less code.
Then, since fip isn't needed for LOGO response, use lport as the arg.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/fcoe.c | 15 +++++----------
drivers/scsi/fcoe/libfcoe.c | 12 ++++++------
include/scsi/libfcoe.h | 2 +-
3 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index d8a5169..be07a45 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -2248,15 +2248,12 @@ static void fcoe_flogi_resp(struct fc_seq *seq, struct fc_frame *fp, void *arg)
mac = fr_cb(fp)->granted_mac;
if (is_zero_ether_addr(mac)) {
/* pre-FIP */
- mac = eth_hdr(&fp->skb)->h_source;
- if (fcoe_ctlr_recv_flogi(fip, lport, fp, mac)) {
+ if (fcoe_ctlr_recv_flogi(fip, lport, fp)) {
fc_frame_free(fp);
return;
}
- } else {
- /* FIP, libfcoe has already seen it */
- fip->update_mac(lport, fr_cb(fp)->granted_mac);
}
+ fcoe_update_src_mac(lport, mac);
done:
fc_lport_flogi_resp(seq, fp, lport);
}
@@ -2272,13 +2269,11 @@ done:
*/
static void fcoe_logo_resp(struct fc_seq *seq, struct fc_frame *fp, void *arg)
{
- struct fcoe_ctlr *fip = arg;
- struct fc_exch *exch = fc_seq_exch(seq);
- struct fc_lport *lport = exch->lp;
+ struct fc_lport *lport = arg;
static u8 zero_mac[ETH_ALEN] = { 0 };
if (!IS_ERR(fp))
- fip->update_mac(lport, zero_mac);
+ fcoe_update_src_mac(lport, zero_mac);
fc_lport_logo_resp(seq, fp, lport);
}
@@ -2313,7 +2308,7 @@ static struct fc_seq *fcoe_elsct_send(struct fc_lport *lport, u32 did,
if (ntoh24(fh->fh_d_id) != FC_FID_FLOGI)
break;
return fc_elsct_send(lport, did, fp, op, fcoe_logo_resp,
- fip, timeout);
+ lport, timeout);
}
return fc_elsct_send(lport, did, fp, op, resp, arg, timeout);
}
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index 062ad15..e4508c8 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -1255,10 +1255,9 @@ static void fcoe_ctlr_recv_work(struct work_struct *recv_work)
}
/**
- * fcoe_ctlr_recv_flogi() - Snoop pre-FIP receipt of FLOGI response or request
+ * fcoe_ctlr_recv_flogi() - Snoop pre-FIP receipt of FLOGI response
* @fip: The FCoE controller
* @fp: The FC frame to snoop
- * @sa: Ethernet source MAC address from received FCoE frame
*
* Snoop potential response to FLOGI or even incoming FLOGI.
*
@@ -1266,16 +1265,18 @@ static void fcoe_ctlr_recv_work(struct work_struct *recv_work)
* by fip->flogi_oxid != FC_XID_UNKNOWN.
*
* The caller is responsible for freeing the frame.
+ * Fill in the granted_mac address.
*
* Return non-zero if the frame should not be delivered to libfc.
*/
int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *fip, struct fc_lport *lport,
- struct fc_frame *fp, u8 *sa)
+ struct fc_frame *fp)
{
struct fc_frame_header *fh;
u8 op;
- u8 mac[ETH_ALEN];
+ u8 *sa;
+ sa = eth_hdr(&fp->skb)->h_source;
fh = fc_frame_header_get(fp);
if (fh->fh_type != FC_TYPE_ELS)
return 0;
@@ -1306,9 +1307,8 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *fip, struct fc_lport *lport,
fip->map_dest = 0;
}
fip->flogi_oxid = FC_XID_UNKNOWN;
- fc_fcoe_set_mac(mac, fh->fh_d_id);
- fip->update_mac(lport, mac);
spin_unlock_bh(&fip->lock);
+ fc_fcoe_set_mac(fr_cb(fp)->granted_mac, fh->fh_d_id);
} else if (op == ELS_FLOGI && fh->fh_r_ctl == FC_RCTL_ELS_REQ && sa) {
/*
* Save source MAC for point-to-point responses.
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index e38ffa0..3837872 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -165,7 +165,7 @@ int fcoe_ctlr_link_down(struct fcoe_ctlr *);
int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct fc_lport *, struct sk_buff *);
void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *);
int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *,
- struct fc_frame *, u8 *);
+ struct fc_frame *);
/* libfcoe funcs */
u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int);
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 22/24] fnic: Add FIP support to the fnic driver
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (20 preceding siblings ...)
2009-09-18 22:50 ` [PATCH 21/24] libfcoe: fcoe: simplify receive FLOGI response Robert Love
@ 2009-09-18 22:50 ` Robert Love
2009-09-18 22:51 ` [PATCH 23/24] libfc: register FC4 features with the FC switch Robert Love
2009-09-18 22:51 ` [PATCH 24/24] MAINTAINERS: Update for libfc, libfcoe, fcoe Robert Love
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:50 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Joe Eykholt, Robert Love
From: Joe Eykholt <jeykholt@cisco.com>
Use libfcoe as a common FIP implementation with fcoe.
FIP or non-FIP mode is fully automatic if the firmware
supports and enables it.
Even if FIP is not supported, this uses libfcoe for the non-FIP
handling of FLOGI and its response.
Use the new lport_set_port_id() notification to capture
successful FLOGI responses and port_id resets.
While transitioning between Ethernet and FC mode, all rx and
tx FC frames are queued. In Ethernet mode, all frames are
passed to the exchange manager to capture FLOGI responses.
Change to set data_src_addr to the ctl_src_addr whenever it
would have previously been zero because we're not logged in.
This seems safer so we'll never send a frame with a 0 source MAC.
This also eliminates a special case for sending FLOGI frames.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/Kconfig | 2
drivers/scsi/fnic/fnic.h | 23 +-
drivers/scsi/fnic/fnic_fcs.c | 499 ++++++++++++++++++++---------------------
drivers/scsi/fnic/fnic_main.c | 71 +++---
drivers/scsi/fnic/fnic_res.c | 5
drivers/scsi/fnic/fnic_res.h | 50 ++++
drivers/scsi/fnic/fnic_scsi.c | 73 +++---
drivers/scsi/fnic/vnic_scsi.h | 1
8 files changed, 382 insertions(+), 342 deletions(-)
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 82bb3b2..49d33f4 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -643,7 +643,7 @@ config FCOE
config FCOE_FNIC
tristate "Cisco FNIC Driver"
depends on PCI && X86
- select LIBFC
+ select LIBFCOE
help
This is support for the Cisco PCI-Express FCoE HBA.
diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index e4c0a3d..d0284dc 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -22,6 +22,7 @@
#include <linux/netdevice.h>
#include <linux/workqueue.h>
#include <scsi/libfc.h>
+#include <scsi/libfcoe.h>
#include "fnic_io.h"
#include "fnic_res.h"
#include "vnic_dev.h"
@@ -145,6 +146,7 @@ struct mempool;
/* Per-instance private data structure */
struct fnic {
struct fc_lport *lport;
+ struct fcoe_ctlr ctlr; /* FIP FCoE controller structure */
struct vnic_dev_bar bar0;
struct msix_entry msix_entry[FNIC_MSIX_INTR_MAX];
@@ -162,23 +164,16 @@ struct fnic {
unsigned int wq_count;
unsigned int cq_count;
- u32 fcoui_mode:1; /* use fcoui address*/
u32 vlan_hw_insert:1; /* let hw insert the tag */
u32 in_remove:1; /* fnic device in removal */
u32 stop_rx_link_events:1; /* stop proc. rx frames, link events */
struct completion *remove_wait; /* device remove thread blocks */
- struct fc_frame *flogi;
- struct fc_frame *flogi_resp;
- u16 flogi_oxid;
- unsigned long s_id;
enum fnic_state state;
spinlock_t fnic_lock;
u16 vlan_id; /* VLAN tag including priority */
- u8 mac_addr[ETH_ALEN];
- u8 dest_addr[ETH_ALEN];
u8 data_src_addr[ETH_ALEN];
u64 fcp_input_bytes; /* internal statistic */
u64 fcp_output_bytes; /* internal statistic */
@@ -205,6 +200,7 @@ struct fnic {
struct work_struct link_work;
struct work_struct frame_work;
struct sk_buff_head frame_queue;
+ struct sk_buff_head tx_queue;
/* copy work queue cache line section */
____cacheline_aligned struct vnic_wq_copy wq_copy[FNIC_WQ_COPY_MAX];
@@ -224,6 +220,11 @@ struct fnic {
____cacheline_aligned struct vnic_intr intr[FNIC_MSIX_INTR_MAX];
};
+static inline struct fnic *fnic_from_ctlr(struct fcoe_ctlr *fip)
+{
+ return container_of(fip, struct fnic, ctlr);
+}
+
extern struct workqueue_struct *fnic_event_queue;
extern struct device_attribute *fnic_attrs[];
@@ -239,7 +240,11 @@ void fnic_handle_link(struct work_struct *work);
int fnic_rq_cmpl_handler(struct fnic *fnic, int);
int fnic_alloc_rq_frame(struct vnic_rq *rq);
void fnic_free_rq_buf(struct vnic_rq *rq, struct vnic_rq_buf *buf);
-int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp);
+void fnic_flush_tx(struct fnic *);
+void fnic_eth_send(struct fcoe_ctlr *, struct sk_buff *skb);
+void fnic_set_port_id(struct fc_lport *, u32, struct fc_frame *);
+void fnic_update_mac(struct fc_lport *, u8 *new);
+void fnic_update_mac_locked(struct fnic *, u8 *new);
int fnic_queuecommand(struct scsi_cmnd *, void (*done)(struct scsi_cmnd *));
int fnic_abort_cmd(struct scsi_cmnd *);
@@ -252,7 +257,7 @@ void fnic_empty_scsi_cleanup(struct fc_lport *);
void fnic_exch_mgr_reset(struct fc_lport *, u32, u32);
int fnic_wq_copy_cmpl_handler(struct fnic *fnic, int);
int fnic_wq_cmpl_handler(struct fnic *fnic, int);
-int fnic_flogi_reg_handler(struct fnic *fnic);
+int fnic_flogi_reg_handler(struct fnic *fnic, u32);
void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq,
struct fcpio_host_req *desc);
int fnic_fw_reset_handler(struct fnic *fnic);
diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic_fcs.c
index 50db3e3..54f8d0e 100644
--- a/drivers/scsi/fnic/fnic_fcs.c
+++ b/drivers/scsi/fnic/fnic_fcs.c
@@ -23,6 +23,7 @@
#include <linux/if_ether.h>
#include <linux/if_vlan.h>
#include <linux/workqueue.h>
+#include <scsi/fc/fc_fip.h>
#include <scsi/fc/fc_els.h>
#include <scsi/fc/fc_fcoe.h>
#include <scsi/fc_frame.h>
@@ -34,6 +35,8 @@
struct workqueue_struct *fnic_event_queue;
+static void fnic_set_eth_mode(struct fnic *);
+
void fnic_handle_link(struct work_struct *work)
{
struct fnic *fnic = container_of(work, struct fnic, link_work);
@@ -64,10 +67,10 @@ void fnic_handle_link(struct work_struct *work)
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
"link down\n");
- fc_linkdown(fnic->lport);
+ fcoe_ctlr_link_down(&fnic->ctlr);
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
"link up\n");
- fc_linkup(fnic->lport);
+ fcoe_ctlr_link_up(&fnic->ctlr);
} else
/* UP -> UP */
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
@@ -76,13 +79,13 @@ void fnic_handle_link(struct work_struct *work)
/* DOWN -> UP */
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "link up\n");
- fc_linkup(fnic->lport);
+ fcoe_ctlr_link_up(&fnic->ctlr);
} else {
/* UP -> DOWN */
fnic->lport->host_stats.link_failure_count++;
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "link down\n");
- fc_linkdown(fnic->lport);
+ fcoe_ctlr_link_down(&fnic->ctlr);
}
}
@@ -107,197 +110,179 @@ void fnic_handle_frame(struct work_struct *work)
return;
}
fp = (struct fc_frame *)skb;
- /* if Flogi resp frame, register the address */
- if (fr_flags(fp)) {
- vnic_dev_add_addr(fnic->vdev,
- fnic->data_src_addr);
- fr_flags(fp) = 0;
+
+ /*
+ * If we're in a transitional state, just re-queue and return.
+ * The queue will be serviced when we get to a stable state.
+ */
+ if (fnic->state != FNIC_IN_FC_MODE &&
+ fnic->state != FNIC_IN_ETH_MODE) {
+ skb_queue_head(&fnic->frame_queue, skb);
+ spin_unlock_irqrestore(&fnic->fnic_lock, flags);
+ return;
}
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
fc_exch_recv(lp, fp);
}
-
-}
-
-static inline void fnic_import_rq_fc_frame(struct sk_buff *skb,
- u32 len, u8 sof, u8 eof)
-{
- struct fc_frame *fp = (struct fc_frame *)skb;
-
- skb_trim(skb, len);
- fr_eof(fp) = eof;
- fr_sof(fp) = sof;
}
-
-static inline int fnic_import_rq_eth_pkt(struct sk_buff *skb, u32 len)
+/**
+ * fnic_import_rq_eth_pkt() - handle received FCoE or FIP frame.
+ * @fnic: fnic instance.
+ * @skb: Ethernet Frame.
+ */
+static inline int fnic_import_rq_eth_pkt(struct fnic *fnic, struct sk_buff *skb)
{
struct fc_frame *fp;
struct ethhdr *eh;
- struct vlan_ethhdr *vh;
struct fcoe_hdr *fcoe_hdr;
struct fcoe_crc_eof *ft;
- u32 transport_len = 0;
+ /*
+ * Undo VLAN encapsulation if present.
+ */
eh = (struct ethhdr *)skb->data;
- vh = (struct vlan_ethhdr *)skb->data;
- if (vh->h_vlan_proto == htons(ETH_P_8021Q) &&
- vh->h_vlan_encapsulated_proto == htons(ETH_P_FCOE)) {
- skb_pull(skb, sizeof(struct vlan_ethhdr));
- transport_len += sizeof(struct vlan_ethhdr);
- } else if (eh->h_proto == htons(ETH_P_FCOE)) {
- transport_len += sizeof(struct ethhdr);
- skb_pull(skb, sizeof(struct ethhdr));
- } else
- return -1;
+ if (eh->h_proto == htons(ETH_P_8021Q)) {
+ memmove((u8 *)eh + VLAN_HLEN, eh, ETH_ALEN * 2);
+ eh = (struct ethhdr *)skb_pull(skb, VLAN_HLEN);
+ skb_reset_mac_header(skb);
+ }
+ if (eh->h_proto == htons(ETH_P_FIP)) {
+ skb_pull(skb, sizeof(*eh));
+ fcoe_ctlr_recv(&fnic->ctlr, skb);
+ return 1; /* let caller know packet was used */
+ }
+ if (eh->h_proto != htons(ETH_P_FCOE))
+ goto drop;
+ skb_set_network_header(skb, sizeof(*eh));
+ skb_pull(skb, sizeof(*eh));
fcoe_hdr = (struct fcoe_hdr *)skb->data;
if (FC_FCOE_DECAPS_VER(fcoe_hdr) != FC_FCOE_VER)
- return -1;
+ goto drop;
fp = (struct fc_frame *)skb;
fc_frame_init(fp);
fr_sof(fp) = fcoe_hdr->fcoe_sof;
skb_pull(skb, sizeof(struct fcoe_hdr));
- transport_len += sizeof(struct fcoe_hdr);
+ skb_reset_transport_header(skb);
- ft = (struct fcoe_crc_eof *)(skb->data + len -
- transport_len - sizeof(*ft));
+ ft = (struct fcoe_crc_eof *)(skb->data + skb->len - sizeof(*ft));
fr_eof(fp) = ft->fcoe_eof;
- skb_trim(skb, len - transport_len - sizeof(*ft));
+ skb_trim(skb, skb->len - sizeof(*ft));
return 0;
+drop:
+ dev_kfree_skb_irq(skb);
+ return -1;
}
-static inline int fnic_handle_flogi_resp(struct fnic *fnic,
- struct fc_frame *fp)
+/**
+ * fnic_update_mac_locked() - set data MAC address and filters.
+ * @fnic: fnic instance.
+ * @new: newly-assigned FCoE MAC address.
+ *
+ * Called with the fnic lock held.
+ */
+void fnic_update_mac_locked(struct fnic *fnic, u8 *new)
{
- u8 mac[ETH_ALEN] = FC_FCOE_FLOGI_MAC;
- struct ethhdr *eth_hdr;
- struct fc_frame_header *fh;
- int ret = 0;
- unsigned long flags;
- struct fc_frame *old_flogi_resp = NULL;
+ u8 *ctl = fnic->ctlr.ctl_src_addr;
+ u8 *data = fnic->data_src_addr;
- fh = (struct fc_frame_header *)fr_hdr(fp);
+ if (is_zero_ether_addr(new))
+ new = ctl;
+ if (!compare_ether_addr(data, new))
+ return;
+ FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "update_mac %pM\n", new);
+ if (!is_zero_ether_addr(data) && compare_ether_addr(data, ctl))
+ vnic_dev_del_addr(fnic->vdev, data);
+ memcpy(data, new, ETH_ALEN);
+ if (compare_ether_addr(new, ctl))
+ vnic_dev_add_addr(fnic->vdev, new);
+}
- spin_lock_irqsave(&fnic->fnic_lock, flags);
+/**
+ * fnic_update_mac() - set data MAC address and filters.
+ * @lport: local port.
+ * @new: newly-assigned FCoE MAC address.
+ */
+void fnic_update_mac(struct fc_lport *lport, u8 *new)
+{
+ struct fnic *fnic = lport_priv(lport);
- if (fnic->state == FNIC_IN_ETH_MODE) {
+ spin_lock_irq(&fnic->fnic_lock);
+ fnic_update_mac_locked(fnic, new);
+ spin_unlock_irq(&fnic->fnic_lock);
+}
- /*
- * Check if oxid matches on taking the lock. A new Flogi
- * issued by libFC might have changed the fnic cached oxid
- */
- if (fnic->flogi_oxid != ntohs(fh->fh_ox_id)) {
- FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
- "Flogi response oxid not"
- " matching cached oxid, dropping frame"
- "\n");
- ret = -1;
- spin_unlock_irqrestore(&fnic->fnic_lock, flags);
- dev_kfree_skb_irq(fp_skb(fp));
- goto handle_flogi_resp_end;
- }
+/**
+ * fnic_set_port_id() - set the port_ID after successful FLOGI.
+ * @lport: local port.
+ * @port_id: assigned FC_ID.
+ * @fp: received frame containing the FLOGI accept or NULL.
+ *
+ * This is called from libfc when a new FC_ID has been assigned.
+ * This causes us to reset the firmware to FC_MODE and setup the new MAC
+ * address and FC_ID.
+ *
+ * It is also called with FC_ID 0 when we're logged off.
+ *
+ * If the FC_ID is due to point-to-point, fp may be NULL.
+ */
+void fnic_set_port_id(struct fc_lport *lport, u32 port_id, struct fc_frame *fp)
+{
+ struct fnic *fnic = lport_priv(lport);
+ u8 *mac;
+ int ret;
- /* Drop older cached flogi response frame, cache this frame */
- old_flogi_resp = fnic->flogi_resp;
- fnic->flogi_resp = fp;
- fnic->flogi_oxid = FC_XID_UNKNOWN;
+ FNIC_FCS_DBG(KERN_DEBUG, lport->host, "set port_id %x fp %p\n",
+ port_id, fp);
- /*
- * this frame is part of flogi get the src mac addr from this
- * frame if the src mac is fcoui based then we mark the
- * address mode flag to use fcoui base for dst mac addr
- * otherwise we have to store the fcoe gateway addr
- */
- eth_hdr = (struct ethhdr *)skb_mac_header(fp_skb(fp));
- memcpy(mac, eth_hdr->h_source, ETH_ALEN);
+ /*
+ * If we're clearing the FC_ID, change to use the ctl_src_addr.
+ * Set ethernet mode to send FLOGI.
+ */
+ if (!port_id) {
+ fnic_update_mac(lport, fnic->ctlr.ctl_src_addr);
+ fnic_set_eth_mode(fnic);
+ return;
+ }
- if (ntoh24(mac) == FC_FCOE_OUI)
- fnic->fcoui_mode = 1;
- else {
- fnic->fcoui_mode = 0;
- memcpy(fnic->dest_addr, mac, ETH_ALEN);
+ if (fp) {
+ mac = fr_cb(fp)->granted_mac;
+ if (is_zero_ether_addr(mac)) {
+ /* non-FIP - FLOGI already accepted - ignore return */
+ fcoe_ctlr_recv_flogi(&fnic->ctlr, lport, fp);
}
+ fnic_update_mac(lport, mac);
+ }
- /*
- * Except for Flogi frame, all outbound frames from us have the
- * Eth Src address as FC_FCOE_OUI"our_sid". Flogi frame uses
- * the vnic MAC address as the Eth Src address
- */
- fc_fcoe_set_mac(fnic->data_src_addr, fh->fh_d_id);
-
- /* We get our s_id from the d_id of the flogi resp frame */
- fnic->s_id = ntoh24(fh->fh_d_id);
-
- /* Change state to reflect transition from Eth to FC mode */
+ /* Change state to reflect transition to FC mode */
+ spin_lock_irq(&fnic->fnic_lock);
+ if (fnic->state == FNIC_IN_ETH_MODE || fnic->state == FNIC_IN_FC_MODE)
fnic->state = FNIC_IN_ETH_TRANS_FC_MODE;
-
- } else {
+ else {
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
"Unexpected fnic state %s while"
" processing flogi resp\n",
fnic_state_to_str(fnic->state));
- ret = -1;
- spin_unlock_irqrestore(&fnic->fnic_lock, flags);
- dev_kfree_skb_irq(fp_skb(fp));
- goto handle_flogi_resp_end;
+ spin_unlock_irq(&fnic->fnic_lock);
+ return;
}
-
- spin_unlock_irqrestore(&fnic->fnic_lock, flags);
-
- /* Drop older cached frame */
- if (old_flogi_resp)
- dev_kfree_skb_irq(fp_skb(old_flogi_resp));
+ spin_unlock_irq(&fnic->fnic_lock);
/*
- * send flogi reg request to firmware, this will put the fnic in
- * in FC mode
+ * Send FLOGI registration to firmware to set up FC mode.
+ * The new address will be set up when registration completes.
*/
- ret = fnic_flogi_reg_handler(fnic);
+ ret = fnic_flogi_reg_handler(fnic, port_id);
if (ret < 0) {
- int free_fp = 1;
- spin_lock_irqsave(&fnic->fnic_lock, flags);
- /*
- * free the frame is some other thread is not
- * pointing to it
- */
- if (fnic->flogi_resp != fp)
- free_fp = 0;
- else
- fnic->flogi_resp = NULL;
-
+ spin_lock_irq(&fnic->fnic_lock);
if (fnic->state == FNIC_IN_ETH_TRANS_FC_MODE)
fnic->state = FNIC_IN_ETH_MODE;
- spin_unlock_irqrestore(&fnic->fnic_lock, flags);
- if (free_fp)
- dev_kfree_skb_irq(fp_skb(fp));
+ spin_unlock_irq(&fnic->fnic_lock);
}
-
- handle_flogi_resp_end:
- return ret;
-}
-
-/* Returns 1 for a response that matches cached flogi oxid */
-static inline int is_matching_flogi_resp_frame(struct fnic *fnic,
- struct fc_frame *fp)
-{
- struct fc_frame_header *fh;
- int ret = 0;
- u32 f_ctl;
-
- fh = fc_frame_header_get(fp);
- f_ctl = ntoh24(fh->fh_f_ctl);
-
- if (fnic->flogi_oxid == ntohs(fh->fh_ox_id) &&
- fh->fh_r_ctl == FC_RCTL_ELS_REP &&
- (f_ctl & (FC_FC_EX_CTX | FC_FC_SEQ_CTX)) == FC_FC_EX_CTX &&
- fh->fh_type == FC_TYPE_ELS)
- ret = 1;
-
- return ret;
}
static void fnic_rq_cmpl_frame_recv(struct vnic_rq *rq, struct cq_desc
@@ -326,6 +311,7 @@ static void fnic_rq_cmpl_frame_recv(struct vnic_rq *rq, struct cq_desc
pci_unmap_single(fnic->pdev, buf->dma_addr, buf->len,
PCI_DMA_FROMDEVICE);
skb = buf->os_buf;
+ fp = (struct fc_frame *)skb;
buf->os_buf = NULL;
cq_desc_dec(cq_desc, &type, &color, &q_number, &completed_index);
@@ -338,6 +324,9 @@ static void fnic_rq_cmpl_frame_recv(struct vnic_rq *rq, struct cq_desc
&fcoe_enc_error, &fcs_ok, &vlan_stripped,
&vlan);
eth_hdrs_stripped = 1;
+ skb_trim(skb, fcp_bytes_written);
+ fr_sof(fp) = sof;
+ fr_eof(fp) = eof;
} else if (type == CQ_DESC_TYPE_RQ_ENET) {
cq_enet_rq_desc_dec((struct cq_enet_rq_desc *)cq_desc,
@@ -352,6 +341,14 @@ static void fnic_rq_cmpl_frame_recv(struct vnic_rq *rq, struct cq_desc
&ipv4_csum_ok, &ipv6, &ipv4,
&ipv4_fragment, &fcs_ok);
eth_hdrs_stripped = 0;
+ skb_trim(skb, bytes_written);
+ if (!fcs_ok) {
+ FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
+ "fcs error. dropping packet.\n");
+ goto drop;
+ }
+ if (fnic_import_rq_eth_pkt(fnic, skb))
+ return;
} else {
/* wrong CQ type*/
@@ -370,43 +367,11 @@ static void fnic_rq_cmpl_frame_recv(struct vnic_rq *rq, struct cq_desc
goto drop;
}
- if (eth_hdrs_stripped)
- fnic_import_rq_fc_frame(skb, fcp_bytes_written, sof, eof);
- else if (fnic_import_rq_eth_pkt(skb, bytes_written))
- goto drop;
-
- fp = (struct fc_frame *)skb;
-
- /*
- * If frame is an ELS response that matches the cached FLOGI OX_ID,
- * and is accept, issue flogi_reg_request copy wq request to firmware
- * to register the S_ID and determine whether FC_OUI mode or GW mode.
- */
- if (is_matching_flogi_resp_frame(fnic, fp)) {
- if (!eth_hdrs_stripped) {
- if (fc_frame_payload_op(fp) == ELS_LS_ACC) {
- fnic_handle_flogi_resp(fnic, fp);
- return;
- }
- /*
- * Recd. Flogi reject. No point registering
- * with fw, but forward to libFC
- */
- goto forward;
- }
- goto drop;
- }
- if (!eth_hdrs_stripped)
- goto drop;
-
-forward:
spin_lock_irqsave(&fnic->fnic_lock, flags);
if (fnic->stop_rx_link_events) {
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
goto drop;
}
- /* Use fr_flags to indicate whether succ. flogi resp or not */
- fr_flags(fp) = 0;
fr_dev(fp) = fnic->lport;
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
@@ -494,12 +459,49 @@ void fnic_free_rq_buf(struct vnic_rq *rq, struct vnic_rq_buf *buf)
buf->os_buf = NULL;
}
-static inline int is_flogi_frame(struct fc_frame_header *fh)
+/**
+ * fnic_eth_send() - Send Ethernet frame.
+ * @fip: fcoe_ctlr instance.
+ * @skb: Ethernet Frame, FIP, without VLAN encapsulation.
+ */
+void fnic_eth_send(struct fcoe_ctlr *fip, struct sk_buff *skb)
{
- return fh->fh_r_ctl == FC_RCTL_ELS_REQ && *(u8 *)(fh + 1) == ELS_FLOGI;
+ struct fnic *fnic = fnic_from_ctlr(fip);
+ struct vnic_wq *wq = &fnic->wq[0];
+ dma_addr_t pa;
+ struct ethhdr *eth_hdr;
+ struct vlan_ethhdr *vlan_hdr;
+ unsigned long flags;
+
+ if (!fnic->vlan_hw_insert) {
+ eth_hdr = (struct ethhdr *)skb_mac_header(skb);
+ vlan_hdr = (struct vlan_ethhdr *)skb_push(skb,
+ sizeof(*vlan_hdr) - sizeof(*eth_hdr));
+ memcpy(vlan_hdr, eth_hdr, 2 * ETH_ALEN);
+ vlan_hdr->h_vlan_proto = htons(ETH_P_8021Q);
+ vlan_hdr->h_vlan_encapsulated_proto = eth_hdr->h_proto;
+ vlan_hdr->h_vlan_TCI = htons(fnic->vlan_id);
+ }
+
+ pa = pci_map_single(fnic->pdev, skb->data, skb->len, PCI_DMA_TODEVICE);
+
+ spin_lock_irqsave(&fnic->wq_lock[0], flags);
+ if (!vnic_wq_desc_avail(wq)) {
+ pci_unmap_single(fnic->pdev, pa, skb->len, PCI_DMA_TODEVICE);
+ spin_unlock_irqrestore(&fnic->wq_lock[0], flags);
+ kfree_skb(skb);
+ return;
+ }
+
+ fnic_queue_wq_eth_desc(wq, skb, pa, skb->len,
+ fnic->vlan_hw_insert, fnic->vlan_id, 1);
+ spin_unlock_irqrestore(&fnic->wq_lock[0], flags);
}
-int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp)
+/*
+ * Send FC frame.
+ */
+static int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp)
{
struct vnic_wq *wq = &fnic->wq[0];
struct sk_buff *skb;
@@ -515,6 +517,10 @@ int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp)
fh = fc_frame_header_get(fp);
skb = fp_skb(fp);
+ if (unlikely(fh->fh_r_ctl == FC_RCTL_ELS_REQ) &&
+ fcoe_ctlr_els_send(&fnic->ctlr, fnic->lport, skb))
+ return 0;
+
if (!fnic->vlan_hw_insert) {
eth_hdr_len = sizeof(*vlan_hdr) + sizeof(*fcoe_hdr);
vlan_hdr = (struct vlan_ethhdr *)skb_push(skb, eth_hdr_len);
@@ -530,16 +536,11 @@ int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp)
fcoe_hdr = (struct fcoe_hdr *)(eth_hdr + 1);
}
- if (is_flogi_frame(fh)) {
+ if (fnic->ctlr.map_dest)
fc_fcoe_set_mac(eth_hdr->h_dest, fh->fh_d_id);
- memcpy(eth_hdr->h_source, fnic->mac_addr, ETH_ALEN);
- } else {
- if (fnic->fcoui_mode)
- fc_fcoe_set_mac(eth_hdr->h_dest, fh->fh_d_id);
- else
- memcpy(eth_hdr->h_dest, fnic->dest_addr, ETH_ALEN);
- memcpy(eth_hdr->h_source, fnic->data_src_addr, ETH_ALEN);
- }
+ else
+ memcpy(eth_hdr->h_dest, fnic->ctlr.dest_addr, ETH_ALEN);
+ memcpy(eth_hdr->h_source, fnic->data_src_addr, ETH_ALEN);
tot_len = skb->len;
BUG_ON(tot_len % 4);
@@ -578,109 +579,85 @@ fnic_send_frame_end:
int fnic_send(struct fc_lport *lp, struct fc_frame *fp)
{
struct fnic *fnic = lport_priv(lp);
- struct fc_frame_header *fh;
- int ret = 0;
- enum fnic_state old_state;
unsigned long flags;
- struct fc_frame *old_flogi = NULL;
- struct fc_frame *old_flogi_resp = NULL;
if (fnic->in_remove) {
dev_kfree_skb(fp_skb(fp));
- ret = -1;
- goto fnic_send_end;
+ return -1;
}
- fh = fc_frame_header_get(fp);
- /* if not an Flogi frame, send it out, this is the common case */
- if (!is_flogi_frame(fh))
- return fnic_send_frame(fnic, fp);
+ /*
+ * Queue frame if in a transitional state.
+ * This occurs while registering the Port_ID / MAC address after FLOGI.
+ */
+ spin_lock_irqsave(&fnic->fnic_lock, flags);
+ if (fnic->state != FNIC_IN_FC_MODE && fnic->state != FNIC_IN_ETH_MODE) {
+ skb_queue_tail(&fnic->tx_queue, fp_skb(fp));
+ spin_unlock_irqrestore(&fnic->fnic_lock, flags);
+ return 0;
+ }
+ spin_unlock_irqrestore(&fnic->fnic_lock, flags);
- /* Flogi frame, now enter the state machine */
+ return fnic_send_frame(fnic, fp);
+}
- spin_lock_irqsave(&fnic->fnic_lock, flags);
-again:
- /* Get any old cached frames, free them after dropping lock */
- old_flogi = fnic->flogi;
- fnic->flogi = NULL;
- old_flogi_resp = fnic->flogi_resp;
- fnic->flogi_resp = NULL;
+/**
+ * fnic_flush_tx() - send queued frames.
+ * @fnic: fnic device
+ *
+ * Send frames that were waiting to go out in FC or Ethernet mode.
+ * Whenever changing modes we purge queued frames, so these frames should
+ * be queued for the stable mode that we're in, either FC or Ethernet.
+ *
+ * Called without fnic_lock held.
+ */
+void fnic_flush_tx(struct fnic *fnic)
+{
+ struct sk_buff *skb;
+ struct fc_frame *fp;
- fnic->flogi_oxid = FC_XID_UNKNOWN;
+ while ((skb = skb_dequeue(&fnic->frame_queue))) {
+ fp = (struct fc_frame *)skb;
+ fnic_send_frame(fnic, fp);
+ }
+}
+/**
+ * fnic_set_eth_mode() - put fnic into ethernet mode.
+ * @fnic: fnic device
+ *
+ * Called without fnic lock held.
+ */
+static void fnic_set_eth_mode(struct fnic *fnic)
+{
+ unsigned long flags;
+ enum fnic_state old_state;
+ int ret;
+
+ spin_lock_irqsave(&fnic->fnic_lock, flags);
+again:
old_state = fnic->state;
switch (old_state) {
case FNIC_IN_FC_MODE:
case FNIC_IN_ETH_TRANS_FC_MODE:
default:
fnic->state = FNIC_IN_FC_TRANS_ETH_MODE;
- vnic_dev_del_addr(fnic->vdev, fnic->data_src_addr);
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
- if (old_flogi) {
- dev_kfree_skb(fp_skb(old_flogi));
- old_flogi = NULL;
- }
- if (old_flogi_resp) {
- dev_kfree_skb(fp_skb(old_flogi_resp));
- old_flogi_resp = NULL;
- }
-
ret = fnic_fw_reset_handler(fnic);
spin_lock_irqsave(&fnic->fnic_lock, flags);
if (fnic->state != FNIC_IN_FC_TRANS_ETH_MODE)
goto again;
- if (ret) {
+ if (ret)
fnic->state = old_state;
- spin_unlock_irqrestore(&fnic->fnic_lock, flags);
- dev_kfree_skb(fp_skb(fp));
- goto fnic_send_end;
- }
- old_flogi = fnic->flogi;
- fnic->flogi = fp;
- fnic->flogi_oxid = ntohs(fh->fh_ox_id);
- old_flogi_resp = fnic->flogi_resp;
- fnic->flogi_resp = NULL;
- spin_unlock_irqrestore(&fnic->fnic_lock, flags);
break;
case FNIC_IN_FC_TRANS_ETH_MODE:
- /*
- * A reset is pending with the firmware. Store the flogi
- * and its oxid. The transition out of this state happens
- * only when Firmware completes the reset, either with
- * success or failed. If success, transition to
- * FNIC_IN_ETH_MODE, if fail, then transition to
- * FNIC_IN_FC_MODE
- */
- fnic->flogi = fp;
- fnic->flogi_oxid = ntohs(fh->fh_ox_id);
- spin_unlock_irqrestore(&fnic->fnic_lock, flags);
- break;
-
case FNIC_IN_ETH_MODE:
- /*
- * The fw/hw is already in eth mode. Store the oxid,
- * and send the flogi frame out. The transition out of this
- * state happens only we receive flogi response from the
- * network, and the oxid matches the cached oxid when the
- * flogi frame was sent out. If they match, then we issue
- * a flogi_reg request and transition to state
- * FNIC_IN_ETH_TRANS_FC_MODE
- */
- fnic->flogi_oxid = ntohs(fh->fh_ox_id);
- spin_unlock_irqrestore(&fnic->fnic_lock, flags);
- ret = fnic_send_frame(fnic, fp);
break;
}
-
-fnic_send_end:
- if (old_flogi)
- dev_kfree_skb(fp_skb(old_flogi));
- if (old_flogi_resp)
- dev_kfree_skb(fp_skb(old_flogi_resp));
- return ret;
+ spin_unlock_irqrestore(&fnic->fnic_lock, flags);
}
static void fnic_wq_complete_frame_send(struct vnic_wq *wq,
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index bfc341c..7b6803e 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -25,6 +25,8 @@
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/workqueue.h>
+#include <linux/if_ether.h>
+#include <scsi/fc/fc_fip.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_transport.h>
#include <scsi/scsi_transport_fc.h>
@@ -68,6 +70,7 @@ MODULE_PARM_DESC(fnic_log_level, "bit mask of fnic logging levels");
static struct libfc_function_template fnic_transport_template = {
.frame_send = fnic_send,
+ .lport_set_port_id = fnic_set_port_id,
.fcp_abort_io = fnic_empty_scsi_cleanup,
.fcp_cleanup = fnic_empty_scsi_cleanup,
.exch_mgr_reset = fnic_exch_mgr_reset
@@ -324,9 +327,6 @@ static int fnic_cleanup(struct fnic *fnic)
{
unsigned int i;
int err;
- unsigned long flags;
- struct fc_frame *flogi = NULL;
- struct fc_frame *flogi_resp = NULL;
vnic_dev_disable(fnic->vdev);
for (i = 0; i < fnic->intr_count; i++)
@@ -367,24 +367,6 @@ static int fnic_cleanup(struct fnic *fnic)
for (i = 0; i < fnic->intr_count; i++)
vnic_intr_clean(&fnic->intr[i]);
- /*
- * Remove cached flogi and flogi resp frames if any
- * These frames are not in any queue, and therefore queue
- * cleanup does not clean them. So clean them explicitly
- */
- spin_lock_irqsave(&fnic->fnic_lock, flags);
- flogi = fnic->flogi;
- fnic->flogi = NULL;
- flogi_resp = fnic->flogi_resp;
- fnic->flogi_resp = NULL;
- spin_unlock_irqrestore(&fnic->fnic_lock, flags);
-
- if (flogi)
- dev_kfree_skb(fp_skb(flogi));
-
- if (flogi_resp)
- dev_kfree_skb(fp_skb(flogi_resp));
-
mempool_destroy(fnic->io_req_pool);
for (i = 0; i < FNIC_SGL_NUM_CACHES; i++)
mempool_destroy(fnic->io_sgl_pool[i]);
@@ -409,6 +391,17 @@ static void *fnic_alloc_slab_dma(gfp_t gfp_mask, void *pool_data)
return kmem_cache_alloc(mem, gfp_mask | GFP_ATOMIC | GFP_DMA);
}
+/**
+ * fnic_get_mac() - get assigned data MAC address for FIP code.
+ * @lport: local port.
+ */
+static u8 *fnic_get_mac(struct fc_lport *lport)
+{
+ struct fnic *fnic = lport_priv(lport);
+
+ return fnic->data_src_addr;
+}
+
static int __devinit fnic_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -433,6 +426,7 @@ static int __devinit fnic_probe(struct pci_dev *pdev,
host = lp->host;
fnic = lport_priv(lp);
fnic->lport = lp;
+ fnic->ctlr.lp = lp;
snprintf(fnic->name, sizeof(fnic->name) - 1, "%s%d", DRV_NAME,
host->host_no);
@@ -541,12 +535,14 @@ static int __devinit fnic_probe(struct pci_dev *pdev,
goto err_out_dev_close;
}
- err = vnic_dev_mac_addr(fnic->vdev, fnic->mac_addr);
+ err = vnic_dev_mac_addr(fnic->vdev, fnic->ctlr.ctl_src_addr);
if (err) {
shost_printk(KERN_ERR, fnic->lport->host,
"vNIC get MAC addr failed \n");
goto err_out_dev_close;
}
+ /* set data_src for point-to-point mode and to keep it non-zero */
+ memcpy(fnic->data_src_addr, fnic->ctlr.ctl_src_addr, ETH_ALEN);
/* Get vNIC configuration */
err = fnic_get_vnic_config(fnic);
@@ -621,9 +617,21 @@ static int __devinit fnic_probe(struct pci_dev *pdev,
fnic->vlan_hw_insert = 1;
fnic->vlan_id = 0;
- fnic->flogi_oxid = FC_XID_UNKNOWN;
- fnic->flogi = NULL;
- fnic->flogi_resp = NULL;
+ /* Initialize the FIP fcoe_ctrl struct */
+ fnic->ctlr.send = fnic_eth_send;
+ fnic->ctlr.update_mac = fnic_update_mac;
+ fnic->ctlr.get_src_addr = fnic_get_mac;
+ fcoe_ctlr_init(&fnic->ctlr);
+ if (fnic->config.flags & VFCF_FIP_CAPABLE) {
+ shost_printk(KERN_INFO, fnic->lport->host,
+ "firmware supports FIP\n");
+ vnic_dev_add_addr(fnic->vdev, FIP_ALL_ENODE_MACS);
+ vnic_dev_add_addr(fnic->vdev, fnic->ctlr.ctl_src_addr);
+ } else {
+ shost_printk(KERN_INFO, fnic->lport->host,
+ "firmware uses non-FIP mode\n");
+ fnic->ctlr.mode = FIP_ST_NON_FIP;
+ }
fnic->state = FNIC_IN_FC_MODE;
/* Enable hardware stripping of vlan header on ingress */
@@ -714,6 +722,7 @@ static int __devinit fnic_probe(struct pci_dev *pdev,
INIT_WORK(&fnic->link_work, fnic_handle_link);
INIT_WORK(&fnic->frame_work, fnic_handle_frame);
skb_queue_head_init(&fnic->frame_queue);
+ skb_queue_head_init(&fnic->tx_queue);
/* Enable all queues */
for (i = 0; i < fnic->raw_wq_count; i++)
@@ -736,8 +745,8 @@ static int __devinit fnic_probe(struct pci_dev *pdev,
err_out_free_exch_mgr:
fc_exch_mgr_free(lp);
err_out_remove_scsi_host:
- fc_remove_host(fnic->lport->host);
- scsi_remove_host(fnic->lport->host);
+ fc_remove_host(lp->host);
+ scsi_remove_host(lp->host);
err_out_free_rq_buf:
for (i = 0; i < fnic->rq_count; i++)
vnic_rq_clean(&fnic->rq[i], fnic_free_rq_buf);
@@ -773,6 +782,7 @@ err_out:
static void __devexit fnic_remove(struct pci_dev *pdev)
{
struct fnic *fnic = pci_get_drvdata(pdev);
+ struct fc_lport *lp = fnic->lport;
unsigned long flags;
/*
@@ -794,6 +804,7 @@ static void __devexit fnic_remove(struct pci_dev *pdev)
*/
flush_workqueue(fnic_event_queue);
skb_queue_purge(&fnic->frame_queue);
+ skb_queue_purge(&fnic->tx_queue);
/*
* Log off the fabric. This stops all remote ports, dns port,
@@ -806,7 +817,8 @@ static void __devexit fnic_remove(struct pci_dev *pdev)
fnic->in_remove = 1;
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
- fc_lport_destroy(fnic->lport);
+ fcoe_ctlr_destroy(&fnic->ctlr);
+ fc_lport_destroy(lp);
/*
* This stops the fnic device, masks all interrupts. Completed
@@ -816,6 +828,7 @@ static void __devexit fnic_remove(struct pci_dev *pdev)
fnic_cleanup(fnic);
BUG_ON(!skb_queue_empty(&fnic->frame_queue));
+ BUG_ON(!skb_queue_empty(&fnic->tx_queue));
spin_lock_irqsave(&fnic_list_lock, flags);
list_del(&fnic->list);
@@ -834,7 +847,7 @@ static void __devexit fnic_remove(struct pci_dev *pdev)
pci_release_regions(pdev);
pci_disable_device(pdev);
pci_set_drvdata(pdev, NULL);
- scsi_host_put(fnic->lport->host);
+ scsi_host_put(lp->host);
}
static struct pci_driver fnic_driver = {
diff --git a/drivers/scsi/fnic/fnic_res.c b/drivers/scsi/fnic/fnic_res.c
index 7ba61ec..50488f8 100644
--- a/drivers/scsi/fnic/fnic_res.c
+++ b/drivers/scsi/fnic/fnic_res.c
@@ -144,10 +144,9 @@ int fnic_get_vnic_config(struct fnic *fnic)
c->intr_timer_type = c->intr_timer_type;
shost_printk(KERN_INFO, fnic->lport->host,
- "vNIC MAC addr %02x:%02x:%02x:%02x:%02x:%02x "
+ "vNIC MAC addr %pM "
"wq/wq_copy/rq %d/%d/%d\n",
- fnic->mac_addr[0], fnic->mac_addr[1], fnic->mac_addr[2],
- fnic->mac_addr[3], fnic->mac_addr[4], fnic->mac_addr[5],
+ fnic->ctlr.ctl_src_addr,
c->wq_enet_desc_count, c->wq_copy_desc_count,
c->rq_desc_count);
shost_printk(KERN_INFO, fnic->lport->host,
diff --git a/drivers/scsi/fnic/fnic_res.h b/drivers/scsi/fnic/fnic_res.h
index b6f3102..1c0ecc5 100644
--- a/drivers/scsi/fnic/fnic_res.h
+++ b/drivers/scsi/fnic/fnic_res.h
@@ -51,6 +51,31 @@ static inline void fnic_queue_wq_desc(struct vnic_wq *wq,
vnic_wq_post(wq, os_buf, dma_addr, len, sop, eop);
}
+static inline void fnic_queue_wq_eth_desc(struct vnic_wq *wq,
+ void *os_buf, dma_addr_t dma_addr,
+ unsigned int len,
+ int vlan_tag_insert,
+ unsigned int vlan_tag,
+ int cq_entry)
+{
+ struct wq_enet_desc *desc = vnic_wq_next_desc(wq);
+
+ wq_enet_desc_enc(desc,
+ (u64)dma_addr | VNIC_PADDR_TARGET,
+ (u16)len,
+ 0, /* mss_or_csum_offset */
+ 0, /* fc_eof */
+ 0, /* offload_mode */
+ 1, /* eop */
+ (u8)cq_entry,
+ 0, /* fcoe_encap */
+ (u8)vlan_tag_insert,
+ (u16)vlan_tag,
+ 0 /* loopback */);
+
+ vnic_wq_post(wq, os_buf, dma_addr, len, 1, 1);
+}
+
static inline void fnic_queue_wq_copy_desc_icmnd_16(struct vnic_wq_copy *wq,
u32 req_id,
u32 lunmap_id, u8 spl_flags,
@@ -132,12 +157,37 @@ static inline void fnic_queue_wq_copy_desc_flogi_reg(struct vnic_wq_copy *wq,
desc->hdr.tag.u.req_id = req_id; /* id for this request */
desc->u.flogi_reg.format = format;
+ desc->u.flogi_reg._resvd = 0;
hton24(desc->u.flogi_reg.s_id, s_id);
memcpy(desc->u.flogi_reg.gateway_mac, gw_mac, ETH_ALEN);
vnic_wq_copy_post(wq);
}
+static inline void fnic_queue_wq_copy_desc_fip_reg(struct vnic_wq_copy *wq,
+ u32 req_id, u32 s_id,
+ u8 *fcf_mac, u8 *ha_mac,
+ u32 r_a_tov, u32 e_d_tov)
+{
+ struct fcpio_host_req *desc = vnic_wq_copy_next_desc(wq);
+
+ desc->hdr.type = FCPIO_FLOGI_FIP_REG; /* enum fcpio_type */
+ desc->hdr.status = 0; /* header status entry */
+ desc->hdr._resvd = 0; /* reserved */
+ desc->hdr.tag.u.req_id = req_id; /* id for this request */
+
+ desc->u.flogi_fip_reg._resvd0 = 0;
+ hton24(desc->u.flogi_fip_reg.s_id, s_id);
+ memcpy(desc->u.flogi_fip_reg.fcf_mac, fcf_mac, ETH_ALEN);
+ desc->u.flogi_fip_reg._resvd1 = 0;
+ desc->u.flogi_fip_reg.r_a_tov = r_a_tov;
+ desc->u.flogi_fip_reg.e_d_tov = e_d_tov;
+ memcpy(desc->u.flogi_fip_reg.ha_mac, ha_mac, ETH_ALEN);
+ desc->u.flogi_fip_reg._resvd2 = 0;
+
+ vnic_wq_copy_post(wq);
+}
+
static inline void fnic_queue_wq_copy_desc_fw_reset(struct vnic_wq_copy *wq,
u32 req_id)
{
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index bfc9969..57d9a96 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -174,6 +174,9 @@ int fnic_fw_reset_handler(struct fnic *fnic)
int ret = 0;
unsigned long flags;
+ skb_queue_purge(&fnic->frame_queue);
+ skb_queue_purge(&fnic->tx_queue);
+
spin_lock_irqsave(&fnic->wq_copy_lock[0], flags);
if (vnic_wq_copy_desc_avail(wq) <= fnic->wq_copy_desc_low[0])
@@ -200,9 +203,11 @@ int fnic_fw_reset_handler(struct fnic *fnic)
* fnic_flogi_reg_handler
* Routine to send flogi register msg to fw
*/
-int fnic_flogi_reg_handler(struct fnic *fnic)
+int fnic_flogi_reg_handler(struct fnic *fnic, u32 fc_id)
{
struct vnic_wq_copy *wq = &fnic->wq_copy[0];
+ enum fcpio_flogi_reg_format_type format;
+ struct fc_lport *lp = fnic->lport;
u8 gw_mac[ETH_ALEN];
int ret = 0;
unsigned long flags;
@@ -217,23 +222,32 @@ int fnic_flogi_reg_handler(struct fnic *fnic)
goto flogi_reg_ioreq_end;
}
- if (fnic->fcoui_mode)
+ if (fnic->ctlr.map_dest) {
memset(gw_mac, 0xff, ETH_ALEN);
- else
- memcpy(gw_mac, fnic->dest_addr, ETH_ALEN);
+ format = FCPIO_FLOGI_REG_DEF_DEST;
+ } else {
+ memcpy(gw_mac, fnic->ctlr.dest_addr, ETH_ALEN);
+ format = FCPIO_FLOGI_REG_GW_DEST;
+ }
- fnic_queue_wq_copy_desc_flogi_reg(wq, SCSI_NO_TAG,
- FCPIO_FLOGI_REG_GW_DEST,
- fnic->s_id,
- gw_mac);
+ if ((fnic->config.flags & VFCF_FIP_CAPABLE) && !fnic->ctlr.map_dest) {
+ fnic_queue_wq_copy_desc_fip_reg(wq, SCSI_NO_TAG,
+ fc_id, gw_mac,
+ fnic->data_src_addr,
+ lp->r_a_tov, lp->e_d_tov);
+ FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
+ "FLOGI FIP reg issued fcid %x src %pM dest %pM\n",
+ fc_id, fnic->data_src_addr, gw_mac);
+ } else {
+ fnic_queue_wq_copy_desc_flogi_reg(wq, SCSI_NO_TAG,
+ format, fc_id, gw_mac);
+ FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
+ "FLOGI reg issued fcid %x map %d dest %pM\n",
+ fc_id, fnic->ctlr.map_dest, gw_mac);
+ }
flogi_reg_ioreq_end:
spin_unlock_irqrestore(&fnic->wq_copy_lock[0], flags);
-
- if (!ret)
- FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
- "flog reg issued\n");
-
return ret;
}
@@ -452,7 +466,6 @@ static int fnic_fcpio_fw_reset_cmpl_handler(struct fnic *fnic,
u8 hdr_status;
struct fcpio_tag tag;
int ret = 0;
- struct fc_frame *flogi;
unsigned long flags;
fcpio_header_dec(&desc->hdr, &type, &hdr_status, &tag);
@@ -462,9 +475,6 @@ static int fnic_fcpio_fw_reset_cmpl_handler(struct fnic *fnic,
spin_lock_irqsave(&fnic->fnic_lock, flags);
- flogi = fnic->flogi;
- fnic->flogi = NULL;
-
/* fnic should be in FC_TRANS_ETH_MODE */
if (fnic->state == FNIC_IN_FC_TRANS_ETH_MODE) {
/* Check status of reset completion */
@@ -505,17 +515,14 @@ static int fnic_fcpio_fw_reset_cmpl_handler(struct fnic *fnic,
* free the flogi frame. Else, send it out
*/
if (fnic->remove_wait || ret) {
- fnic->flogi_oxid = FC_XID_UNKNOWN;
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
- if (flogi)
- dev_kfree_skb_irq(fp_skb(flogi));
+ skb_queue_purge(&fnic->tx_queue);
goto reset_cmpl_handler_end;
}
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
- if (flogi)
- ret = fnic_send_frame(fnic, flogi);
+ fnic_flush_tx(fnic);
reset_cmpl_handler_end:
return ret;
@@ -532,18 +539,13 @@ static int fnic_fcpio_flogi_reg_cmpl_handler(struct fnic *fnic,
u8 hdr_status;
struct fcpio_tag tag;
int ret = 0;
- struct fc_frame *flogi_resp = NULL;
unsigned long flags;
- struct sk_buff *skb;
fcpio_header_dec(&desc->hdr, &type, &hdr_status, &tag);
/* Update fnic state based on status of flogi reg completion */
spin_lock_irqsave(&fnic->fnic_lock, flags);
- flogi_resp = fnic->flogi_resp;
- fnic->flogi_resp = NULL;
-
if (fnic->state == FNIC_IN_ETH_TRANS_FC_MODE) {
/* Check flogi registration completion status */
@@ -567,25 +569,17 @@ static int fnic_fcpio_flogi_reg_cmpl_handler(struct fnic *fnic,
ret = -1;
}
- /* Successful flogi reg cmpl, pass frame to LibFC */
- if (!ret && flogi_resp) {
+ if (!ret) {
if (fnic->stop_rx_link_events) {
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
goto reg_cmpl_handler_end;
}
- skb = (struct sk_buff *)flogi_resp;
- /* Use fr_flags to indicate whether flogi resp or not */
- fr_flags(flogi_resp) = 1;
- fr_dev(flogi_resp) = fnic->lport;
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
- skb_queue_tail(&fnic->frame_queue, skb);
+ fnic_flush_tx(fnic);
queue_work(fnic_event_queue, &fnic->frame_work);
-
} else {
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
- if (flogi_resp)
- dev_kfree_skb_irq(fp_skb(flogi_resp));
}
reg_cmpl_handler_end:
@@ -907,6 +901,7 @@ static int fnic_fcpio_cmpl_handler(struct vnic_dev *vdev,
break;
case FCPIO_FLOGI_REG_CMPL: /* fw completed flogi_reg */
+ case FCPIO_FLOGI_FIP_REG_CMPL: /* fw completed flogi_fip_reg */
ret = fnic_fcpio_flogi_reg_cmpl_handler(fnic, desc);
break;
@@ -1762,7 +1757,7 @@ void fnic_scsi_abort_io(struct fc_lport *lp)
fnic->remove_wait = &remove_wait;
old_state = fnic->state;
fnic->state = FNIC_IN_FC_TRANS_ETH_MODE;
- vnic_dev_del_addr(fnic->vdev, fnic->data_src_addr);
+ fnic_update_mac_locked(fnic, fnic->ctlr.ctl_src_addr);
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
err = fnic_fw_reset_handler(fnic);
@@ -1802,7 +1797,7 @@ void fnic_scsi_cleanup(struct fc_lport *lp)
spin_lock_irqsave(&fnic->fnic_lock, flags);
old_state = fnic->state;
fnic->state = FNIC_IN_FC_TRANS_ETH_MODE;
- vnic_dev_del_addr(fnic->vdev, fnic->data_src_addr);
+ fnic_update_mac_locked(fnic, fnic->ctlr.ctl_src_addr);
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
if (fnic_fw_reset_handler(fnic)) {
diff --git a/drivers/scsi/fnic/vnic_scsi.h b/drivers/scsi/fnic/vnic_scsi.h
index 46baa52..fbb5536 100644
--- a/drivers/scsi/fnic/vnic_scsi.h
+++ b/drivers/scsi/fnic/vnic_scsi.h
@@ -95,5 +95,6 @@ struct vnic_fc_config {
#define VFCF_FCP_SEQ_LVL_ERR 0x1 /* Enable FCP-2 Error Recovery */
#define VFCF_PERBI 0x2 /* persistent binding info available */
+#define VFCF_FIP_CAPABLE 0x4 /* firmware can handle FIP */
#endif /* _VNIC_SCSI_H_ */
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 23/24] libfc: register FC4 features with the FC switch
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (21 preceding siblings ...)
2009-09-18 22:50 ` [PATCH 22/24] fnic: Add FIP support to the fnic driver Robert Love
@ 2009-09-18 22:51 ` Robert Love
2009-09-18 22:51 ` [PATCH 24/24] MAINTAINERS: Update for libfc, libfcoe, fcoe Robert Love
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:51 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Joe Eykholt, Robert Love
From: Joe Eykholt <jeykholt@cisco.com>
Customers and certification tests have pointed out that we don't
show up on the switch management software as an initiator.
On some MDS switches 'show fcns database' command shows libfc
initiators as 'fcp' not 'fcp:init' like other initiators.
On others switches, I think the switch gets the features by doing a PRLI,
but it may be only certain models or under certain configurations.
Fix this by registering our FC4 features with the RFF_ID CT request
after local port login and after the RFT_ID.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/libfc/fc_lport.c | 12 +++++++++++-
include/scsi/fc/fc_fcp.h | 6 ++++++
include/scsi/fc/fc_ns.h | 13 ++++++++++++-
include/scsi/fc_encode.h | 12 ++++++++++++
include/scsi/libfc.h | 2 ++
5 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 58c145c..3de3e6e 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -122,6 +122,7 @@ static const char *fc_lport_state_names[] = {
[LPORT_ST_RSNN_NN] = "RSNN_NN",
[LPORT_ST_RSPN_ID] = "RSPN_ID",
[LPORT_ST_RFT_ID] = "RFT_ID",
+ [LPORT_ST_RFF_ID] = "RFF_ID",
[LPORT_ST_SCR] = "SCR",
[LPORT_ST_READY] = "Ready",
[LPORT_ST_LOGO] = "LOGO",
@@ -1034,6 +1035,7 @@ static void fc_lport_error(struct fc_lport *lport, struct fc_frame *fp)
case LPORT_ST_RSNN_NN:
case LPORT_ST_RSPN_ID:
case LPORT_ST_RFT_ID:
+ case LPORT_ST_RFF_ID:
case LPORT_ST_SCR:
case LPORT_ST_DNS:
case LPORT_ST_FLOGI:
@@ -1070,7 +1072,7 @@ static void fc_lport_ns_resp(struct fc_seq *sp, struct fc_frame *fp,
mutex_lock(&lport->lp_mutex);
- if (lport->state < LPORT_ST_RNN_ID || lport->state > LPORT_ST_RFT_ID) {
+ if (lport->state < LPORT_ST_RNN_ID || lport->state > LPORT_ST_RFF_ID) {
FC_LPORT_DBG(lport, "Received a name server response, "
"but in state %s\n", fc_lport_state(lport));
if (IS_ERR(fp))
@@ -1101,6 +1103,9 @@ static void fc_lport_ns_resp(struct fc_seq *sp, struct fc_frame *fp,
fc_lport_enter_ns(lport, LPORT_ST_RFT_ID);
break;
case LPORT_ST_RFT_ID:
+ fc_lport_enter_ns(lport, LPORT_ST_RFF_ID);
+ break;
+ case LPORT_ST_RFF_ID:
fc_lport_enter_scr(lport);
break;
default:
@@ -1235,6 +1240,10 @@ static void fc_lport_enter_ns(struct fc_lport *lport, enum fc_lport_state state)
cmd = FC_NS_RFT_ID;
size += sizeof(struct fc_ns_rft);
break;
+ case LPORT_ST_RFF_ID:
+ cmd = FC_NS_RFF_ID;
+ size += sizeof(struct fc_ns_rff_id);
+ break;
default:
fc_lport_error(lport, NULL);
return;
@@ -1317,6 +1326,7 @@ static void fc_lport_timeout(struct work_struct *work)
case LPORT_ST_RSNN_NN:
case LPORT_ST_RSPN_ID:
case LPORT_ST_RFT_ID:
+ case LPORT_ST_RFF_ID:
fc_lport_enter_ns(lport, lport->state);
break;
case LPORT_ST_SCR:
diff --git a/include/scsi/fc/fc_fcp.h b/include/scsi/fc/fc_fcp.h
index 5d38f19..29ecb0b 100644
--- a/include/scsi/fc/fc_fcp.h
+++ b/include/scsi/fc/fc_fcp.h
@@ -196,4 +196,10 @@ struct fcp_srr {
__u8 srr_resvd2[3]; /* reserved */
};
+/*
+ * Feature bits in name server FC-4 Features object.
+ */
+#define FCP_FEAT_TARG (1 << 0) /* target function supported */
+#define FCP_FEAT_INIT (1 << 1) /* initiator function supported */
+
#endif /* _FC_FCP_H_ */
diff --git a/include/scsi/fc/fc_ns.h b/include/scsi/fc/fc_ns.h
index f4d354e..e7d3ac4 100644
--- a/include/scsi/fc/fc_ns.h
+++ b/include/scsi/fc/fc_ns.h
@@ -46,10 +46,11 @@ enum fc_ns_req {
FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */
FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */
FC_NS_GID_PT = 0x01a1, /* get IDs by port type */
- FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */
FC_NS_RPN_ID = 0x0212, /* reg port name for ID */
FC_NS_RNN_ID = 0x0213, /* reg node name for ID */
+ FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */
FC_NS_RSPN_ID = 0x0218, /* reg symbolic port name */
+ FC_NS_RFF_ID = 0x021f, /* reg FC4 Features for ID */
FC_NS_RSNN_NN = 0x0239, /* reg symbolic node name */
};
@@ -178,4 +179,14 @@ struct fc_ns_rspn {
char fr_name[];
} __attribute__((__packed__));
+/*
+ * RFF_ID request - register FC-4 Features for ID.
+ */
+struct fc_ns_rff_id {
+ struct fc_ns_fid fr_fid; /* port ID object */
+ __u8 fr_resvd[2];
+ __u8 fr_feat; /* FC-4 Feature bits */
+ __u8 fr_type; /* FC-4 type */
+} __attribute__((__packed__));
+
#endif /* _FC_NS_H_ */
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index ab2260c..8eb0a0f 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -32,6 +32,7 @@ struct fc_ct_req {
struct fc_ns_gid_ft gid;
struct fc_ns_rn_id rn;
struct fc_ns_rft rft;
+ struct fc_ns_rff_id rff;
struct fc_ns_fid fid;
struct fc_ns_rsnn snn;
struct fc_ns_rspn spn;
@@ -131,6 +132,17 @@ static inline int fc_ct_fill(struct fc_lport *lport,
ct->payload.rft.fts = lport->fcts;
break;
+ case FC_NS_RFF_ID:
+ ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id));
+ hton24(ct->payload.rff.fr_fid.fp_fid,
+ fc_host_port_id(lport->host));
+ ct->payload.rff.fr_type = FC_TYPE_FCP;
+ if (lport->service_params & FCP_SPPF_INIT_FCN)
+ ct->payload.rff.fr_feat = FCP_FEAT_INIT;
+ if (lport->service_params & FCP_SPPF_TARG_FCN)
+ ct->payload.rff.fr_feat |= FCP_FEAT_TARG;
+ break;
+
case FC_NS_RNN_ID:
ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id));
hton24(ct->payload.rn.fr_fid.fp_fid,
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 62ee644..fd2abfa 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -62,6 +62,7 @@
* @LPORT_ST_DNS: Waiting for name server remote port to become ready
* @LPORT_ST_RPN_ID: Register port name by ID (RPN_ID) sent
* @LPORT_ST_RFT_ID: Register Fibre Channel types by ID (RFT_ID) sent
+ * @LPORT_ST_RFF_ID: Register FC-4 Features by ID (RFF_ID) sent
* @LPORT_ST_SCR: State Change Register (SCR) sent
* @LPORT_ST_READY: Ready for use
* @LPORT_ST_LOGO: Local port logout (LOGO) sent
@@ -75,6 +76,7 @@ enum fc_lport_state {
LPORT_ST_RSNN_NN,
LPORT_ST_RSPN_ID,
LPORT_ST_RFT_ID,
+ LPORT_ST_RFF_ID,
LPORT_ST_SCR,
LPORT_ST_READY,
LPORT_ST_LOGO,
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 24/24] MAINTAINERS: Update for libfc, libfcoe, fcoe
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
` (22 preceding siblings ...)
2009-09-18 22:51 ` [PATCH 23/24] libfc: register FC4 features with the FC switch Robert Love
@ 2009-09-18 22:51 ` Robert Love
23 siblings, 0 replies; 25+ messages in thread
From: Robert Love @ 2009-09-18 22:51 UTC (permalink / raw)
To: James.Bottomley, linux-scsi
Adding FCoE information to the MAINTAINERS file.
---
MAINTAINERS | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 9117b65..869d6e5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2004,6 +2004,17 @@ S: Supported
F: Documentation/fault-injection/
F: lib/fault-inject.c
+FCOE SUBSYSTEM (libfc, libfcoe, fcoe)
+M: Robert Love <robert.w.love@intel.com>
+L: devel@open-fcoe.org
+W: www.Open-FCoE.org
+S: Supported
+F: drivers/scsi/libfc/
+F: drivers/scsi/fcoe/
+F: include/scsi/fc/
+F: include/scsi/libfc.h
+F: include/scsi/libfcoe.h
+
FILE LOCKING (flock() and fcntl()/lockf())
M: Matthew Wilcox <matthew@wil.cx>
L: linux-fsdevel@vger.kernel.org
^ permalink raw reply related [flat|nested] 25+ messages in thread
end of thread, other threads:[~2009-09-18 22:51 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-18 22:48 [PATCH 00/24] libfc, libfcoe, fcoe and fnic updates for 2.6.32 Robert Love
2009-09-18 22:48 ` [PATCH 01/24] libfc: lport: fix minor documentation errors Robert Love
2009-09-18 22:48 ` [PATCH 02/24] libfcoe: Allow FIP to be disabled by the driver Robert Love
2009-09-18 22:49 ` [PATCH 03/24] libfcoe: fip: use SCSI host number to identify debug messages Robert Love
2009-09-18 22:49 ` [PATCH 04/24] libfcoe: fip: allow FIP receive to be called from IRQ Robert Love
2009-09-18 22:49 ` [PATCH 05/24] libfcoe: FIP should report link to libfc whether selected or not Robert Love
2009-09-18 22:49 ` [PATCH 06/24] libfc: don't WARN_ON in lport_timeout for RESET state Robert Love
2009-09-18 22:49 ` [PATCH 07/24] libfcoe: don't send ELS in FIP mode if no FCF selected Robert Love
2009-09-18 22:49 ` [PATCH 08/24] fcoe: remove extra function decalrations Robert Love
2009-09-18 22:49 ` [PATCH 09/24] libfc: removes initializing fc_cpu_order and fc_cpu_mask per lport Robert Love
2009-09-18 22:49 ` [PATCH 10/24] libfc: adds missing exch release for accepted RRQ Robert Love
2009-09-18 22:49 ` [PATCH 11/24] libfc: removes unused disc_work and ex_list Robert Love
2009-09-18 22:50 ` [PATCH 12/24] fcoe: Use NETIF_F_FCOE_MTU flag to set up max frame size (lport->mfs) Robert Love
2009-09-18 22:50 ` [PATCH 13/24] fcoe: Call ndo_fcoe_enable/disable to turn FCoE feature on/off in LLD Robert Love
2009-09-18 22:50 ` [PATCH 14/24] fcoe: initialize return value in fcoe_destroy Robert Love
2009-09-18 22:50 ` [PATCH 15/24] fcoe: add check to fail gracefully in bonding mode Robert Love
2009-09-18 22:50 ` [PATCH 16/24] libfc: fix RNN_ID smashing skb payload Robert Love
2009-09-18 22:50 ` [PATCH 17/24] libfc: fix symbolic name registrations smashing skb data Robert Love
2009-09-18 22:50 ` [PATCH 18/24] libfc: fix fc_els_resp_type to correct display of CT responses Robert Love
2009-09-18 22:50 ` [PATCH 19/24] libfc: add set_fid function to libfc template Robert Love
2009-09-18 22:50 ` [PATCH 20/24] libfc: add host number to lport link up/down messages Robert Love
2009-09-18 22:50 ` [PATCH 21/24] libfcoe: fcoe: simplify receive FLOGI response Robert Love
2009-09-18 22:50 ` [PATCH 22/24] fnic: Add FIP support to the fnic driver Robert Love
2009-09-18 22:51 ` [PATCH 23/24] libfc: register FC4 features with the FC switch Robert Love
2009-09-18 22:51 ` [PATCH 24/24] MAINTAINERS: Update for libfc, libfcoe, fcoe Robert Love
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).