Issue
I modify the transmit function (ndo_start_xmit
) of a virtual network device which gets an struct sk_buff skb_one
as input.
At one point in the transmission flow I generate a second struct sk_buff skb_second
. This one should go through the same flow skb_one
was going, so it should be sent by the virtual device I am currently in. Furthermore it should be sent after skb_one
.
I thought about two different methods. One is modyfing the queue skb_one
is in:
skb_second->next = skb_one->next;
skb_second->prev = skb_one;
skb_one->next = skb_frag;
Using this approach it is sent after skb_one
but it is not going through the transmission flow of the virtual network device.
The second approach is just using
dev_queue_xmit(skb_second);
With this approach the skb_second
goes through the transmission flow "again", but it is sent before skb_one
.
Is there a possibility to reach both goals?
Solution
dev_queue_xmit
would eventually try to get the device's xmit_lock
, but it would fail because being in ndo_start_xmit
you should already hold it.
So the frame would be queued to run in the NET_TX_SOFTIRQ
after skb_one
is sent out and ndo_start_xmit
has returned.
Am I missing something?
Answered By - a3f Answer Checked By - Gilberto Lyons (WPSolving Admin)