From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id AB9CC239; Sun, 31 Mar 2019 18:25:09 +0200 (CEST) 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 x2VGP9WZ017601; Sun, 31 Mar 2019 09:25:09 -0700 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=wn0DUcH5h7NaDtgq5GHBDCtNTr8IO7G5sgdwXKJppVc=; b=Cdx8JNr4JP3b6rjX9iwhMxzdyElk7qWhkAziufZStZ2DqEukWwBv8pI6qnha2r6EzjU8 VRoY1Rtyii491k1BfbXwDm8RSuC8QuWtVVDirA+2uld2+OiPn9vnlaDZjrkiE4UaPzTW UtmROAs+EsbEOL2W51No2+T911mfF8CFoE7o+KJzTQM+PvSOJD6n0wB7MQZqH/AHX59Q SAFR9R5jAmFmeeByG7eg7cURZeLbT7DcMRqJ7VQpemVOYh6Gs6FPoYC0zppVfRpX52qe UB+qgG7Y1szQH/BWRSGVDVOBxie8u6kJIVDeTZA9VhQnOrhc5VBRC2LFSLfllUOtKtZE 2Q== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2rj7yk2y9y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 31 Mar 2019 09:25:08 -0700 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 09:25:07 -0700 Received: from NAM04-CO1-obe.outbound.protection.outlook.com (104.47.45.56) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Sun, 31 Mar 2019 09:25:07 -0700 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=wn0DUcH5h7NaDtgq5GHBDCtNTr8IO7G5sgdwXKJppVc=; b=E76K1eU4EN/uiZ0rttr7SLe+jpMw1/3DqkbEllKmTf9p9hj6jqfaG2MfYWfB529DJDffmIm5yPuYkqdfmfjctTsgZfzekHxScLD3bxgvE/9kv6zNhV1bWET3BG1p9hi7cVE76YsSNZGjz4UOnT6rGkgkdOXO8g7Kg8NwBbl3ra8= Received: from BN6PR1801MB1859.namprd18.prod.outlook.com (10.161.154.35) by BN6PR1801MB1810.namprd18.prod.outlook.com (10.161.157.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.16; Sun, 31 Mar 2019 16:25:05 +0000 Received: from BN6PR1801MB1859.namprd18.prod.outlook.com ([fe80::98a4:3008:ad01:4759]) by BN6PR1801MB1859.namprd18.prod.outlook.com ([fe80::98a4:3008:ad01:4759%3]) with mapi id 15.20.1750.017; Sun, 31 Mar 2019 16:25:05 +0000 From: Pavan Nikhilesh Bhagavatula To: Jerin Jacob Kollanukkaran , "thomas@monjalon.net" , "ferruh.yigit@intel.com" , "arybchenko@solarflare.com" , "stephen@networkplumber.org" CC: "dev@dpdk.org" , Pavan Nikhilesh Bhagavatula , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] ethdev: fix DMA zone reserve not honoring size Thread-Index: AQHU595MOajHoQkCVUWjgm4oLn5Ltg== Date: Sun, 31 Mar 2019 16:25:04 +0000 Message-ID: <20190331162437.13048-1-pbhagavatula@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SG2PR04CA0132.apcprd04.prod.outlook.com (2603:1096:3:16::16) To BN6PR1801MB1859.namprd18.prod.outlook.com (2603:10b6:405:66::35) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.21.0 x-originating-ip: [49.205.218.5] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: eb5477dc-75bd-465b-7ec1-08d6b5f56e75 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:BN6PR1801MB1810; x-ms-traffictypediagnostic: BN6PR1801MB1810: x-microsoft-antispam-prvs: x-forefront-prvs: 0993689CD1 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(376002)(366004)(136003)(39850400004)(199004)(189003)(71200400001)(4326008)(305945005)(14454004)(476003)(486006)(2616005)(6512007)(6436002)(14444005)(1076003)(25786009)(6486002)(68736007)(99286004)(256004)(54906003)(97736004)(2906002)(106356001)(36756003)(71190400001)(52116002)(86362001)(2501003)(81156014)(5660300002)(26005)(50226002)(386003)(186003)(53936002)(6506007)(78486014)(105586002)(102836004)(8676002)(7736002)(81166006)(478600001)(6116002)(3846002)(8936002)(316002)(66066001)(110136005)(2201001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR1801MB1810; H:BN6PR1801MB1859.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: jxIvuqg7LPo1lbg59nAO/M58tVNuh6K0PShHLnkgRkkR2cgb5aZ+ENFLU6QkWAQksZI0sEaI+Q0JPDJbXzC4jFfMJ1WpF1VZPnnROQ1xTaPo5ITTieXYp5Ol9gepOGukoF5Whd7B5BldyuXfSEiBfSTghBWSnkexl9dT31mJ7+yChThx+KRt1q63r7LdTd1lcQNn2ObJrY0VxUrYEk+kb2667EOIwLT1zCYsLp4+OLp1N3/ga77faTbdhumN5iu59aJgZ556JhatB1Ev8tIImRFlyJdrxIgNqXyg3f9DNnIx2jXaSL0MG/gy3iLTzZZcNMm6eh9jsN04CHuz0WqbyuYUhJ0ZbzF/6bh55R5WcaNcMikI4jS4tFQAtWPeNVJh02JKauPa9CfS8tGlM1nnlA/+NenS5+2V3SOQAkBfbNQ= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: eb5477dc-75bd-465b-7ec1-08d6b5f56e75 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Mar 2019 16:25:04.9726 (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-Transport-CrossTenantHeadersStamped: BN6PR1801MB1810 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-31_10:, , signatures=0 Subject: [dpdk-dev] [PATCH] ethdev: fix DMA zone reserve not honoring size 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: Sun, 31 Mar 2019 16:25:10 -0000 From: Pavan Nikhilesh The `rte_eth_dma_zone_reserve()` is generally used to create HW rings. In some scenarios when a driver needs to reconfigure the ring size since the named memzone already exists it returns the previous memzone without checking if a different sized ring is requested. Introduce a check to see if the ring size requested is different from the previously created memzone length. Fixes: 719dbebceb81 ("xen: allow determining DOM0 at runtime") Cc: stable@dpdk.org Signed-off-by: Pavan Nikhilesh --- lib/librte_ethdev/rte_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.= c index 12b66b68c..4ae12e43b 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -3604,9 +3604,12 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *d= ev, const char *ring_name, } =20 mz =3D rte_memzone_lookup(z_name); - if (mz) + if (mz && (mz->len =3D=3D size)) return mz; =20 + if (mz) + rte_memzone_free(mz); + return rte_memzone_reserve_aligned(z_name, size, socket_id, RTE_MEMZONE_IOVA_CONTIG, align); } --=20 2.21.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 026B0A00B9 for ; Sun, 31 Mar 2019 18:25:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1BB9F11A4; Sun, 31 Mar 2019 18:25:11 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id AB9CC239; Sun, 31 Mar 2019 18:25:09 +0200 (CEST) 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 x2VGP9WZ017601; Sun, 31 Mar 2019 09:25:09 -0700 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=wn0DUcH5h7NaDtgq5GHBDCtNTr8IO7G5sgdwXKJppVc=; b=Cdx8JNr4JP3b6rjX9iwhMxzdyElk7qWhkAziufZStZ2DqEukWwBv8pI6qnha2r6EzjU8 VRoY1Rtyii491k1BfbXwDm8RSuC8QuWtVVDirA+2uld2+OiPn9vnlaDZjrkiE4UaPzTW UtmROAs+EsbEOL2W51No2+T911mfF8CFoE7o+KJzTQM+PvSOJD6n0wB7MQZqH/AHX59Q SAFR9R5jAmFmeeByG7eg7cURZeLbT7DcMRqJ7VQpemVOYh6Gs6FPoYC0zppVfRpX52qe UB+qgG7Y1szQH/BWRSGVDVOBxie8u6kJIVDeTZA9VhQnOrhc5VBRC2LFSLfllUOtKtZE 2Q== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2rj7yk2y9y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 31 Mar 2019 09:25:08 -0700 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 09:25:07 -0700 Received: from NAM04-CO1-obe.outbound.protection.outlook.com (104.47.45.56) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Sun, 31 Mar 2019 09:25:07 -0700 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=wn0DUcH5h7NaDtgq5GHBDCtNTr8IO7G5sgdwXKJppVc=; b=E76K1eU4EN/uiZ0rttr7SLe+jpMw1/3DqkbEllKmTf9p9hj6jqfaG2MfYWfB529DJDffmIm5yPuYkqdfmfjctTsgZfzekHxScLD3bxgvE/9kv6zNhV1bWET3BG1p9hi7cVE76YsSNZGjz4UOnT6rGkgkdOXO8g7Kg8NwBbl3ra8= Received: from BN6PR1801MB1859.namprd18.prod.outlook.com (10.161.154.35) by BN6PR1801MB1810.namprd18.prod.outlook.com (10.161.157.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.16; Sun, 31 Mar 2019 16:25:05 +0000 Received: from BN6PR1801MB1859.namprd18.prod.outlook.com ([fe80::98a4:3008:ad01:4759]) by BN6PR1801MB1859.namprd18.prod.outlook.com ([fe80::98a4:3008:ad01:4759%3]) with mapi id 15.20.1750.017; Sun, 31 Mar 2019 16:25:05 +0000 From: Pavan Nikhilesh Bhagavatula To: Jerin Jacob Kollanukkaran , "thomas@monjalon.net" , "ferruh.yigit@intel.com" , "arybchenko@solarflare.com" , "stephen@networkplumber.org" CC: "dev@dpdk.org" , Pavan Nikhilesh Bhagavatula , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] ethdev: fix DMA zone reserve not honoring size Thread-Index: AQHU595MOajHoQkCVUWjgm4oLn5Ltg== Date: Sun, 31 Mar 2019 16:25:04 +0000 Message-ID: <20190331162437.13048-1-pbhagavatula@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SG2PR04CA0132.apcprd04.prod.outlook.com (2603:1096:3:16::16) To BN6PR1801MB1859.namprd18.prod.outlook.com (2603:10b6:405:66::35) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.21.0 x-originating-ip: [49.205.218.5] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: eb5477dc-75bd-465b-7ec1-08d6b5f56e75 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:BN6PR1801MB1810; x-ms-traffictypediagnostic: BN6PR1801MB1810: x-microsoft-antispam-prvs: x-forefront-prvs: 0993689CD1 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(376002)(366004)(136003)(39850400004)(199004)(189003)(71200400001)(4326008)(305945005)(14454004)(476003)(486006)(2616005)(6512007)(6436002)(14444005)(1076003)(25786009)(6486002)(68736007)(99286004)(256004)(54906003)(97736004)(2906002)(106356001)(36756003)(71190400001)(52116002)(86362001)(2501003)(81156014)(5660300002)(26005)(50226002)(386003)(186003)(53936002)(6506007)(78486014)(105586002)(102836004)(8676002)(7736002)(81166006)(478600001)(6116002)(3846002)(8936002)(316002)(66066001)(110136005)(2201001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR1801MB1810; H:BN6PR1801MB1859.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: jxIvuqg7LPo1lbg59nAO/M58tVNuh6K0PShHLnkgRkkR2cgb5aZ+ENFLU6QkWAQksZI0sEaI+Q0JPDJbXzC4jFfMJ1WpF1VZPnnROQ1xTaPo5ITTieXYp5Ol9gepOGukoF5Whd7B5BldyuXfSEiBfSTghBWSnkexl9dT31mJ7+yChThx+KRt1q63r7LdTd1lcQNn2ObJrY0VxUrYEk+kb2667EOIwLT1zCYsLp4+OLp1N3/ga77faTbdhumN5iu59aJgZ556JhatB1Ev8tIImRFlyJdrxIgNqXyg3f9DNnIx2jXaSL0MG/gy3iLTzZZcNMm6eh9jsN04CHuz0WqbyuYUhJ0ZbzF/6bh55R5WcaNcMikI4jS4tFQAtWPeNVJh02JKauPa9CfS8tGlM1nnlA/+NenS5+2V3SOQAkBfbNQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: eb5477dc-75bd-465b-7ec1-08d6b5f56e75 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Mar 2019 16:25:04.9726 (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-Transport-CrossTenantHeadersStamped: BN6PR1801MB1810 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-31_10:, , signatures=0 Subject: [dpdk-dev] [PATCH] ethdev: fix DMA zone reserve not honoring size 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" Message-ID: <20190331162504.VtGNF9XNZbnnvtdgsMYqvv6yoV4Pt2lLtFkWvVpQZ2Y@z> From: Pavan Nikhilesh The `rte_eth_dma_zone_reserve()` is generally used to create HW rings. In some scenarios when a driver needs to reconfigure the ring size since the named memzone already exists it returns the previous memzone without checking if a different sized ring is requested. Introduce a check to see if the ring size requested is different from the previously created memzone length. Fixes: 719dbebceb81 ("xen: allow determining DOM0 at runtime") Cc: stable@dpdk.org Signed-off-by: Pavan Nikhilesh --- lib/librte_ethdev/rte_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.= c index 12b66b68c..4ae12e43b 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -3604,9 +3604,12 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *d= ev, const char *ring_name, } =20 mz =3D rte_memzone_lookup(z_name); - if (mz) + if (mz && (mz->len =3D=3D size)) return mz; =20 + if (mz) + rte_memzone_free(mz); + return rte_memzone_reserve_aligned(z_name, size, socket_id, RTE_MEMZONE_IOVA_CONTIG, align); } --=20 2.21.0