Skip to content

Commit

Permalink
[netdevice] Add maximum packet length as a net device property
Browse files Browse the repository at this point in the history
Currently this length is set at device allocation time, and is never
changed.
  • Loading branch information
Michael Brown committed Oct 16, 2008
1 parent 64e5ca0 commit 8326681
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/drivers/net/ipoib.c
Expand Up @@ -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

Expand Down Expand Up @@ -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 ) {
Expand Down
2 changes: 2 additions & 0 deletions src/include/gpxe/ethernet.h
Expand Up @@ -9,6 +9,7 @@

#include <stdint.h>
#include <gpxe/netdevice.h>
#include <gpxe/if_ether.h>

extern struct ll_protocol ethernet_protocol;

Expand All @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions src/include/gpxe/ipoib.h
Expand Up @@ -8,6 +8,9 @@

#include <gpxe/infiniband.h>

/** IPoIB packet length */
#define IPOIB_PKT_LEN 2048

/** IPoIB MAC address length */
#define IPOIB_ALEN 20

Expand Down Expand Up @@ -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;
}
Expand Down
5 changes: 5 additions & 0 deletions src/include/gpxe/netdevice.h
Expand Up @@ -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 */
Expand Down

0 comments on commit 8326681

Please sign in to comment.