From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id E844B1B31D for ; Fri, 19 Jan 2018 14:46:09 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 531621112; Fri, 19 Jan 2018 13:46:09 +0000 (UTC) Received: from localhost (ovpn-116-254.ams2.redhat.com [10.36.116.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4126C60A9D; Fri, 19 Jan 2018 13:45:59 +0000 (UTC) From: Stefan Hajnoczi To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, Yuanhan Liu , wei.w.wang@intel.com, mst@redhat.com, zhiyong.yang@intel.com, jasowang@redhat.com, Stefan Hajnoczi Date: Fri, 19 Jan 2018 13:44:29 +0000 Message-Id: <20180119134444.24927-10-stefanha@redhat.com> In-Reply-To: <20180119134444.24927-1-stefanha@redhat.com> References: <20180119134444.24927-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 19 Jan 2018 13:46:09 +0000 (UTC) Subject: [dpdk-dev] [RFC 09/24] vhost: pass vhost_transport_ops through vhost_new_device() 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: , X-List-Received-Date: Fri, 19 Jan 2018 13:46:10 -0000 This patch propagates struct vhost_user_socket's vhost_transport_ops into the newly created vhost device. This patch completes the initial refactoring of socket.c, with the AF_UNIX-specific code now in trans_af_unix.c and the librte_vhost API entrypoints in socket.c. Now it is time to turn towards vhost_user.c and its mixture of vhost-user protocol processing and socket I/O. The socket I/O will be moved into trans_af_unix.c so that other transports can be added that don't use file descriptors. Signed-off-by: Stefan Hajnoczi --- lib/librte_vhost/vhost.h | 2 +- lib/librte_vhost/trans_af_unix.c | 2 +- lib/librte_vhost/vhost.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index 45167b6a7..ca7507284 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -434,7 +434,7 @@ gpa_to_hpa(struct virtio_net *dev, uint64_t gpa, uint64_t size) struct virtio_net *get_device(int vid); -int vhost_new_device(void); +int vhost_new_device(const struct vhost_transport_ops *trans_ops); void cleanup_device(struct virtio_net *dev, int destroy); void reset_device(struct virtio_net *dev); void vhost_destroy_device(int); diff --git a/lib/librte_vhost/trans_af_unix.c b/lib/librte_vhost/trans_af_unix.c index 54c1b2db3..c85a162e8 100644 --- a/lib/librte_vhost/trans_af_unix.c +++ b/lib/librte_vhost/trans_af_unix.c @@ -176,7 +176,7 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket) return; } - vid = vhost_new_device(); + vid = vhost_new_device(vsocket->trans_ops); if (vid == -1) { goto err; } diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 630dbd014..f8754e261 100644 --- a/lib/librte_vhost/vhost.c +++ b/lib/librte_vhost/vhost.c @@ -261,7 +261,7 @@ reset_device(struct virtio_net *dev) * there is a new virtio device being attached). */ int -vhost_new_device(void) +vhost_new_device(const struct vhost_transport_ops *trans_ops) { struct virtio_net *dev; int i; @@ -287,7 +287,7 @@ vhost_new_device(void) vhost_devices[i] = dev; dev->vid = i; dev->slave_req_fd = -1; - dev->trans_ops = &af_unix_trans_ops; + dev->trans_ops = trans_ops; return i; } -- 2.14.3