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 93100A04B5; Wed, 4 Dec 2019 06:01:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BFD421B9B5; Wed, 4 Dec 2019 06:01:57 +0100 (CET) Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by dpdk.org (Postfix) with ESMTP id 0723C4C99 for ; Wed, 4 Dec 2019 06:01:56 +0100 (CET) Received: by mail-pf1-f193.google.com with SMTP id b19so3005036pfo.2 for ; Tue, 03 Dec 2019 21:01:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:to:cc:subject:date:message-id :content-transfer-encoding; bh=LIVe9YLX4H4z40J1lilfdukJn+zdQPBdOiLiD3rqPd0=; b=CxtEN6NRlfR2b0vSMaqUSigp75l9XtqO3Impz8MP8xdR3qmZZCP6cIrI3culfA2o46 7o1kAtMlxZJuGJEJ5flQE/tXO9fyWpmRYvSiUuGjWkoT0olK9uwzqnstKmxqySY2XCDw f0QpJWxi/l0xzi31/s1wQ/3cebxvwkQHxEBB7ZCz1GhRgR594BOXTThr+TIyAKvGcv1a w4LtAugqCQUKVbssvdLMR5Pa65b1HqtogaoMFP+2gaj7ziIxcQ6HX7qv4Wujuftpv4PO Jq4yFuuy/jam74RObQqSVMYR9n0S+w45pDBOp9NElPcGC9/hra15/Al5NE17QI81hHoD Txjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :content-transfer-encoding; bh=LIVe9YLX4H4z40J1lilfdukJn+zdQPBdOiLiD3rqPd0=; b=UeW/QEuLNtbKY2DvPqnye9GUXVpbmjONF5WP191QEpYAxX+XsoRzzifPXu5hOZ50jr Rcy3Z/2A+OwmAMtfKUVD/GkZ5iLOpW5UDZlnt2AmszekDW97fsps+stuTwG0Qji8CNhH RhW5X4r+2gmoVN+yWIR7sJi6zT979vQnlC3EbqKgTAenaqHjrUB7fJcfq4vsO1I9wBDB X0CrLQYdUMo3wbFMenT6lkKpwZa3y95Sf5gY6G2sdZC3+Zd4ybkiPjSgrt1oNo0GyTE6 +5Nedo53x1UL/9GhaAQqxGv/jEOGOGown7wk8MGn/6F5BlPDLLeARvwu2iX5m/wCk2+2 UOQA== MIME-Version: 1.0 X-Gm-Message-State: APjAAAX7Z3JGHJtOS8nW5xNPbs8w8XAn78UkYxd+PMuWu6lwMuMjM6/S EgaP7l7QbSKrONOnHelzWPnt6BlQTcIszdAZNqpbBB/93nTaIQheX5n83OqO+BNphOOjXp+F X-Google-Smtp-Source: APXvYqwg3pEa18hqGpdLojIUVKcnLJlsJfsZfr24WI8H+x+vwi+4cncjOp5/bNVJNA/o/Fo8+e+ECQ== X-Received: by 2002:a65:42ca:: with SMTP id l10mr1512998pgp.121.1575435715789; Tue, 03 Dec 2019 21:01:55 -0800 (PST) Received: from 31_216.localdomain ([23.98.38.159]) by smtp.gmail.com with ESMTPSA id v7sm4536393pjs.2.2019.12.03.21.01.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Dec 2019 21:01:54 -0800 (PST) From: Li Feng To: Maxime Coquelin , Tiwei Bie , Zhihong Wang Cc: dev@dpdk.org, Li Feng Date: Wed, 4 Dec 2019 13:01:11 +0800 Message-Id: <20191204050112.25296-1-fengli@smartx.com> X-Mailer: git-send-email 2.11.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: [dpdk-dev] [PATCH v2] vhost: add config change slave msg support 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" This msg is used to notify qemu that should get the config of backend. For example, vhost-user-blk uses this msg to notify guest os the compacity of backend has changed. Signed-off-by: Li Feng --- v2: * Fix a little log typo. lib/librte_vhost/vhost_user.c | 31 +++++++++++++++++++++++++++++++ lib/librte_vhost/vhost_user.h | 2 ++ 2 files changed, 33 insertions(+) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 0cfb8b792..10f2e47d5 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -2840,6 +2840,37 @@ vhost_user_iotlb_miss(struct virtio_net *dev, uint64= _t iova, uint8_t perm) return 0; } =20 +static int +vhost_user_slave_config_change(struct virtio_net *dev) +{ + int ret; + struct VhostUserMsg msg =3D { + .request.slave =3D VHOST_USER_SLAVE_CONFIG_CHANGE_MSG, + .flags =3D VHOST_USER_VERSION, + .size =3D 0, + }; + + ret =3D send_vhost_message(dev->slave_req_fd, &msg); + if (ret < 0) { + RTE_LOG(ERR, VHOST_CONFIG, + "Failed to send config change (%d)\n", + ret); + return ret; + } + + return 0; +} + +int +rte_vhost_user_slave_config_change(int vid) +{ + struct virtio_net *dev; + dev =3D get_device(vid); + if (!dev) + return -ENODEV; + return vhost_user_slave_config_change(dev); +} + static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev= , int index, int fd, uint64_t offset, diff --git a/lib/librte_vhost/vhost_user.h b/lib/librte_vhost/vhost_user.h index 6563f7315..5c1bb2138 100644 --- a/lib/librte_vhost/vhost_user.h +++ b/lib/librte_vhost/vhost_user.h @@ -62,6 +62,7 @@ typedef enum VhostUserRequest { typedef enum VhostUserSlaveRequest { VHOST_USER_SLAVE_NONE =3D 0, VHOST_USER_SLAVE_IOTLB_MSG =3D 1, + VHOST_USER_SLAVE_CONFIG_CHANGE_MSG =3D 2, VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG =3D 3, VHOST_USER_SLAVE_MAX } VhostUserSlaveRequest; @@ -158,6 +159,7 @@ typedef struct VhostUserMsg { /* vhost_user.c */ int vhost_user_msg_handler(int vid, int fd); int vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t p= erm); +int rte_vhost_user_slave_config_change(int vid); =20 /* socket.c */ int read_fd_message(int sockfd, char *buf, int buflen, int *fds, int max_f= ds, --=20 2.11.0 --=20 The SmartX email address is only for business purpose. Any sent message=20 that is not related to the business is not authorized or permitted by=20 SmartX. =E6=9C=AC=E9=82=AE=E7=AE=B1=E4=B8=BA=E5=8C=97=E4=BA=AC=E5=BF=97=E5=87=8C=E6= =B5=B7=E7=BA=B3=E7=A7=91=E6=8A=80=E6=9C=89=E9=99=90=E5=85=AC=E5=8F=B8=EF=BC= =88SmartX=EF=BC=89=E5=B7=A5=E4=BD=9C=E9=82=AE=E7=AE=B1. =E5=A6=82=E6=9C=AC= =E9=82=AE=E7=AE=B1=E5=8F=91=E5=87=BA=E7=9A=84=E9=82=AE=E4=BB=B6=E4=B8=8E=E5= =B7=A5=E4=BD=9C=E6=97=A0=E5=85=B3,=E8=AF=A5=E9=82=AE=E4=BB=B6=E6=9C=AA=E5= =BE=97=E5=88=B0=E6=9C=AC=E5=85=AC=E5=8F=B8=E4=BB=BB=E4=BD=95=E7=9A=84=E6=98= =8E=E7=A4=BA=E6=88=96=E9=BB=98=E7=A4=BA=E7=9A=84=E6=8E=88=E6=9D=83.