* [PATCH 1/8] libfc: Fixing a memory leak when destroying an interface
2011-02-25 23:02 [PATCH 0/8] libfc, libfcoe and fcoe updates for scsi-misc Robert Love
@ 2011-02-25 23:02 ` Robert Love
2011-02-25 23:02 ` [PATCH 2/8] Revert "[SCSI] libfc: fix exchange being deleted when the abort itself is timed out" Robert Love
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Robert Love @ 2011-02-25 23:02 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Ross Brattain, Neerav Parikh
From: Parikh, Neerav <neerav.parikh@intel.com>
When an fcoe interface is being destroyed; in the process the
fcoe driver will try to release all the resources it had allocated
for that interface including rports. But, it seems that it does not
release the reference held for the name server rport in that process
resulting into a memory leak. This patch fixes that memory leak.
Signed-off-by: Neerav Parikh <neerav.parikh@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/libfc/fc_rport.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 59b16bb..49e1ccc 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -357,6 +357,7 @@ static void fc_rport_work(struct work_struct *work)
if (port_id == FC_FID_DIR_SERV) {
rdata->event = RPORT_EV_NONE;
mutex_unlock(&rdata->rp_mutex);
+ kref_put(&rdata->kref, lport->tt.rport_destroy);
} else if ((rdata->flags & FC_RP_STARTED) &&
rdata->major_retries <
lport->max_rport_retry_count) {
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/8] Revert "[SCSI] libfc: fix exchange being deleted when the abort itself is timed out"
2011-02-25 23:02 [PATCH 0/8] libfc, libfcoe and fcoe updates for scsi-misc Robert Love
2011-02-25 23:02 ` [PATCH 1/8] libfc: Fixing a memory leak when destroying an interface Robert Love
@ 2011-02-25 23:02 ` Robert Love
2011-02-25 23:03 ` [PATCH 3/8] fcoe, libfc: initialize EM anchors list and then update npiv EMs Robert Love
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Robert Love @ 2011-02-25 23:02 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Ross Brattain
From: Parikh, Neerav <neerav.parikh@intel.com>
When abort for an exchange timed out it didn't release the reference to
the exchange resulting in a memory leak.
After discussion with the author of the patch (CC) that introduced this
bug it was suggested to revert that patch.
This reverts commit ea3e2e72eeb3e8a9440a5da965914f9b12088626.
Signed-off by: Neerav Parikh <Neerav.Parikh@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/libfc/fc_exch.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 08bf5fa..10a5436 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -666,13 +666,10 @@ static void fc_exch_timeout(struct work_struct *work)
if (e_stat & ESB_ST_ABNORMAL)
rc = fc_exch_done_locked(ep);
spin_unlock_bh(&ep->ex_lock);
+ if (!rc)
+ fc_exch_delete(ep);
if (resp)
resp(sp, ERR_PTR(-FC_EX_TIMEOUT), arg);
- if (!rc) {
- /* delete the exchange if it's already being aborted */
- fc_exch_delete(ep);
- return;
- }
fc_seq_exch_abort(sp, 2 * ep->r_a_tov);
goto done;
}
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/8] fcoe, libfc: initialize EM anchors list and then update npiv EMs
2011-02-25 23:02 [PATCH 0/8] libfc, libfcoe and fcoe updates for scsi-misc Robert Love
2011-02-25 23:02 ` [PATCH 1/8] libfc: Fixing a memory leak when destroying an interface Robert Love
2011-02-25 23:02 ` [PATCH 2/8] Revert "[SCSI] libfc: fix exchange being deleted when the abort itself is timed out" Robert Love
@ 2011-02-25 23:03 ` Robert Love
2011-02-25 23:03 ` [PATCH 4/8] libfc: introduce __fc_fill_fc_hdr that accepts fc_hdr as an argument Robert Love
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Robert Love @ 2011-02-25 23:03 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Vasu Dev
From: Vasu Dev <vasu.dev@intel.com>
EM anchors list initialization for only master port was not enough to
keep npiv working as described here:-
https://lists.open-fcoe.org/pipermail/devel/2011-January/011063.html
So this patch moves fc_exch_mgr_list_clone to update npiv ports
EMs once EM anchors list initialized.
Also some cleanup, no need to set lport = NULL as that always
get initialized later.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/fcoe.c | 50 +++++++++++++++++++++--------------------
drivers/scsi/libfc/fc_exch.c | 1 +
drivers/scsi/libfc/fc_lport.c | 1 +
drivers/scsi/libfc/fc_npiv.c | 9 +------
4 files changed, 29 insertions(+), 32 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 495456f..0b5fbb8 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -928,8 +928,9 @@ static struct fc_lport *fcoe_if_create(struct fcoe_interface *fcoe,
struct device *parent, int npiv)
{
struct net_device *netdev = fcoe->netdev;
- struct fc_lport *lport = NULL;
+ struct fc_lport *lport, *n_port;
struct fcoe_port *port;
+ struct Scsi_Host *shost;
int rc;
/*
* parent is only a vport if npiv is 1,
@@ -939,13 +940,11 @@ static struct fc_lport *fcoe_if_create(struct fcoe_interface *fcoe,
FCOE_NETDEV_DBG(netdev, "Create Interface\n");
- if (!npiv) {
- lport = libfc_host_alloc(&fcoe_shost_template,
- sizeof(struct fcoe_port));
- } else {
- lport = libfc_vport_create(vport,
- sizeof(struct fcoe_port));
- }
+ if (!npiv)
+ lport = libfc_host_alloc(&fcoe_shost_template, sizeof(*port));
+ else
+ lport = libfc_vport_create(vport, sizeof(*port));
+
if (!lport) {
FCOE_NETDEV_DBG(netdev, "Could not allocate host structure\n");
rc = -ENOMEM;
@@ -998,24 +997,27 @@ static struct fc_lport *fcoe_if_create(struct fcoe_interface *fcoe,
goto out_lp_destroy;
}
- if (!npiv) {
- /*
- * fcoe_em_alloc() and fcoe_hostlist_add() both
- * need to be atomic with respect to other changes to the
- * hostlist since fcoe_em_alloc() looks for an existing EM
- * instance on host list updated by fcoe_hostlist_add().
- *
- * This is currently handled through the fcoe_config_mutex
- * begin held.
- */
-
+ /*
+ * fcoe_em_alloc() and fcoe_hostlist_add() both
+ * need to be atomic with respect to other changes to the
+ * hostlist since fcoe_em_alloc() looks for an existing EM
+ * instance on host list updated by fcoe_hostlist_add().
+ *
+ * This is currently handled through the fcoe_config_mutex
+ * begin held.
+ */
+ if (!npiv)
/* lport exch manager allocation */
rc = fcoe_em_config(lport);
- if (rc) {
- FCOE_NETDEV_DBG(netdev, "Could not configure the EM "
- "for the interface\n");
- goto out_lp_destroy;
- }
+ else {
+ shost = vport_to_shost(vport);
+ n_port = shost_priv(shost);
+ rc = fc_exch_mgr_list_clone(n_port, lport);
+ }
+
+ if (rc) {
+ FCOE_NETDEV_DBG(netdev, "Could not configure the EM\n");
+ goto out_lp_destroy;
}
fcoe_interface_get(fcoe);
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 10a5436..28231ba 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -2175,6 +2175,7 @@ err:
fc_exch_mgr_del(ema);
return -ENOMEM;
}
+EXPORT_SYMBOL(fc_exch_mgr_list_clone);
/**
* fc_exch_mgr_alloc() - Allocate an exchange manager
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 735f1f8..8c08b21 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -1590,6 +1590,7 @@ void fc_lport_enter_flogi(struct fc_lport *lport)
*/
int fc_lport_config(struct fc_lport *lport)
{
+ INIT_LIST_HEAD(&lport->ema_list);
INIT_DELAYED_WORK(&lport->retry_work, fc_lport_timeout);
mutex_init(&lport->lp_mutex);
diff --git a/drivers/scsi/libfc/fc_npiv.c b/drivers/scsi/libfc/fc_npiv.c
index 076cd5f..f33b897 100644
--- a/drivers/scsi/libfc/fc_npiv.c
+++ b/drivers/scsi/libfc/fc_npiv.c
@@ -37,9 +37,7 @@ struct fc_lport *libfc_vport_create(struct fc_vport *vport, int privsize)
vn_port = libfc_host_alloc(shost->hostt, privsize);
if (!vn_port)
- goto err_out;
- if (fc_exch_mgr_list_clone(n_port, vn_port))
- goto err_put;
+ return vn_port;
vn_port->vport = vport;
vport->dd_data = vn_port;
@@ -49,11 +47,6 @@ struct fc_lport *libfc_vport_create(struct fc_vport *vport, int privsize)
mutex_unlock(&n_port->lp_mutex);
return vn_port;
-
-err_put:
- scsi_host_put(vn_port->host);
-err_out:
- return NULL;
}
EXPORT_SYMBOL(libfc_vport_create);
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/8] libfc: introduce __fc_fill_fc_hdr that accepts fc_hdr as an argument
2011-02-25 23:02 [PATCH 0/8] libfc, libfcoe and fcoe updates for scsi-misc Robert Love
` (2 preceding siblings ...)
2011-02-25 23:03 ` [PATCH 3/8] fcoe, libfc: initialize EM anchors list and then update npiv EMs Robert Love
@ 2011-02-25 23:03 ` Robert Love
2011-02-25 23:03 ` [PATCH 5/8] libfcoe: Move FCOE_MTU definition from fcoe.h to libfcoe.h Robert Love
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Robert Love @ 2011-02-25 23:03 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Bhanu Prakash Gollapudi
From: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
fc_fill_fc_hdr() expects fc_frame as an argument. Introduce __fc_fill_fc_hdr to
accept fc_frame_header as an argument.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
include/scsi/fc_encode.h | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index 6d293c8..be418d8 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -46,16 +46,11 @@ struct fc_ct_req {
} payload;
};
-/**
- * fill FC header fields in specified fc_frame
- */
-static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl,
- u32 did, u32 sid, enum fc_fh_type type,
- u32 f_ctl, u32 parm_offset)
+static inline void __fc_fill_fc_hdr(struct fc_frame_header *fh,
+ enum fc_rctl r_ctl,
+ u32 did, u32 sid, enum fc_fh_type type,
+ u32 f_ctl, u32 parm_offset)
{
- struct fc_frame_header *fh;
-
- fh = fc_frame_header_get(fp);
WARN_ON(r_ctl == 0);
fh->fh_r_ctl = r_ctl;
hton24(fh->fh_d_id, did);
@@ -68,6 +63,19 @@ static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl,
}
/**
+ * fill FC header fields in specified fc_frame
+ */
+static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl,
+ u32 did, u32 sid, enum fc_fh_type type,
+ u32 f_ctl, u32 parm_offset)
+{
+ struct fc_frame_header *fh;
+
+ fh = fc_frame_header_get(fp);
+ __fc_fill_fc_hdr(fh, r_ctl, did, sid, type, f_ctl, parm_offset);
+}
+
+/**
* fc_adisc_fill() - Fill in adisc request frame
* @lport: local port.
* @fp: fc frame where payload will be placed.
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/8] libfcoe: Move FCOE_MTU definition from fcoe.h to libfcoe.h
2011-02-25 23:02 [PATCH 0/8] libfc, libfcoe and fcoe updates for scsi-misc Robert Love
` (3 preceding siblings ...)
2011-02-25 23:03 ` [PATCH 4/8] libfc: introduce __fc_fill_fc_hdr that accepts fc_hdr as an argument Robert Love
@ 2011-02-25 23:03 ` Robert Love
2011-02-25 23:03 ` [PATCH 6/8] libfcoe: Remove stale fcoe-netdev entries Robert Love
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Robert Love @ 2011-02-25 23:03 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Bhanu Prakash Gollapudi
From: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
both fcoe and bnx2fc drivers can access the common definition of
FCOE_MTU.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/fcoe.h | 6 ------
include/scsi/libfcoe.h | 6 ++++++
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe.h b/drivers/scsi/fcoe/fcoe.h
index d775128..408a6fd 100644
--- a/drivers/scsi/fcoe/fcoe.h
+++ b/drivers/scsi/fcoe/fcoe.h
@@ -40,12 +40,6 @@
#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");
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index e502463..8c1638b 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -33,6 +33,12 @@
#define FCOE_MAX_CMD_LEN 16 /* Supported CDB length */
/*
+ * 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
+
+/*
* FIP tunable parameters.
*/
#define FCOE_CTLR_START_DELAY 2000 /* mS after first adv. to choose FCF */
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/8] libfcoe: Remove stale fcoe-netdev entries
2011-02-25 23:02 [PATCH 0/8] libfc, libfcoe and fcoe updates for scsi-misc Robert Love
` (4 preceding siblings ...)
2011-02-25 23:03 ` [PATCH 5/8] libfcoe: Move FCOE_MTU definition from fcoe.h to libfcoe.h Robert Love
@ 2011-02-25 23:03 ` Robert Love
2011-02-25 23:03 ` [PATCH 7/8] fcoe: precedence bug in fcoe_filter_frames() Robert Love
2011-02-25 23:03 ` [PATCH 8/8] fcoe: fix broken fcoe interface reset Robert Love
7 siblings, 0 replies; 9+ messages in thread
From: Robert Love @ 2011-02-25 23:03 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Bhanu Prakash Gollapudi
From: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
When L2 driver is unloaded, libfcoe_destroy tries to access the fcoe
transport structure matching the netdev. However, since the netdev is
unregistered by that time, it fails to do so. Hence the stale mappings
exists in the fcoe-netdev list. Handle NETDEV_UREGISTER device
notification mechanism to remove the stale fcoe-netdev mapping.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/fcoe_transport.c | 46 +++++++++++++++++++++++++++++++++++-
1 files changed, 45 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c
index 745eb9a..2586841 100644
--- a/drivers/scsi/fcoe/fcoe_transport.c
+++ b/drivers/scsi/fcoe/fcoe_transport.c
@@ -39,10 +39,13 @@ static struct fcoe_transport *fcoe_transport_lookup(struct net_device *device);
static struct fcoe_transport *fcoe_netdev_map_lookup(struct net_device *device);
static int fcoe_transport_enable(const char *, struct kernel_param *);
static int fcoe_transport_disable(const char *, struct kernel_param *);
+static int libfcoe_device_notification(struct notifier_block *notifier,
+ ulong event, void *ptr);
static LIST_HEAD(fcoe_transports);
-static LIST_HEAD(fcoe_netdevs);
static DEFINE_MUTEX(ft_mutex);
+static LIST_HEAD(fcoe_netdevs);
+static DEFINE_MUTEX(fn_mutex);
unsigned int libfcoe_debug_logging;
module_param_named(debug_logging, libfcoe_debug_logging, int, S_IRUGO|S_IWUSR);
@@ -75,6 +78,11 @@ module_param_call(disable, fcoe_transport_disable, NULL, NULL, S_IWUSR);
__MODULE_PARM_TYPE(disable, "string");
MODULE_PARM_DESC(disable, " Disables fcoe on a ethernet interface.");
+/* notification function for packets from net device */
+static struct notifier_block libfcoe_notifier = {
+ .notifier_call = libfcoe_device_notification,
+};
+
/**
* fcoe_fc_crc() - Calculates the CRC for a given frame
* @fp: The frame to be checksumed
@@ -375,6 +383,7 @@ static int fcoe_transport_show(char *buffer, const struct kernel_param *kp)
static int __init fcoe_transport_init(void)
{
+ register_netdevice_notifier(&libfcoe_notifier);
return 0;
}
@@ -382,6 +391,7 @@ static int __exit fcoe_transport_exit(void)
{
struct fcoe_transport *ft;
+ unregister_netdevice_notifier(&libfcoe_notifier);
mutex_lock(&ft_mutex);
list_for_each_entry(ft, &fcoe_transports, list)
printk(KERN_ERR "FCoE transport %s is still attached!\n",
@@ -405,7 +415,9 @@ static int fcoe_add_netdev_mapping(struct net_device *netdev,
nm->netdev = netdev;
nm->ft = ft;
+ mutex_lock(&fn_mutex);
list_add(&nm->list, &fcoe_netdevs);
+ mutex_unlock(&fn_mutex);
return 0;
}
@@ -414,13 +426,16 @@ static void fcoe_del_netdev_mapping(struct net_device *netdev)
{
struct fcoe_netdev_mapping *nm = NULL, *tmp;
+ mutex_lock(&fn_mutex);
list_for_each_entry_safe(nm, tmp, &fcoe_netdevs, list) {
if (nm->netdev == netdev) {
list_del(&nm->list);
kfree(nm);
+ mutex_unlock(&fn_mutex);
return;
}
}
+ mutex_unlock(&fn_mutex);
}
@@ -438,13 +453,16 @@ static struct fcoe_transport *fcoe_netdev_map_lookup(struct net_device *netdev)
struct fcoe_transport *ft = NULL;
struct fcoe_netdev_mapping *nm;
+ mutex_lock(&fn_mutex);
list_for_each_entry(nm, &fcoe_netdevs, list) {
if (netdev == nm->netdev) {
ft = nm->ft;
+ mutex_unlock(&fn_mutex);
return ft;
}
}
+ mutex_unlock(&fn_mutex);
return NULL;
}
@@ -470,6 +488,32 @@ static struct net_device *fcoe_if_to_netdev(const char *buffer)
}
/**
+ * libfcoe_device_notification() - Handler for net device events
+ * @notifier: The context of the notification
+ * @event: The type of event
+ * @ptr: The net device that the event was on
+ *
+ * This function is called by the Ethernet driver in case of link change event.
+ *
+ * Returns: 0 for success
+ */
+static int libfcoe_device_notification(struct notifier_block *notifier,
+ ulong event, void *ptr)
+{
+ struct net_device *netdev = ptr;
+
+ switch (event) {
+ case NETDEV_UNREGISTER:
+ printk(KERN_ERR "libfcoe_device_notification: NETDEV_UNREGISTER %s\n",
+ netdev->name);
+ fcoe_del_netdev_mapping(netdev);
+ break;
+ }
+ return NOTIFY_OK;
+}
+
+
+/**
* fcoe_transport_create() - Create a fcoe interface
* @buffer: The name of the Ethernet interface to create on
* @kp: The associated kernel param
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 7/8] fcoe: precedence bug in fcoe_filter_frames()
2011-02-25 23:02 [PATCH 0/8] libfc, libfcoe and fcoe updates for scsi-misc Robert Love
` (5 preceding siblings ...)
2011-02-25 23:03 ` [PATCH 6/8] libfcoe: Remove stale fcoe-netdev entries Robert Love
@ 2011-02-25 23:03 ` Robert Love
2011-02-25 23:03 ` [PATCH 8/8] fcoe: fix broken fcoe interface reset Robert Love
7 siblings, 0 replies; 9+ messages in thread
From: Robert Love @ 2011-02-25 23:03 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Dan Carpenter
From: Dan Carpenter <error27@gmail.com>
Negate has higher precedence than bitwise AND. FCPHF_CRC_UNCHECKED is
0x1 so the original code is equivalent to: if (!fr_flags(fp)) { ...
Signed-off-by: Dan Carpenter <error27@gmail.com>
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 0b5fbb8..0b44d05 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -1548,7 +1548,7 @@ static inline int fcoe_filter_frames(struct fc_lport *lport,
return -EINVAL;
}
- if (!fr_flags(fp) & FCPHF_CRC_UNCHECKED ||
+ if (!(fr_flags(fp) & FCPHF_CRC_UNCHECKED) ||
le32_to_cpu(fr_crc(fp)) == ~crc32(~0, skb->data, skb->len)) {
fr_flags(fp) &= ~FCPHF_CRC_UNCHECKED;
return 0;
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 8/8] fcoe: fix broken fcoe interface reset
2011-02-25 23:02 [PATCH 0/8] libfc, libfcoe and fcoe updates for scsi-misc Robert Love
` (6 preceding siblings ...)
2011-02-25 23:03 ` [PATCH 7/8] fcoe: precedence bug in fcoe_filter_frames() Robert Love
@ 2011-02-25 23:03 ` Robert Love
7 siblings, 0 replies; 9+ messages in thread
From: Robert Love @ 2011-02-25 23:03 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Ross Brattain, Vasu Dev
From: Vasu Dev <vasu.dev@intel.com>
Reset using "fcoeadm -r" also needs to restart FIP before
doing libfc lport reset, this is needed for new switch firmware
requiring FIP solicitation before doing FLOGI again during reset.
So this patch does this by doing fcoe_ctlr_link_down and then
fcoe_ctlr_link_up to reset the interface.
The fcoe_ctlr_link_down call path also does lport reset
and then fcoe_ctlr_link_up re-starts the fabric login after
doing FIP solicitation first to get reset feature working
again.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/fcoe.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 0b44d05..94fb480 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -2130,7 +2130,13 @@ void fcoe_percpu_clean(struct fc_lport *lport)
int fcoe_reset(struct Scsi_Host *shost)
{
struct fc_lport *lport = shost_priv(shost);
- fc_lport_reset(lport);
+ struct fcoe_port *port = lport_priv(lport);
+ struct fcoe_interface *fcoe = port->priv;
+
+ fcoe_ctlr_link_down(&fcoe->ctlr);
+ fcoe_clean_pending_queue(fcoe->ctlr.lp);
+ if (!fcoe_link_ok(fcoe->ctlr.lp))
+ fcoe_ctlr_link_up(&fcoe->ctlr);
return 0;
}
^ permalink raw reply related [flat|nested] 9+ messages in thread