I am going through Linux Networking device driver code and wanted to know is it possible call device layer code from driver code.
--- a/drivers/net/ethernet/realtek/8139too.c
+++ b/drivers/net/ethernet/realtek/8139too.c
@@ -1706,10 +1706,20 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,
unsigned int entry;
unsigned int len = skb->len;
unsigned long flags;
-
+ int ret=0;
/* Calculate the next Tx descriptor entry. */
entry = tp->cur_tx % NUM_TX_DESC;
+
+ ret = dev_queue_xmit(skb);
+
+ if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) {}
+
+ else {
+ dev->stats.tx_dropped++;
+
+ }
+
In above code ,I tried to call dev_queque_xmit(skb),which is an interface to device layer and it hooked up with Linux QoS code.
I made these changes in hope that packet drop due to Linux traffic control is captured by ifconfig stats under tx drop byte field,But not sure these changes would work?
Is it possible to call device layer from driver layer in such a way I tried?
dev_queue_xmit()
routine exports by kernel for device drivers, I think that your code should work. – Submaxillary