提交 e6471828 编写于 作者: D Dirk van der Merwe 提交者: David S. Miller

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: NDirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 1deeb640
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册