Переглянути джерело

[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 роки тому
джерело
коміт
832668105e

+ 1
- 4
src/drivers/net/ipoib.c Переглянути файл

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

+ 2
- 0
src/include/gpxe/ethernet.h Переглянути файл

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

+ 4
- 0
src/include/gpxe/ipoib.h Переглянути файл

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

+ 5
- 0
src/include/gpxe/netdevice.h Переглянути файл

@@ -241,6 +241,11 @@ struct net_device {
241 241
 	 * This is the bitwise-OR of zero or more NETDEV_XXX constants.
242 242
 	 */
243 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 249
 	/** TX packet queue */
245 250
 	struct list_head tx_queue;
246 251
 	/** RX packet queue */

Завантаження…
Відмінити
Зберегти