Skip to content

Commit 21274aa

Browse files
Smadar Fuksdavem330
authored andcommitted
octeontx2-af: Add additional register check to rvu_poll_reg()
Check one more time before exiting the API with an error. Fix API to poll at least twice, in case there are other high priority tasks and this API doesn't get CPU cycles for multiple jiffies update. In addition, increase timeout from usecs_to_jiffies(10000) to usecs_to_jiffies(20000), to prevent the case that for CONFIG_100HZ timeout will be a single jiffies. A single jiffies results actual timeout that can be any time between 1usec and 10msec. To solve this, a value of usecs_to_jiffies(20000) ensures that timeout is 2 jiffies. Signed-off-by: Smadar Fuks <[email protected]> Signed-off-by: Sunil Goutham <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8eebaf4 commit 21274aa

File tree

1 file changed

+11
-1
lines changed
  • drivers/net/ethernet/marvell/octeontx2/af

1 file changed

+11
-1
lines changed

drivers/net/ethernet/marvell/octeontx2/af/rvu.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ static void rvu_setup_hw_capabilities(struct rvu *rvu)
9292
*/
9393
int rvu_poll_reg(struct rvu *rvu, u64 block, u64 offset, u64 mask, bool zero)
9494
{
95-
unsigned long timeout = jiffies + usecs_to_jiffies(10000);
95+
unsigned long timeout = jiffies + usecs_to_jiffies(20000);
96+
bool twice = false;
9697
void __iomem *reg;
9798
u64 reg_val;
9899

@@ -107,6 +108,15 @@ int rvu_poll_reg(struct rvu *rvu, u64 block, u64 offset, u64 mask, bool zero)
107108
usleep_range(1, 5);
108109
goto again;
109110
}
111+
/* In scenarios where CPU is scheduled out before checking
112+
* 'time_before' (above) and gets scheduled in such that
113+
* jiffies are beyond timeout value, then check again if HW is
114+
* done with the operation in the meantime.
115+
*/
116+
if (!twice) {
117+
twice = true;
118+
goto again;
119+
}
110120
return -EBUSY;
111121
}
112122

0 commit comments

Comments
 (0)