[ofa-general] Re: [PATCH] infiniband-diags Add support for PortXmitWait counter

Sasha Khapyorsky sashak at voltaire.com
Mon Jan 5 04:34:22 PST 2009


Hi Eli,

On 14:58 Tue 23 Dec     , Eli Dorfman (Voltaire) wrote:
>  Add support for PortXmitWait counter
>  Show PortCounters::PortXmitWait when this capability is supported by the firmware.
>  If not supported show this counter as 0.
> 
> Signed-off-by: Eli Dorfman <elid at voltaire.com>
> ---
>  infiniband-diags/src/perfquery.c  |   10 +++++++++-
>  libibmad/include/infiniband/mad.h |    1 +
>  libibmad/src/fields.c             |    1 +
>  3 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/infiniband-diags/src/perfquery.c b/infiniband-diags/src/perfquery.c
> index 7a53e92..4166fff 100644
> --- a/infiniband-diags/src/perfquery.c
> +++ b/infiniband-diags/src/perfquery.c
> @@ -68,6 +68,7 @@ struct perf_count {
>  	uint32_t rcvdata;
>  	uint32_t xmtpkts;
>  	uint32_t rcvpkts;
> +	uint32_t xmtwait;
>  };
>  
>  struct perf_count_ext {
> @@ -210,6 +211,8 @@ static void aggregate_perfcounters(void)
>  	aggregate_32bit(&perf_count.xmtpkts, val);
>          mad_decode_field(pc, IB_PC_RCV_PKTS_F, &val);
>  	aggregate_32bit(&perf_count.rcvpkts, val);
> +        mad_decode_field(pc, IB_PC_XMT_WAIT_F, &val);
> +	aggregate_32bit(&perf_count.xmtwait, val);
>  }

Should XMT_WAIT support be added to output_aggregate_perfcounters(),
reset and other places too?

>  
>  static void output_aggregate_perfcounters(ib_portid_t *portid)
> @@ -299,9 +302,14 @@ static void dump_perfcounters(int extended, int timeout, uint16_t cap_mask, ib_p
>  	if (extended != 1) {
>  		if (!port_performance_query(pc, portid, port, timeout))
>  			IBERROR("perfquery");
> +		if (!(cap_mask & 0x1000)) {
> +			/* if PortCounters:PortXmitWait not suppported clear this counter */
> +			perf_count.xmtwait = 0;
> +			mad_encode_field(pc, IB_PC_XMT_WAIT_F, &perf_count.xmtwait);
> +		}
>  		if (aggregate)
>  			aggregate_perfcounters();
> -		else
> +		else 
>  			mad_dump_perfcounters(buf, sizeof buf, pc, sizeof pc);
>  	} else {
>  		if (!(cap_mask & 0x200)) /* 1.2 errata: bit 9 is extended counter support */
> diff --git a/libibmad/include/infiniband/mad.h b/libibmad/include/infiniband/mad.h
> index c2ad148..6c313f9 100644
> --- a/libibmad/include/infiniband/mad.h
> +++ b/libibmad/include/infiniband/mad.h
> @@ -413,6 +413,7 @@ enum MAD_FIELDS {
>  	IB_PC_RCV_BYTES_F,
>  	IB_PC_XMT_PKTS_F,
>  	IB_PC_RCV_PKTS_F,
> +	IB_PC_XMT_WAIT_F,
>  	IB_PC_LAST_F,
>  
>  	/*

Basically I'm fine to have two separate patches - one to support
XMT_WAIT in libibmad and another one for perfquery, this is a minor
although.

Sasha

> diff --git a/libibmad/src/fields.c b/libibmad/src/fields.c
> index 6942e85..116e432 100644
> --- a/libibmad/src/fields.c
> +++ b/libibmad/src/fields.c
> @@ -247,6 +247,7 @@ ib_field_t ib_mad_f [] = {
>  	[IB_PC_RCV_BYTES_F] 		{224, 32, "RcvData", mad_dump_uint},
>  	[IB_PC_XMT_PKTS_F] 		{256, 32, "XmtPkts", mad_dump_uint},
>  	[IB_PC_RCV_PKTS_F] 		{288, 32, "RcvPkts", mad_dump_uint},
> +	[IB_PC_XMT_WAIT_F] 		{320, 32, "XmtWait", mad_dump_uint},
>  
>  	/*
>  	 * SMInfo
> -- 
> 1.5.5
> 



More information about the general mailing list