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 1CE90A00C2; Wed, 22 Apr 2020 22:33:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7E7BB1D536; Wed, 22 Apr 2020 22:33:40 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50080.outbound.protection.outlook.com [40.107.5.80]) by dpdk.org (Postfix) with ESMTP id ED7821D447 for ; Wed, 22 Apr 2020 22:33:38 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eByvmskZXmOD+p5OFLAq0nwlDyqY6EiaIovQZcxzdizyww/6zlyC/H7YPx8vbciYJhYrHHBf6yQ6hAIh3dvyVxz6H0kFnLLRirn4B9wTMEnjvRDSrv+3TmyMR8a8qicQjB+vDSag1HokqwGvIEYy7Uj/AdL4WQZm0ounz7TDbSanY8xBcCod2NZD+93dnpc12sZtgBaTwoOCw0vkcMfwQAAceHmKdX6kjmjFCXkf7McA276z/Ihl0/psy2oHRxkYkr+puvkBW5nL6SlASCp9epdQLgJmq+W0QoQclGhEfThrn1o1Gjgkk/qg+FcRPqo7gfre3cQCx2BVWP1M9avpAw== 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=4H2DazLsMD0X7tDTo2GskFY/7lrMiY+ABmlyI3sQBFk=; b=LLtaN0CBy1lsUb1BOortTvsRb8GI+ZSSHcZmze/yORXQVvp6FLAoXZUhalg+l7q9IjDbdyrg1gNqacrAZxM871opkLK1QFCxUiLz5yKnaFtq19YIx4kAKDEkjk273Io3uLnn8FfJy2WBa2AmdvfbRyvobDzV9w36qxuV5/mLLEBcQTUIwoEXJRCsd+b9Y/djr9gLXv6Ar7hyogcsVFXzZzzscdzBfibpmyD/c4sUUcsXAUdJnhrKYXlDSVwiweGh17jog5rueP2vVU+0Z/QzzSefvtdYufG9Mjfr30P2AWINbtNt50uU97FxavITLxiZRYizopy3VWfyQNrjECu69w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4H2DazLsMD0X7tDTo2GskFY/7lrMiY+ABmlyI3sQBFk=; b=Fc8eeSokdebaWrUvaSjyA2l+dT2vvDJ8dgjyGYp9IAAYeywQZh91pa313aTxCRfK++ExtX3SE1JVm7Wnj+yEay4AcDpZScLZpMBkg4ogU0pDSyIii6/lXJAqpVfOJxL4c6xvD2qKndNi5hKsbcS0dNDSXcXq/XB38aWeWokR+u8= Received: from AM6PR05MB5176.eurprd05.prod.outlook.com (2603:10a6:20b:63::30) by AM6PR05MB5128.eurprd05.prod.outlook.com (2603:10a6:20b:3c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.29; Wed, 22 Apr 2020 20:33:37 +0000 Received: from AM6PR05MB5176.eurprd05.prod.outlook.com ([fe80::f5cd:b10f:5f1b:4b22]) by AM6PR05MB5176.eurprd05.prod.outlook.com ([fe80::f5cd:b10f:5f1b:4b22%7]) with mapi id 15.20.2937.012; Wed, 22 Apr 2020 20:33:36 +0000 From: Ori Kam To: Guy Kaneti , Jerin Jacob Kollanukkaran , "xiang.w.wang@intel.com" CC: "dev@dpdk.org" , Pavan Nikhilesh Bhagavatula , Shahaf Shuler , "hemant.agrawal@nxp.com" , Opher Reviv , Alex Rosenbaum , 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 Thread-Topic: [dpdk-dev] [PATCH v2 4/4] regexdev: implement regex rte level functions Thread-Index: AQHWF9EgGVmd3mTYn0eqaV8jrkTpdqiFmBEQ Date: Wed, 22 Apr 2020 20:33:36 +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: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=orika@mellanox.com; x-originating-ip: [89.208.130.33] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 8b12cf5c-5e17-46ad-61a7-08d7e6fc6f43 x-ms-traffictypediagnostic: AM6PR05MB5128:|AM6PR05MB5128: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 03818C953D x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR05MB5176.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(136003)(396003)(366004)(376002)(346002)(39860400002)(26005)(478600001)(55016002)(2906002)(7696005)(33656002)(71200400001)(54906003)(8936002)(186003)(76116006)(66946007)(316002)(9686003)(110136005)(81156014)(7416002)(52536014)(66446008)(66476007)(5660300002)(66556008)(4326008)(7406005)(64756008)(53546011)(6506007)(86362001); DIR:OUT; SFP:1101; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lnzGEitcL/4ZgIeB6xMfJDNJnK7lvLHe/xW64OtTg3p8OgGi73NlH8+iIqf3IQEMr9tx8ItKUcubblyEbvaCsdGwCJwnzxHpQQklWh5KX811HjVkgRA7NfEqghWkRipcz0TiW3p/vZJmaQllc1QZxpZ5lMfdxmv7uz1wnUjcx1Iba1qwpFwwJieljFRas8ElaU8A2JsEQCCAdXlMfvaE2mvOp47YBF5B+XmdGORKk6YzkCDM7pIB5jFnqKcC8b1gL7tZ/9iXX5zTB2cxtysCUW/MRxf1v+OyJ5qouBsb2x61wkqK/Xs9YzGaw9yGQDJ2TcNJHSo3O+MG5CNYUkd5Hjijyx1oyqFXaPgtO1ZwVhFWChbt7rz0mhu0XIxJycUIcia6JwyQpz6I1XvIadQF0xjRq+i1nwhnRieLxSyUy97U2civVdzJCxvcEVsjZYwL x-ms-exchange-antispam-messagedata: /oKAfFDUXGktuHnokiEDnF5q4e1Uq3y2UrcT9H6ChQvZX7xvKZS88aOcZXR/uU+TpiGa9jQnEoU9rRwSJ/ZZC3uFPvZST8QhZXb4zEMixUNP1bC7Ou5Vmpy7CS7rDPBbICVp53pjdyoW8ozJictjng== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b12cf5c-5e17-46ad-61a7-08d7e6fc6f43 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Apr 2020 20:33:36.6440 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 8X54A2EnGE12PxgQkSAKZvC5zmI421NkhNdeg4LFSiw1bnhFj+T4pHfSUV3raA1hGh3ExLwRqqy+bTChgZM0Mw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5128 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 Guy, > -----Original Message----- > From: dev On Behalf Of Guy Kaneti > Sent: Tuesday, April 21, 2020 2:36 PM > To: Ori Kam ; Jerin Jacob Kollanukkaran > ; xiang.w.wang@intel.com > Cc: dev@dpdk.org; Pavan Nikhilesh Bhagavatula > ; Shahaf Shuler ; > hemant.agrawal@nxp.com; Opher Reviv ; Alex > Rosenbaum ; 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 > > Subject: Re: [dpdk-dev] [PATCH v2 4/4] regexdev: implement regex rte leve= l > functions >=20 > Hi, >=20 > > +int > > +rte_regexdev_configure(uint8_t dev_id, const struct rte_regexdev_confi= g > > +*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; > > + } >=20 > The comparison should be > and not >=3D >=20 Yes, you are correct will fix. > > + 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; > > + } >=20 > The comparison should be > and not >=3D >=20 Yes, will fix. > > + 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; > > + } >=20 > The comparison should be > and not >=3D >=20 Will fix. > > + 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; > > + } >=20 > The comparison should be > and not >=3D >=20 Will fix. > > + ret =3D (*dev->dev_ops->dev_configure)(dev, cfg); > > + if (ret =3D=3D 0) > > + dev->data->dev_conf =3D *cfg; > > + return ret; > > +} >=20 > In general I think that the validation of the cfg values should be done b= y the > PMD This was done in the first version. after comments from the community, I changed it. As much as I like the idea that PMD should handle everything by itself. there is no point of code duplication, all PMD will require to do those tes= t, and there is no advantage of doing it inside the PMD. Also it is common practice in DPDK to assume that the input was tested in t= he above=20 layer. (you can see ethdev)