]> git.karo-electronics.de Git - linux-beck.git/commitdiff
scsi: lpfc: Make lpfc_prot_xxx params per hba parameters
authorJames Smart <james.smart@broadcom.com>
Thu, 13 Oct 2016 22:06:06 +0000 (15:06 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 8 Nov 2016 22:29:49 +0000 (17:29 -0500)
Make lpfc_prot_mask and lpfc_prot_guard per hba parameters

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc.h
drivers/scsi/lpfc/lpfc_attr.c
drivers/scsi/lpfc/lpfc_crtn.h
drivers/scsi/lpfc/lpfc_init.c

index b484859464f6b2695fe41d24a5cfecf8e8824c49..debba5e77d9cd040390e1c1c146b49878ae081a8 100644 (file)
@@ -746,6 +746,8 @@ struct lpfc_hba {
        uint32_t cfg_oas_priority;
        uint32_t cfg_XLanePriority;
        uint32_t cfg_enable_bg;
+       uint32_t cfg_prot_mask;
+       uint32_t cfg_prot_guard;
        uint32_t cfg_hostmem_hgp;
        uint32_t cfg_log_verbose;
        uint32_t cfg_aer_support;
index f1019908800edd9ae15d10476d6173330c864d30..be81e617b174b038a1b2e9c139e1b8652df9fa51 100644 (file)
@@ -4691,12 +4691,15 @@ unsigned int lpfc_fcp_look_ahead = LPFC_LOOK_AHEAD_OFF;
 #              HBA supports DIX Type 1: Host to HBA  Type 1 protection
 #
 */
-unsigned int lpfc_prot_mask = SHOST_DIF_TYPE1_PROTECTION |
-                             SHOST_DIX_TYPE0_PROTECTION |
-                             SHOST_DIX_TYPE1_PROTECTION;
-
-module_param(lpfc_prot_mask, uint, S_IRUGO);
-MODULE_PARM_DESC(lpfc_prot_mask, "host protection mask");
+LPFC_ATTR(prot_mask,
+       (SHOST_DIF_TYPE1_PROTECTION |
+       SHOST_DIX_TYPE0_PROTECTION |
+       SHOST_DIX_TYPE1_PROTECTION),
+       0,
+       (SHOST_DIF_TYPE1_PROTECTION |
+       SHOST_DIX_TYPE0_PROTECTION |
+       SHOST_DIX_TYPE1_PROTECTION),
+       "T10-DIF host protection capabilities mask");
 
 /*
 # lpfc_prot_guard: i
@@ -4706,9 +4709,9 @@ MODULE_PARM_DESC(lpfc_prot_mask, "host protection mask");
 #      - Default will result in registering capabilities for all guard types
 #
 */
-unsigned char lpfc_prot_guard = SHOST_DIX_GUARD_IP;
-module_param(lpfc_prot_guard, byte, S_IRUGO);
-MODULE_PARM_DESC(lpfc_prot_guard, "host protection guard type");
+LPFC_ATTR(prot_guard,
+       SHOST_DIX_GUARD_IP, SHOST_DIX_GUARD_CRC, SHOST_DIX_GUARD_IP,
+       "T10-DIF host protection guard type");
 
 /*
  * Delay initial NPort discovery when Clean Address bit is cleared in
@@ -5828,6 +5831,8 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
        phba->cfg_oas_flags = 0;
        phba->cfg_oas_priority = 0;
        lpfc_enable_bg_init(phba, lpfc_enable_bg);
+       lpfc_prot_mask_init(phba, lpfc_prot_mask);
+       lpfc_prot_guard_init(phba, lpfc_prot_guard);
        if (phba->sli_rev == LPFC_SLI_REV4)
                phba->cfg_poll = 0;
        else
index bd7576d452f2921152082a267a2938fe6f7f1ae6..16195b73a5368b1bb07c6ebf9a19053ab0978ad2 100644 (file)
@@ -397,8 +397,6 @@ extern spinlock_t _dump_buf_lock;
 extern int _dump_buf_done;
 extern spinlock_t pgcnt_lock;
 extern unsigned int pgcnt;
-extern unsigned int lpfc_prot_mask;
-extern unsigned char lpfc_prot_guard;
 extern unsigned int lpfc_fcp_look_ahead;
 
 /* Interface exported by fabric iocb scheduler */
index af64d708f84f56d9dae6651b258993d89e230c88..117c69a8278607fd13137d0b5f233b1b76a83d20 100644 (file)
@@ -6279,34 +6279,36 @@ lpfc_setup_bg(struct lpfc_hba *phba, struct Scsi_Host *shost)
        uint32_t old_guard;
 
        int pagecnt = 10;
-       if (lpfc_prot_mask && lpfc_prot_guard) {
+       if (phba->cfg_prot_mask && phba->cfg_prot_guard) {
                lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
                                "1478 Registering BlockGuard with the "
                                "SCSI layer\n");
 
-               old_mask = lpfc_prot_mask;
-               old_guard = lpfc_prot_guard;
+               old_mask = phba->cfg_prot_mask;
+               old_guard = phba->cfg_prot_guard;
 
                /* Only allow supported values */
-               lpfc_prot_mask &= (SHOST_DIF_TYPE1_PROTECTION |
+               phba->cfg_prot_mask &= (SHOST_DIF_TYPE1_PROTECTION |
                        SHOST_DIX_TYPE0_PROTECTION |
                        SHOST_DIX_TYPE1_PROTECTION);
-               lpfc_prot_guard &= (SHOST_DIX_GUARD_IP | SHOST_DIX_GUARD_CRC);
+               phba->cfg_prot_guard &= (SHOST_DIX_GUARD_IP |
+                                        SHOST_DIX_GUARD_CRC);
 
                /* DIF Type 1 protection for profiles AST1/C1 is end to end */
-               if (lpfc_prot_mask == SHOST_DIX_TYPE1_PROTECTION)
-                       lpfc_prot_mask |= SHOST_DIF_TYPE1_PROTECTION;
+               if (phba->cfg_prot_mask == SHOST_DIX_TYPE1_PROTECTION)
+                       phba->cfg_prot_mask |= SHOST_DIF_TYPE1_PROTECTION;
 
-               if (lpfc_prot_mask && lpfc_prot_guard) {
-                       if ((old_mask != lpfc_prot_mask) ||
-                               (old_guard != lpfc_prot_guard))
+               if (phba->cfg_prot_mask && phba->cfg_prot_guard) {
+                       if ((old_mask != phba->cfg_prot_mask) ||
+                               (old_guard != phba->cfg_prot_guard))
                                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
                                        "1475 Registering BlockGuard with the "
                                        "SCSI layer: mask %d  guard %d\n",
-                                       lpfc_prot_mask, lpfc_prot_guard);
+                                       phba->cfg_prot_mask,
+                                       phba->cfg_prot_guard);
 
-                       scsi_host_set_prot(shost, lpfc_prot_mask);
-                       scsi_host_set_guard(shost, lpfc_prot_guard);
+                       scsi_host_set_prot(shost, phba->cfg_prot_mask);
+                       scsi_host_set_guard(shost, phba->cfg_prot_guard);
                } else
                        lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
                                "1479 Not Registering BlockGuard with the SCSI "