LKML Archive on
help / color / mirror / Atom feed
* dev.c -- dev_queue_xmit-- Is the comment misleading or is it a bug??
@ 2004-05-27 14:21 Kumar, Sharath
  0 siblings, 0 replies; only message in thread
From: Kumar, Sharath @ 2004-05-27 14:21 UTC (permalink / raw)
  To: linux-kernel

Hi, (Please mark a cc to my id  in your reply as I am not subscribed to this list Thanks in advance :-))

I am attaching the snippet for dev_queue_xmit code in net/core/dev.c 

The issue I am trying to point out here is about calling this function from  an interrupt context.
(The comment clearly says that I am right in doing so)

So this function has to be re-entrant if it can be called from an interrupt which means 
q->enqueue() also needs to be re-entrant.

The enqueue function by default is mapped to  pfifo_fast_enqueue  (net/sched/sch_generic.c)
unfortunately the code in this function updates the transmit queue and qdisc->q.qlen
without disabling interrupts. 

So If I call dev_queue_xmit from a non-interrupt context and if I  have an interrupt which again makes
a call to dev_queue_xmit(on the same device), then my transmit queue may be left in inconsistent state  :-(

Either the comment is misleading or I am missing something here.

 *	dev_queue_xmit - transmit a buffer
 *	@skb: buffer to transmit
 *	Queue a buffer for transmission to a network device. The caller must
 *	have set the device and priority and built the buffer before calling
 *	this function. The function can be called from an interrupt.
 *	A negative errno code is returned on a failure. A success does not
 *	guarantee the frame will be transmitted as it may be dropped due
 *	to congestion or traffic shaping.

int dev_queue_xmit(struct sk_buff *skb)
	/* Grab device queue */
	q = dev->qdisc;
	if (q->enqueue) {
		rc = q->enqueue(skb, q);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-05-27 14:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-27 14:21 dev.c -- dev_queue_xmit-- Is the comment misleading or is it a bug?? Kumar, Sharath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).