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.70 (requested by yamt in t...



details:   https://anonhg.NetBSD.org/src/rev/908c63bdaa4a
branches:  netbsd-3
changeset: 575363:908c63bdaa4a
user:      tron <tron%NetBSD.org@localhost>
date:      Wed Apr 13 21:34:57 2005 +0000

description:
Pull up revision 1.70 (requested by yamt in ticket #145):
when doing TSO, avoid to use duplicated ip_id heavily.
XXX ip_randomid

diffstat:

 sys/netinet/ip_var.h |  28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 4688e20fa0b7 -r 908c63bdaa4a sys/netinet/ip_var.h
--- a/sys/netinet/ip_var.h      Wed Apr 13 21:34:51 2005 +0000
+++ b/sys/netinet/ip_var.h      Wed Apr 13 21:34:57 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_var.h,v 1.69 2004/12/15 04:25:19 thorpej Exp $      */
+/*     $NetBSD: ip_var.h,v 1.69.8.1 2005/04/13 21:34:57 tron Exp $     */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -263,13 +263,33 @@
 u_int16_t ip_randomid(void);
 extern int ip_do_randomid;
 
+/*
+ * ip_newid_range: "allocate" num contiguous ip_ids.
+ *
+ * => return the first id.
+ */
+
+static __inline uint16_t
+ip_newid_range(unsigned int num)
+{
+       uint16_t id;
+
+       if (ip_do_randomid) {
+               /* XXX ignore num */
+               return ip_randomid();
+       }
+
+       id = htons(ip_id);
+       ip_id += num;
+
+       return id;
+}
+
 static __inline uint16_t
 ip_newid(void)
 {
-       if (ip_do_randomid)
-               return ip_randomid();
 
-       return htons(ip_id++);
+       return ip_newid_range(1);
 }
 
 #endif  /* _KERNEL */



Home | Main Index | Thread Index | Old Index