Browse Source

Dead code removal

tags/v0.9.3
Michael Brown 16 years ago
parent
commit
440e7926fb
2 changed files with 5 additions and 533 deletions
  1. 5
    470
      src/drivers/net/mlx_ipoib/mt25218.c
  2. 0
    63
      src/include/gpxe/infiniband.h

+ 5
- 470
src/drivers/net/mlx_ipoib/mt25218.c View File

@@ -35,290 +35,7 @@ struct ib_address_vector hack_ipoib_bcast_av;
35 35
 
36 36
 
37 37
 
38
-static const struct ib_gid arbel_no_gid = {
39
-	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 }
40
-};
41
-
42
-
43
-#if 0
44
-
45
-#define MLX_RX_MAX_FILL NUM_IPOIB_RCV_WQES
46
-
47
-struct mlx_nic {
48
-#if ! CREATE_OWN
49
-	/** Queue pair handle */
50
-	udqp_t ipoib_qph;
51
-	/** Send completion queue */
52
-	cq_t snd_cqh;
53
-	/** Receive completion queue */
54
-	cq_t rcv_cqh;
55
-#endif
56
-	/** Broadcast Address Vector */
57
-	ud_av_t bcast_av;
58
-
59
-	/** RX fill level */
60
-	unsigned int rx_fill;
61
-
62
-#if CREATE_OWN
63
-	struct ib_completion_queue *own_send_cq;
64
-	struct ib_completion_queue *own_recv_cq;
65
-	struct ib_queue_pair *own_qp;
66
-#endif
67
-};
68
-
69
-
70
-static struct io_buffer *static_ipoib_tx_ring[NUM_IPOIB_SND_WQES];
71
-static struct io_buffer *static_ipoib_rx_ring[NUM_IPOIB_RCV_WQES];
72
-
73
-static struct arbel static_arbel;
74
-
75
-#if ! CREATE_OWN
76
-
77
-static struct arbel_completion_queue static_arbel_ipoib_send_cq = {
78
-	.ci_doorbell_idx = IPOIB_SND_CQ_CI_DB_IDX,
79
-};
80
-static struct ib_completion_queue static_ipoib_send_cq = {
81
-	.cqn = 1234, /* Only used for debug messages */
82
-	.num_cqes = NUM_IPOIB_SND_CQES,
83
-	.work_queues = LIST_HEAD_INIT ( static_ipoib_send_cq.work_queues ),
84
-	.dev_priv = &static_arbel_ipoib_send_cq,
85
-};
86
-
87
-static struct arbel_completion_queue static_arbel_ipoib_recv_cq = {
88
-	.ci_doorbell_idx = IPOIB_RCV_CQ_CI_DB_IDX,
89
-};
90
-static struct ib_completion_queue static_ipoib_recv_cq = {
91
-	.cqn = 2345, /* Only used for debug messages */
92
-	.num_cqes = NUM_IPOIB_RCV_CQES,
93
-	.work_queues = LIST_HEAD_INIT ( static_ipoib_recv_cq.work_queues ),
94
-	.dev_priv = &static_arbel_ipoib_recv_cq,
95
-};
96
-
97
-static struct arbel_queue_pair static_arbel_ipoib_qp = {
98
-	.send = {
99
-		.doorbell_idx = IPOIB_SND_QP_DB_IDX,
100
-	},
101
-	.recv = {
102
-		.doorbell_idx = IPOIB_RCV_QP_DB_IDX,
103
-	},
104
-};
105
-static struct ib_queue_pair static_ipoib_qp = {
106
-	.send = {
107
-		.qp = &static_ipoib_qp,
108
-		.is_send = 1,
109
-		.cq = &static_ipoib_send_cq,
110
-		.num_wqes = NUM_IPOIB_SND_WQES,
111
-		.iobufs = static_ipoib_tx_ring,
112
-		.list = LIST_HEAD_INIT (static_ipoib_qp.send.list),
113
-		.dev_priv = &static_arbel_ipoib_qp.send,
114
-	},
115
-	.recv = {
116
-		.qp = &static_ipoib_qp,
117
-		.is_send = 0,
118
-		.cq = &static_ipoib_recv_cq,
119
-		.num_wqes = NUM_IPOIB_RCV_WQES,
120
-		.iobufs = static_ipoib_rx_ring,
121
-		.list = LIST_HEAD_INIT (static_ipoib_qp.recv.list),
122
-		.dev_priv = &static_arbel_ipoib_qp.recv,
123
-	},
124
-	.dev_priv = &static_arbel_ipoib_qp,
125
-};
126
-
127
-#endif
128
-
129
-
130
-static struct ib_device static_ibdev = {
131
-	.dev_priv = &static_arbel,
132
-};
133
-
134
-
135
-/**
136
- * Open network device
137
- *
138
- * @v netdev		Network device
139
- * @ret rc		Return status code
140
- */
141
-static int mlx_open ( struct net_device *netdev ) {
142
-
143
-	( void ) netdev;
144
-
145
-	return 0;
146
-}
147
-
148
-/**
149
- * Close network device
150
- *
151
- * @v netdev		Network device
152
- */
153
-static void mlx_close ( struct net_device *netdev ) {
154
-
155
-	( void ) netdev;
156
-
157
-}
158
-
159
-static int arbel_post_send ( struct ib_device *ibdev,
160
-			     struct ib_queue_pair *qp,
161
-			     struct ib_address_vector *av,
162
-			     struct io_buffer *iobuf );
163
-
164
-static int mlx_transmit_direct ( struct net_device *netdev,
165
-				 struct io_buffer *iobuf ) {
166
-	struct mlx_nic *mlx = netdev->priv;
167
-	int rc;
168
-
169
-	struct ud_av_st *bcast_av = mlx->bcast_av;
170
-	struct arbelprm_ud_address_vector *bav =
171
-		( struct arbelprm_ud_address_vector * ) &bcast_av->av;
172
-	struct ib_address_vector av = {
173
-		.dest_qp = bcast_av->dest_qp,
174
-		.qkey = bcast_av->qkey,
175
-		.dlid = MLX_GET ( bav, rlid ),
176
-		.rate = ( MLX_GET ( bav, max_stat_rate ) ? 1 : 4 ),
177
-		.sl = MLX_GET ( bav, sl ),
178
-		.gid_present = 1,
179
-	};
180
-	memcpy ( &av.gid, ( ( void * ) bav ) + 16, 16 );
181
-
182
-	rc = arbel_post_send ( &static_ibdev,
183
-#if CREATE_OWN
184
-			       mlx->own_qp,
185
-#else
186
-			       &static_ipoib_qp,
187
-#endif
188
-			       &av, iobuf );
189
-
190
-	return rc;
191
-}
192
-
193
-static void arbel_poll_cq ( struct ib_device *ibdev,
194
-			    struct ib_completion_queue *cq,
195
-			    ib_completer_t complete_send,
196
-			    ib_completer_t complete_recv );
197
-
198
-static void temp_complete_send ( struct ib_device *ibdev __unused,
199
-				 struct ib_queue_pair *qp,
200
-				 struct ib_completion *completion,
201
-				 struct io_buffer *iobuf ) {
202
-	struct net_device *netdev = qp->owner_priv;
203
-
204
-	DBG ( "Wahey! TX completion\n" );
205
-	netdev_tx_complete_err ( netdev, iobuf,
206
-				 ( completion->syndrome ? -EIO : 0 ) );
207
-}
208
-
209
-static void temp_complete_recv ( struct ib_device *ibdev __unused,
210
-				 struct ib_queue_pair *qp,
211
-				 struct ib_completion *completion,
212
-				 struct io_buffer *iobuf ) {
213
-	struct net_device *netdev = qp->owner_priv;
214
-	struct mlx_nic *mlx = netdev->priv;
215
-
216
-	DBG ( "Yay! RX completion on %p len %zx:\n", iobuf, completion->len );
217
-	if ( completion->syndrome ) {
218
-		netdev_rx_err ( netdev, iobuf, -EIO );
219
-	} else {
220
-		iob_put ( iobuf, completion->len );
221
-		iob_pull ( iobuf, sizeof ( struct ib_global_route_header ) );
222
-		netdev_rx ( netdev, iobuf );
223
-	}
224
-
225
-	mlx->rx_fill--;
226
-}
227
-
228
-static int arbel_post_recv ( struct ib_device *ibdev,
229
-			     struct ib_queue_pair *qp,
230
-			     struct io_buffer *iobuf );
231
-
232
-static void mlx_refill_rx ( struct net_device *netdev ) {
233
-	struct mlx_nic *mlx = netdev->priv;
234
-	struct io_buffer *iobuf;
235
-	int rc;
236
-
237
-	while ( mlx->rx_fill < MLX_RX_MAX_FILL ) {
238
-		iobuf = alloc_iob ( 2048 );
239
-		if ( ! iobuf )
240
-			break;
241
-		DBG ( "Posting RX buffer %p:\n", iobuf );
242
-		if ( ( rc = arbel_post_recv ( &static_ibdev,
243
-#if CREATE_OWN
244
-					      mlx->own_qp,
245
-#else
246
-					      &static_ipoib_qp,
247
-#endif
248
-					      iobuf ) ) != 0 ) {
249
-			free_iob ( iobuf );
250
-			break;
251
-		}
252
-		mlx->rx_fill++;
253
-	}
254
-}
255
-
256
-/**
257
- * Poll for completed and received packets
258
- *
259
- * @v netdev		Network device
260
- */
261
-static void mlx_poll ( struct net_device *netdev ) {
262
-	struct mlx_nic *mlx = netdev->priv;
263
-	int rc;
264
-
265
-	if ( ( rc = poll_error_buf() ) != 0 ) {
266
-		DBG ( "poll_error_buf() failed: %s\n", strerror ( rc ) );
267
-		return;
268
-	}
269
-
270
-	/* Drain event queue.  We can ignore events, since we're going
271
-	 * to just poll all completion queues anyway.
272
-	 */
273
-	if ( ( rc = drain_eq() ) != 0 ) {
274
-		DBG ( "drain_eq() failed: %s\n", strerror ( rc ) );
275
-		return;
276
-	}
277
-
278
-	/* Poll completion queues */
279
-	arbel_poll_cq ( &static_ibdev,
280
-#if CREATE_OWN
281
-			mlx->own_send_cq,
282
-#else
283
-			&static_ipoib_send_cq,
284
-#endif
285
-			temp_complete_send, temp_complete_recv );
286
-#if 0
287
-	arbel_poll_cq ( &static_ibdev,
288
-#if CREATE_OWN
289
-			mlx->own_recv_cq,
290
-#else
291
-			&static_ipoib_recv_cq,
292
-#endif
293
-			temp_complete_send, temp_complete_recv );
294
-#endif
295
-
296
-	mlx_refill_rx ( netdev );
297
-}
298
-
299
-/**
300
- * Enable or disable interrupts
301
- *
302
- * @v netdev		Network device
303
- * @v enable		Interrupts should be enabled
304
- */
305
-static void mlx_irq ( struct net_device *netdev, int enable ) {
306
-
307
-	( void ) netdev;
308
-	( void ) enable;
309
-
310
-}
311
-
312
-static struct net_device_operations mlx_operations = {
313
-	.open		= mlx_open,
314
-	.close		= mlx_close,
315
-	.transmit	= mlx_transmit_direct,
316
-	.poll		= mlx_poll,
317
-	.irq		= mlx_irq,
318
-};
319
-
320 38
 
