Commit ca281265 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Doug Ledford

IB/mad: pass ib_mad_send_buf explicitly to the recv_handler

Stop abusing wr_id and just pass the parameter explicitly.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarHal Rosenstock <hal@mellanox.com>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 39f42655
...@@ -3503,6 +3503,7 @@ int ib_cm_notify(struct ib_cm_id *cm_id, enum ib_event_type event) ...@@ -3503,6 +3503,7 @@ int ib_cm_notify(struct ib_cm_id *cm_id, enum ib_event_type event)
EXPORT_SYMBOL(ib_cm_notify); EXPORT_SYMBOL(ib_cm_notify);
static void cm_recv_handler(struct ib_mad_agent *mad_agent, static void cm_recv_handler(struct ib_mad_agent *mad_agent,
struct ib_mad_send_buf *send_buf,
struct ib_mad_recv_wc *mad_recv_wc) struct ib_mad_recv_wc *mad_recv_wc)
{ {
struct cm_port *port = mad_agent->context; struct cm_port *port = mad_agent->context;
......
...@@ -693,7 +693,7 @@ static void snoop_recv(struct ib_mad_qp_info *qp_info, ...@@ -693,7 +693,7 @@ static void snoop_recv(struct ib_mad_qp_info *qp_info,
atomic_inc(&mad_snoop_priv->refcount); atomic_inc(&mad_snoop_priv->refcount);
spin_unlock_irqrestore(&qp_info->snoop_lock, flags); spin_unlock_irqrestore(&qp_info->snoop_lock, flags);
mad_snoop_priv->agent.recv_handler(&mad_snoop_priv->agent, mad_snoop_priv->agent.recv_handler(&mad_snoop_priv->agent, NULL,
mad_recv_wc); mad_recv_wc);
deref_snoop_agent(mad_snoop_priv); deref_snoop_agent(mad_snoop_priv);
spin_lock_irqsave(&qp_info->snoop_lock, flags); spin_lock_irqsave(&qp_info->snoop_lock, flags);
...@@ -1994,9 +1994,9 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, ...@@ -1994,9 +1994,9 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv,
/* user rmpp is in effect /* user rmpp is in effect
* and this is an active RMPP MAD * and this is an active RMPP MAD
*/ */
mad_recv_wc->wc->wr_id = 0; mad_agent_priv->agent.recv_handler(
mad_agent_priv->agent.recv_handler(&mad_agent_priv->agent, &mad_agent_priv->agent, NULL,
mad_recv_wc); mad_recv_wc);
atomic_dec(&mad_agent_priv->refcount); atomic_dec(&mad_agent_priv->refcount);
} else { } else {
/* not user rmpp, revert to normal behavior and /* not user rmpp, revert to normal behavior and
...@@ -2010,9 +2010,10 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, ...@@ -2010,9 +2010,10 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv,
spin_unlock_irqrestore(&mad_agent_priv->lock, flags); spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
/* Defined behavior is to complete response before request */ /* Defined behavior is to complete response before request */
mad_recv_wc->wc->wr_id = (unsigned long) &mad_send_wr->send_buf; mad_agent_priv->agent.recv_handler(
mad_agent_priv->agent.recv_handler(&mad_agent_priv->agent, &mad_agent_priv->agent,
mad_recv_wc); &mad_send_wr->send_buf,
mad_recv_wc);
atomic_dec(&mad_agent_priv->refcount); atomic_dec(&mad_agent_priv->refcount);
mad_send_wc.status = IB_WC_SUCCESS; mad_send_wc.status = IB_WC_SUCCESS;
...@@ -2021,7 +2022,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, ...@@ -2021,7 +2022,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv,
ib_mad_complete_send_wr(mad_send_wr, &mad_send_wc); ib_mad_complete_send_wr(mad_send_wr, &mad_send_wc);
} }
} else { } else {
mad_agent_priv->agent.recv_handler(&mad_agent_priv->agent, mad_agent_priv->agent.recv_handler(&mad_agent_priv->agent, NULL,
mad_recv_wc); mad_recv_wc);
deref_mad_agent(mad_agent_priv); deref_mad_agent(mad_agent_priv);
} }
...@@ -2762,6 +2763,7 @@ static void local_completions(struct work_struct *work) ...@@ -2762,6 +2763,7 @@ static void local_completions(struct work_struct *work)
IB_MAD_SNOOP_RECVS); IB_MAD_SNOOP_RECVS);
recv_mad_agent->agent.recv_handler( recv_mad_agent->agent.recv_handler(
&recv_mad_agent->agent, &recv_mad_agent->agent,
&local->mad_send_wr->send_buf,
&local->mad_priv->header.recv_wc); &local->mad_priv->header.recv_wc);
spin_lock_irqsave(&recv_mad_agent->lock, flags); spin_lock_irqsave(&recv_mad_agent->lock, flags);
atomic_dec(&recv_mad_agent->refcount); atomic_dec(&recv_mad_agent->refcount);
......
...@@ -1669,14 +1669,15 @@ static void send_handler(struct ib_mad_agent *agent, ...@@ -1669,14 +1669,15 @@ static void send_handler(struct ib_mad_agent *agent,
} }
static void recv_handler(struct ib_mad_agent *mad_agent, static void recv_handler(struct ib_mad_agent *mad_agent,
struct ib_mad_send_buf *send_buf,
struct ib_mad_recv_wc *mad_recv_wc) struct ib_mad_recv_wc *mad_recv_wc)
{ {
struct ib_sa_query *query; struct ib_sa_query *query;
struct ib_mad_send_buf *mad_buf;
mad_buf = (void *) (unsigned long) mad_recv_wc->wc->wr_id; if (!send_buf)
query = mad_buf->context[0]; return;
query = send_buf->context[0];
if (query->callback) { if (query->callback) {
if (mad_recv_wc->wc->status == IB_WC_SUCCESS) if (mad_recv_wc->wc->status == IB_WC_SUCCESS)
query->callback(query, query->callback(query,
......
...@@ -210,6 +210,7 @@ static void send_handler(struct ib_mad_agent *agent, ...@@ -210,6 +210,7 @@ static void send_handler(struct ib_mad_agent *agent,
} }
static void recv_handler(struct ib_mad_agent *agent, static void recv_handler(struct ib_mad_agent *agent,
struct ib_mad_send_buf *send_buf,
struct ib_mad_recv_wc *mad_recv_wc) struct ib_mad_recv_wc *mad_recv_wc)
{ {
struct ib_umad_file *file = agent->context; struct ib_umad_file *file = agent->context;
......
...@@ -455,6 +455,7 @@ static void srpt_mad_send_handler(struct ib_mad_agent *mad_agent, ...@@ -455,6 +455,7 @@ static void srpt_mad_send_handler(struct ib_mad_agent *mad_agent,
* srpt_mad_recv_handler() - MAD reception callback function. * srpt_mad_recv_handler() - MAD reception callback function.
*/ */
static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent, static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent,
struct ib_mad_send_buf *send_buf,
struct ib_mad_recv_wc *mad_wc) struct ib_mad_recv_wc *mad_wc)
{ {
struct srpt_port *sport = (struct srpt_port *)mad_agent->context; struct srpt_port *sport = (struct srpt_port *)mad_agent->context;
......
...@@ -438,6 +438,7 @@ typedef void (*ib_mad_snoop_handler)(struct ib_mad_agent *mad_agent, ...@@ -438,6 +438,7 @@ typedef void (*ib_mad_snoop_handler)(struct ib_mad_agent *mad_agent,
/** /**
* ib_mad_recv_handler - callback handler for a received MAD. * ib_mad_recv_handler - callback handler for a received MAD.
* @mad_agent: MAD agent requesting the received MAD. * @mad_agent: MAD agent requesting the received MAD.
* @send_buf: Send buffer if found, else NULL
* @mad_recv_wc: Received work completion information on the received MAD. * @mad_recv_wc: Received work completion information on the received MAD.
* *
* MADs received in response to a send request operation will be handed to * MADs received in response to a send request operation will be handed to
...@@ -447,6 +448,7 @@ typedef void (*ib_mad_snoop_handler)(struct ib_mad_agent *mad_agent, ...@@ -447,6 +448,7 @@ typedef void (*ib_mad_snoop_handler)(struct ib_mad_agent *mad_agent,
* modify the data referenced by @mad_recv_wc. * modify the data referenced by @mad_recv_wc.
*/ */
typedef void (*ib_mad_recv_handler)(struct ib_mad_agent *mad_agent, typedef void (*ib_mad_recv_handler)(struct ib_mad_agent *mad_agent,
struct ib_mad_send_buf *send_buf,
struct ib_mad_recv_wc *mad_recv_wc); struct ib_mad_recv_wc *mad_recv_wc);
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment