mirror of
https://github.com/ipxe/ipxe
synced 2025-12-19 19:49:45 +03:00
Make PKB_ZLEN the minimum possible size of packet buffer (to allow for
hardware that can't autopad).
This commit is contained in:
@@ -28,6 +28,15 @@ struct ll_protocol;
|
|||||||
*/
|
*/
|
||||||
#define PKBUFF_ALIGN 2048
|
#define PKBUFF_ALIGN 2048
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimum packet buffer length
|
||||||
|
*
|
||||||
|
* alloc_pkb() will round up the allocated length to this size if
|
||||||
|
* necessary. This is used on behalf of hardware that is not capable
|
||||||
|
* of auto-padding.
|
||||||
|
*/
|
||||||
|
#define PKB_ZLEN 64
|
||||||
|
|
||||||
/** A packet buffer
|
/** A packet buffer
|
||||||
*
|
*
|
||||||
* This structure is used to represent a network packet within gPXE.
|
* This structure is used to represent a network packet within gPXE.
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ struct pk_buff * alloc_pkb ( size_t len ) {
|
|||||||
struct pk_buff *pkb = NULL;
|
struct pk_buff *pkb = NULL;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
|
/* Pad to minimum length */
|
||||||
|
if ( len < PKB_ZLEN )
|
||||||
|
len = PKB_ZLEN;
|
||||||
|
|
||||||
/* Align buffer length */
|
/* Align buffer length */
|
||||||
len = ( len + __alignof__( *pkb ) - 1 ) & ~( __alignof__( *pkb ) - 1 );
|
len = ( len + __alignof__( *pkb ) - 1 ) & ~( __alignof__( *pkb ) - 1 );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user