[Openib-windows] [PATCH] FW version in vstat
Yossi Leybovich
sleybo at mellanox.co.il
Sun Nov 6 07:00:31 PST 2005
Fab
we found it very useful to know the fw version on the HCA
this patch add fw version to the vstat report.
to make it clean I want to create access function for Mellanox specific
attributes in the query_ca ,
where do you think we should put this functions ?
pls review
10x
Yossi
Singed-off-by Yossi Leybovich (sleybo at mellanox.co.il)
Index: hw/mt23108/kernel/hca_verbs.c
===================================================================
--- hw/mt23108/kernel/hca_verbs.c (revision 707)
+++ hw/mt23108/kernel/hca_verbs.c (working copy)
@@ -228,7 +228,8 @@
num_pkeys = 0;
required_size = PTR_ALIGN(sizeof(ib_ca_attr_t)) +
PTR_ALIGN(sizeof(u_int32_t) * num_page_sizes) +
- PTR_ALIGN(sizeof(ib_port_attr_t) * num_ports);
+ PTR_ALIGN(sizeof(ib_port_attr_t) * num_ports)+
+ PTR_ALIGN(sizeof(hca_ul_info->fw_ver));
for (port_num = 0; port_num < num_ports; port_num++) {
if (HH_OK != THH_hob_query_port_prop(hh_hndl, port_num+1,
&hca_ports[port_num])) {
status = IB_ERROR;
@@ -348,7 +349,8 @@
// !!! GID/PKEY tables must be queried before this call !!!
mlnx_conv_vapi_hca_cap(hca_ul_info, &hca_cap, hca_ports, p_ca_attr);
-
+ memcpy(last_p, &hca_ul_info->fw_ver,sizeof(hca_ul_info->fw_ver));
+ last_p += sizeof(hca_ul_info->fw_ver);
// verify: required space == used space
CL_ASSERT( required_size == (((uintn_t)last_p) -
((uintn_t)p_ca_attr)) );
Index: hw/mt23108/vapi/Hca/hcahal/hh.h
===================================================================
--- hw/mt23108/vapi/Hca/hcahal/hh.h (revision 707)
+++ hw/mt23108/vapi/Hca/hcahal/hh.h (working copy)
@@ -69,6 +69,7 @@
u_int32_t vendor_id; /* IEEE's 24 bit Device Vendor ID
*/
u_int32_t dev_id; /* Device ID */
u_int32_t hw_ver; /* Hardware version (step/rev) */
+ u_int64_t fw_ver;
struct hh_if_ops* if_ops; /* Interface operations */
/* Size (bytes) of user-level ...
*/
Index: hw/mt23108/vapi/Hca/hcahal/tavor/thh_hob/thh_hob.c
===================================================================
--- hw/mt23108/vapi/Hca/hcahal/tavor/thh_hob/thh_hob.c (revision 707)
+++ hw/mt23108/vapi/Hca/hcahal/tavor/thh_hob/thh_hob.c (working copy)
@@ -4176,6 +4176,9 @@
tdev.dev_id = (u_int32_t)hw_props_p->device_id;
MTL_DEBUG1("hw_props_p: device_id = 0x%X,
pci_vendor_id=0x%X,hw_ver=0x%X\n",
hw_props_p->device_id, hw_props_p->pci_vendor_id,
hw_props_p->hw_ver);
+ tdev.fw_ver= tdev.fw_ver = hob_p->fw_props.fw_rev_major;
+ tdev.fw_ver = (tdev.fw_ver <<16) | hob_p->fw_props.fw_rev_minor;
+ tdev.fw_ver = (tdev.fw_ver <<16) | hob_p->fw_props.fw_rev_subminor;;
tdev.hw_ver = hob_p->hw_props.hw_ver;
tdev.if_ops = if_ops_p;
tdev.hca_ul_resources_sz = sizeof(THH_hca_ul_resources_t);
Index: tools/vstat/user/vstat_main.c
===================================================================
--- tools/vstat/user/vstat_main.c (revision 707)
+++ tools/vstat/user/vstat_main.c (working copy)
@@ -155,7 +155,7 @@
-void vstat_print_ca_attr(int idx, ib_ca_attr_t* ca_attr, BOOLEAN
fullPrint){
+void vstat_print_ca_attr(int idx, ib_ca_attr_t* ca_attr, uint32_t size,
BOOLEAN fullPrint){
int i;
printf("\thca_idx=%d\n",idx);
@@ -163,7 +163,10 @@
printf("\tvendor_id=0x%04x\n", ca_attr->vend_id);
printf("\tvendor_part_id=0x%04x\n", ca_attr->dev_id);
printf("\thw_ver=0x%x\n", ca_attr->revision); //TODO: ???
- printf("\tfw_ver=NA\n");
+ printf("\tfw_ver=%d.%.2d.%.4d\n",
+ *(uint16_t *)((char*)ca_attr+ size-6),
+ *(uint16_t *)((char*)ca_attr+ size-4),
+ *(uint16_t *)((char*)ca_attr+ size-2));
printf("\tPSID=NA\n");
if(fullPrint){
printf("\tnum_phys_ports = %d\n",ca_attr->num_ports);
@@ -336,7 +339,7 @@
/* Print_ca_attributes */
- vstat_print_ca_attr((int)i,vstat_ca_attr,
fullPrint);
+ vstat_print_ca_attr((int)i, vstat_ca_attr, bsize,
fullPrint);
/* Free the memory */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20051106/2dcac27b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fw_ver.patch
Type: application/octet-stream
Size: 3632 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20051106/2dcac27b/attachment.obj>
More information about the ofw
mailing list