core.c (22aaae482044b8bfa11f2c2d5725f4cd1b3064f9) core.c (e9f5f44ad3725335d9c559c3c22cd3726152a7b1)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * NVM Express device driver
4 * Copyright (c) 2011-2014, Intel Corporation.
5 */
6
7#include <linux/blkdev.h>
8#include <linux/blk-mq.h>

--- 1730 unchanged lines hidden (view full) ---

1739 if (!IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) ||
1740 !(head->features & NVME_NS_METADATA_SUPPORTED))
1741 return nvme_ns_has_pi(head);
1742
1743 switch (head->pi_type) {
1744 case NVME_NS_DPS_PI_TYPE3:
1745 switch (head->guard_type) {
1746 case NVME_NVM_NS_16B_GUARD:
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * NVM Express device driver
4 * Copyright (c) 2011-2014, Intel Corporation.
5 */
6
7#include <linux/blkdev.h>
8#include <linux/blk-mq.h>

--- 1730 unchanged lines hidden (view full) ---

1739 if (!IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) ||
1740 !(head->features & NVME_NS_METADATA_SUPPORTED))
1741 return nvme_ns_has_pi(head);
1742
1743 switch (head->pi_type) {
1744 case NVME_NS_DPS_PI_TYPE3:
1745 switch (head->guard_type) {
1746 case NVME_NVM_NS_16B_GUARD:
1747 integrity.profile = &t10_pi_type3_crc;
1747 integrity.csum_type = BLK_INTEGRITY_CSUM_CRC;
1748 integrity.tag_size = sizeof(u16) + sizeof(u32);
1749 integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
1750 break;
1751 case NVME_NVM_NS_64B_GUARD:
1748 integrity.tag_size = sizeof(u16) + sizeof(u32);
1749 integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
1750 break;
1751 case NVME_NVM_NS_64B_GUARD:
1752 integrity.profile = &ext_pi_type3_crc64;
1752 integrity.csum_type = BLK_INTEGRITY_CSUM_CRC64;
1753 integrity.tag_size = sizeof(u16) + 6;
1754 integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
1755 break;
1756 default:
1753 integrity.tag_size = sizeof(u16) + 6;
1754 integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
1755 break;
1756 default:
1757 integrity.profile = NULL;
1758 break;
1759 }
1760 break;
1761 case NVME_NS_DPS_PI_TYPE1:
1762 case NVME_NS_DPS_PI_TYPE2:
1763 switch (head->guard_type) {
1764 case NVME_NVM_NS_16B_GUARD:
1757 break;
1758 }
1759 break;
1760 case NVME_NS_DPS_PI_TYPE1:
1761 case NVME_NS_DPS_PI_TYPE2:
1762 switch (head->guard_type) {
1763 case NVME_NVM_NS_16B_GUARD:
1765 integrity.profile = &t10_pi_type1_crc;
1764 integrity.csum_type = BLK_INTEGRITY_CSUM_CRC;
1766 integrity.tag_size = sizeof(u16);
1765 integrity.tag_size = sizeof(u16);
1767 integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
1766 integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE |
1767 BLK_INTEGRITY_REF_TAG;
1768 break;
1769 case NVME_NVM_NS_64B_GUARD:
1768 break;
1769 case NVME_NVM_NS_64B_GUARD:
1770 integrity.profile = &ext_pi_type1_crc64;
1770 integrity.csum_type = BLK_INTEGRITY_CSUM_CRC64;
1771 integrity.tag_size = sizeof(u16);
1771 integrity.tag_size = sizeof(u16);
1772 integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
1772 integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE |
1773 BLK_INTEGRITY_REF_TAG;
1773 break;
1774 default:
1774 break;
1775 default:
1775 integrity.profile = NULL;
1776 break;
1777 }
1778 break;
1779 default:
1776 break;
1777 }
1778 break;
1779 default:
1780 integrity.profile = NULL;
1781 break;
1782 }
1783
1784 integrity.tuple_size = head->ms;
1785 integrity.pi_offset = head->pi_offset;
1786 blk_integrity_register(disk, &integrity);
1787 return true;
1788}

--- 3179 unchanged lines hidden ---
1780 break;
1781 }
1782
1783 integrity.tuple_size = head->ms;
1784 integrity.pi_offset = head->pi_offset;
1785 blk_integrity_register(disk, &integrity);
1786 return true;
1787}

--- 3179 unchanged lines hidden ---