public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] ethernet driver - receiving packets doesn't work
@ 2007-08-30 21:25 Tom Malcolmson
  2007-08-30 22:46 ` Gary Thomas
  2007-08-31  6:50 ` [ECOS] ethernet driver - receiving packets doesn't work Andrew Lunn
  0 siblings, 2 replies; 4+ messages in thread
From: Tom Malcolmson @ 2007-08-30 21:25 UTC (permalink / raw)
  To: ecos-discuss

Hi.

I'm new to eCos - we are trying to move away from a proprietary OS, and 
I'm having basic problems with my Ethernet driver.

I'm using an eCos 2.0 snapshot from September 2006 on an ARM platform 
with the standard FreeBSD stack.

Sending packets from an eCos app, thru my driver works fine, but eCos 
doesn't seem to do anything with the packets that I deliver up to it: 
they never back up to the application.  For DHCP for instance, I see the 
DHCP request come out of my system, and I see a DHCP offer from the 
server go back into my system.  I can see from debug prints in the 
generic ethernet driver that it has correctly received the DHCP offer, 
but the offer never gets back to the app.  I have tried apps other then 
DHCP.

Now, I should expain that there is no actual ethernet hardware, so no 
ethernet interrupts, etc.  My guide for writing the driver has been the 
eCos reference manual, chapter 46:
http://ecos.sourceware.org/docs-2.0/ref/io-eth-drv-generic1.html
But I skip some steps since I don`t have a DSR.  When I have a packet 
for the net stack, I just call (sc->funs->eth_drv->recv)() with the 
number of bytes needed.  eCos calls my receive function which puts the 
packet into the sg list.  From debug output I can see that the generic 
driver code (eth_drv.c) has corrrectly received my packet and presumably 
calls ether_input.

A couple other thing.  Loopback tests work.  I don`t have any debugging 
capability.

I believe that the next step for me would be to insert print statements 
in if_ethersubr.c.

Thanks for any suggestions.
Tom.  


-- 
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] 4+ messages in thread

* Re: [ECOS] ethernet driver - receiving packets doesn't work
  2007-08-30 21:25 [ECOS] ethernet driver - receiving packets doesn't work Tom Malcolmson
@ 2007-08-30 22:46 ` Gary Thomas
  2007-09-01 16:59   ` [ECOS] ethernet driver - receiving packets doesn't work (conclusion) Tom Malcolmson
  2007-08-31  6:50 ` [ECOS] ethernet driver - receiving packets doesn't work Andrew Lunn
  1 sibling, 1 reply; 4+ messages in thread
From: Gary Thomas @ 2007-08-30 22:46 UTC (permalink / raw)
  To: Tom Malcolmson; +Cc: ecos-discuss

Tom Malcolmson wrote:
> Hi.
> 
> I'm new to eCos - we are trying to move away from a proprietary OS, and
> I'm having basic problems with my Ethernet driver.
> 
> I'm using an eCos 2.0 snapshot from September 2006 on an ARM platform
> with the standard FreeBSD stack.
> 
> Sending packets from an eCos app, thru my driver works fine, but eCos
> doesn't seem to do anything with the packets that I deliver up to it:
> they never back up to the application.  For DHCP for instance, I see the
> DHCP request come out of my system, and I see a DHCP offer from the
> server go back into my system.  I can see from debug prints in the
> generic ethernet driver that it has correctly received the DHCP offer,
> but the offer never gets back to the app.  I have tried apps other then
> DHCP.
> 
> Now, I should expain that there is no actual ethernet hardware, so no
> ethernet interrupts, etc.  My guide for writing the driver has been the
> eCos reference manual, chapter 46:
> http://ecos.sourceware.org/docs-2.0/ref/io-eth-drv-generic1.html
> But I skip some steps since I don`t have a DSR.  When I have a packet
> for the net stack, I just call (sc->funs->eth_drv->recv)() with the
> number of bytes needed.  eCos calls my receive function which puts the
> packet into the sg list.  From debug output I can see that the generic
> driver code (eth_drv.c) has corrrectly received my packet and presumably
> calls ether_input.
> 
> A couple other thing.  Loopback tests work.  I don`t have any debugging
> capability.
> 
> I believe that the next step for me would be to insert print statements
> in if_ethersubr.c.

For the network stack, you need to at least pretend that you
get interrupts and call the DSR.  The driver normally calls
into the network stack at DSR time and the stack's input
processing thread is what eventually calls your handler
to fetch the packet, etc.  I don't think it will work without
this interaction.



-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
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] 4+ messages in thread

* Re: [ECOS] ethernet driver - receiving packets doesn't work
  2007-08-30 21:25 [ECOS] ethernet driver - receiving packets doesn't work Tom Malcolmson
  2007-08-30 22:46 ` Gary Thomas
