浏览代码

Make PKB_ZLEN the minimum possible size of packet buffer (to allow for

hardware that can't autopad).
tags/v0.9.3
Michael Brown 18 年前
父节点
当前提交
6c50564724
共有 2 个文件被更改,包括 13 次插入0 次删除
  1. 9
    0
      src/include/gpxe/pkbuff.h
  2. 4
    0
      src/net/pkbuff.c

+ 9
- 0
src/include/gpxe/pkbuff.h 查看文件

@@ -28,6 +28,15 @@ struct ll_protocol;
28 28
  */
29 29
 #define PKBUFF_ALIGN 2048
30 30
 
31
+/**
32
+ * Minimum packet buffer length
33
+ *
34
+ * alloc_pkb() will round up the allocated length to this size if
35
+ * necessary.  This is used on behalf of hardware that is not capable
36
+ * of auto-padding.
37
+ */
38
+#define PKB_ZLEN 64
39
+
31 40
 /** A packet buffer
32 41
  *
33 42
  * This structure is used to represent a network packet within gPXE.

+ 4
- 0
src/net/pkbuff.c 查看文件

@@ -39,6 +39,10 @@ struct pk_buff * alloc_pkb ( size_t len ) {
39 39
 	struct pk_buff *pkb = NULL;
40 40
 	void *data;
41 41
 
42
+	/* Pad to minimum length */
43
+	if ( len < PKB_ZLEN )
44
+		len = PKB_ZLEN;
45
+
42 46
 	/* Align buffer length */
43 47
 	len = ( len + __alignof__( *pkb ) - 1 ) & ~( __alignof__( *pkb ) - 1 );
44 48
 	

正在加载...
取消
保存