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 D8E98A0544; Tue, 11 Oct 2022 02:53:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A1B3E42C16; Tue, 11 Oct 2022 02:52:17 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2055.outbound.protection.outlook.com [40.107.223.55]) by mails.dpdk.org (Postfix) with ESMTP id E506A42B9F for ; Tue, 11 Oct 2022 02:52:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sry7H7cU8yRMY2+RFISrSC0qnZZFvFNhnmm34AqIj8NlNJ/ag6jrLzxHsOpDR5JqLdI49wyWoslup6LdXm/0PaUKsSeaK6v1FQHQIfzDcS7NFwQv3LQpqAxfWJcD2ty+sLmOdxmMvAP7ctH3VTCsbIvRgKw1nvJCb3IvMeQaqSJcmllFYua2IC0K/OUmYxNO8tPe5fvVupwX4+M1FJUr45TVc+i8nmVL2U33zQTp4jJDiDiyXzdGDo5HDDwqpjohJmgAK4Fl77xq5zazDzSr/7EZXa0XhLpTG+JodN38bKxbxjLgLnDV11+vXp1oVo//P7SbkceDVXUn7UZ/IMVfNg== 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=J/X4oTcddrRFJtyvaksnolW05HBJ0g0Q4YUKN2kqEoGTX4wFx2DCzWPMKAitdBZKHquevC/z8dtcMnb72usTIk6m28t9Ge1/Zl9pHqepgwBmEDlpZicDJhhVTbJFgkMuZygbJ7uaWnPs2VdV+yw+T6HBEsm9mq/ELLjXwAk3eG0r/HRQcQ0Iv6vkAUJv30bjkMl6dGxQCZYp/Tsb/G6JnFGGsQ8n+DAUC2nMcX5IfcDCW7sxaNDpo7OsUrCBJQQ6Ko/7jlIbqlXH4KUCsHWURJYPV7SNGizNgIPen3i5Q7Jmpzj82SzgTCpc7imM8jA09rgK9hi6dmSTLo+86RNSEg== 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=iEE3DLHgLZrSdEe0eciWXOsH3eq2Slf9ajAKl/FVb+gH+Dx4xDvsO7rz9hZg99hH9xjl6IIHhIeKNZAuoGNRHX19XlDbRazkumSauIgSKYO3L/JSY+WkzbN9kqzqkArOQgZ2dkZ4jjHf0Bsvnz0oskLhBFS3AuuLyUCX1oLDQV0= Received: from BN0PR04CA0012.namprd04.prod.outlook.com (2603:10b6:408:ee::17) by MN0PR12MB5761.namprd12.prod.outlook.com (2603:10b6:208:374::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.31; Tue, 11 Oct 2022 00:52:09 +0000 Received: from BN8NAM11FT084.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ee:cafe::66) by BN0PR04CA0012.outlook.office365.com (2603:10b6:408:ee::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15 via Frontend Transport; Tue, 11 Oct 2022 00:52:09 +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 BN8NAM11FT084.mail.protection.outlook.com (10.13.176.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5709.10 via Frontend Transport; Tue, 11 Oct 2022 00:52:09 +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; Mon, 10 Oct 2022 19:52:08 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v1 22/35] net/ionic: do bulk allocations of receive mbufs Date: Mon, 10 Oct 2022 17:50:19 -0700 Message-ID: <20221011005032.47584-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: BN8NAM11FT084:EE_|MN0PR12MB5761:EE_ X-MS-Office365-Filtering-Correlation-Id: be0f622a-74fb-4d34-94f2-08daab22d398 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MEEHvjsozJ8VF2Joo9qrHgIBclql1wPVNTPGsUZof5/BXp4PJfoEDQDOjFI4iuTVJC9zsl8Fp4sWkVNVq84bxNssjm1aydyjervFHiiMGbE/W3ZiCewuWiqVzJl+jFixQwRFenonjKdhMfLOFK8bX0sAHK6PZr7U1AqP2RNSiz3bpVOmxOPvS6BvnAUR70Z7VWRGYQ36q9GPT7gnWtIHzwQQdU9PQ6chP4E5wczXOlbJ3eBYoQXqe0jteOtMpRrbluJCXrt0MSCQN21qT2G2WhDNGM4j7PVXYa78gsFhKS0gW4PUoy0RSUgMHilkN/5IsqFL6xW24eJonhX4uBpRadaQxlQJKHM44jUnI/+ZWvcGc7yFYHXAJBQesE+p5bseXipr8XTQXryWfzSdhv2gWlntrCVWXEKNQtyse7EhwOz/AcCghf/SwfBZ40xyeYOIoz7shwe1m9J3A8yYaryp/j6akA6dx1/qSuWU0N+ehMs3m/6koRKHLJQ6Y/4k2wHBaPlePQHvkbzDR3CAf99blfaytNpksRRk1CQ6DAgBVNZ3cMF/1X8VcrKWuJuNk837fCqUvbl+sP5nij/bOhD0yWpf0wcU+vAXNUlOOxGTqR8D27BDBnDSEevosJNmpUvYpr5hGAvWRNh9ZdyZKnr1GwZUv/Msh495Pdd8vKKu34u8X22FCw2rcG6SqPK/7yG45URSK/gu120fUXwQuRnMrpXrL1ZijAuaPS9gIX6PpODDDcHHCZzCjHqBb+Yjhm0PJp/5V6DmaMf2fFN4Chr3sI1Md3F6ReSighmL8nWgNh5GF57x/F2SqQih5ZjLEhuprxGNG+8K8WFamujOsK5tcFbbrIsW14pi8iFrWd9eaAU= 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)(136003)(396003)(39860400002)(376002)(346002)(451199015)(46966006)(36840700001)(40470700004)(4326008)(86362001)(26005)(1076003)(2906002)(40480700001)(44832011)(8676002)(186003)(478600001)(5660300002)(6916009)(40460700003)(316002)(336012)(36860700001)(426003)(41300700001)(356005)(16526019)(81166007)(47076005)(2616005)(83380400001)(8936002)(82740400003)(70586007)(82310400005)(70206006)(6666004)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 00:52:09.3107 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: be0f622a-74fb-4d34-94f2-08daab22d398 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: BN8NAM11FT084.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5761 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