diff options
Diffstat (limited to 'drivers/infiniband/hw/qib/qib_mad.c')
-rw-r--r-- | drivers/infiniband/hw/qib/qib_mad.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c index 395f4046dba2..9625e7c438e5 100644 --- a/drivers/infiniband/hw/qib/qib_mad.c +++ b/drivers/infiniband/hw/qib/qib_mad.c | |||
@@ -83,7 +83,8 @@ static void qib_send_trap(struct qib_ibport *ibp, void *data, unsigned len) | |||
83 | return; | 83 | return; |
84 | 84 | ||
85 | send_buf = ib_create_send_mad(agent, 0, 0, 0, IB_MGMT_MAD_HDR, | 85 | send_buf = ib_create_send_mad(agent, 0, 0, 0, IB_MGMT_MAD_HDR, |
86 | IB_MGMT_MAD_DATA, GFP_ATOMIC); | 86 | IB_MGMT_MAD_DATA, GFP_ATOMIC, |
87 | IB_MGMT_BASE_VERSION); | ||
87 | if (IS_ERR(send_buf)) | 88 | if (IS_ERR(send_buf)) |
88 | return; | 89 | return; |
89 | 90 | ||
@@ -1854,7 +1855,7 @@ static int pma_set_portcounters_ext(struct ib_pma_mad *pmp, | |||
1854 | } | 1855 | } |
1855 | 1856 | ||
1856 | static int process_subn(struct ib_device *ibdev, int mad_flags, | 1857 | static int process_subn(struct ib_device *ibdev, int mad_flags, |
1857 | u8 port, struct ib_mad *in_mad, | 1858 | u8 port, const struct ib_mad *in_mad, |
1858 | struct ib_mad *out_mad) | 1859 | struct ib_mad *out_mad) |
1859 | { | 1860 | { |
1860 | struct ib_smp *smp = (struct ib_smp *)out_mad; | 1861 | struct ib_smp *smp = (struct ib_smp *)out_mad; |
@@ -2006,7 +2007,7 @@ bail: | |||
2006 | } | 2007 | } |
2007 | 2008 | ||
2008 | static int process_perf(struct ib_device *ibdev, u8 port, | 2009 | static int process_perf(struct ib_device *ibdev, u8 port, |
2009 | struct ib_mad *in_mad, | 2010 | const struct ib_mad *in_mad, |
2010 | struct ib_mad *out_mad) | 2011 | struct ib_mad *out_mad) |
2011 | { | 2012 | { |
2012 | struct ib_pma_mad *pmp = (struct ib_pma_mad *)out_mad; | 2013 | struct ib_pma_mad *pmp = (struct ib_pma_mad *)out_mad; |
@@ -2299,7 +2300,7 @@ static int check_cc_key(struct qib_ibport *ibp, | |||
2299 | } | 2300 | } |
2300 | 2301 | ||
2301 | static int process_cc(struct ib_device *ibdev, int mad_flags, | 2302 | static int process_cc(struct ib_device *ibdev, int mad_flags, |
2302 | u8 port, struct ib_mad *in_mad, | 2303 | u8 port, const struct ib_mad *in_mad, |
2303 | struct ib_mad *out_mad) | 2304 | struct ib_mad *out_mad) |
2304 | { | 2305 | { |
2305 | struct ib_cc_mad *ccp = (struct ib_cc_mad *)out_mad; | 2306 | struct ib_cc_mad *ccp = (struct ib_cc_mad *)out_mad; |
@@ -2400,12 +2401,20 @@ bail: | |||
2400 | * This is called by the ib_mad module. | 2401 | * This is called by the ib_mad module. |
2401 | */ | 2402 | */ |
2402 | int qib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port, | 2403 | int qib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port, |
2403 | struct ib_wc *in_wc, struct ib_grh *in_grh, | 2404 | const struct ib_wc *in_wc, const struct ib_grh *in_grh, |
2404 | struct ib_mad *in_mad, struct ib_mad *out_mad) | 2405 | const struct ib_mad_hdr *in, size_t in_mad_size, |
2406 | struct ib_mad_hdr *out, size_t *out_mad_size, | ||
2407 | u16 *out_mad_pkey_index) | ||
2405 | { | 2408 | { |
2406 | int ret; | 2409 | int ret; |
2407 | struct qib_ibport *ibp = to_iport(ibdev, port); | 2410 | struct qib_ibport *ibp = to_iport(ibdev, port); |
2408 | struct qib_pportdata *ppd = ppd_from_ibp(ibp); | 2411 | struct qib_pportdata *ppd = ppd_from_ibp(ibp); |
2412 | const struct ib_mad *in_mad = (const struct ib_mad *)in; | ||
2413 | struct ib_mad *out_mad = (struct ib_mad *)out; | ||
2414 | |||
2415 | if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) || | ||
2416 | *out_mad_size != sizeof(*out_mad))) | ||
2417 | return IB_MAD_RESULT_FAILURE; | ||
2409 | 2418 | ||
2410 | switch (in_mad->mad_hdr.mgmt_class) { | 2419 | switch (in_mad->mad_hdr.mgmt_class) { |
2411 | case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE: | 2420 | case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE: |