[openib-general] [PATCH] fix sparse warnings

Roland Dreier rolandd at cisco.com
Thu Jul 28 11:06:21 PDT 2005


    Sean> I'd like to get a couple of people to test this patch, plus
    Sean> any comments, before committing it.  The majority of the
    Sean> changes are related to MADs and the CM.

This seems to work OK in my very brief testing.  I think at least the
patch below (which includes a real bug fix to mthca_av.c) is needed
for mthca on top of your patch.  Also IPoIB needs some serious
cleanup, which I'll work on.

 - R.

--- infiniband/hw/mthca/mthca_av.c	(revision 2926)
+++ infiniband/hw/mthca/mthca_av.c	(working copy)
@@ -169,7 +169,7 @@ int mthca_read_ah(struct mthca_dev *dev,
 
 	header->lrh.service_level   = be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 28;
 	header->lrh.destination_lid = ah->av->dlid;
-	header->lrh.source_lid      = ah->av->g_slid & 0x7f;
+	header->lrh.source_lid      = cpu_to_be16(ah->av->g_slid & 0x7f);
 	if (ah->av->g_slid & 0x80) {
 		header->grh_present = 1;
 		header->grh.traffic_class =
--- infiniband/hw/mthca/mthca_qp.c	(revision 2926)
+++ infiniband/hw/mthca/mthca_qp.c	(working copy)
@@ -1459,6 +1459,7 @@ static int build_mlx_header(struct mthca
 {
 	int header_size;
 	int err;
+	u16 pkey;
 
 	ib_ud_header_init(256, /* assume a MAD */
 			  sqp->ud_header.grh_present,
@@ -1495,13 +1496,11 @@ static int build_mlx_header(struct mthca
 	sqp->ud_header.bth.solicited_event = !!(wr->send_flags & IB_SEND_SOLICITED);
 	if (!sqp->qp.ibqp.qp_num)
 		ib_get_cached_pkey(&dev->ib_dev, sqp->port,
-				   sqp->pkey_index,
-				   &sqp->ud_header.bth.pkey);
+				   sqp->pkey_index, &pkey);
 	else
 		ib_get_cached_pkey(&dev->ib_dev, sqp->port,
-				   wr->wr.ud.pkey_index,
-				   &sqp->ud_header.bth.pkey);
-	cpu_to_be16s(&sqp->ud_header.bth.pkey);
+				   wr->wr.ud.pkey_index, &pkey);
+	sqp->ud_header.bth.pkey = cpu_to_be16(pkey);
 	sqp->ud_header.bth.destination_qpn = cpu_to_be32(wr->wr.ud.remote_qpn);
 	sqp->ud_header.bth.psn = cpu_to_be32((sqp->send_psn++) & ((1 << 24) - 1));
 	sqp->ud_header.deth.qkey = cpu_to_be32(wr->wr.ud.remote_qkey & 0x80000000 ?



More information about the general mailing list