summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown2008-10-15 01:49:59 +0200
committerMichael Brown2008-10-16 06:11:47 +0200
commit832668105e22c42f965970078124cdc2c556ac0d (patch)
tree67984083b52c5fd499f19d9fd9f82b834d03e55b /src
parent[efi] Fix linker script for ld 2.17.50.0.9 (diff)
downloadipxe-832668105e22c42f965970078124cdc2c556ac0d.tar.gz
ipxe-832668105e22c42f965970078124cdc2c556ac0d.tar.xz
ipxe-832668105e22c42f965970078124cdc2c556ac0d.zip
[netdevice] Add maximum packet length as a net device property
Currently this length is set at device allocation time, and is never changed.
Diffstat (limited to 'src')
-rw-r--r--src/drivers/net/ipoib.c5
-rw-r--r--src/include/gpxe/ethernet.h2
-rw-r--r--src/include/gpxe/ipoib.h4
-rw-r--r--src/include/gpxe/netdevice.h5
4 files changed, 12 insertions, 4 deletions
diff --git a/src/drivers/net/ipoib.c b/src/drivers/net/ipoib.c
index 16b2a0c8..9c9bc918 100644
--- a/src/drivers/net/ipoib.c
+++ b/src/drivers/net/ipoib.c
@@ -33,9 +33,6 @@
* IP over Infiniband
*/
-/** IPoIB MTU */
-#define IPOIB_MTU 2048
-
/** Number of IPoIB data send work queue entries */
#define IPOIB_DATA_NUM_SEND_WQES 2
@@ -727,7 +724,7 @@ static void ipoib_refill_recv ( struct ipoib_device *ipoib,
int rc;
while ( qset->recv_fill < qset->recv_max_fill ) {
- iobuf = alloc_iob ( IPOIB_MTU );
+ iobuf = alloc_iob ( IPOIB_PKT_LEN );
if ( ! iobuf )
break;
if ( ( rc = ib_post_recv ( ibdev, qset->qp, iobuf ) ) != 0 ) {
diff --git a/src/include/gpxe/ethernet.h b/src/include/gpxe/ethernet.h
index 158fe066..ff0fd6c1 100644
--- a/src/include/gpxe/ethernet.h
+++ b/src/include/gpxe/ethernet.h
@@ -9,6 +9,7 @@
#include <stdint.h>
#include <gpxe/netdevice.h>
+#include <gpxe/if_ether.h>
extern struct ll_protocol ethernet_protocol;
@@ -26,6 +27,7 @@ static inline struct net_device * alloc_etherdev ( size_t priv_size ) {
netdev = alloc_netdev ( priv_size );
if ( netdev ) {
netdev->ll_protocol = &ethernet_protocol;
+ netdev->max_pkt_len = ETH_FRAME_LEN;
}
return netdev;
}
diff --git a/src/include/gpxe/ipoib.h b/src/include/gpxe/ipoib.h
index bcbdc4c6..3ec464e3 100644
--- a/src/include/gpxe/ipoib.h
+++ b/src/include/gpxe/ipoib.h
@@ -8,6 +8,9 @@
#include <gpxe/infiniband.h>
+/** IPoIB packet length */
+#define IPOIB_PKT_LEN 2048
+
/** IPoIB MAC address length */
#define IPOIB_ALEN 20
@@ -68,6 +71,7 @@ static inline struct net_device * alloc_ipoibdev ( size_t priv_size ) {
netdev = alloc_netdev ( priv_size );
if ( netdev ) {
netdev->ll_protocol = &ipoib_protocol;
+ netdev->max_pkt_len = IPOIB_PKT_LEN;
}
return netdev;
}
diff --git a/src/include/gpxe/netdevice.h b/src/include/gpxe/netdevice.h
index cdc8cbad..9f39e0c9 100644
--- a/src/include/gpxe/netdevice.h
+++ b/src/include/gpxe/netdevice.h
@@ -241,6 +241,11 @@ struct net_device {
* This is the bitwise-OR of zero or more NETDEV_XXX constants.
*/
unsigned int state;
+ /** Maximum packet length
+ *
+ * This length includes any link-layer headers.
+ */
+ size_t max_pkt_len;
/** TX packet queue */
struct list_head tx_queue;
/** RX packet queue */