Question about dev_queue_xmit and guaranteed packet transmission

From: Jeffrey Merkey
Date: Wed May 08 2019 - 23:49:08 EST


I noticed that Linux has been updated on later versions to always
consume the skb in calls to dev_queue_xmit, and may even drop the skb
after returning a return code of NETDEV_TX_OK which seems kind of
broken. I have an application which requires guaranteed skb
transmission and the following code seems to work well for me if I
call the
netdev->netdev_ops->ndo_start_xmit function directly instead of using
dev_queue_xmit.

Is there a method of calling dev_queue_xmit which guarantees packet
transmission? The current implementation of dev_queue_xmit used to
return error codes without consuming the skb, which allowed programs
which call it to simply resend the failing skb by calling
dev_queue_xmit again without having to recreate and repopulate the
skb. There also appears to be no reliable way to know for certain if
dev_queue_xmit even sent a packet since it can at times return
NETDEV_TX_OK then turn around and drop the packet later on.

I have it working calling the ndo_start_xmit driver function directly
which does seem to guarantee transmission, but would like to know if
there is a way to get guaranteed TX of skb's with dev_queue_xmit.

Jeff