]> git.baikalelectronics.ru Git - kernel.git/commit
cxgb4: Synchronize access to mailbox
authorHariprasad Shenai <hariprasad@chelsio.com>
Fri, 6 Jan 2017 03:17:20 +0000 (08:47 +0530)
committerDavid S. Miller <davem@davemloft.net>
Fri, 6 Jan 2017 20:54:40 +0000 (15:54 -0500)
commit55bee47351dc81128e6a4944a5a3215503fdc3a6
tree438efffe762cde024a6adc03344f8655995c7b9a
parent44493c9eba7a452d02c6a2bd000976b76caa341d
cxgb4: Synchronize access to mailbox

The issue comes when there are multiple threads attempting to use
the mailbox facility at the same time.
When DCB operations and interface up/down is run in a loop for every
0.1 sec, we observed mailbox collisions. And out of the two commands
one would fail with the present code, since we don't queue the second
command.

To overcome the above issue, added a queue to access the mailbox.
Whenever a mailbox command is issued add it to the queue. If its at
the head issue the mailbox command, else wait for the existing command
to complete. Usually command takes less than a milli-second to
complete.

Also timeout from the loop, if the command under execution takes
long time to run.

In reality, the number of mailbox access collisions is going to be
very rare since no one runs such abusive script.

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c