diff options
author | James Smart <James.Smart@Emulex.Com> | 2008-12-04 22:39:46 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-12-29 12:24:27 -0500 |
commit | 81301a9b05c3690bf32bf4ef37d941f0f870a7ba (patch) | |
tree | cd4f13d46241e0652a697f057e5accd8df06b9a9 /drivers/scsi/lpfc/lpfc_init.c | |
parent | 9f1e1b50ab43a281dbc75c25f11e1926a9ea367a (diff) |
[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>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 7a216d478a94..4c77038c8f1c 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -45,6 +45,12 @@ | |||
45 | #include "lpfc_vport.h" | 45 | #include "lpfc_vport.h" |
46 | #include "lpfc_version.h" | 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 | static int lpfc_parse_vpd(struct lpfc_hba *, uint8_t *, int); | 54 | static int lpfc_parse_vpd(struct lpfc_hba *, uint8_t *, int); |
49 | static void lpfc_get_hba_model_desc(struct lpfc_hba *, uint8_t *, uint8_t *); | 55 | static void lpfc_get_hba_model_desc(struct lpfc_hba *, uint8_t *, uint8_t *); |
50 | static int lpfc_post_rcv_buf(struct lpfc_hba *); | 56 | static int lpfc_post_rcv_buf(struct lpfc_hba *); |
@@ -2037,6 +2043,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) | |||
2037 | shost->max_lun = vport->cfg_max_luns; | 2043 | shost->max_lun = vport->cfg_max_luns; |
2038 | shost->this_id = -1; | 2044 | shost->this_id = -1; |
2039 | shost->max_cmd_len = 16; | 2045 | shost->max_cmd_len = 16; |
2046 | |||
2040 | /* | 2047 | /* |
2041 | * Set initial can_queue value since 0 is no longer supported and | 2048 | * Set initial can_queue value since 0 is no longer supported and |
2042 | * scsi_add_host will fail. This will be adjusted later based on the | 2049 | * scsi_add_host will fail. This will be adjusted later based on the |
@@ -2864,6 +2871,75 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
2864 | * the value of can_queue. | 2871 | * the value of can_queue. |
2865 | */ | 2872 | */ |
2866 | shost->can_queue = phba->cfg_hba_queue_depth - 10; | 2873 | shost->can_queue = phba->cfg_hba_queue_depth - 10; |
2874 | if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) { | ||
2875 | |||
2876 | if (lpfc_prot_mask && lpfc_prot_guard) { | ||
2877 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | ||
2878 | "1478 Registering BlockGuard with the " | ||
2879 | "SCSI layer\n"); | ||
2880 | |||
2881 | scsi_host_set_prot(shost, lpfc_prot_mask); | ||
2882 | scsi_host_set_guard(shost, lpfc_prot_guard); | ||
2883 | } | ||
2884 | } | ||
2885 | |||
2886 | if (!_dump_buf_data) { | ||
2887 | int pagecnt = 10; | ||
2888 | while (pagecnt) { | ||
2889 | spin_lock_init(&_dump_buf_lock); | ||
2890 | _dump_buf_data = | ||
2891 | (char *) __get_free_pages(GFP_KERNEL, pagecnt); | ||
2892 | if (_dump_buf_data) { | ||
2893 | printk(KERN_ERR "BLKGRD allocated %d pages for " | ||
2894 | "_dump_buf_data at 0x%p\n", | ||
2895 | (1 << pagecnt), _dump_buf_data); | ||
2896 | _dump_buf_data_order = pagecnt; | ||
2897 | memset(_dump_buf_data, 0, ((1 << PAGE_SHIFT) | ||
2898 | << pagecnt)); | ||
2899 | break; | ||
2900 | } else { | ||
2901 | --pagecnt; | ||
2902 | } | ||
2903 | |||
2904 | } | ||
2905 | |||
2906 | if (!_dump_buf_data_order) | ||
2907 | printk(KERN_ERR "BLKGRD ERROR unable to allocate " | ||
2908 | "memory for hexdump\n"); | ||
2909 | |||
2910 | } else { | ||
2911 | printk(KERN_ERR "BLKGRD already allocated _dump_buf_data=0x%p" | ||
2912 | "\n", _dump_buf_data); | ||
2913 | } | ||
2914 | |||
2915 | |||
2916 | if (!_dump_buf_dif) { | ||
2917 | int pagecnt = 10; | ||
2918 | while (pagecnt) { | ||
2919 | _dump_buf_dif = | ||
2920 | (char *) __get_free_pages(GFP_KERNEL, pagecnt); | ||
2921 | if (_dump_buf_dif) { | ||
2922 | printk(KERN_ERR "BLKGRD allocated %d pages for " | ||
2923 | "_dump_buf_dif at 0x%p\n", | ||
2924 | (1 << pagecnt), _dump_buf_dif); | ||
2925 | _dump_buf_dif_order = pagecnt; | ||
2926 | memset(_dump_buf_dif, 0, ((1 << PAGE_SHIFT) | ||
2927 | << pagecnt)); | ||
2928 | break; | ||
2929 | } else { | ||
2930 | --pagecnt; | ||
2931 | } | ||
2932 | |||
2933 | } | ||
2934 | |||
2935 | if (!_dump_buf_dif_order) | ||
2936 | printk(KERN_ERR "BLKGRD ERROR unable to allocate " | ||
2937 | "memory for hexdump\n"); | ||
2938 | |||
2939 | } else { | ||
2940 | printk(KERN_ERR "BLKGRD already allocated _dump_buf_dif=0x%p\n", | ||
2941 | _dump_buf_dif); | ||
2942 | } | ||
2867 | 2943 | ||
2868 | lpfc_host_attrib_init(shost); | 2944 | lpfc_host_attrib_init(shost); |
2869 | 2945 | ||
@@ -3408,6 +3484,19 @@ lpfc_exit(void) | |||
3408 | fc_release_transport(lpfc_transport_template); | 3484 | fc_release_transport(lpfc_transport_template); |
3409 | if (lpfc_enable_npiv) | 3485 | if (lpfc_enable_npiv) |
3410 | fc_release_transport(lpfc_vport_transport_template); | 3486 | fc_release_transport(lpfc_vport_transport_template); |
3487 | if (_dump_buf_data) { | ||
3488 | printk(KERN_ERR "BLKGRD freeing %lu pages for _dump_buf_data " | ||
3489 | "at 0x%p\n", | ||
3490 | (1L << _dump_buf_data_order), _dump_buf_data); | ||
3491 | free_pages((unsigned long)_dump_buf_data, _dump_buf_data_order); | ||
3492 | } | ||
3493 | |||
3494 | if (_dump_buf_dif) { | ||
3495 | printk(KERN_ERR "BLKGRD freeing %lu pages for _dump_buf_dif " | ||
3496 | "at 0x%p\n", | ||
3497 | (1L << _dump_buf_dif_order), _dump_buf_dif); | ||
3498 | free_pages((unsigned long)_dump_buf_dif, _dump_buf_dif_order); | ||
3499 | } | ||
3411 | } | 3500 | } |
3412 | 3501 | ||
3413 | module_init(lpfc_init); | 3502 | module_init(lpfc_init); |