Browse Source

[netdevice] Add maximum packet length as a net device property

Currently this length is set at device allocation time, and is never
changed.
tags/v0.9.6
Michael Brown 16 years ago
parent
commit
832668105e

+ 1
- 4
src/drivers/net/ipoib.c View File

33
  * IP over Infiniband
33
  * IP over Infiniband
34
  */
34
  */
35
 
35
 
36
-/** IPoIB MTU */
37
-#define IPOIB_MTU 2048
38
-
39
 /** Number of IPoIB data send work queue entries */
36
 /** Number of IPoIB data send work queue entries */
40
 #define IPOIB_DATA_NUM_SEND_WQES 2
37
 #define IPOIB_DATA_NUM_SEND_WQES 2
41
 
38
 
727
 	int rc;
724
 	int rc;
728
 
725
 
729
 	while ( qset->recv_fill < qset->recv_max_fill ) {
726
 	while ( qset->recv_fill < qset->recv_max_fill ) {
730
-		iobuf = alloc_iob ( IPOIB_MTU );
727
+		iobuf = alloc_iob ( IPOIB_PKT_LEN );
731
 		if ( ! iobuf )
728
 		if ( ! iobuf )
732
 			break;
729
 			break;
733
 		if ( ( rc = ib_post_recv ( ibdev, qset->qp, iobuf ) ) != 0 ) {
730
 		if ( ( rc = ib_post_recv ( ibdev, qset->qp, iobuf ) ) != 0 ) {

+ 2
- 0
src/include/gpxe/ethernet.h View File

9
 
9
 
10
 #include <stdint.h>
10
 #include <stdint.h>
11
 #include <gpxe/netdevice.h>
11
 #include <gpxe/netdevice.h>
12
+#include <gpxe/if_ether.h>
12
 
13
 
13
 extern struct ll_protocol ethernet_protocol;
14
 extern struct ll_protocol ethernet_protocol;
14
 
15
 
26
 	netdev = alloc_netdev ( priv_size );
27
 	netdev = alloc_netdev ( priv_size );
27
 	if ( netdev ) {
28
 	if ( netdev ) {
28
 		netdev->ll_protocol = &ethernet_protocol;
29
 		netdev->ll_protocol = &ethernet_protocol;
30
+		netdev->max_pkt_len = ETH_FRAME_LEN;
29
 	}
31
 	}
30
 	return netdev;
32
 	return netdev;
31
 }
33
 }

+ 4
- 0
src/include/gpxe/ipoib.h View File

8
 
8
 
9
 #include <gpxe/infiniband.h>
9
 #include <gpxe/infiniband.h>
10
 
10
 
11
+/** IPoIB packet length */
12
+#define IPOIB_PKT_LEN 2048
13
+
11
 /** IPoIB MAC address length */
14
 /** IPoIB MAC address length */
12
 #define IPOIB_ALEN 20
15
 #define IPOIB_ALEN 20
13
 
16
 
68
 	netdev = alloc_netdev ( priv_size );
71
 	netdev = alloc_netdev ( priv_size );
69
 	if ( netdev ) {
72
 	if ( netdev ) {
70
 		netdev->ll_protocol = &ipoib_protocol;
73
 		netdev->ll_protocol = &ipoib_protocol;
74
+		netdev->max_pkt_len = IPOIB_PKT_LEN;
71
 	}
75
 	}
72
 	return netdev;
76
 	return netdev;
73
 }
77
 }

+ 5
- 0
src/include/gpxe/netdevice.h View File

241
 	 * This is the bitwise-OR of zero or more NETDEV_XXX constants.
241
 	 * This is the bitwise-OR of zero or more NETDEV_XXX constants.
242
 	 */
242
 	 */
243
 	unsigned int state;
243
 	unsigned int state;
244
+	/** Maximum packet length
245
+	 *
246
+	 * This length includes any link-layer headers.
247
+	 */
248
+	size_t max_pkt_len;
244
 	/** TX packet queue */
249
 	/** TX packet queue */
245
 	struct list_head tx_queue;
250
 	struct list_head tx_queue;
246
 	/** RX packet queue */
251
 	/** RX packet queue */

Loading…
Cancel
Save