<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.45">
<TITLE>[PATCH] FW version in vstat</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>Fab </FONT>
</P>
<P><FONT SIZE=2>we found it very useful to know the fw version on the HCA</FONT>
<BR><FONT SIZE=2>this patch add fw version to the vstat report.</FONT>
</P>
<P><FONT SIZE=2>to make it clean I want to create access function for Mellanox specific attributes in the query_ca , </FONT>
<BR><FONT SIZE=2>where do you think we should put this functions ?</FONT>
</P>
<P><FONT SIZE=2>pls review </FONT>
</P>
<P><FONT SIZE=2>10x</FONT>
</P>
<P><FONT SIZE=2>Yossi </FONT>
</P>
<BR>
<P><FONT SIZE=2>Singed-off-by Yossi Leybovich (sleybo@mellanox.co.il)</FONT>
</P>
<P><FONT SIZE=2>Index: hw/mt23108/kernel/hca_verbs.c</FONT>
<BR><FONT SIZE=2>===================================================================</FONT>
<BR><FONT SIZE=2>--- hw/mt23108/kernel/hca_verbs.c (revision 707)</FONT>
<BR><FONT SIZE=2>+++ hw/mt23108/kernel/hca_verbs.c (working copy)</FONT>
<BR><FONT SIZE=2>@@ -228,7 +228,8 @@</FONT>
<BR><FONT SIZE=2> num_pkeys = 0;</FONT>
<BR><FONT SIZE=2> required_size = PTR_ALIGN(sizeof(ib_ca_attr_t)) +</FONT>
<BR><FONT SIZE=2> PTR_ALIGN(sizeof(u_int32_t) * num_page_sizes) +</FONT>
<BR><FONT SIZE=2>- PTR_ALIGN(sizeof(ib_port_attr_t) * num_ports);</FONT>
<BR><FONT SIZE=2>+ PTR_ALIGN(sizeof(ib_port_attr_t) * num_ports)+</FONT>
<BR><FONT SIZE=2>+ PTR_ALIGN(sizeof(hca_ul_info->fw_ver));</FONT>
<BR><FONT SIZE=2> for (port_num = 0; port_num < num_ports; port_num++) {</FONT>
<BR><FONT SIZE=2> if (HH_OK != THH_hob_query_port_prop(hh_hndl, port_num+1, &hca_ports[port_num])) {</FONT>
<BR><FONT SIZE=2> status = IB_ERROR;</FONT>
<BR><FONT SIZE=2>@@ -348,7 +349,8 @@</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> // !!! GID/PKEY tables must be queried before this call !!!</FONT>
<BR><FONT SIZE=2> mlnx_conv_vapi_hca_cap(hca_ul_info, &hca_cap, hca_ports, p_ca_attr);</FONT>
<BR><FONT SIZE=2>-</FONT>
<BR><FONT SIZE=2>+ memcpy(last_p, &hca_ul_info->fw_ver,sizeof(hca_ul_info->fw_ver));</FONT>
<BR><FONT SIZE=2>+ last_p += sizeof(hca_ul_info->fw_ver);</FONT>
<BR><FONT SIZE=2> // verify: required space == used space</FONT>
<BR><FONT SIZE=2> CL_ASSERT( required_size == (((uintn_t)last_p) - ((uintn_t)p_ca_attr)) );</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2>Index: hw/mt23108/vapi/Hca/hcahal/hh.h</FONT>
<BR><FONT SIZE=2>===================================================================</FONT>
<BR><FONT SIZE=2>--- hw/mt23108/vapi/Hca/hcahal/hh.h (revision 707)</FONT>
<BR><FONT SIZE=2>+++ hw/mt23108/vapi/Hca/hcahal/hh.h (working copy)</FONT>
<BR><FONT SIZE=2>@@ -69,6 +69,7 @@</FONT>
<BR><FONT SIZE=2> u_int32_t vendor_id; /* IEEE's 24 bit Device Vendor ID */</FONT>
<BR><FONT SIZE=2> u_int32_t dev_id; /* Device ID */</FONT>
<BR><FONT SIZE=2> u_int32_t hw_ver; /* Hardware version (step/rev) */</FONT>
<BR><FONT SIZE=2>+ u_int64_t fw_ver;</FONT>
<BR><FONT SIZE=2> struct hh_if_ops* if_ops; /* Interface operations */</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> /* Size (bytes) of user-level ... */</FONT>
<BR><FONT SIZE=2>Index: hw/mt23108/vapi/Hca/hcahal/tavor/thh_hob/thh_hob.c</FONT>
<BR><FONT SIZE=2>===================================================================</FONT>
<BR><FONT SIZE=2>--- hw/mt23108/vapi/Hca/hcahal/tavor/thh_hob/thh_hob.c (revision 707)</FONT>
<BR><FONT SIZE=2>+++ hw/mt23108/vapi/Hca/hcahal/tavor/thh_hob/thh_hob.c (working copy)</FONT>
<BR><FONT SIZE=2>@@ -4176,6 +4176,9 @@</FONT>
<BR><FONT SIZE=2> tdev.dev_id = (u_int32_t)hw_props_p->device_id;</FONT>
<BR><FONT SIZE=2> MTL_DEBUG1("hw_props_p: device_id = 0x%X, pci_vendor_id=0x%X,hw_ver=0x%X\n",</FONT>
<BR><FONT SIZE=2> hw_props_p->device_id, hw_props_p->pci_vendor_id, hw_props_p->hw_ver);</FONT>
<BR><FONT SIZE=2>+ tdev.fw_ver= tdev.fw_ver = hob_p->fw_props.fw_rev_major;</FONT>
<BR><FONT SIZE=2>+ tdev.fw_ver = (tdev.fw_ver <<16) | hob_p->fw_props.fw_rev_minor;</FONT>
<BR><FONT SIZE=2>+ tdev.fw_ver = (tdev.fw_ver <<16) | hob_p->fw_props.fw_rev_subminor;;</FONT>
<BR><FONT SIZE=2> tdev.hw_ver = hob_p->hw_props.hw_ver; </FONT>
<BR><FONT SIZE=2> tdev.if_ops = if_ops_p;</FONT>
<BR><FONT SIZE=2> tdev.hca_ul_resources_sz = sizeof(THH_hca_ul_resources_t);</FONT>
<BR><FONT SIZE=2>Index: tools/vstat/user/vstat_main.c</FONT>
<BR><FONT SIZE=2>===================================================================</FONT>
<BR><FONT SIZE=2>--- tools/vstat/user/vstat_main.c (revision 707)</FONT>
<BR><FONT SIZE=2>+++ tools/vstat/user/vstat_main.c (working copy)</FONT>
<BR><FONT SIZE=2>@@ -155,7 +155,7 @@</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2>-void vstat_print_ca_attr(int idx, ib_ca_attr_t* ca_attr, BOOLEAN fullPrint){</FONT>
<BR><FONT SIZE=2>+void vstat_print_ca_attr(int idx, ib_ca_attr_t* ca_attr, uint32_t size, BOOLEAN fullPrint){</FONT>
<BR><FONT SIZE=2> int i;</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> printf("\thca_idx=%d\n",idx);</FONT>
<BR><FONT SIZE=2>@@ -163,7 +163,10 @@</FONT>
<BR><FONT SIZE=2> printf("\tvendor_id=0x%04x\n", ca_attr->vend_id);</FONT>
<BR><FONT SIZE=2> printf("\tvendor_part_id=0x%04x\n", ca_attr->dev_id);</FONT>
<BR><FONT SIZE=2> printf("\thw_ver=0x%x\n", ca_attr->revision); //TODO: ???</FONT>
<BR><FONT SIZE=2>- printf("\tfw_ver=NA\n");</FONT>
<BR><FONT SIZE=2>+ printf("\tfw_ver=%d.%.2d.%.4d\n",</FONT>
<BR><FONT SIZE=2>+ *(uint16_t *)((char*)ca_attr+ size-6),</FONT>
<BR><FONT SIZE=2>+ *(uint16_t *)((char*)ca_attr+ size-4),</FONT>
<BR><FONT SIZE=2>+ *(uint16_t *)((char*)ca_attr+ size-2));</FONT>
<BR><FONT SIZE=2> printf("\tPSID=NA\n");</FONT>
<BR><FONT SIZE=2> if(fullPrint){</FONT>
<BR><FONT SIZE=2> printf("\tnum_phys_ports = %d\n",ca_attr->num_ports);</FONT>
<BR><FONT SIZE=2>@@ -336,7 +339,7 @@</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> /* Print_ca_attributes */</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2>- vstat_print_ca_attr((int)i,vstat_ca_attr, fullPrint);</FONT>
<BR><FONT SIZE=2>+ vstat_print_ca_attr((int)i, vstat_ca_attr, bsize, fullPrint);</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> /* Free the memory */</FONT>
</P>
<P><FONT FACE="Arial" SIZE=2 COLOR="#000000"></FONT>
</BODY>
</HTML>