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 49354A0560; Tue, 18 Oct 2022 21:46:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F279A4284D; Tue, 18 Oct 2022 21:46:39 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2085.outbound.protection.outlook.com [40.107.243.85]) by mails.dpdk.org (Postfix) with ESMTP id D39FB427F1 for ; Tue, 18 Oct 2022 21:46:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z0CC2C7EA2haIHS/qKq5E3GF3LrhU0W8NAIiKcmNmL59hpiSoF+UUUg8IW+oDEDwuMZKX4exNT86eqOE/NPz2208INnCulZZSJCISTBkHUBBLuikSf9R1L4bLfBe4/5aVBygQAt8hrx31Zn3zcq5Qys9B3wicaJaipBCzzc7SK7p67cnpqTdTytVFfPF5HsMn++EvRQs9AQ8IaFhNMvg/nPqfFhPISvCbsel6YJTsaIttiu9cRoEQXRCK1SCXeRxt9XRTLlUfbQZREHh/jKisbVY4ovUkBT0A9f7MPzakjLUfk3FHbZJNlb4dBlLl3KZfIvCEvnSR++VfnTGFkWs3A== 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=QICqXW6v+vmzZRDeqKLjokB693WaUNmtStf9IxoJE6I=; b=Hk/yuRRqcwwZjeAhAhKM1Ymg9SZY7uEqyU4vfon+l/MneMm6lSwECi5Y+FKCZD0nOVO479XYTXrEDcncKuYQirBcU2tOuqp0/6tItbNbQhhfpoXQzmvD6Wq26/vJ/0oJsEgJSHgvIbhtONxi4ZPPa8uKQISM2E5+GEF7BODMruR2Khk8q0CqKAbhtg9NFtRFNSgkAAabeNW8F4zPVWAPNqcGUnOgDMZS37OUlO2pRvHZ0V0mYlMJqxZnlA0k7jyxWGQpGiee+lf2Fftn52Znyvl/NdVHz40luhmbX0uZvmKgLfZuK6nC+E9wetR5DD5NNrdNNVtmKmiPv4YpeRVWvQ== 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=QICqXW6v+vmzZRDeqKLjokB693WaUNmtStf9IxoJE6I=; b=yX7rNO3bcY9gep/PCJbSaYLGRhZEIU0kNt/al4fh4ntoHBcmadwCQAJxLD81B+sMk7MjZkdpgyVfwz4PAabSB0ceRxxgmUia2fHT2tsSuUp2FqY39waqT047L3YGRrnC8Hs3A5Hyoxna9SiUbIw0vYsgCI62CfQjfLo2uc8cfvo= Received: from DS7PR05CA0079.namprd05.prod.outlook.com (2603:10b6:8:57::9) by DM4PR12MB5747.namprd12.prod.outlook.com (2603:10b6:8:5e::16) 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:33 +0000 Received: from DM6NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:8:57:cafe::f6) by DS7PR05CA0079.outlook.office365.com (2603:10b6:8:57::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.6 via Frontend Transport; Tue, 18 Oct 2022 19:46:33 +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 DM6NAM11FT022.mail.protection.outlook.com (10.13.172.210) 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:33 +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:32 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 25/36] net/ionic: add a lookup table for checksum flags Date: Tue, 18 Oct 2022 12:41:20 -0700 Message-ID: <20221018194131.23006-26-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: DM6NAM11FT022:EE_|DM4PR12MB5747:EE_ X-MS-Office365-Filtering-Correlation-Id: e10a14df-597b-40ce-51f6-08dab1417621 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V9qrMLwi1NPVlstPc39SBVLKwIUxiZPVti6xejSBfnS7XRnY9YxrhFr1wnDjqK5H/xIJDxJ9OKn/V2SUqcy4opk6qU1nCJBhnPCRZM2wtJ0HJ452OSKAN7eou4H9jKeyz8sUL73U9Z9ElaDew0WetVVUURS9kOHJj5yZHBPOYsCg2mY+eyFJNihHqmpA0fu9H3Mi4o4p8n7AVDeID2rqTDr+FPHjYYyXpq8FxiMguUm7f0I8hEldJiwvqLdYTN7tD6I+9gpHIeAxboOAwtjgH2VRLo/BHZCyZeBGylGtHPWC0KcZfd9t6gpZba1UiNusqhMRjt3uez/nFN7hsGhDcA/K1JHaM7k+QokITH2NgxRJxbj137Z7bUpuCTMwj0QSiMjBwzhybvMuXMBbVrYHXqCfTcW03R8iJ3TYmELEvc6xR6a/TBzcsNi8XtSwAZUC6lx7Zx4HK1e3Y7815qBysucLZeSiZs1dO5rsxEHkNdfvDsq4a6OMWr+s5hxNUQrvMhxBh8J1pvjsrnYCvH4hvLkpxbbC/SMLS6yPetRo6NkMx91DLMk6pQg5/iEpH4sxGhWmgEXjmfqtOTjPyfOS+dg8m1UrCvY2pvknaY8T8itqRfOOY+JijntE7oYEfCQ85FIK9hk8qjVuVAmdryHyxdPDOocJu6ZIbJ3AoJWvcs7O3m2NU+DJW3hKd9Hwce2aySRsOUdJN+fXeL9PQ3lQvTjX3aJWaI8Hy5LMlpAGMi8bSOb5AcstN7KCjiD2m5S22zR7P0g5eNIvq3RAso2RWHAYEhLxflwTLdGJiBBfuaic/d613ztxoGyM952BSQsv 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)(346002)(136003)(376002)(451199015)(46966006)(40470700004)(36840700001)(6916009)(81166007)(356005)(83380400001)(47076005)(82740400003)(86362001)(316002)(41300700001)(8936002)(26005)(2906002)(6666004)(16526019)(186003)(426003)(336012)(40480700001)(478600001)(44832011)(40460700003)(2616005)(36756003)(1076003)(5660300002)(82310400005)(70586007)(70206006)(8676002)(4326008)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:46:33.8451 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e10a14df-597b-40ce-51f6-08dab1417621 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: DM6NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5747 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 8a544c03d3..697e6dcc15 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