public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] How does  the freebsd socket call the drivers?
@ 2008-03-24 14:35 venice
  2008-03-26 15:27 ` Jürgen Lambrecht
  0 siblings, 1 reply; 4+ messages in thread
From: venice @ 2008-03-24 14:35 UTC (permalink / raw)
  To: ecos-discuss

Hi, I'm writing a net driver and I have a driver template to do that but I 
still do not know how the applications call the drivers through the freebsd 
stack. So can you explain the calling functions of the freebsd stack to the 
drivers?
eg:
    HRDWR_send() can send data by the hardware but who will call this 
function and provide the data buffer to be transported?

Regards,
Venice 


-- 
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] How does  the freebsd socket call the drivers?
  2008-03-24 14:35 [ECOS] How does the freebsd socket call the drivers? venice
@ 2008-03-26 15:27 ` Jürgen Lambrecht
       [not found]   ` <BLU108-DS2355FC752EBFF4BB490D79EFE0@phx.gbl>
  0 siblings, 1 reply; 4+ messages in thread
From: Jürgen Lambrecht @ 2008-03-26 15:27 UTC (permalink / raw)
  To: venice, ecos-discuss

venice wrote:

> Hi, I'm writing a net driver and I have a driver template to do that
> but I still do not know how the applications call the drivers through
> the freebsd stack. So can you explain the calling functions of the
> freebsd stack to the drivers?
> eg:
> HRDWR_send() can send data by the hardware but who will call this
> function and provide the data buffer to be transported?

Your driver implements it in
ecos\packages\devs\eth\[family]\[platform]\current\src\xxx.c
There a macro fills in the function pointer HRDWR_send(), in my case
stdims_eth_send:

ETH_DRV_SC(stdims_eth_sc0,
(void*) &stdims_eth0,
"eth0",
stdims_eth_start,
stdims_eth_stop,
stdims_eth_control,
stdims_eth_can_send,
stdims_eth_send,
stdims_eth_recv,
stdims_eth_deliver,
stdims_eth_poll,
stdims_eth_intvector);
NETDEVTAB_ENTRY(stdims_eth_netdev0,
"stdims_eth0",
stdims_eth_init,
&stdims_eth_sc0);

In the documentation you can read the calling order.

J篓鹿rgen Lambrecht

>
> Regards,
> Venice
>

-- 
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] How does  the freebsd socket call the drivers?
       [not found]   ` <BLU108-DS2355FC752EBFF4BB490D79EFE0@phx.gbl>
