Skip to content

Commit 53153cb

Browse files
committed
net/bnxt: fix mutexes for multi-process
The BNXT driver supports secondary processes. Several mutexes live in structures allocated in shared memory (dev_private and rte_zmalloc'd structures) and must be initialized with PTHREAD_PROCESS_SHARED: - flow_lock, def_cp_lock, health_check_lock, err_recovery_lock in struct bnxt - vfr_start_lock in rep_info - txq_lock in struct bnxt_tx_queue - bnxt_ulp_mutex in session state - flow_db_lock in cfg_data Bugzilla ID: 662 Fixes: 1cb3d39 ("net/bnxt: synchronize between flow related functions") Fixes: 5526c80 ("net/bnxt: fix race between interrupt handler and dev config") Fixes: b59e4be ("net/bnxt: fix VF representor port add") Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
1 parent 9652d66 commit 53153cb

5 files changed

Lines changed: 11 additions & 9 deletions

File tree

drivers/net/bnxt/bnxt_ethdev.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5899,10 +5899,10 @@ static int bnxt_get_config(struct bnxt *bp)
58995899
static int
59005900
bnxt_init_locks(struct bnxt *bp)
59015901
{
5902-
pthread_mutex_init(&bp->flow_lock, NULL);
5903-
pthread_mutex_init(&bp->def_cp_lock, NULL);
5904-
pthread_mutex_init(&bp->health_check_lock, NULL);
5905-
pthread_mutex_init(&bp->err_recovery_lock, NULL);
5902+
rte_thread_mutex_init_shared(&bp->flow_lock);
5903+
rte_thread_mutex_init_shared(&bp->def_cp_lock);
5904+
rte_thread_mutex_init_shared(&bp->health_check_lock);
5905+
rte_thread_mutex_init_shared(&bp->err_recovery_lock);
59065906

59075907
return 0;
59085908
}
@@ -6920,7 +6920,8 @@ static int bnxt_init_rep_info(struct bnxt *bp)
69206920
for (i = 0; i < BNXT_MAX_CFA_CODE; i++)
69216921
bp->cfa_code_map[i] = BNXT_VF_IDX_INVALID;
69226922

6923-
return pthread_mutex_init(&bp->rep_info->vfr_start_lock, NULL);
6923+
rte_thread_mutex_init_shared(&bp->rep_info->vfr_start_lock);
6924+
return 0;
69246925
}
69256926

69266927
static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev,

drivers/net/bnxt/bnxt_txq.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
204204
goto err;
205205
}
206206

207-
return pthread_mutex_init(&txq->txq_lock, NULL);
207+
rte_thread_mutex_init_shared(&txq->txq_lock);
208+
return 0;
208209
err:
209210
bnxt_tx_queue_release_op(eth_dev, queue_idx);
210211
return rc;

drivers/net/bnxt/tf_ulp/bnxt_ulp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ ulp_session_init(struct bnxt *bp,
214214
session->pci_info.domain = pci_addr->domain;
215215
session->pci_info.bus = pci_addr->bus;
216216
memcpy(session->dsn, bp->dsn, sizeof(session->dsn));
217-
pthread_mutex_init(&session->bnxt_ulp_mutex, NULL);
217+
rte_thread_mutex_init_shared(&session->bnxt_ulp_mutex);
218218
STAILQ_INSERT_TAIL(&bnxt_ulp_session_list,
219219
session, next);
220220
}

drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1469,7 +1469,7 @@ ulp_tf_init(struct bnxt *bp,
14691469
goto jump_to_error;
14701470
}
14711471

1472-
pthread_mutex_init(&bp->ulp_ctx->cfg_data->flow_db_lock, NULL);
1472+
rte_thread_mutex_init_shared(&bp->ulp_ctx->cfg_data->flow_db_lock);
14731473

14741474
/* Initialize ulp dparms with values devargs passed */
14751475
rc = ulp_tf_dparms_init(bp, bp->ulp_ctx);

drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ ulp_tfc_init(struct bnxt *bp,
10381038
goto jump_to_error;
10391039
}
10401040

1041-
pthread_mutex_init(&bp->ulp_ctx->cfg_data->flow_db_lock, NULL);
1041+
rte_thread_mutex_init_shared(&bp->ulp_ctx->cfg_data->flow_db_lock);
10421042

10431043
rc = ulp_tfc_dparms_init(bp, bp->ulp_ctx, ulp_dev_id);
10441044
if (rc) {

0 commit comments

Comments
 (0)