Home | History | Annotate | Download | only in net
History log of /src/sys/net/if_gre.h
RevisionDateAuthorComments
 1.50  03-Dec-2021  andvar fix various typos in comments, log messages and documentation.
 1.49  14-Feb-2021  roy if_gre: Remove alignment checks in favour copying to stack

Makes the code a lot simpler, idea from dyoung@
 1.48  12-Feb-2021  roy if_gre: Ensure that gre_h is aligned
 1.47  03-Feb-2021  roy CTASSERT -> __CTASSERT to unbreak userland build.

While here move __packed in tcp_debug.h back to where it was and
note removal warrants more investigation.
 1.46  03-Feb-2021  roy Sprinkle CTASSERT to enforce on-wire layout without __packed
 1.45  03-Feb-2021  roy Remove __packed from various network structures

They are already network aligned and adding the __packed attribute
just causes needless compiler warnings about accssing members of packed
objects.
 1.44  26-Feb-2019  msaitoh branches: 1.44.12;
No functional change:
- Cosmetic change.
- Remove extra space between single quote and comma to make
"grep \'i kdump-ioctl.c | sort -n -k 5,5 | uniq | column -t" happy.
 1.43  06-Sep-2015  dholland branches: 1.43.18;
More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
 1.42  29-Nov-2011  drochner branches: 1.42.8; 1.42.26;
sys/pcq.h isn't installed to userland, so only include it ifdef _KERNEL,
fixes glitch in kdump build
 1.41  02-Nov-2011  dyoung branches: 1.41.2;
For simplicity's sake, use pcq(9) instead of my own circular-queue
implementation. Saves 45 lines of code.
 1.40  01-Jun-2010  mjf Add __cacheline_aligned and __read_mostly annotations.

These annotations help to mitigate false sharing on multiprocessor
systems.

Variables annotated with __cacheline_aligned are placed into the
.data.cacheline_aligned section in the kernel. Each item in this
section is aligned on a cachline boundary - this avoids false
sharing. Highly contended global locks are a good candidate for
__cacheline_aligned annotation.

Variables annotated with __read_mostly are packed together tightly
into a .data.read_mostly section in the kernel. The idea here is that
we can pack infrequently modified data items into a cacheline and
avoid having to purge the cache, which would happen if read mostly
data and write mostly data shared a cachline. Initialisation variables
are a prime candiate for __read_mostly annotations.
 1.39  08-Sep-2008  gmcgarry branches: 1.39.12; 1.39.14; 1.39.16;
Replace most gcc-specific __attribute__ uses with BSD-style sys/cdef.h
preprocessor macros.
 1.38  15-May-2008  dyoung branches: 1.38.4;
Note both my contribution and NSF funding.
 1.37  09-May-2008  dyoung Make gre(4) work in the New File Descriptor / Socket Locking Order.

Move the function+line printing into GRE_DPRINTF().

Retire gre_closef(). Retire gre_join(). Constify gre_reconf(),
and don't pass it an LWP any longer.

Make this work in the new file descriptor regime. Add a kernel
thread per gre(4) instance whose purpose is to install the socket
into proc0's file descriptor table. Add gre_fp_send() and
gre_fp_recv() for passing file_t pointers to proc0.

Fix locking: don't solock() in the socket upcall, where it is
already held. Do solock() before calling soconnect().

Simplify reconfiguration.

Update a comment that mentions finding a less specific route, since
we don't do that any more.
 1.36  04-May-2008  martin branches: 1.36.2;
Move to standard TNF 2 clause license
 1.35  20-Feb-2008  matt branches: 1.35.6; 1.35.8; 1.35.10;
s/u_\(int[0-9]*_t\)/u\1/g
(change u_int*_t to uint*_t)
 1.34  12-Feb-2008  dyoung #include <sys/evcnt.h> for event counters.
 1.33  11-Feb-2008  dyoung Do not needlessly #include <sys/device.h>.
 1.32  25-Dec-2007  perry Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
 1.31  23-Nov-2007  dyoung branches: 1.31.2; 1.31.6;
