[ofa-general] [PATCH 1/4] generic libibmad perf query/reset api

Or Gerlitz ogerlitz at voltaire.com
Sun Mar 1 04:39:02 PST 2009


Export generic api to issue query and reset on performance counters, this
will allow for easier integration of more counters (e.g QoS, CCA related).

Signed-off-by: Or Gerlitz <ogerlitz at voltaire.com>

Index: management/libibmad/include/infiniband/mad.h
===================================================================
--- management.orig/libibmad/include/infiniband/mad.h
+++ management/libibmad/include/infiniband/mad.h
@@ -781,43 +781,13 @@ int ib_resolve_self_via(ib_portid_t * po
 			const void *srcport);

 /* gs.c */
-MAD_EXPORT uint8_t *perf_classportinfo_query(void *rcvbuf, ib_portid_t * dest,
-					     int port, unsigned timeout);
-MAD_EXPORT uint8_t *port_performance_query(void *rcvbuf, ib_portid_t * dest,
-					   int port, unsigned timeout);
-MAD_EXPORT uint8_t *port_performance_reset(void *rcvbuf, ib_portid_t * dest,
-					   int port, unsigned mask,
-					   unsigned timeout);
-MAD_EXPORT uint8_t *port_performance_ext_query(void *rcvbuf, ib_portid_t * dest,
-					       int port, unsigned timeout);
-MAD_EXPORT uint8_t *port_performance_ext_reset(void *rcvbuf, ib_portid_t * dest,
-					       int port, unsigned mask,
-					       unsigned timeout);
-MAD_EXPORT uint8_t *port_samples_control_query(void *rcvbuf, ib_portid_t * dest,
-					       int port, unsigned timeout);
-MAD_EXPORT uint8_t *port_samples_result_query(void *rcvbuf, ib_portid_t * dest,
-					      int port, unsigned timeout);
-
-uint8_t *perf_classportinfo_query_via(void *rcvbuf, ib_portid_t * dest,
-				      int port, unsigned timeout,
-				      const void *srcport);
-uint8_t *port_performance_query_via(void *rcvbuf, ib_portid_t * dest, int port,
-				    unsigned timeout, const void *srcport);
-uint8_t *port_performance_reset_via(void *rcvbuf, ib_portid_t * dest, int port,
-				    unsigned mask, unsigned timeout,
-				    const void *srcport);
-uint8_t *port_performance_ext_query_via(void *rcvbuf, ib_portid_t * dest,
-					int port, unsigned timeout,
-					const void *srcport);
-uint8_t *port_performance_ext_reset_via(void *rcvbuf, ib_portid_t * dest,
-					int port, unsigned mask,
-					unsigned timeout, const void *srcport);
-uint8_t *port_samples_control_query_via(void *rcvbuf, ib_portid_t * dest,
-					int port, unsigned timeout,
-					const void *srcport);
-uint8_t *port_samples_result_query_via(void *rcvbuf, ib_portid_t * dest,
-				       int port, unsigned timeout,
-				       const void *srcport);
+MAD_EXPORT uint8_t *pma_query_via(void *rcvbuf, ib_portid_t * dest, int port,
+			      unsigned timeout, unsigned id,
+			      const void *srcport);
+
+MAD_EXPORT uint8_t *performance_reset_via(void *rcvbuf, ib_portid_t * dest,
+				      int port, unsigned mask, unsigned timeout,
+				      unsigned id, const void *srcport);
 /* dump.c */
 MAD_EXPORT ib_mad_dump_fn
     mad_dump_int, mad_dump_uint, mad_dump_hex, mad_dump_rhex,
Index: management/libibmad/src/gs.c
===================================================================
--- management.orig/libibmad/src/gs.c
+++ management/libibmad/src/gs.c
@@ -45,9 +45,9 @@
 #undef DEBUG
 #define DEBUG 	if (ibdebug)	IBWARN

-static uint8_t *pma_query_via(void *rcvbuf, ib_portid_t * dest, int port,
-			      unsigned timeout, unsigned id,
-			      const void *srcport)
+uint8_t *pma_query_via(void *rcvbuf, ib_portid_t * dest, int port,
+		      unsigned timeout, unsigned id,
+		      const void *srcport)
 {
 	ib_rpc_t rpc = { 0 };
 	int lid = dest->lid;
@@ -81,42 +81,9 @@ static uint8_t *pma_query_via(void *rcvb
 	}
 }

-uint8_t *pma_query(void *rcvbuf, ib_portid_t * dest, int port, unsigned timeout,
-		   unsigned id)
-{
-	return pma_query_via(rcvbuf, dest, port, timeout, id, NULL);
-}
-
-uint8_t *perf_classportinfo_query_via(void *rcvbuf, ib_portid_t * dest,
-				      int port, unsigned timeout,
-				      const void *srcport)
-{
-	return pma_query_via(rcvbuf, dest, port, timeout, CLASS_PORT_INFO,
-			     srcport);
-}
-
-uint8_t *perf_classportinfo_query(void *rcvbuf, ib_portid_t * dest, int port,
-				  unsigned timeout)
-{
-	return pma_query(rcvbuf, dest, port, timeout, CLASS_PORT_INFO);
-}
-
-uint8_t *port_performance_query_via(void *rcvbuf, ib_portid_t * dest, int port,
-				    unsigned timeout, const void *srcport)
-{
-	return pma_query_via(rcvbuf, dest, port, timeout,
-			     IB_GSI_PORT_COUNTERS, srcport);
-}
-
-uint8_t *port_performance_query(void *rcvbuf, ib_portid_t * dest, int port,
-				unsigned timeout)
-{
-	return pma_query(rcvbuf, dest, port, timeout, IB_GSI_PORT_COUNTERS);
-}
-
-static uint8_t *performance_reset_via(void *rcvbuf, ib_portid_t * dest,
-				      int port, unsigned mask, unsigned timeout,
-				      unsigned id, const void *srcport)
+uint8_t *performance_reset_via(void *rcvbuf, ib_portid_t * dest,
+			      int port, unsigned mask, unsigned timeout,
+			      unsigned id, const void *srcport)
 {
 	ib_rpc_t rpc = { 0 };
 	int lid = dest->lid;
@@ -156,84 +123,3 @@ static uint8_t *performance_reset_via(vo
 		return madrpc(&rpc, dest, rcvbuf, rcvbuf);
 	}
 }
