public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Multiple PPP interfaces in single unit
@ 2004-07-28 12:51 Øyvind Harboe
  2004-07-28 13:15 ` [ECOS] " Kelvin Lawson
  2004-07-28 13:27 ` [ECOS] " Nick Garnett
  0 siblings, 2 replies; 9+ messages in thread
From: Øyvind Harboe @ 2004-07-28 12:51 UTC (permalink / raw)
  To: ecos-discuss

Is it possible to use the PPP stack to chain multiple devices via
the serial ports?

I.e.:

Unit 1

Serial 1 talks to PC via PPP
Serial 2 talks to unit #2 via PPP

Unit 2:

Serial 1 talks to Unit #1 via PPP
Serial 2 talks to Unit #3 via PPP

etc.


-- 
Øyvind Harboe
http://www.zylin.com



--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ECOS] Re: Multiple PPP interfaces in single unit
  2004-07-28 12:51 [ECOS] Multiple PPP interfaces in single unit Øyvind Harboe
@ 2004-07-28 13:15 ` Kelvin Lawson
  2004-07-28 13:27 ` [ECOS] " Nick Garnett
  1 sibling, 0 replies; 9+ messages in thread
From: Kelvin Lawson @ 2004-07-28 13:15 UTC (permalink / raw)
  To: ecos-discuss

> Is it possible to use the PPP stack to chain multiple devices via
> the serial ports?

Some modifications are necessary to handle multiple PPP interfaces on 
one unit. There are a bunch of globals in the PPP files used to store 
configuration details. These are currently used for the first PPP 
interface ppp0 only.

In order to support multiple simultaneous interfaces (ppp1, ppp2...) 
those globals need to be replaced by some other mechanism that scales to 
multiple interfaces - a simple solution might be to replace 
per-interface globals by arrays of up to the maximum number of PPP 
interfaces you want to support. A more dynamic system would be nicer 
however.

I haven't got round to trying this out yet, but it's on my list.. 
unfortunately it's not at the top.

As for the chaining scenario - if you want to talk from one end of the 
chain to the other, I guess you'll need to enable IP forwarding on the 
mid-chain units.

Kelvin.


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ECOS] Multiple PPP interfaces in single unit
  2004-07-28 12:51 [ECOS] Multiple PPP interfaces in single unit Øyvind Harboe
  2004-07-28 13:15 ` [ECOS] " Kelvin Lawson
@ 2004-07-28 13:27 ` Nick Garnett
  2004-07-28 13:55   ` Øyvind Harboe
  2004-07-29  7:38   ` Øyvind Harboe
  1 sibling, 2 replies; 9+ messages in thread
From: Nick Garnett @ 2004-07-28 13:27 UTC (permalink / raw)
  To: Øyvind Harboe; +Cc: ecos-discuss

Øyvind Harboe <oyvind.harboe@zylin.com> writes:

> Is it possible to use the PPP stack to chain multiple devices via
> the serial ports?
> 
> I.e.:
> 
> Unit 1
> 
> Serial 1 talks to PC via PPP
> Serial 2 talks to unit #2 via PPP
> 
> Unit 2:
> 
> Serial 1 talks to Unit #1 via PPP
> Serial 2 talks to Unit #3 via PPP

We cannot do this at present, it's an explicit limitation of the
current implementation. The expectation was that most eCos devices
would be solitary remote devices that were dialled into, or dialled
out. So a single PPP connection would be the ususal case.

The main problem is that the PPPD code was designed to instantiate a
separate Unix process for each PPP channel. So there are a lot of
global variables that would need to be duplicated in some way. The
code within the TCP/IP stack itself should not need changing, however.

This is not a trivial job unfortunately, and anything we do would
seriously inhibit any efforts to update the PPP code from the BSD
repository. 

-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ECOS] Multiple PPP interfaces in single unit
  2004-07-28 13:27 ` [ECOS] " Nick Garnett
@ 2004-07-28 13:55   ` Øyvind Harboe
  2004-07-28 14:30     ` Nick Garnett
  2004-07-29  7:38   ` Øyvind Harboe
  1 sibling, 1 reply; 9+ messages in thread
From: Øyvind Harboe @ 2004-07-28 13:55 UTC (permalink / raw)
  To: Nick Garnett; +Cc: ecos-discuss

On Wed, 2004-07-28 at 15:15, Nick Garnett wrote:
> Øyvind Harboe <oyvind.harboe@zylin.com> writes:
> 
> > Is it possible to use the PPP stack to chain multiple devices via
> > the serial ports?
> > 
> > I.e.:
> > 
> > Unit 1
> > 
> > Serial 1 talks to PC via PPP
> > Serial 2 talks to unit #2 via PPP
> > 
> > Unit 2:
> > 
> > Serial 1 talks to Unit #1 via PPP
> > Serial 2 talks to Unit #3 via PPP
> 
> We cannot do this at present, it's an explicit limitation of the
> current implementation. The expectation was that most eCos devices
> would be solitary remote devices that were dialled into, or dialled
> out. So a single PPP connection would be the ususal case.
> 
> The main problem is that the PPPD code was designed to instantiate a
> separate Unix process for each PPP channel. So there are a lot of
> global variables that would need to be duplicated in some way. 

