From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id ABAC7A2EDB for ; Mon, 30 Sep 2019 04:50:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 705524C99; Mon, 30 Sep 2019 04:49:59 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 58EA844C7 for ; Mon, 30 Sep 2019 04:49:57 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8U2jBt6027048; Sun, 29 Sep 2019 19:49:56 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=mZnXLUjr/URcPeD5mSKlr6MYUjze1/YbcjBBLRZPm+8=; b=jjAZbOcObrLVCcf6V3aZRbqebF/KwZdeNPPM1PTfw4DsrWqScZbS01wIzIAzq2s7Lq5K mYCVDa8oRNzTLVlbzT6RM5xdL/rP6gTbAjPFl4SxqaMuY+ZlLpPJHFfCuVkLeF6fga4J wanF5vB3JQYZECL+hx1ri7iLQwY8DKJUCFNhwVaBruzpLH0G41o0jLHGwMWOJmyXzlw6 K47m6/VerTSyAvxU9cP8lq9A70p+xkq0e8ExpqNxKIf71Zoutqa16OcxmZUd2DaY2hM0 OfGq7EjrJKtfa84g0+HK0Fsp7wWglA3X2PRcHm3PRuw9JA0oYzeXqNLRr8Qw5eDLfk3M EQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2va4vrw0nu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 29 Sep 2019 19:49:56 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 29 Sep 2019 19:49:55 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Sun, 29 Sep 2019 19:49:55 -0700 Received: from irv1user08.caveonetworks.com (unknown [10.104.116.105]) by maili.marvell.com (Postfix) with ESMTP id D441A3F703F; Sun, 29 Sep 2019 19:49:54 -0700 (PDT) Received: (from rmody@localhost) by irv1user08.caveonetworks.com (8.14.4/8.14.4/Submit) id x8U2nsBk022218; Sun, 29 Sep 2019 19:49:54 -0700 X-Authentication-Warning: irv1user08.caveonetworks.com: rmody set sender to rmody@marvell.com using -f From: Rasesh Mody To: , , CC: Rasesh Mody , Date: Sun, 29 Sep 2019 19:49:15 -0700 Message-ID: <20190930024921.21818-4-rmody@marvell.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190930024921.21818-1-rmody@marvell.com> References: <20190930024921.21818-1-rmody@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-09-30_01:2019-09-25,2019-09-30 signatures=0 Subject: [dpdk-dev] [PATCH 3/9] net/qede/base: lock entire QM reconfiguration flow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Multiple flows can issue QM reconfiguration, hence hold the lock longer to account for entire duration of reconfiguration flow. Signed-off-by: Rasesh Mody --- drivers/net/qede/base/ecore_dev.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c index d7e1d7b32..b183519b5 100644 --- a/drivers/net/qede/base/ecore_dev.c +++ b/drivers/net/qede/base/ecore_dev.c @@ -2291,18 +2291,21 @@ enum _ecore_status_t ecore_qm_reconf(struct ecore_hwfn *p_hwfn, { struct ecore_qm_info *qm_info = &p_hwfn->qm_info; bool b_rc; - enum _ecore_status_t rc; + enum _ecore_status_t rc = ECORE_SUCCESS; + + /* multiple flows can issue qm reconf. Need to lock */ + OSAL_SPIN_LOCK(&qm_lock); /* initialize ecore's qm data structure */ ecore_init_qm_info(p_hwfn); /* stop PF's qm queues */ - OSAL_SPIN_LOCK(&qm_lock); b_rc = ecore_send_qm_stop_cmd(p_hwfn, p_ptt, false, true, qm_info->start_pq, qm_info->num_pqs); - OSAL_SPIN_UNLOCK(&qm_lock); - if (!b_rc) - return ECORE_INVAL; + if (!b_rc) { + rc = ECORE_INVAL; + goto unlock; + } /* clear the QM_PF runtime phase leftovers from previous init */ ecore_init_clear_rt_data(p_hwfn); @@ -2313,18 +2316,17 @@ enum _ecore_status_t ecore_qm_reconf(struct ecore_hwfn *p_hwfn, /* activate init tool on runtime array */ rc = ecore_init_run(p_hwfn, p_ptt, PHASE_QM_PF, p_hwfn->rel_pf_id, p_hwfn->hw_info.hw_mode); - if (rc != ECORE_SUCCESS) - return rc; /* start PF's qm queues */ - OSAL_SPIN_LOCK(&qm_lock); b_rc = ecore_send_qm_stop_cmd(p_hwfn, p_ptt, true, true, qm_info->start_pq, qm_info->num_pqs); - OSAL_SPIN_UNLOCK(&qm_lock); if (!b_rc) - return ECORE_INVAL; + rc = ECORE_INVAL; - return ECORE_SUCCESS; +unlock: + OSAL_SPIN_UNLOCK(&qm_lock); + + return rc; } static enum _ecore_status_t ecore_alloc_qm_data(struct ecore_hwfn *p_hwfn) -- 2.18.0