Ver código fonte

[hermon] Use SET_PORT to set port parameters

Unlike Arbel, port parameters must be applied via a separate call to
SET_PORT, rather than as parameters to INIT_PORT.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 anos atrás
pai
commit
f62c433d66
2 arquivos alterados com 89 adições e 23 exclusões
  1. 40
    18
      src/drivers/infiniband/hermon.c
  2. 49
    5
      src/drivers/infiniband/hermon.h

+ 40
- 18
src/drivers/infiniband/hermon.c Ver arquivo

@@ -186,6 +186,7 @@ static int hermon_cmd ( struct hermon *hermon, unsigned long command,
186 186
 	memset ( &hcr, 0, sizeof ( hcr ) );
187 187
 	in_buffer = &hcr.u.dwords[0];
188 188
 	if ( in_len && ( command & HERMON_HCR_IN_MBOX ) ) {
189
+		memset ( hermon->mailbox_in, 0, HERMON_MBOX_SIZE );
189 190
 		in_buffer = hermon->mailbox_in;
190 191
 		MLX_FILL_1 ( &hcr, 1, in_param_l, virt_to_bus ( in_buffer ) );
191 192
 	}
@@ -289,12 +290,10 @@ hermon_cmd_close_hca ( struct hermon *hermon ) {
289 290
 }
290 291
 
291 292
 static inline int
292
-hermon_cmd_init_port ( struct hermon *hermon, unsigned int port,
293
-		       const struct hermonprm_init_port *init_port ) {
293
+hermon_cmd_init_port ( struct hermon *hermon, unsigned int port ) {
294 294
 	return hermon_cmd ( hermon,
295
-			    HERMON_HCR_IN_CMD ( HERMON_HCR_INIT_PORT,
296
-						1, sizeof ( *init_port ) ),
297
-			    0, init_port, port, NULL );
295
+			    HERMON_HCR_VOID_CMD ( HERMON_HCR_INIT_PORT ),
296
+			    0, NULL, port, NULL );
298 297
 }
299 298
 
300 299
 static inline int
@@ -304,6 +303,15 @@ hermon_cmd_close_port ( struct hermon *hermon, unsigned int port ) {
304 303
 			    0, NULL, port, NULL );
305 304
 }
306 305
 
306
+static inline int
307
+hermon_cmd_set_port ( struct hermon *hermon, unsigned int port,
308
+		      struct hermonprm_set_port *set_port ) {
309
+	return hermon_cmd ( hermon,
310
+			    HERMON_HCR_IN_CMD ( HERMON_HCR_SET_PORT,
311
+						1, sizeof ( *set_port ) ),
312
+			    0, set_port, port, NULL );
313
+}
314
+
307 315
 static inline int
