Ver código fonte

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 anos atrás
pai
commit
6c50564724
2 arquivos alterados com 13 adições e 0 exclusões
  1. 9
    0
      src/include/gpxe/pkbuff.h
  2. 4
    0
      src/net/pkbuff.c

+ 9
- 0
src/include/gpxe/pkbuff.h Ver arquivo

@@ -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 Ver arquivo

@@ -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
 	

Carregando…
Cancelar
Salvar