Skip to content

Commit

Permalink
net/mlx5: E-switch, Fix mutex init order (jsc#SLE-15172).
Browse files Browse the repository at this point in the history
suse-commit: 15bf7768e41760486ceb7910aed032d5bc905d3b
  • Loading branch information
Thomas Bogendoerfer committed Sep 28, 2020
1 parent f8bfcbd commit b395419
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
Original file line number Diff line number Diff line change
Expand Up @@ -2218,10 +2218,12 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw)
total_vports = num_vfs + MLX5_SPECIAL_VPORTS(esw->dev);

memset(&esw->fdb_table.offloads, 0, sizeof(struct offloads_fdb));
mutex_init(&esw->fdb_table.offloads.vports.lock);
hash_init(esw->fdb_table.offloads.vports.table);

err = esw_create_uplink_offloads_acl_tables(esw);
if (err)
return err;
goto create_acl_err;

err = esw_create_offloads_table(esw, total_vports);
if (err)
Expand All @@ -2239,9 +2241,6 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw)
if (err)
goto create_fg_err;

mutex_init(&esw->fdb_table.offloads.vports.lock);
hash_init(esw->fdb_table.offloads.vports.table);

return 0;

create_fg_err:
Expand All @@ -2252,18 +2251,19 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw)
esw_destroy_offloads_table(esw);
create_offloads_err:
esw_destroy_uplink_offloads_acl_tables(esw);

create_acl_err:
mutex_destroy(&esw->fdb_table.offloads.vports.lock);
return err;
}

static void esw_offloads_steering_cleanup(struct mlx5_eswitch *esw)
{
mutex_destroy(&esw->fdb_table.offloads.vports.lock);
esw_destroy_vport_rx_group(esw);
esw_destroy_offloads_fdb_tables(esw);
esw_destroy_restore_table(esw);
esw_destroy_offloads_table(esw);
esw_destroy_uplink_offloads_acl_tables(esw);
mutex_destroy(&esw->fdb_table.offloads.vports.lock);
}

static void
Expand Down

0 comments on commit b395419

Please sign in to comment.