From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 006A0A09FF; Thu, 7 Jan 2021 03:41:41 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB42D140E60; Thu, 7 Jan 2021 03:41:41 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 2D2A5140E49 for ; Thu, 7 Jan 2021 03:41:40 +0100 (CET) IronPort-SDR: 4jlOIAgS4g8kVJBzv/Ikfgr62ErdRU5tOAOKJussVM0Yuna1Nt/kj+kNewkviLl6faCD+OGm/w Nsudd/eY9Ixw== X-IronPort-AV: E=McAfee;i="6000,8403,9856"; a="173855483" X-IronPort-AV: E=Sophos;i="5.79,328,1602572400"; d="scan'208";a="173855483" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2021 18:41:39 -0800 IronPort-SDR: zx6XUNNzUTmQZXOBy0/be7KS3Y5IHP49P09RBuIhic4WqNgwSKbnoaucw06GdbgMVKpao++tr8 TaRGs/87sm9A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,328,1602572400"; d="scan'208";a="422406764" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by orsmga001.jf.intel.com with ESMTP; 06 Jan 2021 18:41:38 -0800 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 6 Jan 2021 18:41:38 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 6 Jan 2021 18:41:38 -0800 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.48) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Wed, 6 Jan 2021 18:41:36 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L2vDRQMA9926qPPJI4oH5BoaQ5uIz9rrxYw+18vggEXxwIlSjXT8rMDz0halDRA9iBRLwpOrSL+qgxO01f8aK7/55OYrWQnQvwdWXUkCc43H8l4BhmiwX4w7bbp623iIKqM6DjJNxBOCURxwSTdmxzyxagM2pTccR6uyhXKUuNlDpQw+KNQSyTTcmpmnWJ0oRdYpkkk+xwdAwLFBVHog5pjU5s335E7JSSHudxylIonZ5+TRvrhZd4K3SRlYBr35w6SdfeBV8lghhfx5ZkT+4L2jNaMrYIb3HorJNuLp+CV4ax171CPWRvxuzZ5tYvjI1WTHGHPTHhapKy3D7VmdLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yiQBqTngx/L8HLxdhMjdPV5d0gb5+NnWXeJ+nllw58M=; b=PqY79YLGYGKW2vep4Oxi0Nr6SFtF5Px5Nv+YOF+y5nZ8d056GrcXKDlCg1KJLrE2VazkhLVlWo50rhQk7pyjaLJlGKEvGU80D0wk/PN14MIvpEOJWkTuqI9s9BCcUAoQhACKmHuhoIy295ka3jk+Edk8DhTRDgb5coCQXbi9Loxq+/H7XUcJFxFLIch1tnNYreT1GW9/EUGmC+uIeB+rfKy0o2lhFIA4Dl4wqx0kC0HwEgXNQ7QPTfm9PSPkrUoOrwykvhqsY3GL384Qv67VJLY5TqcGDMiZoHUYMHtMhZhcLA5i5MWkn2w8EsWaFAZfMWTKaLdzCo7ndY7S55rUmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yiQBqTngx/L8HLxdhMjdPV5d0gb5+NnWXeJ+nllw58M=; b=PDQb2mQAQLU+d8w5jWnE6qBIDpMKQxnVGzlqBvLXAU4jttng13fDpVbqGUvbUsBbkAmd7CVVih2WHWAOuHH450EB4ZeZzbNTldoDsfuJDE5J609hsINqVXeK1o+MVzTLCMSgsGpHPw+1NFvpfLXukZPs4SbrsN3/W4somN1Mwos= Received: from MN2PR11MB3807.namprd11.prod.outlook.com (2603:10b6:208:f0::24) by MN2PR11MB3632.namprd11.prod.outlook.com (2603:10b6:208:ec::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.21; Thu, 7 Jan 2021 02:41:34 +0000 Received: from MN2PR11MB3807.namprd11.prod.outlook.com ([fe80::4d7f:d51:79bc:e596]) by MN2PR11MB3807.namprd11.prod.outlook.com ([fe80::4d7f:d51:79bc:e596%4]) with mapi id 15.20.3721.024; Thu, 7 Jan 2021 02:41:34 +0000 From: "Xing, Beilei" To: "Xia, Chenbo" , "dev@dpdk.org" , "thomas@monjalon.net" , "david.marchand@redhat.com" CC: "stephen@networkplumber.org" , "Liang, Cunming" , "Lu, Xiuchun" , "Li, Miao" , "Wu, Jingjing" Thread-Topic: [dpdk-dev] [PATCH 7/9] vfio_user: add client APIs of DMA/IRQ/region Thread-Index: AQHW1RNnWDcDNqDk5EWgaEmGs0qSpqobkg3g Date: Thu, 7 Jan 2021 02:41:33 +0000 Message-ID: References: <20201218073851.93609-1-chenbo.xia@intel.com> <20201218073851.93609-8-chenbo.xia@intel.com> In-Reply-To: <20201218073851.93609-8-chenbo.xia@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.36] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 29c14fc4-ea2b-4fed-0d46-08d8b2b5bf67 x-ms-traffictypediagnostic: MN2PR11MB3632: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3513; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dAPO17rjP00wUxUJDH7fk1qPuK92/Ey8QusG+vKIQd2PxX1Pm0PpoLNRvwezDjqgP2czb4alw4adEL7Zr9i0rdNmpiCEw8eN2UzBeyfZPQt5hdqyKtHJkX8npVkXhaXndyhxBaLhghuy9zjbqOHATovvRtDp+O4ITWOo7nckxLW3uFMXwy8+Qq04ALmL0MFzS2ISLeUnb9X7aTq0lJrR5SgnrCRyE8yMDOiWaz0/41PmZc4UH0oT2i9bkkaHsDkjSYF5hR0lbekypQLJAW+atgbm6u7KOQkuD5oVlJgLyDkxMzSRBySalFhjwIY7h0S3S3BYjnwVOdq/uWQ8zMhaGTkHqg6QwP4oA931z8wCF6wMBxnQ2qeNXHVf8doez+qReWBy4JTCE25D4yOPCdaIcvrLBxGdXkFBeattYiUhhDBN4FWGr9dslpyjNiQh1Y+g x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR11MB3807.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(136003)(346002)(366004)(376002)(39860400002)(5660300002)(478600001)(83380400001)(53546011)(76116006)(66446008)(66946007)(26005)(55016002)(2906002)(186003)(33656002)(9686003)(110136005)(316002)(54906003)(107886003)(8936002)(7696005)(8676002)(4326008)(66556008)(52536014)(71200400001)(66476007)(86362001)(6506007)(64756008)(21314003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?iMQdOC6LXlfSd74kON5wQPOoagJYH8EMEt9MURtrOKNwCBVkMl0VRMBig637?= =?us-ascii?Q?aYqPedtHNJFDCEGKpYJNNH9c1UobRptufFl8fsUzYVC+wGO2ybJY49djqxyG?= =?us-ascii?Q?LAXcQwB1Rc7k/4bDNqpW9zrE21vit4uMvmAbtlFcZz/NLHXDz8cadW6V90LI?= =?us-ascii?Q?qOvS+cEn7+g8fCEagAjSWesA3omxVmV2QEbfcqPqg3fYdqUW1gKEAwnYAPjC?= =?us-ascii?Q?ajWU8ErkwGP0JdXEUAMxE4lBVm0ySYbCUWlCJmXxabCiYvcbHYn/BtV0cWbL?= =?us-ascii?Q?/m6YsDLDclfuXLO2olpmLJpfcrBvIXvdRK6BYDnkLe0j1XLi1PDnnGkNMac1?= =?us-ascii?Q?VsBN9BlZzINBwzKSaipgjo+awfzQpRMM478aFRIsLoSzhghfExbrdJfv6OUh?= =?us-ascii?Q?3L0vj7OslPTOqSKvghJ9XRKxT9E6aWA52Z5SWk0q2sTFqJpHa5u1BaMG9trx?= =?us-ascii?Q?Oqmtd9pzBoHtFlQxlkJ9FTu73n+a4NXpEbJdo1b/QaDqxklfUBX66kgS2Axj?= =?us-ascii?Q?n/eYClN93GYx4fdHzL+jld1QkLDfMqcU6tmEUyntWU4EG8jsi3zRDDrq2SY+?= =?us-ascii?Q?uGzTUD5/qhJR0OezlA/AERaMC9HR1o6FzcLn3dGRooMgaWeQ5vweArZyzsTl?= =?us-ascii?Q?bZjzOunSAwFj36GwEYY+bdgekpZQRWo3XUOKwyVpCFKeUMrb/0I6BsLlyR4i?= =?us-ascii?Q?WrAYgaJG1+IfdmK1u4qMvcHemMb6YG3gEJI4Go5Wn8D4N0L1u+fW0W9KqjPW?= =?us-ascii?Q?mr6KTJFUFeYkS1pFILucGpx5QAY0z1c43/RuRwdK91wjdIqBnDkAauyLCuTV?= =?us-ascii?Q?RQ2cqcWYhRWUCu7cB4jEB1nMN0X6wR9zjXAaHedp/eG1CnS25xmM4lzCQHp3?= =?us-ascii?Q?W/8myP3omH7TMnrIWwbTQabbTYYGT/+WA07EqYKMBCojSzV1sE4eUJYaEchd?= =?us-ascii?Q?Rd9phE9aIb1UJOns7iVxgDWEq0X5qzLYbpZfyN2r4Fo=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR11MB3807.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 29c14fc4-ea2b-4fed-0d46-08d8b2b5bf67 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2021 02:41:34.0233 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: qyCmayOnbhVM/XKVok31jhAh5UANO7Q+M79ZITw7zvznp305u9yIeaZTILIoEpyIuqMKilxDF8warz9jCQoYYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3632 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 7/9] vfio_user: add client APIs of DMA/IRQ/region X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" > -----Original Message----- > From: dev 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 > ; Lu, Xiuchun ; Li, Miao > ; Wu, Jingjing > Subject: [dpdk-dev] [PATCH 7/9] vfio_user: add client APIs of DMA/IRQ/reg= ion >=20 > 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 >=20 > Signed-off-by: Chenbo Xia > Signed-off-by: Xiuchun Lu > --- > 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(+) >=20 > 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 =3D VFIO_USER_MSG_HDR_SIZE + sizeof(struct > +vfio_device_info); > + > + if (!info) > + return -EINVAL; > + > + dev =3D 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 =3D 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) !=3D 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 ref= ine.