Commit 605a9bbc authored by Geetha sowjanya's avatar Geetha sowjanya Committed by David S. Miller

net: thunderx: Reduce mbox wait response time.

Replace msleep() with usleep_range() as internally it uses hrtimers.
This will put a cap on maximum wait time.
Signed-off-by: default avatarGeetha sowjanya <gakula@marvell.com>
Signed-off-by: default avatarSunil Goutham <sgoutham@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c0d2507a
...@@ -126,8 +126,7 @@ static void nicvf_write_to_mbx(struct nicvf *nic, union nic_mbx *mbx) ...@@ -126,8 +126,7 @@ static void nicvf_write_to_mbx(struct nicvf *nic, union nic_mbx *mbx)
int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx) int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx)
{ {
int timeout = NIC_MBOX_MSG_TIMEOUT; unsigned long timeout;
int sleep = 10;
int ret = 0; int ret = 0;
mutex_lock(&nic->rx_mode_mtx); mutex_lock(&nic->rx_mode_mtx);
...@@ -137,6 +136,7 @@ int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx) ...@@ -137,6 +136,7 @@ int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx)
nicvf_write_to_mbx(nic, mbx); nicvf_write_to_mbx(nic, mbx);
timeout = jiffies + msecs_to_jiffies(NIC_MBOX_MSG_TIMEOUT);
/* Wait for previous message to be acked, timeout 2sec */ /* Wait for previous message to be acked, timeout 2sec */
while (!nic->pf_acked) { while (!nic->pf_acked) {
if (nic->pf_nacked) { if (nic->pf_nacked) {
...@@ -146,11 +146,10 @@ int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx) ...@@ -146,11 +146,10 @@ int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx)
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
msleep(sleep); usleep_range(8000, 10000);
if (nic->pf_acked) if (nic->pf_acked)
break; break;
timeout -= sleep; if (time_after(jiffies, timeout)) {
if (!timeout) {
netdev_err(nic->netdev, netdev_err(nic->netdev,
"PF didn't ACK to mbox msg 0x%02x from VF%d\n", "PF didn't ACK to mbox msg 0x%02x from VF%d\n",
(mbx->msg.msg & 0xFF), nic->vf_id); (mbx->msg.msg & 0xFF), nic->vf_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment