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 01FAEA0526; Mon, 20 Jan 2020 18:33:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3D98C1BFFB; Mon, 20 Jan 2020 18:33:08 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2062.outbound.protection.outlook.com [40.107.21.62]) by dpdk.org (Postfix) with ESMTP id E3BBB1BFF1 for ; Mon, 20 Jan 2020 18:33:05 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PSTNEsTcpxPinykgoniGh3atCWL6MuBBuewN2Sa/raLRYHQ7Tj9eRj2edkEeo2AelmeGrou462vP2c4FmjDBWLcaJBB5rk9QlhtzUSzyY7ACZQuP/i6UShSQ6Oik3ScxcCXV3Z30qPsB3FqI5l5ufZOIe5lJjTVywrpaY3gVUXhdt6wfY7pkwMuTjGSrwYtlKw+5AqiWPZPLAn6DMQ4OPf327rLyDTWjNBbOYow0yY0UMcp1iZHwc+lkZCBWE61HpnEE09Ggq9oBXvE5sK6dAFL13K86STOCnW7M/7cw8Y6xA5/CkcDkUswz3Q399533zLPBC7gigNbHr4+2NE314Q== 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=WkeFXk4QX/4ImkpwtHOVIA8hwWJHJykJ1AK5SMnpixE=; b=SLbAcu3+pwIdrgUIH8i/J5iBUYMPA2s92PVimpNCBUDUeC1+KAn0HBkLGLXmox8Tnl4cis44nQDXcua3/mMr8xJ0TN2QL3Fu8F/WwTMw0VBdeU6lDvGcn5AvR0BIay8h/dpofco6BPDk5xfyfR9gbEeCSDf+vkScNUjwctzsHVFr96TqLBvug2RVb65o7y411YCnDcLBsc39LWQlSKGcGFsXIyX2/M2zm8+z+x9YUz5hi/JTA/H5rtnB27dUf1YoF0DM0b+gpZLAm2ebyUC4jaV9vybWvoWfPvPWMaoZDyGAZ525CxMB5HHe/JP9E9OMmp2WjJnzGD+DJnY9imXQ+g== 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=WkeFXk4QX/4ImkpwtHOVIA8hwWJHJykJ1AK5SMnpixE=; b=OjzufJSfzdHxA0CNWDeefDo6NOkjSwSfKpqp6BRKsdJEp6ro44P2DPR/+UuRvIYEcAle71XiNglPaMuu+S8CiZFiD4qYtwDEvLbxDzgxWmPF/cxOcFZW12X5WrUziTP4p/i8yzkq+2Adj1MsENxCiJgVJvr/QVNtG+JOYBoRh78= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3218.eurprd05.prod.outlook.com (10.170.125.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.24; Mon, 20 Jan 2020 17:33:05 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::68eb:ad79:71f4:110f]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::68eb:ad79:71f4:110f%3]) with mapi id 15.20.2644.024; Mon, 20 Jan 2020 17:33:05 +0000 From: Slava Ovsiienko To: Olivier Matz CC: "dev@dpdk.org" , Matan Azrad , Raslan Darawsheh , Ori Kam , Shahaf Shuler , "stephen@networkplumber.org" , "thomas@mellanox.net" Thread-Topic: [PATCH v4 3/5] mbuf: create packet pool with external memory buffers Thread-Index: AQHVz5niuAibdErPPUmzCp3SsXtShKfzz6Vg Date: Mon, 20 Jan 2020 17:33:04 +0000 Message-ID: References: <20191118094938.192850-1-shahafs@mellanox.com> <1579179869-32508-1-git-send-email-viacheslavo@mellanox.com> <1579179869-32508-4-git-send-email-viacheslavo@mellanox.com> <20200120135948.GJ14387@glumotte.dev.6wind.com> In-Reply-To: <20200120135948.GJ14387@glumotte.dev.6wind.com> 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=viacheslavo@mellanox.com; x-originating-ip: [77.75.144.194] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 133b02f6-157d-4005-67eb-08d79dcece88 x-ms-traffictypediagnostic: AM4PR05MB3218:|AM4PR05MB3218: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0288CD37D9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(396003)(136003)(346002)(376002)(366004)(189003)(199004)(52536014)(478600001)(76116006)(9686003)(8936002)(6916009)(26005)(33656002)(8676002)(54906003)(186003)(81166006)(81156014)(64756008)(55016002)(86362001)(66476007)(66556008)(66946007)(316002)(66446008)(71200400001)(4326008)(7696005)(5660300002)(2906002)(6506007); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3218; H:AM4PR05MB3265.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; 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: nO+ro+2SGfQTAWRaf6dtQ/IH66NMXRnTLbrEMlHYZv2xkjDiT3EGrh/t/eYaYNq15/c/M5u/kuBVWahSQ6J1iaNR1nV2CnaGvDth5ACx77zJDdC7a4EezaasrLRAxFHBxQP76szdDTyrOhZVvYnPLkClkp2q5xln1AvpycVSVpKL9r1fOZ+1hHU2gQBCN8wecEjnMfcRFuBjRm9ElkVMSnZwYe+kLt4wQ/Kuqw3Dkpi/392HpA4xqLwmSPWwO0WQmal5jdsYi/1st1xK4na04lt2hwDA1wD3peYIm7cFJLlCoctO3/5rwXznA2xRTXsCSjHvArI6wWL0ePAOcMZHGxtz87ommMPQrLZ3mWzbNd0kORN1cck5kwzViXl90L6kFcTjitqGs+bKEll5+ad96KMAXHGUzU9cWveBo1OnPaImG6VN4em2qrg5WVA6S2l2 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: 133b02f6-157d-4005-67eb-08d79dcece88 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jan 2020 17:33:04.9184 (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: AbjBgwyoZoqml6XxFWF2ItsKEniCYJq1C+3DefdnWgEpmBu2kYydl2RwEx0ql73v4/2b7dUpzaD4JNJs57ijjri1h7jqsr0wvuI4z8bUYE0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3218 Subject: Re: [dpdk-dev] [PATCH v4 3/5] mbuf: create packet pool with external memory buffers 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, Olivier Great! Thanks a lot for the unit test template, this is very nice starting = point, I will think what would be good to add for more thorough testing. With best regards, Slava =20 > One more thing: it would be nice to have a functional test for this new > feature. I did a very minimal one to check the basic alloc/free/attach > feature, you can restart from that if you want. >=20 > static int > test_ext_pinned(int test_case) > { > struct rte_pktmbuf_extmem ext_mem; > struct rte_mempool *pinned_pool =3D NULL; > struct rte_mempool *std_pool =3D NULL; > const struct rte_memzone *mz =3D NULL; > struct rte_mbuf *m =3D NULL, *m2 =3D NULL; >=20 > printf("Test mbuf pool with mbufs data pinned to external buffer > (%d)\n", test_case); >=20 > std_pool =3D rte_pktmbuf_pool_create("std_pool", > NB_MBUF, MEMPOOL_CACHE_SIZE, 0, > MBUF_DATA_SIZE, > SOCKET_ID_ANY); > if (std_pool =3D=3D NULL) > GOTO_FAIL("std_pool alloc failed"); >=20 > mz =3D rte_memzone_reserve("std_pool", > NB_MBUF * sizeof(struct rte_mbuf), > SOCKET_ID_ANY, >=20 > RTE_MEMZONE_2MB|RTE_MEMZONE_SIZE_HINT_ONLY); > if (mz =3D=3D NULL) > GOTO_FAIL("memzone alloc failed"); >=20 > ext_mem.buf_ptr =3D mz->addr; > ext_mem.buf_iova =3D mz->iova; > ext_mem.buf_len =3D mz->len; > ext_mem.elt_size =3D sizeof(struct rte_mbuf); >=20 > pinned_pool =3D rte_pktmbuf_pool_create_extbuf("pinned_pool", > NB_MBUF, MEMPOOL_CACHE_SIZE, > 0, 0, SOCKET_ID_ANY, &ext_mem, 1); > if (pinned_pool =3D=3D NULL) > GOTO_FAIL("pinned_pool alloc failed"); >=20 > m =3D rte_pktmbuf_alloc(pinned_pool); > if (unlikely(m =3D=3D NULL)) > goto fail; >=20 > if (test_case !=3D 0) { > m2 =3D rte_pktmbuf_alloc(std_pool); > if (unlikely(m =3D=3D NULL)) > goto fail; > rte_pktmbuf_attach(m2, m); > } >=20 > if (test_case =3D=3D 0) { > rte_pktmbuf_free(m); > } else if (test_case =3D=3D 1) { > rte_pktmbuf_free(m); > rte_pktmbuf_free(m2); > } else if (test_case =3D=3D 2) { > rte_pktmbuf_free(m2); > rte_pktmbuf_free(m); > } >=20 >=20 > rte_mempool_free(pinned_pool); > rte_memzone_free(mz); > rte_mempool_free(std_pool); > return 0; >=20 > fail: > rte_pktmbuf_free(m2); > rte_pktmbuf_free(m); > rte_mempool_free(pinned_pool); > rte_memzone_free(mz); > rte_mempool_free(std_pool); > return -1; > }