@@ -445,6 +445,16 @@ struct icmp_hdr {
#define IP_ICMP_HDR_SIZE (IP_HDR_SIZE + ICMP_HDR_SIZE)
/*
+ * Headroom to allow for driver specific usage in transmitted
+ * packets.
+ */
+#ifndef CONFIG_NET_HEADROOM
+# define PKT_HEADROOM 0
+#else
+# define PKT_HEADROOM CONFIG_NET_HEADROOM
+#endif
+
+/*
* Maximum packet size; used to allocate packet storage.
* TFTP packets can be 524 bytes + IP header + ethernet header.
* Lets be conservative, and go for 38 * 16. (Must also be
@@ -457,7 +467,7 @@ struct icmp_hdr {
* maximum packet size and multiple of 32 bytes = 1536
*/
#define PKTSIZE 1518
-#define PKTSIZE_ALIGN 1536
+#define PKTSIZE_ALIGN (1536 + PKT_HEADROOM)
/*#define PKTSIZE 608*/
/*
@@ -32,4 +32,16 @@ config NET_TFTP_VARS
If unset, timeout and maximum are hard-defined as 1 second
and 10 timouts per TFTP transfer.
+config NET_HEADROOM
+ int "Extra headroom in packets"
+ default 0
+ help
+ Some network devices/drivers need to insert special tags
+ in packets as they are transmitted. This option determines
+ how much headroom to provide. The specified value should
+ meet the dma memory alignment requirements for the platform.
+
+ Unless you are using one of these devices it is safe to
+ leave this unset.
+
endif # if NET
@@ -45,7 +45,7 @@ void arp_init(void)
net_arp_wait_packet_ip.s_addr = 0;
net_arp_wait_reply_ip.s_addr = 0;
arp_wait_tx_packet_size = 0;
- arp_tx_packet = &arp_tx_packet_buf[0] + (PKTALIGN - 1);
+ arp_tx_packet = &arp_tx_packet_buf[PKT_HEADROOM] + (PKTALIGN - 1);
arp_tx_packet -= (ulong)arp_tx_packet % PKTALIGN;
}
@@ -370,7 +370,7 @@ void net_init(void)
*/
int i;
- net_tx_packet = &net_pkt_buf[0] + (PKTALIGN - 1);
+ net_tx_packet = &net_pkt_buf[PKT_HEADROOM] + (PKTALIGN - 1);
net_tx_packet -= (ulong)net_tx_packet % PKTALIGN;
for (i = 0; i < PKTBUFSRX; i++) {
net_rx_packets[i] = net_tx_packet +