aboutsummaryrefslogtreecommitdiffstats
path: root/include/rdma/ib_verbs.h
diff options
context:
space:
mode:
authorSagi Grimberg <sagig@mellanox.com>2014-02-23 07:19:05 -0500
committerRoland Dreier <roland@purestorage.com>2014-03-07 14:26:49 -0500
commit1b01d33560e78417334c2dc673bbfac6c644424c (patch)
tree7a68553c5945eccf207cd2f83e5e2278cb49444e /include/rdma/ib_verbs.h
parent17cd3a2db825506c3e3bb9548ad20f67e2f8d0e7 (diff)
IB/core: Introduce signature verbs API
Introduce a verbs interface for signature-related operations. A signature handover operation configures the layouts of data and protection attributes both in memory and wire domains. Signature operations are: - INSERT: Generate and insert protection information when handing over data from input space to output space. - validate and STRIP: Validate protection information and remove it when handing over data from input space to output space. - validate and PASS: Validate protection information and pass it when handing over data from input space to output space. Once the signature handover opration is done, the HCA will offload data integrity generation/validation while performing the actual data transfer. Additions: 1. HCA signature capabilities in device attributes Verbs provider supporting signature handover operations fills relevant fields in device attributes structure returned by ib_query_device. 2. QP creation flag IB_QP_CREATE_SIGNATURE_EN Creating a QP that will carry signature handover operations may require some special preparations from the verbs provider. So we add QP creation flag IB_QP_CREATE_SIGNATURE_EN to declare that the created QP may carry out signature handover operations. Expose signature support to verbs layer (no support for now). 3. New send work request IB_WR_REG_SIG_MR Signature handover work request. This WR will define the signature handover properties of the memory/wire domains as well as the domains layout. The purpose of this work request is to bind all the needed information for the signature operation: - data to be transferred: wr->sg_list (ib_sge). * The raw data, pre-registered to a single MR (normally, before signature, this MR would have been used directly for the data transfer) - data protection guards: sig_handover.prot (ib_sge). * The data protection buffer, pre-registered to a single MR, which contains the data integrity guards of the raw data blocks. Note that it may not always exist, only in cases where the user is interested in storing protection guards in memory. - signature operation attributes: sig_handover.sig_attrs. * Tells the HCA how to validate/generate the protection information. Once the work request is executed, the memory region that will describe the signature transaction will be the sig_mr. The application can now go ahead and send the sig_mr.rkey or use the sig_mr.lkey for data transfer. 4. New Verb ib_check_mr_status check_mr_status verb checks the status of the memory region post transaction. The first check that may be used is IB_MR_CHECK_SIG_STATUS, which will indicate if any signature errors are pending for a specific signature-enabled ib_mr. This verb is a lightwight check and is allowed to be taken from interrupt context. An application must call this verb after it is known that the actual data transfer has finished. Signed-off-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'include/rdma/ib_verbs.h')
-rw-r--r--include/rdma/ib_verbs.h149
1 files changed, 148 insertions, 1 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index cb12e6a4e553..82ab5c1e7605 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -122,7 +122,19 @@ enum ib_device_cap_flags {
122 IB_DEVICE_BLOCK_MULTICAST_LOOPBACK = (1<<22), 122 IB_DEVICE_BLOCK_MULTICAST_LOOPBACK = (1<<22),
123 IB_DEVICE_MEM_WINDOW_TYPE_2A = (1<<23), 123 IB_DEVICE_MEM_WINDOW_TYPE_2A = (1<<23),
124 IB_DEVICE_MEM_WINDOW_TYPE_2B = (1<<24), 124 IB_DEVICE_MEM_WINDOW_TYPE_2B = (1<<24),
125 IB_DEVICE_MANAGED_FLOW_STEERING = (1<<29) 125 IB_DEVICE_MANAGED_FLOW_STEERING = (1<<29),
126 IB_DEVICE_SIGNATURE_HANDOVER = (1<<30)
127};
128
129enum ib_signature_prot_cap {
130 IB_PROT_T10DIF_TYPE_1 = 1,
131 IB_PROT_T10DIF_TYPE_2 = 1 << 1,
132 IB_PROT_T10DIF_TYPE_3 = 1 << 2,
133};
134
135enum ib_signature_guard_cap {
136 IB_GUARD_T10DIF_CRC = 1,
137 IB_GUARD_T10DIF_CSUM = 1 << 1,
126}; 138};
127 139
128enum ib_atomic_cap { 140enum ib_atomic_cap {
@@ -172,6 +184,8 @@ struct ib_device_attr {
172 unsigned int max_fast_reg_page_list_len; 184 unsigned int max_fast_reg_page_list_len;
173 u16 max_pkeys; 185 u16 max_pkeys;
174 u8 local_ca_ack_delay; 186 u8 local_ca_ack_delay;
187 int sig_prot_cap;
188 int sig_guard_cap;
175}; 189};
176 190
177enum ib_mtu { 191enum ib_mtu {
@@ -477,6 +491,114 @@ struct ib_mr_init_attr {
477 u32 flags; 491 u32 flags;
478}; 492};
479 493
494enum ib_signature_type {
495 IB_SIG_TYPE_T10_DIF,
496};
497
498/**
499 * T10-DIF Signature types
500 * T10-DIF types are defined by SCSI
501 * specifications.
502 */
503enum ib_t10_dif_type {
504 IB_T10DIF_NONE,
505 IB_T10DIF_TYPE1,
506 IB_T10DIF_TYPE2,
507 IB_T10DIF_TYPE3
508};
509
510/**
511 * Signature T10-DIF block-guard types
512 * IB_T10DIF_CRC: Corresponds to T10-PI mandated CRC checksum rules.
513 * IB_T10DIF_CSUM: Corresponds to IP checksum rules.
514 */
515enum ib_t10_dif_bg_type {
516 IB_T10DIF_CRC,
517 IB_T10DIF_CSUM
518};
519
520/**
521 * struct ib_t10_dif_domain - Parameters specific for T10-DIF
522 * domain.
523 * @type: T10-DIF type (0|1|2|3)
524 * @bg_type: T10-DIF block guard type (CRC|CSUM)
525 * @pi_interval: protection information interval.
526 * @bg: seed of guard computation.
527 * @app_tag: application tag of guard block
528 * @ref_tag: initial guard block reference tag.
529 * @type3_inc_reftag: T10-DIF type 3 does not state
530 * about the reference tag, it is the user
531 * choice to increment it or not.
532 */
533struct ib_t10_dif_domain {
534 enum ib_t10_dif_type type;
535 enum ib_t10_dif_bg_type bg_type;
536 u16 pi_interval;
537 u16 bg;
538 u16 app_tag;
539 u32 ref_tag;
540 bool type3_inc_reftag;
541};
542
543/**
544 * struct ib_sig_domain - Parameters for signature domain
545 * @sig_type: specific signauture type
546 * @sig: union of all signature domain attributes that may
547 * be used to set domain layout.
548 */
549struct ib_sig_domain {
550 enum ib_signature_type sig_type;
551 union {
552 struct ib_t10_dif_domain dif;
553 } sig;
554};
555
556/**
557 * struct ib_sig_attrs - Parameters for signature handover operation
558 * @check_mask: bitmask for signature byte check (8 bytes)
559 * @mem: memory domain layout desciptor.
560 * @wire: wire domain layout desciptor.
561 */
562struct ib_sig_attrs {
563 u8 check_mask;
564 struct ib_sig_domain mem;
565 struct ib_sig_domain wire;
566};
567
568enum ib_sig_err_type {
569 IB_SIG_BAD_GUARD,
570 IB_SIG_BAD_REFTAG,
571 IB_SIG_BAD_APPTAG,
572};
573
574/**
575 * struct ib_sig_err - signature error descriptor
576 */
577struct ib_sig_err {
578 enum ib_sig_err_type err_type;
579 u32 expected;
580 u32 actual;
581 u64 sig_err_offset;
582 u32 key;
583};
584
585enum ib_mr_status_check {
586 IB_MR_CHECK_SIG_STATUS = 1,
587};
588
589/**
590 * struct ib_mr_status - Memory region status container
591 *
592 * @fail_status: Bitmask of MR checks status. For each
593 * failed check a corresponding status bit is set.
594 * @sig_err: Additional info for IB_MR_CEHCK_SIG_STATUS
595 * failure.
596 */
597struct ib_mr_status {
598 u32 fail_status;
599 struct ib_sig_err sig_err;
600};
601
480/** 602/**
481 * mult_to_ib_rate - Convert a multiple of 2.5 Gbit/sec to an IB rate 603 * mult_to_ib_rate - Convert a multiple of 2.5 Gbit/sec to an IB rate
482 * enum. 604 * enum.
@@ -660,6 +782,7 @@ enum ib_qp_create_flags {
660 IB_QP_CREATE_IPOIB_UD_LSO = 1 << 0, 782 IB_QP_CREATE_IPOIB_UD_LSO = 1 << 0,
661 IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1, 783 IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1,
662 IB_QP_CREATE_NETIF_QP = 1 << 5, 784 IB_QP_CREATE_NETIF_QP = 1 << 5,
785 IB_QP_CREATE_SIGNATURE_EN = 1 << 6,
663 /* reserve bits 26-31 for low level drivers' internal use */ 786 /* reserve bits 26-31 for low level drivers' internal use */
664 IB_QP_CREATE_RESERVED_START = 1 << 26, 787 IB_QP_CREATE_RESERVED_START = 1 << 26,
665 IB_QP_CREATE_RESERVED_END = 1 << 31, 788 IB_QP_CREATE_RESERVED_END = 1 << 31,
@@ -824,6 +947,7 @@ enum ib_wr_opcode {
824 IB_WR_MASKED_ATOMIC_CMP_AND_SWP, 947 IB_WR_MASKED_ATOMIC_CMP_AND_SWP,
825 IB_WR_MASKED_ATOMIC_FETCH_AND_ADD, 948 IB_WR_MASKED_ATOMIC_FETCH_AND_ADD,
826 IB_WR_BIND_MW, 949 IB_WR_BIND_MW,
950 IB_WR_REG_SIG_MR,
827 /* reserve values for low level drivers' internal use. 951 /* reserve values for low level drivers' internal use.
828 * These values will not be used at all in the ib core layer. 952 * These values will not be used at all in the ib core layer.
829 */ 953 */
@@ -929,6 +1053,12 @@ struct ib_send_wr {
929 u32 rkey; 1053 u32 rkey;
930 struct ib_mw_bind_info bind_info; 1054 struct ib_mw_bind_info bind_info;
931 } bind_mw; 1055 } bind_mw;
1056 struct {
1057 struct ib_sig_attrs *sig_attrs;
1058 struct ib_mr *sig_mr;
1059 int access_flags;
1060 struct ib_sge *prot;
1061 } sig_handover;
932 } wr; 1062 } wr;
933 u32 xrc_remote_srq_num; /* XRC TGT QPs only */ 1063 u32 xrc_remote_srq_num; /* XRC TGT QPs only */
934}; 1064};
@@ -1474,6 +1604,8 @@ struct ib_device {
1474 *flow_attr, 1604 *flow_attr,
1475 int domain); 1605 int domain);
1476 int (*destroy_flow)(struct ib_flow *flow_id); 1606 int (*destroy_flow)(struct ib_flow *flow_id);
1607 int (*check_mr_status)(struct ib_mr *mr, u32 check_mask,
1608 struct ib_mr_status *mr_status);
1477 1609
1478 struct ib_dma_mapping_ops *dma_ops; 1610 struct ib_dma_mapping_ops *dma_ops;
1479 1611
@@ -2473,4 +2605,19 @@ static inline int ib_check_mr_access(int flags)
2473 return 0; 2605 return 0;
2474} 2606}
2475 2607
2608/**
2609 * ib_check_mr_status: lightweight check of MR status.
2610 * This routine may provide status checks on a selected
2611 * ib_mr. first use is for signature status check.
2612 *
2613 * @mr: A memory region.
2614 * @check_mask: Bitmask of which checks to perform from
2615 * ib_mr_status_check enumeration.
2616 * @mr_status: The container of relevant status checks.
2617 * failed checks will be indicated in the status bitmask
2618 * and the relevant info shall be in the error item.
2619 */
2620int ib_check_mr_status(struct ib_mr *mr, u32 check_mask,
2621 struct ib_mr_status *mr_status);
2622
2476#endif /* IB_VERBS_H */ 2623#endif /* IB_VERBS_H */