Преглед на файлове

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
 	

Loading…
Отказ
Запис