Skip to content

Commit c7f44fb

Browse files
Sagi Grimbergrolandd
authored andcommitted
mlx5_core: Copy DIF fields only when input and output space values match
Some DIF implementations (SCSI initiator/target) may want to use different input/output values for application tag and/or reference tag. So in case memory/wire domain values don't match HW must not copy them. Signed-off-by: Sagi Grimberg <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
1 parent 5c273b1 commit c7f44fb

File tree

1 file changed

+6
-3
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+6
-3
lines changed

drivers/infiniband/hw/mlx5/qp.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,6 +2078,7 @@ static int mlx5_set_bsf(struct ib_mr *sig_mr,
20782078
struct ib_sig_domain *wire = &sig_attrs->wire;
20792079
int ret, selector;
20802080

2081+
memset(bsf, 0, sizeof(*bsf));
20812082
switch (sig_attrs->mem.sig_type) {
20822083
case IB_SIG_TYPE_T10_DIF:
20832084
if (sig_attrs->wire.sig_type != IB_SIG_TYPE_T10_DIF)
@@ -2090,9 +2091,11 @@ static int mlx5_set_bsf(struct ib_mr *sig_mr,
20902091
/* Same block structure */
20912092
basic->bsf_size_sbs = 1 << 4;
20922093
if (mem->sig.dif.bg_type == wire->sig.dif.bg_type)
2093-
basic->wire.copy_byte_mask = 0xff;
2094-
else
2095-
basic->wire.copy_byte_mask = 0x3f;
2094+
basic->wire.copy_byte_mask |= 0xc0;
2095+
if (mem->sig.dif.app_tag == wire->sig.dif.app_tag)
2096+
basic->wire.copy_byte_mask |= 0x30;
2097+
if (mem->sig.dif.ref_tag == wire->sig.dif.ref_tag)
2098+
basic->wire.copy_byte_mask |= 0x0f;
20962099
} else
20972100
basic->wire.bs_selector = bs_selector(wire->sig.dif.pi_interval);
20982101

0 commit comments

Comments
 (0)