Using work queues within hard_xmit of a network driver

烈酒焚心 提交于 2019-12-10 18:35:53

问题


We have created our own network device driver. There is a situation where we need to wait for the hard ware to become ready before we send any data in the tx function (the one registered with .ndo_start_xmit). Since we can't sleep/wait in atomic context, we have implemented a workaround by scheduling work queue from within the tx function. The work queue can then wait for the hardware to become ready and send the data.

Is there a better way to do this? i.e. return from .ndo_start_xmit() immediately but at the same time schedule the frame to be sent to the hardware whenever it becomes ready.

Additional information regarding our implementation: We call netif_stop_queue() from .ndo_start_xmit() just before scheduling the work queue. When the work queue handler gets executed, we call netif_start_queue() inside it just after sending the frame out the hardware. This works fine but sometimes we get this error:

NOHZ: local_softirq_pending 08

Of course there is latency in this process, but it works fine in our current application. Our network chip is interfaced to our processor over SPI and can receive ethernet frames as is over SPI. These ethernet frames are further transmitted over the physical media by the chip.

We are using kernel version 2.6.31 on imx233.

来源:https://stackoverflow.com/questions/13642542/using-work-queues-within-hard-xmit-of-a-network-driver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!