This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Is it possible to do polling for the Ethernet driverusing a stack ?


It's certainly possible.

I've experimented with a network device that doesn't support interrupts
and have successfully integrated it with the network stack. Of course
there were other interrupts running, for the timer and other network
devices, and hence threads etc. But the network device was driven in a
totally polled manner.

I initially wrote a standard interrupt driven eCos network driver for
the network device (it was meant to support interrupts it's only when
Itried and found it didn't that the manufacturer owned up that it didn't
really!). When an interrupt occurs on the network device the _eth_isr()
functions runs which returns (CYG_ISR_HANDLED | CYG_ISR_CALL_DSR). This
causes the eth_drv_dsr() function to be run which schedules the network
delivery thread to run. This calls eth_drv_run_deliveries() which calls
my network drivers _eth_int() function. _eth_int() in effect polls the
device to process tx and rx frames. So what I needed to do something to
kick my _eth_int() function into life.

I tried two schemes, I'm sure there are others:

1. When the network device is initialised I created a background thread
and passed the struct eth_drv_sc *sc for the network device as its
parameter. In this background polling thread when I detected there was
something to be serviced on the network device I locked the scheduler /
DSR and called the standard _eth_int that is normally part of the
ETH_DRV_SC macro - this needs the eth_drv_sc *sc parameter passed to the
background thread when its started.

2. Really the same as 1 above but rather than calling the _eth_int
function when I detected there was something to be serviced on the
network device I "created" a "software interrupt" - in effect I called
the cyg_hal_default_interrupt_vsr with a dummy interrupt vector on the
stack. This caused the standard eCos interrupt mechanism to take over
and process network device.

Both these schemes seemed to work with the limted testing I've done.
Although option 2 isn't probably what Pascal wants since it's still
using interrupts.

Dave Webster 

> -----Original Message-----
> From: ecos-discuss-owner@sources.redhat.com [mailto:ecos-discuss-
> owner@sources.redhat.com] On Behalf Of Gary Thomas
> Sent: 31 October 2002 16:04
> To: Cusson, Pascal
> Cc: eCos Discussion
> Subject: RE: [ECOS] Is it possible to do polling for the Ethernet
> driverusing a stack ?
> 
> On Thu, 2002-10-31 at 08:56, Cusson, Pascal wrote:
> > Basically,
> >    I expect the stack to process the packets for all standard socket
> > operations.
> >
> >    By reading through some examples, after polling for the FCCE
flags, I
> > need to calculate the length of the packet and then call the receive
> > function part of my driver hook. However I require a struct
eth_drv_sc
> > argument. This argument is passed from the interrupt. Is there
another
> > way to get that handle ?
> >
> 
> Well, without interrupts and threads running, the stack won't be able
> to do anything for you (that's just how it's designed).
> 
> > Hope I'm giving you a tiny challenge here !
> >
> > Pascal
> >
> > -----Original Message-----
> > From: Gary Thomas [mailto:gthomas@ecoscentric.com]
> > Sent: Thursday, October 31, 2002 10:48 AM
> > To: Cusson, Pascal
> > Cc: eCos Discussion
> > Subject: RE: [ECOS] Is it possible to do polling for the Ethernet
driver
> > using a stack ?
> >
> >
> > On Thu, 2002-10-31 at 08:32, Cusson, Pascal wrote:
> > > Yes there is,
> > >    I need maximize performance on a system will support multiple
ATM
> > and
> > > ETH. My system need to be synchronous meaning one after another in
> > > specific order. By using polling I can easily control all aspects.
> > > Further more, polling will take less time than using interrupts
which
> > > should help for performances. The 8260 I am using is not the
fastest
> > > therefore I need everything I can get out of it.
> > >
> > >    What I would like do is poll the FCCE to see if there is a
buffer
> > > ready and then signal the stack so that the buffer descriptor can
be
> > > processed and freed.
> > >
> > > The part I am missing here is how to I tell the stack to process
my
> > > buffer descriptor ?
> > >
> >
> > One you have a packet (or activity), what sort of things are you
then
> > expecting the "stack" to do for you?
> >
> > > Pascal
> > >
> > > -----Original Message-----
> > > From: Gary Thomas [mailto:gthomas@ecoscentric.com]
> > > Sent: Thursday, October 31, 2002 10:25 AM
> > > To: Cusson, Pascal
> > > Cc: eCos Discussion
> > > Subject: Re: [ECOS] Is it possible to do polling for the Ethernet
> > driver
> > > using a stack ?
> > >
> > >
> > > On Thu, 2002-10-31 at 08:04, Cusson, Pascal wrote:
> > > > Hello Everyone,
> > > >    Has anyone ever made a Ethernet driver using polling ? If so
how
> > > did you link the driver to the stack ? What function calls did you
> > make
> > > ?
> > >
> > > The stacks that are used with eCos (not RedBoot, it has it's
> > > own stack) really should be interrupt driven.  Is there some
> > > reason that you want to poll?
> > >
> > > --
> > > ------------------------------------------------------------
> > > Gary Thomas                  |
> > > eCosCentric, Ltd.            |
> > > +1 (970) 229-1963            |  eCos & RedBoot experts
> > > gthomas@ecoscentric.com      |
> > > http://www.ecoscentric.com/  |
> > > ------------------------------------------------------------
> > >
> > > --
> > > Before posting, please read the FAQ:
> > http://sources.redhat.com/fom/ecos
> > > and search the list archive:
http://sources.redhat.com/ml/ecos-discuss
> > --
> > ------------------------------------------------------------
> > Gary Thomas                  |
> > eCosCentric, Ltd.            |
> > +1 (970) 229-1963            |  eCos & RedBoot experts
> > gthomas@ecoscentric.com      |
> > http://www.ecoscentric.com/  |
> > ------------------------------------------------------------
> >
> >
> > --
> > Before posting, please read the FAQ:
http://sources.redhat.com/fom/ecos
> > and search the list archive:
http://sources.redhat.com/ml/ecos-discuss
> >
> > --
> > Before posting, please read the FAQ:
http://sources.redhat.com/fom/ecos
> > and search the list archive:
http://sources.redhat.com/ml/ecos-discuss
> --
> ------------------------------------------------------------
> Gary Thomas                  |
> eCosCentric, Ltd.            |
> +1 (970) 229-1963            |  eCos & RedBoot experts
> gthomas@ecoscentric.com      |
> http://www.ecoscentric.com/  |
> ------------------------------------------------------------
> 
> 
> --
> Before posting, please read the FAQ:
http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
> 



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]