david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

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

Currently this length is set at device allocation time, and is never
changed.
This commit is contained in:
Michael Brown 2008-10-15 00:49:59 +01:00
parent 64e5ca0582
commit 832668105e
4 changed files with 12 additions and 4 deletions

View File

@ -33,9 +33,6 @@
* IP over Infiniband * IP over Infiniband
*/ */
/** IPoIB MTU */
#define IPOIB_MTU 2048
/** Number of IPoIB data send work queue entries */ /** Number of IPoIB data send work queue entries */
#define IPOIB_DATA_NUM_SEND_WQES 2 #define IPOIB_DATA_NUM_SEND_WQES 2
@ -727,7 +724,7 @@ static void ipoib_refill_recv ( struct ipoib_device *ipoib,
int rc; int rc;
while ( qset->recv_fill < qset->recv_max_fill ) { while ( qset->recv_fill < qset->recv_max_fill ) {
iobuf = alloc_iob ( IPOIB_MTU ); iobuf = alloc_iob ( IPOIB_PKT_LEN );
if ( ! iobuf ) if ( ! iobuf )
break; break;
if ( ( rc = ib_post_recv ( ibdev, qset->qp, iobuf ) ) != 0 ) { if ( ( rc = ib_post_recv ( ibdev, qset->qp, iobuf ) ) != 0 ) {

View File

@ -9,6 +9,7 @@
#include <stdint.h> #include <stdint.h>
#include <gpxe/netdevice.h> #include <gpxe/netdevice.h>
#include <gpxe/if_ether.h>
extern struct ll_protocol ethernet_protocol; 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 ); netdev = alloc_netdev ( priv_size );
if ( netdev ) { if ( netdev ) {
netdev->ll_protocol = &ethernet_protocol; netdev->ll_protocol = &ethernet_protocol;
netdev->max_pkt_len = ETH_FRAME_LEN;
} }
return netdev; return netdev;
} }

View File

@ -8,6 +8,9 @@
#include <gpxe/infiniband.h> #include <gpxe/infiniband.h>
/** IPoIB packet length */
#define IPOIB_PKT_LEN 2048
/** IPoIB MAC address length */ /** IPoIB MAC address length */
#define IPOIB_ALEN 20 #define IPOIB_ALEN 20
@ -68,6 +71,7 @@ static inline struct net_device * alloc_ipoibdev ( size_t priv_size ) {
netdev = alloc_netdev ( priv_size ); netdev = alloc_netdev ( priv_size );
if ( netdev ) { if ( netdev ) {
netdev->ll_protocol = &ipoib_protocol; netdev->ll_protocol = &ipoib_protocol;
netdev->max_pkt_len = IPOIB_PKT_LEN;
} }
return netdev; return netdev;
} }

View File

@ -241,6 +241,11 @@ struct net_device {
* This is the bitwise-OR of zero or more NETDEV_XXX constants. * This is the bitwise-OR of zero or more NETDEV_XXX constants.
*/ */
unsigned int state; unsigned int state;
/** Maximum packet length
*
* This length includes any link-layer headers.
*/
size_t max_pkt_len;
/** TX packet queue */ /** TX packet queue */
struct list_head tx_queue; struct list_head tx_queue;
/** RX packet queue */ /** RX packet queue */