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 F158CA0544; Tue, 11 Oct 2022 02:53:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7EADE42BE6; Tue, 11 Oct 2022 02:52:09 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2074.outbound.protection.outlook.com [40.107.220.74]) by mails.dpdk.org (Postfix) with ESMTP id 3E5A942C03 for ; Tue, 11 Oct 2022 02:52:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m7xah0MvihXRsUPxOh5VWvahag9cHdJMJfW2bQbVL2capGnvOmyNBnabrpQ7IE2tsMT+mNk9ZadgPR9a3q7c6Pauqpa/z5OhwXSbpy0nIxdMSIN9ADXwKrVigQ82n3c98cLnqDPiAx+QWgp3SgyPBSvrw/rCh2AhoaxAMtk53ICEnGA4FH3K2+I8/2JPX/gwbcxe6qC1eM7F6OFE9FSLpaq4zHG2rERGSwxRkS7kTOE5COYKEAnfx86F/VHg/a992FRe5QLS1kGTUi7bsdEBE6feGmphUO0og0Aq1BL3U5mQ2B/+2NiRvQ7TtKELb0DtV6Of9D5rnUvrRqPAZSiTIw== 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=0zbJ8OETcZL2YXjMs2URjDHyEnQijTUyw/o964mXprU=; b=hm3vmFOK5W70UD43wEwkIDh2afOhzZcUrFaaZS8AAuWSbuJKxuFp0Zz9spudMpmFoWAYPKm4uQfiYqPXey7Ue9ude+yvLPRHNFhKyaqelQdIv+BvUuiFZ9fbZ7in3Ze3EQ0CA3xJdmIvcSoPK1ZM08rXooKFjcx8Fl/CN6q51EeIC3W5fd08iT4yShB5xxrfbW+NN/96V2mI3jNd/Ps3OttOcYZ21UO/ICja/Jz+AIHd7yjEphGByblpqlzSr26KOM0ImoLmaSpLHVpuOmOw8ze2yueiv1TCXkJj4S9SipNqB7N8upJWFs4EtQsE3T7EAh2gBMFxszH08NkdxBIegQ== 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=0zbJ8OETcZL2YXjMs2URjDHyEnQijTUyw/o964mXprU=; b=Sc5mXeAB1SAVx64h5WsIIx1T0QvmDyLpfYwI9dClNcvksooHA/HmqKnAbceKwZqZp682NCAD6QockRPtJRQv18UUDDuACShJ9rFn4zF6XOkk9I11AMDknQ0LXCzC3dr9KYXZ+5sprJmGcnu09K/G/4VmrbIZCdyoNcbEkFXxBGs= Received: from BN9PR03CA0332.namprd03.prod.outlook.com (2603:10b6:408:f6::7) by CY8PR12MB7193.namprd12.prod.outlook.com (2603:10b6:930:5b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Tue, 11 Oct 2022 00:52:04 +0000 Received: from BN8NAM11FT078.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f6:cafe::2) by BN9PR03CA0332.outlook.office365.com (2603:10b6:408:f6::7) 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:04 +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 BN8NAM11FT078.mail.protection.outlook.com (10.13.176.251) 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:04 +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:03 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v1 18/35] net/ionic: do one-time init of receive descriptors Date: Mon, 10 Oct 2022 17:50:15 -0700 Message-ID: <20221011005032.47584-19-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: BN8NAM11FT078:EE_|CY8PR12MB7193:EE_ X-MS-Office365-Filtering-Correlation-Id: 68a84823-7916-402e-e5a6-08daab22d082 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aloHsGDm17TSa/iCoRBwrHKvodFz0XQ2Pig6b0ChD8jXLOgCP0yaunQ+vhaXNsuRTc0edOTKckahsfgOAu4dPyBXaeBSAIVLj3iq7JFmyHJkXj5TIkGnJqiYKeJ2vmmcknuDCJJcQ2yMDrukgWtZRS25/picVDIH9HmvYraFLxE1hBTGQEHex1ABfIzMJLpwzpC8dAwkgvkHaY6CH6U4gGM1YEQGbvxAafAYjUFw2/Bny/HEe/V38ut4gU06WRhv9M5hdhRRbAbCqkxWRtoV3RI+25ZbzWE0RfSBu6WwxT7kszM2CXw51OL1D9x9RMxlxrIvOvuRTd5e7UiIzoeBlSmcCwVDJWZLdlJsts0AlyxYuRW1hehu0pL3n/Lf6HpEX6cc0LtDAtXkCR4Laj3JbYeWbD/rr8N5V1rtLjWf+XzRHtPATALFaG7UiY9dCq32AjHgABT9eZm0q4zCA30k6vuLK8YtSTKHT75FW2/+5wq05o8B/lDm2it7uzGz3pSGDo4I7LDT0Ezw3TlGhFT0lgQwJm4Kd87/Jcwpt1wWn6QTFGmMUQEPMkdca9yZIYBBO0FXmevN+9IG+QyVwS2j3qPM7N1Dz55tZXye52kO9aUx9DRoSIXIv4sFvAmVr85qA8VTVKpt8441yoaR5puuLLFCykkI9h+GnGezOlkoxZuKknaT/4qaRUxfzAyYBsPfyrJrKxU81FlpXoDuSKnTjB4BQ5QbFRdJ15kO5UCnk3sazJr239dePA6wLPM9oYlhvk8t8kB5oMn0Gt2QvxCk52q0hAg46onIYqL6GjwgAaA= 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)(376002)(136003)(346002)(451199015)(40470700004)(46966006)(36840700001)(5660300002)(82310400005)(6666004)(356005)(81166007)(36860700001)(40460700003)(478600001)(2906002)(40480700001)(6916009)(316002)(41300700001)(86362001)(44832011)(2616005)(36756003)(4326008)(83380400001)(336012)(82740400003)(70206006)(16526019)(8936002)(186003)(47076005)(70586007)(26005)(8676002)(1076003)(426003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 00:52:04.1354 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68a84823-7916-402e-e5a6-08daab22d082 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: BN8NAM11FT078.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7193 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 These fields don't need to be set in the hot path. This improves performance. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_rxtx.c | 38 ++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 0c1cc842cf..2a34465e46 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -941,9 +941,6 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq) desc = &desc_base[q->head_idx]; dma_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(rxm)); desc->addr = dma_addr; - desc->len = rxq->hdr_seg_size; - desc->opcode = (q->num_segs > 1) ? IONIC_RXQ_DESC_OPCODE_SG : - IONIC_RXQ_DESC_OPCODE_SIMPLE; rxm->next = NULL; prev_rxm_seg = rxm; @@ -963,7 +960,6 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq) data_iova = rte_mbuf_data_iova(rxm_seg); dma_addr = rte_cpu_to_le_64(data_iova); elem->addr = dma_addr; - elem->len = rxq->seg_size; elem++; rxm_seg->next = NULL; @@ -981,6 +977,38 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq) return 0; } +/* + * Perform one-time initialization of descriptor fields + * which will not change for the life of the queue. + */ +static void __rte_cold +ionic_rx_init_descriptors(struct ionic_rx_qcq *rxq) +{ + struct ionic_queue *q = &rxq->qcq.q; + struct ionic_rxq_desc *desc, *desc_base = q->base; + struct ionic_rxq_sg_desc *sg_desc, *sg_desc_base = q->sg_base; + uint32_t i, j; + uint8_t opcode; + + opcode = (q->num_segs > 1) ? + IONIC_RXQ_DESC_OPCODE_SG : IONIC_RXQ_DESC_OPCODE_SIMPLE; + + /* + * NB: Only the first segment needs to leave headroom (hdr_seg_size). + * Later segments (seg_size) do not. + */ + for (i = 0; i < q->num_descs; i++) { + desc = &desc_base[i]; + desc->len = rte_cpu_to_le_16(rxq->hdr_seg_size); + desc->opcode = opcode; + + sg_desc = &sg_desc_base[i]; + for (j = 0; j < q->num_segs - 1u; j++) + sg_desc->elems[j].len = + rte_cpu_to_le_16(rxq->seg_size); + } +} + /* * Start Receive Units for specified queue. */ @@ -1010,6 +1038,8 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs, size %u segs %u", rx_queue_id, q->num_descs, rxq->frame_size, q->num_segs); + ionic_rx_init_descriptors(rxq); + err = ionic_lif_rxq_init(rxq); if (err) return err; -- 2.17.1