From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 30C3646060; Sun, 12 Jan 2025 19:59:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 908AF402ED; Sun, 12 Jan 2025 19:59:01 +0100 (CET) Received: from mail-ej1-f99.google.com (mail-ej1-f99.google.com [209.85.218.99]) by mails.dpdk.org (Postfix) with ESMTP id 6420F402EA for ; Sun, 12 Jan 2025 19:59:00 +0100 (CET) Received: by mail-ej1-f99.google.com with SMTP id a640c23a62f3a-aaf3c3c104fso633700866b.1 for ; Sun, 12 Jan 2025 10:59:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736708340; x=1737313140; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DtgR18t8MeDEJPEx8snwQ9o9j4AsfYaAQr6vPswtt70=; b=Whmr4XaCQ25ASfl8gyhcxSJbGLM8Inp63wJOUFMGmqZ8UpGP2hlq//7kFote83xNUo Nry6Rcf+GAr+E70RDwQ3i9IO+cNCEqtHQW1DPY3hJHIccv0x/dLeUEH8fzNNLQgl7/8h 15sobPTmu2loq3cN2PMNRTbvGEJ5ktYom+Us4fJv5grjDu9IV+9CCQbMsicVcN1oON8X KPn4QLIBEelFqWrSCDzYIw1z3ZV7A4q1uL4J+GBrduyqf6wACg63CQ6r8QpZu61IX7XK 7RtmaxVsATMJbHxyXtiZVAwLhymW8oq9J9Bw6s5tJagQk2oghxZOKnIPOGG6aC0KuuMO s3+A== X-Gm-Message-State: AOJu0YyvfHkY8qm64YwUXj119FK3/oX0PqegRwxRq/+d0fZJvlZL5U66 qytir3APsyfrH+ruGJqrwYitGfHURvTk1vlBqL8fkVlHCjmrxrMWK+D8QaWj5P0S/WDLqhIF9uK 6qUMU8lRqlug1LW5KmaOIByyckSkoVmU5G5BOAjSS X-Gm-Gg: ASbGncuLTBfB+69qTlyo30jTssuxUqYavQSAN9u77jiaQtB7wR6xwznYaBoLEuGkTqb Kbb2BOfQGs1dOGWeGplLsC5EiZAJq17OoEhbHHYpSmcs4oBTlDsjg11Lm2tJ+2G1xc4eCbw2KV+ D/GCMDj+lWOWCNnj90fshQi1A1dCpOutiYaQVzq1GOLWQj172wa6g7IgsJO5VleNZYVKKCAp/yK M2lQ7ZfVuDcs9Pz/5eg9yhl4Kbwz8y9IVv27hFLpRd9Opl6ZjrmnYwlvs9YaWdbXzbh79crTSNC R8Igr1vGGanokbLHsKMr/1RhDQ== X-Google-Smtp-Source: AGHT+IGDF/X9EulVvzbw0IweAcBGJBMCVWDnPw9eVZgwhdjFCE9zvlAR4ehWC+JGLqFcSIK+IXiZTAfsmEnf X-Received: by 2002:a17:907:7249:b0:aa6:6a55:ad81 with SMTP id a640c23a62f3a-ab2ab6bfbcemr1613988866b.41.1736708340035; Sun, 12 Jan 2025 10:59:00 -0800 (PST) Received: from smtpservice.6wind.com ([185.13.181.2]) by smtp-relay.gmail.com with ESMTP id a640c23a62f3a-ab2c912f0cfsm33019166b.107.2025.01.12.10.58.59; Sun, 12 Jan 2025 10:59:00 -0800 (PST) X-Relaying-Domain: 6wind.com Received: from localhost (rainbow.dev.6wind.com [10.17.1.165]) by smtpservice.6wind.com (Postfix) with ESMTP id DC2FB13D76; Sun, 12 Jan 2025 19:58:59 +0100 (CET) From: Ariel Otilibili To: dev@dpdk.org Cc: Stephen Hemminger , Thomas Monjalon , David Marchand , Ariel Otilibili Subject: [PATCH 2/6] net/bnxt: remove check around pthread_mutex_init() Date: Sun, 12 Jan 2025 19:58:38 +0100 Message-Id: <20250112185842.9752-3-otilibil@eurecom.fr> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20250112185842.9752-1-otilibil@eurecom.fr> References: <20250112185842.9752-1-otilibil@eurecom.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > pthread_mutex_init always returns 0. The other mutex functions > return 0 on success and a non-zero error code on error. Link: https://man7.org/linux/man-pages/man3/pthread_mutex_lock.3.html Bugzilla ID: 1586 Signed-off-by: Ariel Otilibili --- drivers/net/bnxt/bnxt_ethdev.c | 40 ++++++-------------------- drivers/net/bnxt/bnxt_txq.c | 6 +--- drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 8 +----- drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c | 6 +--- drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c | 6 +--- drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c | 6 +--- drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c | 6 +--- 7 files changed, 14 insertions(+), 64 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index ef8a928c9170..3a88cdc94128 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -5821,31 +5821,12 @@ static int bnxt_get_config(struct bnxt *bp) static int bnxt_init_locks(struct bnxt *bp) { - int err; + pthread_mutex_init(&bp->flow_lock, NULL); + pthread_mutex_init(&bp->def_cp_lock, NULL); + pthread_mutex_init(&bp->health_check_lock, NULL); + pthread_mutex_init(&bp->err_recovery_lock, NULL); - err = pthread_mutex_init(&bp->flow_lock, NULL); - if (err) { - PMD_DRV_LOG_LINE(ERR, "Unable to initialize flow_lock"); - return err; - } - - err = pthread_mutex_init(&bp->def_cp_lock, NULL); - if (err) { - PMD_DRV_LOG_LINE(ERR, "Unable to initialize def_cp_lock"); - return err; - } - - err = pthread_mutex_init(&bp->health_check_lock, NULL); - if (err) { - PMD_DRV_LOG_LINE(ERR, "Unable to initialize health_check_lock"); - return err; - } - - err = pthread_mutex_init(&bp->err_recovery_lock, NULL); - if (err) - PMD_DRV_LOG_LINE(ERR, "Unable to initialize err_recovery_lock"); - - return err; + return 0; } /* This should be called after we have queried trusted VF cap */ @@ -6746,7 +6727,7 @@ static void bnxt_free_rep_info(struct bnxt *bp) static int bnxt_init_rep_info(struct bnxt *bp) { - int i = 0, rc; + int i = 0; if (bp->rep_info) return 0; @@ -6770,14 +6751,9 @@ static int bnxt_init_rep_info(struct bnxt *bp) for (i = 0; i < BNXT_MAX_CFA_CODE; i++) bp->cfa_code_map[i] = BNXT_VF_IDX_INVALID; - rc = pthread_mutex_init(&bp->rep_info->vfr_start_lock, NULL); - if (rc) { - PMD_DRV_LOG_LINE(ERR, "Unable to initialize vfr_start_lock"); - bnxt_free_rep_info(bp); - return rc; - } + pthread_mutex_init(&bp->rep_info->vfr_start_lock, NULL); - return rc; + return 0; } static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev, diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c index c8649359923f..ab561585d771 100644 --- a/drivers/net/bnxt/bnxt_txq.c +++ b/drivers/net/bnxt/bnxt_txq.c @@ -198,11 +198,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev, goto err; } - rc = pthread_mutex_init(&txq->txq_lock, NULL); - if (rc != 0) { - PMD_DRV_LOG_LINE(ERR, "TxQ mutex init failed!"); - goto err; - } + pthread_mutex_init(&txq->txq_lock, NULL); return 0; err: bnxt_tx_queue_release_op(eth_dev, queue_idx); diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c index 1bfc88cf79ef..0c03ae7a8349 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c @@ -188,7 +188,6 @@ ulp_session_init(struct bnxt *bp, struct rte_pci_device *pci_dev; struct rte_pci_addr *pci_addr; struct bnxt_ulp_session_state *session; - int rc = 0; if (!bp) return NULL; @@ -215,12 +214,7 @@ ulp_session_init(struct bnxt *bp, session->pci_info.domain = pci_addr->domain; session->pci_info.bus = pci_addr->bus; memcpy(session->dsn, bp->dsn, sizeof(session->dsn)); - rc = pthread_mutex_init(&session->bnxt_ulp_mutex, NULL); - if (rc) { - BNXT_DRV_DBG(ERR, "mutex create failed\n"); - pthread_mutex_unlock(&bnxt_ulp_global_mutex); - return NULL; - } + pthread_mutex_init(&session->bnxt_ulp_mutex, NULL); STAILQ_INSERT_TAIL(&bnxt_ulp_session_list, session, next); } diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c index fa7e8fe00077..4a1ccfa2a36d 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c @@ -1472,11 +1472,7 @@ ulp_tf_init(struct bnxt *bp, goto jump_to_error; } - rc = pthread_mutex_init(&bp->ulp_ctx->cfg_data->flow_db_lock, NULL); - if (rc) { - BNXT_DRV_DBG(ERR, "Unable to initialize flow db lock\n"); - goto jump_to_error; - } + pthread_mutex_init(&bp->ulp_ctx->cfg_data->flow_db_lock, NULL); /* Initialize ulp dparms with values devargs passed */ rc = ulp_tf_dparms_init(bp, bp->ulp_ctx); diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c index 6d7ec0ffec79..508c194d0490 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c @@ -993,11 +993,7 @@ ulp_tfc_init(struct bnxt *bp, goto jump_to_error; } - rc = pthread_mutex_init(&bp->ulp_ctx->cfg_data->flow_db_lock, NULL); - if (rc) { - BNXT_DRV_DBG(ERR, "Unable to initialize flow db lock\n"); - goto jump_to_error; - } + pthread_mutex_init(&bp->ulp_ctx->cfg_data->flow_db_lock, NULL); rc = ulp_tfc_dparms_init(bp, bp->ulp_ctx, ulp_dev_id); if (rc) { diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c index 67489b76f390..f9d069f4e17e 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c @@ -129,11 +129,7 @@ ulp_fc_mgr_init(struct bnxt_ulp_context *ctxt) ulp_fc_info->fc_ops = fc_ops; ulp_fc_info->flags = flags; - rc = pthread_mutex_init(&ulp_fc_info->fc_lock, NULL); - if (rc) { - BNXT_DRV_DBG(ERR, "Failed to initialize fc mutex\n"); - goto error; - } + pthread_mutex_init(&ulp_fc_info->fc_lock, NULL); /* Add the FC info tbl to the ulp context. */ bnxt_ulp_cntxt_ptr2_fc_info_set(ctxt, ulp_fc_info); diff --git a/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c index 3c75a6b43721..7b7c10d3602e 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c +++ b/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c @@ -412,11 +412,7 @@ ulp_ha_mgr_init(struct bnxt_ulp_context *ulp_ctx) /* Add the HA info tbl to the ulp context. */ bnxt_ulp_cntxt_ptr2_ha_info_set(ulp_ctx, ha_info); - rc = pthread_mutex_init(&ha_info->ha_lock, NULL); - if (rc) { - PMD_DRV_LOG_LINE(ERR, "Failed to initialize ha mutex"); - goto cleanup; - } + pthread_mutex_init(&ha_info->ha_lock, NULL); rc = ulp_ha_mgr_timer_start(ulp_ctx->cfg_data); if (rc) { PMD_DRV_LOG_LINE(ERR, "Unable to start timer CB"); -- 2.30.2