From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id B9F462904 for ; Thu, 17 Jan 2019 15:13:58 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0HE62J9014323; Thu, 17 Jan 2019 06:13:57 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=wjRXMesizpX+5I3EfIgCYarBgCDeUSj1FLZf4/VaCG4=; b=jG3XEh+Qbku7rFO4g/BzgP71PShAZ1pG5APYwRiwKf+ZLZ6oLwo6mL7tbYPWJk1TfGMJ P2WiAgRxg8bpx7uvG5lZqOgQJgA6gK8EwO3G+Nd04CjW76lob/6QBTx80UK2aCEe+icQ MpMe2yVMM0B+uwu+DuR8ZYdyXwr4EaaJIqYUmS4sc9vleryrfMH1aW9cY9xzlle64DFk Yms31f7+LGDHgfkenzagYQ6rqKKIxsWQNrberrHP/WkXMP7tZ88dW23HCi1v0fW+XIrB vEuTZtuwqvlP6p3L69T2A4eQwWVqbuSX4+utmYpwvTZ0Ak0zd9jtcizF3BM+0zOzKref ZQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 2q2pf91kvs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 17 Jan 2019 06:13:57 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 17 Jan 2019 06:13:56 -0800 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (104.47.41.53) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 17 Jan 2019 06:13:56 -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=wjRXMesizpX+5I3EfIgCYarBgCDeUSj1FLZf4/VaCG4=; b=v1u5WF9krJwGGON6j11dQePN5zBuwJg2nlxZWlV2+UzOkUh8x6oC0VTt5BxxTqjR9XiclMpqreJvX1w+vEcgV7pY37cCeu24TM1eqvX/lnO/KJrKhZrIRBsqNxSYcbz8ERUulgEjgU3Il5t0UgQIYTv3Hbi8Z+ocDg60b61JWC8= Received: from DM6PR18MB2427.namprd18.prod.outlook.com (20.179.104.21) by DM6PR18MB3081.namprd18.prod.outlook.com (20.179.48.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.19; Thu, 17 Jan 2019 14:13:54 +0000 Received: from DM6PR18MB2427.namprd18.prod.outlook.com ([fe80::74b7:e3be:245b:939b]) by DM6PR18MB2427.namprd18.prod.outlook.com ([fe80::74b7:e3be:245b:939b%2]) with mapi id 15.20.1537.018; Thu, 17 Jan 2019 14:13:54 +0000 From: Nithin Kumar Dabilpuram To: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" , Jerin Jacob Kollanukkaran , Nithin Kumar Dabilpuram Thread-Topic: [PATCH v3] ethdev: report error on name truncation Thread-Index: AQHUrm7hx5INfneAw0uS3Xi9f98SgQ== Date: Thu, 17 Jan 2019 14:13:54 +0000 Message-ID: <20190117141316.24187-1-ndabilpuram@marvell.com> References: <20190107143951.30076-1-ndabilpuram@marvell.com> In-Reply-To: <20190107143951.30076-1-ndabilpuram@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BMXPR01CA0044.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::30) 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; DM6PR18MB3081; 20:GQwKEpHLJpvZgF37ML0HdXTi8Q9aFGNDG0E3ZA4xBKlNA4KjxXdMNaKaSAlqwqxUtt/Oze1ssZxsvjb2/VVXb3OBPoG3Pn55n1HHfREwAoTGnJWgz1bUPSafDoaU6kXUFIWI8WA+DtQe4mqijNq5rQ0P/dL1Fa+4NGHBVPLjPVw= x-ms-office365-filtering-correlation-id: 0f2db1b6-90f0-4d06-8ffc-08d67c860350 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:DM6PR18MB3081; x-ms-traffictypediagnostic: DM6PR18MB3081: x-microsoft-antispam-prvs: x-forefront-prvs: 0920602B08 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(366004)(136003)(396003)(346002)(54534003)(189003)(199004)(52116002)(55236004)(6436002)(478600001)(446003)(71190400001)(11346002)(1076003)(6116002)(7736002)(3846002)(102836004)(2906002)(99286004)(71200400001)(105586002)(66066001)(14454004)(386003)(6506007)(106356001)(186003)(256004)(54906003)(305945005)(316002)(110136005)(6512007)(26005)(36756003)(68736007)(25786009)(107886003)(5660300001)(486006)(6486002)(4326008)(53936002)(86362001)(50226002)(97736004)(76176011)(2616005)(81166006)(8676002)(81156014)(476003)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR18MB3081; H:DM6PR18MB2427.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: uzO6MMrQhpL9cmusFOGLicfKU+GT9oALOIII2pIzLnTLWozDKEX2VEyHXcOrA3XExMDvC8Y7g+zaut6mxTghfcVbxvPAN6A4N3Yji9PeiwG6j9qmWueWrayJrSHCD//QwGP7VS8u+8qbdZm9yHVEYwVfZnbD7ipB98uMAutKzfCvViKlsIrlZVOl5vmgNJ1U9LkALnXnpeKqhyC/OdYpagmrYDK/He+ZmF0AQPFHncdi72a5KT53phzxmbhNo/XaXnbXYB2aKADRBn3vtLgKHIxG+UwOpf8IJ5c19cqOuWXdPFfsBKI8xxWsTcRE4vKhWPfFXMYtwf65EXCXSk3n1hHUn6lPSldsJaLcRujWnprO3zIRDY2dkaSrteQxSL2seL6PWNbAHZ827RNeAi8Zo5flnYTXQ81kg6J4oyr0/Cw= 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: 0f2db1b6-90f0-4d06-8ffc-08d67c860350 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Jan 2019 14:13:51.9608 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR18MB3081 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-01-17_04:, , 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=1015 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-1901170103 Subject: [dpdk-dev] [PATCH v3] 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jan 2019 14:13:59 -0000 Currently this api doesn't report error if name is truncated and so user is not sure about uniqueness of name. This change reports error to help user. Signed-off-by: Nithin Dabilpuram --- v3: Change log message v2: Fix issue caused by rebase and also fix log message lib/librte_ethdev/rte_ethdev.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.= c index 9d5107d..474f305 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -3588,9 +3588,16 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *d= ev, const char *ring_name, { char z_name[RTE_MEMZONE_NAMESIZE]; const struct rte_memzone *mz; + int rc; =20 - snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", - dev->data->port_id, queue_id, ring_name); + rc =3D snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", + dev->data->port_id, queue_id, ring_name); + + if (rc >=3D RTE_MEMZONE_NAMESIZE) { + RTE_ETHDEV_LOG(ERR, "ring name too long\n"); + rte_errno =3D ENAMETOOLONG; + return NULL; + } =20 mz =3D rte_memzone_lookup(z_name); if (mz) --=20 2.8.4