Skip to content

Commit

Permalink
IB/mthca: Fix MAD extended header format for MAD_IFC firmware command
Browse files Browse the repository at this point in the history
Several fields in an incoming MAD extended info header were passed
into the MAD_IFC firmware command at incorrect offsets (mostly off by
4 bytes).  As the result, the HCA will fail to generate traps in which
this info is needed (e.g. traps which include the GRH of the incoming
packet), in violation of the IB spec.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Michael S. Tsirkin authored and Roland Dreier committed Oct 31, 2006
1 parent 0b26c88 commit 68586b6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions drivers/infiniband/hw/mthca/mthca_cmd.c
Original file line number Diff line number Diff line change
@@ -1820,11 +1820,11 @@ int mthca_MAD_IFC(struct mthca_dev *dev, int ignore_mkey, int ignore_bkey,

#define MAD_IFC_BOX_SIZE 0x400
#define MAD_IFC_MY_QPN_OFFSET 0x100
#define MAD_IFC_RQPN_OFFSET 0x104
#define MAD_IFC_SL_OFFSET 0x108
#define MAD_IFC_G_PATH_OFFSET 0x109
#define MAD_IFC_RLID_OFFSET 0x10a
#define MAD_IFC_PKEY_OFFSET 0x10e
#define MAD_IFC_RQPN_OFFSET 0x108
#define MAD_IFC_SL_OFFSET 0x10c
#define MAD_IFC_G_PATH_OFFSET 0x10d
#define MAD_IFC_RLID_OFFSET 0x10e
#define MAD_IFC_PKEY_OFFSET 0x112
#define MAD_IFC_GRH_OFFSET 0x140

inmailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
@@ -1862,15 +1862,15 @@ int mthca_MAD_IFC(struct mthca_dev *dev, int ignore_mkey, int ignore_bkey,

val = in_wc->dlid_path_bits |
(in_wc->wc_flags & IB_WC_GRH ? 0x80 : 0);
MTHCA_PUT(inbox, val, MAD_IFC_GRH_OFFSET);
MTHCA_PUT(inbox, val, MAD_IFC_G_PATH_OFFSET);

MTHCA_PUT(inbox, in_wc->slid, MAD_IFC_RLID_OFFSET);
MTHCA_PUT(inbox, in_wc->pkey_index, MAD_IFC_PKEY_OFFSET);

if (in_grh)
memcpy(inbox + MAD_IFC_GRH_OFFSET, in_grh, 40);

op_modifier |= 0x10;
op_modifier |= 0x4;

in_modifier |= in_wc->slid << 16;
}

0 comments on commit 68586b6

Please sign in to comment.