[openib-general] [PATCH] sysfs: Use enum for PortCounters attribute

Hal Rosenstock halr at voltaire.com
Wed Jul 13 05:07:46 PDT 2005


sysfs: Use enum rather than hardcoded constant for PortCounters
attribute

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: sysfs.c
===================================================================
--- sysfs.c	(revision 2824)
+++ sysfs.c	(working copy)
@@ -2,6 +2,7 @@
  * Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
  * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2005 Voltaire, Inc.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -38,6 +39,13 @@
 
 #include <ib_mad.h>
 
+enum {
+	IB_PERF_MGMT_ATTR_CLASS_PORTINFO	= 0x01,
+	IB_PERF_MGMT_ATTR_PORTSAMPLES_CONTROL	= 0x10,
+	IB_PERF_MGMT_ATTR_PORTSAMPLES_RESULT	= 0x11,
+	IB_PERF_MGMT_ATTR_PORTCOUNTERS		= 0x12,
+};
+
 struct ib_port {
 	struct kobject         kobj;
 	struct ib_device      *ibdev;
@@ -313,7 +321,7 @@
 	in_mad->mad_hdr.mgmt_class    = IB_MGMT_CLASS_PERF_MGMT;
 	in_mad->mad_hdr.class_version = 1;
 	in_mad->mad_hdr.method        = IB_MGMT_METHOD_GET;
-	in_mad->mad_hdr.attr_id       = cpu_to_be16(0x12); /* PortCounters */
+	in_mad->mad_hdr.attr_id       = cpu_to_be16(IB_PERF_MGMT_ATTR_PORTCOUNTERS);
 
 	in_mad->data[41] = p->port_num;	/* PortSelect field */
 






More information about the general mailing list