[openib-general] [PATCH] Reorganize and clean up debug messages in find_mad_agent()

Krishna Kumar krkumar at us.ibm.com
Wed Nov 3 18:23:58 PST 2004


Now messages are printed if either :

1. mad_agent is not found.
2. mad_agent is found but doesn't have a handler.

Printing messages during errors in the process of finding the
mad_agent has been removed.

Thanks,

- KK

On Wed, 3 Nov 2004, Sean Hefty wrote:

> Thanks for the patch.  If you can do something with the printk's, that
> would be good.  They should be KERN_NOTICE, but we may want to consider
> just removing them.

diff -ruNp 5/mad.c 6/mad.c
--- 5/mad.c	2004-11-03 17:56:54.000000000 -0800
+++ 6/mad.c	2004-11-03 18:17:04.000000000 -0800
@@ -752,34 +752,33 @@ find_mad_agent(struct ib_mad_port_privat

 	spin_lock_irqsave(&port_priv->reg_lock, flags);

-	/* Whether MAD was solicited determines type of routing to MAD client */
+	/*
+	 * Whether MAD was solicited determines type of routing to
+	 * MAD client.
+	 */
 	if (solicited) {
 		u32 hi_tid;
 		struct ib_mad_agent_private *entry;

-		/* Routing is based on high 32 bits of transaction ID of MAD  */
+		/*
+		 * Routing is based on high 32 bits of transaction ID
+		 * of MAD.
+		 */
 		hi_tid = be64_to_cpu(mad->mad_hdr.tid) >> 32;
-		list_for_each_entry(entry, &port_priv->agent_list, agent_list) {
+		list_for_each_entry(entry, &port_priv->agent_list,
+				    agent_list) {
 			if (entry->agent.hi_tid == hi_tid) {
 				mad_agent = entry;
 				break;
 			}
 		}
-		if (!mad_agent)
-			printk(KERN_ERR PFX "No client 0x%x for received MAD "
-			       "on port %d\n",
-			       hi_tid, port_priv->port_num);
 	} else {
 		struct ib_mad_mgmt_class_table *version;
 		struct ib_mad_mgmt_method_table *class;

 		/* Routing is based on version, class, and method */
-		if (mad->mad_hdr.class_version >= MAX_MGMT_VERSION) {
-			printk(KERN_ERR PFX "MAD received with unsupported "
-			       "class version %d on port %d\n",
-			       mad->mad_hdr.class_version, port_priv->port_num);
+		if (mad->mad_hdr.class_version >= MAX_MGMT_VERSION)
 			goto out;
-		}
 		version = port_priv->version[mad->mad_hdr.class_version];
 		if (!version)
 			goto out;
@@ -790,18 +789,19 @@ find_mad_agent(struct ib_mad_port_privat
 						 ~IB_MGMT_METHOD_RESP];
 	}

-out:
 	if (mad_agent) {
 		if (mad_agent->agent.recv_handler)
 			atomic_inc(&mad_agent->refcount);
 		else {
-			mad_agent = NULL;
-			printk(KERN_ERR PFX "No receive handler for client "
+			printk(KERN_NOTICE PFX "No receive handler for client "
 			       "%p on port %d\n",
 			       &mad_agent->agent, port_priv->port_num);
+			mad_agent = NULL;
 		}
-	}
-
+	} else
+		printk(KERN_NOTICE PFX "No client for received MAD on "
+		       "port %d\n", port_priv->port_num);
+out:
 	spin_unlock_irqrestore(&port_priv->reg_lock, flags);

 	return mad_agent;




More information about the general mailing list