Device driver only receives 5 tcpip (npkts) within a period

Hi,
I have written a “device driver” (up-producer) which is not
interfacing a real device, but passing the ethernet packets via an
IPC to a “device”.
Receving pkts via IPC and passing them up the tcpip stack via io-net
(tx_up_start() ) is no problem!
But receiving pkts from the tcpip is not working propably!!
The uml_nwd_rx_down() function receive 5 pkts, then no
more pkts is received; until the tcpip-v4.so somehow clear some
buffers, then uml_nwd_rx_down() receive some (<5)
pkts again. This continue.Can anybody explain me what
the problem is?

I have written a tiny socket application which send small UDP packets.
In cases where the pkts is not received by my device driver, errno is
set to 264 (HOST is down).


io_net_dll_entry_t io_net_dll_entry = {
2,
uml_nwd_entry,
NULL
};

io_net_registrant_funcs_t uml_nwd_funcs = {
8,
NULL,
uml_nwd_rx_down,
uml_nwd_tx_done,
uml_nwd_shutdown1,
uml_nwd_shutdown2,
uml_nwd_advertise,
NULL,
NULL,
NULL
};

io_net_registrant_t uml_nwd_reg = {
_REG_PRODUCER_UP | _REG_TRACK_MCAST,
“devn-emuNwd”,
“en”,
NULL,
NULL,
&uml_nwd_funcs,
0
};
The uml_nwd_rx_down() looks as follows.I have seen that the pkts
received has the npkt->flags set to _NPKT_BCAST!
I have also tried to send tx_done() (ion_tx_complete) after I have
defrag_and_sent the pkt, but with the same result.

[color=blue:573caae818]int uml_nwd_rx_down( npkt_t *npkt, void *hdl)
{
Nic_t *nic = (Nic_t *)hdl;
pcnet_ext_t *ext;


ext = (pcnet_ext_t *)nic->ext;


if( npkt->flags & _NPKT_MSG ) {

if( npkt->flags & _NPKT_NO_RES ) {
ion_free(npkt->org_data);
ion_free( npkt );
}
else {
ion_tx_complete(ext->reg_hdl, npkt);
}
}
else {
/* Just standard packet data! */
defrag_and_send();
// ion_tx_complete(ext->reg_hdl, npkt);
}
return( EOK );
}[/color:573caae818]
I start the io-net as follows:
[color=blue:573caae818]io-net -i1 -v -demuNwd mac=123456789abc
-ptcpip-v4 prefix=/sock2
SOCK=/sock2 ifconfig en0 193.240.113.28[/color:573caae818]

HaBe <hans.bergseth@thales-esecurity-dot-com.no-spam.invalid> wrote:

Hi,
I have written a “device driver” (up-producer) which is not
interfacing a real device, but passing the ethernet packets via an
IPC to a “device”.
Receving pkts via IPC and passing them up the tcpip stack via io-net
(tx_up_start() ) is no problem!
But receiving pkts from the tcpip is not working propably!!
The uml_nwd_rx_down() function receive 5 pkts, then no
more pkts is received; until the tcpip-v4.so somehow clear some
buffers, then uml_nwd_rx_down() receive some (<5)
pkts again. This continue.Can anybody explain me what
the problem is?

I have written a tiny socket application which send small UDP packets.
In cases where the pkts is not received by my device driver, errno is
set to 264 (HOST is down).

It sounds like the stack is sending arp requests for the
other end and not receiving a reply. Try seeding
the arp entry by hand:

arp -s xx:xx:xx:xx:xx:xx

-seanb


io_net_dll_entry_t io_net_dll_entry = {
2,
uml_nwd_entry,
NULL
};

io_net_registrant_funcs_t uml_nwd_funcs = {
8,
NULL,
uml_nwd_rx_down,
uml_nwd_tx_done,
uml_nwd_shutdown1,
uml_nwd_shutdown2,
uml_nwd_advertise,
NULL,
NULL,
NULL
};

io_net_registrant_t uml_nwd_reg = {
_REG_PRODUCER_UP | _REG_TRACK_MCAST,
“devn-emuNwd”,
“en”,
NULL,
NULL,
&uml_nwd_funcs,
0
};
The uml_nwd_rx_down() looks as follows.I have seen that the pkts
received has the npkt->flags set to _NPKT_BCAST!
I have also tried to send tx_done() (ion_tx_complete) after I have
defrag_and_sent the pkt, but with the same result.

[color=blue:573caae818]int uml_nwd_rx_down( npkt_t *npkt, void *hdl)
{
Nic_t *nic = (Nic_t *)hdl;
pcnet_ext_t *ext;


ext = (pcnet_ext_t *)nic->ext;



if( npkt->flags & _NPKT_MSG ) {

if( npkt->flags & _NPKT_NO_RES ) {
ion_free(npkt->org_data);
ion_free( npkt );
}
else {
ion_tx_complete(ext->reg_hdl, npkt);
}
}
else {
/* Just standard packet data! */
defrag_and_send();
// ion_tx_complete(ext->reg_hdl, npkt);
}
return( EOK );
}[/color:573caae818]
I start the io-net as follows:
[color=blue:573caae818]io-net -i1 -v -demuNwd mac=123456789abc
-ptcpip-v4 prefix=/sock2
SOCK=/sock2 ifconfig en0 193.240.113.28[/color:573caae818]

Hi Sean,
if I have just looked into the ethernet packet I would have seen that
it was an ARP packet and not my UDP packet.

Thank you!