@ 2008-03-27  8:28     ` Jürgen Lambrecht
  0 siblings, 0 replies; 4+ messages in thread
From: Jürgen Lambrecht @ 2008-03-27  8:28 UTC (permalink / raw)
  To: venice, eCos Discussion

venice wrote:

>
>
> --------------------------------------------------
> From: "J篓鹿rgen Lambrecht" <J.Lambrecht@televic.com>
> Sent: Wednesday, March 26, 2008 8:30 PM
> To: "venice" <venice.tu@live.com>; <ecos-discuss@ecos.sourceware.org>
> Subject: Re: [ECOS] How does the freebsd socket call the drivers?
>
>> venice wrote:
>>
>>> Hi, I'm writing a net driver and I have a driver template to do that
>>> but I still do not know how the applications call the drivers through
>>> the freebsd stack. So can you explain the calling functions of the
>>> freebsd stack to the drivers?
>>> eg:
>>> HRDWR_send() can send data by the hardware but who will call this
>>> function and provide the data buffer to be transported?
>>
>>
>> Your driver implements it in
>> ecos\packages\devs\eth\[family]\[platform]\current\src\xxx.c
>> There a macro fills in the function pointer HRDWR_send(), in my case
>> stdims_eth_send:
>>
>> ETH_DRV_SC(stdims_eth_sc0,
>> (void*) &stdims_eth0,
>> "eth0",
>> stdims_eth_start,
>> stdims_eth_stop,
>> stdims_eth_control,
>> stdims_eth_can_send,
>> stdims_eth_send,
>> stdims_eth_recv,
>> stdims_eth_deliver,
>> stdims_eth_poll,
>> stdims_eth_intvector);
>> NETDEVTAB_ENTRY(stdims_eth_netdev0,
>> "stdims_eth0",
>> stdims_eth_init,
>> &stdims_eth_sc0);
>>
>> In the documentation you can read the calling order.
>>
>> J篓鹿rgen Lambrecht
>
>
> Thank J篓鹿rgen. My template is something like yours', but I don't know
> which function will call "stdims_eth_send"? you know the the function
> is declared :
>
> stdims_eth_send(struct eth_drv_sc *sc, struct eth_drv_sg *sg_list, int
> sg_len,
> int total_len, unsigned long key)
>
> The function just sends data out by hardware, so there must be a data
> buffer created by stack and if the stack want to send data it will put
> data to the buffer and the will call this function.
> Well, I haven't enough time to through out the source code of freebsd
> stack but I think the stack will work in this way. But I don't know
> the interface of the stack, maybe the data buffer? If I have more time
> I will trace the stack for that.
> Anyway, thanks!

1. cdl options

see \ecos\packages\net\bsd_tcpip\current\cdl\freebsd_net.cdl for TCP/IP
stack options
(e.g. CYGPKG_NET_MEM_USAGE)
and \ecos\packages\net\common\current\cdl\net.cdl for network support
options (TFTP, DHCP or fixed IP addresses, ..)

2. read chapter "TCP/IP Stack Support for eCos
<http://ecos.sourceware.org/docs-latest/ref/net-common-tcpip.html>" on
http://ecos.sourceware.org/docs-latest/ref/ecos-ref.html
or
read a TCP/IP book.
To send data, you need to create a socket. A TCP socket is a
SOCK_STREAM, a UDP socket is a SOCK_DGRAM.
A TCP socket can be client (initiator) or server (listener). A server
e.g. listen(..) for incoming connections, and then accept(..) the
connection if select(..) returned that there is data available. With TCP
you read(..) and write(..) data from/to the TCP socket.
With UDP you just recvfrom(..) or sendto(..) a UDP packet.

3. If you want to use big UDP packets over 9kB, you have to change the
socket send buffer size (SO_SNDBUF) (high water level).
There a lot of socket options you can set. Read documentation about this
if you need it.

Success,
J篓鹿rgen

>
> Regards,
> Venice


-- 
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] How does  the freebsd socket call the drivers?
@ 2008-03-27  8:25 venice
  0 siblings, 0 replies; 4+ messages in thread
From: venice @ 2008-03-27  8:25 UTC (permalink / raw)
  To: ecos-discuss



--------------------------------------------------
From: "J篓鹿rgen Lambrecht" <J.Lambrecht@televic.com>
Sent: Wednesday, March 26, 2008 8:30 PM
To: "venice" <venice.tu@live.com>; <ecos-discuss@ecos.sourceware.org>
Subject: Re: [ECOS] How does  the freebsd socket call the drivers?

> venice wrote:
>
>> Hi, I'm writing a net driver and I have a driver template to do that
>> but I still do not know how the applications call the drivers through
>> the freebsd stack. So can you explain the calling functions of the
>> freebsd stack to the drivers?
>> eg:
>> HRDWR_send() can send data by the hardware but who will call this
>> function and provide the data buffer to be transported?
>
> Your driver implements it in
> ecos\packages\devs\eth\[family]\[platform]\current\src\xxx.c
> There a macro fills in the function pointer HRDWR_send(), in my case
> stdims_eth_send:
>
> ETH_DRV_SC(stdims_eth_sc0,
> (void*) &stdims_eth0,
> "eth0",
> stdims_eth_start,
> stdims_eth_stop,
> stdims_eth_control,
> stdims_eth_can_send,
> stdims_eth_send,
> stdims_eth_recv,
> stdims_eth_deliver,
> stdims_eth_poll,
> stdims_eth_intvector);
> NETDEVTAB_ENTRY(stdims_eth_netdev0,
> "stdims_eth0",
> stdims_eth_init,
> &stdims_eth_sc0);
>
> In the documentation you can read the calling order.
>
> J篓鹿rgen Lambrecht

Thank J篓鹿rgen. My template is something like yours', but I don't know which
function will call  "stdims_eth_send"?  you know the the function is
declared :

stdims_eth_send(struct eth_drv_sc *sc, struct eth_drv_sg *sg_list, int
sg_len,
              int total_len, unsigned long key)

  The function just sends data out by hardware, so there must be a data
buffer created by stack and if the stack want to send data it will put data
to the buffer and the  will call this function.
    Well, I haven't enough time to through out the source code of freebsd
stack but I think the stack will work in this way. But I don't know the
interface of the stack, maybe the data buffer? If I have more time I will
trace the stack for that.
    Anyway, thanks!

 Regards,
 Venice
 


-- 
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:[~2008-03-27  8:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-24 14:35 [ECOS] How does the freebsd socket call the drivers? venice
2008-03-26 15:27 ` Jürgen Lambrecht
     [not found]   ` <BLU108-DS2355FC752EBFF4BB490D79EFE0@phx.gbl>
2008-03-27  8:28     ` Jürgen Lambrecht
2008-03-27  8:25 venice

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