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 34E9BA0544; Tue, 11 Oct 2022 02:53:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A6A8A42C1A; Tue, 11 Oct 2022 02:52:19 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2086.outbound.protection.outlook.com [40.107.102.86]) by mails.dpdk.org (Postfix) with ESMTP id A37F542C0A for ; Tue, 11 Oct 2022 02:52:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kkie2HeZ7uD2xTG7WoGCe5C0VDHquMpMLEVBEMUaRr8shze964awRATTV9mNkOVN3GuyP+C1KYhPqv9ctrfDgyWS1SB/iEbSrzzGsTzD1TPW+gIkA/KL3vH4aatbSK8pPx4GdS3XFFop2PFioBnGLfO+5NVOsH0Ni9v8hVD5kSIKb6ODEfC9CtfdK5Hfw2OA4qVAXrgLlEwIbf/8OUBJtiRsHsvvw4288zIisnhaoVrrC/OJjz6IB0WGoyFLgbHeMK9/kfpYQeQbibfRVkToRcs75ADHetH7tDpXiI/E85agExQ5R20ZBTNR2Af8qMB1MNH1NdI4KYrT3U0Y5j1Mgg== 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=gTK7Sor/BMl2wxnOP9118Iy8VLGPVx81QazNn7+qVBc=; b=ij3MKbgRlFm4QtHqckM5T7u9/9SkkiTslR2iICyi7rDoBIsfh4e0dnHSYPrGnQPSXJSAZqvhOJ6iEfZzhI5tqfRqW1oB4WBuq/CNbV+mYofOd6k370RkuYe1sDz2sPIKW+cW9kQqrSyTBXv55X2BC9fM100AoNbEoPITHQXxrQOxB2BwISezBdpBFZgaAcxPP9kqSxZXTqM0A6We/OcKmFTAfWL5CNATqxUvwsZFLjXOAQS4iDwZCw94nQAOAHKVFblcUGq8SQyAF+yH0H0TbrleUoPosQsNhwW4UDRl5CMgU1WoXv3d8rWKdN2Nx5j5BOGXRS6ylErlFXNPYOE4NA== 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=gTK7Sor/BMl2wxnOP9118Iy8VLGPVx81QazNn7+qVBc=; b=3OyU9a9xNW3NLnP4DwDBKVU+wVocUmSQjjIJBF8hvAgjqI0j3Cv6sudWfPmxE+XxueKUq/9dORo/DbchRqik+A+w7c3ReKvn1/qwTh2gZajp/xfomhIhLhMFvWtHrvnuLJfJjG52KLH0p4Hh9RuPAUlyI9lyngZ0ATnzbT5bhJo= Received: from BN1PR12CA0010.namprd12.prod.outlook.com (2603:10b6:408:e1::15) by SA1PR12MB7271.namprd12.prod.outlook.com (2603:10b6:806:2b8::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:12 +0000 Received: from BN8NAM11FT069.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e1:cafe::c) by BN1PR12CA0010.outlook.office365.com (2603:10b6:408:e1::15) 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:11 +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 BN8NAM11FT069.mail.protection.outlook.com (10.13.176.152) 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:11 +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:11 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v1 24/35] net/ionic: add a lookup table for checksum flags Date: Mon, 10 Oct 2022 17:50:21 -0700 Message-ID: <20221011005032.47584-25-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: BN8NAM11FT069:EE_|SA1PR12MB7271:EE_ X-MS-Office365-Filtering-Correlation-Id: 297775ed-566e-41dd-5ae7-08daab22d503 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zpgEXqGq6nl2QiLgO8DNpKIXeSudQN0CReK5btVS3TbnQK4skqX7mFPqXt2JDVclXELYaq5+/L6vkLHupMu0eX/b3xxYQKmLnPCGpsadxh67noA0kSdinF6QHYpeGzO8wQ0BOwKqqvwaoib4ihLnlWS/lTEi8rWNrQLvKDuLAtTpuP6Zl61/6K+vcDFX1jWUsA+///z4F+R7wOCjI9kuo/iZG6xX29bk7jOiI4MsvSub6Ncw7C6eWLbPJxr62rl/aBkM7J6jgMJ7yJi96hzGDx8WxdabRjTTxU/PQdc83+toknPTXYDr77cHKGAWX6RJAhxqBINwxYJ6KWIHpVOVXXsir6nLvfDxyfyrCfAk01pUa/T2zuZwAE4xLgsei67PFNx9/4Pmvq2NhXTC2J/4+irNrt82WdG84FONhZdsPqDanmmZXFJSL8cAdZgrDpClXTfpkef6eI3UnWvuFxFyHJnnOFZP+swR9/NhAwILsgmSPOTiuNw0US+SeUyIaG2dRTMWPMysWrOb3ZCXmSX1RiSqwQCY51FZYx3edVUG2kWHquUoDbNOVMhbr/20jEumtveEcFnbYrB12Bamd4UYFzaiH2VMINDzGV+mSw0teggKSTHoV3YFCdIhlF3MZbJis2fG/3reNZ3XW7GL02OdJLsQ2LKc4rb2D/247KTg37sARV4E6e+7IHxgCrXZ4kFapBnlAHdzHGHtm6rUi6iU2Z+x29wVYhdhBD/GD7S0TFtejYGAujXtRPNeTYpnkvP5Zm2+xQidCqDCjkZ3PT6Yncipu88IKH9GCaTQVIROhWrGN6ocNjLMdemBeQFz1s4c 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)(376002)(396003)(346002)(136003)(39860400002)(451199015)(46966006)(36840700001)(40470700004)(40480700001)(336012)(82740400003)(2616005)(86362001)(316002)(186003)(5660300002)(1076003)(16526019)(2906002)(26005)(426003)(8936002)(70206006)(70586007)(47076005)(6916009)(40460700003)(4326008)(8676002)(83380400001)(82310400005)(6666004)(44832011)(81166007)(36756003)(356005)(478600001)(41300700001)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 00:52:11.6882 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 297775ed-566e-41dd-5ae7-08daab22d503 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: BN8NAM11FT069.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7271 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 This improves performance by reducing branching. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_rxtx.c | 47 ++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index bb09c4eb1f..134589b016 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -804,6 +804,36 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, return 0; } +#define IONIC_CSUM_FLAG_MASK (IONIC_RXQ_COMP_CSUM_F_VLAN - 1) +static const uint64_t ionic_csum_flags[IONIC_CSUM_FLAG_MASK] + __rte_cache_aligned = { + /* IP_BAD set */ + [IONIC_RXQ_COMP_CSUM_F_IP_BAD] = RTE_MBUF_F_RX_IP_CKSUM_BAD, + [IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_TCP_OK] = + RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_GOOD, + [IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_TCP_BAD] = + RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_BAD, + [IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_UDP_OK] = + RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_GOOD, + [IONIC_RXQ_COMP_CSUM_F_IP_BAD | IONIC_RXQ_COMP_CSUM_F_UDP_BAD] = + RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_BAD, + /* IP_OK set */ + [IONIC_RXQ_COMP_CSUM_F_IP_OK] = RTE_MBUF_F_RX_IP_CKSUM_GOOD, + [IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_TCP_OK] = + RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_GOOD, + [IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_TCP_BAD] = + RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_BAD, + [IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_UDP_OK] = + RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_GOOD, + [IONIC_RXQ_COMP_CSUM_F_IP_OK | IONIC_RXQ_COMP_CSUM_F_UDP_BAD] = + RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_BAD, + /* No IP flag set */ + [IONIC_RXQ_COMP_CSUM_F_TCP_OK] = RTE_MBUF_F_RX_L4_CKSUM_GOOD, + [IONIC_RXQ_COMP_CSUM_F_TCP_BAD] = RTE_MBUF_F_RX_L4_CKSUM_BAD, + [IONIC_RXQ_COMP_CSUM_F_UDP_OK] = RTE_MBUF_F_RX_L4_CKSUM_GOOD, + [IONIC_RXQ_COMP_CSUM_F_UDP_BAD] = RTE_MBUF_F_RX_L4_CKSUM_BAD, +}; + /* RTE_PTYPE_UNKNOWN is 0x0 */ static const uint32_t ionic_ptype_table[IONIC_RXQ_COMP_PKT_TYPE_MASK] __rte_cache_aligned = { @@ -836,7 +866,7 @@ ionic_rx_clean_one(struct ionic_rx_qcq *rxq, uint32_t pkt_type; uint32_t left, i; uint16_t cq_desc_len; - uint8_t ptype; + uint8_t ptype, cflags; void **info; cq_desc_len = rte_le_to_cpu_16(cq_desc->len); @@ -894,19 +924,8 @@ ionic_rx_clean_one(struct ionic_rx_qcq *rxq, /* Checksum */ if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_CALC) { - if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_IP_OK) - pkt_flags |= RTE_MBUF_F_RX_IP_CKSUM_GOOD; - else if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_IP_BAD) - pkt_flags |= RTE_MBUF_F_RX_IP_CKSUM_BAD; - - if ((cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_TCP_OK) || - (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_UDP_OK)) - pkt_flags |= RTE_MBUF_F_RX_L4_CKSUM_GOOD; - else if ((cq_desc->csum_flags & - IONIC_RXQ_COMP_CSUM_F_TCP_BAD) || - (cq_desc->csum_flags & - IONIC_RXQ_COMP_CSUM_F_UDP_BAD)) - pkt_flags |= RTE_MBUF_F_RX_L4_CKSUM_BAD; + cflags = cq_desc->csum_flags & IONIC_CSUM_FLAG_MASK; + pkt_flags |= ionic_csum_flags[cflags]; } rxm->ol_flags = pkt_flags; -- 2.17.1