components/open-fabrics/infiniband-diags/patches/base.patch
changeset 1793 b253729db1c0
parent 1749 6a6f92e9feaf
child 2187 391c8a50fa82
equal deleted inserted replaced
1792:5cea652172c6 1793:b253729db1c0
  1801  					out_switch(ch->linenode[n], group,
  1801  					out_switch(ch->linenode[n], group,
  1802  						   chname, NULL, NULL);
  1802  						   chname, NULL, NULL);
  1803 diff -r -u /tmp/infiniband-diags-1.5.8/src/saquery.c infiniband-diags-1.5.8/src/saquery.c
  1803 diff -r -u /tmp/infiniband-diags-1.5.8/src/saquery.c infiniband-diags-1.5.8/src/saquery.c
  1804 --- /tmp/infiniband-diags-1.5.8/src/saquery.c	Wed Feb 16 02:13:21 2011
  1804 --- /tmp/infiniband-diags-1.5.8/src/saquery.c	Wed Feb 16 02:13:21 2011
  1805 +++ infiniband-diags-1.5.8/src/saquery.c	Thu Jun 23 10:36:40 2011
  1805 +++ infiniband-diags-1.5.8/src/saquery.c	Thu Jun 23 10:36:40 2011
  1806 @@ -105,7 +105,7 @@
  1806 @@ -104,8 +104,7 @@
       
  1807  /**
  1807   * Declare some globals because I don't want this to be too complex.
  1808   * Declare some globals because I don't want this to be too complex.
  1808   */
  1809   */
  1809  #define MAX_PORTS (8)
  1810 -#define MAX_PORTS (8)
  1810 -#define DEFAULT_SA_TIMEOUT_MS (1000)
  1811 -#define DEFAULT_SA_TIMEOUT_MS (1000)
  1811 +#define DEFAULT_SA_TIMEOUT_MS (10000)
  1812 +#define DEFAULT_SA_TIMEOUT_MS (10000)
  1812  static struct query_res result;
  1813  static struct query_res result;
  1813  
  1814  
  1814  enum {
  1815  enum {
  1815 @@ -1757,7 +1757,7 @@
  1816 @@ -1757,7 +1756,7 @@
  1816  			requested_lid = (uint16_t) strtoul(argv[0], NULL, 0);
  1817  			requested_lid = (uint16_t) strtoul(argv[0], NULL, 0);
  1817  			requested_lid_flag++;
  1818  			requested_lid_flag++;
  1818  		} else if (node_print_desc == NAME_OF_GUID) {
  1819  		} else if (node_print_desc == NAME_OF_GUID) {
  1819 -			requested_guid = strtoul(argv[0], NULL, 0);
  1820 -			requested_guid = strtoul(argv[0], NULL, 0);
  1820 +			requested_guid = strtoull(argv[0], NULL, 0);
  1821 +			requested_guid = strtoull(argv[0], NULL, 0);
  1883 -	"???",
  1884 -	"???",
  1884 +	"Unknown",
  1885 +	"Unknown",
  1885  	"Down",
  1886  	"Down",
  1886  	"Initializing",
  1887  	"Initializing",
  1887  	"Armed",
  1888  	"Armed",
  1888 @@ -96,6 +97,19 @@
  1889 @@ -112,10 +113,10 @@
  1889  	"PhyTest"
       
  1890  };
       
  1891  
       
  1892 +static const char *port_link_layer_str(uint8_t link_layer)
       
  1893 +{
       
  1894 +	switch (link_layer) {
       
  1895 +		case IBV_LINK_LAYER_UNSPECIFIED:
       
  1896 +		case IBV_LINK_LAYER_INFINIBAND:
       
  1897 +			return "IB";
       
  1898 +		case IBV_LINK_LAYER_ETHERNET:
       
  1899 +			return "Ethernet";
       
  1900 +		default:
       
  1901 +			return "Unknown";
       
  1902 +        }
       
  1903 +};
       
  1904 +
       
  1905  static int port_dump(umad_port_t * port, int alone)
       
  1906  {
       
  1907  	char *pre = "";
       
  1908 @@ -112,10 +126,10 @@
       
  1909  	printf("%sPort %d:\n", hdrpre, port->portnum);
  1890  	printf("%sPort %d:\n", hdrpre, port->portnum);
  1910  	printf("%sState: %s\n", pre,
  1891  	printf("%sState: %s\n", pre,
  1911  	       (unsigned)port->state <=
  1892  	       (unsigned)port->state <=
  1912 -	       4 ? port_state_str[port->state] : "???");
  1893 -	       4 ? port_state_str[port->state] : "???");
  1913 +	       4 ? port_state_str[port->state] : "Unknown");
  1894 +	       4 ? port_state_str[port->state] : "Unknown");
  1916 -	       7 ? port_phy_state_str[port->phys_state] : "???");
  1897 -	       7 ? port_phy_state_str[port->phys_state] : "???");
  1917 +	       7 ? port_phy_state_str[port->phys_state] : "Unknown");
  1898 +	       7 ? port_phy_state_str[port->phys_state] : "Unknown");
  1918  	printf("%sRate: %d\n", pre, port->rate);
  1899  	printf("%sRate: %d\n", pre, port->rate);
  1919  	printf("%sBase lid: %d\n", pre, port->base_lid);
  1900  	printf("%sBase lid: %d\n", pre, port->base_lid);
  1920  	printf("%sLMC: %d\n", pre, port->lmc);
  1901  	printf("%sLMC: %d\n", pre, port->lmc);
  1921 @@ -122,7 +136,7 @@
  1902 @@ -167,13 +168,13 @@
  1922  	printf("%sSM lid: %d\n", pre, port->sm_lid);
  1903  
  1923  	printf("%sCapability mask: 0x%08x\n", pre, ntohl(port->capmask));
  1904  static int ports_list(char names[][UMAD_CA_NAME_LEN], int n)
  1924  	printf("%sPort GUID: 0x%016" PRIx64 "\n", pre, ntohll(port->port_guid));
  1905  {
  1925 -	printf("%sLink layer: %s\n", pre, port->link_layer);
  1906 -	uint64_t guids[64];
  1926 +	printf("%sLink layer: %s\n", pre, port_link_layer_str(atoi(port->link_layer)));
  1907 +	uint64_t guids[MAX_PORTS];
  1927  	return 0;
  1908  	int found, ports, i;
  1928  }
  1909  
  1929  
  1910 -	for (i = 0, found = 0; i < n && found < 64; i++) {
  1930 @@ -245,7 +259,7 @@
  1911 +	for (i = 0, found = 0; i < n && found < MAX_PORTS; i++) {
       
  1912  		if ((ports =
       
  1913  		     umad_get_ca_portguids(names[i], guids + found,
       
  1914 -					   64 - found)) < 0)
       
  1915 +					   MAX_PORTS - found)) < 0)
       
  1916  			return -1;
       
  1917  		found += ports;
       
  1918  	}
       
  1919 @@ -245,7 +246,7 @@
  1931  		if (i >= n)
  1920  		if (i >= n)
  1932  			IBPANIC("'%s' IB device can't be found", argv[0]);
  1921  			IBPANIC("'%s' IB device can't be found", argv[0]);
  1933  
  1922  
  1934 -		strncpy(names[i], argv[0], sizeof names[i]);
  1923 -		strncpy(names[i], argv[0], sizeof names[i]);
  1935 +		strncpy(names[0], argv[0], sizeof names[i]);
  1924 +		strncpy(names[0], argv[0], sizeof names[i]);