netdev
[Top] [All Lists]

Re: RFC: PPP over X

To: Dave Grothe <dave@xxxxxxxx>
Subject: Re: RFC: PPP over X
From: Matti Aarnio <matti.aarnio@xxxxxxxxx>
Date: Thu, 10 Feb 2000 17:04:59 +0200
Cc: Ole Husgaard <osh@xxxxxxxxx>, Paul Mackerras <paulus@xxxxxxxxxxxxx>, Henner Eisen <eis@xxxxxxxxxxxxx>, hadi@xxxxxxxxxx, mostrows@xxxxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx, axboe@xxxxxxx, markster@xxxxxxxxx, mitch@xxxxxxxxxx, ak@xxxxxxx, marc@xxxxxxx, bcrl@xxxxxxxxxx, Linux STREAMS <linux-streams@xxxxxxxxxxxxxxxxxx>
In-reply-to: <38A2CCDD.3F9FACAE@xxxxxxxx>; from Dave Grothe on Thu, Feb 10, 2000 at 08:36:13AM -0600
References: <200002092333.AAA05339@xxxxxxxxxxxxx> <00021011490500.01926@xxxxxxxxxxxxxxxxxxxxx> <38A2B348.B07A7398@xxxxxxxxx> <38A2CCDD.3F9FACAE@xxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
On Thu, Feb 10, 2000 at 08:36:13AM -0600, Dave Grothe wrote:
> To amplify a bit on what Ole said:  The Linux STREAMS code (LiS) does a
> good job in being able to interpose complex and flexible protocol
> stacks below IP -- the _standard_ Linux IP.
> 
> What it _cannot_ do, and would require some assistance from the kernel
> networking folks, is to run protocol stacks _above_ TCP or _above_ UDP.
> Every once in awhile I get a question from a potential customer about
> tunneling our SNA over a TCP connection in Linux.  Without making a
> trip up to user space the answer always has to be "can't be done."  The
> reason being that we can't configure our SNA code (STREAMS based) above
> TCP while keeping the messages in the kernel.

        Yes you can.  You can "simulate" user dataspace in kernel
        by doing:

        (from mm/filemap.c)

static int file_send_actor(read_descriptor_t * desc, struct page *page,
                           unsigned long offset , unsigned long size)
{
        unsigned long kaddr;
        ssize_t written;
        unsigned long count = desc->count;
        struct file *file = (struct file *) desc->buf;
        mm_segment_t old_fs;

        if (size > count)
                size = count;
        old_fs = get_fs();
        set_fs(KERNEL_DS);

        kaddr = kmap(page);
        written = file->f_op->write(file, (char *)kaddr + offset,
                                         size, &file->f_pos);
        kunmap(page);
        set_fs(old_fs);
        if (written < 0) {
                desc->error = written;
                written = 0;
        }
        desc->count = count - written;
        desc->written += written;
        return written;
}

        Sure it isn't too pretty, but it does work quite well.
        (And "worst" of all, it involves data copy...)

> (Having contributed this two-cents worth to this discussion, I feel somewhat
> embarassed in that I am leaving for a two-week vacation on Saturday and will 
> not
> have an opportunity to read responses or comment further.)
> 
> -- Dave (author of LiS)

/Matti Aarnio <matti.aarnio@xxxxxxxxx>

<Prev in Thread] Current Thread [Next in Thread>