[openib-general] modify_device API?

Sean Hefty mshefty at ichips.intel.com
Mon Aug 16 12:23:10 PDT 2004


On Mon, 16 Aug 2004 09:07:53 -0700
Sean Hefty <mshefty at ichips.intel.com> wrote:

> > Next, the API
> > 
> > 	int ib_modify_device(struct ib_device *device,
> > 			     u8 port_num,
> > 			     int device_attr_flags);
> > 
> > seems to leave out the actual properties structure.
> > 
> > One last minor question: system image GUID is really per-device (since
> > it's in NodeInfo, not PortInfo), so requiring a port number to set it
> > seems a little unclean.  Is it worth creating a new entry point for
> > setting system image GUID (and any other per-device settings we want)?
> 
> If you have a proposal for an alternate API, please let me know.  Otherwise, I will take some time and examine some of the other code and try to pull something together.  I like the idea of having two calls, modify_port and modify_device/node.

Here's an initial attempt at fixing the ib_modify_device routine.  I split the call into two calls: ib_modify_device and ib_modify_port.  For ib_modify_port, I tried to re-use the port_info capability mask definitions.  Please respond with any feedback.

- Sean

Index: ib_verbs.h
===================================================================
--- ib_verbs.h	(revision 654)
+++ ib_verbs.h	(working copy)
@@ -135,7 +135,7 @@
 	IB_DEVICE_SHUTDOWN_PORT		= (1<<8),
 	IB_DEVICE_INIT_TYPE		= (1<<9),
 	IB_DEVICE_PORT_ACTIVE_EVENT	= (1<<10),
-	IB_DEVICE_SYS_IMG_GUID		= (1<<11),
+	IB_DEVICE_SYS_IMAGE_GUID	= (1<<11),
 	IB_DEVICE_RC_RNR_NAK_GEN	= (1<<12),
 	IB_DEVICE_SRQ_RESIZE		= (1<<13),
 	IB_DEVICE_N_NOTIFY_CQ		= (1<<14),
@@ -228,10 +228,10 @@
 	IB_PORT_SYS_IMAGE_GUID_SUP		= (1<<11),
 	IB_PORT_PKEY_SW_EXT_PORT_TRAP_SUP	= (1<<12),
 	IB_PORT_CM_SUP				= (1<<16),
-	IB_PORT_SNMP_TUNN_SUP			= (1<<17),
+	IB_PORT_SNMP_TUNNEL_SUP			= (1<<17),
 	IB_PORT_REINIT_SUP			= (1<<18),
 	IB_PORT_DEVICE_MGMT_SUP			= (1<<19),
-	IB_PORT_VENDOR_CLS_SUP			= (1<<20),
+	IB_PORT_VENDOR_CLASS_SUP		= (1<<20),
 	IB_PORT_DR_NOTICE_SUP			= (1<<21),
 	IB_PORT_PORT_NOTICE_SUP			= (1<<22),
 	IB_PORT_BOOT_MGMT_SUP			= (1<<23)
@@ -256,12 +256,24 @@
 	u8			init_type_reply;
 }; 
 
-enum ib_device_attr_flags {
-	IB_DEVICE_SM			= 1,
-	IB_DEVICE_SNMP_TUN_SUP		= (1<<1),
-	IB_DEVICE_DM_SUP		= (1<<2),
-	IB_DEVICE_VENDOR_CLS_SUP	= (1<<3),
-	IB_DEVICE_RESET_QKEY_CNTR	= (1<<4)
+enum ib_device_modify_flags {
+	IB_DEVICE_SYS_IMAGE_GUID	= 1
+};
+
+struct ib_device_modify {
+	u64	sys_image_guid;
+};
+
+enum ib_port_modify_flags {
+	IB_PORT_SHUTDOWN		= 1,
+	IB_PORT_INIT_TYPE		= (1<<2),
+	IB_PORT_RESET_QKEY_CNTR		= (1<<3)
+};
+
+struct ib_port_modify {
+	u32	set_port_cap_mask;
+	u32	clr_port_cap_mask;
+	u8	init_type;
 };
 
 union ib_gid {
@@ -626,7 +638,11 @@
 	int		 (*query_pkey)(struct ib_device *device,
 				       u8 port_num, u16 index, u16 *pkey);
 	int		 (*modify_device)(struct ib_device *device,
-					  u8 port_num, int device_attr_flags);
+					  int device_modify_mask,
+					  struct ib_device_modify *device_modify);
+	int		 (*modify_port)(struct ib_device *device,
+					u8 port_num, int port_modify_mask,
+					struct ib_port_modify *port_modify);
 	struct ib_pd *	 (*alloc_pd)(struct ib_device *device);
 	int		 (*dealloc_pd)(struct ib_pd *pd);
 	struct ib_ah *	 (*create_ah)(struct ib_pd *pd,
@@ -750,10 +766,20 @@
 }
 
 static inline int ib_modify_device(struct ib_device *device,
-				   u8 port_num,
-				   int device_attr_flags)
+				   int device_modify_mask,
+				   struct ib_device_modify *device_modify)
+{
+	return device->modify_device(device, device_modify_mask,
+				     device_modify);
+}
+
+static inline int ib_modify_port(struct ib_device *device,
+				 u8 port_num,
+				 int port_modify_mask,
+				 struct ib_port_modify *port_modify)
 {
-	return device->modify_device(device, port_num, device_attr_flags);
+	return device->modify_device(device, port_num, port_modify_mask,
+				     port_modify);
 }
 
 static inline struct ib_pd *ib_alloc_pd(struct ib_device *device)



More information about the general mailing list