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 A94A8A0560; Tue, 18 Oct 2022 21:46:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C1FE44114B; Tue, 18 Oct 2022 21:46:28 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2064.outbound.protection.outlook.com [40.107.100.64]) by mails.dpdk.org (Postfix) with ESMTP id 02F2B4003F for ; Tue, 18 Oct 2022 21:46:27 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YjiE+MOZaz+rOohyMxcACHMrIwVOKr9KUQLrCuKmiS98kVDuyMQwWAYauWhHuc4uCfq8TpKbhWUv+C0NVEQRENBNS8s8S6xc6Zvrh9SQJZSMl/btUd4NeTRoM/Uh/wMnO8pruCzNjUM4he8qoHbq04xE8TkuEu58kYhhtYa+8joaZ1gP52VOqUCAoDy+EQeBXq2CdIoQeWGChV0QCRFJ4Kd8vYznC6C9Tlf8LHbTd0HYIsh0lnxnvhyBphLo9KUEnGFIM40hbX9NxEYX69opSyPuQ4PoVIGYbRk7uqUKNmU8nukzMoStC7ym2pdxkOqrESIZwwu6EbhJfHt1rGUWCA== 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=1IuWfozZqQ9az7nxY4D3dTARCn3eP/ZOoTxmoycnkX4=; b=AHgbkGdctxq1sYuV6c42MOzQHmV2Q8umtPGow0rU2AMuQklxh0t1Ng25iV0blzKuJl8FqF73Dct5gBW0W+vnczPRNriz6PEvRCnoTm9qcqE9nu8E1rBcnOvtX7lkf55Z9IgtjEtgPmLAgL+fcWsie45vOPt6fTH5MmQbx53/OAZnX8jiqbbyhRbYMQY5uF3H05m3i55+N+9FbdftGM1PYZFJsAR9Mi43z57fPu9G64Wsd3lbAyXWbHsrUWwDERIouwHYjIA+Jk0U8YJS5m+lWSgnEAe3J31IsOT1HZtwNewW9kB6PLBoexa2cbiiUUKccmPece3hUkCUn3uuqQxmQw== 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=1IuWfozZqQ9az7nxY4D3dTARCn3eP/ZOoTxmoycnkX4=; b=BpbCSDosOiQZ9HoDNYEmfX73cMewsd2J8b6/63rh1QAhpPhdRVVEM9rU5b8z//sjR25Nf7XMyJGQB0ai+Xgc/1bvYrbt26/TSvV/50Zb8G1wCP20prd8GC9PpS5mvFLAlbSz1V3ekseWC3+pq/uBcMSRIclPBtl6Ky2cskGMxcw= Received: from DM6PR07CA0064.namprd07.prod.outlook.com (2603:10b6:5:74::41) by IA1PR12MB6211.namprd12.prod.outlook.com (2603:10b6:208:3e5::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.33; Tue, 18 Oct 2022 19:46:25 +0000 Received: from DM6NAM11FT052.eop-nam11.prod.protection.outlook.com (2603:10b6:5:74:cafe::2) by DM6PR07CA0064.outlook.office365.com (2603:10b6:5:74::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32 via Frontend Transport; Tue, 18 Oct 2022 19:46:25 +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 DM6NAM11FT052.mail.protection.outlook.com (10.13.172.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5746.16 via Frontend Transport; Tue, 18 Oct 2022 19:46:25 +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.31; Tue, 18 Oct 2022 14:46:22 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 23/36] net/ionic: do bulk allocations of receive mbufs Date: Tue, 18 Oct 2022 12:41:18 -0700 Message-ID: <20221018194131.23006-24-andrew.boyer@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011005032.47584-1-andrew.boyer@amd.com> References: <20221011005032.47584-1-andrew.boyer@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT052:EE_|IA1PR12MB6211:EE_ X-MS-Office365-Filtering-Correlation-Id: ef97f97e-8530-49d4-3647-08dab1417105 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AW4RZzdsVVrPjMugDv1Q5/Z/v9xv56p4kiW0hGgx40/MG0xwLVUuB+8P3HbYdLAZPb4UBlWJqwqvv9dZM5+DziDc5qAlqN1UCUkqTVaYxHvbCrvdknc/zh/zLFlPhonfoIosglpCNbQgmAcqHPZAtqKNxqzxQfH15F+BNrr3faf4HgZEsvouh5Iy8BtmtEjEyhV5REBkmmBkkj0cmRz7EOO3WFrDyr0XGUunp33IZlmfITDFRwZjE8sKBy843K6kCumoSnOzc/ssQCb+DPibZ2ufHUbfuLD2gQ8e9nqQTXCFh6tP0r/YuwcGY8MlKJWWAsSROb8+QvbeU17bShexN4iOrDVeTCo7swnOCj88txvQiAmZx36sRXHG56L+nS2PuOg2NJondMOqMso6+POu2EEHkHNJpPIGNbSD1G4JSbJNiLVM1SDOW8TR4QnRBT4WCoxxGGbxOeQuVWiDzEEWC1GH26dY3lPv0n8E3kBzpiR1W3SA83zqAI457+P9o4VANj5kHiISJL2S1FUuSwi2C6/diggP6v3/2JVHliLIbKzVAlSv0WSLDYFlGCef9TJkJV+Gp2HLGvC1tKjNThUyfqDlTynjwh6QZHImWNMxY6rj85cGodATFqxGENOe2HpudEWtyPyzX883U7+PQybFIjRjGz3rexisbl9HvhuWMXkbhG1hq9X/MwPtvU+2Ed+J6KYBDxVNF/u/uKwWshih2KDju38X9ScNkc/1K6UrQrkxpFg5AYLO5ODZSewIBkMzMwCqaThGc9b/iSo/hb6hwmO0AesKyOk7LJgeEJXZd8Y7rKLB7uXkqjn4wVFkPgUy 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)(396003)(376002)(136003)(346002)(39860400002)(451199015)(46966006)(40470700004)(36840700001)(26005)(6666004)(478600001)(70586007)(36756003)(4326008)(8676002)(316002)(82740400003)(70206006)(86362001)(6916009)(36860700001)(356005)(1076003)(81166007)(336012)(40480700001)(40460700003)(426003)(47076005)(83380400001)(2616005)(186003)(16526019)(82310400005)(44832011)(41300700001)(8936002)(5660300002)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:46:25.2879 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ef97f97e-8530-49d4-3647-08dab1417105 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: DM6NAM11FT052.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6211 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 547d4873be..f1cc0f60fc 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 64766f2652..cb5ae7671d 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