mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-23 16:19:28 +07:00
nfp: opportunistically poll for reconfig result
If the reconfig was a quick update, we could have results available from firmware within 200us. Signed-off-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1deeb6408c
commit
e64718282c
@ -137,20 +137,37 @@ static bool nfp_net_reconfig_check_done(struct nfp_net *nn, bool last_check)
|
||||
return false;
|
||||
}
|
||||
|
||||
static int nfp_net_reconfig_wait(struct nfp_net *nn, unsigned long deadline)
|
||||
static bool __nfp_net_reconfig_wait(struct nfp_net *nn, unsigned long deadline)
|
||||
{
|
||||
bool timed_out = false;
|
||||
int i;
|
||||
|
||||
/* Poll update field, waiting for NFP to ack the config.
|
||||
* Do an opportunistic wait-busy loop, afterward sleep.
|
||||
*/
|
||||
for (i = 0; i < 50; i++) {
|
||||
if (nfp_net_reconfig_check_done(nn, false))
|
||||
return false;
|
||||
udelay(4);
|
||||
}
|
||||
|
||||
/* Poll update field, waiting for NFP to ack the config */
|
||||
while (!nfp_net_reconfig_check_done(nn, timed_out)) {
|
||||
msleep(1);
|
||||
usleep_range(250, 500);
|
||||
timed_out = time_is_before_eq_jiffies(deadline);
|
||||
}
|
||||
|
||||
return timed_out;
|
||||
}
|
||||
|
||||
static int nfp_net_reconfig_wait(struct nfp_net *nn, unsigned long deadline)
|
||||
{
|
||||
if (__nfp_net_reconfig_wait(nn, deadline))
|
||||
return -EIO;
|
||||
|
||||
if (nn_readl(nn, NFP_NET_CFG_UPDATE) & NFP_NET_CFG_UPDATE_ERR)
|
||||
return -EIO;
|
||||
|
||||
return timed_out ? -EIO : 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void nfp_net_reconfig_timer(struct timer_list *t)
|
||||
|
Loading…
Reference in New Issue
Block a user