From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0064.outbound.protection.outlook.com [104.47.33.64]) by dpdk.org (Postfix) with ESMTP id 0536C1C00; Thu, 11 May 2017 12:31:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=iqZdWX6POt0USC6j7NxxhTVHrz5i28VLpUObd/oAMdE=; b=D0R9HnmkJtwOpFZQsFl6mWDC7QyWZ4YwshUnd1eVaQoPlkXfYqma0XiciuUl8BNEc1VtnY3JHQm+2JKPjtkNnhqIBuIvpUe8GK8rB+d/6u5cDv73aIT8AWpopDTQc0NNLb7hv4C2NLySSSKAdfJDES8+WcbKjSZhkLVV8yzZugc= Authentication-Results: 6wind.com; dkim=none (message not signed) header.d=none;6wind.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.localdomain (111.93.218.67) by BN3PR0701MB1718.namprd07.prod.outlook.com (10.163.39.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1084.16; Thu, 11 May 2017 10:31:27 +0000 From: Santosh Shukla To: olivier.matz@6wind.com, dev@dpdk.org Cc: thomas.monjalon@6wind.com, shreyansh.jain@nxp.com, Santosh Shukla , stable@dpdk.org Date: Thu, 11 May 2017 16:00:43 +0530 Message-Id: <20170511103044.14298-1-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: PN1PR01CA0026.INDPRD01.PROD.OUTLOOK.COM (10.164.137.33) To BN3PR0701MB1718.namprd07.prod.outlook.com (10.163.39.17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d5717d33-d2e8-4c41-fb1b-08d49858e35a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BN3PR0701MB1718; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 3:X726JZ7IMtT2Kl30d9zb4KOfREf5CfPomXZbpq/BFzDO6tkHhQNvXGlocpkMVSM8LpijT5CH4oeBQ9PWI2/FAjmRIybR6LIJ9rcd9VulIAPidJmmX5OvtO6u2q7kLLWcTQKtMpar6eVNKhJA4AQSb/pB1/+hdhikwLvXim6DwYFHaBx+WvbMDQYg0GbNgzmEZoz8kKe/s0OIelMpnTA6pYe9pi/cyxo1+xO2KpsZdYJBcO09UeDHL/9OKuHMZxeJutFyR9KMAGQ3wxuTNSFDKUFlhkOkQ+fRmXQ7onnu5j8gPxUTRtaqD065U4g6Jzq7n0iVwpUNcsDVFQx6b5BFHA==; 25:KABlj5gjk7C1ZOryJ3OkMi6pzizmjkgdVbmWqj0GXPy0lAiBG6HX572bW4h01XWY/kP5My5vFYF1tD4VLpQ0jWpMuq/LPcpXX0mlsj07tb+dV9y3uaV3Nckv8EluHWkYyuGjNuLdIWFLuyPcwD+E7wCMY8UEUtGFbzrvlhX12Bu1Zun1iRe6ke6uZJ3DBpM+Y2fBeRvWW93R/lw5qiQRX9JjFnCZvpcWma1jhVY7ZR4jNvTe1l+w35F0bV2rXsZ3dJTdW+TlBFmK+YDMyDytKDxK8MZIu3VEcENmHRHRwaBcmcbSszMGzhkGW/7Fv1lgXGAAKBZpvuGsS1XrTTev8ZdUwcmvPU4C3FrRfaf9wfocRv+xLMzJ+yhKpBElzDpfUShn0N8+joB2xahTUPVCInnmNfYnScGHF6xb4cgt6SgesW1HaZ3TETm6feZ+fqArPzoJ4J6WXg7+073xEpt7mKrW8zWHIMf3PEUjpQoioLs= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 31:6QOPnQA3jJK8awwA2zpc5ZzP7GqyfV+6XqGW/afhW81WUBfmMsrRDVmz6D6TgnIULUQ7R0HgWgDumwLelQtMAyzYEys519XnIIOgAaniBx3EsuPOfYOl44ewXpCiR+YTcrkmzg/xL1BWdyLFIvV8gY61jD5Qc1DO1ag9wxo7jMFT0yPgA1v8M287l7jJZV06E3XEHrPM1PPD1d35o4o3Kmer2cYBimaDzLdbtsBfTu0iDDd1w4JCrwDI0Mx1klEtXk03NuBr03WvFIhbYZz2KA==; 20:kGKLusbZPwIsxcEZxv3qEXU9aBk+TihftubMRkNTAGqRPX3K2NexFuxalaPDPcY3vhqYCY0MOthdwI5ORFCmDcZoWEpDCgBF/3+a+avmMGASoc29s0biVkXpdG90PHUdvDCVJ8ukxy04S4JfCvOBne2fwo1H4EINUSzEwUG43SzAoeKZkj5Kyyi7pR4PS3yz4RH4Jr48W48F4XRVroGmLrH/Wf0CjomxI4xz4zJEQN8NJr6Dbuud/vwNoTxJr0nHYHn2JKXlm+zPASEIrlm3zSVdbzWv62sWTurf8MuGEGyzbcUZy5bk7cM0J3uStaWPmGctsNlaYE6MOn4iMqT+Ki8Lx5bAluBIo5w4rkpRwAeng5K27C18hO0tbDUtFuP4R0KkWkpN7OUH2TPT950KpfKtyH7exKiS/FcFKEyIlGs6Rs1OyD5g77vlzHywCjtlo+Ua3+dNgNdWd9l0U1shWg8Z5guOFItdLL35nwxnsTP4we4YdjrDZzNFxM//UN7zMk3Ao1jeEqlymspHmi4uP0ZqRLCY5AB0bOb/GpDkKVb+SWccRfvRad6FIq2802yJTgxCkjcO60YMF1ltyTonNwFs6NmgnjwxdFYKUp8Blgw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(93006095)(3002001)(6041248)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123558100)(20161123560025)(6072148); SRVR:BN3PR0701MB1718; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1718; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 4:bXniKppSkjD8yPmP4B3vz8115E+wokmsPyx2JeoRadafTStz6aOq9H0bJ6Hi564lN584y92jTDBJV58Gi4OxXhGVrZyrHXl0Mczstw3DRO/kLUAHMG33EzNmywOPKkFzr/FV1Trter6LQvGovUdMVZhR6sGKahlv0f4jvXNVhj+7uAxWuNF/iunwhl/ptGxyk+VDcJqcmnX0gu1yqQQpm3RQTXV/rIw5+va2j/SscfSrvsUiT+AuqcJwpfKhsAanb8hydgyu9DfHVog4hZJIMuZLraPLLTtePz5JF+5c5ukLwr3gkewOUNXEuWelIeNtsgVLNEABlB0U2CLnIutLTG/H19R1jBivU10VtOGKhGl7nDgiFuWAlXe1bFUoAw/YsGivdIrLanZcg0UIuseNHpwajECKaAr0TLgIi2c5FT+OmL7uirWOues0P/8q8Q5kzDt1bJHZzsBllMA/zs8emuXCXFx/lpwjjlkTwBO8lWlPLUucwK4XWsbTgaT32THRrAqMF+ca5025/6rUxFNZmIPN4M/PnTZ7opH3T4LqX4Ynee8weZMcYKCa0lvnJ2UHfCfRe11w++XCuzGRzskj70F8RfYQq2N1/vqoJmJICW9Xj3u7tTHLvHH1VMpL7rd2EdEH0YNTwmuM+i2bZuSzHdbKN/KWEIvX8XW6FQFSLxYUP7wWjRpSByKTr7S7LjHICeqUJtuQq/G9eYn4hG+g3pern7Zg6ztUs7id1vv5bZk7Rku1kz4s7ZgSLpkjD+A5axyaJE4AWTHDDsthp8ZJ8Q== X-Forefront-PRVS: 0304E36CA3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(39450400003)(39850400002)(39400400002)(39410400002)(39840400002)(33646002)(36756003)(48376002)(50466002)(5660300001)(6512007)(66066001)(81166006)(6486002)(8676002)(72206003)(3846002)(305945005)(53936002)(7736002)(189998001)(50226002)(2906002)(47776003)(478600001)(6116002)(42882006)(5003940100001)(1076002)(50986999)(6506006)(42186005)(8656002)(5890100001)(6666003)(5009440100003)(4326008)(110136004)(25786009)(38730400002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1718; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0701MB1718; 23:0gRqb0jpKrj12QHdD9QZp0J4Oba6TUYGdwjPP+i?= =?us-ascii?Q?uadpfgIwQylCKuqb0LDMo7i5Vr+4JHRa0L275WNmP92WrvhgENXJHcxMErZj?= =?us-ascii?Q?q1cNTqZoQWHcRzvD44v4KKtYP5kX1L30GjQ27+yihwAre2pjsAH4VorS/DF+?= =?us-ascii?Q?C7x3iRhgKm/3dr/k6/jhfeurVTYIFp8CO2wXrfupsSpEK1Yh8RqqCrxIsEKf?= =?us-ascii?Q?PV7WXdwyWGZOJT+47YEWcTeIsKOueeCZ7LN8TpxahvlY4NPKIrdZC1HWKhdR?= =?us-ascii?Q?uPRjexLkNUKsMKc41OVNCDSoblEqTlbxer/fFlG/HV0CdOjQTlvHvVhmyb/e?= =?us-ascii?Q?jQL57urZkpkBBuUVd1dLfTMstP6t7wWEnUEaigVxjEV7LXMFTqNw+GRNN8ax?= =?us-ascii?Q?v9/i7AtllFy9qZudPOutbM/tbBhbBvPot5MIfodSOr3dP9z6zZrulqtCddJp?= =?us-ascii?Q?Nv+Z+e5/ZBjiSHe/80K+IdxVg6JfWTLy0kTeyOtUGzuF652mWxq02fzVS1Vf?= =?us-ascii?Q?SmkoWJvSxPnjkXGs5JluadJbxlfXLK42GETlIoGQqNw5PiLiXO70TxCzy2Kx?= =?us-ascii?Q?yK3ZNVGjaaSjt9P5G4+xnEGnMxAZFE6l7M1r3PqP/zN5+qEfTVM+gyiHTzEN?= =?us-ascii?Q?anZQ96lUVO4ABCLHvC6X3jC4cLxHbSHQhnhqUv9v0m4/IUskaSHWhNi25RoG?= =?us-ascii?Q?WVLYSK+t0Z4SkbdKC+RBqSr858A2E93nMdTSabXTDGHWzu8PP0+cBmihitFb?= =?us-ascii?Q?yeK6U0KPSsxp/BR6jJWjaV7LY5dwxeQ2hmdcHA0BoeQVEkq26D0sD2r3yFLA?= =?us-ascii?Q?NaT5VN5xBsCfe/8wdZZEHR2X3KDImEeSzBkhfx5aUmaRHHj4857Zir8y9lUc?= =?us-ascii?Q?lHz4uInG0RQOE7P0cyoRAVb5TK1ZedeSbVU0SKDNLihy49HKjpAbEg8clioz?= =?us-ascii?Q?/lmLBnB3zBkBmeHP5MdLmwiMmJlFF2kbNR8M5L7GrLHf2jH2R0ey34OcLyk+?= =?us-ascii?Q?60Zieha6rBJ7HrxaECD42mRSF64sq6vm4ngNBKJWJ4tx9d5Jx4PaLiP5ZLzM?= =?us-ascii?Q?SjK6SnAi5K7KjC90pCYceebkDsJroFB6oOtR/7hv/JlyALAMrew=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 6:4WDsYXKknKr6Bx4KX2JCRLozmBUq8k6sQSaLXJwr3BhdjjQCf1AJC02RbZkBiJtd13bKU8kjDQ5kwx8Rdvz73nkRyDsO6/qzrtgGyyeWZKTfjUf+Yi170uqBnzH6A/ASWDxlRfZs6kCG9vhBwJn6uNMl9djBYvwZLRgaSnB/KmOap4PdrQCJVzgwFTejuGB8BrhLvS5I7W60s85zrA6dAr+ArmbSA/yl4y8xKwgNFgofJlTu+q3h9ElpblG7sJkth1GRqhe4XLzNPhrJWXCXaHsjRsww6zMDhBHE2PHiPtnOvjOdPEfvGn+LlOaNW2tz3EN4lN00e/AeLrpGY/k7PmFwsy0UI9KSG5DW9VK6iUlncIVS6kq1I8CiwBbKZYXCJpRybpXzhOcOTi+sBD+kYHRriTpVjq+pwU5TfNxCnUGooYVa46fPHlTii1pSNdtcl3cvk3JdeJ71Z98L4vy5wePKAKjVkIrSeHJINs5TuW06p+iY77BMpMUXkGAkrUjOnFS1XeBU6NfEdRRwInmsPA==; 5:GsKE0z/7jep8K29dxMNQ2hs4/COewAx/Gfa78QjVMNBDKmi4kyzcjouiRluCFn7OiAAaq1klA8/aSZzxHmMpjFnEB9xzM/rt/FatBQvCTOgJElI/7ujFKGIgAuNaup8rwmI0YPDOqVciw6wZfc+yVA==; 24:wdTiIniUMQmjg0kVPVcTJwXxQvulxdfR2aY8QmbBd3wG/U8qzvy4uHeU+HLVj/kN48DOUT6Hy5d4rTJyawBYQU9foSfHIIDh0kczvmo9tRQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 7:boUFIgxC4JdpkT0tm0cXM2j3FROhqBYdnvkxJl4HX1VTVyLLV0Y3eQ21A03/LGbGV++/wme6PnBQzWG/LXG3jczSDqQ9IXtyuMoQ5ew3wieJ9G28FBgKKV+S27803Fm9OZFsmS/9XN1TqDsr4WNQQob2Q6J9mqClN0ganb0EPOX0cBsvbe5shom0c5ZB+acGf+HrHpdmQS/sNYhwCPV8RLpuBQz+/4EgQi2/Tgg0HoC+r5B/hZdlqeJOJU672Vt6xRqj1IAGYP06iX7fVaz0e6F5K1zbv7csylc3C76u8+zdjTQXL8BTZj60dn2PVJNx2ftyTz7IOJUtgBCGgcyj1A== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2017 10:31:27.7516 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1718 Subject: [dpdk-stable] [PATCH 1/2] test/test_mbuf: Remove mempool global var X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 May 2017 10:31:32 -0000 Cc: stable@dpdk.org Signed-off-by: Santosh Shukla --- test/test/test_mbuf.c | 100 +++++++++++++++++++++++++------------------------- 1 file changed, 51 insertions(+), 49 deletions(-) diff --git a/test/test/test_mbuf.c b/test/test/test_mbuf.c index d3ea812e5..ba93ac783 100644 --- a/test/test/test_mbuf.c +++ b/test/test/test_mbuf.c @@ -82,13 +82,8 @@ #define MAKE_STRING(x) # x -static struct rte_mempool *pktmbuf_pool = NULL; -static struct rte_mempool *pktmbuf_pool2 = NULL; - #ifdef RTE_MBUF_REFCNT_ATOMIC -static struct rte_mempool *refcnt_pool = NULL; -static struct rte_ring *refcnt_mbuf_ring = NULL; static volatile uint32_t refcnt_stop_slaves; static unsigned refcnt_lcore[RTE_MAX_LCORE]; @@ -144,7 +139,7 @@ static unsigned refcnt_lcore[RTE_MAX_LCORE]; * test data manipulation in mbuf with non-ascii data */ static int -test_pktmbuf_with_non_ascii_data(void) +test_pktmbuf_with_non_ascii_data(struct rte_mempool *pktmbuf_pool) { struct rte_mbuf *m = NULL; char *data; @@ -182,7 +177,7 @@ test_pktmbuf_with_non_ascii_data(void) * test data manipulation in mbuf */ static int -test_one_pktmbuf(void) +test_one_pktmbuf(struct rte_mempool *pktmbuf_pool) { struct rte_mbuf *m = NULL; char *data, *data2, *hdr; @@ -328,7 +323,7 @@ test_one_pktmbuf(void) } static int -testclone_testupdate_testdetach(void) +testclone_testupdate_testdetach(struct rte_mempool *pktmbuf_pool) { struct rte_mbuf *m = NULL; struct rte_mbuf *clone = NULL; @@ -432,7 +427,8 @@ testclone_testupdate_testdetach(void) } static int -test_attach_from_different_pool(void) +test_attach_from_different_pool(struct rte_mempool *pktmbuf_pool, + struct rte_mempool *pktmbuf_pool2) { struct rte_mbuf *m = NULL; struct rte_mbuf *clone = NULL; @@ -542,7 +538,7 @@ test_attach_from_different_pool(void) * test allocation and free of mbufs */ static int -test_pktmbuf_pool(void) +test_pktmbuf_pool(struct rte_mempool *pktmbuf_pool) { unsigned i; struct rte_mbuf *m[NB_MBUF]; @@ -583,7 +579,7 @@ test_pktmbuf_pool(void) * test that the pointer to the data on a packet mbuf is set properly */ static int -test_pktmbuf_pool_ptr(void) +test_pktmbuf_pool_ptr(struct rte_mempool *pktmbuf_pool) { unsigned i; struct rte_mbuf *m[NB_MBUF]; @@ -636,7 +632,7 @@ test_pktmbuf_pool_ptr(void) } static int -test_pktmbuf_free_segment(void) +test_pktmbuf_free_segment(struct rte_mempool *pktmbuf_pool) { unsigned i; struct rte_mbuf *m[NB_MBUF]; @@ -680,10 +676,11 @@ test_pktmbuf_free_segment(void) #ifdef RTE_MBUF_REFCNT_ATOMIC static int -test_refcnt_slave(__attribute__((unused)) void *arg) +test_refcnt_slave(void *arg) { unsigned lcore, free; void *mp = 0; + struct rte_ring *refcnt_mbuf_ring = arg; lcore = rte_lcore_id(); printf("%s started at lcore %u\n", __func__, lcore); @@ -704,7 +701,9 @@ test_refcnt_slave(__attribute__((unused)) void *arg) } static void -test_refcnt_iter(unsigned lcore, unsigned iter) +test_refcnt_iter(unsigned int lcore, unsigned int iter, + struct rte_mempool *refcnt_pool, + struct rte_ring *refcnt_mbuf_ring) { uint16_t ref; unsigned i, n, tref, wn; @@ -760,7 +759,8 @@ test_refcnt_iter(unsigned lcore, unsigned iter) } static int -test_refcnt_master(void) +test_refcnt_master(struct rte_mempool *refcnt_pool, + struct rte_ring *refcnt_mbuf_ring) { unsigned i, lcore; @@ -768,7 +768,7 @@ test_refcnt_master(void) printf("%s started at lcore %u\n", __func__, lcore); for (i = 0; i != REFCNT_MAX_ITER; i++) - test_refcnt_iter(lcore, i); + test_refcnt_iter(lcore, i, refcnt_pool, refcnt_mbuf_ring); refcnt_stop_slaves = 1; rte_wmb(); @@ -783,9 +783,9 @@ static int test_refcnt_mbuf(void) { #ifdef RTE_MBUF_REFCNT_ATOMIC - unsigned lnum, master, slave, tref; - + struct rte_mempool *refcnt_pool = NULL; + struct rte_ring *refcnt_mbuf_ring = NULL; if ((lnum = rte_lcore_count()) == 1) { printf("skipping %s, number of lcores: %u is not enough\n", @@ -797,20 +797,19 @@ test_refcnt_mbuf(void) /* create refcnt pool & ring if they don't exist */ - if (refcnt_pool == NULL && - (refcnt_pool = rte_pktmbuf_pool_create( - MAKE_STRING(refcnt_pool), - REFCNT_MBUF_NUM, 0, 0, 0, - SOCKET_ID_ANY)) == NULL) { + refcnt_pool = rte_pktmbuf_pool_create(MAKE_STRING(refcnt_pool), + REFCNT_MBUF_NUM, 0, 0, 0, + SOCKET_ID_ANY); + if (refcnt_pool == NULL) { printf("%s: cannot allocate " MAKE_STRING(refcnt_pool) "\n", __func__); return -1; } - if (refcnt_mbuf_ring == NULL && - (refcnt_mbuf_ring = rte_ring_create("refcnt_mbuf_ring", + refcnt_mbuf_ring = rte_ring_create("refcnt_mbuf_ring", rte_align32pow2(REFCNT_RING_SIZE), SOCKET_ID_ANY, - RING_F_SP_ENQ)) == NULL) { + RING_F_SP_ENQ); + if (refcnt_mbuf_ring == NULL) { printf("%s: cannot allocate " MAKE_STRING(refcnt_mbuf_ring) "\n", __func__); return -1; @@ -819,9 +818,10 @@ test_refcnt_mbuf(void) refcnt_stop_slaves = 0; memset(refcnt_lcore, 0, sizeof (refcnt_lcore)); - rte_eal_mp_remote_launch(test_refcnt_slave, NULL, SKIP_MASTER); + rte_eal_mp_remote_launch(test_refcnt_slave, refcnt_mbuf_ring, + SKIP_MASTER); - test_refcnt_master(); + test_refcnt_master(refcnt_pool, refcnt_mbuf_ring); rte_eal_mp_wait_lcore(); @@ -870,7 +870,7 @@ verify_mbuf_check_panics(struct rte_mbuf *buf) } static int -test_failing_mbuf_sanity_check(void) +test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool) { struct rte_mbuf *buf; struct rte_mbuf badbuf; @@ -931,7 +931,9 @@ test_failing_mbuf_sanity_check(void) } static int -test_mbuf_linearize(int pkt_len, int nb_segs) { +test_mbuf_linearize(struct rte_mempool *pktmbuf_pool, int pkt_len, + int nb_segs) +{ struct rte_mbuf *m = NULL, *mbuf = NULL; uint8_t *data; @@ -1022,7 +1024,7 @@ test_mbuf_linearize(int pkt_len, int nb_segs) { } static int -test_mbuf_linearize_check(void) +test_mbuf_linearize_check(struct rte_mempool *pktmbuf_pool) { struct test_mbuf_array { int size; @@ -1039,7 +1041,7 @@ test_mbuf_linearize_check(void) printf("Test mbuf linearize API\n"); for (i = 0; i < RTE_DIM(mbuf_array); i++) - if (test_mbuf_linearize(mbuf_array[i].size, + if (test_mbuf_linearize(pktmbuf_pool, mbuf_array[i].size, mbuf_array[i].nb_segs)) { printf("Test failed for %d, %d\n", mbuf_array[i].size, mbuf_array[i].nb_segs); @@ -1052,13 +1054,15 @@ test_mbuf_linearize_check(void) static int test_mbuf(void) { + struct rte_mempool *pktmbuf_pool = NULL; + struct rte_mempool *pktmbuf_pool2 = NULL; + + RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) != RTE_CACHE_LINE_MIN_SIZE * 2); /* create pktmbuf pool if it does not exist */ - if (pktmbuf_pool == NULL) { - pktmbuf_pool = rte_pktmbuf_pool_create("test_pktmbuf_pool", + pktmbuf_pool = rte_pktmbuf_pool_create("test_pktmbuf_pool", NB_MBUF, 32, 0, MBUF_DATA_SIZE, SOCKET_ID_ANY); - } if (pktmbuf_pool == NULL) { printf("cannot allocate mbuf pool\n"); @@ -1067,10 +1071,8 @@ test_mbuf(void) /* create a specific pktmbuf pool with a priv_size != 0 and no data * room size */ - if (pktmbuf_pool2 == NULL) { - pktmbuf_pool2 = rte_pktmbuf_pool_create("test_pktmbuf_pool2", + pktmbuf_pool2 = rte_pktmbuf_pool_create("test_pktmbuf_pool2", NB_MBUF, 32, MBUF2_PRIV_SIZE, 0, SOCKET_ID_ANY); - } if (pktmbuf_pool2 == NULL) { printf("cannot allocate mbuf pool\n"); @@ -1078,25 +1080,25 @@ test_mbuf(void) } /* test multiple mbuf alloc */ - if (test_pktmbuf_pool() < 0) { + if (test_pktmbuf_pool(pktmbuf_pool) < 0) { printf("test_mbuf_pool() failed\n"); return -1; } /* do it another time to check that all mbufs were freed */ - if (test_pktmbuf_pool() < 0) { + if (test_pktmbuf_pool(pktmbuf_pool) < 0) { printf("test_mbuf_pool() failed (2)\n"); return -1; } /* test that the pointer to the data on a packet mbuf is set properly */ - if (test_pktmbuf_pool_ptr() < 0) { + if (test_pktmbuf_pool_ptr(pktmbuf_pool) < 0) { printf("test_pktmbuf_pool_ptr() failed\n"); return -1; } /* test data manipulation in mbuf */ - if (test_one_pktmbuf() < 0) { + if (test_one_pktmbuf(pktmbuf_pool) < 0) { printf("test_one_mbuf() failed\n"); return -1; } @@ -1106,28 +1108,28 @@ test_mbuf(void) * do it another time, to check that allocation reinitialize * the mbuf correctly */ - if (test_one_pktmbuf() < 0) { + if (test_one_pktmbuf(pktmbuf_pool) < 0) { printf("test_one_mbuf() failed (2)\n"); return -1; } - if (test_pktmbuf_with_non_ascii_data() < 0) { + if (test_pktmbuf_with_non_ascii_data(pktmbuf_pool) < 0) { printf("test_pktmbuf_with_non_ascii_data() failed\n"); return -1; } /* test free pktmbuf segment one by one */ - if (test_pktmbuf_free_segment() < 0) { + if (test_pktmbuf_free_segment(pktmbuf_pool) < 0) { printf("test_pktmbuf_free_segment() failed.\n"); return -1; } - if (testclone_testupdate_testdetach()<0){ + if (testclone_testupdate_testdetach(pktmbuf_pool) < 0) { printf("testclone_and_testupdate() failed \n"); return -1; } - if (test_attach_from_different_pool() < 0) { + if (test_attach_from_different_pool(pktmbuf_pool, pktmbuf_pool2) < 0) { printf("test_attach_from_different_pool() failed\n"); return -1; } @@ -1137,12 +1139,12 @@ test_mbuf(void) return -1; } - if (test_failing_mbuf_sanity_check() < 0) { + if (test_failing_mbuf_sanity_check(pktmbuf_pool) < 0) { printf("test_failing_mbuf_sanity_check() failed\n"); return -1; } - if (test_mbuf_linearize_check() < 0) { + if (test_mbuf_linearize_check(pktmbuf_pool) < 0) { printf("test_mbuf_linearize_check() failed\n"); return -1; } -- 2.11.0