Commit e6471828 authored by Dirk van der Merwe's avatar Dirk van der Merwe Committed by 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: default avatarDirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1deeb640
...@@ -137,20 +137,37 @@ static bool nfp_net_reconfig_check_done(struct nfp_net *nn, bool last_check) ...@@ -137,20 +137,37 @@ static bool nfp_net_reconfig_check_done(struct nfp_net *nn, bool last_check)
return false; 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; 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)) { while (!nfp_net_reconfig_check_done(nn, timed_out)) {
msleep(1); usleep_range(250, 500);
timed_out = time_is_before_eq_jiffies(deadline); 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) if (nn_readl(nn, NFP_NET_CFG_UPDATE) & NFP_NET_CFG_UPDATE_ERR)
return -EIO; return -EIO;
return timed_out ? -EIO : 0; return 0;
} }
static void nfp_net_reconfig_timer(struct timer_list *t) static void nfp_net_reconfig_timer(struct timer_list *t)
......
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