diff options
author | Sagi Grimberg <sagig@mellanox.com> | 2014-08-13 12:54:34 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-10-09 03:10:53 -0400 |
commit | 3d73cf1a2a05cca7b43f7a0c16d1077065b38385 (patch) | |
tree | 0fa8ef3136eb6b736113364bb96cf059a9aa73aa | |
parent | 92792c0a197db85e9d3039b59d2211ed0157e824 (diff) |
Target/iser: Centralize ib_sig_domain setting
Later there will be more parameters to set, so we want to do it in a
centralized place.
This patch does not change any functionality.
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index da8ff124762a..73092756460b 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -2626,41 +2626,40 @@ se2ib_prot_type(enum target_prot_type prot_type) | |||
2626 | } | 2626 | } |
2627 | } | 2627 | } |
2628 | 2628 | ||
2629 | static inline void | ||
2630 | isert_set_dif_domain(struct se_cmd *se_cmd, struct ib_sig_attrs *sig_attrs, | ||
2631 | struct ib_sig_domain *domain) | ||
2632 | { | ||
2633 | enum ib_t10_dif_type ib_prot_type = se2ib_prot_type(se_cmd->prot_type); | ||
2634 | |||
2635 | domain->sig.dif.type = ib_prot_type; | ||
2636 | domain->sig.dif.bg_type = IB_T10DIF_CRC; | ||
2637 | domain->sig.dif.pi_interval = se_cmd->se_dev->dev_attrib.block_size; | ||
2638 | domain->sig.dif.ref_tag = se_cmd->reftag_seed; | ||
2639 | }; | ||
2640 | |||
2629 | static int | 2641 | static int |
2630 | isert_set_sig_attrs(struct se_cmd *se_cmd, struct ib_sig_attrs *sig_attrs) | 2642 | isert_set_sig_attrs(struct se_cmd *se_cmd, struct ib_sig_attrs *sig_attrs) |
2631 | { | 2643 | { |
2632 | enum ib_t10_dif_type ib_prot_type = se2ib_prot_type(se_cmd->prot_type); | ||
2633 | 2644 | ||
2634 | sig_attrs->mem.sig_type = IB_SIG_TYPE_T10_DIF; | 2645 | sig_attrs->mem.sig_type = IB_SIG_TYPE_T10_DIF; |
2635 | sig_attrs->wire.sig_type = IB_SIG_TYPE_T10_DIF; | 2646 | sig_attrs->wire.sig_type = IB_SIG_TYPE_T10_DIF; |
2636 | sig_attrs->mem.sig.dif.pi_interval = | ||
2637 | se_cmd->se_dev->dev_attrib.block_size; | ||
2638 | sig_attrs->wire.sig.dif.pi_interval = | ||
2639 | se_cmd->se_dev->dev_attrib.block_size; | ||
2640 | 2647 | ||
2641 | switch (se_cmd->prot_op) { | 2648 | switch (se_cmd->prot_op) { |
2642 | case TARGET_PROT_DIN_INSERT: | 2649 | case TARGET_PROT_DIN_INSERT: |
2643 | case TARGET_PROT_DOUT_STRIP: | 2650 | case TARGET_PROT_DOUT_STRIP: |
2644 | sig_attrs->mem.sig.dif.type = IB_T10DIF_NONE; | 2651 | sig_attrs->mem.sig.dif.type = IB_T10DIF_NONE; |
2645 | sig_attrs->wire.sig.dif.type = ib_prot_type; | 2652 | isert_set_dif_domain(se_cmd, sig_attrs, &sig_attrs->wire); |
2646 | sig_attrs->wire.sig.dif.bg_type = IB_T10DIF_CRC; | ||
2647 | sig_attrs->wire.sig.dif.ref_tag = se_cmd->reftag_seed; | ||
2648 | break; | 2653 | break; |
2649 | case TARGET_PROT_DOUT_INSERT: | 2654 | case TARGET_PROT_DOUT_INSERT: |
2650 | case TARGET_PROT_DIN_STRIP: | 2655 | case TARGET_PROT_DIN_STRIP: |
2651 | sig_attrs->mem.sig.dif.type = ib_prot_type; | ||
2652 | sig_attrs->mem.sig.dif.bg_type = IB_T10DIF_CRC; | ||
2653 | sig_attrs->mem.sig.dif.ref_tag = se_cmd->reftag_seed; | ||
2654 | sig_attrs->wire.sig.dif.type = IB_T10DIF_NONE; | 2656 | sig_attrs->wire.sig.dif.type = IB_T10DIF_NONE; |
2657 | isert_set_dif_domain(se_cmd, sig_attrs, &sig_attrs->mem); | ||
2655 | break; | 2658 | break; |
2656 | case TARGET_PROT_DIN_PASS: | 2659 | case TARGET_PROT_DIN_PASS: |
2657 | case TARGET_PROT_DOUT_PASS: | 2660 | case TARGET_PROT_DOUT_PASS: |
2658 | sig_attrs->mem.sig.dif.type = ib_prot_type; | 2661 | isert_set_dif_domain(se_cmd, sig_attrs, &sig_attrs->wire); |
2659 | sig_attrs->mem.sig.dif.bg_type = IB_T10DIF_CRC; | 2662 | isert_set_dif_domain(se_cmd, sig_attrs, &sig_attrs->mem); |
2660 | sig_attrs->mem.sig.dif.ref_tag = se_cmd->reftag_seed; | ||
2661 | sig_attrs->wire.sig.dif.type = ib_prot_type; | ||
2662 | sig_attrs->wire.sig.dif.bg_type = IB_T10DIF_CRC; | ||
2663 | sig_attrs->wire.sig.dif.ref_tag = se_cmd->reftag_seed; | ||
2664 | break; | 2663 | break; |
2665 | default: | 2664 | default: |
2666 | pr_err("Unsupported PI operation %d\n", se_cmd->prot_op); | 2665 | pr_err("Unsupported PI operation %d\n", se_cmd->prot_op); |