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

Ira Weiny weiny2 at llnl.gov
Tue Jun 24 19:22:51 PDT 2008


On Wed, 25 Jun 2008 10:33:13 +1000
Max Matveev <makc at sgi.com> wrote:

> 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.

Good points, v2 is attached.

> 
>  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.

Ah, yes...

Actually...  there is already a portid2str functions...  :-(

I will have to leave this till tomorrow to make sure I don't mess anything else up tonight.

Sorry Sasha,
Ira



More information about the general mailing list