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 #include <linux/types.h>
11 enum ib_signature_prot_cap {
12 IB_PROT_T10DIF_TYPE_1 = 1,
13 IB_PROT_T10DIF_TYPE_2 = 1 << 1,
14 IB_PROT_T10DIF_TYPE_3 = 1 << 2,
17 enum ib_signature_guard_cap {
18 IB_GUARD_T10DIF_CRC = 1,
19 IB_GUARD_T10DIF_CSUM = 1 << 1,
23 * enum ib_signature_type - Signature types
24 * @IB_SIG_TYPE_NONE: Unprotected.
25 * @IB_SIG_TYPE_T10_DIF: Type T10-DIF
27 enum ib_signature_type {
33 * enum ib_t10_dif_bg_type - Signature T10-DIF block-guard types
34 * @IB_T10DIF_CRC: Corresponds to T10-PI mandated CRC checksum rules.
35 * @IB_T10DIF_CSUM: Corresponds to IP checksum rules.
37 enum ib_t10_dif_bg_type {
43 * struct ib_t10_dif_domain - Parameters specific for T10-DIF
45 * @bg_type: T10-DIF block guard type (CRC|CSUM)
46 * @pi_interval: protection information interval.
47 * @bg: seed of guard computation.
48 * @app_tag: application tag of guard block
49 * @ref_tag: initial guard block reference tag.
50 * @ref_remap: Indicate wethear the reftag increments each block
51 * @app_escape: Indicate to skip block check if apptag=0xffff
52 * @ref_escape: Indicate to skip block check if reftag=0xffffffff
53 * @apptag_check_mask: check bitmask of application tag.
55 struct ib_t10_dif_domain {
56 enum ib_t10_dif_bg_type bg_type;
64 u16 apptag_check_mask;
68 * struct ib_sig_domain - Parameters for signature domain
69 * @sig_type: specific signauture type
70 * @sig: union of all signature domain attributes that may
71 * be used to set domain layout.
73 struct ib_sig_domain {
74 enum ib_signature_type sig_type;
76 struct ib_t10_dif_domain dif;
81 * struct ib_sig_attrs - Parameters for signature handover operation
82 * @check_mask: bitmask for signature byte check (8 bytes)
83 * @mem: memory domain layout descriptor.
84 * @wire: wire domain layout descriptor.
85 * @meta_length: metadata length
89 struct ib_sig_domain mem;
90 struct ib_sig_domain wire;
94 enum ib_sig_err_type {
101 * Signature check masks (8 bytes in total) according to the T10-PI standard:
102 * -------- -------- ------------
103 * | GUARD | APPTAG | REFTAG |
105 * -------- -------- ------------
108 IB_SIG_CHECK_GUARD = 0xc0,
109 IB_SIG_CHECK_APPTAG = 0x30,
110 IB_SIG_CHECK_REFTAG = 0x0f,
114 * struct ib_sig_err - signature error descriptor
117 enum ib_sig_err_type err_type;
124 #endif /* _RDMA_SIGNATURE_H_ */