Browse Source

Remove some dead code

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
75fbc96f75
1 changed files with 10 additions and 245 deletions
  1. 10
    245
      src/drivers/net/mlx_ipoib/mt25218.c

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

@@ -21,7 +21,6 @@ Skeleton NIC driver for Etherboot
21 21
 /* to get the interface to the body of the program */
22 22
 #include "nic.h"
23 23
 
24
-#include "mt_version.c"
25 24
 #include "mt25218_imp.c"
26 25
 
27 26
 struct mlx_nic {
@@ -35,133 +34,6 @@ struct mlx_nic {
35 34
 	cq_t rcv_cqh;
36 35
 };
37 36
 
38
-int prompt_key(int secs, unsigned char *ch_p)
39
-{
40
-	unsigned long tmo;
41
-	unsigned char ch;
42
-
43
-	for (tmo = currticks() + secs * TICKS_PER_SEC; currticks() < tmo;) {
44
-		if (iskey()) {
45
-			ch = getchar();
46
-			/* toupper does not work ... */
47
-			if (ch == 'v')
48
-				ch = 'V';
49
-			if (ch == 'i')
50
-				ch = 'I';
51
-			if ((ch=='V') || (ch=='I')) {
52
-				*ch_p = ch;
53
-				return 1;
54
-			}
55
-		}
56
-	}
57
-
58
-	return 0;
59
-}
60
-
61
-#if 0
62
-/**************************************************************************
63
-IRQ - handle interrupts
64
-***************************************************************************/
65
-static void mt25218_irq(struct nic *nic, irq_action_t action)
66
-{
67
-	/* This routine is somewhat optional.  Etherboot itself
68
-	 * doesn't use interrupts, but they are required under some
69
-	 * circumstances when we're acting as a PXE stack.
70
-	 *
71
-	 * If you don't implement this routine, the only effect will
72
-	 * be that your driver cannot be used via Etherboot's UNDI
73
-	 * API.  This won't affect programs that use only the UDP
74
-	 * portion of the PXE API, such as pxelinux.
75
-	 */
76
-
77
-	if (0) {
78
-		nic = NULL;
79
-	}
80
-	switch (action) {
81
-	case DISABLE:
82
-	case ENABLE:
83
-		/* Set receive interrupt enabled/disabled state */
84
-		/*
85
-		   outb ( action == ENABLE ? IntrMaskEnabled : IntrMaskDisabled,
86
-		   nic->ioaddr + IntrMaskRegister );
87
-		 */
88
-		break;
89
-	case FORCE:
90
-		/* Force NIC to generate a receive interrupt */
91
-		/*
92
-		   outb ( ForceInterrupt, nic->ioaddr + IntrForceRegister );
93
-		 */
94
-		break;
95
-	}
96
-}
97
-
98
-/**************************************************************************
99
-POLL - Wait for a frame
100
-***************************************************************************/
101
-static int mt25218_poll(struct nic *nic, int retrieve)
102
-{
103
-	/* Work out whether or not there's an ethernet packet ready to
104
-	 * read.  Return 0 if not.
105
-	 */
106
-	/* 
107
-	   if ( ! <packet_ready> ) return 0;
108
-	 */
109
-
110
-	/* retrieve==0 indicates that we are just checking for the
111
-	 * presence of a packet but don't want to read it just yet.
112
-	 */
113
-	/*
114
-	   if ( ! retrieve ) return 1;
115
-	 */
116
-
117
-	/* Copy data to nic->packet.  Data should include the
118
-	 * link-layer header (dest MAC, source MAC, type).
119
-	 * Store length of data in nic->packetlen.
120
-	 * Return true to indicate a packet has been read.
121
-	 */
122
-	/* 
123
-	   nic->packetlen = <packet_length>;
124
-	   memcpy ( nic->packet, <packet_data>, <packet_length> );
125
-	   return 1;
126
-	 */
127
-	unsigned int size;
128
-	int rc;
129
-	rc = poll_imp(nic, retrieve, &size);
130
-	if (rc) {
131
-		return 0;
132
-	}
133
-
134
-	if (size == 0) {
135
-		return 0;
136
-	}
137
-
138
-	nic->packetlen = size;
139
-
140
-	return 1;
141
-}
142
-
143
-/**************************************************************************
144
-TRANSMIT - Transmit a frame
145
-***************************************************************************/
146
-static void mt25218_transmit(struct nic *nic, const char *dest,	/* Destination */
147
-			     unsigned int type,	/* Type */
148
-			     unsigned int size,	/* size */
149
-			     const char *packet)
150
-{				/* Packet */
151
-	int rc;
152
-
153
-	/* Transmit packet to dest MAC address.  You will need to
154
-	 * construct the link-layer header (dest MAC, source MAC,
155
-	 * type).
156
-	 */
157
-	if (nic) {
158
-		rc = transmit_imp(dest, type, packet, size);
159
-		if (rc)
160
-			eprintf("tranmit error");
161
-	}
162
-}
163
-#endif
164
-
165 37
 /**
166 38
  * Open network device
167 39
  *
@@ -219,23 +91,6 @@ static int mlx_transmit ( struct net_device *netdev,
219 91
 	}
220 92
 
221 93
 	return 0;
222
-
223
-#if 0
224
-	( void ) netdev;
225
-
226
-	iob_pull ( iobuf, sizeof ( *ibhdr ) );	
227
-
228
-	if ( memcmp ( ibhdr->peer, ib_broadcast, IB_ALEN ) == 0 ) {
229
-		printf ( "Sending broadcast packet\n" );
230
-		return send_bcast_packet ( ntohs ( ibhdr->proto ),
231
-					   iobuf->data, iob_len ( iobuf ) );
232
-	} else {
233
-		printf ( "Sending unicast packet\n" );
234
-		return send_ucast_packet ( ibhdr->peer,
235
-					   ntohs ( ibhdr->proto ),
236
-					   iobuf->data, iob_len ( iobuf ) );
237
-	}
238
-#endif
239 94
 }
240 95
 
241 96
 /**
@@ -275,14 +130,12 @@ static void mlx_rx_complete ( struct net_device *netdev,
275 130
 		netdev_rx_err ( netdev, NULL, -ENOMEM );
276 131
 		return;
277 132
 	}
133
+
134
+	/* Fill I/O buffer */
278 135
 	buf = get_rcv_wqe_buf ( ib_cqe->wqe, 1 );
279 136
 	memcpy ( iob_put ( iobuf, len ), buf, len );
280
-	//	DBG ( "Received packet header:\n" );
281
-	//	struct recv_wqe_st *rcv_wqe = ib_cqe.wqe;
282
-	//	DBG_HD ( get_rcv_wqe_buf(ib_cqe.wqe, 0),
283
-	//		 be32_to_cpu(rcv_wqe->mpointer[0].byte_count) );
284
-	//	DBG ( "Received packet:\n" );
285
-	//	DBG_HD ( iobuf->data, iob_len ( iobuf ) );
137
+
138
+	/* Hand off to network stack */
286 139
 	netdev_rx ( netdev, iobuf );
287 140
 }
