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 9A0C6A04FD; Fri, 7 Oct 2022 19:46:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 18E0F42BDE; Fri, 7 Oct 2022 19:44:59 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2087.outbound.protection.outlook.com [40.107.94.87]) by mails.dpdk.org (Postfix) with ESMTP id AA4BF42B9B for ; Fri, 7 Oct 2022 19:44:57 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KxPgVQUDcK1kMqfBNE5fQfAYfjreHQoiEFROSO0Hc12AbgCgYqeV51n5oFc+2t0J3FM8YnPdzhoogM7DCJ/NGFoIlXFNPdhA0KWAdqjZSKL8+G0x8je/w2IJHJrhqnNHfjyDkYVrizZBRzHHZxYcM8G2AKesVcfTGOTT9ATdZtig/asbwYEF/+A+5vdKuidRKGGVZYTNm/ChGce3stQtddE+JtnXyYKvokcPQfd/7GQKQP3fjtDjZ6rltAA/TInImWvmC25DmGdQdC7fXkNxWJl5+cIkEyS8L1iIQKReIcZKFlK/dEkIjX0DTDMuK1gNMigxJpPpgHBRdQuyioLbNw== 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=pWIWSbP4KuBwq9GvTt2eW3OWXAW1G5uoCuAipAuOGaw=; b=aVgZYhCdDZDDvJBSOfcTwzXcwWWG8QXAuRktJfw3G/GVpGHhQTImwqYcoAlRWXqtwkwjWp0rsXJZri1EwwDo6fo9IZgL6wlwhDcug9witcTGosLdVK7jIeO8aFuJgNyYYcuADte1dSjZf9Cdzt85sr/j72MLhJntSqj+T4kUnXKbqPyrHsOXc2C95WVtVCuBhBjPJHLG79wZtq6PZWHg+XQGhcZzXslonrWSp5rDC1PT0l2Cvn5BG+o0OSQ69wIWJJTcx/zUR8+8P0Y8AeSWxuqqiYJRqWHAdKPdrTwnv5GJKR1udENIqs2rUbpj5YHwkMN3O3gN7XOQVwLX1SySBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pWIWSbP4KuBwq9GvTt2eW3OWXAW1G5uoCuAipAuOGaw=; b=X+f9q8eCZgeMogARbw//CFNAI/FgWTX09KlNdRolhFvikPXV9CH+fBRxLl4xp3EaVY4D/p95myITr4RK1X2neBzPoN5wbJFrItw7PreWM5kEz9yvh+XvjBgQokxOQwQ+CHYoQTunbfetWkdJjk3Ozr+ec+LW0QPbNF5b/FT+PgQ= Received: from MW4PR03CA0336.namprd03.prod.outlook.com (2603:10b6:303:dc::11) by MN2PR12MB4469.namprd12.prod.outlook.com (2603:10b6:208:268::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.28; Fri, 7 Oct 2022 17:44:55 +0000 Received: from CO1NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dc:cafe::f1) by MW4PR03CA0336.outlook.office365.com (2603:10b6:303:dc::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15 via Frontend Transport; Fri, 7 Oct 2022 17:44:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT068.mail.protection.outlook.com (10.13.175.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5709.10 via Frontend Transport; Fri, 7 Oct 2022 17:44:54 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Fri, 7 Oct 2022 12:44:52 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH 22/35] net/ionic: do bulk allocations of receive mbufs Date: Fri, 7 Oct 2022 10:43:23 -0700 Message-ID: <20221007174336.54354-23-andrew.boyer@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221007174336.54354-1-andrew.boyer@amd.com> References: <20221007174336.54354-1-andrew.boyer@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT068:EE_|MN2PR12MB4469:EE_ X-MS-Office365-Filtering-Correlation-Id: a6cd6b42-b1ce-45c8-2b20-08daa88ba4fb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Qjp09PDr3/aHO05tWXOX9DryeS0NXz17bxaUg6QrQDdieB1+vpI1BZfVd+D0Y0OXiubXeYzn14JO0WCSztBnDrCpT6+MSWOIUVeG4gTShw3Fttm2SDMb8bbgxs7BzUIDwKqHBD2x5hAKgXtpYytPBtCAUnV1VVEtAA4gFdX8/poSW/tNU9uNoG14541GlLuA6X7lf+bhpRBGdk3QZyFIufNjmzR3UsYorO/y2b7hcd8xsumeNEobOCRS+SmbLhTRhQgrmHYwi8BJ2f94jtle9sDpvv+hkp+swNygUIoaEfKQupOFR+xkgkWrFX/aD5q25vffP32v/3vf4y/4STVm8BBsJvxYh3AI42HAmYuj0h4TEDyHFu+5PBfJgQDhQeIi7b7PNuYMEv64DWC5Dv0MGNWgcaNGWmdYw60QhtkQOR+G1P4k9ay0k0lqu1p8+TbBXBX6gMGOypfQw2E5WJ8cYAazJIb8ZP8Zf57Or5Gk/g+nifPlzkFltC31XTHsbv08R5YCMVwhxVXv/3zG9GWC+pblZHjmJ50axGwQqTeafJOUD020nHvc6blmyu8G9tmjKO0z/Cy8RHAYnjfcK9vNesHh38zTXu8ZeccTNnsNls8QGpihVtkFSxoCD8yrQPlwHcxCnSLJHhJent3JFBKQGx4Wr4AApXUm3dy4+/EPPq0mo8aniPZViugf1P7Rf6DxIzPWyx0B0tsIJXRG0XfYOB0mNMbMQDwoo9K46AHz7bZwq74vyzZIVRKAwQTM7hREdO/lXLWqn6p9kXqQzBPeM8AdOGy/fvGPtUUXD45C0VgJjkAaK5FOf3oZ2QjKS3uW X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(396003)(136003)(376002)(346002)(451199015)(40470700004)(46966006)(36840700001)(82310400005)(36756003)(44832011)(5660300002)(8936002)(86362001)(41300700001)(47076005)(336012)(83380400001)(186003)(1076003)(2616005)(16526019)(426003)(40460700003)(8676002)(4326008)(81166007)(2906002)(70586007)(356005)(70206006)(6666004)(40480700001)(36860700001)(478600001)(82740400003)(26005)(6916009)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2022 17:44:54.6628 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a6cd6b42-b1ce-45c8-2b20-08daa88ba4fb X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4469 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 Do bulk allocations to improve performance. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.h | 6 ++++++ drivers/net/ionic/ionic_rxtx.c | 35 ++++++++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index 4fb1f213ff..5231909213 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -17,6 +17,8 @@ #define IONIC_ADMINQ_LENGTH 16 /* must be a power of two */ #define IONIC_NOTIFYQ_LENGTH 64 /* must be a power of two */ +#define IONIC_MBUF_BULK_ALLOC 64 /* Multiple of 4 */ + #define IONIC_RSS_OFFLOAD_ALL ( \ IONIC_RSS_TYPE_IPV4 | \ IONIC_RSS_TYPE_IPV4_TCP | \ @@ -86,9 +88,13 @@ struct ionic_rx_qcq { uint16_t hdr_seg_size; /* Length of first segment of RX chain */ uint16_t seg_size; /* Length of all subsequent segments */ uint16_t flags; + uint16_t mb_idx; /* cacheline3 (inside stats) */ struct ionic_rx_stats stats; + + /* cacheline4+ */ + struct rte_mbuf *mbs[IONIC_MBUF_BULK_ALLOC] __rte_cache_aligned; }; struct ionic_tx_qcq { diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 30f7ce9fc6..5ee6573a50 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -77,6 +77,10 @@ ionic_rx_empty(struct ionic_rx_qcq *rxq) * fragments that were left dangling for later reuse */ ionic_empty_array(q->info, q->num_descs * q->num_segs, 0); + + ionic_empty_array((void **)rxq->mbs, + IONIC_MBUF_BULK_ALLOC, rxq->mb_idx); + rxq->mb_idx = 0; } /********************************************************************* @@ -950,6 +954,7 @@ ionic_rx_fill_one(struct ionic_rx_qcq *rxq) rte_iova_t data_iova; uint32_t i; void **info; + int ret; info = IONIC_INFO_PTR(q, q->head_idx); desc = &desc_base[q->head_idx]; @@ -959,12 +964,19 @@ ionic_rx_fill_one(struct ionic_rx_qcq *rxq) if (unlikely(info[0])) return 0; - rxm = rte_mbuf_raw_alloc(rxq->mb_pool); - if (unlikely(rxm == NULL)) { - assert(0); - return -ENOMEM; + if (rxq->mb_idx == 0) { + ret = rte_mempool_get_bulk(rxq->mb_pool, + (void **)rxq->mbs, + IONIC_MBUF_BULK_ALLOC); + if (ret) { + assert(0); + return -ENOMEM; + } + + rxq->mb_idx = IONIC_MBUF_BULK_ALLOC; } + rxm = rxq->mbs[--rxq->mb_idx]; info[0] = rxm; data_iova = rte_mbuf_data_iova_default(rxm); @@ -975,12 +987,19 @@ ionic_rx_fill_one(struct ionic_rx_qcq *rxq) if (info[i]) return 0; - rxm_seg = rte_mbuf_raw_alloc(rxq->mb_pool); - if (rxm_seg == NULL) { - assert(0); - return -ENOMEM; + if (rxq->mb_idx == 0) { + ret = rte_mempool_get_bulk(rxq->mb_pool, + (void **)rxq->mbs, + IONIC_MBUF_BULK_ALLOC); + if (ret) { + assert(0); + return -ENOMEM; + } + + rxq->mb_idx = IONIC_MBUF_BULK_ALLOC; } + rxm_seg = rxq->mbs[--rxq->mb_idx]; info[i] = rxm_seg; /* The data_off does not get set to 0 until later */ -- 2.17.1