ib/port_attr: report active width as part of port attributes
authorshefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 18 Aug 2009 19:22:47 +0000 (19:22 +0000)
committershefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 18 Aug 2009 19:22:47 +0000 (19:22 +0000)
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@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2366 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/winverbs/kernel/wv_device.c
hw/mlx4/kernel/hca/data.c
hw/mthca/kernel/hca_data.c
inc/iba/ib_types.h

index cd97ae0..5cc20bd 100644 (file)
@@ -517,7 +517,7 @@ static void WvConvertPortAttr(WV_IO_PORT_ATTRIBUTES *pAttributes,
 {\r
        WvConvertPortCap(&pAttributes->PortCabilityFlags, &pPortAttr->cap);\r
        pAttributes->State                      = pPortAttr->link_state;\r
-       pAttributes->MaxMtu                     = 0;    // TODO: missing in ib_port_attr_t\r
+       pAttributes->MaxMtu                     = 0x80 << pPortAttr->mtu;\r
        pAttributes->ActiveMtu          = 0x80 << pPortAttr->mtu;\r
        pAttributes->GidTableLength     = pPortAttr->num_gids;\r
        pAttributes->MaxMessageSize     = (UINT32) pPortAttr->max_msg_size;\r
@@ -531,9 +531,9 @@ static void WvConvertPortAttr(WV_IO_PORT_ATTRIBUTES *pAttributes,
        pAttributes->SmSl                       = pPortAttr->sm_sl;\r
        pAttributes->SubnetTimeout      = pPortAttr->subnet_timeout;\r
        pAttributes->InitTypeReply      = pPortAttr->init_type_reply;\r
-       pAttributes->ActiveWidth        = pPortAttr->link_width_supported;\r
-       pAttributes->ActiveSpeed        = 0;    // TODO: missing in ib_port_attr_t\r
-       pAttributes->PhysicalState      = 0;    // TODO: missing in ib_port_attr_t\r
+       pAttributes->ActiveWidth        = pPortAttr->active_width;\r
+       pAttributes->ActiveSpeed        = pPortAttr->active_speed;\r
+       pAttributes->PhysicalState      = pPortAttr->phys_state;\r
        pAttributes->Reserved[0]        = 0;\r
        pAttributes->Reserved[1]        = 0;\r
 }\r
index 23f4280..91df60d 100644 (file)
@@ -347,6 +347,7 @@ from_hca_cap(
                        ibal_port_p->max_msg_size = mthca_port_p->max_msg_sz;\r
                        ibal_port_p->mtu = (uint8_t)mthca_port_p->max_mtu;\r
                        ibal_port_p->active_speed = mthca_port_p->active_speed;\r
+                       ibal_port_p->active_width = mthca_port_p->active_width;\r
                        ibal_port_p->phys_state = mthca_port_p->phys_state;\r
 \r
                        ibal_port_p->subnet_timeout = mthca_port_p->subnet_timeout;\r
index 92a3918..f3d002b 100644 (file)
@@ -323,6 +323,7 @@ mlnx_conv_hca_cap(
                ibal_port_p->max_msg_size = mthca_port_p->max_msg_sz;\r
                ibal_port_p->mtu = (uint8_t)mthca_port_p->max_mtu;\r
                ibal_port_p->active_speed = mthca_port_p->active_speed;\r
+               ibal_port_p->active_width = mthca_port_p->active_width;\r
                ibal_port_p->phys_state = mthca_port_p->phys_state;\r
 \r
                ibal_port_p->subnet_timeout = mthca_port_p->subnet_timeout;\r
index 583b317..a6ffb4e 100644 (file)
@@ -8724,11 +8724,7 @@ typedef struct _ib_port_attr
        ib_net16_t                              lid;\r
        uint8_t                                 lmc;\r
 \r
-       /*\r
-        * LinkWidthSupported as defined in PortInfo.  Required to calculate\r
-        * inter-packet delay (a.k.a. static rate).\r
-        */\r
-       uint8_t                                 link_width_supported;\r
+       uint8_t                                 active_width;\r
 \r
        uint16_t                                max_vls;\r
 \r