[ofa-general] [PATCH 2/2] libibmad: print warning when _do_madrpc fails with destination port information

Max Matveev makc at sgi.com
Tue Jun 24 17:33:13 PDT 2008


On Tue, 24 Jun 2008 14:48:39 -0700, Ira Weiny wrote:

 IW> +		static char gid[256];
 IW> +		static char drpath[256];
 IW> +		inet_ntop(AF_INET6, dport->gid, gid, 256);
 IW> +		drpath2str(&(dport->drpath), drpath, 256);
Couple of nitpicks:

1. you don't need static if all you do is print the strings.
2. longest IPv6 address is is known, so you can declare gid as
           char gid[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"];
3. Use sizeof(str) in the arguments to inet_ntop() and drpath2str.

 IW> +		IBWARN("_do_madrpc failed; dport (lid %d; grh \"%s\"; gid %s; drpath %s)",
 IW> +				dport->lid, dport->grh_present ? "yes":"no",
 IW> +				gid, drpath);
 IW>  		return 0;
 IW> +	}
 
 IW>  	mad = umad_get_mad(rcvbuf);
 
 IW> @@ -223,8 +232,16 @@ mad_rpc_rmpp(void *port_id, ib_rpc_t *rpc, ib_portid_t *dport,
 
 IW> +		static char gid[256];
 IW> +		static char drpath[256];
 IW> +		inet_ntop(AF_INET6, dport->gid, gid, 256);
 IW> +		drpath2str(&(dport->drpath), drpath, 256);
 IW> +		IBWARN("_do_madrpc failed; dport (lid %d; grh \"%s\"; gid %s; drpath %s)",
 IW> +				dport->lid, dport->grh_present ? "yes":"no",
 IW> +				gid, drpath);
 IW>  		return 0;
 IW> +	}
Same as above. In fact, consider factoring that bit out.

max



More information about the general mailing list