Message ID | 20190107143951.30076-1-ndabilpuram@marvell.com (mailing list archive) |
---|---|
State | Changes Requested, archived |
Delegated to: | Ferruh Yigit |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 777A71B43C; Mon, 7 Jan 2019 15:40:11 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id EE4061B3FB for <dev@dpdk.org>; Mon, 7 Jan 2019 15:40:09 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x07EZAor027749; Mon, 7 Jan 2019 06:40:09 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=A6pipGKWxWIU/w59AHEKakfqAQdYbS0OXQRK6hAo8Vg=; b=TrwNn+iy34czYf1c/2lVvdjuRVR3UF0kp2n0r1bPanTYeA+C3cvgnVTc67e5EqCtiAMu voMZsUPVGegEj2qKA1Xuk2jwnR4mDQN+elyW3rY47Vq08JG6/MkusqS8kzgEik/FxFOr kB3DTlYYhMszE0QLVsd/KtAmJj46cFFM7+WFqa7nSu5aC4eUZb95EBaN+/gTIYP+1QSc 0wxaFGdEg9MZlQLv10+fLMomZ0GDlhwQjbv82LKsWUvjgBQ7I66HrTkENp6SB9TP6riP gTA5CrMFn68YEsmpjI1JoVHfo5/ip/mntAM/sH5gK2IxoQwPGIgGM+3kKsrsutE/vv1S DA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2pv58srqp3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 07 Jan 2019 06:40:09 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 7 Jan 2019 06:40:07 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.52) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Mon, 7 Jan 2019 06:40:07 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A6pipGKWxWIU/w59AHEKakfqAQdYbS0OXQRK6hAo8Vg=; b=WJRcK24vOsm1VT1D2MfRGTz/fky/SymqO+QsImmEVBfOxwdcumRQSIiNdgDrxa3lW4SCMRQ5oLXaXsjl4EbY/LXyQZ7LnJOw+9aP7zRwve6dxAoLLVqXJUnvTWfPMMi0Kc+MXIbqai1e1mXYuVhl4xX96LOdtOxEJG6IruNwEJI= Received: from DM6PR18MB2427.namprd18.prod.outlook.com (20.179.104.21) by DM6PR18MB2395.namprd18.prod.outlook.com (20.179.71.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.6; Mon, 7 Jan 2019 14:40:05 +0000 Received: from DM6PR18MB2427.namprd18.prod.outlook.com ([fe80::11f0:6cac:aa5d:c1b7]) by DM6PR18MB2427.namprd18.prod.outlook.com ([fe80::11f0:6cac:aa5d:c1b7%3]) with mapi id 15.20.1495.011; Mon, 7 Jan 2019 14:40:05 +0000 From: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com> To: Thomas Monjalon <thomas@monjalon.net>, Ferruh Yigit <ferruh.yigit@intel.com>, Andrew Rybchenko <arybchenko@solarflare.com> CC: "dev@dpdk.org" <dev@dpdk.org>, Jerin Jacob Kollanukkaran <jerinj@marvell.com>, Nithin Kumar Dabilpuram <ndabilpuram@marvell.com> Thread-Topic: [PATCH] ethdev: report error on name truncation Thread-Index: AQHUppbhtFOKYPOsVUWsd7vKUiZ53A== Date: Mon, 7 Jan 2019 14:40:05 +0000 Message-ID: <20190107143951.30076-1-ndabilpuram@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR01CA0100.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::16) To DM6PR18MB2427.namprd18.prod.outlook.com (2603:10b6:5:180::21) x-mailer: git-send-email 2.8.4 x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [115.113.156.2] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM6PR18MB2395; 20:aTx/J98okcbLtDSiNJ4Z0Lxg6NcBpJU9BB3aGvS39P6fyiW7hwmroilNXFR4aKE3gIjU8EY46EEOJxiS5P2uG5Wc7k27RnW0TGyXq7PO0/n5mExzqi3g1jbIUJtCkZy5Gv6YeIybdsZs3j5TscMHek6faCjYDsJy0QFVdPYLQxU= x-ms-office365-filtering-correlation-id: 2bcd4020-ae07-45b9-78c2-08d674ae037f x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:DM6PR18MB2395; x-ms-traffictypediagnostic: DM6PR18MB2395: x-microsoft-antispam-prvs: <DM6PR18MB2395194F1DEFEA98F3A71A7DAF890@DM6PR18MB2395.namprd18.prod.outlook.com> x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231475)(944501520)(52105112)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:DM6PR18MB2395; BCL:0; PCL:0; RULEID:; SRVR:DM6PR18MB2395; x-forefront-prvs: 0910AAF391 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(136003)(396003)(366004)(376002)(199004)(189003)(52116002)(478600001)(2616005)(26005)(6436002)(6486002)(53936002)(107886003)(110136005)(54906003)(186003)(5660300001)(71190400001)(55236004)(68736007)(6506007)(386003)(81156014)(2906002)(81166006)(71200400001)(256004)(50226002)(97736004)(102836004)(99286004)(8676002)(486006)(106356001)(316002)(14454004)(86362001)(8936002)(6512007)(6116002)(66066001)(3846002)(4326008)(25786009)(1076003)(7736002)(36756003)(476003)(305945005)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR18MB2395; H:DM6PR18MB2427.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: oWebmE3U4dGBlAeuPi069w0Df+z7sgEirazBcTgY74z0ACwVv+CChewsuiMTD8THYhAYpTuqeVZYfGV4B3avt5vn0RRPAEcUvSPUgbrdNM1ha0+sGkDgum6QfjxJYoKEeAmNLPYbf9Zygur2fNUhsFc09v+P5QFSlpa8vwflaRYFmVLvrsfinOjakbw9E8VU1ENX2eVVxh4V6Zzt+4/Na31itlC7P3uqy4eJgWcq8Fovt9d+WotPbUNV/1benumUeGLmYAksc6tcN+7B+TCK5KplkGJskZM3tbEUQHD9w9YqkXy/t/BpnI44JOggkFSq spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 2bcd4020-ae07-45b9-78c2-08d674ae037f X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2019 14:40:05.5774 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR18MB2395 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-01-07_06:, , signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901070129 Subject: [dpdk-dev] [PATCH] ethdev: report error on name truncation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Series |
ethdev: report error on name truncation
|
|
Checks
Context | Check | Description |
---|---|---|
ci/checkpatch | warning | coding style issues |
ci/mellanox-Performance-Testing | success | Performance Testing PASS |
ci/intel-Performance-Testing | success | Performance Testing PASS |
ci/Intel-compilation | success | Compilation OK |
Commit Message
Nithin Dabilpuram
Jan. 7, 2019, 2:40 p.m. UTC
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
lib/librte_ethdev/rte_ethdev.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
Comments
On 1/7/19 5:40 PM, Nithin Kumar Dabilpuram wrote: > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com> > --- > lib/librte_ethdev/rte_ethdev.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c > index 9d5107d..bd45445 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -3588,9 +3588,17 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name, > { > char z_name[RTE_MEMZONE_NAMESIZE]; > const struct rte_memzone *mz; > + int rc; > > - snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", > - dev->data->port_id, queue_id, ring_name); > + rc = snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", > + dev->device->driver->name, ring_name, > + dev->data->port_id, queue_id); > + > + if (rc >= RTE_MEMZONE_NAMESIZE) { > + RTE_LOG(ERR, EAL, "%s(): truncated name\n", __func__); > + rte_errno = ENAMETOOLONG; > + return NULL; > + } > > mz = rte_memzone_lookup(z_name); > if (mz) It is good to report an error in the case of name truncation, but the patch does more. It changes format of the memzone name, adds the driver name in it (what is bad since testpmd has commands to find the memzone by name and read descriptors (hack, but sometimes very useful)). Also I'm not sure about function name in the log message. Other places do not have it.
Hi, Please provide an explanation of the current behaviour. 07/01/2019 15:40, Nithin Kumar Dabilpuram: > - snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", > - dev->data->port_id, queue_id, ring_name); > + rc = snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", > + dev->device->driver->name, ring_name, > + dev->data->port_id, queue_id); You should keep the same name format. Please check this commit: http://git.dpdk.org/dpdk/commit/?id=5e046832
On Mon, 7 Jan 2019 17:47:08 +0300 Andrew Rybchenko <arybchenko@solarflare.com> wrote: > On 1/7/19 5:40 PM, Nithin Kumar Dabilpuram wrote: > > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com> > > --- > > lib/librte_ethdev/rte_ethdev.c | 12 ++++++++++-- > > 1 file changed, 10 insertions(+), 2 deletions(-) > > > > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c > > index 9d5107d..bd45445 100644 > > --- a/lib/librte_ethdev/rte_ethdev.c > > +++ b/lib/librte_ethdev/rte_ethdev.c > > @@ -3588,9 +3588,17 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name, > > { > > char z_name[RTE_MEMZONE_NAMESIZE]; > > const struct rte_memzone *mz; > > + int rc; > > > > - snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", > > - dev->data->port_id, queue_id, ring_name); > > + rc = snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", > > + dev->device->driver->name, ring_name, > > + dev->data->port_id, queue_id); > > + > > + if (rc >= RTE_MEMZONE_NAMESIZE) { > > + RTE_LOG(ERR, EAL, "%s(): truncated name\n", __func__); > > + rte_errno = ENAMETOOLONG; > > + return NULL; > > + } > > > > mz = rte_memzone_lookup(z_name); > > if (mz) > > It is good to report an error in the case of name truncation, but the patch > does more. It changes format of the memzone name, adds the driver name > in it (what is bad since testpmd has commands to find the memzone by name > and read descriptors (hack, but sometimes very useful)). > Also I'm not sure about function name in the log message. Other places > do not have it. > Maybe MEMZONE_NAMESIZE should be big enough that this should never happen? The size is arbitrary anyway.
On 1/7/19 6:53 PM, Stephen Hemminger wrote: > On Mon, 7 Jan 2019 17:47:08 +0300 > Andrew Rybchenko <arybchenko@solarflare.com> wrote: > >> On 1/7/19 5:40 PM, Nithin Kumar Dabilpuram wrote: >>> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com> >>> --- >>> lib/librte_ethdev/rte_ethdev.c | 12 ++++++++++-- >>> 1 file changed, 10 insertions(+), 2 deletions(-) >>> >>> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c >>> index 9d5107d..bd45445 100644 >>> --- a/lib/librte_ethdev/rte_ethdev.c >>> +++ b/lib/librte_ethdev/rte_ethdev.c >>> @@ -3588,9 +3588,17 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name, >>> { >>> char z_name[RTE_MEMZONE_NAMESIZE]; >>> const struct rte_memzone *mz; >>> + int rc; >>> >>> - snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", >>> - dev->data->port_id, queue_id, ring_name); >>> + rc = snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", >>> + dev->device->driver->name, ring_name, >>> + dev->data->port_id, queue_id); >>> + >>> + if (rc >= RTE_MEMZONE_NAMESIZE) { >>> + RTE_LOG(ERR, EAL, "%s(): truncated name\n", __func__); >>> + rte_errno = ENAMETOOLONG; >>> + return NULL; >>> + } >>> >>> mz = rte_memzone_lookup(z_name); >>> if (mz) >> It is good to report an error in the case of name truncation, but the patch >> does more. It changes format of the memzone name, adds the driver name >> in it (what is bad since testpmd has commands to find the memzone by name >> and read descriptors (hack, but sometimes very useful)). >> Also I'm not sure about function name in the log message. Other places >> do not have it. >> > Maybe MEMZONE_NAMESIZE should be big enough that this should never happen? > The size is arbitrary anyway. ring_name is provided by caller, so we can't guarantee it locally.
Hi Thomas, Sorry, missed to notice that format changed by your commit recently got overridden during some of our internal branch merging. I'll send a v2 with same format. -- Thanks Nithin From: Thomas Monjalon <thomas@monjalon.net> Sent: Monday, January 7, 2019 8:20 PM To: Nithin Kumar Dabilpuram Cc: Ferruh Yigit; Andrew Rybchenko; dev@dpdk.org; Jerin Jacob Kollanukkaran Subject: [EXT] Re: [PATCH] ethdev: report error on name truncation External Email ---------------------------------------------------------------------- Hi, Please provide an explanation of the current behaviour. 07/01/2019 15:40, Nithin Kumar Dabilpuram: > - snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", > - dev->data->port_id, queue_id, ring_name); > + rc = snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", > + dev->device->driver->name, ring_name, > + dev->data->port_id, queue_id); You should keep the same name format. Please check this commit: http://git.dpdk.org/dpdk/commit/?id=5e046832
Sure. Format change was unintentional and happened during internal merge, I’ll fix that and remove function name and send V2.
--
Thanks
Nithin
From: Andrew Rybchenko <arybchenko@solarflare.com>
Sent: Monday, January 7, 2019 8:17 PM
To: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Thomas Monjalon <thomas@monjalon.net>; Ferruh Yigit <ferruh.yigit@intel.com>; Andrew Rybchenko <arybchenko@solarflare.com>
Cc: dev@dpdk.org; Jerin Jacob Kollanukkaran <jerinj@marvell.com>
Subject: [EXT] Re: [dpdk-dev] [PATCH] ethdev: report error on name truncation
External Email
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 9d5107d..bd45445 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -3588,9 +3588,17 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name, { char z_name[RTE_MEMZONE_NAMESIZE]; const struct rte_memzone *mz; + int rc; - snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", - dev->data->port_id, queue_id, ring_name); + rc = snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", + dev->device->driver->name, ring_name, + dev->data->port_id, queue_id); + + if (rc >= RTE_MEMZONE_NAMESIZE) { + RTE_LOG(ERR, EAL, "%s(): truncated name\n", __func__); + rte_errno = ENAMETOOLONG; + return NULL; + } mz = rte_memzone_lookup(z_name); if (mz)