On Thu, 2014-02-20 at 19:31 +0200, Sagi Grimberg wrote: > Found in 0-day testing. > > sparse: mixing different enum types > sparse warnings: (new ones prefixed by >>) > > >> drivers/infiniband/ulp/isert/ib_isert.c:2481:54: sparse: mixing different enum types > drivers/infiniband/ulp/isert/ib_isert.c:2481:54: int enum target_prot_type versus > drivers/infiniband/ulp/isert/ib_isert.c:2481:54: int enum ib_t10_dif_type > >> drivers/infiniband/ulp/isert/ib_isert.c:2487:53: sparse: mixing different enum types > drivers/infiniband/ulp/isert/ib_isert.c:2487:53: int enum target_prot_type versus > drivers/infiniband/ulp/isert/ib_isert.c:2487:53: int enum ib_t10_dif_type > >> drivers/infiniband/ulp/isert/ib_isert.c:2494:53: sparse: mixing different enum types > drivers/infiniband/ulp/isert/ib_isert.c:2494:53: int enum target_prot_type versus > drivers/infiniband/ulp/isert/ib_isert.c:2494:53: int enum ib_t10_dif_type > >> drivers/infiniband/ulp/isert/ib_isert.c:2497:54: sparse: mixing different enum types > drivers/infiniband/ulp/isert/ib_isert.c:2497:54: int enum target_prot_type versus > drivers/infiniband/ulp/isert/ib_isert.c:2497:54: int enum ib_t10_dif_type > > Signed-off-by: Sagi Grimberg <sagig@xxxxxxxxxxxx> > --- > drivers/infiniband/ulp/isert/ib_isert.c | 27 +++++++++++++++++++++++---- > 1 files changed, 23 insertions(+), 4 deletions(-) > > diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c > index b7c8cd7..2953572 100644 > --- a/drivers/infiniband/ulp/isert/ib_isert.c > +++ b/drivers/infiniband/ulp/isert/ib_isert.c > @@ -2464,9 +2464,28 @@ isert_fast_reg_mr(struct isert_conn *isert_conn, > return ret; > } > > +static inline enum ib_t10_dif_type > +se2ib_prot_type(enum target_prot_type prot_type) > +{ > + switch (prot_type) { > + case TARGET_DIF_TYPE0_PROT: > + return IB_T10DIF_NONE; > + case TARGET_DIF_TYPE1_PROT: > + return IB_T10DIF_TYPE1; > + case TARGET_DIF_TYPE2_PROT: > + return IB_T10DIF_TYPE2; > + case TARGET_DIF_TYPE3_PROT: > + return IB_T10DIF_TYPE3; > + default: > + return IB_T10DIF_NONE; > + } > +} > + > static int > isert_set_sig_attrs(struct se_cmd *se_cmd, struct ib_sig_attrs *sig_attrs) > { > + enum ib_t10_dif_type ib_prot_type = se2ib_prot_type(se_cmd->prot_type); > + > sig_attrs->mem.sig_type = IB_SIG_TYPE_T10_DIF; > sig_attrs->wire.sig_type = IB_SIG_TYPE_T10_DIF; > sig_attrs->mem.sig.dif.pi_interval = > @@ -2478,23 +2497,23 @@ isert_set_sig_attrs(struct se_cmd *se_cmd, struct ib_sig_attrs *sig_attrs) > case TARGET_PROT_DIN_INSERT: > case TARGET_PROT_DOUT_STRIP: > sig_attrs->mem.sig.dif.type = IB_T10DIF_NONE; > - sig_attrs->wire.sig.dif.type = se_cmd->prot_type; > + sig_attrs->wire.sig.dif.type = ib_prot_type; > sig_attrs->wire.sig.dif.bg_type = IB_T10DIF_CRC; > sig_attrs->wire.sig.dif.ref_tag = se_cmd->reftag_seed; > break; > case TARGET_PROT_DOUT_INSERT: > case TARGET_PROT_DIN_STRIP: > - sig_attrs->mem.sig.dif.type = se_cmd->prot_type; > + sig_attrs->mem.sig.dif.type = ib_prot_type; > sig_attrs->mem.sig.dif.bg_type = IB_T10DIF_CRC; > sig_attrs->mem.sig.dif.ref_tag = se_cmd->reftag_seed; > sig_attrs->wire.sig.dif.type = IB_T10DIF_NONE; > break; > case TARGET_PROT_DIN_PASS: > case TARGET_PROT_DOUT_PASS: > - sig_attrs->mem.sig.dif.type = se_cmd->prot_type; > + sig_attrs->mem.sig.dif.type = ib_prot_type; > sig_attrs->mem.sig.dif.bg_type = IB_T10DIF_CRC; > sig_attrs->mem.sig.dif.ref_tag = se_cmd->reftag_seed; > - sig_attrs->wire.sig.dif.type = se_cmd->prot_type; > + sig_attrs->wire.sig.dif.type = ib_prot_type; > sig_attrs->wire.sig.dif.bg_type = IB_T10DIF_CRC; > sig_attrs->wire.sig.dif.ref_tag = se_cmd->reftag_seed; > break; Applied + squashed into commit: IB/isert: Support T10-PI protected transactions --nab -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html