321
-#endif /* 0 */
322 39
 
323 40
 
324 41
 
@@ -1030,6 +747,11 @@ static void arbel_ring_doorbell ( struct arbel *arbel,
1030 747
 	writel ( db_reg->dword[1], ( arbel->uar + offset + 4 ) );
1031 748
 }
1032 749
 
750
+/** GID used for GID-less send work queue entries */
751
+static const struct ib_gid arbel_no_gid = {
752
+	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 }
753
+};
754
+
1033 755
 /**
1034 756
  * Post send work queue entry
1035 757
  *
@@ -1500,193 +1222,6 @@ static int arbel_get_port_gid ( struct arbel *arbel, struct ib_gid *gid ) {
1500 1222
 
1501 1223
 
1502 1224
 
1503
-#if 0
1504
-
1505
-/**
1506
- * Probe PCI device
1507
- *
1508
- * @v pci		PCI device
1509
- * @v id		PCI ID
1510
- * @ret rc		Return status code
1511
- */
1512
-static int arbel_probe ( struct pci_device *pci,
1513
-			 const struct pci_device_id *id __unused ) {
1514
-	struct net_device *netdev;
1515
-	struct arbelprm_query_dev_lim dev_lim;
1516
-	struct arbel *arbel = &static_arbel;
1517
-	struct mlx_nic *mlx;
1518
-	struct ib_mac *mac;
1519
-	udqp_t qph;
1520
-	int rc;
1521
-
1522
-	/* Allocate net device */
1523
-	netdev = alloc_ibdev ( sizeof ( *mlx ) );
1524
-	if ( ! netdev )
1525
-		return -ENOMEM;
1526
-	netdev_init ( netdev, &mlx_operations );
1527
-	mlx = netdev->priv;
1528
-	pci_set_drvdata ( pci, netdev );
1529
-	netdev->dev = &pci->dev;
1530
-	memset ( mlx, 0, sizeof ( *mlx ) );
1531
-
1532
-	/* Fix up PCI device */
1533
-	adjust_pci_device ( pci );
1534
-
1535
-	/* Initialise hardware */
1536
-	if ( ( rc = ib_driver_init ( pci, &qph ) ) != 0 )
1537
-		goto err_ipoib_init;
1538
-	mlx->bcast_av = ib_data.bcast_av;
1539
-#if ! CREATE_OWN
1540
-	mlx->ipoib_qph = qph;
1541
-	mlx->snd_cqh = ib_data.ipoib_snd_cq;
1542
-	mlx->rcv_cqh = ib_data.ipoib_rcv_cq;
1543
-	mac = ( ( struct ib_mac * ) netdev->ll_addr );
1544
-	mac->qpn = htonl ( ib_get_qpn ( mlx->ipoib_qph ) );
1545
-	memcpy ( &mac->gid, ib_data.port_gid.raw, sizeof ( mac->gid ) );
1546
-#endif
1547
-
1548
-	/* Hack up IB structures */
1549
-	arbel->config = memfree_pci_dev.cr_space;
1550
-	arbel->mailbox_in = dev_buffers_p->inprm_buf;
1551
-	arbel->mailbox_out = dev_buffers_p->outprm_buf;
1552
-	arbel->uar = memfree_pci_dev.uar;
1553
-	arbel->db_rec = dev_ib_data.uar_context_base;
1554
-	arbel->reserved_lkey = dev_ib_data.mkey;
1555
-	arbel->eqn = dev_ib_data.eq.eqn;
1556
-#if ! CREATE_OWN
1557
-	static_arbel_ipoib_qp.send.wqe =
1558
-		( ( struct udqp_st * ) qph )->snd_wq;
1559
-	static_arbel_ipoib_qp.recv.wqe =
1560
-		( ( struct udqp_st * ) qph )->rcv_wq;
1561
-	static_arbel_ipoib_send_cq.cqe =
1562
-		( ( struct cq_st * ) ib_data.ipoib_snd_cq )->cq_buf;
1563
-	static_arbel_ipoib_recv_cq.cqe =
1564
-		( ( struct cq_st * ) ib_data.ipoib_rcv_cq )->cq_buf;
1565
-	static_ipoib_qp.qpn = ib_get_qpn ( qph );
1566
-	static_ipoib_qp.owner_priv = netdev;
1567
-	list_add ( &static_ipoib_qp.send.list,
1568
-		   &static_ipoib_send_cq.work_queues );
1569
-	list_add ( &static_ipoib_qp.recv.list,
1570
-		   &static_ipoib_recv_cq.work_queues );
1571
-#endif
1572
-	static_ibdev.op = &arbel_ib_operations;
1573
-
1574
-	/* Get device limits */
1575
-	if ( ( rc = arbel_cmd_query_dev_lim ( arbel, &dev_lim ) ) != 0 ) {
1576
-		DBGC ( arbel, "Arbel %p could not get device limits: %s\n",
1577
-		       arbel, strerror ( rc ) );
1578
-		goto err_query_dev_lim;
1579
-	}
1580
-	arbel->limits.reserved_uars = MLX_GET ( &dev_lim, num_rsvd_uars );
1581
-	arbel->limits.reserved_cqs =
1582
-		( 1 << MLX_GET ( &dev_lim, log2_rsvd_cqs ) );
1583
-	arbel->limits.reserved_qps =
1584
-		( 1 << MLX_GET ( &dev_lim, log2_rsvd_qps ) );
1585
-
1586
-#if CREATE_OWN
1587
-	struct ib_device *ibdev = &static_ibdev;
1588
-	mlx->own_send_cq = ib_create_cq ( ibdev, 32 );
1589
-	if ( ! mlx->own_send_cq ) {
1590
-		DBG ( "Could not create send CQ\n" );
1591
-		return -EIO;
1592
-	}
1593
-#if 0
1594
-	mlx->own_recv_cq = ib_create_cq ( ibdev, 32 );
1595
-	if ( ! mlx->own_recv_cq ) {
1596
-		DBG ( "Could not create send CQ\n" );
1597
-		return -EIO;
1598
-	}
1599
-#endif
1600
-	mlx->own_qp = ib_create_qp ( ibdev, NUM_IPOIB_SND_WQES,
1601
-				     mlx->own_send_cq, NUM_IPOIB_RCV_WQES,
1602
-				     //mlx->own_recv_cq, ipoib_qkey );
1603
-				     mlx->own_send_cq, ipoib_qkey );
1604
-	if ( ! mlx->own_qp ) {
1605
-		DBG ( "Could not create QP\n" );
1606
-		return -EIO;
1607
-	}
1608
-	mlx->own_qp->owner_priv = netdev;
1609
-	struct ib_gid *bcast_gid = ( struct ib_gid * ) &ib_data.bcast_gid;
1610
-	if ( ( rc = ib_mcast_attach ( ibdev, mlx->own_qp,
1611
-				      bcast_gid ) ) != 0 ) {
1612
-		DBG ( "Could not attach to broadcast GID: %s\n",
1613
-		      strerror ( rc ) );
1614
-		return rc;
1615
-	}
1616
-
1617
-	if ( ( rc = arbel_get_port_gid ( arbel, &ibdev->port_gid ) ) != 0 ) {
1618
-		DBGC ( arbel, "Arbel %p could not determine port GID: %s\n",
1619
-		       arbel, strerror ( rc ) );
1620
-		return rc;
1621
-	}
1622
-
1623
-	DBG ( "Port GID:\n" );
1624
-	DBG_HD ( &ibdev->port_gid, sizeof ( ibdev->port_gid ) );
1625
-		
1626
-
1627
-	mac = ( ( struct ib_mac * ) netdev->ll_addr );
1628
-	mac->qpn = htonl ( mlx->own_qp->qpn );
1629
-	memcpy ( &mac->gid, &ibdev->port_gid, sizeof ( mac->gid ) );	
1630
-#endif
1631
-
1632
-#if 0
1633
-	DBG ( "MADS SND CQN = %#lx\n", dev_ib_data.mads_qp.snd_cq.cqn );
1634
-	struct ib_completion_queue *test_cq;
1635
-	test_cq = ib_create_cq ( &static_ibdev, 32 );
1636
-	if ( test_cq ) {
1637
-		DBG ( "Woot: create_cq() passed!\n" );
1638
-	}
1639
-#endif
1640
-
1641
-	ibdev->dev = &pci->dev;
1642
-
1643
-
1644
-	struct ud_av_st *bcast_av = mlx->bcast_av;
1645
-	struct arbelprm_ud_address_vector *bav =
1646
-		( struct arbelprm_ud_address_vector * ) &bcast_av->av;
1647
-	struct ib_address_vector *av = &hack_ipoib_bcast_av;
1648
-	av->dest_qp = bcast_av->dest_qp;
1649
-	av->qkey = bcast_av->qkey;
1650
-	av->dlid = MLX_GET ( bav, rlid );
1651
-	av->rate = ( MLX_GET ( bav, max_stat_rate ) ? 1 : 4 );
1652
-	av->sl = MLX_GET ( bav, sl );
1653
-	av->gid_present = 1;
1654
-	memcpy ( &av->gid, ( ( void * ) bav ) + 16, 16 );
1655
-
1656
-
1657
-	/* Register network device */
1658
-	if ( ( rc = register_netdev ( netdev ) ) != 0 )
1659
-		goto err_register_netdev;
1660
-
1661
-	return 0;
1662
-
1663
- err_query_dev_lim:
1664
- err_register_netdev:
1665
- err_ipoib_init:
1666
-	ib_driver_close ( 0 );
1667
-	netdev_nullify ( netdev );
1668
-	netdev_put ( netdev );
1669
-	return rc;
1670
-}
1671
-
1672
-/**
1673
- * Remove PCI device
1674
- *
1675
- * @v pci		PCI device
1676
- */
1677
-static void arbel_remove ( struct pci_device *pci ) {
1678
-	struct net_device *netdev = pci_get_drvdata ( pci );
1679
-
1680
-	unregister_netdev ( netdev );
1681
-	ib_driver_close ( 0 );
1682
-	netdev_nullify ( netdev );
1683
-	netdev_put ( netdev );
1684
-}
1685
-
1686
-#endif /* 0 */
1687
-
1688
-
1689
-
1690 1225
 /**
1691 1226
  * Probe PCI device
1692 1227
  *

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

@@ -10,42 +10,6 @@
10 10
 #include <stdint.h>
11 11
 #include <gpxe/device.h>
12 12
 
13
-
14
-
15
-#if 0
16
-/** Infiniband MAC address length */
17
-#define IB_ALEN 20
18
-
19
-/** An Infiniband MAC address */
20
-struct ib_mac {
21
-	/** Queue pair number
22
-	 *
23
-	 * MSB must be zero; QPNs are only 24-bit.
24
-	 */
25
-	uint32_t qpn;
26
-	/** Port GID */
27
-	struct ib_gid gid;
28
-} __attribute__ (( packed ));
29
-
30
-/** Infiniband link-layer header length */
31
-#define IB_HLEN 4
32
-
33
-/** An Infiniband link-layer header */
34
-struct ibhdr {
35
-	/** Network-layer protocol */
36
-	uint16_t proto;
37
-	/** Reserved, must be zero */
38
-	uint16_t reserved;
39
-} __attribute__ (( packed ));
40
-#endif
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49 13
 /** An Infiniband Global Identifier */
50 14
 struct ib_gid {
51 15
 	uint8_t bytes[16];
@@ -511,31 +475,4 @@ union ib_mad {
511 475
 	struct ib_mad_port_info port_info;
512 476
 } __attribute__ (( packed ));
513 477
 
514
-
515
-
516
-
517
-#if 0
518
-
519
-extern struct ll_protocol infiniband_protocol;
520
-
521
-extern const char * ib_ntoa ( const void *ll_addr );
522
-
523
-/**
524
- * Allocate Infiniband device
525
- *
526
- * @v priv_size		Size of driver private data
527
- * @ret netdev		Network device, or NULL
528
- */
529
-static inline struct net_device * alloc_ibdev ( size_t priv_size ) {
530
-	struct net_device *netdev;
531
-
532
-	netdev = alloc_netdev ( priv_size );
533
-	if ( netdev ) {
534
-		netdev->ll_protocol = &infiniband_protocol;
535
-	}
536
-	return netdev;
537
-}
538
-
539
-#endif
540
-
541 478
 #endif /* _GPXE_INFINIBAND_H */

Loading…
Cancel
Save