From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 897DAA0C4B; Thu, 14 Oct 2021 19:15:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 135E140041; Thu, 14 Oct 2021 19:15:38 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id D616F4003C for ; Thu, 14 Oct 2021 19:15:35 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19ECiCvF030229; Thu, 14 Oct 2021 10:15:33 -0700 Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2175.outbound.protection.outlook.com [104.47.58.175]) by mx0b-0016f401.pphosted.com with ESMTP id 3bpjk19x0w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Oct 2021 10:15:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KpSyXi59jwQf315Fjqg+IWU1mGDnoQiuDAxkPnhv+PUBqq0kZMvYuo//JIY6zvtVtYP62LvZ4ohNSjprIgH+DJynCUDqffbO03AXEkLBnD1cqpwOAzC4T8dh42cdbArIbfGkkeFMrdp4EzgjNuLOXJBh0dSrEgYRoxcp1LxhUs0m8a0NdU+thmF/mtRHmQVBWCxsgVcjrddWnC1daA8hja8Mq+sygbPvuytaqhqOCMIQW+oXzIc4VPQB/lCWKIptd/7YM1Dn5Rl+nKwOsaWcmAjKBzxTbb25kjSy9DU/8Av9Dyo35qxVw+2zrjuMxiQLfg0N0AZmEVDKl/C17rex1A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JbpyAVdwSoCZg1KvEtSIOmsTpTwD5PI6lSYpQ12pp5w=; b=AekMwad3ZhWI5U5LZRiZl7sHnHGQwXe5hcRf1HwB5F1BIuMWBS98pS4e98NADE9wsJTm+DWUv1iRb2czEEWFe4bVrwjhwVN6huaaigizc8ufA0fxebYsuytfU+PIW+nXS/oXN8247VKvYl+Wy75r5uJQOrHWxxkA3ToY2rPsQGRtoPhcuuGVziHfRfl+GZUA9ZNCaNmDihKpOAwm1lzHedS1U+iOEuW1tk97VZBhqrIf7if9zDooBHd+h+kerG/EthUahu91YGfk2kmtW9QbYf0onFisKAsZ1ECNvGoS8J+d1ZQArPIWBRKKxtDl39IyqR0h+hUARhZh50HbuZtqcA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JbpyAVdwSoCZg1KvEtSIOmsTpTwD5PI6lSYpQ12pp5w=; b=h/w8Mb9UAVmRiTVasHNXNntIbbf1IFUmzdJb6DywRrkFgLjP+OL7VqIW3v79z86RKUfkMfX9/TZ+XBrAOOFaSH6H5zHPeCQHvA01qiX7cmtOCi+DtbE4CBcXJzcx+pfBJfOrAbKoqfG7QWINipJl0h28D/8MYy5wPa1//dViS7U= Received: from BN9PR18MB4204.namprd18.prod.outlook.com (2603:10b6:408:119::18) by BN8PR18MB2434.namprd18.prod.outlook.com (2603:10b6:408:9c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Thu, 14 Oct 2021 17:15:32 +0000 Received: from BN9PR18MB4204.namprd18.prod.outlook.com ([fe80::29f4:8e3d:264f:26b1]) by BN9PR18MB4204.namprd18.prod.outlook.com ([fe80::29f4:8e3d:264f:26b1%8]) with mapi id 15.20.4608.016; Thu, 14 Oct 2021 17:15:31 +0000 From: Harman Kalra To: Dmitry Kozlyuk CC: "dev@dpdk.org" , Thomas Monjalon , Ray Kinsella , "david.marchand@redhat.com" Thread-Topic: [EXT] Re: [PATCH v2 1/6] eal/interrupts: implement get set APIs Thread-Index: AQHXueK2CId47iEMR0q7GpXXL9x7TKvRuYkAgAEN9nA= Date: Thu, 14 Oct 2021 17:15:31 +0000 Message-ID: References: <20210826145726.102081-1-hkalra@marvell.com> <20211005121502.66964-1-hkalra@marvell.com> <20211005121502.66964-2-hkalra@marvell.com> <20211014035852.7bb70657@sovereign> In-Reply-To: <20211014035852.7bb70657@sovereign> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fe91dedd-891f-4d9a-c5ba-08d98f363a58 x-ms-traffictypediagnostic: BN8PR18MB2434: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: mLnAMW73sig6G/yBazNekKR24VcM550oSEZmLkp4mjPgsnNLNfbnxDHcIYaGppLaXXKMTN6mV58XoHKU9rK0VNsyCDQJRYgKuo8D08jHN6xXtlDmHat5w2wWORRNFDoQUPEIhs2GBIb2h5uuplN6y4BwT4ul3lJslXJNTAcF0ySqjt234Ax41WK81CvqoJnLbMeL+l0j/T9eoJt0JrdfzB+QmNfk7VwkLpRXCxtgFkklLPxmb1+ruXI6XsdMwaoRg+M3V9T7FTn698fbclX/boP9drIYzO290q+sCwpimpJtZHGSBnT4sbLpr9nG6/+WX4zjN7kyvZBCXsqsJ4J7XHM96eIrVYdQ2eOcuXk/LcD+Npnk7qyXBZRkChhpHwdXBnAROVfwBGPd5jPCRVy9crq4yjTuNKG0amqaEeL+0woI/TbcLSF8l8d+5v+hJDYb6N9QS+BwM/DAfRBQ9BFWc2u2fC203dbd5CB+plrCyw65OE653j5JDcD3X8noAbF/Hk2nvhd6Al6RfuHxCNY6f6MjI5fvTY26leuFvXLHol51Ch/qmpWZ4Z68isik2jCM62R1WaratwQV/ZF/lUufXiHw+j0PfUZxaWXSf+osUPwUAaX/foZ83rQ4zbktIf1xqOeuBhurPYMU67XSH9Os50tNPU6UY/6/9Li+JuuCIK8aTvMaLibcvqW7KDOrOC+JJ8Mzl6ez9OF7G2HSFBj+Ew== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN9PR18MB4204.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(4326008)(6916009)(316002)(6506007)(122000001)(53546011)(7696005)(508600001)(2906002)(38100700002)(33656002)(54906003)(5660300002)(186003)(83380400001)(55016002)(76116006)(66476007)(64756008)(66946007)(52536014)(66446008)(66556008)(38070700005)(8936002)(86362001)(26005)(9686003)(8676002)(71200400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?yh5u6jOxOfNXgdlJJgULQ/+tQeSQMKBh1OS3yIvgi0yQOL/lpioEnqH/NwOt?= =?us-ascii?Q?nvX5IVtzjZlqkwbJfsIk33IGVOjjrVtxjcdZTqSUIbI4Ind8EFID4YTjOTOA?= =?us-ascii?Q?/anoISJfbSy7Qybn1XIGKx0vgR8qDzkPvZfI+4623lSgAo+F5vWOWwXLaW1/?= =?us-ascii?Q?CXfqGmhrk5DPSNYJazI+d8oIuhCGuxrKYP79DHLQjQHo51ev75gVVKRlzokV?= =?us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YTNvpPB8+//I3seQ9uD5?= =?us-ascii?Q?iaBFr1HHza6KCyx//TZjM/x9FUHyX4Y2K/LDF9qwcBE/OFzTJU/8JWs3Tr5H?= =?us-ascii?Q?oRQFrL4I2VfNLOcKeIG6sO7KC7QrjXDMVz5IEN0QS1UstFZX2736x6BI4O7i?= =?us-ascii?Q?ZB2rgT798eKaDkhT0zKa1xo5WM9lLC3ysPPV3r3fop95SjEP4PpQZWx9k6GY?= =?us-ascii?Q?XOpug8+WjmKRT9528uB2rzQQ?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR18MB4204.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe91dedd-891f-4d9a-c5ba-08d98f363a58 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Oct 2021 17:15:31.8771 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 9PrDak1F5aAo0mxTepqpALpkI9/sYIMT5/GQqfXsT5/NtHtVth6kpypSfyGLXRwUFw3n+CvqibNJLpJcnYNQGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR18MB2434 X-Proofpoint-ORIG-GUID: r1IF05pQvaxZDtdb7YutP4oSIZ3QL2ph X-Proofpoint-GUID: r1IF05pQvaxZDtdb7YutP4oSIZ3QL2ph X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-14_09,2021-10-14_02,2020-04-07_01 Subject: Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/6] eal/interrupts: implement get set APIs 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" Hi Dmitry, Thanks for your inputs. Please see inline. > -----Original Message----- > From: Dmitry Kozlyuk > Sent: Thursday, October 14, 2021 6:29 AM > To: Harman Kalra > Cc: dev@dpdk.org; Thomas Monjalon ; Ray Kinsella > ; david.marchand@redhat.com > Subject: [EXT] Re: [PATCH v2 1/6] eal/interrupts: implement get set APIs >=20 > External Email >=20 > ---------------------------------------------------------------------- > 2021-10-05 17:44 (UTC+0530), Harman Kalra: > > [...] > > +int rte_intr_instance_copy(struct rte_intr_handle *intr_handle, > > + const struct rte_intr_handle *src) { > > + if (intr_handle =3D=3D NULL) { > > + RTE_LOG(ERR, EAL, "Interrupt instance unallocated\n"); > > + rte_errno =3D ENOTSUP; > > + goto fail; > > + } > > + > > + if (src =3D=3D NULL) { > > + RTE_LOG(ERR, EAL, "Source interrupt instance > unallocated\n"); > > + rte_errno =3D EINVAL; > > + goto fail; > > + } > > + > > + intr_handle->fd =3D src->fd; > > + intr_handle->vfio_dev_fd =3D src->vfio_dev_fd; > > + intr_handle->type =3D src->type; > > + intr_handle->max_intr =3D src->max_intr; > > + intr_handle->nb_efd =3D src->nb_efd; > > + intr_handle->efd_counter_size =3D src->efd_counter_size; > > + > > + memcpy(intr_handle->efds, src->efds, src->nb_intr); > > + memcpy(intr_handle->elist, src->elist, src->nb_intr); >=20 > Buffer overrun if "intr_handle->nb_intr < src->nb_intr"? Ack, I will add the check. >=20 > > + > > + return 0; > > +fail: > > + return -rte_errno; > > +} > > + > > +int rte_intr_instance_mem_allocator_get( > > + const struct rte_intr_handle *intr_handle) { > > + if (intr_handle =3D=3D NULL) { > > + RTE_LOG(ERR, EAL, "Interrupt instance unallocated\n"); > > + return -ENOTSUP; >=20 > ENOTSUP usually means the operation is valid from API standpoint but not > supported by the implementation. EINVAL/EFAULT suits better. Ack, will make it EFAULT. >=20 > > + } > > + > > + return intr_handle->mem_allocator; > > +} >=20 > What do you think about having an API to retrieve the entire flags instea= d? Now since we are planning to remove this flag variable and rely on auto det= ection mechanism. I will remove this API. >=20 > > + > > +void rte_intr_instance_free(struct rte_intr_handle *intr_handle) { > > + if (intr_handle =3D=3D NULL) { > > + RTE_LOG(ERR, EAL, "Interrupt instance unallocated\n"); > > + rte_errno =3D ENOTSUP; > > + } >=20 > API are neater when free(NULL) is a no-op. Correct. >=20 > > + > > + if (intr_handle->mem_allocator) > > + rte_free(intr_handle); > > + else > > + free(intr_handle); > > +} > > + > > +int rte_intr_fd_set(struct rte_intr_handle *intr_handle, int fd) { > > + if (intr_handle =3D=3D NULL) { > > + RTE_LOG(ERR, EAL, "Interrupt instance unallocated\n"); > > + rte_errno =3D ENOTSUP; > > + goto fail; > > + } >=20 > This piece repeats over and over, how about making it a function or a mac= ro, > like in ethdev? Ack, will define a macro for the same. >=20 > > + > > + intr_handle->fd =3D fd; > > + > > + return 0; > > +fail: > > + return -rte_errno; > > +} > > + > > +int rte_intr_fd_get(const struct rte_intr_handle *intr_handle) { > > + if (intr_handle =3D=3D NULL) { > > + RTE_LOG(ERR, EAL, "Interrupt instance unallocated\n"); > > + rte_errno =3D ENOTSUP; > > + goto fail; > > + } > > + > > + return intr_handle->fd; > > +fail: > > + return -1; > > +} >=20 > Please add a similar pair of experimental API for the "handle" member, it= is > needed for Windows interrupt support I'm working on top of these series > (IIUC, API changes should be closed by RC1.) If you will be doing this an= d > don't like "handle" name, it might be like "dev_handle" or > "windows_device". I add new APIs to get/set handle. Let's rename it to "windows_handle" >=20 > > [...] > > +int rte_intr_max_intr_set(struct rte_intr_handle *intr_handle, > > + int max_intr) > > +{ > > + if (intr_handle =3D=3D NULL) { > > + RTE_LOG(ERR, EAL, "Interrupt instance unallocated\n"); > > + rte_errno =3D ENOTSUP; > > + goto fail; > > + } > > + > > + if (max_intr > intr_handle->nb_intr) { > > + RTE_LOG(ERR, EAL, "Max_intr=3D%d greater than > > +RTE_MAX_RXTX_INTR_VEC_ID=3D%d", >=20 > The macros is not used in the comparison, neither should the log mention = it. I will add the check. >=20 > > [...] > > @@ -420,6 +412,14 @@ EXPERIMENTAL { > > > > # added in 21.08 > > rte_power_monitor_multi; # WINDOWS_NO_EXPORT > > + > > + # added in 21.11 > > + rte_intr_fd_set; > > + rte_intr_fd_get; >=20 > WINDOWS_NO_EXPORT Ack. >=20 > > + rte_intr_type_set; > > + rte_intr_type_get; > > + rte_intr_instance_alloc; > > + rte_intr_instance_free; > > }; >=20 > Do I understand correctly that these exports are needed to allow an > application to use DPDK callback facilities for its own interrupt sources= ? I exported only those APIs which are currently used by test suite or exampl= e applications, may be later more APIs can be moved from internal to public o= n need basis. > If so, I'd suggest that instead we export a simpler set of functions: > 1. Create/free a handle instance with automatic fixed type selection. > 2. Trigger an interrupt on the specified handle instance. > The flow would be that the application listens on whatever it wants, prob= ably > with OS-specific mechanisms, and just notifies the interrupt thread about > events to trigger callbacks. > Because these APIs are experimental we don't need to change it now, just = my > thoughts for the future. I am sorry but I did not followed your suggestion, can you please explain. Thanks Harman