[openib-general] [PATCH] mad: After calling process_mad, handle MAD being consumed

Hal Rosenstock halr at voltaire.com
Wed Nov 10 17:34:18 PST 2004


mad: After calling process_mad, handle MAD being consumed

Index: mad.c
===================================================================
--- mad.c	(revision 1199)
+++ mad.c	(working copy)
@@ -400,16 +400,22 @@
 					    smp->dr_slid, /* ? */
 					    (struct ib_mad *)smp,
 					    (struct ib_mad *)&mad_priv->mad);
-			if ((ret & IB_MAD_RESULT_SUCCESS) &&
-			    (ret & IB_MAD_RESULT_REPLY)) {
-				if (!smi_handle_dr_smp_recv(
+			if (ret & IB_MAD_RESULT_SUCCESS) {
+				if (ret & IB_MAD_RESULT_CONSUMED) {
+					ret = 1;
+					goto error1;
+				}
+				if (ret & IB_MAD_RESULT_REPLY) {
+					if (!smi_handle_dr_smp_recv(
 					    (struct ib_smp *)&mad_priv->mad,
 					    mad_agent->device->node_type,
 					    mad_agent->port_num,
 					    mad_agent->device->phys_port_cnt)) {
-					ret = -EINVAL;
-					kmem_cache_free(ib_mad_cache, mad_priv);
-					goto error1;
+						ret = -EINVAL;
+						kmem_cache_free(ib_mad_cache,
+								mad_priv);
+						goto error1;
+					}
 				}
 			}
 		}
@@ -1147,6 +1153,8 @@
 						     recv->header.recv_buf.mad,
 						     &response->mad.mad);
 		if (ret & IB_MAD_RESULT_SUCCESS) {
+			if (ret & IB_MAD_RESULT_CONSUMED)
+				goto out;
 			if (ret & IB_MAD_RESULT_REPLY) {
 				/* Send response */
 				if (!agent_send(response, &recv->grh, wc,






More information about the general mailing list