From: "Xing, Beilei" <beilei.xing@intel.com>
To: "Xia, Chenbo" <chenbo.xia@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>,
"thomas@monjalon.net" <thomas@monjalon.net>,
"david.marchand@redhat.com" <david.marchand@redhat.com>
Cc: "stephen@networkplumber.org" <stephen@networkplumber.org>,
"Liang, Cunming" <cunming.liang@intel.com>,
"Lu, Xiuchun" <xiuchun.lu@intel.com>,
"Li, Miao" <miao.li@intel.com>,
"Wu, Jingjing" <jingjing.wu@intel.com>
Subject: Re: [dpdk-dev] [PATCH 7/9] vfio_user: add client APIs of DMA/IRQ/region
Date: Thu, 7 Jan 2021 02:41:33 +0000 [thread overview]
Message-ID: <MN2PR11MB38075A37B9F41EE7C66D53CEF7AF0@MN2PR11MB3807.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20201218073851.93609-8-chenbo.xia@intel.com>
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Chenbo Xia
> Sent: Friday, December 18, 2020 3:39 PM
> To: dev@dpdk.org; thomas@monjalon.net; david.marchand@redhat.com
> Cc: stephen@networkplumber.org; Liang, Cunming
> <cunming.liang@intel.com>; Lu, Xiuchun <xiuchun.lu@intel.com>; Li, Miao
> <miao.li@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>
> Subject: [dpdk-dev] [PATCH 7/9] vfio_user: add client APIs of DMA/IRQ/region
>
> This patch introduces nine APIs
> - Device related:
> rte_vfio_user_get_dev_info and rte_vfio_user_reset
> - DMA related:
> rte_vfio_user_dma_map/unmap
> - Region related:
> rte_vfio_user_get_reg_info and rte_vfio_user_region_read/write
> - IRQ related:
> rte_vfio_user_get_irq_info and rte_vfio_user_set_irqs
>
> Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
> Signed-off-by: Xiuchun Lu <xiuchun.lu@intel.com>
> ---
> lib/librte_vfio_user/rte_vfio_user.h | 168 ++++++++++
> lib/librte_vfio_user/version.map | 9 +
> lib/librte_vfio_user/vfio_user_client.c | 412 ++++++++++++++++++++++++
> 3 files changed, 589 insertions(+)
>
> diff --git a/lib/librte_vfio_user/rte_vfio_user.h
> b/lib/librte_vfio_user/rte_vfio_user.h
> index b09d83e224..fe27d05992 100644
> --- a/lib/librte_vfio_user/rte_vfio_user.h
> +++ b/lib/librte_vfio_user/rte_vfio_user.h
> @@ -229,6 +229,15 @@ int rte_vfio_user_set_irq_info(const char *sock_addr,
> +int rte_vfio_user_get_dev_info(int dev_id, struct vfio_device_info
> +*info) {
> + VFIO_USER_MSG msg;
> + struct vfio_user_client *dev;
> + int ret;
> + uint32_t sz = VFIO_USER_MSG_HDR_SIZE + sizeof(struct
> +vfio_device_info);
> +
> + if (!info)
> + return -EINVAL;
> +
> + dev = vfio_client_devs.cl[dev_id];
> + if (!dev) {
> + VFIO_USER_LOG(ERR, "Failed to get device info: "
> + "wrong device ID\n");
> + return -EINVAL;
> + }
> +
> + memset(&msg, 0, sizeof(VFIO_USER_MSG));
> + vfio_user_client_fill_hdr(&msg, VFIO_USER_DEVICE_GET_INFO, sz);
> +
> + ret = vfio_user_client_send_recv(dev->sock.sock_fd, &msg);
> + if (ret)
> + return ret;
> +
> + if (msg.flags & VFIO_USER_ERROR) {
> + VFIO_USER_LOG(ERR, "Failed to get device info: %s\n",
> + msg.err ? strerror(msg.err) : "Unknown error");
> + return msg.err ? -(int)msg.err : -1;
> + }
> +
> + if (vfio_user_check_msg_fdnum(&msg, 0) != 0)
> + return -1;
> +
> + memcpy(info, &msg.payload.dev_info, sizeof(*info));
> + return ret;
> +}
> +
Seems there's duplicate code in function get_xxx_info, double check and refine.
next prev parent reply other threads:[~2021-01-07 2:41 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-18 7:38 [dpdk-dev] [PATCH 0/9] Introduce vfio-user library Chenbo Xia
2020-12-18 7:38 ` [dpdk-dev] [PATCH 1/9] lib: introduce " Chenbo Xia
2020-12-18 17:13 ` Stephen Hemminger
2020-12-19 6:12 ` Xia, Chenbo
2020-12-18 17:17 ` Stephen Hemminger
2020-12-19 6:25 ` Xia, Chenbo
2020-12-18 7:38 ` [dpdk-dev] [PATCH 2/9] vfio_user: implement lifecycle related APIs Chenbo Xia
2021-01-05 8:34 ` Xing, Beilei
2021-01-05 9:58 ` Xia, Chenbo
2020-12-18 7:38 ` [dpdk-dev] [PATCH 3/9] vfio_user: implement device and region " Chenbo Xia
2021-01-06 5:51 ` Xing, Beilei
2021-01-06 7:50 ` Xia, Chenbo
2020-12-18 7:38 ` [dpdk-dev] [PATCH 4/9] vfio_user: implement DMA table and socket address API Chenbo Xia
2020-12-18 7:38 ` [dpdk-dev] [PATCH 5/9] vfio_user: implement interrupt related APIs Chenbo Xia
2020-12-30 1:04 ` Wu, Jingjing
2020-12-30 2:31 ` Xia, Chenbo
2020-12-18 7:38 ` [dpdk-dev] [PATCH 6/9] vfio_user: add client APIs of device attach/detach Chenbo Xia
2020-12-18 7:38 ` [dpdk-dev] [PATCH 7/9] vfio_user: add client APIs of DMA/IRQ/region Chenbo Xia
2021-01-07 2:41 ` Xing, Beilei [this message]
2021-01-07 7:26 ` Xia, Chenbo
2020-12-18 7:38 ` [dpdk-dev] [PATCH 8/9] test/vfio_user: introduce functional test Chenbo Xia
2020-12-18 7:38 ` [dpdk-dev] [PATCH 9/9] doc: add vfio-user library guide Chenbo Xia
2021-01-06 5:07 ` Xing, Beilei
2021-01-06 7:43 ` Xia, Chenbo
2020-12-18 9:37 ` [dpdk-dev] [PATCH 0/9] Introduce vfio-user library David Marchand
2020-12-18 14:07 ` Thanos Makatos
2023-06-29 16:10 ` Stephen Hemminger
2023-06-30 1:36 ` Xia, Chenbo
2021-01-14 6:14 ` [dpdk-dev] [PATCH v2 " Chenbo Xia
2021-01-14 6:14 ` [dpdk-dev] [PATCH v2 1/9] lib: introduce " Chenbo Xia
2021-01-14 6:14 ` [dpdk-dev] [PATCH v2 2/9] vfio_user: implement lifecycle related APIs Chenbo Xia
2021-01-14 6:14 ` [dpdk-dev] [PATCH v2 3/9] vfio_user: implement device and region " Chenbo Xia
2021-01-14 18:48 ` David Christensen
2021-01-19 3:22 ` Xia, Chenbo
2021-01-14 6:14 ` [dpdk-dev] [PATCH v2 4/9] vfio_user: implement DMA table and socket address API Chenbo Xia
2021-01-14 6:14 ` [dpdk-dev] [PATCH v2 5/9] vfio_user: implement interrupt related APIs Chenbo Xia
2021-01-14 6:14 ` [dpdk-dev] [PATCH v2 6/9] vfio_user: add client APIs of device attach/detach Chenbo Xia
2021-01-14 6:14 ` [dpdk-dev] [PATCH v2 7/9] vfio_user: add client APIs of DMA/IRQ/region Chenbo Xia
2021-01-14 6:14 ` [dpdk-dev] [PATCH v2 8/9] test/vfio_user: introduce functional test Chenbo Xia
2021-01-14 19:03 ` David Christensen
2021-01-19 3:27 ` Xia, Chenbo
2021-01-19 18:26 ` David Christensen
2021-01-14 6:14 ` [dpdk-dev] [PATCH v2 9/9] doc: add vfio-user library guide Chenbo Xia
2021-01-15 7:58 ` [dpdk-dev] [PATCH v2 0/9] Introduce vfio-user library David Marchand
2021-01-19 3:13 ` Xia, Chenbo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MN2PR11MB38075A37B9F41EE7C66D53CEF7AF0@MN2PR11MB3807.namprd11.prod.outlook.com \
--to=beilei.xing@intel.com \
--cc=chenbo.xia@intel.com \
--cc=cunming.liang@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=miao.li@intel.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
--cc=xiuchun.lu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).