Delete state GRE_S_DOCONF, I no longer use it.
 1.30  06-Oct-2007  dyoung branches: 1.30.4;
Good-bye, kernel thread, we don't need you any longer.
 1.29  05-Oct-2007  martin Add missing include for definition of struct evcnt.
 1.28  05-Oct-2007  dyoung Remove a lot of dead code. Move gre_do_send() code into greintr(),
and move gre_do_recv() code into gre_receive(). Get rid of some
unused event counters.
 1.27  05-Oct-2007  dyoung Work in progress: use a raw socket for GRE in IP encapsulation
instead of adding/subtracting our own IPv4 header.

There are many benefits: gre(4) needn't grok the outer encapsulation
header any longer, so this simplifies the gre(4) code. The IP
stack needn't grok GRE, so it is simplified, too. gre(4) will
benefit from optimizations in the socket code. Eventually, gre(4)
will gain an IPv6 encapsulation with very few new lines of code.

There is a small performance loss. A 133 MHz, 486-class AMD Elan
sinks/sources a TCP stream over GRE with about 93% the throughput
of the old code. TCP throughput on a 266 MHz, 586-class AMD Geode
is about 96% the throughput of the old code. A 175-MHz ADM5120
(MIPS) only sinks a TCP stream over GRE at about 90% of the old
code; I am still investigating that.

I produced stripped-down versions of sosend() and soreceive() for
gre(4) to use. They are guaranteed not to block, so they can be
called from a software interrupt and from a socket upcall,
respectively.

A kernel thread is no longer necessary for socket transmit/receive,
but I didn't get around to removing it, yet.

Thanks to Matt Thomas for suggesting the use of stripped-down socket
code and software interrupts, and to Andrew Doran for advice and
answers concerning software interrupts, threads, and performance.
 1.26  02-Sep-2007  dyoung branches: 1.26.2;
Be consistent: use the prefix sc_ for all members of the gre_softc.
 1.25  30-Aug-2007  dyoung Move sc_fp & sc_newfp from struct gre_softc to struct gre_soparm.
 1.24  30-Aug-2007  dyoung Cosmetic: remove an out-of-place comma in a comment.
 1.23  24-Aug-2007  dyoung branches: 1.23.2;
Overhaul gre(4), especially the GRE in UDP bits:

* Create the kernel thread in gre_clone_create() instead of trying
to create it in gre_ioctl(). (Thanks ad@ for suggesting it, and
pointing out that I can't kthread_create while I hold a spin
lock.) Run the thread always, but put it to sleep while the
gre(4) is not in UDP mode.

* Use sockaddr_in_init().

* Move some thread state off of the stack and into the softc.

* Extract subroutines gre_do_recv(), gre_do_send(), and gre_reconf()
from gre_thread1(), making the code more readable.
 1.22  06-May-2007  dyoung branches: 1.22.2; 1.22.6;
Switch from spl(9) to mutex(9) and condvar(9).

Fix a defect in the locking of file descriptors as we delegate a
UDP socket from userland to the kernel. Move sc_fp out of sc_soparm.
Synchronize access to sc_fp by gre_ioctl() and the kernel thread
using a condition variable. For simplicity's sake, make it the
kernel helper thread's responsibility to close its UDP socket.
 1.21  21-Mar-2007  dyoung If we do not recognize the protocol of a received packet, then
increase ifi_noproto. If the GRE header contains routing options,
increase the input-error count, ifi_ierrors.

While I am here, make some cosmetic changes: remove unnecessary
'proto' argument from gre_input3(). Shorten some staircases.
 1.20  26-Jan-2007  dyoung branches: 1.20.2; 1.20.6; 1.20.8; 1.20.10;
Mark some shared variables as volatile.
 1.19  16-Nov-2006  dyoung Cosmetic: s/g_proto/sc_proto/.

