[ofw] [PATCH v2] ib/port_attr: report active width as part of port attributes

Sean Hefty sean.hefty at intel.com
Thu Aug 13 11:04:19 PDT 2009


Return the active width in the port attributes reported by the HCA.
Because the kernel and user space share the same source 
files, to avoid breaking the ABI, rename link_width_supported field
to active_width and use that field to return the value.
link_width_supported is currently uninitialized and in the svn tree
unused, so repurposing the field should have minimal impact.  However,
this change will break the API.  Applications that reference the
link_width_supported field from struct _ib_port_attr will require
a minor update if recompiled. 

Update winverbs to report this value and fill in other missing fields
from the port attribute structure.  This fix allows reporting the
correct values through the libibverbs port and ibv_devinfo example
utility.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
changes from v1: renamed link_width_supported field

diff -up -r -X \mshefty\scm\winof\trunk\docs\dontdiff.txt -I '\$Id:' trunk\inc\iba/ib_types.h branches\winverbs\inc\iba/ib_types.h
--- trunk\inc\iba/ib_types.h	2009-06-11 10:33:24.189875000 -0700
+++ branches\winverbs\inc\iba/ib_types.h	2009-08-13 10:55:27.403564800 -0700
@@ -8724,11 +8724,7 @@ typedef struct _ib_port_attr
 	ib_net16_t				lid;
 	uint8_t					lmc;
 
-	/*
-	 * LinkWidthSupported as defined in PortInfo.  Required to calculate
-	 * inter-packet delay (a.k.a. static rate).
-	 */
-	uint8_t					link_width_supported;
+	uint8_t					active_width;
 
 	uint16_t				max_vls;
 
diff -up -r -X \mshefty\scm\winof\trunk\docs\dontdiff.txt -I '\$Id:' trunk\hw/mlx4/kernel/hca/data.c
branches\winverbs\hw/mlx4/kernel/hca/data.c
--- trunk\hw/mlx4/kernel/hca/data.c	2009-06-11 10:33:38.377375000 -0700
+++ branches\winverbs\hw/mlx4/kernel/hca/data.c	2009-08-13 10:41:52.762601000 -0700
@@ -347,6 +347,7 @@ from_hca_cap(
 			ibal_port_p->max_msg_size = mthca_port_p->max_msg_sz;
 			ibal_port_p->mtu = (uint8_t)mthca_port_p->max_mtu;
 			ibal_port_p->active_speed = mthca_port_p->active_speed;
+			ibal_port_p->active_width = mthca_port_p->active_width;
 			ibal_port_p->phys_state = mthca_port_p->phys_state;
 
 			ibal_port_p->subnet_timeout = mthca_port_p->subnet_timeout;
diff -up -r -X \mshefty\scm\winof\trunk\docs\dontdiff.txt -I '\$Id:' trunk\hw/mthca/kernel/hca_data.c
branches\winverbs\hw/mthca/kernel/hca_data.c
--- trunk\hw/mthca/kernel/hca_data.c	2009-06-11 10:33:47.846125000 -0700
+++ branches\winverbs\hw/mthca/kernel/hca_data.c	2009-08-13 10:41:53.137533800 -0700
@@ -323,6 +323,7 @@ mlnx_conv_hca_cap(
 		ibal_port_p->max_msg_size = mthca_port_p->max_msg_sz;
 		ibal_port_p->mtu = (uint8_t)mthca_port_p->max_mtu;
 		ibal_port_p->active_speed = mthca_port_p->active_speed;
+		ibal_port_p->active_width = mthca_port_p->active_width;
 		ibal_port_p->phys_state = mthca_port_p->phys_state;
 
 		ibal_port_p->subnet_timeout = mthca_port_p->subnet_timeout;
diff -up -r -X \mshefty\scm\winof\trunk\docs\dontdiff.txt -I '\$Id:' trunk\core\winverbs/kernel/wv_device.c
branches\winverbs\core\winverbs/kernel/wv_device.c
--- trunk\core\winverbs/kernel/wv_device.c	2009-06-11 10:32:48.283625000 -0700
+++ branches\winverbs\core\winverbs/kernel/wv_device.c	2009-08-13 10:42:24.665309400 -0700
@@ -517,7 +517,7 @@ static void WvConvertPortAttr(WV_IO_PORT
 {
 	WvConvertPortCap(&pAttributes->PortCabilityFlags, &pPortAttr->cap);
 	pAttributes->State			= pPortAttr->link_state;
-	pAttributes->MaxMtu			= 0;	// TODO: missing in ib_port_attr_t
+	pAttributes->MaxMtu			= 0x80 << pPortAttr->mtu;
 	pAttributes->ActiveMtu		= 0x80 << pPortAttr->mtu;
 	pAttributes->GidTableLength	= pPortAttr->num_gids;
 	pAttributes->MaxMessageSize	= (UINT32) pPortAttr->max_msg_size;
@@ -531,9 +531,9 @@ static void WvConvertPortAttr(WV_IO_PORT
 	pAttributes->SmSl			= pPortAttr->sm_sl;
 	pAttributes->SubnetTimeout	= pPortAttr->subnet_timeout;
 	pAttributes->InitTypeReply	= pPortAttr->init_type_reply;
-	pAttributes->ActiveWidth	= pPortAttr->link_width_supported;
-	pAttributes->ActiveSpeed	= 0;	// TODO: missing in ib_port_attr_t
-	pAttributes->PhysicalState	= 0;	// TODO: missing in ib_port_attr_t
+	pAttributes->ActiveWidth	= pPortAttr->active_width;
+	pAttributes->ActiveSpeed	= pPortAttr->active_speed;
+	pAttributes->PhysicalState	= pPortAttr->phys_state;
 	pAttributes->Reserved[0]	= 0;
 	pAttributes->Reserved[1]	= 0;
 }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hw.diff
Type: application/octet-stream
Size: 1383 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090813/80b4e2cf/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winverbs.diff
Type: application/octet-stream
Size: 1443 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090813/80b4e2cf/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: al.diff
Type: application/octet-stream
Size: 586 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090813/80b4e2cf/attachment-0002.obj>


More information about the ofw mailing list