From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 5C8FCA0096 for ; Fri, 12 Apr 2019 10:32:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DFD2C5681; Fri, 12 Apr 2019 10:32:37 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 56E265323 for ; Fri, 12 Apr 2019 10:32:36 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190412083235euoutp02a3f36a8bc4366e1d509f7b2a17cfb524~UrPiVr6RN2222322223euoutp023 for ; Fri, 12 Apr 2019 08:32:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190412083235euoutp02a3f36a8bc4366e1d509f7b2a17cfb524~UrPiVr6RN2222322223euoutp023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1555057955; bh=tSoNdI70N40l0Ue7TFYIXuTwHXwLApYySbm5ek8cPc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mA6bx20R86rSgQe36j4BhM5k8z4wj8W8EKayYvqj6XcF2OLDSRn/Ir8QxI4vI/t+e T+XGg16JqrNMsHp+yYY0z7I9NDfzU9BOAdqVIkEcl9lWk4oYRVXiGFZOR7N+U7NE9p TYraICOPQvQnmnMWnTJTSYuuuvVZYpPCYcM8hlwo= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190412083234eucas1p1bf0e88de09bfab9324ebfb3ab7b7a9fc~UrPh1-eik2469624696eucas1p1M; Fri, 12 Apr 2019 08:32:34 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 1F.BB.04325.22D40BC5; Fri, 12 Apr 2019 09:32:34 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20190412083233eucas1p181a34d6544869582defba814e4caeb52~UrPhLTgEb2837428374eucas1p1B; Fri, 12 Apr 2019 08:32:33 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20190412083233eusmtrp2b6c734ea30d263682416e84ada282049~UrPg75zt73098930989eusmtrp2Z; Fri, 12 Apr 2019 08:32:33 +0000 (GMT) X-AuditID: cbfec7f5-b8fff700000010e5-17-5cb04d22c68e Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id D1.36.04146.12D40BC5; Fri, 12 Apr 2019 09:32:33 +0100 (BST) Received: from imaximets.rnd.samsung.ru (unknown [106.109.129.180]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20190412083232eusmtip1f5e87b8f4c055db8bb0b931450d26017~UrPgYImyc2510125101eusmtip1n; Fri, 12 Apr 2019 08:32:32 +0000 (GMT) From: Ilya Maximets To: dev@dpdk.org, Maxime Coquelin Cc: Tiwei Bie , Jens Freimann , Dariusz Stojaczyk , David Marchand , Ilya Maximets , stable@dpdk.org Date: Fri, 12 Apr 2019 11:32:28 +0300 Message-Id: <20190412083228.8371-1-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190409133622.14729-1-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDIsWRmVeSWpSXmKPExsWy7djPc7pKvhtiDBbt57NYtr+VxWL7ii42 i3eftjNZXGn/yW5xbs1SFotjnXtYLP51/GG32Nrwn8mBw+PXgqWsHov3vGTyeL/vKptH35ZV jAEsUVw2Kak5mWWpRfp2CVwZZ1/sZik4ylXx614PawPjS44uRk4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0gRs8ArRok5rbvYQRLCAt4S 3UsfgU1iEVCV2HxvLlgDr4CVxJ9X71kgNshLrN5wAGwzp4CNROeh+2ALhASsJU6+3cQ6gZFv ASPDKkaR1NLi3PTcYkO94sTc4tK8dL3k/NxNjMCw3Xbs5+YdjJc2Bh9iFOBgVOLhDbBaHyPE mlhWXJl7iFGCg1lJhDeEBSjEm5JYWZValB9fVJqTWnyI0RToqInMUqLJ+cCYyiuJNzQ1NLew NDQ3Njc2s1AS5z1vUBklJJCeWJKanZpakFoE08fEwSnVwLhoc9L3TM8layMuWGyNvOG/Ss/W gqFAJVmrd+4nX9Wuqz+9ZNvnvTf8YCtUOffryXsuXRNWsTBWr7LwXF5qs5hL7XFMUbFJ40lb jalbCtRu6OTInYwJyUxrX8KX889p+QqzwNiWKYqHFTMZCpN3M/BM2xJ5SnqT3lfVpJsegbor yh+tZWTdq8RSnJFoqMVcVJwIAKCHvPZxAgAA X-CMS-MailID: 20190412083233eucas1p181a34d6544869582defba814e4caeb52 X-Msg-Generator: CA Content-Type: text/plain; charset="UTF-8" X-RootMTR: 20190412083233eucas1p181a34d6544869582defba814e4caeb52 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190412083233eucas1p181a34d6544869582defba814e4caeb52 References: <20190409133622.14729-1-i.maximets@samsung.com> Subject: [dpdk-dev] [PATCH v2] vhost: fix passing destroyed device to destroy callback 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" Message-ID: <20190412083228.83206_2880v7n1PtRr56rH5jGWj-5ssbxQ2V2GnGsWA@z> Application should be able to obtain information like 'ifname' from the 'vid' passed to 'destroy_connection' callback. Currently, all the API calls with passed 'vid' fails with 'device not found'. Fixes: efba12a78ddf ("vhost: add user callbacks for socket open/close") Cc: stable@dpdk.org Signed-off-by: Ilya Maximets --- Version 2: * Fixed wrong order of 'destroy_device' and 'destroy_connection'. lib/librte_vhost/socket.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c index 3da9de62c..af09dfa17 100644 --- a/lib/librte_vhost/socket.c +++ b/lib/librte_vhost/socket.c @@ -295,13 +295,19 @@ vhost_user_read_cb(int connfd, void *dat, int *remove) ret = vhost_user_msg_handler(conn->vid, connfd); if (ret < 0) { + struct virtio_net *dev = get_device(conn->vid); + close(connfd); *remove = 1; - vhost_destroy_device(conn->vid); + + if (dev) + vhost_destroy_device_notify(dev); if (vsocket->notify_ops->destroy_connection) vsocket->notify_ops->destroy_connection(conn->vid); + vhost_destroy_device(conn->vid); + pthread_mutex_lock(&vsocket->conn_mutex); TAILQ_REMOVE(&vsocket->conn_list, conn, next); pthread_mutex_unlock(&vsocket->conn_mutex); -- 2.17.1