Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Sep 2008 23:17:49 +0100 (BST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Ryan French <rjf12@students.waikato.ac.nz>
Cc:        freebsd-net@freebsd.org
Subject:   Re: Initialisation of a networking protocol
Message-ID:  <alpine.BSF.1.10.0809292311560.29569@fledge.watson.org>
In-Reply-To: <f7ab8f150809281621y6285b624k10e3cfc700a74064@mail.gmail.com>
References:  <f7ab8f150809281621y6285b624k10e3cfc700a74064@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Mon, 29 Sep 2008, Ryan French wrote:

> I'm having a bit of trouble with my MPLS protocol code at the moment. I have 
> the code written and compiling (mostly based on some OpenBSD code I was 
> shown) but when an MPLS packet is received it doesnt appear as thou my 
> mpls_input routine is being called. I believe this is because I have not 
> initialised the protocol properly. I have created protosw structure for MPLS 
> as well as created an mpls_init(void) function which registers the protocol 
> with netisr via netisr_register. Other than that I am not really sure where 
> I tell the kernel to call the mpls_init function so that the protocol is 
> initialised, and a couple of hours of googling/looking through ip6 code 
> hasnt really helped at all. If anyone can help and needs to see the code it 
> can be viewed on Perforce at 
> http://perforce.freebsd.org/depotTreeBrowser.cgi?FSPC=//depot/projects/soc2008/rfrench_mpls&HIDEDEL=NO

Hi Ryan:

netisr is just a dispatch facility consisting of a series of named queues, 
worker thread(s), and a dispatch model -- it is the responsibility of some 
other piece of driver or protocol code to inject packets using netisr_queue() 
or netisr_dispatch().  Typically this occurs in the decapsulation code for the 
layer below the dispatched layer -- often the link layer.  You can take a look 
at current dispatch points here:

   http://fxr.watson.org/fxr/ident?im=bigexcerpts;i=netisr_queue
   http://fxr.watson.org/fxr/ident?im=bigexcerpts;i=netisr_dispatch

A typical dispatch point is ether_demux(), which switches on the etherhet 
frame header's protocol field and then hands off the packet to netisr for 
dispatch.  If the dispatch may lead to recursion, then you may need to use 
netisr_queue() rather than netisr_direct() to disallow direct dispatch.

Robert N M Watson
Computer Laboratory
University of Cambridge



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.1.10.0809292311560.29569>