From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 51D2AA0542; Tue, 5 Jul 2022 10:10:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 028DA4021D; Tue, 5 Jul 2022 10:10:07 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2073.outbound.protection.outlook.com [40.107.93.73]) by mails.dpdk.org (Postfix) with ESMTP id 1D6B4400D7; Tue, 5 Jul 2022 10:10:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=is0rGu7nFN9aUQXc8ddnDdWAt9QLw4MRYJH5DNZ94Bjzkwddm9xVRMA7cCmtn3vd0PsuUzY64YXU31R6qbDmb/ecBsrMH5uhvU9UZuTnu1H61qAnfAmcwHyawfTIxwP9i26gH92U8E7cs0BYaGf9wlXpIKgoDfUDfQdsuauMrWptndfoBubD9bEutwl3LuV1WcTP/Tmucu79e8RnW4QGxuP3iXJhhQKGwkqcW9cF+kxLO9tXxV43GQAZcIiABC2Gg+o/UeKDDMj14BlONvzIaNOfkWuL6ynSNMlGcPqm7tFyjdg2pTotIHH0UEh+WIL8hWrOM0Eex4HIK8u8qrEoYQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hR7qRzUixsEg/Ij62bJ1vCl16V1JAPvpsNdbKDCqnLI=; b=dWzFxQHRJg9H5ANFchWxHlALjdxgNRd3Qm72Q1inbKEqi+L7x5Ih+uJKUmB6YkBHgx5UpWtDe2MuUubpzc0dmrnYVXNanXd20mStTZ6RsGmSb+/0TbNlOKx2wUA15TzXo62YphueuwaQ3apExsppVsfTJgkJyF7aTBYa28ELmtSjiBGmcXBxGwA3QwrGca3qAnrb6IM7Fsvd4PJlh7GLRWj0w1BrBPy/D7eYPG+IfWIHVbWbVviC7kPcOqVO/oPpz1ek+EJc4bTTJ48ErFlPvwr+lfW4jMR+tfMenDs/1arAimhVy41TPV8xWjiuDI4CFYN2zxTHiQpryaz6xbPy5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hR7qRzUixsEg/Ij62bJ1vCl16V1JAPvpsNdbKDCqnLI=; b=DzvmteNF9Tamrcgq3HHyKivAp2aKk138uiTP7MtmVplGQywgShLgKIBNZHpzMwvbasqoqUHwpNaMxkOc5do9nJ4KHchAk153+YsxTvaagxANltdEX2FlzlhxgfAg5HfJR3b6fdF6edji8GBf5WYaOfpSjLC3Wr49rNPVl/gbRYrTnFTlwknL9U7+jqQhUExB/ttniw7Ft+TTYaFIry3guEW2UcuY13Ux0fB9AhZ6HRaA99PlriUhoLLVy9qq8Z4DwKdxgiZ7kwKwB0rKbuwxkWLriTB8c7w5i1oHJRvzOt/2241Vjevmu5T0gn7KxYoaQcjkx5VQ/gKX7+ocRxi7CA== Received: from CO2PR04CA0130.namprd04.prod.outlook.com (2603:10b6:104:7::32) by DS0PR12MB6605.namprd12.prod.outlook.com (2603:10b6:8:d3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.21; Tue, 5 Jul 2022 08:10:04 +0000 Received: from CO1NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:104:7:cafe::42) by CO2PR04CA0130.outlook.office365.com (2603:10b6:104:7::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14 via Frontend Transport; Tue, 5 Jul 2022 08:10:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.236) by CO1NAM11FT032.mail.protection.outlook.com (10.13.174.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5395.17 via Frontend Transport; Tue, 5 Jul 2022 08:10:04 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 5 Jul 2022 08:10:03 +0000 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Tue, 5 Jul 2022 01:10:00 -0700 From: Raslan Darawsheh To: , CC: , , Ori Kam Subject: [PATCH] app/regex: fix mbuf size for multi segemnt buffers Date: Tue, 5 Jul 2022 11:09:16 +0300 Message-ID: <20220705080917.13784-1-rasland@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 379b438b-cf70-4124-499c-08da5e5dc419 X-MS-TrafficTypeDiagnostic: DS0PR12MB6605:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6E2kREC2/6MfXIyoZ2CiaYgcx+71cGJorX7wRiLsUEIEt/0dpuh9Mvsgsf3M4tvksPS74C/5m7nuEFjUwpchp1L7GVaff9xkoITDdLdViPCI5xR+5+RxtfUB6gpq5gzkGVt9Me91gWqJ5rmnRlmDtmornh7q53p25daghdDxOerhQ9l5Ss2kJCno1htz0foju4l1+nqRRuknrdnSWpyq8ymK63B8JqzvOM1UgQvIRk4rj/IRtrGg40QOleFP7minx1HWQq3iy73tMobI/MVwnvhFHL3Gk3j8GI67nqo6cXg1YF5cPbhG7Ytd2+6ipex4mP/MxhKtPiD86kbgZZeV+/sbJOwIJuYhoaSCw5kzPrT9PHvCUe9MxQjPFfF4akoOrPpzkfYty3iHIzC6PjSAolaFYbBYqe47wtHsTQld0emggeRB9W5XlpVrjBdiRFIddGGfE9wPQzK5bCuGGVCUPihhrhcZwvH/vy4WmuMtG8w1W9AYfu93Lv3YlzErjM3rwmHkELTv1CABqtUxmGrAgfPiUCYgPi2N4B0dKavLzf95C21J7S2nMaG+yMVxbQEg1Y407vRV8GzCBQFLAQVPkvM0i8AuEkY3EK+oPiAjAR7d1yLBIKflh+ADHJH280FGk9aRa8dpPU3xXff/Y7wkS28nMcd6sIEa0MhF2tDJdqUterpEFqxXG9aSQAb2E2YkIFTP2eDOW78yLILd8ScAexbowZ3OrOousSpXs111GOd69QMbhBDC2CBhcLLiM0vY8x+sLXEZ58HRrGOeU2HdlpOhqT0pj4OtpTuYDDxWenfXzDuPm2wrYeS7TsRcz0dwy1RV3jG2/sJvfeJ6EFVjxqHkO1AGGS3EKUB6EHw52I0= X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(136003)(346002)(376002)(396003)(39860400002)(36840700001)(40470700004)(46966006)(478600001)(107886003)(16526019)(186003)(1076003)(2616005)(36756003)(7696005)(41300700001)(6666004)(110136005)(2906002)(316002)(54906003)(8936002)(5660300002)(86362001)(47076005)(82310400005)(81166007)(336012)(356005)(82740400003)(426003)(40460700003)(6286002)(26005)(36860700001)(40480700001)(83380400001)(55016003)(70206006)(70586007)(4326008)(8676002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2022 08:10:04.0370 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 379b438b-cf70-4124-499c-08da5e5dc419 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6605 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When allocating multi segmented buffers, and in case there is a remainder in total buf len, the actual job len might be more than expected job_len. This adds additional space in the mbuf in the multi seg case, to allow the remaining memory to be stored in one segment. Fixes: c1d1b94eec58 ("app/regex: fix number of matches") Cc: ggribbon@nvidia.com Cc: stable@dpdk.org Signed-off-by: Raslan Darawsheh Acked-by: Ori Kam --- app/test-regex/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test-regex/main.c b/app/test-regex/main.c index 7c014b2210..db6a315abe 100644 --- a/app/test-regex/main.c +++ b/app/test-regex/main.c @@ -412,8 +412,8 @@ run_regex(void *args) mbuf_mp = rte_pktmbuf_pool_create(mbuf_pool, rte_align32pow2(nb_jobs * nb_qps * nb_segs), 0, 0, (nb_segs == 1) ? MBUF_SIZE : - (rte_align32pow2(job_len) / nb_segs + - RTE_PKTMBUF_HEADROOM), + (rte_align32pow2(job_len + (data_len % nb_jobs)) / + nb_segs + RTE_PKTMBUF_HEADROOM), rte_socket_id()); if (mbuf_mp == NULL) { printf("Error, can't create memory pool\n"); -- 2.25.1