1 /* SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) */
3 * Copyright (c) 2017-2018 Mellanox Technologies. All rights reserved.
6 #ifndef _RDMA_SIGNATURE_H_
7 #define _RDMA_SIGNATURE_H_
9 enum ib_signature_prot_cap {
10 IB_PROT_T10DIF_TYPE_1 = 1,
11 IB_PROT_T10DIF_TYPE_2 = 1 << 1,
12 IB_PROT_T10DIF_TYPE_3 = 1 << 2,
15 enum ib_signature_guard_cap {
16 IB_GUARD_T10DIF_CRC = 1,
17 IB_GUARD_T10DIF_CSUM = 1 << 1,
21 * enum ib_signature_type - Signature types
22 * @IB_SIG_TYPE_NONE: Unprotected.
23 * @IB_SIG_TYPE_T10_DIF: Type T10-DIF
25 enum ib_signature_type {
31 * enum ib_t10_dif_bg_type - Signature T10-DIF block-guard types
32 * @IB_T10DIF_CRC: Corresponds to T10-PI mandated CRC checksum rules.
33 * @IB_T10DIF_CSUM: Corresponds to IP checksum rules.
35 enum ib_t10_dif_bg_type {
41 * struct ib_t10_dif_domain - Parameters specific for T10-DIF
43 * @bg_type: T10-DIF block guard type (CRC|CSUM)
44 * @pi_interval: protection information interval.
45 * @bg: seed of guard computation.
46 * @app_tag: application tag of guard block
47 * @ref_tag: initial guard block reference tag.
48 * @ref_remap: Indicate wethear the reftag increments each block
49 * @app_escape: Indicate to skip block check if apptag=0xffff
50 * @ref_escape: Indicate to skip block check if reftag=0xffffffff
51 * @apptag_check_mask: check bitmask of application tag.
53 struct ib_t10_dif_domain {
54 enum ib_t10_dif_bg_type bg_type;
62 u16 apptag_check_mask;
66 * struct ib_sig_domain - Parameters for signature domain
67 * @sig_type: specific signauture type
68 * @sig: union of all signature domain attributes that may
69 * be used to set domain layout.
71 struct ib_sig_domain {
72 enum ib_signature_type sig_type;
74 struct ib_t10_dif_domain dif;
79 * struct ib_sig_attrs - Parameters for signature handover operation
80 * @check_mask: bitmask for signature byte check (8 bytes)
81 * @mem: memory domain layout descriptor.
82 * @wire: wire domain layout descriptor.
83 * @meta_length: metadata length
87 struct ib_sig_domain mem;
88 struct ib_sig_domain wire;
92 enum ib_sig_err_type {
99 * Signature check masks (8 bytes in total) according to the T10-PI standard:
100 * -------- -------- ------------
101 * | GUARD | APPTAG | REFTAG |
103 * -------- -------- ------------
106 IB_SIG_CHECK_GUARD = 0xc0,
107 IB_SIG_CHECK_APPTAG = 0x30,
108 IB_SIG_CHECK_REFTAG = 0x0f,
112 * struct ib_sig_err - signature error descriptor
115 enum ib_sig_err_type err_type;
122 #endif /* _RDMA_SIGNATURE_H_ */