-
-static uint8_t *performance_reset(void *rcvbuf, ib_portid_t * dest, int port,
-				  unsigned mask, unsigned timeout, unsigned id)
-{
-	return performance_reset_via(rcvbuf, dest, port, mask, timeout,
-				     id, NULL);
-}
-
-uint8_t *port_performance_reset_via(void *rcvbuf, ib_portid_t * dest, int port,
-				    unsigned mask, unsigned timeout,
-				    const void *srcport)
-{
-	return performance_reset_via(rcvbuf, dest, port, mask, timeout,
-				     IB_GSI_PORT_COUNTERS, srcport);
-}
-
-uint8_t *port_performance_reset(void *rcvbuf, ib_portid_t * dest, int port,
-				unsigned mask, unsigned timeout)
-{
-	return performance_reset(rcvbuf, dest, port, mask, timeout,
-				 IB_GSI_PORT_COUNTERS);
-}
-
-uint8_t *port_performance_ext_query_via(void *rcvbuf, ib_portid_t * dest,
-					int port, unsigned timeout,
-					const void *srcport)
-{
-	return pma_query_via(rcvbuf, dest, port, timeout,
-			     IB_GSI_PORT_COUNTERS_EXT, srcport);
-}
-
-uint8_t *port_performance_ext_query(void *rcvbuf, ib_portid_t * dest, int port,
-				    unsigned timeout)
-{
-	return pma_query(rcvbuf, dest, port, timeout, IB_GSI_PORT_COUNTERS_EXT);
-}
-
-uint8_t *port_performance_ext_reset_via(void *rcvbuf, ib_portid_t * dest,
-					int port, unsigned mask,
-					unsigned timeout, const void *srcport)
-{
-	return performance_reset_via(rcvbuf, dest, port, mask, timeout,
-				     IB_GSI_PORT_COUNTERS_EXT, srcport);
-}
-
-uint8_t *port_performance_ext_reset(void *rcvbuf, ib_portid_t * dest, int port,
-				    unsigned mask, unsigned timeout)
-{
-	return performance_reset(rcvbuf, dest, port, mask, timeout,
-				 IB_GSI_PORT_COUNTERS_EXT);
-}
-
-uint8_t *port_samples_control_query_via(void *rcvbuf, ib_portid_t * dest,
-					int port, unsigned timeout,
-					const void *srcport)
-{
-	return pma_query_via(rcvbuf, dest, port, timeout,
-			     IB_GSI_PORT_SAMPLES_CONTROL, srcport);
-}
-
-uint8_t *port_samples_control_query(void *rcvbuf, ib_portid_t * dest, int port,
-				    unsigned timeout)
-{
-	return pma_query(rcvbuf, dest, port, timeout,
-			 IB_GSI_PORT_SAMPLES_CONTROL);
-}
-
-uint8_t *port_samples_result_query_via(void *rcvbuf, ib_portid_t * dest,
-				       int port, unsigned timeout,
-				       const void *srcport)
-{
-	return pma_query_via(rcvbuf, dest, port, timeout,
-			     IB_GSI_PORT_SAMPLES_RESULT, srcport);
-}
-
-uint8_t *port_samples_result_query(void *rcvbuf, ib_portid_t * dest, int port,
-				   unsigned timeout)
-{
-	return pma_query(rcvbuf, dest, port, timeout,
-			 IB_GSI_PORT_SAMPLES_RESULT);
-}
Index: management/libibmad/src/libibmad.map
===================================================================
--- management.orig/libibmad/src/libibmad.map
+++ management/libibmad/src/libibmad.map
@@ -40,13 +40,8 @@ IBMAD_1.3 {
 		mad_set_field64;
 		mad_get_array;
 		mad_set_array;
-		perf_classportinfo_query;
-		port_performance_query;
-		port_performance_reset;
-		port_performance_ext_query;
-		port_performance_ext_reset;
-		port_samples_control_query;
-		port_samples_result_query;
+		pma_query_via;
+		performance_reset_via;
 		mad_build_pkt;
 		mad_decode_field;
 		mad_encode;
@@ -97,11 +92,5 @@ IBMAD_1.3 {
 		ib_resolve_portid_str_via;
 		ib_resolve_self_via;
 		perf_classportinfo_query_via;
-		port_performance_query_via;
-		port_performance_reset_via;
-		port_performance_ext_query_via;
-		port_performance_ext_reset_via;
-		port_samples_control_query_via;
-		port_samples_result_query_via;
 	local: *;
 };



More information about the general mailing list