[SCSI] libfc: RNN_ID may be required before RSNN_NN with some switches
[deliverable/linux.git] / include / scsi / fc_encode.h
index 27dad703824f164a442104cc2577ed9dd4cf5a3b..ad13cb1c3eec9ba70c6cce28ec84a098d87357ef 100644 (file)
@@ -128,12 +128,12 @@ static inline int fc_ct_fill(struct fc_lport *lport,
                ct->payload.rft.fts = lport->fcts;
                break;
 
-       case FC_NS_RPN_ID:
+       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,
                       fc_host_port_id(lport->host));
                ct->payload.rft.fts = lport->fcts;
-               put_unaligned_be64(lport->wwpn, &ct->payload.rn.fr_wwn);
+               put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn);
                break;
 
        default:
@@ -198,6 +198,31 @@ static inline void fc_flogi_fill(struct fc_lport *lport, struct fc_frame *fp)
        sp->sp_bb_data = htons((u16) lport->mfs);
        cp = &flogi->fl_cssp[3 - 1];    /* class 3 parameters */
        cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ);
+       if (lport->does_npiv)
+               sp->sp_features = htons(FC_SP_FT_NPIV);
+}
+
+/**
+ * fc_fdisc_fill - Fill in a fdisc request frame.
+ */
+static inline void fc_fdisc_fill(struct fc_lport *lport, struct fc_frame *fp)
+{
+       struct fc_els_csp *sp;
+       struct fc_els_cssp *cp;
+       struct fc_els_flogi *fdisc;
+
+       fdisc = fc_frame_payload_get(fp, sizeof(*fdisc));
+       memset(fdisc, 0, sizeof(*fdisc));
+       fdisc->fl_cmd = (u8) ELS_FDISC;
+       put_unaligned_be64(lport->wwpn, &fdisc->fl_wwpn);
+       put_unaligned_be64(lport->wwnn, &fdisc->fl_wwnn);
+       sp = &fdisc->fl_csp;
+       sp->sp_hi_ver = 0x20;
+       sp->sp_lo_ver = 0x20;
+       sp->sp_bb_cred = htons(10);     /* this gets set by gateway */
+       sp->sp_bb_data = htons((u16) lport->mfs);
+       cp = &fdisc->fl_cssp[3 - 1];    /* class 3 parameters */
+       cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ);
 }
 
 /**
@@ -296,6 +321,10 @@ static inline int fc_els_fill(struct fc_lport *lport,
                fc_flogi_fill(lport, fp);
                break;
 
+       case ELS_FDISC:
+               fc_fdisc_fill(lport, fp);
+               break;
+
        case ELS_LOGO:
                fc_logo_fill(lport, fp);
                break;
This page took 0.031867 seconds and 5 git commands to generate.