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 A3372A0597; Tue, 21 Apr 2020 13:36:35 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 043761D177; Tue, 21 Apr 2020 13:36:35 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id B10CF1D173 for ; Tue, 21 Apr 2020 13:36:33 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03LBZefF016225; Tue, 21 Apr 2020 04:36:22 -0700 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-0016f401.pphosted.com with ESMTP id 30fxwpc16m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Apr 2020 04:36:22 -0700 Received: from m0045849.ppops.net (m0045849.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 03LBa4cI016312; Tue, 21 Apr 2020 04:36:21 -0700 Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 30fxwpc16f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 21 Apr 2020 04:36:21 -0700 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 21 Apr 2020 04:36:19 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.52) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Tue, 21 Apr 2020 04:36:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PXRn5mhOv4nSOPV7MAKNoQXLOtrJtWrr1/JjiJtsaiw8utLpv5UiPcO99uPFbFE03kvqTcfzJVS280gmxSAN38lifuIDNO1+pCnEbbuZSkvBpn8bH0b7us9JPboFSOc1AnHf4h2sNpxPs2JxT6eopKIzHya+7KlkNCbRXhNiG4l/5f6pgylAHmLZOWrcxsjgkfT+mEvecxHqjg1e716uwQDobcUI8/wc72bgRy3CrWJsYLnUayzLz3EV0axrOvNSrQd5S7wJnL5k5ASwIH6p4Tpr0mvpEtDCWu33adjqOblgOZb3n5MSH6U4FAZ85Xa/cD45R7OnKYyrr4xQZX6JdA== 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=OH089FoP661hYGruLLbfT8w3vfinPdfnHSsbiAczYOs=; b=iXZLj7mdTbxuwPPvnIxY4fOK1Wq5RssdZjQQpVf6t/2VDyk9p+oe1bomC0gmn40N7Yt1h392ufcLjnSfytOClnA34LZYOEXd1d7wqOdmG6ZjDMt9CpS5iS5W/H4Re76w372IWcbPSZ393B0s7g25Nf2ZduAABSsgG4F5eYAnZNjN/DHnMxQj1tYIbc8B7bH44gz0wK2VwanA37QMmwmUAFiqcReMuHeIQtJ8KQNARhrp3pn85qlNItc3fjnGHsVC/cVDXJDpDznBD6MNd/zNyMjW1KTOPGyGtBXhk6mzONB5x2kOP80Q46NlpGxw90rjz+apQ+haZRt9fwHt+25mnA== 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=OH089FoP661hYGruLLbfT8w3vfinPdfnHSsbiAczYOs=; b=XZOyiaXURCCofNREKoYAdet8SJqAwdJFBsqCJMwx74K/GC2aIeraxVf461KBWzNSqyvJ3t6zTS+dEdXWyM+nik/Kfc1aTIO9/yK7h31JG3oSjrANH5VyXk4G5EpID1UK447Uwsfly/gtJui9Kd9z+uW8mkePGy/sEo8uq6O9qLI= Received: from DM6PR18MB2410.namprd18.prod.outlook.com (2603:10b6:5:187::16) by DM6SPR01MB0038.namprd18.prod.outlook.com (2603:10b6:5:61::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.25; Tue, 21 Apr 2020 11:36:17 +0000 Received: from DM6PR18MB2410.namprd18.prod.outlook.com ([fe80::60e0:765a:d168:e1ec]) by DM6PR18MB2410.namprd18.prod.outlook.com ([fe80::60e0:765a:d168:e1ec%7]) with mapi id 15.20.2921.030; Tue, 21 Apr 2020 11:36:17 +0000 From: Guy Kaneti To: Ori Kam , Jerin Jacob Kollanukkaran , "xiang.w.wang@intel.com" CC: "dev@dpdk.org" , Pavan Nikhilesh Bhagavatula , "shahafs@mellanox.com" , "hemant.agrawal@nxp.com" , "opher@mellanox.com" , "alexr@mellanox.com" , "Dovrat Zifroni" , Prasun Kapoor , "nipun.gupta@nxp.com" , "bruce.richardson@intel.com" , "yang.a.hong@intel.com" , "harry.chang@intel.com" , "gu.jian1@zte.com.cn" , "shanjiangh@chinatelecom.cn" , "zhangy.yun@chinatelecom.cn" , "lixingfu@huachentel.com" , "wushuai@inspur.com" , "yuyingxia@yxlink.com" , "fanchenggang@sunyainfo.com" , "davidfgao@tencent.com" , "liuzhong1@chinaunicom.cn" , "zhaoyong11@huawei.com" , "oc@yunify.com" , "jim@netgate.com" , "hongjun.ni@intel.com" , "j.bromhead@titan-ic.com" , "deri@ntop.org" , "fc@napatech.com" , "arthur.su@lionic.com" , "thomas@monjalon.net" Thread-Topic: [dpdk-dev] [PATCH v2 4/4] regexdev: implement regex rte level functions Thread-Index: AQHWFLYcrN3IQYEDy0m8ElMHoZe0XaiDdsoA Date: Tue, 21 Apr 2020 11:36:17 +0000 Message-ID: References: <1585464438-111285-1-git-send-email-orika@mellanox.com> <1587127417-82492-1-git-send-email-orika@mellanox.com> <1587127417-82492-5-git-send-email-orika@mellanox.com> In-Reply-To: <1587127417-82492-5-git-send-email-orika@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [176.231.70.105] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 51183238-908a-46ba-e669-08d7e5e834de x-ms-traffictypediagnostic: DM6SPR01MB0038: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 038002787A x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR18MB2410.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(376002)(396003)(136003)(346002)(366004)(39860400002)(55016002)(8936002)(6506007)(4326008)(7696005)(5660300002)(186003)(9686003)(54906003)(110136005)(26005)(316002)(81156014)(33656002)(71200400001)(7416002)(2906002)(52536014)(66446008)(64756008)(478600001)(66476007)(66946007)(66556008)(76116006)(86362001); DIR:OUT; SFP:1101; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: vRH5Nqv8WqKmOLwVOOPPc4GbPLOesxFnMUjQoz2Yu6CINCPCeBIKChYli1MFHNOsJ9vnFXt/6OqQgtQIsYYK5uGhtwoYkpRxVt/OCvOwj72Dahpe82XBJc2sTzfSmqAZNjsEMQw/spfEuesltWOGStWQIo3L0XHE/zakQk4dxttRJopcryEttBBOW8ysRMV94wD4iRAxkskzGRgtfs9wScfj+z0TXmx+lQoGqMUWHAbXYiDECq0k+YpdGRRa4UCS8xpkWryJ5Gsw3UaS+o6LHvmNFMbzI7kMt97Iv6OkOOM7R0Z4mAOLxI+K9uK2YO0JPlS6qmfJj9OhWI97ePFx3LgjnTwD0WtOU0NJrjvyARotGsSTw0tqLlsOSd8riHq9e1KqAfwGbJxqL6ZQtrHCm1oRIX7cIK7m5yeDkEeBI2Psek/6fsAgkMLgQw37TeSp x-ms-exchange-antispam-messagedata: KqT4Kof7RCYyx9lroXODtMIE4ajL719/NUY/d6J8FR1JngE6FJRCoqWTJbTuCWdCLKZY2jKw7s0aQi5zrAgBXGpIWxEpNPy0n037i952l1GPmBZKtnBBaIaz0DhHeSjZv5OvzkEhRgDC2fl5vtoK+g== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 51183238-908a-46ba-e669-08d7e5e834de X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Apr 2020 11:36:17.6332 (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: HXCfjpVxVpF4Ocs4vmFDeFkdY6DbQPDebdVE10E8/N+ciRRYX7Le+b6V5sUJfRAwH8pFk2nfPUUDARwVk3V+0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6SPR01MB0038 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-21_04:2020-04-20, 2020-04-21 signatures=0 Subject: Re: [dpdk-dev] [PATCH v2 4/4] regexdev: implement regex rte level functions 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" Hi, > +int > +rte_regexdev_configure(uint8_t dev_id, const struct rte_regexdev_config > +*cfg) { > + struct rte_regexdev *dev; > + struct rte_regexdev_info dev_info; > + int ret; > + > + RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL); > + if (cfg =3D=3D NULL) > + return -EINVAL; > + dev =3D &rte_regex_devices[dev_id]; > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, - > ENOTSUP); > + if (dev->data->dev_started) { > + RTE_REGEXDEV_LOG > + (ERR, "Dev %u must be stopped to allow > configuration\n", > + dev_id); > + return -EBUSY; > + } > + ret =3D regexdev_info_get(dev_id, &dev_info); > + if (ret < 0) > + return ret; > + if ((cfg->dev_cfg_flags & > RTE_REGEXDEV_CFG_CROSS_BUFFER_SCAN_F) && > + !(dev_info.regexdev_capa & > RTE_REGEXDEV_SUPP_CROSS_BUFFER_F)) { > + RTE_REGEXDEV_LOG(ERR, > + "Dev %u doesn't support cross buffer > scan\n", > + dev_id); > + return -EINVAL; > + } > + if ((cfg->dev_cfg_flags & RTE_REGEXDEV_CFG_MATCH_AS_END_F) > && > + !(dev_info.regexdev_capa & > RTE_REGEXDEV_SUPP_MATCH_AS_END_F)) { > + RTE_REGEXDEV_LOG(ERR, > + "Dev %u doesn't support match as end\n", > + dev_id); > + return -EINVAL; > + } > + if ((cfg->dev_cfg_flags & RTE_REGEXDEV_CFG_MATCH_ALL_F) && > + !(dev_info.regexdev_capa & > RTE_REGEXDEV_SUPP_MATCH_ALL_F)) { > + RTE_REGEXDEV_LOG(ERR, > + "Dev %u doesn't support match all\n", > + dev_id); > + return -EINVAL; > + } > + if (cfg->nb_groups =3D=3D 0) { > + RTE_REGEXDEV_LOG(ERR, "Dev %u num of groups must be > > 0\n", > + dev_id); > + return -EINVAL; > + } > + if (cfg->nb_groups >=3D dev_info.max_groups) { > + RTE_REGEXDEV_LOG(ERR, "Dev %u num of groups %d > > %d\n", > + dev_id, cfg->nb_groups, > dev_info.max_groups); > + return -EINVAL; > + } The comparison should be > and not >=3D > + if (cfg->nb_max_matches =3D=3D 0) { > + RTE_REGEXDEV_LOG(ERR, "Dev %u num of matches must be > > 0\n", > + dev_id); > + return -EINVAL; > + } > + if (cfg->nb_max_matches >=3D dev_info.max_matches) { > + RTE_REGEXDEV_LOG(ERR, "Dev %u num of matches %d > > %d\n", > + dev_id, cfg->nb_max_matches, > + dev_info.max_matches); > + return -EINVAL; > + } The comparison should be > and not >=3D > + if (cfg->nb_queue_pairs =3D=3D 0) { > + RTE_REGEXDEV_LOG(ERR, "Dev %u num of queues must be > > 0\n", > + dev_id); > + return -EINVAL; > + } > + if (cfg->nb_queue_pairs >=3D dev_info.max_queue_pairs) { > + RTE_REGEXDEV_LOG(ERR, "Dev %u num of queues %d > > %d\n", > + dev_id, cfg->nb_queue_pairs, > + dev_info.max_queue_pairs); > + return -EINVAL; > + } The comparison should be > and not >=3D > + if (cfg->nb_rules_per_group =3D=3D 0) { > + RTE_REGEXDEV_LOG(ERR, > + "Dev %u num of rules per group must be > > 0\n", > + dev_id); > + return -EINVAL; > + } > + if (cfg->nb_rules_per_group >=3D dev_info.max_rules_per_group) { > + RTE_REGEXDEV_LOG(ERR, > + "Dev %u num of rules per group %d > %d\n", > + dev_id, cfg->nb_rules_per_group, > + dev_info.max_rules_per_group); > + return -EINVAL; > + } The comparison should be > and not >=3D > + ret =3D (*dev->dev_ops->dev_configure)(dev, cfg); > + if (ret =3D=3D 0) > + dev->data->dev_conf =3D *cfg; > + return ret; > +} In general I think that the validation of the cfg values should be done by = the PMD