Browse Source

Can now both send and receive packets. LL header format not yet

fixed; still using a quick hack-up just to be able to pass through
data.
tags/v0.9.3
Michael Brown 17 years ago
parent
commit
30a19c3f1c

+ 2
- 0
src/drivers/net/mlx_ipoib/ib_mt25218.c View File

@@ -1587,12 +1587,14 @@ static void prep_send_wqe_buf(void *qph,
1587 1587
 	}
1588 1588
 	snd_wqe->mpointer[0].byte_count = cpu_to_be32(len);
1589 1589
 
1590
+#if 0
1590 1591
 	DBG ( "prep_send_wqe_buf()\n" );
1591 1592
 	DBG ( "snd_wqe:\n" );
1592 1593
 	DBG_HD ( snd_wqe, sizeof ( *snd_wqe ) );
1593 1594
 	DBG ( "packet:\n" );
1594 1595
 	DBG_HD ( bus_to_virt(be32_to_cpu(snd_wqe->mpointer[0].local_addr_l)),
1595 1596
 		 len );
1597
+#endif
1596 1598
 }
1597 1599
 
1598 1600
 static void *alloc_ud_av(void)

+ 10
- 7
src/drivers/net/mlx_ipoib/mt25218.c View File

@@ -248,13 +248,13 @@ static void mlx_poll ( struct net_device *netdev ) {
248 248
 	}
249 249
 	buf = get_rcv_wqe_buf(ib_cqe.wqe, 1);
250 250
 	memcpy ( iob_put ( iobuf, len ), buf, len );
251
-	DBG ( "Received packet header:\n" );
252
-	struct recv_wqe_st *rcv_wqe = ib_cqe.wqe;
253
-	DBG_HD ( get_rcv_wqe_buf(ib_cqe.wqe, 0),
254
-		 be32_to_cpu(rcv_wqe->mpointer[0].byte_count) );
251
+	//	DBG ( "Received packet header:\n" );
252
+	//	struct recv_wqe_st *rcv_wqe = ib_cqe.wqe;
253
+	//	DBG_HD ( get_rcv_wqe_buf(ib_cqe.wqe, 0),
254
+	//		 be32_to_cpu(rcv_wqe->mpointer[0].byte_count) );
255 255
 		 
256
-	DBG ( "Received packet:\n" );
257
-	DBG_HD ( iobuf->data, iob_len ( iobuf ) );
256
+	//	DBG ( "Received packet:\n" );
257
+	//	DBG_HD ( iobuf->data, iob_len ( iobuf ) );
258 258
 
259 259
 	netdev_rx ( netdev, iobuf );
260 260
 
@@ -392,6 +392,7 @@ static int mlx_probe ( struct pci_device *pci,
392 392
 		       const struct pci_device_id *id __unused ) {
393 393
 	struct net_device *netdev;
394 394
 	struct mlx_nic *mlx;
395
+	struct ib_mac *mac;
395 396
 	int rc;
396 397
 
397 398
 	/* Allocate net device */
@@ -410,7 +411,9 @@ static int mlx_probe ( struct pci_device *pci,
410 411
 	/* Initialise hardware */
411 412
 	if ( ( rc = ipoib_init ( pci ) ) != 0 )
412 413
 		goto err_ipoib_init;
413
-	memcpy ( netdev->ll_addr, ipoib_data.port_gid_raw, IB_ALEN );
414
+	mac = ( ( struct ib_mac * ) netdev->ll_addr );
415
+	mac->qpn = htonl ( ipoib_data.ipoib_qpn );
416
+	memcpy ( &mac->gid, ipoib_data.port_gid_raw, sizeof ( mac->gid ) );
414 417
 
415 418
 	/* Register network device */
416 419
 	if ( ( rc = register_netdev ( netdev ) ) != 0 )

+ 37
- 0
src/include/gpxe/infiniband.h View File

@@ -14,6 +14,43 @@
14 14
 #define IB_ALEN 20
15 15
 #define IB_HLEN 24
16 16
 
17
+/** An Infiniband Global Identifier */
18
+struct ib_gid {
19
+	uint8_t bytes[16];
20
+};
21
+
22
+/** An Infiniband Global Route Header */
23
+struct ib_global_route_header {
24
+	/** IP version, traffic class, and flow label
25
+	 *
26
+	 *  4 bits : Version of the GRH
27
+	 *  8 bits : Traffic class
28
+	 * 20 bits : Flow label
29
+	 */
30
+	uint32_t ipver_tclass_flowlabel;
31
+	/** Payload length */
32
+	uint16_t paylen;
33
+	/** Next header */
34
+	uint8_t nxthdr;
35
+	/** Hop limit */
36
+	uint8_t hoplmt;
37
+	/** Source GID */
38
+	struct ib_gid sgid;
39
+	/** Destiniation GID */
40
+	struct ib_gid dgid;
41
+} __attribute__ (( packed ));
42
+
43
+/** An Infiniband MAC address */
44
+struct ib_mac {
45
+	/** Queue pair number
46
+	 *
47
+	 * MSB must be zero; QPNs are only 24-bit.
48
+	 */
49
+	uint32_t qpn;
50
+	/** Port GID */
51
+	struct ib_gid gid;
52
+} __attribute__ (( packed ));
53
+
17 54
 /** An Infiniband header
18 55
  *
19 56
  * This data structure doesn't represent the on-wire format, but does

+ 11
- 0
src/net/infiniband.c View File

@@ -70,6 +70,17 @@ static int ib_tx ( struct io_buffer *iobuf, struct net_device *netdev,
70 70
  * network-layer protocol.
71 71
  */
72 72
 static int ib_rx ( struct io_buffer *iobuf, struct net_device *netdev ) {
73
+
74
+	struct {
75
+		uint16_t proto;
76
+		uint16_t reserved;
77
+	} * header = iobuf->data;
78
+
79
+	iob_pull ( iobuf, sizeof ( *header ) );
80
+	return net_rx ( iobuf, netdev, header->proto, NULL );
81
+
82
+
83
+
73 84
 	struct ibhdr *ibhdr = iobuf->data;
74 85
 
75 86
 	/* Sanity check */

Loading…
Cancel
Save