Re: [net V2 05/15] net/mlx5: Add retry mechanism to the command entry index allocation

2020-10-02 Thread Saeed Mahameed
On Thu, 2020-10-01 at 16:23 -0700, Jakub Kicinski wrote: > On Thu, 1 Oct 2020 12:52:37 -0700 sa...@kernel.org wrote: > > +static int cmd_alloc_index_retry(struct mlx5_cmd *cmd) > > +{ > > + unsigned long alloc_end = jiffies + msecs_to_jiffies(1000); > > + int idx; > > + > > +retry: > > + idx

Re: [net V2 05/15] net/mlx5: Add retry mechanism to the command entry index allocation

2020-10-01 Thread Jakub Kicinski
On Thu, 1 Oct 2020 12:52:37 -0700 sa...@kernel.org wrote: > +static int cmd_alloc_index_retry(struct mlx5_cmd *cmd) > +{ > + unsigned long alloc_end = jiffies + msecs_to_jiffies(1000); > + int idx; > + > +retry: > + idx = cmd_alloc_index(cmd); > + if (idx < 0 && time_before(jiffies

[net V2 05/15] net/mlx5: Add retry mechanism to the command entry index allocation

2020-10-01 Thread saeed
From: Eran Ben Elisha It is possible that new command entry index allocation will temporarily fail. The new command holds the semaphore, so it means that a free entry should be ready soon. Add one second retry mechanism before returning an error. Patch "net/mlx5: Avoid possible free of command e