Seperate C++ namespace for each PPPD?

- Write a pppd2.h file

---
namespace PPPD2;
---


- Compile PPPD twice, but second time add option:

g++ -include pppd2.h ...


> The
> code within the TCP/IP stack itself should not need changing, however.
> 
> This is not a trivial job unfortunately, and anything we do would
> seriously inhibit any efforts to update the PPP code from the BSD
> repository. 




-- 
Øyvind Harboe
http://www.zylin.com



--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ECOS] Multiple PPP interfaces in single unit
  2004-07-28 13:55   ` Øyvind Harboe
@ 2004-07-28 14:30     ` Nick Garnett
  2004-07-28 14:50       ` Øyvind Harboe
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Garnett @ 2004-07-28 14:30 UTC (permalink / raw)
  To: Øyvind Harboe; +Cc: ecos-discuss

Øyvind Harboe <oyvind.harboe@zylin.com> writes:

> 
> Seperate C++ namespace for each PPPD?
> 
> - Write a pppd2.h file
> 
> ---
> namespace PPPD2;
> ---
> 
> 
> - Compile PPPD twice, but second time add option:
> 
> g++ -include pppd2.h ...

I have considered several ways around the problem, but not even in my
most fevered imaginings did I come up with that one :-)

This would end up duplicating the code and the data. Not a good idea.

The least disruptive approach I came up with is to convert all of
these global variable into arrays, rename them and then define a macro
with the original name which picks out the correct instance. However,
there are still issues about where the instance index comes from.


-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ECOS] Multiple PPP interfaces in single unit
  2004-07-28 14:30     ` Nick Garnett
@ 2004-07-28 14:50       ` Øyvind Harboe
  2004-07-28 15:18         ` Nick Garnett
  0 siblings, 1 reply; 9+ messages in thread
From: Øyvind Harboe @ 2004-07-28 14:50 UTC (permalink / raw)
  To: Nick Garnett; +Cc: ecos-discuss

On Wed, 2004-07-28 at 15:45, Nick Garnett wrote:
> Øyvind Harboe <oyvind.harboe@zylin.com> writes:
> 
> > 
> > Seperate C++ namespace for each PPPD?
> > 
> > - Write a pppd2.h file
> > 
> > ---
> > namespace PPPD2;
> > ---
> > 
> > 
> > - Compile PPPD twice, but second time add option:
> > 
> > g++ -include pppd2.h ...
> 
> I have considered several ways around the problem, but not even in my
> most fevered imaginings did I come up with that one :-)
>
> This would end up duplicating the code and the data. Not a good idea.

Currently we have no solution. Thats not good either :-)

If this solution requires no changes to the code, makes updates easy and
incurs no overhead for the common case(single PPPD)...

Slightly increased code size(only PPPD code is duplicated, not the rest
of eCos) and probably not very much more ram usage.

Perhaps you know something I don't, but it seems like a very economical
solution. 

Now, the next question is whether it will work out of the box...


> The least disruptive approach I came up with is to convert all of
> these global variable into arrays, rename them and then define a macro
> with the original name which picks out the correct instance. However,
> there are still issues about where the instance index comes from.
-- 
Øyvind Harboe
http://www.zylin.com



--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ECOS] Multiple PPP interfaces in single unit
  2004-07-28 15:18         ` Nick Garnett
@ 2004-07-28 15:18           ` Øyvind Harboe
  0 siblings, 0 replies; 9+ messages in thread
From: Øyvind Harboe @ 2004-07-28 15:18 UTC (permalink / raw)
  To: Nick Garnett; +Cc: ecos-discuss

On Wed, 2004-07-28 at 16:30, Nick Garnett wrote:
> Øyvind Harboe <oyvind.harboe@zylin.com> writes:
> 
> > On Wed, 2004-07-28 at 15:45, Nick Garnett wrote:
> > > Øyvind Harboe <oyvind.harboe@zylin.com> writes:
> > > 
> > > > 
> > > > Seperate C++ namespace for each PPPD?
> > > > 
> > > > - Write a pppd2.h file
> > > > 
> > > > ---
> > > > namespace PPPD2;
> > > > ---
> > > > 
> > > > 
> > > > - Compile PPPD twice, but second time add option:
> > > > 
> > > > g++ -include pppd2.h ...
> > > 
> > > I have considered several ways around the problem, but not even in my
> > > most fevered imaginings did I come up with that one :-)
> > >
> > > This would end up duplicating the code and the data. Not a good idea.
> > 
> > Currently we have no solution. Thats not good either :-)
> 
> I don't believe *we* need a solution. It's not something that eCos is
> intended to do at present. If you want to try this out for your own
> application then go ahead, but it is not what I would consider a good
> solution and I would not want to see it added to the repository.

