Updates to libfc, libfcoe, fcoe and fnic
Subsystems (3)
cover Updates to libfc, libfcoe, fcoe and fnic
The following series contains 5 patches that were previously mailed on 01/21/2010. 3 new patches for fnic and an update to the MAINTAINERS file.
These patches should apply to scsi-misc.
---
Bhanu Prakash Gollapudi (1):
libfcoe: Send port LKA every FIP_VN_KA_PERIOD secs.
Hugh Daschbach (2):
libfc: Don't assume response request present.
libfc: Fix e_d_tov ns -> ms scaling factor in PLOGI response.
Robert Love (2):
MAINTAINERS: Adding FCoE information to the MAINTAINERS file.
fcoe: Only rmmod fcoe.ko if there are no active connections
Vasu Dev (1):
libfc: call ddp setup for only FCP reads to avoid accessing junk fsp pointer
Venkata Siva Vijayendra Bhamidipati (3):
fnic: Set fnic driver version
fnic: lport stats need to be initialized in fnic_probe()
fnic: Allow multicast and unicast address registrations for fnic
MAINTAINERS | 11 +++++++++++ drivers/scsi/fcoe/fcoe.c | 18 ++++++++++++++++-- drivers/scsi/fcoe/libfcoe.c | 2 +- drivers/scsi/fnic/fnic.h | 2 +- drivers/scsi/fnic/fnic_main.c | 4 ++++ drivers/scsi/fnic/vnic_devcmd.h | 2 +- drivers/scsi/libfc/fc_exch.c | 2 +- drivers/scsi/libfc/fc_fcp.c | 3 --- drivers/scsi/libfc/fc_lport.c | 3 ++- drivers/scsi/libfc/fc_rport.c | 2 +- 10 files changed, 38 insertions(+), 11 deletions(-)
Signature · 1 line
//Rob
PATCH 1/9 libfc: call ddp setup for only FCP reads to avoid accessing junk fsp pointer
From: Vasu Dev <[email protected]>
Adds check to call fc_fcp_ddp_setup for only FCP read cmds to avoid accessing junk fsp pointer at least in ESX since non FCP frame had junk fsp value, though fsp is implicitly initialized to null by __alloc_skb but with this patch no more relying on fsp initialized to null value and hitting junk fsp ptr access.
Removes fsp pointer checking in fc_fcp_ddp_setup as this is not needed any more since its only caller for FCP read will always have a valid fsp.
Reported by: Frank Zhang <[email protected]> Reported by: Rob Love <[email protected]>
---
drivers/scsi/libfc/fc_exch.c | 2 +- drivers/scsi/libfc/fc_fcp.c | 3 --- 2 files changed, 1 insertions(+), 4 deletions(-)
drivers/scsi/libfc/fc_exch.c +1 -1
@@ -1890,7 +1890,7 @@ static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport,fc_exch_setup_hdr (ep, fp, ep->f_ctl); sp->cnt++; -if (ep->xid <= lport->lro_xid) +if (ep->xid <= lport->lro_xid && fh->fh_r_ctl ==FC_RCTL_DD_UNSOL_CMD )fc_fcp_ddp_setup (fr_fsp (fp), ep->xid);if (unlikely (lport->tt.frame_send (lport, fp)))
drivers/scsi/libfc/fc_fcp.c +0 -3
@@ -298,9 +298,6 @@ void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid) {struct fc_lport *lport; -if (!fsp) -return ; - lport = fsp->lp;if ((fsp->req_flags &FC_SRB_READ ) && (lport->lro_enabled) && (lport->tt.ddp_setup)) {
PATCH 2/9 libfc: Fix e_d_tov ns -> ms scaling factor in PLOGI response.
In reply to Robert LoveFrom: Hugh Daschbach <[email protected]>
Both PLOGI and RTV response processing conditionally scale e_d_tov, but use different scaling factors. The scaling factor is correct in RTV response processing. Bring PLOGI e_d_tov scaling in line with RTV common service parameter inspection.
---
drivers/scsi/libfc/fc_rport.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/libfc/fc_rport.c +1 -1
@@ -623,7 +623,7 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp, tov =ntohl (plp->fl_csp.sp_e_d_tov);if (ntohs (plp->fl_csp.sp_features) &FC_SP_FT_EDTR ) - tov /=1000 ; + tov /=1000000 ;if (tov > rdata->e_d_tov) rdata->e_d_tov = tov; csp_seq =ntohs (plp->fl_csp.sp_tot_seq);
PATCH 3/9 libfc: Don't assume response request present.
In reply to Robert LoveFrom: Hugh Daschbach <[email protected]>
Fix NULL pointer dereference crash occurs in fc_lport_bsg_request() for bsg requests that do not contain a response request. Specifically, FC_BSG_HST_ADD_RPORT and FC_BSG_HST_DEL_RPORT bsg requests are not guaranteed to include a response request.
---
drivers/scsi/libfc/fc_lport.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/scsi/libfc/fc_lport.c +2 -1
@@ -1800,7 +1800,8 @@ int fc_lport_bsg_request(struct fc_bsg_job *job)u32 did; job->reply->reply_payload_rcv_len =0 ; - rsp->resid_len = job->reply_payload.payload_len; +if (rsp) + rsp->resid_len = job->reply_payload.payload_len;mutex_lock (&lport->lp_mutex);
PATCH 4/9 libfcoe: Send port LKA every FIP_VN_KA_PERIOD secs.
In reply to Robert LoveFrom: Bhanu Prakash Gollapudi <[email protected]>
libfcoe module doesnt send port keep alive every FIP_VN_KA_PERIOD due to improper assignment of timeout value. Update the port_ka_time appropriately by incrementing it by FIP_VN_KA_PERIOD in fcoe_ctlr_timeout(), so that the link_work is scheduled to send the port LKA.
---
drivers/scsi/fcoe/libfcoe.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/fcoe/libfcoe.c +1 -1
@@ -1187,7 +1187,7 @@ static void fcoe_ctlr_timeout(unsigned long arg) next_timer = fip->ctlr_ka_time;if (time_after_eq (jiffies, fip->port_ka_time)) { - fip->port_ka_time += jiffies + + fip->port_ka_time = jiffies +msecs_to_jiffies (FIP_VN_KA_PERIOD ); fip->send_port_ka =1 ; }
PATCH 5/9 fcoe: Only rmmod fcoe.ko if there are no active connections
In reply to Robert LoveCurrently we're gracefully tearing down each active connection when fcoe.ko is removed. We shouldn't allow the user to destroy connections by removing the module. We should force the user to destroy each connection and then the module can be removed.
This patch makes it so a refrerence count on the module is taken each time a fcoe_interface is created. The reference count is dropped when the fcoe_interface is destroyed. This makes it so that module_exit() doesn't get called unless all fcoe_interfaces have been destroyed.
This patch leaves the removal of interfaces in the module_exit routine so that if the user does a 'rmmod -f' we'll clean everything up before removing the module.
The module_put line was put before the out_putdev goto line because we should only be decrementing the reference count if a fcoe_interface is actually destroyed. If we can't find the netdev or the fcoe_interface then it's assumed that something else has destroyed the fcoe_interface and it would have decremented the reference count at that time.
---
drivers/scsi/fcoe/fcoe.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-)
drivers/scsi/fcoe/fcoe.c +16 -2
@@ -2009,6 +2009,8 @@ static int fcoe_destroy(const char *buffer, struct kernel_param *kp)fcoe_interface_cleanup (fcoe);rtnl_unlock ();fcoe_if_destroy (fcoe->ctlr.lp); +module_put (THIS_MODULE ); + out_putdev:dev_put (netdev); out_nodev:
@@ -2059,6 +2061,11 @@ static int fcoe_create(const char *buffer, struct kernel_param *kp) }#endif +if (!try_module_get (THIS_MODULE )) { + rc = -EINVAL ; + goto out_nomod; + } +rtnl_lock (); netdev =fcoe_if_to_netdev (buffer);if (!netdev) {
@@ -2099,17 +2106,24 @@ static int fcoe_create(const char *buffer, struct kernel_param *kp)if (!fcoe_link_ok (lport))fcoe_ctlr_link_up (&fcoe->ctlr); - rc =0 ; -out_free:/* * Release from init in fcoe_interface_create(), on success lport * should be holding a reference taken in fcoe_if_create(). */ fcoe_interface_put (fcoe); +dev_put (netdev); +rtnl_unlock (); +mutex_unlock (&fcoe_config_mutex); + +return 0 ; +out_free: +fcoe_interface_put (fcoe); out_putdev:dev_put (netdev); out_nodev:rtnl_unlock (); +module_put (THIS_MODULE ); +out_nomod:mutex_unlock (&fcoe_config_mutex);return rc; }
PATCH 6/9 fnic: Allow multicast and unicast address registrations for fnic
In reply to Robert LoveFrom: Venkata Siva Vijayendra Bhamidipati <[email protected]>
To enable FIP support in fnic, we have to register with hardware to receive FIP solication frames on a well-known multicast address.
Before FIP support, the firmware interface allowed multicast address registrations only for enic devices. This is a minor change in fnic to allow the firmware interface to now register mcast addresses for fnic too.
---
drivers/scsi/fnic/fnic_main.c | 2 ++ drivers/scsi/fnic/vnic_devcmd.h | 2 +- 2 files changed, 3 insertions(+), 1 deletions(-)
drivers/scsi/fnic/fnic_main.c +2 -0
@@ -620,6 +620,8 @@ static int __devinit fnic_probe(struct pci_dev *pdev,if (fnic->config.flags &VFCF_FIP_CAPABLE ) {shost_printk (KERN_INFO , fnic->lport->host,"firmware supports FIP\n" ); +/* enable directed and multicast */ +vnic_dev_packet_filter (fnic->vdev,1 ,1 ,0 ,0 ,0 );vnic_dev_add_addr (fnic->vdev,FIP_ALL_ENODE_MACS );vnic_dev_add_addr (fnic->vdev, fnic->ctlr.ctl_src_addr); }else {
drivers/scsi/fnic/vnic_devcmd.h +1 -1
@@ -94,7 +94,7 @@ enum vnic_devcmd_cmd {CMD_STATS_DUMP =_CMDC (_CMD_DIR_WRITE, _CMD_VTYPE_ALL,4 ),/* set Rx packet filter: (u32)a0=filters (see CMD_PFILTER_*) */ -CMD_PACKET_FILTER =_CMDCNW (_CMD_DIR_WRITE, _CMD_VTYPE_ENET,7 ), +CMD_PACKET_FILTER =_CMDCNW (_CMD_DIR_WRITE, _CMD_VTYPE_ALL,7 ),/* hang detection notification */ CMD_HANG_NOTIFY = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_ALL, 8),
PATCH 7/9 fnic: lport stats need to be initialized in fnic_probe()
In reply to Robert LoveFrom: Venkata Siva Vijayendra Bhamidipati <[email protected]>
Incorrect initialization of lport stats in fnic_probe() causes fnic to crash at bootup and a node hang if fip is enabled and all links are brought up after fnic is loaded.
---
drivers/scsi/fnic/fnic_main.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/scsi/fnic/fnic_main.c +2 -0
@@ -700,6 +700,8 @@ static int __devinit fnic_probe(struct pci_dev *pdev, goto err_out_remove_scsi_host; } +fc_lport_init_stats (lp); +fc_lport_config (lp); if (fc_set_mfs(lp, fnic->config.maxdatafieldsize +
PATCH 8/9 fnic: Set fnic driver version
In reply to Robert LoveFrom: Venkata Siva Vijayendra Bhamidipati <[email protected]>
Update fnic driver version.
---
drivers/scsi/fnic/fnic.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/fnic/fnic.h +1 -1
@@ -36,7 +36,7 @@#define DRV_NAME "fnic"#define DRV_DESCRIPTION "Cisco FCoE HBA Driver" -#define DRV_VERSION "1.0.0.1121" +#define DRV_VERSION "1.4.0.98"#define PFX DRV_NAME ": "#define DFX DRV_NAME "%d: "
PATCH 9/9 MAINTAINERS: Adding FCoE information to the MAINTAINERS file.
In reply to Robert Love---
MAINTAINERS | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
MAINTAINERS +11 -0
@@ -2145,6 +2145,17 @@ S: Supported F: Documentation/fault-injection/ F: lib/fault-inject.c +FCOE SUBSYSTEM (libfc, libfcoe, fcoe) +M: Robert Love <[email protected]> +L: [email protected] +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 <[email protected]> L: [email protected]