How to get tx_done() after tx_down() ?

I’ve write net filter (under QNX 6.3) that can
catch any packet that goes up (from eth. card en0) on my filter rx_up()
and can send raw ethernet frames to en0 using card tx_down().

It works fine, but there is no call to my filter tx_done()
after en0 tx_down().
Why ?

PS
I tried to create and fill one npkt_done_t strucure
(immediately after npkt_t struct):
npkt_done->done_hdl = filter_funcs.tx_done;
npkt_done->registrant_hdl = filter_reg_hdl;
but it doesn’t work :frowning:.

Q <no@spam.pl> wrote:

I’ve write net filter (under QNX 6.3) that can
catch any packet that goes up (from eth. card en0) on my filter rx_up()
and can send raw ethernet frames to en0 using card tx_down().

It works fine, but there is no call to my filter tx_done()
after en0 tx_down().
Why ?

PS
I tried to create and fill one npkt_done_t strucure
(immediately after npkt_t struct):
npkt_done->done_hdl = filter_funcs.tx_done;
npkt_done->registrant_hdl = filter_reg_hdl;
but it doesn’t work > :frowning:> .

You need to reg_tx_done() before tx_down().

-seanb

You need to reg_tx_done() before tx_down().

thanks!

Is it [callback to tx_done()] necessary to know
about tx_down() errors ?

/ tx_down() return codes:
#define TX_DOWN_AGAIN 1
#define TX_DOWN_OK 0
#define TX_DOWN_FAILED -1

Can I free tx buffer immediately after tx_down()?
/ or I have to wait for [registered] tx_done() ?

Q <no@spam.pl> wrote:

You need to reg_tx_done() before tx_down().

thanks!

Is it [callback to tx_done()] necessary to know
about tx_down() errors ?

/ tx_down() return codes:
#define TX_DOWN_AGAIN 1
#define TX_DOWN_OK 0
#define TX_DOWN_FAILED -1

Can I free tx buffer immediately after tx_down()?
/ or I have to wait for [registered] tx_done() ?

You have to wait. After tx_down() you packet is pass down to the module
below to you (the eth driver), and the driver will try to put packet
on the wire. Only when the hardware tells the driver the packet is sent,
then the driver will try to free the packet (by calling
io-net->tx_done(), which will in turn call your filter->tx_done()
function to let you free the packet, if you have reg_tx_done() it)

One thing (since you are writing a filter), you can only free the
packet that is allocate by yourself. If you only changed the packet
contents but haven’t add any net_buf into a packet. You don’t need
to reg_tx_done() and you don’t need to touch the packet when it
is done.

-xtang

Only when the hardware tells the driver the packet is sent,
then the driver will try to free the packet (by calling
io-net->tx_done(), which will in turn call your filter->tx_done()

So what does it mean
when tx_down() returns TX_DOWN_OK ?

packet struct is OK & packet was transmitted (outside hardware)?
packet struct is OK but packet wasn’t transmitted?
…?

Q <no@spam.pl> wrote:

Only when the hardware tells the driver the packet is sent,
then the driver will try to free the packet (by calling
io-net->tx_done(), which will in turn call your filter->tx_done()

So what does it mean
when tx_down() returns TX_DOWN_OK ?

packet struct is OK & packet was transmitted (outside hardware)?
packet struct is OK but packet wasn’t transmitted?
…?

You lower layer accept the packet and (if it is a network driver)
will transmit it.

-xtang