t10-pi.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef _LINUX_T10_PI_H
  2. #define _LINUX_T10_PI_H
  3. #include <linux/types.h>
  4. #include <linux/blkdev.h>
  5. /*
  6. * A T10 PI-capable target device can be formatted with different
  7. * protection schemes. Currently 0 through 3 are defined:
  8. *
  9. * Type 0 is regular (unprotected) I/O
  10. *
  11. * Type 1 defines the contents of the guard and reference tags
  12. *
  13. * Type 2 defines the contents of the guard and reference tags and
  14. * uses 32-byte commands to seed the latter
  15. *
  16. * Type 3 defines the contents of the guard tag only
  17. */
  18. enum t10_dif_type {
  19. T10_PI_TYPE0_PROTECTION = 0x0,
  20. T10_PI_TYPE1_PROTECTION = 0x1,
  21. T10_PI_TYPE2_PROTECTION = 0x2,
  22. T10_PI_TYPE3_PROTECTION = 0x3,
  23. };
  24. /*
  25. * T10 Protection Information tuple.
  26. */
  27. struct t10_pi_tuple {
  28. __be16 guard_tag; /* Checksum */
  29. __be16 app_tag; /* Opaque storage */
  30. __be32 ref_tag; /* Target LBA or indirect LBA */
  31. };
  32. extern struct blk_integrity_profile t10_pi_type1_crc;
  33. extern struct blk_integrity_profile t10_pi_type1_ip;
  34. extern struct blk_integrity_profile t10_pi_type3_crc;
  35. extern struct blk_integrity_profile t10_pi_type3_ip;
  36. #endif