summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2024-03-17 00:25:07 +0100
committerMichael Brown2024-03-17 00:28:34 +0100
commitbac967d51a8851ef274da6aa7a3a9711de0bb056 (patch)
treea245646f5ced5b1f1ca00efdc186c257ad17059a
parent[ucode] Add support for updating x86 microcode (diff)
downloadipxe-bac967d51a8851ef274da6aa7a3a9711de0bb056.tar.gz
ipxe-bac967d51a8851ef274da6aa7a3a9711de0bb056.tar.xz
ipxe-bac967d51a8851ef274da6aa7a3a9711de0bb056.zip
[snp] Allocate additional padding for receive buffers
Some SNP implementations (observed with a wifi adapter in a Dell Latitude 3440 laptop) seem to require additional space in the allocated receive buffers, otherwise full-length packets will be silently dropped. The EDK2 MnpDxe driver happens to allocate an additional 8 bytes of padding (4 for a VLAN tag, 4 for the Ethernet frame checksum). Match this behaviour since drivers are very likely to have been tested against MnpDxe. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/drivers/net/efi/snpnet.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/drivers/net/efi/snpnet.c b/src/drivers/net/efi/snpnet.c
index 3b09d491..c66aa7d2 100644
--- a/src/drivers/net/efi/snpnet.c
+++ b/src/drivers/net/efi/snpnet.c
@@ -71,6 +71,19 @@ struct snp_nic {
/** Delay between each initialisation retry */
#define SNP_INITIALIZE_RETRY_DELAY_MS 10
+/** Additional padding for receive buffers
+ *
+ * Some SNP implementations seem to require additional space in the
+ * allocated receive buffers, otherwise full-length packets will be
+ * silently dropped.
+ *
+ * The EDK2 MnpDxe driver happens to allocate an additional 8 bytes of
+ * padding (4 for a VLAN tag, 4 for the Ethernet frame checksum).
+ * Match this behaviour since drivers are very likely to have been
+ * tested against MnpDxe.
+ */
+#define SNP_RX_PAD 8
+
/**
* Format SNP MAC address (for debugging)
*
@@ -246,7 +259,7 @@ static void snpnet_poll_rx ( struct net_device *netdev ) {
/* Allocate buffer, if required */
if ( ! snp->rxbuf ) {
- snp->rxbuf = alloc_iob ( snp->mtu );
+ snp->rxbuf = alloc_iob ( snp->mtu + SNP_RX_PAD );
if ( ! snp->rxbuf ) {
/* Leave for next poll */
break;