Series short description
cover Series short description
The following series implements...
Currently OpenFC maintains several control structures for each enabled fcoe interface, such as inner and outer fc_port, fcdev, openfc_softc, fcs_state (for fc_local_port and fc_virt_fab) etc. Here fc_port should not be confused with FC protocol's ports related structs, instead fc_port provides generic/portable interface to FCS sub module embedded inside openFC for egress, ingress handlers and sa events lists to OpenFC per FCoE interface instance.
I removed outer port instance in these patches, instead used existing fcdev structure by direct functions calls between FCS & OpenFC for outer port egress and inegress functions. The fcdev is key shared structure per FCoE interface between OpenFC and FCoE modules, fcdev can be extended for all libfc(TBD) users to access per libfc user instance.
Consolidation of more control structures in fcdev will simplify openFC implementation which will help in converting OpenFC into generic libfc library as suggested by linux-scsi reviewers.
Signature · 1 line
Signature : Vasu Dev <[email protected]>
PATCH 1/5 Removed outer port allocation
Instead used fcs_recv() port ingress function directly.
The port egress and frame-alloc functions will be used from fcdev directly.
---
drivers/scsi/ofc/openfc/openfc_if.c | 19 +------------------ 1 files changed, 1 insertions(+), 18 deletions(-)
drivers/scsi/ofc/openfc/openfc_if.c +1 -18
@@ -801,9 +801,8 @@ static void openfc_timeout_handler(ulong vp)void openfc_rcv (struct fcdev *dev,struct fc_frame *fp) {struct openfc_softc *openfcp =openfc_get_softc (dev); -struct fc_port *portp = openfcp->fcs_port; -fc_port_ingress (portp, fp); +fcs_recv (openfcp->fcs_state, fp); }EXPORT_SYMBOL (openfc_rcv);
@@ -923,7 +922,6 @@ int openfc_register(struct fcdev *dev) {struct openfc_softc *openfcp;struct Scsi_Host *host; -struct fc_port *port;struct class_device *cp;int i;int rc;
@@ -972,19 +970,6 @@ int openfc_register(struct fcdev *dev)*/ openfcp->state =OPENFC_INITIALIZATION ; openfcp->status =OPENFC_LINK_UP ; - port =fc_port_alloc (); -if (!port) { -OFC_DBG ("Could not create fc_port structure" ); - goto out_host_rem; - } - openfcp->fcs_port = port; -if (dev->port_ops.frame_alloc) -fc_port_set_frame_alloc (port, dev->port_ops.frame_alloc); - -fc_port_set_egress (port, - (int (*)(void *,struct fc_frame *))dev->port_ops. - send, dev); - ofc_fcs_args.fca_port = port;if (dev->min_xid) ofc_fcs_args.fca_min_xid = dev->min_xid;
@@ -995,12 +980,10 @@ int openfc_register(struct fcdev *dev)else ofc_fcs_args.fca_max_xid =OPENFC_MAX_XID ; -fc_port_set_max_frame_size (port, dev->framesize); ofc_fcs_args.fca_cb_arg = (void *)openfcp; openfcp->fcs_state =fcs_create (&ofc_fcs_args);if (openfcp->fcs_state ==NULL ) {OFC_DBG ("Could not create fcs_state structure" ); -fc_port_close_ingress (port); goto out_host_rem; }
PATCH 2/5 Removed outer port use from fcs
In reply to Vasu DevRemoved outer port use from fcs create and fcs destroy.
Made fcdev available via fcs_state for previously used some of the fields from outer port, e.g. egress handler and framesize from outer port. Also added fcdev to fc_local_port and initialized this fcdev during local port create, this fcdev will be used for frame alloc and removing inner port later.
Also moved outer port event list to fcs_state.
---
drivers/scsi/ofc/include/fc_local_port.h | 2 + drivers/scsi/ofc/include/fcs_state.h | 4 ++ drivers/scsi/ofc/libfc/fc_local_port.c | 2 + drivers/scsi/ofc/libfc/fc_local_port_impl.h | 1 + drivers/scsi/ofc/libfc/fcs_state.c | 47 +++++++++++++++------------ drivers/scsi/ofc/libfc/fcs_state_impl.h | 4 ++ drivers/scsi/ofc/openfc/openfc_if.c | 7 ++-- drivers/scsi/ofc/openfc/openfc_ioctl.c | 10 +++--- 8 files changed, 48 insertions(+), 29 deletions(-)
drivers/scsi/ofc/include/fc_local_port.h +2 -0
@@ -27,6 +27,7 @@*/ #include "sa_event.h" #include "fc_fs.h" +#include "fcdev.h" struct fc_local_port ;/* semi-opaque. See fc_local_port_impl.h */ struct fc_remote_port ;
@@ -38,6 +39,7 @@ struct fc_frame;struct fc_ns_fts ; struct fc_local_port *fc_local_port_create(struct fc_virt_fab *, + struct fcdev *, struct fc_port *, fc_wwn_t wwpn, fc_wwn_t wwnn, u_int timeout_msec,
drivers/scsi/ofc/include/fcs_state.h +4 -0
@@ -20,6 +20,8 @@#ifndef _LIBFC_FCS_STATE_H_#define _LIBFC_FCS_STATE_H_ +#include "fcdev.h" +struct fcs_state ;struct fc_remote_port ;struct fc_local_port ;
@@ -34,6 +36,7 @@ struct fcs_create_args {void (*fca_prlo_notify)(void *arg,struct fc_remote_port *);void *fca_cb_arg;/* arg for callbacks */ struct fc_port *fca_port;/* transport interface to FC fabric */ +struct fcdev *dev;/* transport driver instance */ u_int fca_service_params;/* service parm flags from fc/fcp.h */ fc_xid_t fca_min_xid;/* starting exchange ID */ fc_xid_t fca_max_xid;/* maximum exchange ID */
@@ -51,6 +54,7 @@ void fcs_recv(struct fcs_state *, struct fc_frame *);int fcs_local_port_set (struct fcs_state *,fc_wwn_t node,fc_wwn_t port);int fcs_cmd_send (struct fcs_state *,struct fc_frame *,struct fc_frame *,u_int ,u_int ); +void fcs_send_event (struct fcs_state *sp,enum fc_event event);struct fc_local_port *fcs_get_local_port (struct fcs_state *);/*
drivers/scsi/ofc/libfc/fc_local_port.c +2 -0
@@ -869,6 +869,7 @@ void fc_local_port_table_destroy(struct fc_virt_fab *vp)* Create Local Port. */ struct fc_local_port *fc_local_port_create(struct fc_virt_fab *vf, + struct fcdev *dev, struct fc_port *port, fc_wwn_t wwpn, fc_wwn_t wwnn, u_int timeout_msec,
@@ -882,6 +883,7 @@ struct fc_local_port *fc_local_port_create(struct fc_virt_fab *vf,memset (lp,0 ,sizeof (*lp)); lp->fl_vf = vf;atomic_set (&lp->fl_refcnt,1 ); + lp->dev = dev; lp->fl_port = port; lp->fl_port_wwn = wwpn; lp->fl_node_wwn = wwnn;
drivers/scsi/ofc/libfc/fc_local_port_impl.h +1 -0
@@ -55,6 +55,7 @@ struct fc_local_port {struct fc_virt_fab *fl_vf;/* virtual fabric */ struct list_head fl_list;/* list headed in virt_fab */ struct fc_port *fl_port;/* port to use when sending */ +struct fcdev *dev;/* fc device instance */ struct fc_sess *fl_dns_sess;/* session for dNS queries */ struct fc_remote_port *fl_ptp_rp;/* point-to-point remote port */ struct list_head fl_sess_list;/* list of sessions */
drivers/scsi/ofc/libfc/fcs_state.c +26 -21
115 lines not on this page · raw message
drivers/scsi/ofc/libfc/fcs_state_impl.h +4 -0
@@ -20,6 +20,9 @@#ifndef _OPENFC_FCS_STATE_IMPL_H_#define _OPENFC_FCS_STATE_IMPL_H_ +#include "sa_event.h" +#include "fc_event.h" +/* * Private state structure. */
@@ -29,6 +32,7 @@ struct fcs_state {struct fc_local_port *fs_local_port;/* local port */ struct fc_port *fs_inner_port;/* port used by local port */ uint8_t fs_disc_done;/* discovery complete */ +struct sa_event_list *events;/* fcs events */ };void fcs_ev_destroy (void );
drivers/scsi/ofc/openfc/openfc_if.c +4 -3
@@ -981,6 +981,7 @@ int openfc_register(struct fcdev *dev) ofc_fcs_args.fca_max_xid =OPENFC_MAX_XID ; ofc_fcs_args.fca_cb_arg = (void *)openfcp; + ofc_fcs_args.dev = dev; openfcp->fcs_state =fcs_create (&ofc_fcs_args);if (openfcp->fcs_state ==NULL ) {OFC_DBG ("Could not create fcs_state structure" );
@@ -1018,7 +1019,7 @@ int openfc_register(struct fcdev *dev) goto out_fcs; }if (dev->fd_link_status ==TRANS_LINK_DOWN ) { -fc_port_send_event (openfcp->fcs_port,FC_EV_DOWN ); +fcs_send_event (openfcp->fcs_state,FC_EV_DOWN ); openfcp->status &= ~OPENFC_LINK_UP ; }if (dev->options &TRANS_O_FCS_AUTO ) {
@@ -1120,7 +1121,7 @@ void openfc_linkup(struct fcdev *dev)struct openfc_softc *openfcp =openfc_get_softc (dev);if (!(openfcp->status &OPENFC_LINK_UP )) { -fc_port_send_event (openfcp->fcs_port,FC_EV_READY ); +fcs_send_event (openfcp->fcs_state,FC_EV_READY ); openfcp->status |=OPENFC_LINK_UP ; } }
@@ -1136,7 +1137,7 @@ void openfc_linkdown(struct fcdev *dev)struct fc_scsi_pkt *fsp;if (openfcp->status &OPENFC_LINK_UP ) { -fc_port_send_event (openfcp->fcs_port,FC_EV_DOWN ); +fcs_send_event (openfcp->fcs_state,FC_EV_DOWN ); openfcp->status &= ~(OPENFC_LINK_UP ); fsp =openfc_alloc_scsi_pkt (openfcp);openfc_scsi_cleanup (fsp);
drivers/scsi/ofc/openfc/openfc_ioctl.c +5 -5
@@ -189,14 +189,14 @@ static int openfc_ioctl(struct inode *inode, struct file *file, port->pi_max_frame_size =FC_MAX_PAYLOAD ; port->pi_class =FC_COS_CLASS3 ; -if (fc_port_ready (openfcp->fcs_port) ==0 ) { +if (openfcp->fcs_state ==NULL ) port->pi_port_state =OFC_PSTATE_NOLINK ; - }else if (atomic_read (&openfcp->fcs_status) == -OPENFC_FCS_ONLINE ) { +else if (atomic_read (&openfcp->fcs_status) == +OPENFC_FCS_ONLINE ) port->pi_port_state =OFC_PSTATE_ONLINE ; - }else { +else port->pi_port_state =OFC_PSTATE_OFFLINE ; - } + lp =fcs_get_local_port (openfcp->fcs_state); fm =fc_local_port_get_fc4_map (lp);memcpy (port->pi_fc4_support, fm,sizeof (*fm));
PATCH 3/5 Removed outer port use in fc_exch
In reply to Vasu DevUsed fcdev for frame_alloc instead outer port. The frame_alloc() is modified in next patch with its all other references.
---
drivers/scsi/ofc/include/fc_exch.h | 5 +++-- drivers/scsi/ofc/include/fc_frame.h | 2 ++ drivers/scsi/ofc/libfc/fc_exch.c | 32 ++++++++++++++++---------------- drivers/scsi/ofc/libfc/fc_exch_impl.h | 4 ++-- drivers/scsi/ofc/libfc/fc_local_port.c | 2 +- drivers/scsi/ofc/libfc/fc_sess.c | 2 +- drivers/scsi/ofc/libfc/fcs_cmd.c | 2 +- drivers/scsi/ofc/libfc/fcs_state.c | 1 + 8 files changed, 27 insertions(+), 23 deletions(-)
drivers/scsi/ofc/include/fc_exch.h +3 -2
@@ -27,6 +27,7 @@#include "fc_event.h" #include "fc_fs.h" #include "fc_els.h" +#include "fcdev.h" /* * Principles of Operation.
@@ -92,9 +93,9 @@ void fc_exch_mgr_reset(struct fc_exch_mgr *, fc_fid_t s_id, fc_fid_t d_id);void fc_exch_set_addr (struct fc_exch *,fc_fid_t orig,fc_fid_t resp);/* -* Set the output port to be used for an exchange. +* Set the device to be used for an exchange. */ -void fc_exch_set_port (struct fc_exch *,struct fc_port *); +void fc_exch_set_dev (struct fc_exch *,struct fcdev *);/* * Start a new sequence as originator on a new exchange.
drivers/scsi/ofc/include/fc_frame.h +2 -0
@@ -44,6 +44,7 @@struct fc_frame {struct fc_port *fr_in_port;/* port where frame was received */ +struct fcdev *dev;/* fc device instance */ struct fc_seq *fr_seq;/* for use with exchange manager */ struct fc_frame_header *fr_hdr;/* pointer to frame header in buffer */ const char *fr_stamp;/* debug info on last usage */
@@ -85,6 +86,7 @@ struct fc_frame {static inline void fc_frame_init (struct fc_frame *fp) { fp->fr_in_port =NULL ; + fp->dev =NULL ; fp->fr_seq =NULL ; fp->fr_flags =0 ; fp->fr_sg_len =0 ;
drivers/scsi/ofc/libfc/fc_exch.c +16 -16
@@ -481,7 +481,7 @@ int fc_seq_abort_exch(const struct fc_seq *req_sp)/* * Send an abort for the sequence that timed out. */ - fp =fc_frame_alloc (ep->ex_port,0 ); + fp =fc_frame_alloc (ep->dev,0 );if (fp) {fc_frame_setup (fp,FC_RCTL_BA_ABTS ,FC_TYPE_BLS ); sp->seq_f_ctl |=FC_FC_SEQ_INIT ;
@@ -609,7 +609,7 @@ static struct fc_exch *fc_exch_resp(struct fc_exch_mgr *mp, ep =fc_exch_alloc (mp);if (ep) { - ep->ex_port = fp->fr_in_port; + ep->dev = fp->dev; ep->ex_class =fc_frame_class (fp);/*
@@ -788,9 +788,9 @@ static struct fc_seq *fc_seq_lookup_orig(struct fc_exch_mgr *mp,/* * Set the output port to be used for an exchange. */ -void fc_exch_set_port (struct fc_exch *ep,struct fc_port *port) +void fc_exch_set_dev (struct fc_exch *ep,struct fcdev *dev) { - ep->ex_port = port; + ep->dev = dev; }/*
@@ -934,7 +934,7 @@ size_t fc_seq_mfs(struct fc_seq *sp)int fc_seq_send_frag (struct fc_seq *sp,struct fc_frame *fp) {struct fc_exch *ep; -struct fc_port *port; +struct fcdev *dev;struct fc_frame_header *fh;enum fc_class class;u_int32_t f_ctl;
@@ -942,7 +942,7 @@ int fc_seq_send_frag(struct fc_seq *sp, struct fc_frame *fp) ep =fc_seq_exch (sp);WARN_ON ((ep->ex_e_stat &ESB_ST_SEQ_INIT ) !=ESB_ST_SEQ_INIT ); - port = ep->ex_port; + dev = ep->dev;WARN_ON ((sp->seq_f_ctl &FC_FC_END_SEQ ) !=0 );WARN_ON (fp->fr_len %4 !=0 );/* can't pad except on last frame */
@@ -969,7 +969,7 @@ int fc_seq_send_frag(struct fc_seq *sp, struct fc_frame *fp)/* * Send the frame. */ - error =fc_port_egress (port, fp); + error = dev->port_ops.send (dev, fp);/* * Update the exchange and sequence flags.
@@ -989,7 +989,7 @@ int fc_seq_send_frag(struct fc_seq *sp, struct fc_frame *fp)int fc_seq_send (struct fc_seq *sp,struct fc_frame *fp) {struct fc_exch *ep; -struct fc_port *port; +struct fcdev *dev;struct fc_frame_header *fh;enum fc_class class;u_int32_t f_ctl;
@@ -998,7 +998,7 @@ int fc_seq_send(struct fc_seq *sp, struct fc_frame *fp) ep =fc_seq_exch (sp);WARN_ON ((ep->ex_e_stat &ESB_ST_SEQ_INIT ) !=ESB_ST_SEQ_INIT ); - port = ep->ex_port; + dev = ep->dev;WARN_ON ((sp->seq_f_ctl &FC_FC_END_SEQ ) !=0 ); class = ep->ex_class;
@@ -1032,7 +1032,7 @@ int fc_seq_send(struct fc_seq *sp, struct fc_frame *fp)/* * Send the frame. */ - error =fc_port_egress (port, fp); + error = dev->port_ops.send (dev, fp);/* * Update the exchange and sequence flags,
@@ -1115,7 +1115,7 @@ static void fc_seq_send_ack(struct fc_seq *sp, const struct fc_frame *rx_fp)* Don't send ACKs for class 3. */ if (fc_sof_needs_ack (rx_fp->fr_sof)) { - fp =fc_frame_alloc (fc_seq_exch (sp)->ex_port,0 ); + fp =fc_frame_alloc (fc_seq_exch (sp)->dev,0 );BUG_ON (!fp);if (!fp)return ;
@@ -1150,7 +1150,7 @@ static void fc_seq_send_ack(struct fc_seq *sp, const struct fc_frame *rx_fp) }else { fp->fr_eof =FC_EOF_N ; } - (void )fc_port_egress (rx_fp->fr_in_port, fp); + (void ) rx_fp->dev->port_ops.send (rx_fp->dev, fp); } }
@@ -1451,7 +1451,7 @@ void fc_seq_ls_acc(struct fc_seq *req_sp)struct fc_frame *fp; sp =fc_seq_start_next (req_sp); - fp =fc_frame_alloc (fc_seq_exch (sp)->ex_port,sizeof (*acc)); + fp =fc_frame_alloc (fc_seq_exch (sp)->dev,sizeof (*acc));if (fp) { acc =fc_frame_payload_get (fp,sizeof (*acc));memset (acc,0 ,sizeof (*acc));
@@ -1475,7 +1475,7 @@ void fc_seq_ls_rjt(struct fc_seq *req_sp, enum fc_els_rjt_reason reason,struct fc_frame *fp; sp =fc_seq_start_next (req_sp); - fp =fc_frame_alloc (fc_seq_exch (sp)->ex_port,sizeof (*rjt)); + fp =fc_frame_alloc (fc_seq_exch (sp)->dev,sizeof (*rjt));if (fp) { rjt =fc_frame_payload_get (fp,sizeof (*rjt));memset (rjt,0 ,sizeof (*rjt));
@@ -1533,7 +1533,7 @@ struct fc_seq *fc_seq_rec_req(struct fc_seq *inq_sp,struct fc_els_rec *rp; ep =fc_seq_exch (inq_sp); - fp =fc_frame_alloc (ep->ex_port,sizeof (*rp)); + fp =fc_frame_alloc (ep->dev,sizeof (*rp));if (!fp)return NULL ; sp = fc_seq_start_exch(ep->ex_pool->emp_mgr, recv, errh, arg,
@@ -1542,7 +1542,7 @@ struct fc_seq *fc_seq_rec_req(struct fc_seq *inq_sp,fc_frame_free (fp);return NULL ; } -fc_seq_exch (sp)->ex_port = ep->ex_port; +fc_seq_exch (sp)->dev = ep->dev; rp =fc_frame_payload_get (fp,sizeof (*rp));memset (rp,0 ,sizeof (*rp)); rp->rec_cmd =ELS_REC ;
drivers/scsi/ofc/libfc/fc_exch_impl.h +2 -2
@@ -77,8 +77,8 @@ struct fc_exch {/* * Fields after ex_refcnt are cleared when an exchange is reallocated. */ -#define fc_exch_clear_start ex_port -struct fc_port *ex_port;/* port to peer (s/b in remote port) */ +#define fc_exch_clear_start dev +struct fcdev *dev;/* fc device instance */ fc_xid_t ex_ox_id;/* originator's exchange ID */ fc_xid_t ex_rx_id;/* responder's exchange ID */ fc_fid_t ex_orig_fid;/* originator's FCID */
drivers/scsi/ofc/libfc/fc_local_port.c +1 -1
@@ -398,7 +398,7 @@ static void fc_local_port_els_send(struct fc_local_port *lp, struct fc_seq *sp, struct fc_frame *fp) {if (sp && fp) { -fc_seq_exch (sp)->ex_port = lp->fl_port; +fc_seq_exch (sp)->dev = lp->dev;fc_exch_timer_set (fc_seq_exch (sp), lp->fl_e_d_tov);if (fc_seq_send_req (sp, fp,FC_RCTL_ELS_REQ ,FC_TYPE_ELS ,0 ))fc_local_port_retry (lp);
drivers/scsi/ofc/libfc/fc_sess.c +1 -1
@@ -519,7 +519,7 @@ struct fc_seq *fc_sess_seq_alloc(struct fc_sess *sess, sess->fs_remote_fid);if (sp) { ep =fc_seq_exch (sp); - ep->ex_port = lp->fl_port; + ep->dev = lp->dev; ep->ex_max_payload = sess->fs_max_payload; }return sp;
drivers/scsi/ofc/libfc/fcs_cmd.c +1 -1
@@ -140,7 +140,7 @@ int fcs_cmd_send(struct fcs_state *sp, struct fc_frame *fp, } cp->fcc_seq = seq; -fc_exch_set_port (fc_seq_exch (seq), sp->fs_args.fca_port); +fc_exch_set_dev (fc_seq_exch (seq), sp->fs_args.dev); cp->fcc_req_hdr = *fh;kref_get (&cp->fcc_kref);/* take ref for response */
drivers/scsi/ofc/libfc/fcs_state.c +1 -0
@@ -178,6 +178,7 @@ void fcs_recv(struct fcs_state *sp, struct fc_frame *fp)if (sp->fs_local_port) { fp->fr_in_port = sp->fs_inner_port; + fp->dev = sp->fs_args.dev;fc_local_port_recv (sp->fs_local_port, fp); }else {OFC_DBG ("fcs_local_port_set needed before receiving" );
PATCH 4/5 Fixed style error reported by checkpatch
In reply to Vasu DevFixed checkpatch ERROR here: do not use assignment in if condition (+ } else if ((fp = fc_frame_alloc(lp->dev, sizeof(*pl))) == NULL)
---
drivers/scsi/ofc/libfc/fc_sess.c | 57 +++++++++++++++++++++----------------- 1 files changed, 31 insertions(+), 26 deletions(-)
drivers/scsi/ofc/libfc/fc_sess.c +31 -26
@@ -1189,35 +1189,40 @@ static void fc_sess_recv_plogi_req(struct fc_sess *sess,if (reject) {fc_seq_ls_rjt (sp, reject,ELS_EXPL_NONE );fc_frame_free (fp); - }else if ((fp =fc_frame_alloc (lp->fl_port,sizeof (*pl))) ==NULL ) { - fp = rx_fp; -fc_seq_ls_rjt (sp,ELS_RJT_UNAB ,ELS_EXPL_NONE ); -fc_frame_free (fp); }else { - sp =fc_seq_start_next (sp); -WARN_ON (!sp); -fc_frame_free (rx_fp); -fc_remote_port_set_name (rp, wwpn, wwnn); + fp =fc_frame_alloc (lp->fl_port,sizeof (*pl)); +if (fp ==NULL ) { + fp = rx_fp; +fc_seq_ls_rjt (sp,ELS_RJT_UNAB ,ELS_EXPL_NONE ); +fc_frame_free (fp); + }else { + sp =fc_seq_start_next (sp); +WARN_ON (!sp); +fc_frame_free (rx_fp); +fc_remote_port_set_name (rp, wwpn, wwnn); -/* -* Get session payload size from incoming PLOGI. -*/ - sess->fs_max_payload = (uint16_t ) -fc_local_port_get_payload_size (pl, lp->fl_max_payload); - pl =fc_frame_payload_get (fp,sizeof (*pl)); -WARN_ON (!pl); -fc_local_port_flogi_fill (lp, pl,ELS_LS_ACC ); +/* +* Get session payload size from incoming PLOGI. +*/ + sess->fs_max_payload = (uint16_t ) +fc_local_port_get_payload_size (pl, + lp->fl_max_payload); + pl =fc_frame_payload_get (fp,sizeof (*pl)); +WARN_ON (!pl); +fc_local_port_flogi_fill (lp, pl,ELS_LS_ACC ); -/* -* Send LS_ACC. If this fails, the originator should retry. -*/ -fc_seq_send_last (sp, fp,FC_RCTL_ELS_REP ,FC_TYPE_ELS ); -if (sess->fs_state ==SESS_ST_PLOGI ) -fc_sess_enter_prli (sess); -else -fc_sess_state_enter (sess,SESS_ST_PLOGI_RECV ); -fc_sess_hold (sess);/* represents login */ - sess->fs_plogi_held =1 ; +/* +* Send LS_ACC. If this fails, +* the originator should retry. +*/ +fc_seq_send_last (sp, fp,FC_RCTL_ELS_REP ,FC_TYPE_ELS ); +if (sess->fs_state ==SESS_ST_PLOGI ) +fc_sess_enter_prli (sess); +else +fc_sess_state_enter (sess,SESS_ST_PLOGI_RECV ); +fc_sess_hold (sess);/* represents login */ + sess->fs_plogi_held =1 ; + } }fc_sess_unlock_send (sess); }
PATCH 5/5 Removed fc_port from fc_frame_alloc()
In reply to Vasu DevInstead used fcdev.
---
drivers/scsi/ofc/include/fc_frame.h | 17 +++++++++-------- drivers/scsi/ofc/libfc/fc_disc_targ.c | 4 ++-- drivers/scsi/ofc/libfc/fc_frame.c | 4 ++-- drivers/scsi/ofc/libfc/fc_local_port.c | 18 +++++++++--------- drivers/scsi/ofc/libfc/fc_sess.c | 12 ++++++------ drivers/scsi/ofc/openfc/openfc_ioctl.c | 4 ++-- drivers/scsi/ofc/openfc/openfc_scsi.c | 9 ++++----- 7 files changed, 34 insertions(+), 34 deletions(-)
drivers/scsi/ofc/include/fc_frame.h +9 -8
@@ -29,6 +29,7 @@#include "fc_fs.h" #include "fc_encaps.h" #include "fc_port.h" +#include "fcdev.h" #include <linux/scatterlist.h>
@@ -120,18 +121,18 @@ static inline int fc_frame_freed_static(struct fc_frame *fp)*/ struct fc_frame *fc_frame_alloc_int (size_t payload_size); -struct fc_frame *fc_frame_alloc_fill (struct fc_port *,size_t payload_len); +struct fc_frame *fc_frame_alloc_fill (struct fcdev *,size_t payload_len);/* * Get frame for sending via port. */ -static inline struct fc_frame *fc_port_frame_alloc (struct fc_port *port, +static inline struct fc_frame *_fc_frame_alloc (struct fcdev *dev,size_t payload_len) { -return (*port->np_frame_alloc)(payload_len); +return ((dev->port_ops.frame_alloc)(payload_len)); } -static inline struct fc_frame *fc_frame_alloc_inline (struct fc_port *port, +static inline struct fc_frame *fc_frame_alloc_inline (struct fcdev *dev,size_t len,const char *stamp) {struct fc_frame *fp;
@@ -141,9 +142,9 @@ static inline struct fc_frame *fc_frame_alloc_inline(struct fc_port *port,* this check will usually be evaluated and eliminated at compile time. */ if ((len %4 ) !=0 ) - fp =fc_frame_alloc_fill (port, len); + fp =fc_frame_alloc_fill (dev, len);else - fp =fc_port_frame_alloc (port, len); + fp =_fc_frame_alloc (dev, len);#ifdef FC_FRAME_DEBUG if (fp) fp->fr_stamp = stamp;
@@ -156,8 +157,8 @@ static inline struct fc_frame *fc_frame_alloc_inline(struct fc_port *port,* payload_size + sizeof (struct fc_frame_header). * This version of fc_frame_alloc() stamps the frame to help find leaks. */ -#define fc_frame_alloc (port, len) \ - fc_frame_alloc_inline(port, len, __FUNCTION__) +#define fc_frame_alloc (dev, len) \ + fc_frame_alloc_inline(dev, len, __FUNCTION__)/* * Free the fc_frame structure and buffer. */
drivers/scsi/ofc/libfc/fc_disc_targ.c +2 -2
@@ -340,7 +340,7 @@ static void fcdt_gpn_ft_req(struct fc_local_port *lp) lp->fl_disc_buf_len =0 ; lp->fl_disc_seq_cnt =0 ; - fp =fc_frame_alloc (lp->fl_port,sizeof (*rp)); + fp =fc_frame_alloc (lp->dev,sizeof (*rp));if (fp ==NULL ) { error =ENOMEM ; }else {
@@ -562,7 +562,7 @@ static int fcdt_gpn_id_req(struct fc_local_port *lp, struct fc_remote_port *rp) } *cp;int error; - fp =fc_frame_alloc (lp->fl_port,sizeof (*cp)); + fp =fc_frame_alloc (lp->dev,sizeof (*cp));if (fp ==NULL ) { error =ENOMEM ; }else {
drivers/scsi/ofc/libfc/fc_frame.c +2 -2
@@ -52,7 +52,7 @@ u_int32_t fc_frame_crc_check(struct fc_frame *fp)return (error); } -struct fc_frame *fc_frame_alloc_fill (struct fc_port *port,size_t payload_len) +struct fc_frame *fc_frame_alloc_fill (struct fcdev *dev,size_t payload_len) {struct fc_frame *fp;size_t fill;
@@ -60,7 +60,7 @@ struct fc_frame *fc_frame_alloc_fill(struct fc_port *port, size_t payload_len) fill = payload_len %4 ;if (fill !=0 ) fill =4 - fill; - fp =fc_port_frame_alloc (port, payload_len + fill); + fp =_fc_frame_alloc (dev, payload_len + fill);if (fp) { fp->fr_len -= fill;memset ((char *)fp->fr_hdr + fp->fr_len,0 , fill);
drivers/scsi/ofc/libfc/fc_local_port.c +9 -9
@@ -421,7 +421,7 @@ static void fc_local_port_flogi_send(struct fc_local_port *lp) sp =fc_seq_start_exch (lp->fl_vf->vf_exch_mgr, fc_local_port_flogi_resp, fc_local_port_error, lp,0 ,FC_FID_FLOGI ); - fp =fc_frame_alloc (lp->fl_port,sizeof (*flp)); + fp =fc_frame_alloc (lp->dev,sizeof (*flp));if (fp) { flp =fc_frame_payload_get (fp,sizeof (*flp));fc_local_port_flogi_fill (lp, flp,ELS_FLOGI );
@@ -486,7 +486,7 @@ static void fc_local_port_recv_flogi_req(struct fc_seq *sp_in,fc_local_port_enter_ready (lp); - fp =fc_frame_alloc (lp->fl_port,sizeof (*flp)); + fp =fc_frame_alloc (lp->dev,sizeof (*flp));if (fp) { sp =fc_seq_start_next (rx_fp->fr_seq);fc_seq_set_addr (sp, remote_fid, local_fid);
@@ -657,7 +657,7 @@ static void fc_local_port_enter_reg_pn(struct fc_local_port *lp) } *rp;fc_local_port_enter_state (lp,LOCAL_PORT_ST_REG_PN ); - fp =fc_frame_alloc (lp->fl_port,sizeof (*rp)); + fp =fc_frame_alloc (lp->dev,sizeof (*rp));if (!fp) {fc_local_port_retry (lp);return ;
@@ -718,7 +718,7 @@ static void fc_local_port_enter_reg_ft(struct fc_local_port *lp)if (net32_get (&lps->ff_type_map[i]) !=0 )break ;if (i >=0 ) { - fp =fc_frame_alloc (lp->fl_port,sizeof (*rp)); + fp =fc_frame_alloc (lp->dev,sizeof (*rp));if (fp) { rp =fc_frame_payload_get (fp,sizeof (*rp)); fc_local_port_fill_dns_hdr(lp, &rp->ct,
@@ -750,7 +750,7 @@ static void fc_local_port_enter_scr(struct fc_local_port *lp) sp =fc_seq_start_exch (lp->fl_vf->vf_exch_mgr, fc_local_port_scr_resp, fc_local_port_error, lp, lp->fl_fid,FC_FID_FCTRL ); - fp =fc_frame_alloc (lp->fl_port,sizeof (*scr)); + fp =fc_frame_alloc (lp->dev,sizeof (*scr));if (fp) { scr =fc_frame_payload_get (fp,sizeof (*scr));memset (scr,0 ,sizeof (*scr));
@@ -831,7 +831,7 @@ static void fc_local_port_enter_logo(struct fc_local_port *lp) fc_local_port_logo_resp, fc_local_port_error, lp, lp->fl_fid, FC_FID_FLOGI); - fp =fc_frame_alloc (lp->fl_port,sizeof (*logo)); + fp =fc_frame_alloc (lp->dev,sizeof (*logo));if (fp) { logo =fc_frame_payload_get (fp,sizeof (*logo));memset (logo,0 ,sizeof (*logo));
@@ -1348,7 +1348,7 @@ static void fc_local_port_echo_req(struct fc_seq *sp, struct fc_frame *in_fp,if (len <sizeof (net32_t)) len =sizeof (net32_t); - fp =fc_frame_alloc (lp->fl_port, len); + fp =fc_frame_alloc (lp->dev, len);if (fp) { dp =fc_frame_payload_get (fp, len);memcpy (dp, pp, len);
@@ -1389,7 +1389,7 @@ static void fc_local_port_rnid_req(struct fc_seq *sp, struct fc_frame *in_fp, fmt =ELS_RNIDF_NONE ;/* nothing to provide */ len -=sizeof (rp->gen); } - fp =fc_frame_alloc (lp->fl_port, len); + fp =fc_frame_alloc (lp->dev, len);if (fp) { rp =fc_frame_payload_get (fp, len);memset (rp,0 , len);
@@ -1750,7 +1750,7 @@ static int fc_local_port_send_gid_pn(struct fc_local_port_handle *lp_handle)struct fc_ns_gid_pn pn; } *req; - fp =fc_frame_alloc (lp->fl_port,sizeof (*req)); + fp =fc_frame_alloc (lp->dev,sizeof (*req));if (!fp)return ENOMEM ;
drivers/scsi/ofc/libfc/fc_sess.c +6 -6
@@ -747,7 +747,7 @@ static void fc_sess_enter_plogi(struct fc_sess *sess)fc_sess_state_enter (sess,SESS_ST_PLOGI ); sess->fs_max_payload = sess->fs_local_port->fl_max_payload; - fp =fc_frame_alloc (sess->fs_local_port->fl_port,sizeof (*rp)); + fp =fc_frame_alloc (sess->fs_local_port->dev,sizeof (*rp));if (!fp) {fc_sess_retry (sess);return ;
@@ -830,7 +830,7 @@ static void fc_sess_enter_prli(struct fc_sess *sess)fc_sess_enter_ready (sess);return ; } - fp =fc_frame_alloc (sess->fs_local_port->fl_port,sizeof (*pp)); + fp =fc_frame_alloc (sess->fs_local_port->dev,sizeof (*pp));if (!fp) {fc_sess_retry (sess);return ;
@@ -898,7 +898,7 @@ static void fc_sess_enter_rtv(struct fc_sess *sess)fc_sess_state_enter (sess,SESS_ST_RTV ); - fp =fc_frame_alloc (sess->fs_local_port->fl_port,sizeof (*rtv)); + fp =fc_frame_alloc (sess->fs_local_port->dev,sizeof (*rtv));if (!fp) {fc_sess_retry (sess);return ;
@@ -967,7 +967,7 @@ static void fc_sess_enter_logo(struct fc_sess *sess)fc_sess_state_enter (sess,SESS_ST_LOGO ); lp = sess->fs_local_port; - fp =fc_frame_alloc (lp->fl_port,sizeof (*logo)); + fp =fc_frame_alloc (lp->dev,sizeof (*logo));if (!fp) {fc_sess_retry (sess);return ;
@@ -1190,7 +1190,7 @@ static void fc_sess_recv_plogi_req(struct fc_sess *sess,fc_seq_ls_rjt (sp, reject,ELS_EXPL_NONE );fc_frame_free (fp); }else { - fp =fc_frame_alloc (lp->fl_port,sizeof (*pl)); + fp =fc_frame_alloc (lp->dev,sizeof (*pl));if (fp ==NULL ) { fp = rx_fp;fc_seq_ls_rjt (sp,ELS_RJT_UNAB ,ELS_EXPL_NONE );
@@ -1286,7 +1286,7 @@ static void fc_sess_recv_prli_req(struct fc_sess *sess, rspp = &pp->spp; }if (reason !=ELS_RJT_NONE || - (fp =fc_frame_alloc (lp->fl_port, len)) ==NULL ) { + (fp =fc_frame_alloc (lp->dev, len)) ==NULL ) {fc_seq_ls_rjt (sp, reason, explan); }else { sp =fc_seq_start_next (sp);
drivers/scsi/ofc/openfc/openfc_ioctl.c +2 -2
@@ -360,10 +360,10 @@ static int openfc_ioctl_send_cmd(void __user *_arg)if (cp->ic_resp_len >0xffff )/* arbitrary defensive max */ return -EINVAL ; rc = -ENOMEM ; - fp =fc_frame_alloc (openfcp->fcs_port, len); + fp =fc_frame_alloc (openfcp->dev, len);if (!fp) goto out; - rfp =fc_frame_alloc (openfcp->fcs_port, cp->ic_resp_len); + rfp =fc_frame_alloc (openfcp->dev, cp->ic_resp_len);if (!rfp) goto out; rc = -EFAULT ;
drivers/scsi/ofc/openfc/openfc_scsi.c +4 -5
@@ -302,10 +302,9 @@ static void openfc_scsi_send_data(struct fc_scsi_pkt *fsp, struct fc_seq *sp,if (!fp) { tlen =min (mfs, remaining);if (using_sg) { - fp =fc_port_frame_alloc (openfcp->fcs_port,0 ); + fp =_fc_frame_alloc (openfcp->dev,0 ); }else { - fp =fc_port_frame_alloc (openfcp->fcs_port, - tlen); + fp =_fc_frame_alloc (openfcp->dev, tlen); data = (void *)(fp->fr_hdr +1 ); }BUG_ON (!fp);
@@ -679,7 +678,7 @@ int openfc_scsi_send(struct fcdev *dev, struct fc_scsi_pkt *fsp) rc =-1 ; goto out; }else { - fp =fc_frame_alloc (openfcp->fcs_port,sizeof (fsp->cdb_cmd)); + fp =fc_frame_alloc (openfcp->dev,sizeof (fsp->cdb_cmd));if (fp) {fc_seq_hold (sp); fsp->seq_ptr = sp;
@@ -885,7 +884,7 @@ int openfc_target_reset(struct fcdev *dev, struct fc_scsi_pkt *fsp) openfc_scsi_error, (void *)fsp);if (sp) {fc_seq_hold (sp); - fp =fc_frame_alloc (openfcp->fcs_port,sizeof (fsp->cdb_cmd)); + fp =fc_frame_alloc (openfcp->dev,sizeof (fsp->cdb_cmd));if (fp ==NULL ) {OFC_DBG ("could not allocate frame" );fc_seq_exch_complete (sp);