(Straggler from last commit affecting net/if_gre.c, netinet/ip_gre.c.)
 1.18  01-Sep-2006  dyoung branches: 1.18.2; 1.18.4;
Rename gre_softc member sc_sp to sc_soparm to fix NetBSD/alpha
compiles, where some other system header #defines sc_sp.

In gre_ioctl, GREDSOCK case, do not try to delete sc_fp if it is
NULL.

Move GREDSOCK and GRESSOCK definitions to where the other GRE ioctls
are defined.

Remove #ifdef GRESSOCK, it's unnecessary now that the feature is
complete.
 1.17  31-Aug-2006  dyoung Add a mode to gre(4) that sends GRE tunnel packets in UDP datagrams.
Fix MOBILE encapsulation. Add many debugging printfs (mainly
concerning UDP mode). Clean up the gre(4) code a bit. Add the
capability to setup UDP tunnels to ifconfig. Update documentation.

In UDP mode, gre(4) puts a GRE header onto transmitted packets,
and hands them to a UDP socket for transmission. That is, the
encapsulation looks like this: IP+UDP+GRE+encapsulated packet.

There are two ways to set up a UDP tunnel. One way is to tell the
source and destination IP+port to gre(4), and let gre(4) create
the socket. The other way to create a UDP tunnel is for userland
to "delegate" a UDP socket to the kernel.
 1.16  11-Dec-2005  thorpej branches: 1.16.4; 1.16.8;
ANSI function decls and application of static.
 1.15  10-Dec-2005  elad Multiple inclusion protection, as suggested by christos@ on tech-kern@
few days ago.
 1.14  26-Feb-2005  perry branches: 1.14.4;
nuke trailing whitespace
 1.13  10-Nov-2003  wiz branches: 1.13.8; 1.13.10;
Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.
 1.12  05-Sep-2003  itojun u_short -> u_int16_t
 1.11  08-Jul-2003  itojun prototype must not have variable name
 1.10  24-Feb-2002  martin branches: 1.10.16;
Clear M_BCAST and M_MCAST on outgoing mbufs.
Don't copy ttl from the inner packet to the encapsulating packet. Make
the outer ttl sysctl'able. This should close PR 14269 from Jasper Wallace
(change partly from there) and it makes traceroute work over gre tunnels.
 1.9  10-May-2001  itojun branches: 1.9.2;
whitespace/indentation cleanup
 1.8  12-Dec-2000  thorpej branches: 1.8.2;
Adapt to bpfattach() changes, and further centralize the bpfattach()
and bpfdetach() calls into link-type subroutines where possible.
 1.7  05-Jul-2000  thorpej Fix an omission in the gre cloning changes.
 1.6  05-Jul-2000  thorpej Make gre(4) a cloning network pseudo-device.
 1.5  19-Nov-1999  thorpej branches: 1.5.4;