@ 2007-08-31  6:50 ` Andrew Lunn
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2007-08-31  6:50 UTC (permalink / raw)
  To: Tom Malcolmson; +Cc: ecos-discuss

> Now, I should expain that there is no actual ethernet hardware, so no 
> ethernet interrupts, etc.

Since there is no actual hardware, could you run this on the synthetic
target on Linux? You then get debug capabilities.

> I believe that the next step for me would be to insert print statements in 
> if_ethersubr.c.

Yes. You have to slowly work your way up the stack to find out why the
packets are being dropped. It is probably something silly, like they
are the wrong length, or you have not taken the MAC header off etc....

    Andrew

-- 
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] 4+ messages in thread

* Re: [ECOS] ethernet driver - receiving packets doesn't work (conclusion)
  2007-08-30 22:46 ` Gary Thomas
@ 2007-09-01 16:59   ` Tom Malcolmson
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Malcolmson @ 2007-09-01 16:59 UTC (permalink / raw)
  To: Gary Thomas; +Cc: ecos-discuss

Gary Thomas wrote:
> Tom Malcolmson wrote:
>   
>> Hi.
>>
>> I'm new to eCos - we are trying to move away from a proprietary OS, and
>> I'm having basic problems with my Ethernet driver.
>>
>> I'm using an eCos 2.0 snapshot from September 2006 on an ARM platform
>> with the standard FreeBSD stack.
>>
>> Sending packets from an eCos app, thru my driver works fine, but eCos
>> doesn't seem to do anything with the packets that I deliver up to it:
>> they never back up to the application.  For DHCP for instance, I see the
>> DHCP request come out of my system, and I see a DHCP offer from the
>> server go back into my system.  I can see from debug prints in the
>> generic ethernet driver that it has correctly received the DHCP offer,
>> but the offer never gets back to the app.  I have tried apps other then
>> DHCP.
>>
>> Now, I should expain that there is no actual ethernet hardware, so no
>> ethernet interrupts, etc.  My guide for writing the driver has been the
>> eCos reference manual, chapter 46:
>> http://ecos.sourceware.org/docs-2.0/ref/io-eth-drv-generic1.html
>> But I skip some steps since I don`t have a DSR.  When I have a packet
>> for the net stack, I just call (sc->funs->eth_drv->recv)() with the
>> number of bytes needed.  eCos calls my receive function which puts the
>> packet into the sg list.  From debug output I can see that the generic
>> driver code (eth_drv.c) has corrrectly received my packet and presumably
>> calls ether_input.
>>
>> A couple other thing.  Loopback tests work.  I don`t have any debugging
>> capability.
>>
>> I believe that the next step for me would be to insert print statements
>> in if_ethersubr.c.
>>     
>
> For the network stack, you need to at least pretend that you
> get interrupts and call the DSR.  The driver normally calls
> into the network stack at DSR time and the stack's input
> processing thread is what eventually calls your handler
> to fetch the packet, etc.  I don't think it will work without
> this interaction.
>   
Thanks Andrew and Gary for your responses.

I changed my implementation as above.  This did not solve my problem, 
but it did lead me to the solution.  With this new implementation I 
found that my driver_deliver function was not getting called, and that 
this was because the net stack threads weren't getting scheduled.   The 
priorities of some of my threads were too high.  So, lowering 
CYGPKG_NET_THREAD_PRIORITY solved my problem.

Tom.

-- 
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] 4+ messages in thread

end of thread, other threads:[~2007-09-01 16:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-30 21:25 [ECOS] ethernet driver - receiving packets doesn't work Tom Malcolmson
2007-08-30 22:46 ` Gary Thomas
2007-09-01 16:59   ` [ECOS] ethernet driver - receiving packets doesn't work (conclusion) Tom Malcolmson
2007-08-31  6:50 ` [ECOS] ethernet driver - receiving packets doesn't work Andrew Lunn

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).