Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Make if_loop MTU settable via SIOCSFMTU/ifconfig. Us...



details:   https://anonhg.NetBSD.org/src/rev/d0a068abe88a
branches:  trunk
changeset: 550652:d0a068abe88a
user:      jonathan <jonathan%NetBSD.org@localhost>
date:      Fri Aug 15 19:22:08 2003 +0000

description:
Make if_loop MTU settable via SIOCSFMTU/ifconfig. Useful for testing,
and for regression-testing performance at various MTUs.

NB: route MTU may not track MTU changes, which may cause problems for
AF_ISO if loopback MTU is decreased. I've never seen problems with IP,
in various tests going back to around NetBSD 1.3.

diffstat:

 sys/net/if_loop.c |  20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diffs (58 lines):

diff -r bfda355cda49 -r d0a068abe88a sys/net/if_loop.c
--- a/sys/net/if_loop.c Fri Aug 15 17:22:23 2003 +0000
+++ b/sys/net/if_loop.c Fri Aug 15 19:22:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_loop.c,v 1.47 2003/08/07 16:32:53 agc Exp $ */
+/*     $NetBSD: if_loop.c,v 1.48 2003/08/15 19:22:08 jonathan Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.47 2003/08/07 16:32:53 agc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.48 2003/08/15 19:22:08 jonathan Exp $");
 
 #include "opt_inet.h"
 #include "opt_atalk.h"
@@ -134,8 +134,10 @@
 
 #if defined(LARGE_LOMTU)
 #define LOMTU  (131072 +  MHLEN + MLEN)
+#define LOMTU_MAX LOMTU
 #else
 #define        LOMTU   (32768 +  MHLEN + MLEN)
+#define        LOMTU_MAX       (65536 +  MHLEN + MLEN)
 #endif
 
 struct ifnet loif[NLOOP];
@@ -402,8 +404,10 @@
        struct rt_addrinfo *info;
 {
 
+       struct ifnet *ifp = &loif[0];
        if (rt)
-               rt->rt_rmx.rmx_mtu = LOMTU;
+               rt->rt_rmx.rmx_mtu = ifp->if_mtu;
+
 }
 
 /*
@@ -432,6 +436,16 @@
                 */
                break;
 
+       case SIOCSIFMTU:
+               ifr = (struct ifreq *)data;
+               if ((unsigned)ifr->ifr_mtu > LOMTU_MAX)
+                       error = EINVAL;
+               else {
+                       /* XXX update rt mtu for AF_ISO? */
+                       ifp->if_mtu = ifr->ifr_mtu;
+               }
+               break;
+
        case SIOCADDMULTI:
        case SIOCDELMULTI:
                ifr = (struct ifreq *)data;



Home | Main Index | Thread Index | Old Index