sd_dif.c (9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e) | sd_dif.c (e9f5f44ad3725335d9c559c3c22cd3726152a7b1) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * sd_dif.c - SCSI Data Integrity Field 4 * 5 * Copyright (C) 2007, 2008 Oracle Corporation 6 * Written by: Martin K. Petersen <martin.petersen@oracle.com> 7 */ 8 --- 33 unchanged lines hidden (view full) --- 42 if (!dix) { 43 blk_integrity_unregister(disk); 44 return; 45 } 46 47 memset(&bi, 0, sizeof(bi)); 48 49 /* Enable DMA of protection information */ | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * sd_dif.c - SCSI Data Integrity Field 4 * 5 * Copyright (C) 2007, 2008 Oracle Corporation 6 * Written by: Martin K. Petersen <martin.petersen@oracle.com> 7 */ 8 --- 33 unchanged lines hidden (view full) --- 42 if (!dix) { 43 blk_integrity_unregister(disk); 44 return; 45 } 46 47 memset(&bi, 0, sizeof(bi)); 48 49 /* Enable DMA of protection information */ |
50 if (scsi_host_get_guard(sdkp->device->host) & SHOST_DIX_GUARD_IP) { 51 if (type == T10_PI_TYPE3_PROTECTION) 52 bi.profile = &t10_pi_type3_ip; 53 else 54 bi.profile = &t10_pi_type1_ip; | 50 if (scsi_host_get_guard(sdkp->device->host) & SHOST_DIX_GUARD_IP) 51 bi.csum_type = BLK_INTEGRITY_CSUM_IP; 52 else 53 bi.csum_type = BLK_INTEGRITY_CSUM_CRC; |
55 | 54 |
56 bi.flags |= BLK_INTEGRITY_IP_CHECKSUM; 57 } else 58 if (type == T10_PI_TYPE3_PROTECTION) 59 bi.profile = &t10_pi_type3_crc; 60 else 61 bi.profile = &t10_pi_type1_crc; | 55 if (type != T10_PI_TYPE3_PROTECTION) 56 bi.flags |= BLK_INTEGRITY_REF_TAG; |
62 63 bi.tuple_size = sizeof(struct t10_pi_tuple); 64 65 if (dif && type) { 66 bi.flags |= BLK_INTEGRITY_DEVICE_CAPABLE; 67 68 if (!sdkp->ATO) 69 goto out; 70 71 if (type == T10_PI_TYPE3_PROTECTION) 72 bi.tag_size = sizeof(u16) + sizeof(u32); 73 else 74 bi.tag_size = sizeof(u16); 75 } 76 77 sd_first_printk(KERN_NOTICE, sdkp, 78 "Enabling DIX %s, application tag size %u bytes\n", | 57 58 bi.tuple_size = sizeof(struct t10_pi_tuple); 59 60 if (dif && type) { 61 bi.flags |= BLK_INTEGRITY_DEVICE_CAPABLE; 62 63 if (!sdkp->ATO) 64 goto out; 65 66 if (type == T10_PI_TYPE3_PROTECTION) 67 bi.tag_size = sizeof(u16) + sizeof(u32); 68 else 69 bi.tag_size = sizeof(u16); 70 } 71 72 sd_first_printk(KERN_NOTICE, sdkp, 73 "Enabling DIX %s, application tag size %u bytes\n", |
79 bi.profile->name, bi.tag_size); | 74 blk_integrity_profile_name(&bi), bi.tag_size); |
80out: 81 blk_integrity_register(disk, &bi); 82} 83 | 75out: 76 blk_integrity_register(disk, &bi); 77} 78 |