[openib-general] [PATCH] agent: Change calling argument to agent_mad_send

Hal Rosenstock halr at voltaire.com
Thu Nov 4 07:15:11 PST 2004


agent: Change calling argument to agent_mad_send
Rather than taking a struct ib_mad_recv_wc *, take a struct ib_wc *

Index: agent.c
===================================================================
--- agent.c	(revision 1131)
+++ agent.c	(working copy)
@@ -296,7 +296,7 @@
 static int agent_mad_send(struct ib_mad_agent *mad_agent,
 			  struct ib_mad *mad,
 			  struct ib_grh *grh,
-			  struct ib_mad_recv_wc *mad_recv_wc)
+			  struct ib_wc *wc)
 {
 	struct ib_agent_port_private *port_priv;
 	struct ib_agent_send_wr *agent_send_wr;
@@ -332,17 +332,17 @@
 	send_wr.opcode = IB_WR_SEND;
 	send_wr.sg_list = &gather_list;
 	send_wr.num_sge = 1;
-	send_wr.wr.ud.remote_qpn = mad_recv_wc->wc->src_qp; /* DQPN */
+	send_wr.wr.ud.remote_qpn = wc->src_qp; /* DQPN */
 	send_wr.wr.ud.timeout_ms = 0;
 	send_wr.send_flags = IB_SEND_SIGNALED | IB_SEND_SOLICITED;
 
-	ah_attr.dlid = mad_recv_wc->wc->slid;
+	ah_attr.dlid = wc->slid;
 	ah_attr.port_num = mad_agent->port_num;
-	ah_attr.src_path_bits = mad_recv_wc->wc->dlid_path_bits;
-	ah_attr.sl = mad_recv_wc->wc->sl;
+	ah_attr.src_path_bits = wc->dlid_path_bits;
+	ah_attr.sl = wc->sl;
 	ah_attr.static_rate = 0;
 	if (mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT) {
-		if (mad_recv_wc->wc->wc_flags & IB_WC_GRH) {
+		if (wc->wc_flags & IB_WC_GRH) {
 			ah_attr.ah_flags = IB_AH_GRH;
 			ah_attr.grh.sgid_index = 0; /* Should sgid be looked up
 ? */
@@ -351,7 +351,7 @@
 			ah_attr.grh.traffic_class = (be32_to_cpup(&grh->version_tclass_flow)
>> 20) & 0xff;
 			memcpy(ah_attr.grh.dgid.raw, grh->sgid.raw, sizeof(struct ib_grh));
 		} else {
-			ah_attr.ah_flags = 0; /* No GRH */
+			ah_attr.ah_flags = 0; /* No GRH for SM class */
 		}
 	} else {
 		/* Directed route or LID routed SM class */
@@ -367,7 +367,7 @@
 
 	send_wr.wr.ud.ah = agent_send_wr->ah;
 	if (mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT) {
-		send_wr.wr.ud.pkey_index = mad_recv_wc->wc->pkey_index;
+		send_wr.wr.ud.pkey_index = wc->pkey_index;
 		send_wr.wr.ud.remote_qkey = IB_QP1_QKEY;
 	} else {
 		send_wr.wr.ud.pkey_index = 0; /* Should only matter for GMPs */
@@ -407,7 +407,6 @@
 {
 	struct ib_agent_port_private *port_priv;
 	struct ib_mad_agent *mad_agent;
-	struct ib_mad_recv_wc mad_recv_wc;
 
 	port_priv = ib_get_agent_mad(device, port_num, NULL);
 	if (!port_priv) {
@@ -431,9 +430,7 @@
 			return 1;
 	}
 
-	/* Other fields don't matter so should change signature to just use wc
*/
-	mad_recv_wc.wc = wc;
-	return agent_mad_send(mad_agent, mad, grh, &mad_recv_wc);
+	return agent_mad_send(mad_agent, mad, grh, wc);
 }
 
 static void agent_send_handler(struct ib_mad_agent *mad_agent,






More information about the general mailing list