288 141
 
@@ -335,11 +188,15 @@ static void mlx_poll ( struct net_device *netdev ) {
335 188
 		return;
336 189
 	}
337 190
 
191
+	/* Drain event queue.  We can ignore events, since we're going
192
+	 * to just poll all completion queues anyway.
193
+	 */
338 194
 	if ( ( rc = drain_eq() ) != 0 ) {
339 195
 		DBG ( "drain_eq() failed: %s\n", strerror ( rc ) );
340 196
 		return;
341 197
 	}
342 198
 
199
+	/* Poll completion queues */
343 200
 	mlx_poll_cq ( netdev, mlx->snd_cqh, mlx_tx_complete );
344 201
 	mlx_poll_cq ( netdev, mlx->rcv_cqh, mlx_rx_complete );
345 202
 }
@@ -365,28 +222,6 @@ static struct net_device_operations mlx_operations = {
365 222
 	.irq		= mlx_irq,
366 223
 };
367 224
 
368
-#if 0
369
-/**************************************************************************
370
-DISABLE - Turn off ethernet interface
371
-***************************************************************************/
372
-static void mt25218_disable(struct nic *nic)
373
-{
374
-	/* put the card in its initial state */
375
-	/* This function serves 3 purposes.
376
-	 * This disables DMA and interrupts so we don't receive
377
-	 *  unexpected packets or interrupts from the card after
378
-	 *  etherboot has finished. 
379
-	 * This frees resources so etherboot may use
380
-	 *  this driver on another interface
381
-	 * This allows etherboot to reinitialize the interface
382
-	 *  if something is something goes wrong.
383
-	 */
384
-	if (nic || 1) {		// ????
385
-		disable_imp();
386
-	}
387
-}
388
-#endif
389
-
390 225
 /**
391 226
  * Remove PCI device
392 227
  *
@@ -401,76 +236,6 @@ static void mlx_remove ( struct pci_device *pci ) {
401 236
 	netdev_put ( netdev );
402 237
 }
403 238
 
404
-#if 0
405
-static struct nic_operations mt25218_operations = {
406
-	.connect	= dummy_connect,
407
-	.poll		= mt25218_poll,
408
-	.transmit	= mt25218_transmit,
409
-	.irq		= mt25218_irq,
410
-};
411
-
412
-/**************************************************************************
413
-PROBE - Look for an adapter, this routine's visible to the outside
414
-***************************************************************************/
415
-
416
-static int mt25218_probe(struct nic *nic, struct pci_device *pci)
417
-{
418
-	int rc;
419
-	unsigned char user_request;
420
-
421
-	if (pci->vendor != MELLANOX_VENDOR_ID) {
422
-		eprintf("");
423
-		return 0;
424
-	}
425
-
426
-	printf("\n");
427
-	printf("Mellanox Technologies LTD - Boot over IB implementaion\n");
428
-	printf("Build version = %s\n\n", build_revision);
429
-
430
-	verbose_messages = 0;
431
-        print_info = 0;
432
-	printf("Press within 3 seconds:\n");
433
-	printf("V - to increase verbosity\n");
434
-	printf("I - to print information\n");
435
-	if (prompt_key(3, &user_request)) {
436
-		if (user_request == 'V') {
437
-			printf("User selected verbose messages\n");
438
-			verbose_messages = 1;
439
-		}
440
-		else if (user_request == 'I') {
441
-			printf("User selected to print information\n");
442
-			print_info = 1;
443
-		}
444
-	}
445
-	printf("\n");
446
-
447
-	adjust_pci_device(pci);
448
-
449
-	nic->priv_data = NULL;
450
-	rc = probe_imp(pci, nic);
451
-
452
-	/* give the user a chance to look at the info */
453
-	if (print_info)
454
-		sleep(5);
455
-
456
-	if (!rc) {
457
-		/* store NIC parameters */
458
-		nic->ioaddr = pci->ioaddr & ~3;
459
-		nic->irqno = pci->irq;
460
-		/* point to NIC specific routines */
461
-		nic->nic_op = &mt25218_operations;
462
-
463
-		uint8_t fixed_node_addr[ETH_ALEN] = { 0x00, 0x02, 0xc9,
464
-						      0x20, 0xf5, 0x95 };
465
-		memcpy ( nic->node_addr, fixed_node_addr, ETH_ALEN );
466
-
467
-		return 1;
468
-	}
469
-	/* else */
470
-	return 0;
471
-}
472
-#endif
473
-
474 239
 /**
475 240
  * Probe PCI device
476 241
  *
@@ -525,8 +290,8 @@ static int mlx_probe ( struct pci_device *pci,
525 290
 }
526 291
 
527 292
 static struct pci_device_id mlx_nics[] = {
528
-	PCI_ROM(0x15b3, 0x6282, "MT25218", "MT25218 HCA driver"),
529
-	PCI_ROM(0x15b3, 0x6274, "MT25204", "MT25204 HCA driver"),
293
+	PCI_ROM ( 0x15b3, 0x6282, "MT25218", "MT25218 HCA driver" ),
294
+	PCI_ROM ( 0x15b3, 0x6274, "MT25204", "MT25204 HCA driver" ),
530 295
 };
531 296
 
532 297
 struct pci_driver mlx_driver __pci_driver = {

Loading…
Cancel
Save