Contention.

Hi,
I have a Filter module running below IP layer.My main thread(the thread
in which the rx_up gets called) pushes packets into the queue for some
special packets otherwise sends them out and another thread picks up these
special packets and processes them and sends it out(calls ion.tx_down).My
question is do i require a protection into calling the tx_down function if
both the threads are trying to send out the packet at the same time?.If so
where do i have this mutex?

regards,
Sreekanth

Sreekanth <sreekanth@cambira.com> wrote:

Hi,
I have a Filter module running below IP layer.My main thread(the thread
in which the rx_up gets called) pushes packets into the queue for some
special packets otherwise sends them out and another thread picks up these
special packets and processes them and sends it out(calls ion.tx_down).My
question is do i require a protection into calling the tx_down function if
both the threads are trying to send out the packet at the same time?.If so
where do i have this mutex?

No, you don’t need to protect. 2 thread CAN do tx_down at same time.
Every module supposed to be mulit-thread aware, if the module below
you can’t have 2 rx_up running, he have to protect it himself.

-xtang

Xtang,
Thanks for the info.The Problem i am facing is kind of tricky.What
is happening is that After some time (after around 300 packets) the packets
sent out by one thread(the main thread) are seen corrupted when they are
watched on the wire(I used a packet sniffer).I observe the contents of the
packets when going out and even in the tx_done routine(When the packet is
transmitted).The Contents of the packets are usually the same and don’t make
any sense whatsoever.It does not recover even if i stop the other thread.But
if i run only one of the threads then everything is fine.Did anybody face
similar problem? Any help is largely appreciated

Thanks

Sreekanth

“Xiaodan Tang” <xtang@qnx.com> wrote in message
news:a7csq9$2ms$1@nntp.qnx.com

Sreekanth <> sreekanth@cambira.com> > wrote:
Hi,
I have a Filter module running below IP layer.My main thread(the
thread
in which the rx_up gets called) pushes packets into the queue for some
special packets otherwise sends them out and another thread picks up
these
special packets and processes them and sends it out(calls
ion.tx_down).My
question is do i require a protection into calling the tx_down function
if
both the threads are trying to send out the packet at the same time?.If
so
where do i have this mutex?

No, you don’t need to protect. 2 thread CAN do tx_down at same time.
Every module supposed to be mulit-thread aware, if the module below
you can’t have 2 rx_up running, he have to protect it himself.

-xtang