Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] lpfc 8.3.0 : Add BlockGuard support (T10-DIF) structs and defs

Update struct definitions, #defines, sysfs entries, and initialization
to support BlockGuard.

Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

authored by

James Smart and committed by
James Bottomley
81301a9b 9f1e1b50

+432 -10
+12 -2
drivers/scsi/lpfc/lpfc.h
··· 29 29 #define LPFC_MAX_NS_RETRY 3 /* Number of retry attempts to contact 30 30 the NameServer before giving up. */ 31 31 #define LPFC_CMD_PER_LUN 3 /* max outstanding cmds per lun */ 32 - #define LPFC_DEFAULT_SG_SEG_CNT 64 /* sg element count per scsi cmnd */ 33 - #define LPFC_MAX_SG_SEG_CNT 256 /* sg element count per scsi cmnd */ 32 + #define LPFC_DEFAULT_SG_SEG_CNT 64 /* sg element count per scsi cmnd */ 33 + #define LPFC_DEFAULT_PROT_SG_SEG_CNT 4096 /* sg protection elements count */ 34 + #define LPFC_MAX_SG_SEG_CNT 4096 /* sg element count per scsi cmnd */ 35 + #define LPFC_MAX_PROT_SG_SEG_CNT 4096 /* prot sg element count per scsi cmd*/ 34 36 #define LPFC_IOCB_LIST_CNT 2250 /* list of IOCBs for fast-path usage. */ 35 37 #define LPFC_Q_RAMP_UP_INTERVAL 120 /* lun q_depth ramp up interval */ 36 38 #define LPFC_VNAME_LEN 100 /* vport symbolic name length */ ··· 428 426 #define LPFC_SLI3_VPORT_TEARDOWN 0x04 429 427 #define LPFC_SLI3_CRP_ENABLED 0x08 430 428 #define LPFC_SLI3_INB_ENABLED 0x10 429 + #define LPFC_SLI3_BG_ENABLED 0x20 431 430 uint32_t iocb_cmd_size; 432 431 uint32_t iocb_rsp_size; 433 432 ··· 502 499 uint32_t cfg_poll_tmo; 503 500 uint32_t cfg_use_msi; 504 501 uint32_t cfg_sg_seg_cnt; 502 + uint32_t cfg_prot_sg_seg_cnt; 505 503 uint32_t cfg_sg_dma_buf_size; 506 504 uint64_t cfg_soft_wwnn; 507 505 uint64_t cfg_soft_wwpn; 508 506 uint32_t cfg_hba_queue_depth; 509 507 uint32_t cfg_enable_hba_reset; 510 508 uint32_t cfg_enable_hba_heartbeat; 509 + uint32_t cfg_enable_bg; 511 510 512 511 lpfc_vpd_t vpd; /* vital product data */ 513 512 ··· 575 570 uint64_t fc4InputRequests; 576 571 uint64_t fc4OutputRequests; 577 572 uint64_t fc4ControlRequests; 573 + uint64_t bg_guard_err_cnt; 574 + uint64_t bg_apptag_err_cnt; 575 + uint64_t bg_reftag_err_cnt; 578 576 579 577 struct lpfc_sysfs_mbox sysfs_mbox; 580 578 ··· 627 619 struct dentry *debug_hbqinfo; 628 620 struct dentry *debug_dumpHostSlim; 629 621 struct dentry *debug_dumpHBASlim; 622 + struct dentry *debug_dumpData; /* BlockGuard BPL*/ 623 + struct dentry *debug_dumpDif; /* BlockGuard BPL*/ 630 624 struct dentry *debug_slow_ring_trc; 631 625 struct lpfc_debugfs_trc *slow_ring_trc; 632 626 atomic_t slow_ring_trc_cnt;
+116 -3
drivers/scsi/lpfc/lpfc_attr.c
··· 96 96 return snprintf(buf, PAGE_SIZE, LPFC_MODULE_DESC "\n"); 97 97 } 98 98 99 + static ssize_t 100 + lpfc_bg_info_show(struct device *dev, struct device_attribute *attr, 101 + char *buf) 102 + { 103 + struct Scsi_Host *shost = class_to_shost(dev); 104 + struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 105 + struct lpfc_hba *phba = vport->phba; 106 + 107 + if (phba->cfg_enable_bg) 108 + if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) 109 + return snprintf(buf, PAGE_SIZE, "BlockGuard Enabled\n"); 110 + else 111 + return snprintf(buf, PAGE_SIZE, 112 + "BlockGuard Not Supported\n"); 113 + else 114 + return snprintf(buf, PAGE_SIZE, 115 + "BlockGuard Disabled\n"); 116 + } 117 + 118 + static ssize_t 119 + lpfc_bg_guard_err_show(struct device *dev, struct device_attribute *attr, 120 + char *buf) 121 + { 122 + struct Scsi_Host *shost = class_to_shost(dev); 123 + struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 124 + struct lpfc_hba *phba = vport->phba; 125 + 126 + return snprintf(buf, PAGE_SIZE, "%llu\n", phba->bg_guard_err_cnt); 127 + } 128 + 129 + static ssize_t 130 + lpfc_bg_apptag_err_show(struct device *dev, struct device_attribute *attr, 131 + char *buf) 132 + { 133 + struct Scsi_Host *shost = class_to_shost(dev); 134 + struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 135 + struct lpfc_hba *phba = vport->phba; 136 + 137 + return snprintf(buf, PAGE_SIZE, "%llu\n", phba->bg_apptag_err_cnt); 138 + } 139 + 140 + static ssize_t 141 + lpfc_bg_reftag_err_show(struct device *dev, struct device_attribute *attr, 142 + char *buf) 143 + { 144 + struct Scsi_Host *shost = class_to_shost(dev); 145 + struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 146 + struct lpfc_hba *phba = vport->phba; 147 + 148 + return snprintf(buf, PAGE_SIZE, "%llu\n", phba->bg_reftag_err_cnt); 149 + } 150 + 99 151 /** 100 152 * lpfc_info_show: Return some pci info about the host in ascii. 101 153 * @dev: class converted to a Scsi_host structure. ··· 1537 1485 static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 1538 1486 lpfc_##name##_show, lpfc_##name##_store) 1539 1487 1488 + static DEVICE_ATTR(bg_info, S_IRUGO, lpfc_bg_info_show, NULL); 1489 + static DEVICE_ATTR(bg_guard_err, S_IRUGO, lpfc_bg_guard_err_show, NULL); 1490 + static DEVICE_ATTR(bg_apptag_err, S_IRUGO, lpfc_bg_apptag_err_show, NULL); 1491 + static DEVICE_ATTR(bg_reftag_err, S_IRUGO, lpfc_bg_reftag_err_show, NULL); 1540 1492 static DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); 1541 1493 static DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); 1542 1494 static DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); ··· 2026 1970 # LOG_LINK_EVENT 0x10 Link events 2027 1971 # LOG_FCP 0x40 FCP traffic history 2028 1972 # LOG_NODE 0x80 Node table events 1973 + # LOG_BG 0x200 BlockBuard events 2029 1974 # LOG_MISC 0x400 Miscellaneous events 2030 1975 # LOG_SLI 0x800 SLI events 2031 1976 # LOG_FCP_ERROR 0x1000 Only log FCP errors ··· 2826 2769 LPFC_ATTR_R(enable_hba_heartbeat, 1, 0, 1, "Enable HBA Heartbeat."); 2827 2770 2828 2771 /* 2772 + # lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF) 2773 + # 0 = BlockGuard disabled (default) 2774 + # 1 = BlockGuard enabled 2775 + # Value range is [0,1]. Default value is 0. 2776 + */ 2777 + LPFC_ATTR_R(enable_bg, 0, 0, 1, "Enable BlockGuard Support"); 2778 + 2779 + 2780 + /* 2781 + # lpfc_prot_mask: i 2782 + # - Bit mask of host protection capabilities used to register with the 2783 + # SCSI mid-layer 2784 + # - Only meaningful if BG is turned on (lpfc_enable_bg=1). 2785 + # - Allows you to ultimately specify which profiles to use 2786 + # - Default will result in registering capabilities for all profiles. 2787 + # 2788 + */ 2789 + unsigned int lpfc_prot_mask = SHOST_DIX_TYPE0_PROTECTION; 2790 + 2791 + module_param(lpfc_prot_mask, uint, 0); 2792 + MODULE_PARM_DESC(lpfc_prot_mask, "host protection mask"); 2793 + 2794 + /* 2795 + # lpfc_prot_guard: i 2796 + # - Bit mask of protection guard types to register with the SCSI mid-layer 2797 + # - Guard types are currently either 1) IP checksum 2) T10-DIF CRC 2798 + # - Allows you to ultimately specify which profiles to use 2799 + # - Default will result in registering capabilities for all guard types 2800 + # 2801 + */ 2802 + unsigned char lpfc_prot_guard = SHOST_DIX_GUARD_IP; 2803 + module_param(lpfc_prot_guard, byte, 0); 2804 + MODULE_PARM_DESC(lpfc_prot_guard, "host protection guard type"); 2805 + 2806 + 2807 + /* 2829 2808 * lpfc_sg_seg_cnt: Initial Maximum DMA Segment Count 2830 2809 * This value can be set to values between 64 and 256. The default value is 2831 2810 * 64, but may be increased to allow for larger Max I/O sizes. The scsi layer ··· 2870 2777 LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_DEFAULT_SG_SEG_CNT, 2871 2778 LPFC_MAX_SG_SEG_CNT, "Max Scatter Gather Segment Count"); 2872 2779 2780 + LPFC_ATTR_R(prot_sg_seg_cnt, LPFC_DEFAULT_PROT_SG_SEG_CNT, 2781 + LPFC_DEFAULT_PROT_SG_SEG_CNT, LPFC_MAX_PROT_SG_SEG_CNT, 2782 + "Max Protection Scatter Gather Segment Count"); 2783 + 2873 2784 struct device_attribute *lpfc_hba_attrs[] = { 2785 + &dev_attr_bg_info, 2786 + &dev_attr_bg_guard_err, 2787 + &dev_attr_bg_apptag_err, 2788 + &dev_attr_bg_reftag_err, 2874 2789 &dev_attr_info, 2875 2790 &dev_attr_serialnum, 2876 2791 &dev_attr_modeldesc, ··· 2926 2825 &dev_attr_lpfc_poll, 2927 2826 &dev_attr_lpfc_poll_tmo, 2928 2827 &dev_attr_lpfc_use_msi, 2828 + &dev_attr_lpfc_enable_bg, 2929 2829 &dev_attr_lpfc_soft_wwnn, 2930 2830 &dev_attr_lpfc_soft_wwpn, 2931 2831 &dev_attr_lpfc_soft_wwn_enable, ··· 2935 2833 &dev_attr_lpfc_sg_seg_cnt, 2936 2834 &dev_attr_lpfc_max_scsicmpl_time, 2937 2835 &dev_attr_lpfc_stat_data_ctrl, 2836 + &dev_attr_lpfc_prot_sg_seg_cnt, 2938 2837 NULL, 2939 2838 }; 2940 2839 ··· 4064 3961 lpfc_use_msi_init(phba, lpfc_use_msi); 4065 3962 lpfc_enable_hba_reset_init(phba, lpfc_enable_hba_reset); 4066 3963 lpfc_enable_hba_heartbeat_init(phba, lpfc_enable_hba_heartbeat); 3964 + lpfc_enable_bg_init(phba, lpfc_enable_bg); 4067 3965 phba->cfg_poll = lpfc_poll; 4068 3966 phba->cfg_soft_wwnn = 0L; 4069 3967 phba->cfg_soft_wwpn = 0L; 4070 3968 lpfc_sg_seg_cnt_init(phba, lpfc_sg_seg_cnt); 4071 - /* Also reinitialize the host templates with new values. */ 4072 - lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; 4073 - lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt; 3969 + lpfc_prot_sg_seg_cnt_init(phba, lpfc_prot_sg_seg_cnt); 4074 3970 /* 4075 3971 * Since the sg_tablesize is module parameter, the sg_dma_buf_size 4076 3972 * used to create the sg_dma_buf_pool must be dynamically calculated. ··· 4078 3976 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + 4079 3977 sizeof(struct fcp_rsp) + 4080 3978 ((phba->cfg_sg_seg_cnt + 2) * sizeof(struct ulp_bde64)); 3979 + 3980 + if (phba->cfg_enable_bg) { 3981 + phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT; 3982 + phba->cfg_sg_dma_buf_size += 3983 + phba->cfg_prot_sg_seg_cnt * sizeof(struct ulp_bde64); 3984 + } 3985 + 3986 + /* Also reinitialize the host templates with new values. */ 3987 + lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; 3988 + lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt; 3989 + 4081 3990 lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); 4082 3991 return; 4083 3992 }
+12
drivers/scsi/lpfc/lpfc_crtn.h
··· 285 285 uint32_t, uint32_t); 286 286 extern struct lpfc_hbq_init *lpfc_hbq_defs[]; 287 287 288 + /* externs BlockGuard */ 289 + extern char *_dump_buf_data; 290 + extern unsigned long _dump_buf_data_order; 291 + extern char *_dump_buf_dif; 292 + extern unsigned long _dump_buf_dif_order; 293 + extern spinlock_t _dump_buf_lock; 294 + extern int _dump_buf_done; 295 + extern spinlock_t pgcnt_lock; 296 + extern unsigned int pgcnt; 297 + extern unsigned int lpfc_prot_mask; 298 + extern unsigned char lpfc_prot_guard; 299 + 288 300 /* Interface exported by fabric iocb scheduler */ 289 301 void lpfc_fabric_abort_nport(struct lpfc_nodelist *); 290 302 void lpfc_fabric_abort_hba(struct lpfc_hba *);
+202 -5
drivers/scsi/lpfc/lpfc_hw.h
··· 1544 1544 uint32_t ulpIoTag32; /* Can be used for 32 bit I/O Tag */ 1545 1545 } ULP_BDL; 1546 1546 1547 + /* 1548 + * BlockGuard Definitions 1549 + */ 1550 + 1551 + enum lpfc_protgrp_type { 1552 + LPFC_PG_TYPE_INVALID = 0, /* used to indicate errors */ 1553 + LPFC_PG_TYPE_NO_DIF, /* no DIF data pointed to by prot grp */ 1554 + LPFC_PG_TYPE_EMBD_DIF, /* DIF is embedded (inline) with data */ 1555 + LPFC_PG_TYPE_DIF_BUF /* DIF has its own scatter/gather list */ 1556 + }; 1557 + 1558 + /* PDE Descriptors */ 1559 + #define LPFC_PDE1_DESCRIPTOR 0x81 1560 + #define LPFC_PDE2_DESCRIPTOR 0x82 1561 + #define LPFC_PDE3_DESCRIPTOR 0x83 1562 + 1563 + /* BlockGuard Profiles */ 1564 + enum lpfc_bg_prof_codes { 1565 + LPFC_PROF_INVALID, 1566 + LPFC_PROF_A1 = 128, /* Full Protection */ 1567 + LPFC_PROF_A2, /* Disabled Protection Checks:A2~A4 */ 1568 + LPFC_PROF_A3, 1569 + LPFC_PROF_A4, 1570 + LPFC_PROF_B1, /* Embedded DIFs: B1~B3 */ 1571 + LPFC_PROF_B2, 1572 + LPFC_PROF_B3, 1573 + LPFC_PROF_C1, /* Separate DIFs: C1~C3 */ 1574 + LPFC_PROF_C2, 1575 + LPFC_PROF_C3, 1576 + LPFC_PROF_D1, /* Full Protection */ 1577 + LPFC_PROF_D2, /* Partial Protection & Check Disabling */ 1578 + LPFC_PROF_D3, 1579 + LPFC_PROF_E1, /* E1~E4:out - check-only, in - update apptag */ 1580 + LPFC_PROF_E2, 1581 + LPFC_PROF_E3, 1582 + LPFC_PROF_E4, 1583 + LPFC_PROF_F1, /* Full Translation - F1 Prot Descriptor */ 1584 + /* F1 Translation BDE */ 1585 + LPFC_PROF_ANT1, /* TCP checksum, DIF inline with data buffers */ 1586 + LPFC_PROF_AST1, /* TCP checksum, DIF split from data buffer */ 1587 + LPFC_PROF_ANT2, 1588 + LPFC_PROF_AST2 1589 + }; 1590 + 1591 + /* BlockGuard error-control defines */ 1592 + #define BG_EC_STOP_ERR 0x00 1593 + #define BG_EC_CONT_ERR 0x01 1594 + #define BG_EC_IGN_UNINIT_STOP_ERR 0x10 1595 + #define BG_EC_IGN_UNINIT_CONT_ERR 0x11 1596 + 1597 + /* PDE (Protection Descriptor Entry) word 0 bit masks and shifts */ 1598 + #define PDE_DESC_TYPE_MASK 0xff000000 1599 + #define PDE_DESC_TYPE_SHIFT 24 1600 + #define PDE_BG_PROFILE_MASK 0x00ff0000 1601 + #define PDE_BG_PROFILE_SHIFT 16 1602 + #define PDE_BLOCK_LEN_MASK 0x0000fffc 1603 + #define PDE_BLOCK_LEN_SHIFT 2 1604 + #define PDE_ERR_CTRL_MASK 0x00000003 1605 + #define PDE_ERR_CTRL_SHIFT 0 1606 + /* PDE word 1 bit masks and shifts */ 1607 + #define PDE_APPTAG_MASK_MASK 0xffff0000 1608 + #define PDE_APPTAG_MASK_SHIFT 16 1609 + #define PDE_APPTAG_VAL_MASK 0x0000ffff 1610 + #define PDE_APPTAG_VAL_SHIFT 0 1611 + struct lpfc_pde { 1612 + uint32_t parms; /* bitfields of descriptor, prof, len, and ec */ 1613 + uint32_t apptag; /* bitfields of app tag maskand app tag value */ 1614 + uint32_t reftag; /* reference tag occupying all 32 bits */ 1615 + }; 1616 + 1617 + /* inline function to set fields in parms of PDE */ 1618 + static inline void 1619 + lpfc_pde_set_bg_parms(struct lpfc_pde *p, u8 desc, u8 prof, u16 len, u8 ec) 1620 + { 1621 + uint32_t *wp = &p->parms; 1622 + 1623 + /* spec indicates that adapter appends two 0's to length field */ 1624 + len = len >> 2; 1625 + 1626 + *wp &= 0; 1627 + *wp |= ((desc << PDE_DESC_TYPE_SHIFT) & PDE_DESC_TYPE_MASK); 1628 + *wp |= ((prof << PDE_BG_PROFILE_SHIFT) & PDE_BG_PROFILE_MASK); 1629 + *wp |= ((len << PDE_BLOCK_LEN_SHIFT) & PDE_BLOCK_LEN_MASK); 1630 + *wp |= ((ec << PDE_ERR_CTRL_SHIFT) & PDE_ERR_CTRL_MASK); 1631 + *wp = le32_to_cpu(*wp); 1632 + } 1633 + 1634 + /* inline function to set apptag and reftag fields of PDE */ 1635 + static inline void 1636 + lpfc_pde_set_dif_parms(struct lpfc_pde *p, u16 apptagmask, u16 apptagval, 1637 + u32 reftag) 1638 + { 1639 + uint32_t *wp = &p->apptag; 1640 + *wp &= 0; 1641 + *wp |= ((apptagmask << PDE_APPTAG_MASK_SHIFT) & PDE_APPTAG_MASK_MASK); 1642 + *wp |= ((apptagval << PDE_APPTAG_VAL_SHIFT) & PDE_APPTAG_VAL_MASK); 1643 + *wp = le32_to_cpu(*wp); 1644 + wp = &p->reftag; 1645 + *wp = le32_to_cpu(reftag); 1646 + } 1647 + 1648 + 1547 1649 /* Structure for MB Command LOAD_SM and DOWN_LOAD */ 1548 1650 1549 1651 typedef struct { ··· 2697 2595 #endif 2698 2596 2699 2597 #ifdef __BIG_ENDIAN_BITFIELD 2700 - uint32_t rsvd1 : 24; /* Reserved */ 2701 - uint32_t cmv : 1; /* Configure Max VPIs */ 2598 + uint32_t rsvd1 : 23; /* Reserved */ 2599 + uint32_t cbg : 1; /* Configure BlockGuard */ 2600 + uint32_t cmv : 1; /* Configure Max VPIs */ 2702 2601 uint32_t ccrp : 1; /* Config Command Ring Polling */ 2703 2602 uint32_t csah : 1; /* Configure Synchronous Abort Handling */ 2704 2603 uint32_t chbs : 1; /* Cofigure Host Backing store */ ··· 2716 2613 uint32_t csah : 1; /* Configure Synchronous Abort Handling */ 2717 2614 uint32_t ccrp : 1; /* Config Command Ring Polling */ 2718 2615 uint32_t cmv : 1; /* Configure Max VPIs */ 2719 - uint32_t rsvd1 : 24; /* Reserved */ 2616 + uint32_t cbg : 1; /* Configure BlockGuard */ 2617 + uint32_t rsvd1 : 23; /* Reserved */ 2720 2618 #endif 2721 2619 #ifdef __BIG_ENDIAN_BITFIELD 2722 - uint32_t rsvd2 : 24; /* Reserved */ 2620 + uint32_t rsvd2 : 23; /* Reserved */ 2621 + uint32_t gbg : 1; /* Grant BlockGuard */ 2723 2622 uint32_t gmv : 1; /* Grant Max VPIs */ 2724 2623 uint32_t gcrp : 1; /* Grant Command Ring Polling */ 2725 2624 uint32_t gsah : 1; /* Grant Synchronous Abort Handling */ ··· 2739 2634 uint32_t gsah : 1; /* Grant Synchronous Abort Handling */ 2740 2635 uint32_t gcrp : 1; /* Grant Command Ring Polling */ 2741 2636 uint32_t gmv : 1; /* Grant Max VPIs */ 2742 - uint32_t rsvd2 : 24; /* Reserved */ 2637 + uint32_t gbg : 1; /* Grant BlockGuard */ 2638 + uint32_t rsvd2 : 23; /* Reserved */ 2743 2639 #endif 2744 2640 2745 2641 #ifdef __BIG_ENDIAN_BITFIELD ··· 3360 3254 struct lpfc_hbq_entry buff[5]; 3361 3255 }; 3362 3256 3257 + struct sli3_bg_fields { 3258 + uint32_t filler[6]; /* word 8-13 in IOCB */ 3259 + uint32_t bghm; /* word 14 - BlockGuard High Water Mark */ 3260 + /* Bitfields for bgstat (BlockGuard Status - word 15 of IOCB) */ 3261 + #define BGS_BIDIR_BG_PROF_MASK 0xff000000 3262 + #define BGS_BIDIR_BG_PROF_SHIFT 24 3263 + #define BGS_BIDIR_ERR_COND_FLAGS_MASK 0x003f0000 3264 + #define BGS_BIDIR_ERR_COND_SHIFT 16 3265 + #define BGS_BG_PROFILE_MASK 0x0000ff00 3266 + #define BGS_BG_PROFILE_SHIFT 8 3267 + #define BGS_INVALID_PROF_MASK 0x00000020 3268 + #define BGS_INVALID_PROF_SHIFT 5 3269 + #define BGS_UNINIT_DIF_BLOCK_MASK 0x00000010 3270 + #define BGS_UNINIT_DIF_BLOCK_SHIFT 4 3271 + #define BGS_HI_WATER_MARK_PRESENT_MASK 0x00000008 3272 + #define BGS_HI_WATER_MARK_PRESENT_SHIFT 3 3273 + #define BGS_REFTAG_ERR_MASK 0x00000004 3274 + #define BGS_REFTAG_ERR_SHIFT 2 3275 + #define BGS_APPTAG_ERR_MASK 0x00000002 3276 + #define BGS_APPTAG_ERR_SHIFT 1 3277 + #define BGS_GUARD_ERR_MASK 0x00000001 3278 + #define BGS_GUARD_ERR_SHIFT 0 3279 + uint32_t bgstat; /* word 15 - BlockGuard Status */ 3280 + }; 3281 + 3282 + static inline uint32_t 3283 + lpfc_bgs_get_bidir_bg_prof(uint32_t bgstat) 3284 + { 3285 + return (le32_to_cpu(bgstat) & BGS_BIDIR_BG_PROF_MASK) >> 3286 + BGS_BIDIR_BG_PROF_SHIFT; 3287 + } 3288 + 3289 + static inline uint32_t 3290 + lpfc_bgs_get_bidir_err_cond(uint32_t bgstat) 3291 + { 3292 + return (le32_to_cpu(bgstat) & BGS_BIDIR_ERR_COND_FLAGS_MASK) >> 3293 + BGS_BIDIR_ERR_COND_SHIFT; 3294 + } 3295 + 3296 + static inline uint32_t 3297 + lpfc_bgs_get_bg_prof(uint32_t bgstat) 3298 + { 3299 + return (le32_to_cpu(bgstat) & BGS_BG_PROFILE_MASK) >> 3300 + BGS_BG_PROFILE_SHIFT; 3301 + } 3302 + 3303 + static inline uint32_t 3304 + lpfc_bgs_get_invalid_prof(uint32_t bgstat) 3305 + { 3306 + return (le32_to_cpu(bgstat) & BGS_INVALID_PROF_MASK) >> 3307 + BGS_INVALID_PROF_SHIFT; 3308 + } 3309 + 3310 + static inline uint32_t 3311 + lpfc_bgs_get_uninit_dif_block(uint32_t bgstat) 3312 + { 3313 + return (le32_to_cpu(bgstat) & BGS_UNINIT_DIF_BLOCK_MASK) >> 3314 + BGS_UNINIT_DIF_BLOCK_SHIFT; 3315 + } 3316 + 3317 + static inline uint32_t 3318 + lpfc_bgs_get_hi_water_mark_present(uint32_t bgstat) 3319 + { 3320 + return (le32_to_cpu(bgstat) & BGS_HI_WATER_MARK_PRESENT_MASK) >> 3321 + BGS_HI_WATER_MARK_PRESENT_SHIFT; 3322 + } 3323 + 3324 + static inline uint32_t 3325 + lpfc_bgs_get_reftag_err(uint32_t bgstat) 3326 + { 3327 + return (le32_to_cpu(bgstat) & BGS_REFTAG_ERR_MASK) >> 3328 + BGS_REFTAG_ERR_SHIFT; 3329 + } 3330 + 3331 + static inline uint32_t 3332 + lpfc_bgs_get_apptag_err(uint32_t bgstat) 3333 + { 3334 + return (le32_to_cpu(bgstat) & BGS_APPTAG_ERR_MASK) >> 3335 + BGS_APPTAG_ERR_SHIFT; 3336 + } 3337 + 3338 + static inline uint32_t 3339 + lpfc_bgs_get_guard_err(uint32_t bgstat) 3340 + { 3341 + return (le32_to_cpu(bgstat) & BGS_GUARD_ERR_MASK) >> 3342 + BGS_GUARD_ERR_SHIFT; 3343 + } 3344 + 3363 3345 #define LPFC_EXT_DATA_BDE_COUNT 3 3364 3346 struct fcp_irw_ext { 3365 3347 uint32_t io_tag64_low; ··· 3556 3362 struct que_xri64cx_ext_fields que_xri64cx_ext_words; 3557 3363 struct fcp_irw_ext fcp_ext; 3558 3364 uint32_t sli3Words[24]; /* 96 extra bytes for SLI-3 */ 3365 + 3366 + /* words 8-15 for BlockGuard */ 3367 + struct sli3_bg_fields sli3_bg; 3559 3368 } unsli3; 3560 3369 3561 3370 #define ulpCt_h ulpXS
+89
drivers/scsi/lpfc/lpfc_init.c
··· 45 45 #include "lpfc_vport.h" 46 46 #include "lpfc_version.h" 47 47 48 + char *_dump_buf_data; 49 + unsigned long _dump_buf_data_order; 50 + char *_dump_buf_dif; 51 + unsigned long _dump_buf_dif_order; 52 + spinlock_t _dump_buf_lock; 53 + 48 54 static int lpfc_parse_vpd(struct lpfc_hba *, uint8_t *, int); 49 55 static void lpfc_get_hba_model_desc(struct lpfc_hba *, uint8_t *, uint8_t *); 50 56 static int lpfc_post_rcv_buf(struct lpfc_hba *); ··· 2043 2037 shost->max_lun = vport->cfg_max_luns; 2044 2038 shost->this_id = -1; 2045 2039 shost->max_cmd_len = 16; 2040 + 2046 2041 /* 2047 2042 * Set initial can_queue value since 0 is no longer supported and 2048 2043 * scsi_add_host will fail. This will be adjusted later based on the ··· 2871 2864 * the value of can_queue. 2872 2865 */ 2873 2866 shost->can_queue = phba->cfg_hba_queue_depth - 10; 2867 + if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) { 2868 + 2869 + if (lpfc_prot_mask && lpfc_prot_guard) { 2870 + lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 2871 + "1478 Registering BlockGuard with the " 2872 + "SCSI layer\n"); 2873 + 2874 + scsi_host_set_prot(shost, lpfc_prot_mask); 2875 + scsi_host_set_guard(shost, lpfc_prot_guard); 2876 + } 2877 + } 2878 + 2879 + if (!_dump_buf_data) { 2880 + int pagecnt = 10; 2881 + while (pagecnt) { 2882 + spin_lock_init(&_dump_buf_lock); 2883 + _dump_buf_data = 2884 + (char *) __get_free_pages(GFP_KERNEL, pagecnt); 2885 + if (_dump_buf_data) { 2886 + printk(KERN_ERR "BLKGRD allocated %d pages for " 2887 + "_dump_buf_data at 0x%p\n", 2888 + (1 << pagecnt), _dump_buf_data); 2889 + _dump_buf_data_order = pagecnt; 2890 + memset(_dump_buf_data, 0, ((1 << PAGE_SHIFT) 2891 + << pagecnt)); 2892 + break; 2893 + } else { 2894 + --pagecnt; 2895 + } 2896 + 2897 + } 2898 + 2899 + if (!_dump_buf_data_order) 2900 + printk(KERN_ERR "BLKGRD ERROR unable to allocate " 2901 + "memory for hexdump\n"); 2902 + 2903 + } else { 2904 + printk(KERN_ERR "BLKGRD already allocated _dump_buf_data=0x%p" 2905 + "\n", _dump_buf_data); 2906 + } 2907 + 2908 + 2909 + if (!_dump_buf_dif) { 2910 + int pagecnt = 10; 2911 + while (pagecnt) { 2912 + _dump_buf_dif = 2913 + (char *) __get_free_pages(GFP_KERNEL, pagecnt); 2914 + if (_dump_buf_dif) { 2915 + printk(KERN_ERR "BLKGRD allocated %d pages for " 2916 + "_dump_buf_dif at 0x%p\n", 2917 + (1 << pagecnt), _dump_buf_dif); 2918 + _dump_buf_dif_order = pagecnt; 2919 + memset(_dump_buf_dif, 0, ((1 << PAGE_SHIFT) 2920 + << pagecnt)); 2921 + break; 2922 + } else { 2923 + --pagecnt; 2924 + } 2925 + 2926 + } 2927 + 2928 + if (!_dump_buf_dif_order) 2929 + printk(KERN_ERR "BLKGRD ERROR unable to allocate " 2930 + "memory for hexdump\n"); 2931 + 2932 + } else { 2933 + printk(KERN_ERR "BLKGRD already allocated _dump_buf_dif=0x%p\n", 2934 + _dump_buf_dif); 2935 + } 2874 2936 2875 2937 lpfc_host_attrib_init(shost); 2876 2938 ··· 3484 3408 fc_release_transport(lpfc_transport_template); 3485 3409 if (lpfc_enable_npiv) 3486 3410 fc_release_transport(lpfc_vport_transport_template); 3411 + if (_dump_buf_data) { 3412 + printk(KERN_ERR "BLKGRD freeing %lu pages for _dump_buf_data " 3413 + "at 0x%p\n", 3414 + (1L << _dump_buf_data_order), _dump_buf_data); 3415 + free_pages((unsigned long)_dump_buf_data, _dump_buf_data_order); 3416 + } 3417 + 3418 + if (_dump_buf_dif) { 3419 + printk(KERN_ERR "BLKGRD freeing %lu pages for _dump_buf_dif " 3420 + "at 0x%p\n", 3421 + (1L << _dump_buf_dif_order), _dump_buf_dif); 3422 + free_pages((unsigned long)_dump_buf_dif, _dump_buf_dif_order); 3423 + } 3487 3424 } 3488 3425 3489 3426 module_init(lpfc_init);
+1
drivers/scsi/lpfc/lpfc_logmsg.h
··· 27 27 #define LOG_FCP 0x40 /* FCP traffic history */ 28 28 #define LOG_NODE 0x80 /* Node table events */ 29 29 #define LOG_TEMP 0x100 /* Temperature sensor events */ 30 + #define LOG_BG 0x200 /* BlockBuard events */ 30 31 #define LOG_MISC 0x400 /* Miscellaneous events */ 31 32 #define LOG_SLI 0x800 /* SLI events */ 32 33 #define LOG_FCP_ERROR 0x1000 /* log errors, not underruns */