Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-3]: src/sys/netinet Pull up revision 1.150 (requested by yamt in ...
details: https://anonhg.NetBSD.org/src/rev/4688e20fa0b7
branches: netbsd-3
changeset: 575362:4688e20fa0b7
user: tron <tron%NetBSD.org@localhost>
date: Wed Apr 13 21:34:51 2005 +0000
description:
Pull up revision 1.150 (requested by yamt in ticket #145):
when doing TSO, avoid to use duplicated ip_id heavily.
XXX ip_randomid
diffstat:
sys/netinet/ip_output.c | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
diffs (46 lines):
diff -r 7325acec4a14 -r 4688e20fa0b7 sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c Wed Apr 13 21:33:35 2005 +0000
+++ b/sys/netinet/ip_output.c Wed Apr 13 21:34:51 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_output.c,v 1.149 2005/03/11 17:07:51 matt Exp $ */
+/* $NetBSD: ip_output.c,v 1.149.2.1 2005/04/13 21:34:51 tron Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -98,7 +98,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.149 2005/03/11 17:07:51 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.149.2.1 2005/04/13 21:34:51 tron Exp $");
#include "opt_pfil_hooks.h"
#include "opt_inet.h"
@@ -235,7 +235,26 @@
if ((flags & (IP_FORWARDING|IP_RAWOUTPUT)) == 0) {
ip->ip_v = IPVERSION;
ip->ip_off = htons(0);
- ip->ip_id = ip_newid();
+ if ((m->m_pkthdr.csum_flags & M_CSUM_TSOv4) == 0) {
+ ip->ip_id = ip_newid();
+ } else {
+
+ /*
+ * TSO capable interfaces (typically?) increment
+ * ip_id for each segment.
+ * "allocate" enough ids here to increase the chance
+ * for them to be unique.
+ *
+ * note that the following calculation is not
+ * needed to be precise. wasting some ip_id is fine.
+ */
+
+ unsigned int segsz = m->m_pkthdr.segsz;
+ unsigned int datasz = ntohs(ip->ip_len) - hlen;
+ unsigned int num = howmany(datasz, segsz);
+
+ ip->ip_id = ip_newid_range(num);
+ }
ip->ip_hl = hlen >> 2;
ipstat.ips_localout++;
} else {
Home |
Main Index |
Thread Index |
Old Index