Add the `packed' attribute to structures which describe wire protocol
data formats.
 1.4  22-Dec-1998  thorpej branches: 1.4.8; 1.4.14;
Add an extern declaration of gre_softc[] here. Wrap it and the prototypes
in #ifdef _KERNEL.
 1.3  07-Oct-1998  thorpej Fix some typos in comments, and clean up some whitespace.
 1.2  30-Sep-1998  hwr Start supporting IPPROTO_MOBILE (55) encapsulation. This is yet
another tunneling protocol used by the Mobile-IP people. See RFC 2004
for this.
 1.1  13-Sep-1998  hwr Add a gre tunnel pseudo network device. Gre = generic route encapsulation.
This device shows up like any other network interface and can be used to
tunnel L3 protocols as e.g. IP over IP.
 1.4.14.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.8.2  13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.4.8.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.4.1  26-Feb-2002  he Pull up revision 1.10 (requested by martin):
Clear M_BCAST and M_MCAST on encapsulated packets on outgoing
mbufs. Also do not copy TTL from the inner packet, and make the
outer TTL sysctl'able. Fixes PR#14269, and makes traceroute work
over GRE tunnels.
 1.8.2.2  28-Feb-2002  nathanw Catch up to -current.
 1.8.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.9.2.1  16-Mar-2002  jdolecek Catch up with -current.
 1.10.16.5  11-Dec-2005  christos Sync with head.
 1.10.16.4  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.16.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.16.2  18-Sep-2004  skrll Sync with HEAD.
 1.10.16.1  03-Aug-2004  skrll Sync with HEAD
 1.13.10.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.8.1  29-Apr-2005  kent sync with -current
 1.14.4.8  27-Feb-2008  yamt sync with head.
 1.14.4.7  21-Jan-2008  yamt sync with head
 1.14.4.6  07-Dec-2007  yamt sync with head
 1.14.4.5  27-Oct-2007  yamt sync with head.
 1.14.4.4  03-Sep-2007  yamt sync with head.
 1.14.4.3  26-Feb-2007  yamt sync with head.
 1.14.4.2  30-Dec-2006  yamt sync with head.
 1.14.4.1  21-Jun-2006  yamt sync with head.
 1.16.8.1  03-Sep-2006  yamt sync with head.
 1.16.4.1  09-Sep-2006  rpaulo sync with head
 1.18.4.1  10-Dec-2006  yamt sync with head.
 1.18.2.2  01-Feb-2007  ad Sync with head.
 1.18.2.1  18-Nov-2006  ad Sync with head.
 1.20.10.1  29-Mar-2007  reinoud Pullup to -current
 1.20.8.1  11-Jul-2007  mjf Sync with head.
 1.20.6.3  09-Oct-2007  ad Sync with head.
 1.20.6.2  08-Jun-2007  ad Sync with head.
 1.20.6.1  10-Apr-2007  ad Sync with head.
 1.20.2.2  07-May-2007  yamt sync with head.
 1.20.2.1  24-Mar-2007  yamt sync with head.
 1.22.6.3  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.22.6.2  07-Oct-2007  joerg Sync with HEAD.
 1.22.6.1  03-Sep-2007  jmcneill Sync with HEAD.
 1.22.2.1  03-Sep-2007  skrll Sync with HEAD.
 1.23.2.3  23-Mar-2008  matt sync with HEAD
 1.23.2.2  09-Jan-2008  matt sync with HEAD
 1.23.2.1  06-Nov-2007  matt sync with HEAD
 1.26.2.2  14-Oct-2007  yamt sync with head.
 1.26.2.1  06-Oct-2007  yamt sync with head.
 1.30.4.2  18-Feb-2008  mjf Sync with HEAD.
 1.30.4.1  08-Dec-2007  mjf Sync with HEAD.
 1.31.6.1  02-Jan-2008  bouyer Sync with HEAD
 1.31.2.1  26-Dec-2007  ad Sync with head.
 1.35.10.3  11-Aug-2010  yamt sync with head.
 1.35.10.2  04-May-2009  yamt sync with head.
 1.35.10.1  16-May-2008  yamt sync with head.
 1.35.8.1  18-May-2008  yamt sync with head.
 1.35.6.2  28-Sep-2008  mjf Sync with HEAD.
 1.35.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.36.2.2  24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.36.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.38.4.1  19-Oct-2008  haad Sync with HEAD.
 1.39.16.1  03-Jul-2010  rmind sync with head
 1.39.14.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.39.12.1  03-Dec-2011  matt Add __cacheline_aligned and __read_mostly from -HEAD.
 1.41.2.1  17-Apr-2012  yamt sync with head
 1.42.26.1  22-Sep-2015  skrll Sync with HEAD
 1.42.8.1  03-Dec-2017  jdolecek update from HEAD
 1.43.18.1  10-Jun-2019  christos Sync with HEAD
 1.44.12.1  03-Apr-2021  thorpej Sync with HEAD.

RSS XML Feed