netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Chapman <jchapman@katalix.com>
To: Kevin Lloyd <klloyd@sierrawireless.com>
Cc: Dan Williams <dcbw@redhat.com>, netdev@vger.kernel.org
Subject: Re: Network device driver with PPP
Date: Sat, 01 Mar 2008 12:08:48 +0000	[thread overview]
Message-ID: <47C94750.8060006@katalix.com> (raw)
In-Reply-To: <3415E2A2AB26944B9159CDB22001004D0252D1B7@nestea.sierrawireless.local>

Kevin Lloyd wrote:
> James Chapman wrote:
>>> Actually we provide a method for the driver to obtain the
>>> username/password information needed for the CHAP authentication so
> in
>>> theory the driver has the information needed to create the
> connection.
>>> I'm not sure how it would go about setting the DNS and IP addresses,
> but
>>> that's a separate issue further down the road.
>> Can you explain why you need the driver to be involved in any of this?
> I'm trying to evaluate what level of consistency can be maintained for
> our drivers across operating systems and whether there is precedence for
> such a design. Looking like it's not going to happen...

If your goal is to have your driver submitted upstream, it needs to fit 
the Linux infrastructure. Use existing kernel subsystems where they 
exist. Avoid OS abstraction wrappers too.

>> Control protocols live in userspace, datapath in the kernel.
> Okay. I have a question about the datapath actually: If I have a serial
> device and I establish a connection with pppd does it configure the
> generic ppp driver to talk to the ttyUSBx port and then route the
> control (e.g. NCP and LCP) packets to /dev/ppp for control by pppd and
> the data (IP) packets somewhere else? 

It depends.

pppd creates a ppp network interface. This is exactly the same as all 
other network interfaces in the system (eth0 etc) in that data packets 
pass from/to the device to/from the kernel network subsystems. Data 
packets arriving on your PPP interface can be delivered without any 
involvement from pppd.

If the PPP packet is to be encapsulated (e.g. PPPoATM, PPPoE) then 
things are more complicated. A kernel device driver does the 
encapsulation (drivers/net/pppoatm.c, drivers/net/pppoe.c) and a pppd 
plugin interfaces with that driver in order to send/receive PPP control 
packets. The kernel's ppp core separates PPP control and data packets.

However, some protocols don't have a pppox driver or corresponding 
userspace pppd plugin (e.g. PPTP). In these cases, pppd uses pseudo tty 
devices and copies data packets to/from it in userspace. Data packets 
are delivered to a pppd "data pump" which inserts or removes the 
encapsulation before passing it on. This can be quicker to implement but 
is obviously suboptimal because userspace copies all data and does all 
the protocol encapsulation/decapsulation work.

> Also is it pppd that directly sets
> up the network interface in ifconfig? I'm a little confused/lost here...

Yes. Though ifconfig is just one userspace app that can list network 
devices.

>> Can't you implement a private interface to your kernel driver so that
>> userspace can ask it for the username/password and userspace then
> starts
>> pppd with those parameters?
> Yes I suppose I could do that, how would you recommend approaching this,
> ioctl?

It depends on your device driver. If it can have a private driver ioctl 
handler, ioctl is simplest.

> Also, is Documentation\networking\ppp_generic.txt up-to-date (says
> edited 2002) or is there a better resource explaining ppp architecture
> on Linux?

The PPP APIs have been stable for a long time.


-- 
James Chapman
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development


      reply	other threads:[~2008-03-01 12:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-28  1:28 Network device driver with PPP Kevin Lloyd
2008-02-28  2:15 ` Dan Williams
2008-02-28  9:27   ` James Chapman
2008-02-28 16:19     ` Kevin Lloyd
2008-02-29 15:02       ` James Chapman
2008-03-01  1:41         ` Kevin Lloyd
2008-03-01 12:08           ` James Chapman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47C94750.8060006@katalix.com \
    --to=jchapman@katalix.com \
    --cc=dcbw@redhat.com \
    --cc=klloyd@sierrawireless.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).