Fair enough.

Maybe I'll take it for a spin.

> > If this solution requires no changes to the code, makes updates easy and
> > incurs no overhead for the common case(single PPPD)...
> > 
> > Slightly increased code size(only PPPD code is duplicated, not the rest
> > of eCos) and probably not very much more ram usage.
> > 
> > Perhaps you know something I don't, but it seems like a very economical
> > solution. 
> 
> The PPP code is currently about 80k text plus 16k data. Of that the
> PPPD-derived part is the by far the largest. If we subtract about 20k
> for the TCP/IP-resident parts, that's still 70k+ that will be
> duplicated. 

Thats kinda what I expected. In my particular configuration, code size
is cheap and RAM is expensive, so I'm more concerned about whether this
approach will increase RAM usage.

More generally, code size should be optimised as well..

However, the real killer would be if I lost the ability to merge in
bug-fixes.
 
> > Now, the next question is whether it will work out of the box...
> 
> I think that there will be lots of obscure issues to trip you up if
> you try to do it this way.

Beauty is useful as guidance when designing and I do find this approach
"ugly". :-)

But beauty aside, please share any specific issues you can think of.

I'm especially concerned about stuff that does not show up at compile
time.

-- 
Øyvind Harboe
http://www.zylin.com



--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ECOS] Multiple PPP interfaces in single unit
  2004-07-28 14:50       ` Øyvind Harboe
@ 2004-07-28 15:18         ` Nick Garnett
  2004-07-28 15:18           ` Øyvind Harboe
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Garnett @ 2004-07-28 15:18 UTC (permalink / raw)
  To: Øyvind Harboe; +Cc: ecos-discuss

Øyvind Harboe <oyvind.harboe@zylin.com> writes:

> On Wed, 2004-07-28 at 15:45, Nick Garnett wrote:
> > Øyvind Harboe <oyvind.harboe@zylin.com> writes:
> > 
> > > 
> > > Seperate C++ namespace for each PPPD?
> > > 
> > > - Write a pppd2.h file
> > > 
> > > ---
> > > namespace PPPD2;
> > > ---
> > > 
> > > 
> > > - Compile PPPD twice, but second time add option:
> > > 
> > > g++ -include pppd2.h ...
> > 
> > I have considered several ways around the problem, but not even in my
> > most fevered imaginings did I come up with that one :-)
> >
> > This would end up duplicating the code and the data. Not a good idea.
> 
> Currently we have no solution. Thats not good either :-)

I don't believe *we* need a solution. It's not something that eCos is
intended to do at present. If you want to try this out for your own
application then go ahead, but it is not what I would consider a good
solution and I would not want to see it added to the repository.

> 
> If this solution requires no changes to the code, makes updates easy and
> incurs no overhead for the common case(single PPPD)...
> 
> Slightly increased code size(only PPPD code is duplicated, not the rest
> of eCos) and probably not very much more ram usage.
> 
> Perhaps you know something I don't, but it seems like a very economical
> solution. 

The PPP code is currently about 80k text plus 16k data. Of that the
PPPD-derived part is the by far the largest. If we subtract about 20k
for the TCP/IP-resident parts, that's still 70k+ that will be
duplicated. 

> 
> Now, the next question is whether it will work out of the box...

I think that there will be lots of obscure issues to trip you up if
you try to do it this way.


-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ECOS] Multiple PPP interfaces in single unit
  2004-07-28 13:27 ` [ECOS] " Nick Garnett
  2004-07-28 13:55   ` Øyvind Harboe
@ 2004-07-29  7:38   ` Øyvind Harboe
  1 sibling, 0 replies; 9+ messages in thread
From: Øyvind Harboe @ 2004-07-29  7:38 UTC (permalink / raw)
  To: Nick Garnett; +Cc: ecos-discuss

> This is not a trivial job unfortunately, and anything we do would
> seriously inhibit any efforts to update the PPP code from the BSD
> repository. 

Here is a new PPPD refactoring scheme I thought off. It should be fairly
diff/merge-friendly.

int globalvar;

void foo(int x, int y)
{
	globalvar++;
}


=>

class PPPD
{
	int globalvar;
	void foo(int x, int y);
};

void PPPD::foo(int x, int y)
{
	globalvar++;
}


-- 
Øyvind Harboe
http://www.zylin.com



--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-07-29  6:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-28 12:51 [ECOS] Multiple PPP interfaces in single unit Øyvind Harboe
2004-07-28 13:15 ` [ECOS] " Kelvin Lawson
2004-07-28 13:27 ` [ECOS] " Nick Garnett
2004-07-28 13:55   ` Øyvind Harboe
2004-07-28 14:30     ` Nick Garnett
2004-07-28 14:50       ` Øyvind Harboe
2004-07-28 15:18         ` Nick Garnett
2004-07-28 15:18           ` Øyvind Harboe
2004-07-29  7:38   ` Øyvind Harboe

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 read-only IMAP folder(s) and NNTP newsgroup(s).