From patchwork Mon Apr 27 18:10:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 69402 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 74AE3A00BE; Mon, 27 Apr 2020 20:10:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1B43E1D425; Mon, 27 Apr 2020 20:10:55 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 0E7C21C43C for ; Mon, 27 Apr 2020 20:10:53 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03RIAPkB028590; Mon, 27 Apr 2020 11:10:53 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=Om9Z3m/L6h/U+McU/f7lCFtfyRdyvDrrmf073QFIL5Q=; b=YaZdu++bJvtoao4v9XApT1/HI2RqrRZu7a/QuMWSEsRSDxf8dLtfLLEhFVK8mIxz303e fiSZwJbnubolJ37Ybb+Y/Q7CV4T3I6P647535//1npP/k7lsUkm/+sz14RYc0pIUUucb KCoIH53BZg4vwzrhx2H+D7SGhkQ9OoYp/tKYqmbqQvELKZ9V6zqxDeT8OAj6WJSC9hjC ItoWbGd+iJsFe8MAJYo6FaJnK4ES0VZIUNTfqRfuEiyiowG9cvqjmlloPHSd1VW9V/JN PpI5qfqkFtO8UsSHXZP/yudB74JvwsUOUIuEA1CpUilqViimuQMZl9DKPOD52gC5T+ZZ +Q== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 30mmqmg9e4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 27 Apr 2020 11:10:53 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Apr 2020 11:10:50 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 27 Apr 2020 11:10:51 -0700 Received: from BG-LT7430.marvell.com (BG-LT7430.marvell.com [10.28.163.117]) by maili.marvell.com (Postfix) with ESMTP id 74C5F3F703F; Mon, 27 Apr 2020 11:10:49 -0700 (PDT) From: To: , Anatoly Burakov CC: , Pavan Nikhilesh Date: Mon, 27 Apr 2020 23:40:38 +0530 Message-ID: <20200427181039.1943-1-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-27_12:2020-04-27, 2020-04-27 signatures=0 Subject: [dpdk-dev] [PATCH] eventdev: fix device probe and remove for secondary process 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" From: Pavan Nikhilesh When probing event device in secondary process skip reinitializing the device data structure as it is already done in primary process. When removing event device in secondary process skip closing the event device as it should be done by primary process. Fixes: 322d0345c2bc ("eventdev: implement PMD registration functions") Signed-off-by: Pavan Nikhilesh Acked-by: Jerin Jacob --- lib/librte_eventdev/rte_eventdev.c | 13 ++++++++----- lib/librte_eventdev/rte_eventdev_pmd_pci.h | 8 +++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index b987e0745..9aca7fbd5 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -1364,14 +1364,17 @@ rte_event_pmd_allocate(const char *name, int socket_id) eventdev->data = eventdev_data; - strlcpy(eventdev->data->name, name, RTE_EVENTDEV_NAME_MAX_LEN); + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { - eventdev->data->dev_id = dev_id; - eventdev->data->socket_id = socket_id; - eventdev->data->dev_started = 0; + strlcpy(eventdev->data->name, name, + RTE_EVENTDEV_NAME_MAX_LEN); - eventdev->attached = RTE_EVENTDEV_ATTACHED; + eventdev->data->dev_id = dev_id; + eventdev->data->socket_id = socket_id; + eventdev->data->dev_started = 0; + } + eventdev->attached = RTE_EVENTDEV_ATTACHED; eventdev_globals.nb_devs++; } diff --git a/lib/librte_eventdev/rte_eventdev_pmd_pci.h b/lib/librte_eventdev/rte_eventdev_pmd_pci.h index 8fb61386f..443cd38c2 100644 --- a/lib/librte_eventdev/rte_eventdev_pmd_pci.h +++ b/lib/librte_eventdev/rte_eventdev_pmd_pci.h @@ -112,9 +112,11 @@ rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev, if (eventdev == NULL) return -ENODEV; - ret = rte_event_dev_close(eventdev->data->dev_id); - if (ret < 0) - return ret; + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + ret = rte_event_dev_close(eventdev->data->dev_id); + if (ret < 0) + return ret; + } /* Invoke PMD device un-init function */ if (devuninit)