what happens at tx_done ?

Hi,

I’m doing a little tracking on a bug I have and I’m trying to figure out the
following:

My packet is coming from tcp/ip after punching ping xxxx.

In general, I want to replace the packet from the stack with one of my own.

In my_tx_down function:
I’m allocation a new packet with alloc_down_npkt(_hdl, 0,
(void**)my_net_buf)
I’m allocating new buffers and connecting them to the packet.
Now I can see that num_complete=req_complete=1
Now, I’m registration this packet with reg_tx_done.
Now I can see that num_complete=1 req_complete=2
Before sending the packet with tx_down I can see that the npkt_done_t is
empty (assuming it’s directly following the npkt_t structure), that is:
registrant_hdl=0 and done_hdl=0. (??? suspicious ???)

Sending via tx_down appears to succeed (I.e., returns TX_DOWN_OK), but:

  • No packet is sent on the wire
  • After about half a minute:
  • “io-net: ex_tx_done BAD3” is printed to the terminal from which io-net
    was invoked
  • my tx_done callback is called

What’s wrong with this picture?


Benzy Gabay
R&D
Everbee Wireless
mailto:bgabay@everbeewireless.com
tel. +972-9-956-0135
fax. +972-9-955-9654

Benzy Gabay <bgabay@everbee.com> wrote:
: Hi,

: I’m doing a little tracking on a bug I have and I’m trying to figure out the
: following:

: My packet is coming from tcp/ip after punching ping xxxx.

: In general, I want to replace the packet from the stack with one of my own.

: In my_tx_down function:
: I’m allocation a new packet with alloc_down_npkt(_hdl, 0,
: (void**)my_net_buf)
: I’m allocating new buffers and connecting them to the packet.
: Now I can see that num_complete=req_complete=1

This is suspicious. After ion->alloc_down_npkt(), num_complete = x,
req_complete = 0. You must have overwritten req_complete somewhere
or something was freed twice or too soon and io-net returned you an
in use buffer.

: Now, I’m registration this packet with reg_tx_done.
: Now I can see that num_complete=1 req_complete=2
: Before sending the packet with tx_down I can see that the npkt_done_t is
: empty (assuming it’s directly following the npkt_t structure), that is:
: registrant_hdl=0 and done_hdl=0. (??? suspicious ???)

Immediately after ion->alloc_down_npkt, the npkt_done_t immediately after
the npkt are not initialized so registrant_hdl=0 and done_hdl=0 are
certainly possible. If req_complete > num_complete they are not
stored after the npkt for obvious reasons but io-net learns that it
didn’t allocate enough. Next time you call ion->alloc_down_npkt, req_complete
will be greater.

: Sending via tx_down appears to succeed (I.e., returns TX_DOWN_OK), but:
: - No packet is sent on the wire
: - After about half a minute:
: - “io-net: ex_tx_done BAD3” is printed to the terminal from which io-net
: was invoked
: - my tx_done callback is called

Sounds like you’ve got a buffer management problem somewhere: overwriting a
buffer, freeing something incorrectly. io-net is noticing something
is wrong. My guess is that your tx_done is being called erroneously.

-seanb