308 316
 hermon_cmd_sw2hw_mpt ( struct hermon *hermon, unsigned int index,
309 317
 		       const struct hermonprm_mpt *mpt ) {
@@ -1903,8 +1911,11 @@ static int hermon_sense_port_type ( struct ib_device *ibdev ) {
1903 1911
 	int rc;
1904 1912
 
1905 1913
 	/* If DPDP is not supported, always assume Infiniband */
1906
-	if ( ! hermon->cap.dpdp )
1914
+	if ( ! hermon->cap.dpdp ) {
1915
+		DBGC ( hermon, "Hermon %p does not support DPDP; assuming "
1916
+		       "Infiniband\n", hermon );
1907 1917
 		return HERMON_PORT_TYPE_IB;
1918
+	}
1908 1919
 
1909 1920
 	/* Sense the port type */
1910 1921
 	if ( ( rc = hermon_cmd_sense_port ( hermon, ibdev->port,
@@ -1928,7 +1939,7 @@ static int hermon_sense_port_type ( struct ib_device *ibdev ) {
1928 1939
  */
1929 1940
 static int hermon_open ( struct ib_device *ibdev ) {
1930 1941
 	struct hermon *hermon = ib_get_drvdata ( ibdev );
1931
-	struct hermonprm_init_port init_port;
1942
+	struct hermonprm_set_port set_port;
1932 1943
 	int port_type;
1933 1944
 	int rc;
1934 1945
 
@@ -1941,18 +1952,29 @@ static int hermon_open ( struct ib_device *ibdev ) {
1941 1952
 		return -ENOTCONN;
1942 1953
         }
1943 1954
 
1944
-	/* Init Port */
1945
-	memset ( &init_port, 0, sizeof ( init_port ) );
1946
-	MLX_FILL_2 ( &init_port, 0,
1947
-		     port_width_cap, 3,
1948
-		     vl_cap, 1 );
1949
-	MLX_FILL_2 ( &init_port, 1,
1950
-		     mtu, HERMON_MTU_2048,
1955
+	/* Set port parameters */
1956
+	memset ( &set_port, 0, sizeof ( set_port ) );
1957
+	MLX_FILL_7 ( &set_port, 0,
1958
+		     mmc, 1,
1959
+		     mvc, 1,
1960
+		     mp, 1,
1961
+		     mg, 1,
1962
+		     mtu_cap, IB_MTU_2048,
1963
+		     vl_cap, IB_VL_0,
1964
+		     rcm, 1 );
1965
+	MLX_FILL_2 ( &set_port, 10,
1966
+		     max_pkey, 1,
1951 1967
 		     max_gid, 1 );
1952
-	MLX_FILL_1 ( &init_port, 2, max_pkey, 64 );
1953
-	if ( ( rc = hermon_cmd_init_port ( hermon, ibdev->port,
1954
-					   &init_port ) ) != 0 ) {
1955
-		DBGC ( hermon, "Hermon %p port %d could not intialise port: "
1968
+	if ( ( rc = hermon_cmd_set_port ( hermon, ibdev->port,
1969
+					  &set_port ) ) != 0 ) {
1970
+		DBGC ( hermon, "Hermon %p port %d could not set port: %s\n",
1971
+		       hermon, ibdev->port, strerror ( rc ) );
1972
+		return rc;
1973
+	}
1974
+
1975
+	/* Initialise port */
1976
+	if ( ( rc = hermon_cmd_init_port ( hermon, ibdev->port ) ) != 0 ) {
1977
+		DBGC ( hermon, "Hermon %p port %d could not initialise port: "
1956 1978
 		       "%s\n", hermon, ibdev->port, strerror ( rc ) );
1957 1979
 		return rc;
1958 1980
 	}

+ 49
- 5
src/drivers/infiniband/hermon.h Ver arquivo

@@ -47,6 +47,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
47 47
 #define HERMON_HCR_CLOSE_HCA		0x0008
48 48
 #define HERMON_HCR_INIT_PORT		0x0009
49 49
 #define HERMON_HCR_CLOSE_PORT		0x000a
50
+#define HERMON_HCR_SET_PORT		0x000c
50 51
 #define HERMON_HCR_SW2HW_MPT		0x000d
51 52
 #define HERMON_HCR_WRITE_MTT		0x0011
52 53
 #define HERMON_HCR_MAP_EQ		0x0012
@@ -84,6 +85,9 @@ FILE_LICENCE ( GPL2_OR_LATER );
84 85
 #define HERMON_ST_UD			0x03
85 86
 #define HERMON_ST_MLX			0x07
86 87
 
88
+/* Port types */
89
+#define HERMON_PORT_TYPE_IB		1
90
+
87 91
 /* MTUs */
88 92
 #define HERMON_MTU_2048			0x04
89 93
 
@@ -190,13 +194,53 @@ struct hermonprm_port_state_change_event_st {
190 194
 	struct hermonprm_port_state_change_st data;
191 195
 } __attribute__ (( packed ));
192 196
 
193
-/** Hermon sense port */
194 197
 struct hermonprm_sense_port_st {
195 198
 	pseudo_bit_t port_type[0x00020];
196 199
 /* -------------- */
197 200
 	pseudo_bit_t reserved[0x00020];
198
-};
199
-#define HERMON_PORT_TYPE_IB		1
201
+} __attribute__ (( packed ));
202
+
203
+struct hermonprm_set_port_st {
204
+	pseudo_bit_t rqk[0x00001];
205
+	pseudo_bit_t rcm[0x00001];
206
+	pseudo_bit_t reserved0[0x00002];
207
+	pseudo_bit_t vl_cap[0x00004];
208
+	pseudo_bit_t reserved1[0x00004];
209
+	pseudo_bit_t mtu_cap[0x00004];
210
+	pseudo_bit_t g0[0x00001];
211
+	pseudo_bit_t ng[0x00001];
212
+	pseudo_bit_t sig[0x00001];
213
+	pseudo_bit_t mg[0x00001];
214
+	pseudo_bit_t mp[0x00001];
215
+	pseudo_bit_t mvc[0x00001];
216
+	pseudo_bit_t mmc[0x00001];
217
+	pseudo_bit_t reserved2[0x00009];
218
+/* -------------- */
219
+	pseudo_bit_t capability_mask[0x00020];
220
+/* -------------- */
221
+	pseudo_bit_t system_image_guid_h[0x00020];
222
+/* -------------- */
223
+	pseudo_bit_t system_image_guid_l[0x00020];
224
+/* -------------- */
225
+	pseudo_bit_t guid0_h[0x00020];
226
+/* -------------- */
227
+	pseudo_bit_t guid0_l[0x00020];
228
+/* -------------- */
229
+	pseudo_bit_t node_guid_h[0x00020];
230
+/* -------------- */
231
+	pseudo_bit_t node_guid_l[0x00020];
232
+/* -------------- */
233
+	pseudo_bit_t egress_sniff_qpn[0x00018];
234
+	pseudo_bit_t egress_sniff_mode[0x00002];
235
+	pseudo_bit_t reserved3[0x00006];
236
+/* -------------- */
237
+	pseudo_bit_t ingress_sniff_qpn[0x00018];
238
+	pseudo_bit_t ingress_sniff_mode[0x00002];
239
+	pseudo_bit_t reserved4[0x00006];
240
+/* -------------- */
241
+	pseudo_bit_t max_gid[0x00010];
242
+	pseudo_bit_t max_pkey[0x00010];
243
+} __attribute__ (( packed ));
200 244
 
201 245
 /*
202 246
  * Wrapper structures for hardware datatypes
@@ -213,7 +257,6 @@ struct MLX_DECLARE_STRUCT ( hermonprm_event_mask );
213 257
 struct MLX_DECLARE_STRUCT ( hermonprm_event_queue_entry );
214 258
 struct MLX_DECLARE_STRUCT ( hermonprm_hca_command_register );
215 259
 struct MLX_DECLARE_STRUCT ( hermonprm_init_hca );
216
-struct MLX_DECLARE_STRUCT ( hermonprm_init_port );
217 260
 struct MLX_DECLARE_STRUCT ( hermonprm_mad_ifc );
218 261
 struct MLX_DECLARE_STRUCT ( hermonprm_mcg_entry );
219 262
 struct MLX_DECLARE_STRUCT ( hermonprm_mgm_hash );
@@ -228,6 +271,7 @@ struct MLX_DECLARE_STRUCT ( hermonprm_queue_pair_ee_context_entry );
228 271
 struct MLX_DECLARE_STRUCT ( hermonprm_scalar_parameter );
229 272
 struct MLX_DECLARE_STRUCT ( hermonprm_sense_port );
230 273
 struct MLX_DECLARE_STRUCT ( hermonprm_send_db_register );
274
+struct MLX_DECLARE_STRUCT ( hermonprm_set_port );
231 275
 struct MLX_DECLARE_STRUCT ( hermonprm_ud_address_vector );
232 276
 struct MLX_DECLARE_STRUCT ( hermonprm_virtual_physical_mapping );
233 277
 struct MLX_DECLARE_STRUCT ( hermonprm_wqe_segment_ctrl_mlx );
@@ -590,7 +634,7 @@ struct hermon {
590 634
 #define HERMON_HCR_REG(x)		( HERMON_HCR_BASE + 4 * (x) )
591 635
 #define HERMON_HCR_MAX_WAIT_MS		2000
592 636
 #define HERMON_MBOX_ALIGN		4096
593
-#define HERMON_MBOX_SIZE		512
637
+#define HERMON_MBOX_SIZE		1024
594 638
 
595 639
 /* HCA command is split into
596 640
  *

Carregando…
Cancelar
Salvar