Revert "net/mlx5: Add retry mechanism to the command entry index allocation"
commit 4f6626b0e140867fd6d5a2e9d4ceaef97f10f46a upstream. This reverts commit410bd754cd
. The reverted commit had added a retry mechanism to the command entry index allocation. The previous patch ensures that there is a free command entry index once the command work handler holds the command semaphore. Thus the retry mechanism is not needed. Fixes:410bd754cd
("net/mlx5: Add retry mechanism to the command entry index allocation") Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Eran Ben Elisha <eranbe@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
78cf5f63a3
commit
4cb7aba1e0
@@ -887,25 +887,6 @@ static bool opcode_allowed(struct mlx5_cmd *cmd, u16 opcode)
|
|||||||
return cmd->allowed_opcode == opcode;
|
return cmd->allowed_opcode == opcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
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, alloc_end)) {
|
|
||||||
/* Index allocation can fail on heavy load of commands. This is a temporary
|
|
||||||
* situation as the current command already holds the semaphore, meaning that
|
|
||||||
* another command completion is being handled and it is expected to release
|
|
||||||
* the entry index soon.
|
|
||||||
*/
|
|
||||||
cpu_relax();
|
|
||||||
goto retry;
|
|
||||||
}
|
|
||||||
return idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool mlx5_cmd_is_down(struct mlx5_core_dev *dev)
|
bool mlx5_cmd_is_down(struct mlx5_core_dev *dev)
|
||||||
{
|
{
|
||||||
return pci_channel_offline(dev->pdev) ||
|
return pci_channel_offline(dev->pdev) ||
|
||||||
@@ -930,7 +911,7 @@ static void cmd_work_handler(struct work_struct *work)
|
|||||||
sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem;
|
sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem;
|
||||||
down(sem);
|
down(sem);
|
||||||
if (!ent->page_queue) {
|
if (!ent->page_queue) {
|
||||||
alloc_ret = cmd_alloc_index_retry(cmd);
|
alloc_ret = cmd_alloc_index(cmd);
|
||||||
if (alloc_ret < 0) {
|
if (alloc_ret < 0) {
|
||||||
mlx5_core_err_rl(dev, "failed to allocate command entry\n");
|
mlx5_core_err_rl(dev, "failed to allocate command entry\n");
|
||||||
if (ent->callback) {
|
if (ent->callback) {
|
||||||
|
Reference in New Issue
Block a user