From patchwork Tue Oct 18 19:40:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118467 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6D3B8A0560; Tue, 18 Oct 2022 21:41:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4C0B2410F2; Tue, 18 Oct 2022 21:41:56 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2068.outbound.protection.outlook.com [40.107.94.68]) by mails.dpdk.org (Postfix) with ESMTP id 861CB410EE; Tue, 18 Oct 2022 21:41:54 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rz0JWocgqLX5wBjVGhMRjlUuiCfEL+xVo7WIPZnHHPcebgJT5r/I5urLzoSBGFTUZvVsfSYqT3ycZIMzSMRAWMDXm1ha0hPMWYPaGDV+KCWWDhc1YJbMHL1CqLMO6vsmN1yXQROTzVSWh/TyMMwndz0Vorem3AwRgq79YGcKs1j9zfrf3jGJN75QyJtpUxU9nydFi0xOEHuBbl3TgQg+wloB0e3me5awDtiWKrZLERdfWZKN6VyIvaYIb7i+QbLS6GgCh/5hnwx1WO1qHewZilroelVL+y3N4aduckyJCKgIWh6V25X+AjLzJfmZt2yQx+jxUUYvDVN7YgikUYJTLA== 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=l6qPoordwLRytVvYf+Iggpb+OHA3MOzk2RfVK5FpKVk=; b=inGKrmqXWhG2Z3Lk58FuMt4Wf+fUV2/bJ695xgir7dNxcF1VerArJ0H4yuKD+X8hhgWB4AquynZ4zPP6QZU4jON9zp7f18dgz06H48yCfhMV9NCANZjqTnPvjY2ad3m/p2y2O+XJCZHQkaXWH5tSF5rg3GnPt9xbf1crQBQd++3XhM6nUUObJCB0NFwj/M8jKoFxwiYkDxyAaKKWStVEtotwqZgGF5fwZLaoH/uf4UNqHhl9YahsPuakOcWNX/P2jDlVWf8Ml1uqdhRUzI1/jWkly09PQDktXy5whrAQF1BLgbxIPuw6HQ3GaqsmXYKCVJZQKaedB76RGvlJFB2hMw== 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=l6qPoordwLRytVvYf+Iggpb+OHA3MOzk2RfVK5FpKVk=; b=JP84KwCSDm96TUfOsPzx7Z2lJe41KKpRRzqn3kBE5+VINJnaFdnxoYXMa/FCWuBNsILE5gcwuyP28D6Cj49RRsUlV12eJz8mSIGK7vCTfaMdEqJEfPc4NoL2mC0lS0UpNtS0BnVU5pQUztz4xlITveVhnEvDXLNmPMQKQjy7o+8= Received: from BN9PR03CA0156.namprd03.prod.outlook.com (2603:10b6:408:f4::11) by SJ1PR12MB6052.namprd12.prod.outlook.com (2603:10b6:a03:489::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Tue, 18 Oct 2022 19:41:52 +0000 Received: from BN8NAM11FT058.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f4:cafe::9f) by BN9PR03CA0156.outlook.office365.com (2603:10b6:408:f4::11) 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:41:51 +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 BN8NAM11FT058.mail.protection.outlook.com (10.13.177.58) 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:41:51 +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:41:50 -0500 From: Andrew Boyer To: CC: Andrew Boyer , , Subject: [PATCH v2 01/36] net/ionic: fix up endianness for Rx and Tx handling Date: Tue, 18 Oct 2022 12:40:56 -0700 Message-ID: <20221018194131.23006-2-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 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: BN8NAM11FT058:EE_|SJ1PR12MB6052:EE_ X-MS-Office365-Filtering-Correlation-Id: 8530ac7b-1107-4e58-15a4-08dab140cdff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DH/dT+comu6rblD3T5NXWwogJbhbr8W1KLuoGBJVVkjARUlEVHomO2ReKoBejnFy/T2G4PGV18cdEyHz/dDmFDQN+/8WyRi2G9sWvQDItQc7xxMwqBbt0ADGzii+7bAOmPgeksVMyZCoP09kK8uQdB8vROZgpgTf8zqGIbaKxMA6wc8tJgUl6lSTQwH06IO7lU0TLIsU1GAQgc0kke1MXXLxPrJ7hhTSrlb07lagFu34Xu3YqFqW6ez6yz7xRJkm/ACRArlHFpun+vhoZ6VCP20QRcFEHrkLUUBQHm/CTpKMzm1HwHq17sW8zvei6HL7T6+bTwReAYH47yMnii5enoFuk2haFvzDvU7h8Q8leOhqiANJJo+ZoP/Kth4EIDSEkogWG9Bu9dxrxZ7RYWYxn7ZEOLVoJx7dFqj1gOR47INoml2myWN1Td6hlUVuYBx9PLd0uIpiRHJr40AwxDL11OBMbdtdsCCqZPL4dzYtAhbGxO1QCcbafsrYWlqj2zb0JBHlRxdMlSfAWn/QeJ14GCwbtOcGENydAobSo5C6znyLr+nVmrkW4ybmTO0/ZFN+TiKbUgkWbcc2BcAeCX8Jf8e+YtIwi93WONQq03QyhaHSbSl+yyLLbDbokLdBpw7lzJWYfveJDiQDF6wYOimo6QmcF6LNOru8N853myHvQi6UmZGObAuE2QG0BwPgMHriVHf0G54dqOit8iafYP8BOTxmiiGz2UIZpBb/sTDzBlSbxDDIufomZDHOuOZLYeXWqok5uaALg+VnA1USj/GmTBZihbAawyxpsiQjTypR4zo= 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)(376002)(396003)(39860400002)(346002)(451199015)(46966006)(40470700004)(36840700001)(47076005)(356005)(478600001)(81166007)(426003)(54906003)(82740400003)(6916009)(83380400001)(82310400005)(2616005)(26005)(36860700001)(8936002)(316002)(40460700003)(2906002)(41300700001)(186003)(86362001)(1076003)(16526019)(40480700001)(44832011)(36756003)(5660300002)(8676002)(336012)(4326008)(70586007)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:41:51.7947 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8530ac7b-1107-4e58-15a4-08dab140cdff 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: BN8NAM11FT058.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6052 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 all need to be LE when talking to the FW. Fixes: a27d901331da ("net/ionic: add Rx and Tx handling") Cc: cardigliano@ntop.org Cc: stable@dpdk.org Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_rxtx.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 9f602de6a9..af2d89f9fa 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -300,18 +300,20 @@ ionic_tx_tso_post(struct ionic_queue *q, struct ionic_txq_desc *desc, bool start, bool done) { void **info; + uint64_t cmd; uint8_t flags = 0; flags |= has_vlan ? IONIC_TXQ_DESC_FLAG_VLAN : 0; flags |= encap ? IONIC_TXQ_DESC_FLAG_ENCAP : 0; flags |= start ? IONIC_TXQ_DESC_FLAG_TSO_SOT : 0; flags |= done ? IONIC_TXQ_DESC_FLAG_TSO_EOT : 0; - desc->cmd = encode_txq_desc_cmd(IONIC_TXQ_DESC_OPCODE_TSO, + cmd = encode_txq_desc_cmd(IONIC_TXQ_DESC_OPCODE_TSO, flags, nsge, addr); - desc->len = len; - desc->vlan_tci = vlan_tci; - desc->hdr_len = hdrlen; - desc->mss = mss; + desc->cmd = rte_cpu_to_le_64(cmd); + desc->len = rte_cpu_to_le_16(len); + desc->vlan_tci = rte_cpu_to_le_16(vlan_tci); + desc->hdr_len = rte_cpu_to_le_16(hdrlen); + desc->mss = rte_cpu_to_le_16(mss); if (done) { info = IONIC_INFO_PTR(q, q->head_idx); @@ -423,7 +425,7 @@ ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) len = RTE_MIN(frag_left, left); frag_left -= len; elem->addr = next_addr; - elem->len = len; + elem->len = rte_cpu_to_le_16(len); elem++; desc_nsge++; } else { @@ -470,7 +472,7 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) bool encap; bool has_vlan; uint64_t ol_flags = txm->ol_flags; - uint64_t addr; + uint64_t addr, cmd; uint8_t opcode = IONIC_TXQ_DESC_OPCODE_CSUM_NONE; uint8_t flags = 0; @@ -505,9 +507,10 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm)); - desc->cmd = encode_txq_desc_cmd(opcode, flags, txm->nb_segs - 1, addr); - desc->len = txm->data_len; - desc->vlan_tci = txm->vlan_tci; + cmd = encode_txq_desc_cmd(opcode, flags, txm->nb_segs - 1, addr); + desc->cmd = rte_cpu_to_le_64(cmd); + desc->len = rte_cpu_to_le_16(txm->data_len); + desc->vlan_tci = rte_cpu_to_le_16(txm->vlan_tci); info[0] = txm; @@ -515,7 +518,7 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) txm_seg = txm->next; while (txm_seg != NULL) { - elem->len = txm_seg->data_len; + elem->len = rte_cpu_to_le_16(txm_seg->data_len); elem->addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm_seg)); elem++; txm_seg = txm_seg->next; @@ -845,7 +848,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq, /* Vlan Strip */ if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_VLAN) { pkt_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED; - rxm->vlan_tci = cq_desc->vlan_tci; + rxm->vlan_tci = rte_le_to_cpu_16(cq_desc->vlan_tci); } /* Checksum */ From patchwork Tue Oct 18 19:40:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118468 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 736BDA0560; Tue, 18 Oct 2022 21:42:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 74D2341147; Tue, 18 Oct 2022 21:42:00 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2040.outbound.protection.outlook.com [40.107.244.40]) by mails.dpdk.org (Postfix) with ESMTP id 1179F41145; Tue, 18 Oct 2022 21:41:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S9Tnrk7PdJlTqHBGL7sKBmVpHefaPR6JZdyzMQFgWzClaY01KD7ntp2b+eNY/1or1W3Z/Dbdf32cQAByVRlA/BCHkSG9iP7LK2AMP+XwYlFZNCbO+2cKVCx6z0C1YUAzcEpu7uSAqbEqR+UfrS9gGluIbVC7Z8GcLOUn3BDN7zXK8AD7Jna3Qh5aSEpdr70TnP/E8mpVpzcoqzfzTZfzcxIDh0qsY2+MtVwg4hDF6UDRFBJJ40cRpkxqelGt+MmqGpGAQUSZbCuudJWWcImsXcKFNKRIVpxVy9j6h2mgYT78M6afTJMDMleDtKUsz7l/8Po0Y3ts3L3vHZ2NaY07jw== 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=wv+SJFHZtoF0cbL6kOsGC6q4yIamc00xvELMlpsSuVw=; b=OJqbcpH3NqayCtBeCgcGhTcGVHps/cqzTvavFr491JPyQC/w/trqGP+lDVht70vB9nHJcCQHizx8A1cJ3U27XY6hI1eGHXCHq9zMWbBe+W/+M0ByhGlFpzJg1WSHUSj6ghQO39weLPc2eRnyoIAQamkyCSZGySFSNfbH8aygtqEgh9PgX8bbZJxHYibWIagUeMMtpc3wWkjrv7uQcpWtJiZXGTX0glf2HusJfZr0IJG9pcSYQNN6nbUaql1GRj73gosizeqYQJYnhZA5NJZ7v9LGUqj6DhQVA2U3zvP6J7FJy/CiPA75YZBo39+xb66HrAgP3vZCo+vmDDsS8GgCyg== 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=wv+SJFHZtoF0cbL6kOsGC6q4yIamc00xvELMlpsSuVw=; b=iub/aZitoeyrZsqEGyf9QBbT4+5vTk0Q/+8EmO2UZqk9Mf+3WXTJo6H2uSfL1Jc3O9c9s1NNJmLxt1gbxwWerl5kuehfj/CBgu9vRzChVc4BEia25SnFuU0QByemwiFGsU61NqWBZejxU6+VLjLOs+dsQRlbwTReypXh8HoVolM= Received: from BN0PR04CA0129.namprd04.prod.outlook.com (2603:10b6:408:ed::14) by DM4PR12MB5986.namprd12.prod.outlook.com (2603:10b6:8:69::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:41:56 +0000 Received: from BN8NAM11FT037.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ed:cafe::ab) by BN0PR04CA0129.outlook.office365.com (2603:10b6:408:ed::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30 via Frontend Transport; Tue, 18 Oct 2022 19:41:55 +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 BN8NAM11FT037.mail.protection.outlook.com (10.13.177.182) 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:41:55 +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:41:54 -0500 From: Andrew Boyer To: CC: Andrew Boyer , , Subject: [PATCH v2 02/36] net/ionic: fix up endianness for RSS Date: Tue, 18 Oct 2022 12:40:57 -0700 Message-ID: <20221018194131.23006-3-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 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: BN8NAM11FT037:EE_|DM4PR12MB5986:EE_ X-MS-Office365-Filtering-Correlation-Id: 59b71ed2-efcf-4518-b2a7-08dab140d051 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ddrxyX4bhDvKVZUx7yUM8oCmB0Fq9YDjy6rX10ERTnmK7hglkl4cdk8WmzqN5ZQz9viiM219Rc+fo++N88Z+5Y0T/CXpSi+qegWqJBt2kESTgCkIAm/xMPqSXY83Tv7tQxUEhcgnTMpX9QF6MJnVlokNHoO72yhAzAKF5gwnaUGheQ3usNlfnTqu4qXdrUDzpnLaBcdzMNLeXNDP8fpBbow/ITgGLyhf3QiBW6FQQ4+tiXkAFgx1xRiWhCVDTFcmrR5SABhqQqhdikZM+CCd+7NQkH9uT8tr9JQ3fGeD3uD2EoiH84koVUgOOnVnHiOsSgDuRF4iJFBxv9xA6fF0BYQmWJTlro4GD6uh1Of4PGF49FKF0/EE5Wbl8wG6mKnypdu08/8dAs8uc2gEFoYzokFbVS76asY7fU6Sz60d7DkMUCxd3LEDjeW7yYGWxEreB8Qewy7Tdf1aHqNdZqkZ/I0ZUDhJly+NX/FWHhJc0IIPlFJUVEl+BKuLA5P6VU2JGZe0RVk4LwEJg5duvVNFa5GPDyCAb8BbL5f5TBm5bUUXnfuX/pRG3mA4rR1W0eoTaeoshhS5+clFXfIAMs+A3yL+PR7p/6LjXpY6n8I3g+bRUSwL7GZ7Xa8ztYJsLazR7DUfWiFFIvYNZzD2XNS1f7AroF+KYuVKNXNM1PlwhZbzRX1y7QTlV40sPZEtjemamAffNIM/r+fKxtZUc9g9Q8BuuBS73futUAte3RWcpY/IIa+CE5Aa09twvKTT5d0Ix8SviwheNFzN3u//Ty9JqphfbBo309ziiP+TGq6YJKA= 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)(39860400002)(346002)(136003)(396003)(451199015)(36840700001)(46966006)(40470700004)(316002)(54906003)(6916009)(70586007)(8676002)(70206006)(4326008)(478600001)(44832011)(5660300002)(356005)(81166007)(2616005)(186003)(41300700001)(16526019)(2906002)(1076003)(26005)(8936002)(36756003)(83380400001)(336012)(426003)(47076005)(82740400003)(36860700001)(4744005)(86362001)(82310400005)(40460700003)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:41:55.6916 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 59b71ed2-efcf-4518-b2a7-08dab140d051 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: BN8NAM11FT037.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5986 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 field needs to be LE when talking to the FW. Fixes: 22e7171bc63b ("net/ionic: support RSS") Cc: cardigliano@ntop.org Cc: stable@dpdk.org Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index af2d89f9fa..665d085823 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -843,7 +843,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq, /* RSS */ pkt_flags |= RTE_MBUF_F_RX_RSS_HASH; - rxm->hash.rss = cq_desc->rss_hash; + rxm->hash.rss = rte_le_to_cpu_32(cq_desc->rss_hash); /* Vlan Strip */ if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_VLAN) { From patchwork Tue Oct 18 19:40:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118469 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 164A6A0560; Tue, 18 Oct 2022 21:42:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 951EB41155; Tue, 18 Oct 2022 21:42:04 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2085.outbound.protection.outlook.com [40.107.237.85]) by mails.dpdk.org (Postfix) with ESMTP id 93C6141155; Tue, 18 Oct 2022 21:42:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fIDtrzdtOe9wDE70f35aHphUwx/o7lSgoxkSdEs5KOf2hSAYy2QUqsj5sugqkKXmqJHUzpVXooTglRptQWm6aG+35ThtQCS548Q53L0fdMej4oCLtpwzd1/I9vmbwKGkvaQAAZxxOTfjJwXK2F+wIP7+ChlnvbdnxN2JjfGN/n2Os9rTBGApBO2RzHIurgyyP26qrSH5uEGe8LfHPjCzOYGDrU++O0kSc6tWD5HmyaCwZtjF8EzmriH5dPoXMrMOKXDP4CK8R7vDbkLMIrA0blzn0NPhOd8DpG8UQhwU+cORYZ6n2GznAFvYauZWeR9jc75iXGbqSgiBZUrlK37YYw== 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=2CXwDgXKQExNPERJKMEc7MExWRkKVvmTzBk353Hx568=; b=MLfRXbnwnx4Y+ZDW3OT7MQqHvsvNoJ3AEce1w3fAMuMbzDxRay3jw0YElvu/Y5Vi7lFZAsxSVhihY2btQyHzU1Mf8Wv6DknYpwBDNrWHAJctS2L6Y8/+UK86BEsBKvyR0SMc9FtSvexvu644EPVtYrMF295KgBqer9gr3Z3OU1fupF9lzhz1U/qKhfBmpRy/FEEYC9oLiBo06xS9pJms++jXfjEK7cZlQLFINGLS4g31eRologaM+JweKBMtQYhGwlDOg1UXzVQPkC0w9Y+2puSSCS7/cWFn3PorlFnwDhfsIxPfw1qh+dfLij5Yu4CM9n0XRwEBjK6lfH+RZVau6A== 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=2CXwDgXKQExNPERJKMEc7MExWRkKVvmTzBk353Hx568=; b=tBVgZDwC4zMpzYn3MWPaOHzGd3Di10Bgd1lgAJjP1wigp3fGFmX0MPcBnkrN3LKY4gYiSyS3+WQwsyjynduWY1HcSiPg1VPkNIWkbNR+zACbilWr1AcY/0jmkau0Sw57ipKFSBY6l9wHp8Ao8QjA0eExZoScXdTMkwAIb3jDKrw= Received: from BN0PR08CA0008.namprd08.prod.outlook.com (2603:10b6:408:142::30) by CY5PR12MB6528.namprd12.prod.outlook.com (2603:10b6:930:43::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Tue, 18 Oct 2022 19:42:01 +0000 Received: from BN8NAM11FT104.eop-nam11.prod.protection.outlook.com (2603:10b6:408:142:cafe::48) by BN0PR08CA0008.outlook.office365.com (2603:10b6:408:142::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.31 via Frontend Transport; Tue, 18 Oct 2022 19:42:00 +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 BN8NAM11FT104.mail.protection.outlook.com (10.13.177.160) 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:42:00 +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:42:00 -0500 From: Andrew Boyer To: CC: Andrew Boyer , Subject: [PATCH v2 03/36] net/ionic: fix to set the adapter name for logging Date: Tue, 18 Oct 2022 12:40:58 -0700 Message-ID: <20221018194131.23006-4-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 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: BN8NAM11FT104:EE_|CY5PR12MB6528:EE_ X-MS-Office365-Filtering-Correlation-Id: 95c9ed67-e3fb-48ba-dc4f-08dab140d361 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UJqWTdkd1ZElZ41NXguP0S6HtUeJmpQwnvphwHbSyKCAksVefPjivLYlWPNZbfF2aIPI3JI4BZZfYfg2J93V0oxk/o1H5DBWvKTg8Hihe7DjNcx9Y4D1jdztNBAQWZWwcLaYagbtmtSUJZzIgMmsyprmv5y0e28MDhMYAGo+Jgogh3NUGPTJz9GRHaLEk/Cwko0Xwd/BWk/qyWYtLIlhyz2RklmJTt11MoY3J8jbDf4HkPPYWoII0UqegDGhn9cq1EJP+MQH0CBud/QPGF2iYKDpZDYCfMjvW8BHdVN7JINNg65tlW72iT+6jZe5dXgp2/rv84UH9hiNt85Lu3tijuphnSt8x4xzxKwbvKDVbZ3CD5+mZIOEA/hfxLFvsC06/OoDJWjeREYUGFU7+IP94SttpOat1dWYC8UmOWmGsDX/48MZWcDQ45NPFBTQ0iUewAt8M1gVEB5d/Ky0HBAKh8sAixtVW/7tpmdro8B+lNBMlZL802Fsnt0qjnXsNg8Aj4we1z6wQsSVW+eOQcf9hLDQKGI5udId1jNcXr1eLjvC6kaH1beS1FDDT/bFt+CKJR2qukWt3NqromO3YbELPBMKkOVa8GD5gY/i+ft630YwCrGfjfgcCv/S3haBPNwC3Dz8sCCI184/0W1XcRD2wu1k1QHPBGwlwcvpj4ERPhJrWP6SJsostNFLJ6jchGYs3WIV+Xz2ewwoq8K4ukiFT/PwLl1MiOJDaqKpA66Sxa/yYRoRomkcfuhmFKGMbPNotkni+SNbXz5KaomuKPsHP0CwZdWs9QUBykjdkwhMbZR4wjksKyJv0RmFkrngnoZD 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)(346002)(396003)(39860400002)(376002)(136003)(451199015)(46966006)(40470700004)(36840700001)(2906002)(36756003)(82310400005)(8936002)(5660300002)(86362001)(4326008)(186003)(4744005)(41300700001)(40460700003)(44832011)(16526019)(2616005)(1076003)(478600001)(336012)(26005)(8676002)(47076005)(40480700001)(70586007)(356005)(83380400001)(70206006)(81166007)(426003)(450100002)(82740400003)(6916009)(54906003)(316002)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:42:00.8307 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 95c9ed67-e3fb-48ba-dc4f-08dab140d361 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: BN8NAM11FT104.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6528 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 Otherwise the log messages will be garbled. Fixes: 4ae96cb88fa0 ("net/ionic: do minor logging fixups") Cc: stable@dpdk.org Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_dev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c index 43e9ca3de3..5439b99b2d 100644 --- a/drivers/net/ionic/ionic_dev.c +++ b/drivers/net/ionic/ionic_dev.c @@ -55,7 +55,10 @@ ionic_dev_setup(struct ionic_adapter *adapter) ioread8(&idev->dev_info->fw_version[i]); adapter->fw_version[IONIC_DEVINFO_FWVERS_BUFLEN - 1] = '\0'; - IONIC_PRINT(DEBUG, "Firmware version: %s", adapter->fw_version); + adapter->name = adapter->pci_dev->device.name; + + IONIC_PRINT(DEBUG, "%s firmware version: %s", + adapter->name, adapter->fw_version); /* BAR1: doorbells */ bar++; From patchwork Tue Oct 18 19:40:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118470 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4C2C7A0560; Tue, 18 Oct 2022 21:42:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3F29D40A8B; Tue, 18 Oct 2022 21:42:48 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2062.outbound.protection.outlook.com [40.107.244.62]) by mails.dpdk.org (Postfix) with ESMTP id EEBD340041; Tue, 18 Oct 2022 21:42:46 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cq2BA3DSoETCTn2LXYxwqEh2o1NHbQkFrLGPa75jnKxD6cGencP/b8UO1+3ZUJ52BASvzzDuG99qM8p6/FEiot6kLrIXM8L5j6y+/zy/6n1RmpbkB3oH2RVCbpXzPFHcqZ0Lpzl81cnvBwt5AB0wVRG6ezkP7EdTBTmuoThZgUWwit1vpOBbwjtVvI1RrM4uFjTOsLw/y0YGg9xz4ZSLEQgLCm1C3wNmOte9J0lj7byb6SuetR/YU69Yud3RxRj3gZGWZp6xrrTWn9We0cmm6FUD6GG/PSnz7YOoKGZ7Sw92a8FwpX4nXlGl75eTdPumAugdkN6F8qUO/SUqx0TSPg== 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=2D9kgK+HW6LulQg52lNcgajhCK4gktTz9uKrqFgyWmA=; b=GwRX1eEIlOPqH/DGuG6Ka/X78o9Xmz//qtLO5zxXZmFK5ArnfP/GjBqlyLjGlreAPuSvOEhwqDxSp7iScPPjXUTTZ/+GC88piQt8cYwmgZr5TavKcrWpnt87T02owDI9kLa9ydGjzufILKx37wcV3MDAWLAWjRu3wjHxCXU7e4U9L52Bj5Wx8bQSx1tTDNNu4DoXaV7rH7mZA3MmbPgtmOcc/s/iH0gLzWlmEGVeVV7U4wfCdqIYP/DdLqBugwe5voYRcolrtN0WFD98t+etnunHYeuDHmrlj8DDRsiPfWlZsyd26/DduydhCPZ2G6/FjPYT8LQfPnV7L6N7WNr6mA== 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=2D9kgK+HW6LulQg52lNcgajhCK4gktTz9uKrqFgyWmA=; b=Y5jFSC7uIscwpVqSKxxp+s3rNy3fMlYZu8iyKPNM3qND9ATMc3Op9/73fKFvgNH4cvW7ZUWYJa+bSUNb6IcTv0x2sM1ZgQkhfsRYJSHDNiD2pUT/otZO0MoZnXaCaChPf5qla1pD8t5bGhieTkIXKpWDjCnDlHn6Ybh7ElozDpA= Received: from BN9PR03CA0435.namprd03.prod.outlook.com (2603:10b6:408:113::20) by SA1PR12MB7197.namprd12.prod.outlook.com (2603:10b6:806:2bd::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Tue, 18 Oct 2022 19:42:44 +0000 Received: from BN8NAM11FT084.eop-nam11.prod.protection.outlook.com (2603:10b6:408:113:cafe::e5) by BN9PR03CA0435.outlook.office365.com (2603:10b6:408:113::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34 via Frontend Transport; Tue, 18 Oct 2022 19:42:44 +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.5746.16 via Frontend Transport; Tue, 18 Oct 2022 19:42:44 +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:42:04 -0500 From: Andrew Boyer To: CC: Andrew Boyer , Subject: [PATCH v2 04/36] net/ionic: fix up the Rx filter save API Date: Tue, 18 Oct 2022 12:40:59 -0700 Message-ID: <20221018194131.23006-5-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 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: BN8NAM11FT084:EE_|SA1PR12MB7197:EE_ X-MS-Office365-Filtering-Correlation-Id: 67e423ad-6251-47bd-07eb-08dab140ed35 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: smbL7Wx/Zi20LGWiZFk3Z657X3+AV89lmYDNzvhr48r7hylazlejQEAcyo6Pt2UHnTlWeTTQnmAUDBlb4Ok4+/a0hVHDosYUBlIZ631wtZlkUXWrbhYwMZTGoS3imjhmgbVQFaE6Tgv4tlzQV7vhlHfn8eidaKQml7tTUWDed0oBqUDSEONosuw2rsppic6qcK2CJgNhzwQKdRjVY5X8avsFufongHeoP3BwbTCMac+mkmouK4KmRt7OIWdl78Fpfw6F9lODL9NdxPvNWU55TYSs9owba8BYALuUQiNvyNcE2jT5ISk8jD08/44AZg/sX9L/u7XriWK78KTxL92EIQ0mmN4Pl937wPUxiZ9aFAY1tVP/0rQPc872U/AH1V354NsdSWvo+snwJ4Pglj/Sv18giwnApkxlkRZdOLUNA1Cj+uWXMhxcwaT2issCqLwRlOiKLidWhVMhmR4qlna3kitfYHzY23b3X38AJqTSdk5LbxVYh4O5BIfpisGMO85P25Le8oH2MTI0jvx30yDFRkMk9RtFbWbTkkd8HmxDY0gHJYchkD/p9+9ouxPf9efZnRfe/gbaZOLgazX4IubTAylaWpHikR+n07/tDSEysHBLojlueRp8jJcXlMMeThOURXb00fjEQSusC3r+yHoTqqwEnD3YfbIOwslm8bMVDg2qIpiDNg/2VxCox1sy9j+24Q5u8WdbxegrorovcXbtiRg2PKuTrpa1ytEFqk5hicADp1iir1r1C12ru2XsgfzrBz0SMeVcET5A4rSiPKymu0g3pmPjUimklTMK+wG0qa4is3K172aTc+XfYZitvZqC 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)(39860400002)(396003)(346002)(376002)(451199015)(46966006)(36840700001)(40470700004)(5660300002)(44832011)(4744005)(70586007)(6916009)(54906003)(8676002)(41300700001)(4326008)(36860700001)(36756003)(450100002)(478600001)(6666004)(8936002)(26005)(316002)(83380400001)(426003)(2906002)(47076005)(70206006)(40480700001)(40460700003)(356005)(81166007)(1076003)(186003)(82310400005)(82740400003)(2616005)(16526019)(86362001)(336012)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:42:44.1576 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 67e423ad-6251-47bd-07eb-08dab140ed35 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: SA1PR12MB7197 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 Check the match variable after copying cmd info, or else there can be unexpected results. Fixes: a27e0e96ab77 ("net/ionic: observe endianness in Rx filter") Cc: andrew.boyer@amd.com Cc: stable@dpdk.org Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_rx_filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ionic/ionic_rx_filter.c b/drivers/net/ionic/ionic_rx_filter.c index bf57a9fa52..4b2e907f9f 100644 --- a/drivers/net/ionic/ionic_rx_filter.c +++ b/drivers/net/ionic/ionic_rx_filter.c @@ -63,8 +63,8 @@ ionic_rx_filter_save(struct ionic_lif *lif, uint32_t flow_id, f->flow_id = flow_id; f->filter_id = rte_le_to_cpu_32(ctx->comp.rx_filter_add.filter_id); f->rxq_index = rxq_index; - f->match = rte_le_to_cpu_16(f->cmd.match); memcpy(&f->cmd, &ctx->cmd, sizeof(f->cmd)); + f->match = rte_le_to_cpu_16(f->cmd.match); switch (f->match) { case IONIC_RX_FILTER_MATCH_VLAN: From patchwork Tue Oct 18 19:41:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118471 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 93A53A0560; Tue, 18 Oct 2022 21:42:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 891F641147; Tue, 18 Oct 2022 21:42:57 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2085.outbound.protection.outlook.com [40.107.223.85]) by mails.dpdk.org (Postfix) with ESMTP id 169F64113C; Tue, 18 Oct 2022 21:42:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sm50x4ZDnUIOti+OYWpo4ePRBBFY0AIDn8gvgFcJTSkMf6P3CcLNAzdNyeAjU9lXGAAcVfPDrO+1/EYSrOX1Yaw5mM6PxV+XBNU0Qylwo5Mn0sEJYCls7LUrZMS+QMkHv1c4BUjGyEhW67QqUBZE6/clzAR/AvT8lN3wQtRPnGuDWYocQ9BZqYHTd8/z4fDzSH36+NYhxGc5xDTVnofwYUTdclgnTU9ei404VgHQ8JjQNuoE/cYMLeSzeUYEl/HUZmG5VPxe7LPMc/w8WXEwspfhgk4cjv2zH8nAPctFPxRwFKdgti39Imz9mc9MWha6L7F9B4fNQGdOXI0NIr5/Sw== 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=40fjOdsZ9XMkJ08cFZgreKod3g1ObzNW5j5dhZ+1Rc4=; b=gFJV/4H3YubwNGp4/msWtG48YTyB4S315UINu1eUrfGL+ngMJXx+bA/pbmRxfy6ly4mh8/SfP7lA+riysgIIF0WSfIM/6zgiAXr5VGh6IQqSnZzo8he7uCMaz/ogTRrwJ6f7BiBpUmxryDLBfiZhyE6uT5hI7u7VobaY3lGea8Srdddl4Eu6yGhGIZM0OxkwiwRZP6ErTGvqQXhoszlR5BQzNghpeZid7U2UEMbiF9yPYEVYYwOkC06dMDwPB1KUdXPQTwY5ay23AjDhWX8gK4otX2SJAhJ6dy3a+T9tjl9JyILAdtdE9YSlt3SCgPeky/Mtz3sutOS4UP4+/k87pg== 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=40fjOdsZ9XMkJ08cFZgreKod3g1ObzNW5j5dhZ+1Rc4=; b=5eD9Kv91178d8EamY3gglIKerODYbDFAY+T6GE2G/b/AWliRIxF8WTM59JfUm0eGI4Onx8K1b6RGuGL2Th9ICooUuP5GX31LaYP2vGmHX1gmxHI2QGMvj7gRWO5E/BwVOgbHUIxjEqdrDlAPH3mw1Iko5UKkG8EJEH5af0qOctY= Received: from BN9PR03CA0427.namprd03.prod.outlook.com (2603:10b6:408:113::12) by BY5PR12MB4965.namprd12.prod.outlook.com (2603:10b6:a03:1c4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Tue, 18 Oct 2022 19:42:52 +0000 Received: from BN8NAM11FT084.eop-nam11.prod.protection.outlook.com (2603:10b6:408:113:cafe::6a) by BN9PR03CA0427.outlook.office365.com (2603:10b6:408:113::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.31 via Frontend Transport; Tue, 18 Oct 2022 19:42:51 +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.5746.16 via Frontend Transport; Tue, 18 Oct 2022 19:42:51 +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:42:50 -0500 From: Andrew Boyer To: CC: Andrew Boyer , , Subject: [PATCH v2 05/36] net/ionic: fix up reported error stats Date: Tue, 18 Oct 2022 12:41:00 -0700 Message-ID: <20221018194131.23006-6-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 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: BN8NAM11FT084:EE_|BY5PR12MB4965:EE_ X-MS-Office365-Filtering-Correlation-Id: 859dc7f2-0d12-48ff-cd4b-08dab140f190 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Xy6qDut28r5qbUadGMUbRMnKFQcU7rSEDw74C5EAEQ2WvHMQZBuvK0UfSP/0MzoHSKuEbrlgL+YJFLdMAyb6fyHtuy4wvMRUrRwBwR4Nmy6wKOhVPMimO51zTJDW78QrnZOgbFS1LxPvsfY31M2rtWqjhR448nFolR0I+JJi05pRO/k/5uRy1fBjgZVqe3t0sqU1P3eGWawdxrz5CQCxWDbv7/31oiZoHh9LPlgUpHKZkP3zseWXNt27txGF0sg0WAXFeadAPuTznGw09VDM3jaCGTfhu4esb87kUN44pzS9MsdspPwmGDmYxcF5VEqF97w28mABg54xJM/kP0SFsqvJ1JphOgD1Zpkcym/xBls71/SZ6TX228OzCtbYt9Wsq14PUVBcyvbXyqRW3kJUcdMFI+TuHTMgw+8eJhEjBFrDEHI3cLqJEhKSacmV3SjyurTmPp3hOw1tcn29VD3MRzIjcMKEmPeiJPs/o8u8++Ih5FhokMQF5HQM6MmlPMUjEimPoJS2yEMTg7cOR9mRGi8DBSj1Yv/O8+cNCI6YP/dhX1qXOkBoe61oko5WEFu6QJcoad1esvDh08aJoME4Mn+UfF5lmqnhHqdDZ0BeuMFco0YWm81aZ/2CezyqAtfT/zOYjDAf8r8QCIvMSYhgva5LfEWyElq0Nfofsk4z/G01Taf4jbugwadAREWrIUzSY28Lrvmy8VINt2fLT2wCh2Olefa/HthfVquuX05OawXHj9bPyAZNebqpKvQv4bhQinLJsUDTvanhiSer3uHMW8n/NLyBB9UKPXCx8vLHlmyDABWB2bdWteZsdaS5Fe2Z 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)(136003)(346002)(396003)(39860400002)(451199015)(36840700001)(40470700004)(46966006)(36756003)(36860700001)(86362001)(336012)(82740400003)(44832011)(2906002)(5660300002)(2616005)(426003)(186003)(16526019)(1076003)(81166007)(356005)(83380400001)(47076005)(6916009)(316002)(478600001)(26005)(41300700001)(70586007)(6666004)(54906003)(70206006)(40480700001)(82310400005)(8936002)(4326008)(8676002)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:42:51.4699 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 859dc7f2-0d12-48ff-cd4b-08dab140f190 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: BY5PR12MB4965 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 Report descriptor errors in ierrors instead of imissed. Don't report rx_queue_empty or rx_queue_disabled in imissed, since those packet errors are already included in the rx_*_drop_packets counters. This makes the reported stats correct. Fixes: 3cdfd90579e7 ("net/ionic: add stats") Cc: cardigliano@ntop.org Cc: stable@dpdk.org Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 5e8fdf3893..799530f7f5 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -132,7 +132,7 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats for (i = 0; i < lif->nrxqcqs; i++) { struct ionic_rx_stats *rx_stats = &lif->rxqcqs[i]->stats; - stats->imissed += + stats->ierrors += rx_stats->no_cb_arg + rx_stats->bad_cq_status + rx_stats->no_room + @@ -144,10 +144,8 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats ls->rx_mcast_drop_packets + ls->rx_bcast_drop_packets; - stats->imissed += - ls->rx_queue_empty + + stats->ierrors += ls->rx_dma_error + - ls->rx_queue_disabled + ls->rx_desc_fetch_error + ls->rx_desc_data_error; From patchwork Tue Oct 18 19:41:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118472 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5E26BA0560; Tue, 18 Oct 2022 21:43:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 713AF410F2; Tue, 18 Oct 2022 21:43:00 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2045.outbound.protection.outlook.com [40.107.92.45]) by mails.dpdk.org (Postfix) with ESMTP id D2C0D41144 for ; Tue, 18 Oct 2022 21:42:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JzPFtczbYqK70yQTNIeF1JzSb46s4D0jbW853Qf+6fyIl097QoILhMKTppiQ1YQe3en6HV87wzfPGthXOnOd5jKMA9bP2E13RLZtLOt5C8xSH1bGdID0Iur2bzeny2QEzy20MhrnfKsgSKLAYezGAF48/feqqcn92rNuJpCKryKzAsKb8bt8eX8LAEw75yshyXrlcYdaNgLfBxtms0QelEgXwmvYbYdbzwNmdzBrTPplpnMsx+Gi13iUemNBL+AhSnBhbfGFwZC7MbA8hamRLNSOr71m+gp64Pr99i54Zo20xdEzj+Z2x0Bpcz2PlTZiq1kkE/pGshyP+bixXsTGPQ== 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=TerdoU+bnhlBCg9Q20uhVYlpQP1SWDaeKKxLbi9IsWI=; b=mOB3Jwc+J6G076sYuJOFyNtFGie+PAf61jtlDWxokwUKfeEA01F5P41OTdQO58pNDubZ3jwhEjXHQa6NR0ngWEm5QTRrRa/zTsvh1Pqy0AgYnzdbAEb3/6GCJjC3kusPvc4lhJbbRqrlHuWoH+idRhnf8EuG8fEB/zw+HDT0tw4hNwVfUv95CM2omwHxpUyOGRLQ+DtgzzSGdM3qctVfi/gwozhZB0EHpFLVBzzV5+a5rsuS/OD0eWpGBnhtsg20Kgmw0p1YwISWs2/Ul+wCBNZ/0Fazq1PdZM3Aqf40S2UCRCLQAwobBlWUhn7V0egtS+MUQhMWAxiFZwO5yhtUww== 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=TerdoU+bnhlBCg9Q20uhVYlpQP1SWDaeKKxLbi9IsWI=; b=0siSog6hOSP4RyhCTN9iYWej0C0r3oX0zbNiDRWqH8tCIO+DsIhQCLUahclz1LY0Ipq+X+h41uRyg3miehwWvF0rrrEQm9pKOibatjKrtj1BToB/WqjT43qAM2MkZkz/sc9r3vTR+uoGQnDQldDqeUkCWoVZy7QBarBr64kIZGs= Received: from BN9PR03CA0422.namprd03.prod.outlook.com (2603:10b6:408:113::7) by CY8PR12MB7266.namprd12.prod.outlook.com (2603:10b6:930:56::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Tue, 18 Oct 2022 19:42:56 +0000 Received: from BN8NAM11FT084.eop-nam11.prod.protection.outlook.com (2603:10b6:408:113:cafe::62) by BN9PR03CA0422.outlook.office365.com (2603:10b6:408:113::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.31 via Frontend Transport; Tue, 18 Oct 2022 19:42:56 +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.5746.16 via Frontend Transport; Tue, 18 Oct 2022 19:42:56 +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:42:55 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 06/36] net/ionic: update documentation and copyrights Date: Tue, 18 Oct 2022 12:41:01 -0700 Message-ID: <20221018194131.23006-7-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 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: BN8NAM11FT084:EE_|CY8PR12MB7266:EE_ X-MS-Office365-Filtering-Correlation-Id: e6ae8f1f-af61-4705-2f82-08dab140f482 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UX44ud3NsgsaUS6f44VR8vExVYsDZj4WZfKHi1+8D9v62goBq6SzjZjTRFBLoKrPHrwzFYJF9BaeLWwoavvXrDA/DzkCDnp3pmvVbqIRfdi8jOIcgxkM6IWU4ihJp+qKSwM26ZKssDSpsEaW98QHHEapowVECTYABn2N6U0Qhkb1y0olSYQlpLgXVCoUxBGWLAq9LjwJvYujHnrn1T46C+TdFiQanfuibxcZ1iEKTrw/BkDd9+KGNmSuSV8z9Cg2fz8h+R7G6D4azabHs/4kQ2dbDaq6YJu54fe9++Re809SqO4kPWvWMlhA70hoQn/G3tkgjS6bsIEWc5lTKwbdvHquQ5XWzL6G1q7t+G/4NeDteQ8BwzG6SokR//zRhnRpZTXEmco/WGV+AsF33JzNAVyRgk6iolXigXpKg9b8kDpB5FsOPoEZWYzVZRy3Q7g+k2kgjJRdvtWDazRNCBKsM1IagqbGSjCt7l5YaE67/cOwDWxJlP6Mme7D8/e72bbBAL517mBbNozYlcd4rfitFi5hwOGyRnhFO1kUO0gC7lAw553qHKuGeJRwEgiL586iPJTMnEJ3JHdGkn8l80QZ8+obnXnHhCk4i4Q5JOOyVGG/fWfNpBfLPy4H1BTGKQecfrQigAspOQHJs62LNR5Kr859W7Y73bCNdnXMOA0YBHasPEVgOVo++2qRWCN+rGK4YsBzShHZ8e4QgNKy4muQrQux/sY0zuHLnuTFOEoNqGFRYoJqCVel+d/N0x+AEo2sVxxyohlG2QeE/nN3qyNHLVGfPkXfDqzHs0VFtKenWQvBHaARzNRst9uIUwuNa3hna5/r+LBQ18s2yoLCcWot4Nx6b1lBnpDPmMvyZxIi3p1EYJ9IDcxZzW5HLYWCnsr4bEkDFDoE+AF/0ZrbtIT+4Q== 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)(39860400002)(346002)(376002)(136003)(451199015)(36840700001)(40470700004)(46966006)(36756003)(36860700001)(426003)(8936002)(5660300002)(30864003)(82740400003)(44832011)(356005)(47076005)(81166007)(336012)(83380400001)(86362001)(40460700003)(26005)(6916009)(6666004)(2616005)(16526019)(186003)(40480700001)(478600001)(966005)(1076003)(4326008)(316002)(70586007)(41300700001)(70206006)(8676002)(82310400005)(2906002)(15650500001)(15398625002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:42:56.4073 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e6ae8f1f-af61-4705-2f82-08dab140f482 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: CY8PR12MB7266 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 Pensando Systems has been acquired by AMD. Update all copyright strings and email addresses. Signed-off-by: Andrew Boyer --- MAINTAINERS | 12 ++++++------ doc/guides/nics/ionic.rst | 15 +++++++-------- doc/guides/rel_notes/release_22_11.rst | 6 ++++++ drivers/net/ionic/ionic.h | 4 ++-- drivers/net/ionic/ionic_dev.c | 2 +- drivers/net/ionic/ionic_dev.h | 2 +- drivers/net/ionic/ionic_ethdev.c | 2 +- drivers/net/ionic/ionic_ethdev.h | 2 +- drivers/net/ionic/ionic_if.h | 2 +- drivers/net/ionic/ionic_lif.c | 2 +- drivers/net/ionic/ionic_lif.h | 2 +- drivers/net/ionic/ionic_logs.h | 2 +- drivers/net/ionic/ionic_mac_api.c | 2 +- drivers/net/ionic/ionic_mac_api.h | 2 +- drivers/net/ionic/ionic_main.c | 2 +- drivers/net/ionic/ionic_osdep.h | 2 +- drivers/net/ionic/ionic_regs.h | 2 +- drivers/net/ionic/ionic_rx_filter.c | 2 +- drivers/net/ionic/ionic_rx_filter.h | 2 +- drivers/net/ionic/ionic_rxtx.c | 2 +- drivers/net/ionic/ionic_rxtx.h | 2 +- drivers/net/ionic/meson.build | 2 +- 22 files changed, 39 insertions(+), 34 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 2bd4a55f1b..92b381bc30 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -630,6 +630,12 @@ F: drivers/net/axgbe/ F: doc/guides/nics/axgbe.rst F: doc/guides/nics/features/axgbe.ini +AMD Pensando ionic +M: Andrew Boyer +F: drivers/net/ionic/ +F: doc/guides/nics/ionic.rst +F: doc/guides/nics/features/ionic.ini + Marvell/Aquantia atlantic M: Igor Russkikh T: git://dpdk.org/next/dpdk-next-net-mrvl @@ -895,12 +901,6 @@ F: doc/guides/nics/pfe.rst F: drivers/net/pfe/ F: doc/guides/nics/features/pfe.ini -Pensando ionic -M: Andrew Boyer -F: drivers/net/ionic/ -F: doc/guides/nics/ionic.rst -F: doc/guides/nics/features/ionic.ini - Marvell QLogic bnx2x M: Rasesh Mody M: Shahed Shaikh diff --git a/doc/guides/nics/ionic.rst b/doc/guides/nics/ionic.rst index 673700d6ce..82fb0eff9f 100644 --- a/doc/guides/nics/ionic.rst +++ b/doc/guides/nics/ionic.rst @@ -1,22 +1,21 @@ .. SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - Copyright(c) 2018-2020 Pensando Systems, Inc. All rights reserved. + Copyright 2018-2022 Advanced Micro Devices, Inc. IONIC Driver ============ -The ionic driver provides support for Pensando server adapters. +The ionic driver provides support for AMD Pensando server adapters. It currently supports the below models: -- DSC-25 dual-port 25G Distributed Services Card `(pdf) `__ -- DSC-100 dual-port 100G Distributed Services Card `(pdf) `__ +- DSC-25 dual-port 25G Distributed Services Card `(pdf) `__ +- DSC-100 dual-port 100G Distributed Services Card `(pdf) `__ -Please visit the Pensando web site at https://pensando.io for more information. -The `Documents `_ page contains Product Briefs and other product information. +Please visit the AMD Pensando web site at https://www.amd.com/en/accelerators/pensando for more information. Identifying the Adapter ----------------------- -To determine if one or more Pensando DSC Ethernet devices are installed +To determine if one or more AMD Pensando DSC Ethernet devices are installed on the host, check for the PCI devices: .. code-block:: console @@ -30,7 +29,7 @@ Firmware Support The ionic PMD requires firmware which supports 16 segment transmit SGLs. This support was added prior to version 1.0. For help upgrading older versions, -please contact Pensando support. +please contact AMD Pensando support. Building DPDK ------------- diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index a3700bbb34..4656607aae 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -140,6 +140,12 @@ New Features * Made compatible with libbpf v0.8.0 (when used with libxdp). +* **Updated AMD Pensando ionic driver.** + + Updated the ionic PMD with new features and improvements, including: + + * Updated to reflect that Pensando has been acquired by AMD. + * **Updated Intel iavf driver.** * Added flow subscription support. diff --git a/drivers/net/ionic/ionic.h b/drivers/net/ionic/ionic.h index a55202b178..986408ad31 100644 --- a/drivers/net/ionic/ionic.h +++ b/drivers/net/ionic/ionic.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #ifndef _IONIC_H_ @@ -15,7 +15,7 @@ #include "ionic_osdep.h" #define IONIC_DRV_NAME "ionic" -#define IONIC_DRV_DESCRIPTION "Pensando Ethernet NIC Driver" +#define IONIC_DRV_DESCRIPTION "AMD Pensando Ethernet NIC Driver" #define IONIC_DRV_VERSION "0.11.0-49" /* Vendor ID */ diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c index 5439b99b2d..c891a51e03 100644 --- a/drivers/net/ionic/ionic_dev.c +++ b/drivers/net/ionic/ionic_dev.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #include diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index 38c078efdf..c814301451 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #ifndef _IONIC_DEV_H_ diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index d72033c32c..d85162ee3f 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #include diff --git a/drivers/net/ionic/ionic_ethdev.h b/drivers/net/ionic/ionic_ethdev.h index 9304e170de..b5b1212bfa 100644 --- a/drivers/net/ionic/ionic_ethdev.h +++ b/drivers/net/ionic/ionic_ethdev.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #ifndef _IONIC_ETHDEV_H_ diff --git a/drivers/net/ionic/ionic_if.h b/drivers/net/ionic/ionic_if.h index 45bad9b040..0e99df8cc2 100644 --- a/drivers/net/ionic/ionic_if.h +++ b/drivers/net/ionic/ionic_if.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB OR BSD-3-Clause */ -/* Copyright (c) 2017-2020 Pensando Systems, Inc. All rights reserved. */ +/* Copyright 2017-2022 Advanced Micro Devices, Inc. */ #ifndef _IONIC_IF_H_ #define _IONIC_IF_H_ diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 799530f7f5..27002b8142 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #include diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index 9f00ba2973..c11c1f35da 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #ifndef _IONIC_LIF_H_ diff --git a/drivers/net/ionic/ionic_logs.h b/drivers/net/ionic/ionic_logs.h index bc10ad1744..a4ebac346c 100644 --- a/drivers/net/ionic/ionic_logs.h +++ b/drivers/net/ionic/ionic_logs.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #ifndef _IONIC_LOGS_H_ diff --git a/drivers/net/ionic/ionic_mac_api.c b/drivers/net/ionic/ionic_mac_api.c index 411d84b578..71775dcf95 100644 --- a/drivers/net/ionic/ionic_mac_api.c +++ b/drivers/net/ionic/ionic_mac_api.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #include diff --git a/drivers/net/ionic/ionic_mac_api.h b/drivers/net/ionic/ionic_mac_api.h index ed9e059a63..4ab8555c24 100644 --- a/drivers/net/ionic/ionic_mac_api.h +++ b/drivers/net/ionic/ionic_mac_api.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #ifndef _IONIC_API_H_ diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c index 7301f53342..066cd98617 100644 --- a/drivers/net/ionic/ionic_main.c +++ b/drivers/net/ionic/ionic_main.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #include diff --git a/drivers/net/ionic/ionic_osdep.h b/drivers/net/ionic/ionic_osdep.h index 89ed106d11..5776a2944f 100644 --- a/drivers/net/ionic/ionic_osdep.h +++ b/drivers/net/ionic/ionic_osdep.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #ifndef _IONIC_OSDEP_ diff --git a/drivers/net/ionic/ionic_regs.h b/drivers/net/ionic/ionic_regs.h index 3bdec34242..1b17540690 100644 --- a/drivers/net/ionic/ionic_regs.h +++ b/drivers/net/ionic/ionic_regs.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #ifndef _IONIC_REGS_H_ diff --git a/drivers/net/ionic/ionic_rx_filter.c b/drivers/net/ionic/ionic_rx_filter.c index 4b2e907f9f..448afefddd 100644 --- a/drivers/net/ionic/ionic_rx_filter.c +++ b/drivers/net/ionic/ionic_rx_filter.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #include diff --git a/drivers/net/ionic/ionic_rx_filter.h b/drivers/net/ionic/ionic_rx_filter.h index 773042fcb2..a3401c6e53 100644 --- a/drivers/net/ionic/ionic_rx_filter.h +++ b/drivers/net/ionic/ionic_rx_filter.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #ifndef _IONIC_RX_FILTER_H_ diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 665d085823..96896aec2b 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #include diff --git a/drivers/net/ionic/ionic_rxtx.h b/drivers/net/ionic/ionic_rxtx.h index befbe61cef..1a8b9c0117 100644 --- a/drivers/net/ionic/ionic_rxtx.h +++ b/drivers/net/ionic/ionic_rxtx.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + * Copyright 2018-2022 Advanced Micro Devices, Inc. */ #ifndef _IONIC_RXTX_H_ diff --git a/drivers/net/ionic/meson.build b/drivers/net/ionic/meson.build index 487fef1882..76389f9213 100644 --- a/drivers/net/ionic/meson.build +++ b/drivers/net/ionic/meson.build @@ -1,5 +1,5 @@ # SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) -# Copyright(c) 2019 Pensando +# Copyright 2019-2022 Advanced Micro Devices, Inc. if is_windows build = false From patchwork Tue Oct 18 19:41:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118473 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0A9A0A0560; Tue, 18 Oct 2022 21:43:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F20B7410EE; Tue, 18 Oct 2022 21:43:28 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2061.outbound.protection.outlook.com [40.107.220.61]) by mails.dpdk.org (Postfix) with ESMTP id 7DEBE40395 for ; Tue, 18 Oct 2022 21:43:27 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tq6KRh0vSiJvZ8UrZKZEmfOUOWKZffwOSrz9QgZrx73/2n/LzhIVxPXY8jeQkKSFWLFWNRhlYazr6BPpUsjCMv4jnptcMmqtiTzBZsv4dZ+XM8u2A9QOdzGWTCk88/B7wCRG/HjHCBhEuKKShGGS2PdtMcEQKnbDyjXzUAsSvL6L3/Nm/2sZiGd16hA497q9tLbtK0fSvrI9rBy1x3ZQTo/4+NN4Yi3El+EvReEGJFGVQOOaiv9LtQ+2Ze+aVtKCFAY+jqq1I4X7zngYxmz3bc47MWdMJ/u/QUyriWJnVT29bRPETSpi+1oIT7WctmfU8cesU4cw2ypcRT6NuvIm/w== 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=Z+m3ypx2tkssR/xGl+e2rRm8XGSVdgJ3qucdN1Sam50=; b=VW9PJV6gnjn3rkkrD/eJzeqcmFHhAhP6f8CjngLBvN8mGzb1xY+DmywZpwhcK2LCSp6Lzsmxtybh2jBbmeYuIwJVE20l6fsphM9EVxlw5RxoqN2/84tWIsnZgM/85qqeIALBFSDodQZfolu/J4xx+8zhGGK5gcKgTDsBfXk1HbAV1GKjN4fMkk1G/sg2jghdwTm1hVM+uB7lkE6Cqm+Vy5PgroVrU00O4r7imsNUceH+aw+dtkuh0uzkOzxuxufOaNaLSmv45dVT5RVBymjkuMy8XbTa6ziZpEUwOImgKVGdRbgNRlvcFCxjb9EPHDBKt2YNxwxgbGyTqVRBYg+99A== 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=Z+m3ypx2tkssR/xGl+e2rRm8XGSVdgJ3qucdN1Sam50=; b=qZCvBnDxFfyRSthKnybzN8gxwCh5JZHhz0pSrB9W6k8+VXdG9bIyh1xu88gy6fVJQpPpX3cGV2AMQ8jFOt96nMx2iWbouJxe71DJh+GAF3vIq+dWUGaWAZRum9Oo5JUG2ILoICn2ukiIkN+k4r7gcMcVN5sbPAv7PROt1snOFfk= Received: from BN8PR16CA0032.namprd16.prod.outlook.com (2603:10b6:408:4c::45) by MN2PR12MB4112.namprd12.prod.outlook.com (2603:10b6:208:19a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 18 Oct 2022 19:43:25 +0000 Received: from BN8NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:408:4c:cafe::5a) by BN8PR16CA0032.outlook.office365.com (2603:10b6:408:4c::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26 via Frontend Transport; Tue, 18 Oct 2022 19:43: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 BN8NAM11FT024.mail.protection.outlook.com (10.13.177.38) 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:43: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:43:23 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 07/36] net/ionic: update supported devices list Date: Tue, 18 Oct 2022 12:41:02 -0700 Message-ID: <20221018194131.23006-8-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 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: BN8NAM11FT024:EE_|MN2PR12MB4112:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e472eef-0233-4d62-221a-08dab14105b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qwX9ysFClHDILenxXVhQ2go3XA8TFYr0brleBUbxaNXtkbSpQtkAU+8zL3w/watk+hiu1Wum11Lez2oW18m4vpgIDMe5DAalIbIEuedFAz8yqJppELIN+MdHwDL6b+Pj9FOrpZXQJs2XQspyQbuz+VXm1dy21ctnzl6dbSShnrxqnZ5SMbe6HwAHdSDkfrM3H0roFrL+OiGQhONnd8cIZGGb0fhgwo11cwW/8YEBo8fXTSlfHInvqf+c4Wru3hnlvv4j0lVOvdyZ07PDvGNZnfYmOOUGyPOP5TwqZoelaVc/cHOHuti8uz2ngBIs9J0yI2bzzFKNnV63vW1CDAf3zyRpCEFJW2OHGRFgXyScfHTkbAehJGfkbKv6NL4ucFOlGL5qOaT77jrmJixPM0LXsw6j4CbAqphRkVmCB5Jhg9mWR+q/FnsD5sKbdHtcpFc8c0Teppdo8e8yU7EymZA64erTp2DlPmrfI/V8ZJx6efYXMonBCe544rx4lNsaxVQ0nZP4XXIIs3bMogH0IxQ+A+PzNLpb0+ruM5F4Dxrzk90Vo+bVnvPevsP2FXlCgsvKx9xC5hYlfEniU1ouFI2zRBmG4gn/lEJi444cnpCmPOuoCsUU2G1kttsGt4sxAle8VuT6FrlFDVVSJ3lZqnostEYud65E4Ee1HNrk24AF+MAUVQ2KDsKdOLi/pMiWH6B4f3jt9q9puAbtPnWvx4po+5Rz0F4B7VFpxI6W99mZeK7Uf8DrL/0PUeauJ0L8jRP3CWTnGsV/sOPy2oojlsiFXp61ZBlyg2WUDnDPAL45Sxqn5wEpafyQvjmt+SvxhE0sNSc2mfFiIu0QK0gwUVpVvI1R1MwrLHXgg9xP9oC58obCGLudXs/CzhrZT7TaQ+S6 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)(39860400002)(346002)(136003)(451199015)(46966006)(40470700004)(36840700001)(36860700001)(82740400003)(82310400005)(966005)(478600001)(356005)(81166007)(186003)(4326008)(2616005)(40460700003)(36756003)(44832011)(6916009)(316002)(70586007)(70206006)(426003)(336012)(47076005)(83380400001)(6666004)(1076003)(5660300002)(8676002)(40480700001)(16526019)(4744005)(2906002)(26005)(8936002)(86362001)(41300700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:43:25.2428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e472eef-0233-4d62-221a-08dab14105b2 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: BN8NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4112 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 Add listed support for the DSC-200. Signed-off-by: Andrew Boyer --- doc/guides/nics/ionic.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/guides/nics/ionic.rst b/doc/guides/nics/ionic.rst index 82fb0eff9f..f2cdd2b571 100644 --- a/doc/guides/nics/ionic.rst +++ b/doc/guides/nics/ionic.rst @@ -9,6 +9,7 @@ It currently supports the below models: - DSC-25 dual-port 25G Distributed Services Card `(pdf) `__ - DSC-100 dual-port 100G Distributed Services Card `(pdf) `__ +- DSC-200 dual-port 200G Distributed Services Card `(pdf) `__ Please visit the AMD Pensando web site at https://www.amd.com/en/accelerators/pensando for more information. From patchwork Tue Oct 18 19:41:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118474 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DBE6DA0560; Tue, 18 Oct 2022 21:43:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D0C0B4114E; Tue, 18 Oct 2022 21:43:34 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2048.outbound.protection.outlook.com [40.107.220.48]) by mails.dpdk.org (Postfix) with ESMTP id CF57140A8B for ; Tue, 18 Oct 2022 21:43:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fHBuAKkaQPIG1UJq8/e7oG/aGDkkmYpUwdxu0x7kjcvORfDt4oPFFUnMtMAqdn8+IYVHT2H2WPx5rC1wKHAVZbQFDAXOb9A7hClxjSJX7V7YBdxNKPiIfyMgnOHcmpDEE9z+7BAliiECDCT09fB1y2v4VAa15P42olAG0F91bVirLZk8GSilPE5Cj9UcViQ7qMM869KHnI0710uHrGynk4cwsFG3tDavcD66+2FTCEqZlmHpSVL+Faf6apV9o7LDK6hljZ+f0chyGV2Fj8Ohd0a91jB2pyuf+JypTzE/jrHVd8ZU5sfSnFCjk8RJT8sLO2KzBPdZlnoqAH8/FyivSQ== 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=dBST4Pgi/FwQrZ0AneIKtKXOhLoZ7gqnv3G0Rh/Ylp4=; b=K+zJ5nCp4acbR+jYdRJP7jRuacWHiitv8pyT0ZT60h0B6njuST+5t41HgdAoQfbG1zwehf5cDUzPdOJ+KRuWuBnwc3xPEJh8wtQTgz1W1/BnvJkIBw4Bq8mroflHdYgxRqOvVbwOQi0JRYMB2UxwNy0HSD0nOMqzc+3i7y3mH9vAxgtbJpeoYTi3qEs+yBVOjznGI0tVm0OCl2Heic65Wi6CEHB7R6v9WqtuwMaxS2Bcilb/IeytDoQXl3LeD7gkHQyXO5GJFU5sll69Zavk3PQjY0mEJsloIfuj+XBGZ9irzgtvAJfzaQYa41rqZlAVL4NNjcHYPP8CebE2LNLvBg== 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=dBST4Pgi/FwQrZ0AneIKtKXOhLoZ7gqnv3G0Rh/Ylp4=; b=aMs/jLFUnNlWoJWGAxgTqHlJu+l67fHycIXPmdIF61PiW4/TRONTwX2s66ACMG1wAQYysxY7sPNVAC8aZpQ1O7tBNYp41kI4YU1BYx5rBvJD6FCisr5DXpg5NrLuMUoW3bWLbTuWIYJcSx+pnIJa/23BOyBkE5Dm0vRRzwMg3mc= Received: from BN9PR03CA0351.namprd03.prod.outlook.com (2603:10b6:408:f6::26) by CH2PR12MB4086.namprd12.prod.outlook.com (2603:10b6:610:7c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32; Tue, 18 Oct 2022 19:43:30 +0000 Received: from BN8NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f6:cafe::74) by BN9PR03CA0351.outlook.office365.com (2603:10b6:408:f6::26) 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:43:30 +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 BN8NAM11FT054.mail.protection.outlook.com (10.13.177.102) 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:43:30 +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:43:29 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 08/36] net/ionic: update license terms to remove GPL Date: Tue, 18 Oct 2022 12:41:03 -0700 Message-ID: <20221018194131.23006-9-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 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: BN8NAM11FT054:EE_|CH2PR12MB4086:EE_ X-MS-Office365-Filtering-Correlation-Id: ffda929e-2c84-4420-af83-08dab14108c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9ZxgMsGCXbXOffozRNs/W6CZZM6mYhpr8akxYQC6khG2bs5feHFgNOvTJ/+yQVWtUxzW5T8Lhr0vcIcJ0HeXP2+Ai5yGJNzxRHY+wK5ZKk90dZkDXpOyd+Ki+Xsz5DAhvxhrDNsoImGeaKpb/cNhfXHLKjObfAtlMAY2yKuUmpQNEzgF9TKK3x0k1l/VruO8HJ/hLaRSmjwCkpIn08P8O5kLYoZaGXlhF/erZ/8EcnqCd+TvbDmnWjDo7w/BpXx889EjLhRzdOaxuWZ69kCFcaCaAQsuWPQiqm1g6DCqamiBMbce2uY6i1OiHzk2SatpFefRKaoPyvQA72VwnOo8yk2AtinhzIG5hCLwcR1ZaFy2gtjLL5AnXtivhBIv7jbreOsGka4pvMHQTA512WJqs/l0VrQuBbe/g+7av99Ye0q4ioSrohpVRnhEHTTo8E2lY+Ir7XrX3SK5a7bw/Agfm72kw/MENbP+LETY5TIHvXkCaa7/19BWOTBn8NJI2J7GLp2VXLfm0Lz+yP4/1kdbiEElcOcSUqveAwxobGepFNMgjWU1fV4UKfBvraB8QjpG8y1zX5fJR17tSRT3GZXu4zxvOuepvinvqTCCgyhGgdkwgUT52tpQcGm7Zu8MzX8SJmQB9F0GFZBS5QdGSwtotcs4sv2ZysTjBBzhDDh6WWv9+KH0uWCdChW65Wi03pG86Jk3PRVBYf5orGIh9EOyPXYz19xGl2tWR0CroZrvNTW6few5cLC4DFyK9YDtSFJfCcEIdJEtWsKwkuKN+YlkgpEE8ndDmfLgRQt7QK34m1KAfsz2NlPH/XVD7omhzB6+ 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)(346002)(376002)(39860400002)(396003)(451199015)(36840700001)(46966006)(40470700004)(478600001)(81166007)(356005)(8936002)(83380400001)(316002)(6916009)(82740400003)(41300700001)(82310400005)(186003)(26005)(36756003)(40480700001)(4326008)(426003)(6666004)(1076003)(16526019)(40460700003)(2616005)(336012)(2906002)(5660300002)(47076005)(8676002)(86362001)(70586007)(36860700001)(44832011)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:43:30.3779 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ffda929e-2c84-4420-af83-08dab14108c1 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: BN8NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4086 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 Remove GPL2 and leave only BSD-3-Clause. This is more in line with the norms of the DPDK community. Signed-off-by: Andrew Boyer --- doc/guides/nics/ionic.rst | 2 +- drivers/net/ionic/ionic.h | 2 +- drivers/net/ionic/ionic_dev.c | 2 +- drivers/net/ionic/ionic_dev.h | 2 +- drivers/net/ionic/ionic_ethdev.c | 2 +- drivers/net/ionic/ionic_ethdev.h | 2 +- drivers/net/ionic/ionic_if.h | 5 +++-- drivers/net/ionic/ionic_lif.c | 2 +- drivers/net/ionic/ionic_lif.h | 2 +- drivers/net/ionic/ionic_logs.h | 2 +- drivers/net/ionic/ionic_mac_api.c | 2 +- drivers/net/ionic/ionic_mac_api.h | 2 +- drivers/net/ionic/ionic_main.c | 2 +- drivers/net/ionic/ionic_osdep.h | 2 +- drivers/net/ionic/ionic_regs.h | 2 +- drivers/net/ionic/ionic_rx_filter.c | 2 +- drivers/net/ionic/ionic_rx_filter.h | 2 +- drivers/net/ionic/ionic_rxtx.c | 2 +- drivers/net/ionic/ionic_rxtx.h | 2 +- drivers/net/ionic/meson.build | 2 +- 20 files changed, 22 insertions(+), 21 deletions(-) diff --git a/doc/guides/nics/ionic.rst b/doc/guides/nics/ionic.rst index f2cdd2b571..216f820736 100644 --- a/doc/guides/nics/ionic.rst +++ b/doc/guides/nics/ionic.rst @@ -1,4 +1,4 @@ -.. SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +.. SPDX-License-Identifier: BSD-3-Clause Copyright 2018-2022 Advanced Micro Devices, Inc. IONIC Driver diff --git a/drivers/net/ionic/ionic.h b/drivers/net/ionic/ionic.h index 986408ad31..a05bf4ee71 100644 --- a/drivers/net/ionic/ionic.h +++ b/drivers/net/ionic/ionic.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c index c891a51e03..27abc29da4 100644 --- a/drivers/net/ionic/ionic_dev.c +++ b/drivers/net/ionic/ionic_dev.c @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index c814301451..fabc21834a 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index d85162ee3f..2b7c05a9f2 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_ethdev.h b/drivers/net/ionic/ionic_ethdev.h index b5b1212bfa..4762ba7a9d 100644 --- a/drivers/net/ionic/ionic_ethdev.h +++ b/drivers/net/ionic/ionic_ethdev.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_if.h b/drivers/net/ionic/ionic_if.h index 0e99df8cc2..c9c4a9dee4 100644 --- a/drivers/net/ionic/ionic_if.h +++ b/drivers/net/ionic/ionic_if.h @@ -1,5 +1,6 @@ -/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB OR BSD-3-Clause */ -/* Copyright 2017-2022 Advanced Micro Devices, Inc. */ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2017-2022 Advanced Micro Devices, Inc. + */ #ifndef _IONIC_IF_H_ #define _IONIC_IF_H_ diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 27002b8142..0d167f677f 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index c11c1f35da..b37841b69f 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_logs.h b/drivers/net/ionic/ionic_logs.h index a4ebac346c..c10b06c051 100644 --- a/drivers/net/ionic/ionic_logs.h +++ b/drivers/net/ionic/ionic_logs.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_mac_api.c b/drivers/net/ionic/ionic_mac_api.c index 71775dcf95..baf6047921 100644 --- a/drivers/net/ionic/ionic_mac_api.c +++ b/drivers/net/ionic/ionic_mac_api.c @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_mac_api.h b/drivers/net/ionic/ionic_mac_api.h index 4ab8555c24..78202d44c6 100644 --- a/drivers/net/ionic/ionic_mac_api.h +++ b/drivers/net/ionic/ionic_mac_api.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c index 066cd98617..11b8a8a44b 100644 --- a/drivers/net/ionic/ionic_main.c +++ b/drivers/net/ionic/ionic_main.c @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_osdep.h b/drivers/net/ionic/ionic_osdep.h index 5776a2944f..68f767b920 100644 --- a/drivers/net/ionic/ionic_osdep.h +++ b/drivers/net/ionic/ionic_osdep.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_regs.h b/drivers/net/ionic/ionic_regs.h index 1b17540690..b4c665a58d 100644 --- a/drivers/net/ionic/ionic_regs.h +++ b/drivers/net/ionic/ionic_regs.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_rx_filter.c b/drivers/net/ionic/ionic_rx_filter.c index 448afefddd..bbfc217826 100644 --- a/drivers/net/ionic/ionic_rx_filter.c +++ b/drivers/net/ionic/ionic_rx_filter.c @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_rx_filter.h b/drivers/net/ionic/ionic_rx_filter.h index a3401c6e53..5500c7d70b 100644 --- a/drivers/net/ionic/ionic_rx_filter.h +++ b/drivers/net/ionic/ionic_rx_filter.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 96896aec2b..ffca26dd3e 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/ionic_rxtx.h b/drivers/net/ionic/ionic_rxtx.h index 1a8b9c0117..e55e86c8b3 100644 --- a/drivers/net/ionic/ionic_rxtx.h +++ b/drivers/net/ionic/ionic_rxtx.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2018-2022 Advanced Micro Devices, Inc. */ diff --git a/drivers/net/ionic/meson.build b/drivers/net/ionic/meson.build index 76389f9213..d122686b5a 100644 --- a/drivers/net/ionic/meson.build +++ b/drivers/net/ionic/meson.build @@ -1,4 +1,4 @@ -# SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) +# SPDX-License-Identifier: BSD-3-Clause # Copyright 2019-2022 Advanced Micro Devices, Inc. if is_windows From patchwork Tue Oct 18 19:41:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118475 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 30C7AA0560; Tue, 18 Oct 2022 21:43:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2566240A8B; Tue, 18 Oct 2022 21:43:42 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2056.outbound.protection.outlook.com [40.107.212.56]) by mails.dpdk.org (Postfix) with ESMTP id 448A542670 for ; Tue, 18 Oct 2022 21:43:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HxVLDWC3XBUCxKxggSELXJdOWLAenyhpZ9nnapEIR4drW5egFooWZHzWIU4FsUhI7hbd1T/AJGwOPXbY13L/5c4JO/ioWE938WN23uQBpNpafz+DVRRnGhyEiIy4Oj5cqO40RxykKvbVJ0BSCDAtoYwVH1D3vmwdcPGgvC8d9G2XKeO7265LNdgKPv3Vq/8Z+44qWGCwhHh6pHk71zXsfWfT8daGfX8PlKNRB1kHcHLJr6UYaEjNe2uUsCcqyYeZqTP7EW64nzDRTyfC0+1scyn7/XjUBz8xBtSKtf6loo8YurLCFXA3cm//Ub9fmpv+KOosYQff29kdZL7crfsYVA== 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=WCKmUGVCap2foJU9K803lLjoIApCRHGwBTUBZCRZjGo=; b=dLOhRrmCwjpPfPu/sFCuC1w4G+/fbv1s7Tiy5K6uIxokPxabk7UM4QV4bIkOmoxeaJbGypV2GaRrml3MY4NI4SXH1j/UV4aomSJBi69sZHINsmnGGjoMFSGCIxNlqYZ862AbWMj1Msc05zMHcMbfMgKFhly9lBSQ4kHtIyy+8ATkzIZLZw415SvpA7dIS25CzG9kazAXmVn5TAUPupL5aKjMvnCUVDgos5Ly6/akTHiD9gBWTl+k8IHyL/JRykuGjMEZQXjPOYEbb2Undhw4JJBCe7MIWl9bRxZSl85tiJ//HejYtIvB7STW5LPkh/dL4DRdfkiLrvJReyWITPrviw== 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=WCKmUGVCap2foJU9K803lLjoIApCRHGwBTUBZCRZjGo=; b=VepdCMNJuOl6FrXVpLMZ98yfJN6//xWpoXEfr2cWGelDVX4nVXYSfMigHTLidra/dpwihcmdUdS0xXmmYhC3PeT0WsuRE8b0bSUHiAxL4TGxGyqdKm5CwfpO0yWudHvRF0N/kpdffTFOMtbCtmLz9+o8S80PuHTqrOafb2VT5GE= Received: from BN9PR03CA0335.namprd03.prod.outlook.com (2603:10b6:408:f6::10) by IA1PR12MB6068.namprd12.prod.outlook.com (2603:10b6:208:3ec::10) 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:43:38 +0000 Received: from BN8NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f6:cafe::4c) by BN9PR03CA0335.outlook.office365.com (2603:10b6:408:f6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34 via Frontend Transport; Tue, 18 Oct 2022 19:43:38 +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 BN8NAM11FT054.mail.protection.outlook.com (10.13.177.102) 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:43:38 +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:43:34 -0500 From: Andrew Boyer To: CC: Andrew Boyer , R Mohamed Shah Subject: [PATCH v2 09/36] net/ionic: update MTU calculations Date: Tue, 18 Oct 2022 12:41:04 -0700 Message-ID: <20221018194131.23006-10-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 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: BN8NAM11FT054:EE_|IA1PR12MB6068:EE_ X-MS-Office365-Filtering-Correlation-Id: b68bf19f-6d86-4189-5c6c-08dab1410d54 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NwiXBatTBkQvvBEj5moJ1TAXf0GAvVJjDYsjqQs/4vmzskv8LzMJb3Sb9v8uQ+gYTvs2GysI3quHg6ddWRe5OBpXANOCb1Xz3XzY+R0vlpnnUw61DJwEFHiXaOMHSIIiqqBNM7Ik9Vt2/xsa/cZt5lrHMPqy7QPT315v2fqmFn6bICQ9uW8DrF0F33+ubYYGjDKfzQmnXoUM22bygQa5fT/ajx+jJCZE71sHCmel1MlwRIjYuX6csY90pj44QXzL5emBccm7tN8MHg9H//gYGR7I/bf/V6ZMOKVw8ut0OnKcEgFLHSKNMbVK7OswgFVJXaNfiRhy0pRFQy7SaLiMv90NQtCW/7n5ERvavdsHpGhk/BcNR5Ra/07nQQ4wvqJU6StJHTmpkrBNwliYa7qKBOBBg35cmoXpNyEdjJFp5fP6Ob8BiujKAaUsoaNdHYEIBBuw4q6anZNksio3JT00lWJF+cdTYHc0Yvb18PwP/MY2n4jVZ5txBMZ/+Jg1zN+MbaSjRN4T+qUgjQv+0IbCym5B1Sweuwb0VfdlRaiRRGir69PYS33n7NjER5B/WTMQwUZKK8lAwJ50QvqPilQtyVRFf3GgVGVNcNRpKE0Hk6UMP05Zp/+N1+1wPh8p4leA8QE9vyqJMlTTFvcpanPBfns3AntX+vUhyoOhuFVpyoyohJujUFBXBQsa6jQTw+txSn6IrKLlLHS28qyycptQPWhD4Y9ATFL8askJeUTPytPQMxMHSRil7ujfAZLz/WwxmmdLKru78wu0g5MeHkGaJKzc7wJLxJ6BdqK0eS038wfyg2gCVcH34SlbE7foqdbv 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)(39860400002)(376002)(136003)(346002)(451199015)(40470700004)(36840700001)(46966006)(1076003)(186003)(2616005)(26005)(36860700001)(336012)(6666004)(426003)(47076005)(83380400001)(2906002)(5660300002)(16526019)(44832011)(40480700001)(15650500001)(40460700003)(6916009)(54906003)(316002)(41300700001)(8936002)(4326008)(8676002)(70206006)(70586007)(82310400005)(478600001)(86362001)(36756003)(356005)(81166007)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:43:38.0657 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b68bf19f-6d86-4189-5c6c-08dab1410d54 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: BN8NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6068 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 Test min and max MTU against values read from firmware, for correctness. Update the firmware field name, for clarity. The device must be stopped before changing MTU, for correctness. Store the calculated frame size in the queue, for performance. Signed-off-by: Andrew Boyer Signed-off-by: R Mohamed Shah --- drivers/net/ionic/ionic_dev.h | 5 +++- drivers/net/ionic/ionic_ethdev.c | 40 +++++++++++++++++++++----------- drivers/net/ionic/ionic_if.h | 8 +++---- drivers/net/ionic/ionic_lif.c | 10 +++----- drivers/net/ionic/ionic_lif.h | 4 +++- drivers/net/ionic/ionic_rxtx.c | 26 +++++++++------------ 6 files changed, 51 insertions(+), 42 deletions(-) diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index fabc21834a..7aea9c9907 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -11,8 +11,11 @@ #include "ionic_if.h" #include "ionic_regs.h" +#define VLAN_TAG_SIZE 4 + #define IONIC_MIN_MTU RTE_ETHER_MIN_MTU -#define IONIC_MAX_MTU 9194 +#define IONIC_MAX_MTU 9378 +#define IONIC_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + VLAN_TAG_SIZE) #define IONIC_MAX_RING_DESC 32768 #define IONIC_MIN_RING_DESC 16 diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 2b7c05a9f2..637553716d 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -343,18 +343,17 @@ static int ionic_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) { struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); - int err; - IONIC_PRINT_CALL(); + if (lif->state & IONIC_LIF_F_UP) { + IONIC_PRINT(ERR, "Stop %s before setting mtu", lif->name); + return -EBUSY; + } - /* - * Note: mtu check against IONIC_MIN_MTU, IONIC_MAX_MTU - * is done by the API. - */ + /* Note: mtu check against min/max is done by the API */ + IONIC_PRINT(INFO, "Setting mtu %u", mtu); - err = ionic_lif_change_mtu(lif, mtu); - if (err) - return err; + /* Update the frame size used by the Rx path */ + lif->frame_size = mtu + IONIC_ETH_OVERHEAD; return 0; } @@ -376,12 +375,16 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev, rte_le_to_cpu_32(cfg->queue_count[IONIC_QTYPE_TXQ]); /* Also add ETHER_CRC_LEN if the adapter is able to keep CRC */ - dev_info->min_rx_bufsize = IONIC_MIN_MTU + RTE_ETHER_HDR_LEN; - dev_info->max_rx_pktlen = IONIC_MAX_MTU + RTE_ETHER_HDR_LEN; - dev_info->max_mac_addrs = adapter->max_mac_addrs; - dev_info->min_mtu = IONIC_MIN_MTU; - dev_info->max_mtu = IONIC_MAX_MTU; + dev_info->min_mtu = RTE_MAX((uint32_t)IONIC_MIN_MTU, + rte_le_to_cpu_32(ident->lif.eth.min_mtu)); + dev_info->max_mtu = RTE_MIN((uint32_t)IONIC_MAX_MTU, + rte_le_to_cpu_32(ident->lif.eth.max_mtu)); + dev_info->min_rx_bufsize = dev_info->min_mtu + IONIC_ETH_OVERHEAD; + dev_info->max_rx_pktlen = dev_info->max_mtu + IONIC_ETH_OVERHEAD; + dev_info->max_lro_pkt_size = + eth_dev->data->dev_conf.rxmode.max_lro_pkt_size; + dev_info->max_mac_addrs = adapter->max_mac_addrs; dev_info->hash_key_size = IONIC_RSS_HASH_KEY_SIZE; dev_info->reta_size = rte_le_to_cpu_16(ident->lif.eth.rss_ind_tbl_sz); dev_info->flow_type_rss_offloads = IONIC_ETH_RSS_OFFLOAD_ALL; @@ -889,6 +892,15 @@ ionic_dev_start(struct rte_eth_dev *eth_dev) if (dev_conf->lpbk_mode) IONIC_PRINT(WARNING, "Loopback mode not supported"); + lif->frame_size = eth_dev->data->mtu + IONIC_ETH_OVERHEAD; + + err = ionic_lif_change_mtu(lif, eth_dev->data->mtu); + if (err) { + IONIC_PRINT(ERR, "Cannot set LIF frame size %u: %d", + lif->frame_size, err); + return err; + } + err = ionic_lif_start(lif); if (err) { IONIC_PRINT(ERR, "Cannot start LIF: %d", err); diff --git a/drivers/net/ionic/ionic_if.h b/drivers/net/ionic/ionic_if.h index c9c4a9dee4..79aa196345 100644 --- a/drivers/net/ionic/ionic_if.h +++ b/drivers/net/ionic/ionic_if.h @@ -401,8 +401,8 @@ union ionic_lif_config { * @version: Ethernet identify structure version * @max_ucast_filters: Number of perfect unicast addresses supported * @max_mcast_filters: Number of perfect multicast addresses supported - * @min_frame_size: Minimum size of frames to be sent - * @max_frame_size: Maximum size of frames to be sent + * @min_mtu: Minimum MTU of frames to be sent + * @max_mtu: Maximum MTU of frames to be sent * @config: LIF config struct with features, mtu, mac, q counts * * @rdma: RDMA identify structure @@ -434,8 +434,8 @@ union ionic_lif_identity { __le32 max_ucast_filters; __le32 max_mcast_filters; __le16 rss_ind_tbl_sz; - __le32 min_frame_size; - __le32 max_frame_size; + __le32 min_mtu; + __le32 max_mtu; u8 rsvd2[106]; union ionic_lif_config config; } __rte_packed eth; diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 0d167f677f..13c763407c 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -536,7 +536,7 @@ ionic_dev_allmulticast_disable(struct rte_eth_dev *eth_dev) } int -ionic_lif_change_mtu(struct ionic_lif *lif, int new_mtu) +ionic_lif_change_mtu(struct ionic_lif *lif, uint32_t new_mtu) { struct ionic_admin_ctx ctx = { .pending_work = true, @@ -546,13 +546,8 @@ ionic_lif_change_mtu(struct ionic_lif *lif, int new_mtu) .mtu = rte_cpu_to_le_32(new_mtu), }, }; - int err; - - err = ionic_adminq_post_wait(lif, &ctx); - if (err) - return err; - return 0; + return ionic_adminq_post_wait(lif, &ctx); } int @@ -730,6 +725,7 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, int err; flags = IONIC_QCQ_F_SG; + err = ionic_qcq_alloc(lif, IONIC_QTYPE_RXQ, sizeof(struct ionic_rx_qcq), diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index b37841b69f..c87f981803 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -81,6 +81,7 @@ struct ionic_rx_qcq { /* cacheline2 */ struct rte_mempool *mb_pool; + uint16_t frame_size; /* Based on configured MTU */ uint16_t flags; /* cacheline3 (inside stats) */ @@ -123,6 +124,7 @@ struct ionic_lif { struct ionic_adapter *adapter; struct rte_eth_dev *eth_dev; uint16_t port_id; /**< Device port identifier */ + uint16_t frame_size; uint32_t hw_index; uint32_t state; uint32_t ntxqcqs; @@ -181,7 +183,7 @@ int ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr); int ionic_qcq_service(struct ionic_qcq *qcq, int budget, ionic_cq_cb cb, void *cb_arg); -int ionic_lif_change_mtu(struct ionic_lif *lif, int new_mtu); +int ionic_lif_change_mtu(struct ionic_lif *lif, uint32_t new_mtu); int ionic_dev_add_mac(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mac_addr, diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index ffca26dd3e..ce1bdbc2c3 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -772,8 +772,6 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq, struct ionic_rxq_comp *cq_desc_base = cq->base; struct ionic_rxq_comp *cq_desc = &cq_desc_base[cq_desc_index]; struct rte_mbuf *rxm, *rxm_seg; - uint32_t max_frame_size = - rxq->qcq.lif->eth_dev->data->mtu + RTE_ETHER_HDR_LEN; uint64_t pkt_flags = 0; uint32_t pkt_type; struct ionic_rx_stats *stats = &rxq->stats; @@ -814,8 +812,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq, return; } - if (cq_desc->len > max_frame_size || - cq_desc->len == 0) { + if (cq_desc->len > rxq->frame_size || cq_desc->len == 0) { stats->bad_len++; ionic_rx_recycle(q, q_desc_index, rxm); return; @@ -936,7 +933,7 @@ ionic_rx_recycle(struct ionic_queue *q, uint32_t q_desc_index, } static __rte_always_inline int -ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len) +ionic_rx_fill(struct ionic_rx_qcq *rxq) { struct ionic_queue *q = &rxq->qcq.q; struct ionic_rxq_desc *desc, *desc_base = q->base; @@ -961,7 +958,7 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len) info = IONIC_INFO_PTR(q, q->head_idx); - nsegs = (len + buf_size - 1) / buf_size; + nsegs = (rxq->frame_size + buf_size - 1) / buf_size; desc = &desc_base[q->head_idx]; dma_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(rxm)); @@ -996,9 +993,9 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len) prev_rxm_seg = rxm_seg; } - if (size < len) + if (size < rxq->frame_size) IONIC_PRINT(ERR, "Rx SG size is not sufficient (%d < %d)", - size, len); + size, rxq->frame_size); info[0] = rxm; @@ -1016,7 +1013,6 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len) int __rte_cold ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) { - uint32_t frame_size = eth_dev->data->mtu + RTE_ETHER_HDR_LEN; uint8_t *rx_queue_state = eth_dev->data->rx_queue_state; struct ionic_rx_qcq *rxq; int err; @@ -1029,8 +1025,10 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) rxq = eth_dev->data->rx_queues[rx_queue_id]; - IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs (size: %u)", - rx_queue_id, rxq->qcq.q.num_descs, frame_size); + rxq->frame_size = rxq->qcq.lif->frame_size - RTE_ETHER_CRC_LEN; + + IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs, size %u", + rx_queue_id, rxq->qcq.q.num_descs, rxq->frame_size); if (!(rxq->flags & IONIC_QCQ_F_INITED)) { err = ionic_lif_rxq_init(rxq); @@ -1041,7 +1039,7 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) } /* Allocate buffers for descriptor rings */ - if (ionic_rx_fill(rxq, frame_size) != 0) { + if (ionic_rx_fill(rxq) != 0) { IONIC_PRINT(ERR, "Could not alloc mbuf for queue:%d", rx_queue_id); return -1; @@ -1129,8 +1127,6 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { struct ionic_rx_qcq *rxq = rx_queue; - uint32_t frame_size = - rxq->qcq.lif->eth_dev->data->mtu + RTE_ETHER_HDR_LEN; struct ionic_rx_service service_cb_arg; service_cb_arg.rx_pkts = rx_pkts; @@ -1139,7 +1135,7 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, ionic_rxq_service(rxq, nb_pkts, &service_cb_arg); - ionic_rx_fill(rxq, frame_size); + ionic_rx_fill(rxq); return service_cb_arg.nb_rx; } From patchwork Tue Oct 18 19:41:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118476 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E47DCA0560; Tue, 18 Oct 2022 21:44:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D757840A8B; Tue, 18 Oct 2022 21:44:33 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2044.outbound.protection.outlook.com [40.107.220.44]) by mails.dpdk.org (Postfix) with ESMTP id 180C240395 for ; Tue, 18 Oct 2022 21:44:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UZd71DGldKyQOIDP/feNVHy6tps9a72Dwt8/ZebDc93jzxx5wS7ozno2gTHcrR+wJX3AajkKB6W4UMXbq09veCtN2x8ln4th22swHzIBSiaDjxwN9VEwI2zrX65dpDBBpyws6tCLhX2PB3YC0NshR2F8TcGEJX4w94fH6Yi2Fn9JP+s2bXUF05XMm3FgPWCqpMddBIdHNKTUQFka3s2bZ6h5+zpebk+u2yiEbJANTDnQQDCdou8JqMh9mOT1OWkH6IRFahV+mrxtvBYPU4Ff1F97qUMnV011EPToHd1oQhll9Ngi6mKZHdZaYPnjtLsM8CT2pfhxlXJfsF4rtx+wJQ== 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=hfH/w3UZI8f4QPFSBiSCxmpZlHZQ/PUZ8TbK9OBmAeM=; b=huvdDim2UnkwaXGZ5BC67OYiN2ZHMUnwbirY1m+LpHyqEyGrVRt6eZSYylLBfEZTkMLxjFWXvZpXi8E8cmW/FN2kvad7q8iH/6uFQTxX/NXVDgbVr7SwYkQ/vcjqQksX41/YxfT/oIi7lzs+F2faBCPDQIkHHMNyi4NvaGYtYRMvHZir7l9GbRW4skWFbBtuS1u2UuxPEJIQz8lFmbmSXDaenMFqmyCTrafWcJ09mx5aUL61niEREd2i4dencICXoH4IYvctZZwZUGtS5LfEKYEO2h/E4VWAgaB47f/2mNyaQrflOWFzCrRLzznInA2raJQ2rMXPrMjl//cjgvn90w== 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=hfH/w3UZI8f4QPFSBiSCxmpZlHZQ/PUZ8TbK9OBmAeM=; b=zHf2WpweVvr1JS2b1+5bMqp/G0DWRkbL0Tm+x6xqsFwu96KfWcS+wt5pAan+ps7G+judwdz2P58oFwL1sWJhSVzdIjfOpyiyvlf0hpPXJjZQCmaJK7MYJhSVWwQ/0oAtRcSHn8yYyv+kxSAObKO8zGymw/grE4XHvoJfEeg9MNw= Received: from DM6PR11CA0012.namprd11.prod.outlook.com (2603:10b6:5:190::25) by DM6PR12MB4878.namprd12.prod.outlook.com (2603:10b6:5:1b8::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Tue, 18 Oct 2022 19:44:31 +0000 Received: from DM6NAM11FT006.eop-nam11.prod.protection.outlook.com (2603:10b6:5:190:cafe::80) by DM6PR11CA0012.outlook.office365.com (2603:10b6:5:190::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30 via Frontend Transport; Tue, 18 Oct 2022 19:44:31 +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 DM6NAM11FT006.mail.protection.outlook.com (10.13.173.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5723.20 via Frontend Transport; Tue, 18 Oct 2022 19:44:31 +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:44:29 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 10/36] net/ionic: simplify code by removing doorbell map helper Date: Tue, 18 Oct 2022 12:41:05 -0700 Message-ID: <20221018194131.23006-11-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 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: DM6NAM11FT006:EE_|DM6PR12MB4878:EE_ X-MS-Office365-Filtering-Correlation-Id: 561f3bc8-fc89-40ad-ed0d-08dab1412ce6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +lgLvSUrz/hqAkr/OUTY5mKAKHRncDjmadXju6hS+gNarHPSkQzsEjkTTX3wqGkCvyS6I3qXCGCgA5xIF7qk4F0MVCYPglaMjta36y2Ac33JGmRRepYF/bu/oeHc6gQM6rOtC9jzZfviJnh8Xbj+uRwrjAkQ+W3kdvtCX+aRSRLz/BQCG4l2XYHWYeHxX4stNuIuJilAfp5VnTT9AiH0JUglx0Xgb19QRBremMBT/BKajXQ2TFI7XBvfrXZ7LPv2Jtg6E5RVmpcPZdc2rptBlN6+G7zueI4yEaYVcgqEffbQBI2FqOIz6bx7FTGMi44U7tMEdZnZiNAk1VAsqZMxhwsZ+jyUpcJrdRc81YlOmyl3/S2ZhB1wlybc0KE5wrohgjo9nc3uTtZaqC3cgZqlcsrjzOqYoNlcELUtVMO8dt8cupvIQ+TvuXAfj79ja78W3r8xHNw2F4wSeISBq2PmsmafRaolcFbGtbzSqD5ceUl3lo0uHaZw7wWBFjSrzigNgIsVgZrI6/ffQqxgLBCkDphjzhaKcyfUfKTcNXIDoVYvBnz76ed/ylyfBYdHg5ww7Telmn5q/3otQMrlnfngivYkD9zyfWobdK+rkUfqdW6s82JD7SBq+DshLmp2F5Ho3jgWE3hauSHHIaEhdmEZCtCGDC5fV96MMCwknACw86L396WiuMT6viEfMumE5BaU/j2rJI9NrhPbPvpALIRA5FRYlNGqO+sUTtb4jhJadkUKvzBIiamHbSIohE1qN0oNybChdcwyPXjbrjwlKOvcsh/9YZ0PEwLjkw8G680JJaPD2AtDmUKQaEp593HBuqKT 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)(376002)(346002)(396003)(39860400002)(451199015)(40470700004)(36840700001)(46966006)(36756003)(36860700001)(86362001)(5660300002)(82740400003)(44832011)(2906002)(2616005)(47076005)(186003)(1076003)(426003)(16526019)(336012)(81166007)(83380400001)(356005)(316002)(478600001)(26005)(41300700001)(6666004)(6916009)(70586007)(70206006)(82310400005)(8936002)(40480700001)(4326008)(8676002)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:44:31.0043 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 561f3bc8-fc89-40ad-ed0d-08dab1412ce6 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: DM6NAM11FT006.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4878 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 There is only one doorbell page in DPDK configurations, so no helper function is needed. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 13c763407c..637473cca5 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -846,17 +846,6 @@ ionic_notify_qcq_alloc(struct ionic_lif *lif) return 0; } -static void * -ionic_bus_map_dbpage(struct ionic_adapter *adapter, int page_num) -{ - char *vaddr = adapter->bars[IONIC_PCI_BAR_DBELL].vaddr; - - if (adapter->num_bars <= IONIC_PCI_BAR_DBELL) - return NULL; - - return (void *)&vaddr[page_num << PAGE_SHIFT]; -} - static void ionic_lif_queue_identify(struct ionic_lif *lif) { @@ -959,7 +948,7 @@ ionic_lif_alloc(struct ionic_lif *lif) rte_spinlock_init(&lif->adminq_lock); rte_spinlock_init(&lif->adminq_service_lock); - lif->kern_dbpage = ionic_bus_map_dbpage(adapter, 0); + lif->kern_dbpage = adapter->idev.db_pages; if (!lif->kern_dbpage) { IONIC_PRINT(ERR, "Cannot map dbpage, aborting"); return -ENOMEM; From patchwork Tue Oct 18 19:41:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118477 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C4CA4A0560; Tue, 18 Oct 2022 21:44:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BA8F84114E; Tue, 18 Oct 2022 21:44:38 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2070.outbound.protection.outlook.com [40.107.212.70]) by mails.dpdk.org (Postfix) with ESMTP id 373B94114B for ; Tue, 18 Oct 2022 21:44:38 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Es5K1zO88ObD9HxKJEdtckklkij6GTZYSkImAW67KAu+xGz6N5naA4jBA3942tIAucyXowx7SBGQbO4/jjC+RJGAXr2QgkszAT93HB3NchBwuc3DfwB/xHdfMJ4XvuvkY7MMxs2waqmP5f7D1gDSLiGMsCVEs/kVQD3QDibMCTJDWA57SGpUDBOvDiA5hdzJogSzZzjTETJIoJeNTsvvX51fHqQ0aT7XQEdreToEy1CQJF+rOKF2t8JCQx9+JLqlzxS+Sjybbh6PSOKOZIqLZ3wizSA8RybsOq2fS1rrt2GlSksN5qKg1U6YZ9YUZp7WpQWiFCYdFBJCSqYbprl/nw== 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=uoog+p1vNqNgbvJRJ0BSaYkq3TvZlH+Pfn+chCzP9YA=; b=EZH0LCCX1qsEwwR5s3tzbB98vGIU59g/dd40fiSRgAuA3ZlBmtFhz0Smzo9gfT++1BpnxJczFhCh6F2Ik2IyqUbPqLie6QGkr2VX/Lg3quOuq2Z17jvDNxUwzvEUhZMCRX/QadEaoWT/mPOucRf3w4kYjbDYZ4jmwechKtaiZGkaydFW52O+HX3Rz61gt6fO4xkTavrrGYxueLSSMbisdT45kCa+ou2slLXVqFxO/vEGZt1LfRjPUoAd1gpKwZS2XK+0o2dREM2TPIZrKnTYQOlPXcp2W/EEcogbzwDXADpU4wH8IwyQKaKeIkHbl1rJwwQRKB1OSMu8BPsf5ZJE1Q== 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=uoog+p1vNqNgbvJRJ0BSaYkq3TvZlH+Pfn+chCzP9YA=; b=CQuyk3yqoKim9ktmIwWEHrveWlMuSnizH8WMbUpD0i852l3z9wKHe5Gt05PW1xhZVDyomkJlWZHRHNb+394YsCu2i3tlZ4YNiFHjRZ1oRZJRqmftEtMwVFBRHkkcsVhwbtDESff9vIojWq3FEv7j7A9UQFC++0LOjt9k5TF+0KU= Received: from DS7PR03CA0145.namprd03.prod.outlook.com (2603:10b6:5:3b4::30) by MW3PR12MB4379.namprd12.prod.outlook.com (2603:10b6:303:5e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32; Tue, 18 Oct 2022 19:44:36 +0000 Received: from DM6NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b4:cafe::ec) by DS7PR03CA0145.outlook.office365.com (2603:10b6:5:3b4::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34 via Frontend Transport; Tue, 18 Oct 2022 19:44:35 +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 DM6NAM11FT009.mail.protection.outlook.com (10.13.173.20) 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:44:35 +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:44:33 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 11/36] net/ionic: remove unused identifiers Date: Tue, 18 Oct 2022 12:41:06 -0700 Message-ID: <20221018194131.23006-12-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 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: DM6NAM11FT009:EE_|MW3PR12MB4379:EE_ X-MS-Office365-Filtering-Correlation-Id: 0aeca0ad-0af6-45f2-cf98-08dab1412fc1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d8TWPwAzRxamTcUS/9YmizekAWMDR3Gnqu2h35V1b7vsceQ+Vy9Tx/jseXVXfV/KZ3z/LtH06fCV2DYU47ObDSioh78/ViU7DzwoQqSMSX5H69HNNeXjeHnbzrVFMa7mQJOpuxPlhUOt1W1EdpcnqYzoXB5GApt5JzbcGyJdyiWu/rjtRmkCWJblMSCtVMZeRzZAqtR2lmA3KO5GwAohDam0P+2s75i+tRwWWoCUeWg29ioMRErRzN1Xot84ThpnaGU6OPlozysn1e14eA4ZfgA73+MFND4K6hHuiBvDgwNeFNnLdtCM5lrRHTFh+Z/7fuujU7KU21snfwKiYD5730Cann8qMbBB4SRu+nfAhQLY+RR+yD5c2TqJcAGi55nxBWG/Cb1io5cL9jWHF7bX5xUJ4pepX+jcR6rQwB4FHbCwSD6N3gi/VkwomvtEOwVp0t6EjWsJxkzwVEW3CU6nCtmbaCwG7ggizJT/fnw+OHLGZ7w46YToQOctpKmwogWk8yEWqod39wfRzzPI5Lr04k/b0azVQXzB+8yUQ3bXThDd8vGjUh+ig/65xdax5RWzJUknkI7WBql0X9u4becpO5WUX/51B8/Mc7jaPfjmhD9Gq2sC2t+nXryy2ATKqkvZQA2ZbQMHhLE3M0Y8mguK4+i+CJmCZJ17TcT3h2yOOjWibaOP4TCCI9O7J8zdPebO7H0L1fRutKEcnNWXPmXdB8qc+6+O/pEfpF9Nf9sR26jbwJYB7EReGTuXpqQ6tSxGFaX+I9IG+YszK3jz2n/pszHk9BrLq9GNLcQ1YqdU9to= 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)(376002)(136003)(396003)(346002)(451199015)(36840700001)(46966006)(40470700004)(1076003)(2616005)(426003)(47076005)(186003)(16526019)(81166007)(83380400001)(336012)(356005)(86362001)(36860700001)(5660300002)(82740400003)(2906002)(44832011)(4326008)(82310400005)(41300700001)(40480700001)(8676002)(8936002)(6666004)(478600001)(70206006)(316002)(70586007)(40460700003)(26005)(6916009)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:44:35.7786 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0aeca0ad-0af6-45f2-cf98-08dab1412fc1 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: DM6NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4379 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 bits are not used. Remove them to simplify the code. Fix the spacing on the IONIC_ALIGN #define. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic.h | 1 - drivers/net/ionic/ionic_dev.h | 4 +--- drivers/net/ionic/ionic_ethdev.h | 2 -- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/ionic/ionic.h b/drivers/net/ionic/ionic.h index a05bf4ee71..7c8710b637 100644 --- a/drivers/net/ionic/ionic.h +++ b/drivers/net/ionic/ionic.h @@ -62,7 +62,6 @@ struct ionic_adapter { bool link_up; char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN]; struct rte_pci_device *pci_dev; - LIST_ENTRY(ionic_adapter) pci_adapters; }; /** ionic_admin_ctx - Admin command context. diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index 7aea9c9907..b284a36044 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -21,12 +21,10 @@ #define IONIC_MIN_RING_DESC 16 #define IONIC_DEF_TXRX_DESC 4096 -#define IONIC_LIFS_MAX 1024 - #define IONIC_DEVCMD_TIMEOUT 5 /* devcmd_timeout */ #define IONIC_DEVCMD_CHECK_PERIOD_US 10 /* devcmd status chk period */ -#define IONIC_ALIGN 4096 +#define IONIC_ALIGN 4096 struct ionic_adapter; diff --git a/drivers/net/ionic/ionic_ethdev.h b/drivers/net/ionic/ionic_ethdev.h index 4762ba7a9d..16077e2786 100644 --- a/drivers/net/ionic/ionic_ethdev.h +++ b/drivers/net/ionic/ionic_ethdev.h @@ -17,8 +17,6 @@ #define IONIC_ETH_DEV_TO_LIF(eth_dev) ((struct ionic_lif *) \ (eth_dev)->data->dev_private) -#define IONIC_ETH_DEV_TO_ADAPTER(eth_dev) \ - (IONIC_ETH_DEV_TO_LIF(eth_dev)->adapter) int ionic_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete); From patchwork Tue Oct 18 19:41:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118479 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 66097A0560; Tue, 18 Oct 2022 21:45:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 36AB342684; Tue, 18 Oct 2022 21:45:01 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2056.outbound.protection.outlook.com [40.107.243.56]) by mails.dpdk.org (Postfix) with ESMTP id DBB8A40395 for ; Tue, 18 Oct 2022 21:44:57 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fWXQXkE8JRlQfGcLQxUao+VQLsA9wgEpt+PZD+nET5PIghsvJDDRc+fFqkA64Y+UG1VFnwjqt862Pm5vWTTs4s6qtl8xV/Ooqrx3itJeeHVKn0uD2+recuGco0ehL1ZWOiV+YMvjY8bPqp8BwPDWoDIok/bIkFpnRtzotDFH75TpKa7xc6xhJBuWqxq6GO7B9ni0RfUm66c8HGDHBE0/8DNWtqtkbC8whHjasESIGb3AqnRe7jyZ8J4J7q1xhRc2reEIHG4zcTv4dSHrHZYwqNLFQvS/vLo1f6EuEVQSGMJx749KIifOQBkklbwTbF3LOmLmsIXIJlNnIss33EjcsA== 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=P5r2Zo5/EOc6agdlPho3L07P4h5cPltgEdvhcUgNAZQ=; b=KBzvvGkGdKzm8Nqel+gHLJjxa3i6yvdnWTHTBu2RgHsjzXmjYmF+TUhCPWXDYmW4JlJcPrkclT0kI7wrvkp+ml+BWCY4JLiAbbRufRCyJzHvdgVTmNz97dKPlMM6utYOP7XtNAIrXIGvvbCxtjrMem19RLcw4hVTPJS3FEEYEjhuw8K/BKUb/DFVt54ywLrJCDiuNnEgHKl+Lmf3vMnsD0art6ivqbHWnoTC6jbjTHkDu46SZTDcUSpJdZtaOj0mQwjyiOy8OAK62+YbkTJymgAutcmnDQIHXMO8H06ZVEOd1vL5Jo64jgYXWoYyNF1jClKk0WvWh6Z1hrTKi2Nvjw== 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=P5r2Zo5/EOc6agdlPho3L07P4h5cPltgEdvhcUgNAZQ=; b=y38onFDBcIaYkKKrWhhiZN8fpP1O+H+Sk3E+sU8Kzd9c6wzcS6gfNIQl05R1i9B9/u1oSMquGbbtOPP5WX+53zDE9L8Pu2h/aQS0jwaawUhszOIBiHDk2FuiznLemQSrs+6HIPeQVrUM37RngQfZIfd5y6sl04TtUpGMHsNMA14= Received: from BN9PR03CA0783.namprd03.prod.outlook.com (2603:10b6:408:13f::8) by LV2PR12MB5728.namprd12.prod.outlook.com (2603:10b6:408:17c::7) 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:44:54 +0000 Received: from BN8NAM11FT020.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13f:cafe::de) by BN9PR03CA0783.outlook.office365.com (2603:10b6:408:13f::8) 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:44:54 +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 BN8NAM11FT020.mail.protection.outlook.com (10.13.176.223) 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:44:53 +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:44:38 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 12/36] net/ionic: only allocate interrupts if required Date: Tue, 18 Oct 2022 12:41:07 -0700 Message-ID: <20221018194131.23006-13-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 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: BN8NAM11FT020:EE_|LV2PR12MB5728:EE_ X-MS-Office365-Filtering-Correlation-Id: b806c325-242e-4469-eed6-08dab1413a96 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z/cdRUetZgWIB9U4OPJGxA7Ee2IREBOr1wdDzrLVQRX9Yb1wazZZLRgSzEiUxcWr3UDnbodofsZJREcunS5C4grvho2lWNthEtuXir1VU6zFdLiWI8NXmra4hFyJAivfsQMa0fFg5d+YrD3CetpGUIh1oE1XQE1MBd9ULI++fwR6ujB/Cj5mmRvqsduvHIdAs1VvQfeMdfy+MFHVVMFDFyYOu/qb10KVyvcVgcFAT5tFVATCK4cIX5Qw/YKTYHO7p99u9gbLojG8gvBR6WWiqTxxC/P/5QVPpf/cv3FG5e3RKLztchrBrm0opXZpt3DS7XJz9/HFo3QXb5//ZndO85bCDf1XjsFdbBD/FcTlc5lCDRdZ2vUwzwOUleiQakCPlbTsaNCHhtsRSxHZnTtyvzrtd4f1xkt+LgTNdvqu9G8x4vzLXKZ8srnNdMa8OkbBjvXygWRYUGxbKfhi8WAk2JkMX13nK+hbf9KHbwyZKlKQzZzqLQ+c+34DwMJZSpAJUC1AGu+n1ko8uefjK3U54KPQ/Q+2LRmRWujD2KQfyLfL+flvg1w7AiGuBZ72oiizRV4Q6K//BkUTloMpPiTw/BfQBAzfCsEVm5eizy7OnX8vkPXM1Owwuib0Jht8CpKqXQti6SozCNEpNXGURQ3Mj+g3wlM2JcFfFUAJ8Xv57R7o54neF7d/oybNb6T8axloiHIqqKO9bprQIsPmrNDgdN/jWLwBIt7rQyvGEq28zMdXDqcAMqz+X1AQ1YmFEjY8Uo58FTzfX4dw40lVYJ1EI+82pbfYXjBCJz9pCGlWjbIPveVxiOtQyUhxEKskPZZF 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)(346002)(39860400002)(396003)(136003)(376002)(451199015)(46966006)(36840700001)(40470700004)(83380400001)(36756003)(2906002)(8936002)(86362001)(5660300002)(4326008)(82310400005)(186003)(26005)(41300700001)(1076003)(6666004)(40460700003)(44832011)(2616005)(16526019)(336012)(478600001)(356005)(8676002)(47076005)(70206006)(70586007)(81166007)(426003)(6916009)(40480700001)(316002)(82740400003)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:44:53.9994 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b806c325-242e-4469-eed6-08dab1413a96 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: BN8NAM11FT020.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5728 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 There is no need to allocate the interrupt vector list if datapath packet interrupts are not enabled. This conserves resources. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_ethdev.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 637553716d..cabdfa1f21 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -1082,14 +1082,16 @@ ionic_configure_intr(struct ionic_adapter *adapter) return -1; } - if (rte_intr_dp_is_en(intr_handle)) + if (rte_intr_dp_is_en(intr_handle)) { IONIC_PRINT(DEBUG, "Packet I/O interrupt on datapath is enabled"); - if (rte_intr_vec_list_alloc(intr_handle, "intr_vec", adapter->nintrs)) { - IONIC_PRINT(ERR, "Failed to allocate %u vectors", - adapter->nintrs); - return -ENOMEM; + if (rte_intr_vec_list_alloc(intr_handle, "intr_vec", + adapter->nintrs)) { + IONIC_PRINT(ERR, "Failed to allocate %u vectors", + adapter->nintrs); + return -ENOMEM; + } } err = rte_intr_callback_register(intr_handle, From patchwork Tue Oct 18 19:41:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118478 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 62F3FA0560; Tue, 18 Oct 2022 21:44:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 53CEB4114A; Tue, 18 Oct 2022 21:44:58 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2074.outbound.protection.outlook.com [40.107.223.74]) by mails.dpdk.org (Postfix) with ESMTP id 0013D40395 for ; Tue, 18 Oct 2022 21:44:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CD4rK7BQkI37UIpoyD4meRUPw8NZ5SLTtRXK6x2qCJXIFmEPXJoh0mmt6+NuEc8Zn/j6/rSw8V/7/dWG4lFhR+6+XmeN/Q4v0TxHlAdSFApT6CgySKc/2pwCEDqLuY8agxFJN10+DMojdkcDBTRL7K29zr4mP7yTQj+lFzxcxdZS68TQZe0E7AP8lA6vB9ZFcgyN0U5ZaBCroCqr+9AsxIBncQfnqlnzXJC9mbK2xEBm8x8prKIvIEBfSm7DOrIccBAwyGKIASmGL5286mD96fWJLIldQTpL46I+hxnMM1mzmFw6OE4ZJXFx8J5uWNG/oNAt6CX44o5F0SfQbLqsxQ== 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=n6X1ALYtXHKDnxSFAnFX0O0AVPs3ovp88SXK9OaIurc=; b=N6WZLwlhqEupl6bUgBFgybl3zuH5s7pvyvQ1Gocxe1LKwZeNECQa3YddjQQRBJxHDA8VSWpQxqwIDKenSUTB8V/LsQfar7Vo6KNLmnQvJRYZEI8SLky3I0TuCAnp58SlW7US9crHHFZIL12PVRMGuVsi+cTOWHFpD4B43/OIQi30ydJJ0ldtt6WXkWerk4pPc0euvC+grohkfGm6zJBmEjFoMXnVBddQbrgAj78ZAyhbIP5K/HdsUxTFHnODLtmwEHQfCYzg/EG5BgY0Rgr0ZRSz7J3xm9/mk0Yl9m30MT+C2y+dYs88RChzARWJFpYSpuOfMFKgCh1ial5zeVIwow== 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=n6X1ALYtXHKDnxSFAnFX0O0AVPs3ovp88SXK9OaIurc=; b=jjmsZSUbGa0ZBhX6hEduUXF6H+KYBVGW6UZOf88tpkrisRuwe4lYtIR1RmXyVfSfOs8N9VxGK0cmHoRCb1EdicYAL3cyPUEupXI5W3amhC3rb1kqjaoZY9oMqr86Am0xq/ADhQ3ojfaWCZuAupd7OOnbMKtNWmI1kfBgePnFy/A= Received: from DS7PR03CA0188.namprd03.prod.outlook.com (2603:10b6:5:3b6::13) by DM8PR12MB5446.namprd12.prod.outlook.com (2603:10b6:8:3c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34; Tue, 18 Oct 2022 19:44:55 +0000 Received: from DM6NAM11FT102.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b6:cafe::78) by DS7PR03CA0188.outlook.office365.com (2603:10b6:5:3b6::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.33 via Frontend Transport; Tue, 18 Oct 2022 19:44:55 +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 DM6NAM11FT102.mail.protection.outlook.com (10.13.173.172) 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:44:54 +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:44:53 -0500 From: Andrew Boyer To: CC: Andrew Boyer , Neel Patel , "R Mohamed Shah" Subject: [PATCH v2 13/36] net/ionic: move PCI-specific code to a separate file Date: Tue, 18 Oct 2022 12:41:08 -0700 Message-ID: <20221018194131.23006-14-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 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: DM6NAM11FT102:EE_|DM8PR12MB5446:EE_ X-MS-Office365-Filtering-Correlation-Id: 36565b5d-5e3c-48cf-d42a-08dab1413b26 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VMVxBaAoTUV2FkcX2JSUH0yKTrpqMAA7JWjSAVO48dNPQIubXhO4tVecoCV2RhFo8dVWz1uTnPCHl2XMgCsoEzVvtNgma7qhXKmS2MqRR5hlPLHzrxUrCtuNRMTZ0sTT1edx6avHV5N6bb18gYsDoO7fO6IjuAy5ioxiV5ar+V8SxWKU27jFIaEhCwjUG6gB7N1qNMWZ0vgjyeYZz0KPvRWqXmt9jmxSA/rfKBK82+FEEt3fpiKSbcipRiyYxj1xyWGg8iC9CFNqx0l5mKJ02VpKduun2mnVxQdkff/fy5GNT2o+Xkj2xpbydLJSwuUbFktd2vIxDhnCksBFDuSC4gBcHdyy/MKXJGpW1JtSKKE/+Sw5mMx8x6OUuPt98YVd9AxOOjEtGibez0GHbl3wVjv+rIVy7Ie2IuLRKfGeshq3Wru+b0DGgvrUkmX0feyP723Oql6jMlAXDdqrRFTwYouyJN1BbYg28RB2m0UA/MeF80ju8730gkyuhEFKfwTn+gL5Nzu8bs5vqCqxJn0pBnQ4vl1zeb5V1jbuR/rqAnehLvtukkWi9DkngW31CKb12/QFmI/xGL+2aClUKHnBQA1tY98kx9P+Z5BFePpSkXTWvVZcCHPW59xLD8QfGaYkjEIDgQTJPehSULk37r/qsdPn0iMIT+IBugL4Kc4c5fHZFdK4EtE1yGJ34jOn+y3UCCBhLlWtpa27XepSXAL7BYb7aa/PJXHILUO+TVh8GyWOmTqskTgqdAiC+Kot32cqNXYbSMltxSL/+gzN7Td2gx05qcHytZ9HsQgD7BuEBFHVhWg1uCvZjiKMCzjXTqp/ 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)(346002)(376002)(39860400002)(136003)(451199015)(36840700001)(40470700004)(46966006)(82740400003)(44832011)(70206006)(4326008)(2906002)(70586007)(81166007)(2616005)(356005)(30864003)(5660300002)(36860700001)(47076005)(336012)(16526019)(83380400001)(186003)(426003)(1076003)(86362001)(6666004)(26005)(54906003)(6916009)(40480700001)(316002)(8676002)(8936002)(41300700001)(36756003)(478600001)(40460700003)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:44:54.8956 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 36565b5d-5e3c-48cf-d42a-08dab1413b26 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: DM6NAM11FT102.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR12MB5446 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 For future support of virtual devices, move the PCI code to its own file. Create a new device interface, struct ionic_dev_intf, to plug in to common code. Signed-off-by: Andrew Boyer Signed-off-by: Neel Patel Signed-off-by: R Mohamed Shah --- drivers/net/ionic/ionic.h | 13 +- drivers/net/ionic/ionic_dev.c | 62 --------- drivers/net/ionic/ionic_dev.h | 13 +- drivers/net/ionic/ionic_dev_pci.c | 216 ++++++++++++++++++++++++++++++ drivers/net/ionic/ionic_ethdev.c | 161 ++++++---------------- drivers/net/ionic/ionic_ethdev.h | 9 ++ drivers/net/ionic/ionic_main.c | 2 +- drivers/net/ionic/meson.build | 1 + 8 files changed, 286 insertions(+), 191 deletions(-) create mode 100644 drivers/net/ionic/ionic_dev_pci.c diff --git a/drivers/net/ionic/ionic.h b/drivers/net/ionic/ionic.h index 7c8710b637..8b0e85ea26 100644 --- a/drivers/net/ionic/ionic.h +++ b/drivers/net/ionic/ionic.h @@ -8,8 +8,6 @@ #include #include -#include - #include "ionic_dev.h" #include "ionic_if.h" #include "ionic_osdep.h" @@ -42,6 +40,11 @@ struct ionic_hw { uint16_t vendor_id; }; +struct ionic_bars { + struct ionic_dev_bar bar[IONIC_BARS_MAX]; + uint32_t num_bars; +}; + /* * Structure to store private data for each driver instance (for each adapter). */ @@ -49,10 +52,10 @@ struct ionic_adapter { struct ionic_hw hw; struct ionic_dev idev; const char *name; - struct ionic_dev_bar bars[IONIC_BARS_MAX]; + struct ionic_bars bars; + const struct ionic_dev_intf *intf; struct ionic_identity ident; struct ionic_lif *lif; - uint32_t num_bars; uint32_t max_ntxqs_per_lif; uint32_t max_nrxqs_per_lif; uint32_t max_mac_addrs; @@ -61,7 +64,7 @@ struct ionic_adapter { bool intrs[IONIC_INTR_CTRL_REGS_MAX]; bool link_up; char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN]; - struct rte_pci_device *pci_dev; + void *bus_dev; }; /** ionic_admin_ctx - Admin command context. diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c index 27abc29da4..1082a007d3 100644 --- a/drivers/net/ionic/ionic_dev.c +++ b/drivers/net/ionic/ionic_dev.c @@ -10,68 +10,6 @@ #include "ionic_lif.h" #include "ionic.h" -int -ionic_dev_setup(struct ionic_adapter *adapter) -{ - struct ionic_dev_bar *bar = adapter->bars; - unsigned int num_bars = adapter->num_bars; - struct ionic_dev *idev = &adapter->idev; - uint32_t sig; - u_char *bar0_base; - unsigned int i; - - /* BAR0: dev_cmd and interrupts */ - if (num_bars < 1) { - IONIC_PRINT(ERR, "No bars found, aborting"); - return -EFAULT; - } - - if (bar->len < IONIC_BAR0_SIZE) { - IONIC_PRINT(ERR, - "Resource bar size %lu too small, aborting", - bar->len); - return -EFAULT; - } - - bar0_base = bar->vaddr; - idev->dev_info = (union ionic_dev_info_regs *) - &bar0_base[IONIC_BAR0_DEV_INFO_REGS_OFFSET]; - idev->dev_cmd = (union ionic_dev_cmd_regs *) - &bar0_base[IONIC_BAR0_DEV_CMD_REGS_OFFSET]; - idev->intr_status = (struct ionic_intr_status *) - &bar0_base[IONIC_BAR0_INTR_STATUS_OFFSET]; - idev->intr_ctrl = (struct ionic_intr *) - &bar0_base[IONIC_BAR0_INTR_CTRL_OFFSET]; - - sig = ioread32(&idev->dev_info->signature); - if (sig != IONIC_DEV_INFO_SIGNATURE) { - IONIC_PRINT(ERR, "Incompatible firmware signature %" PRIx32 "", - sig); - return -EFAULT; - } - - for (i = 0; i < IONIC_DEVINFO_FWVERS_BUFLEN; i++) - adapter->fw_version[i] = - ioread8(&idev->dev_info->fw_version[i]); - adapter->fw_version[IONIC_DEVINFO_FWVERS_BUFLEN - 1] = '\0'; - - adapter->name = adapter->pci_dev->device.name; - - IONIC_PRINT(DEBUG, "%s firmware version: %s", - adapter->name, adapter->fw_version); - - /* BAR1: doorbells */ - bar++; - if (num_bars < 2) { - IONIC_PRINT(ERR, "Doorbell bar missing, aborting"); - return -EFAULT; - } - - idev->db_pages = bar->vaddr; - - return 0; -} - /* Devcmd Interface */ uint8_t diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index b284a36044..6dab7e5bbd 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -173,14 +173,23 @@ struct ionic_cq { struct ionic_lif; struct ionic_adapter; struct ionic_qcq; +struct rte_mempool; +struct rte_eth_dev; + +struct ionic_dev_intf { + int (*setup)(struct ionic_adapter *adapter); + void (*copy_bus_info)(struct ionic_adapter *adapter, + struct rte_eth_dev *eth_dev); + int (*configure_intr)(struct ionic_adapter *adapter); + void (*unconfigure_intr)(struct ionic_adapter *adapter); + void (*unmap_bars)(struct ionic_adapter *adapter); +}; void ionic_intr_init(struct ionic_dev *idev, struct ionic_intr_info *intr, unsigned long index); const char *ionic_opcode_to_str(enum ionic_cmd_opcode opcode); -int ionic_dev_setup(struct ionic_adapter *adapter); - void ionic_dev_cmd_go(struct ionic_dev *idev, union ionic_dev_cmd *cmd); uint8_t ionic_dev_cmd_status(struct ionic_dev *idev); bool ionic_dev_cmd_done(struct ionic_dev *idev); diff --git a/drivers/net/ionic/ionic_dev_pci.c b/drivers/net/ionic/ionic_dev_pci.c new file mode 100644 index 0000000000..5366cee56a --- /dev/null +++ b/drivers/net/ionic/ionic_dev_pci.c @@ -0,0 +1,216 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018-2022 Advanced Micro Devices, Inc. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ionic.h" +#include "ionic_if.h" +#include "ionic_dev.h" +#include "ionic_ethdev.h" +#include "ionic_logs.h" + +static const struct rte_pci_id pci_id_ionic_map[] = { + { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_PF) }, + { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_VF) }, + { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_MGMT) }, + { .vendor_id = 0, /* sentinel */ }, +}; + +static int +ionic_pci_setup(struct ionic_adapter *adapter) +{ + struct ionic_dev_bar *bar = adapter->bars.bar; + unsigned int num_bars = adapter->bars.num_bars; + struct ionic_dev *idev = &adapter->idev; + struct rte_pci_device *bus_dev = adapter->bus_dev; + uint32_t sig; + u_char *bar0_base; + unsigned int i; + + /* BAR0: dev_cmd and interrupts */ + if (num_bars < 1) { + IONIC_PRINT(ERR, "No bars found, aborting\n"); + return -EFAULT; + } + + if (bar->len < IONIC_BAR0_SIZE) { + IONIC_PRINT(ERR, + "Resource bar size %lu too small, aborting\n", + bar->len); + return -EFAULT; + } + + bar0_base = bar->vaddr; + idev->dev_info = (union ionic_dev_info_regs *) + &bar0_base[IONIC_BAR0_DEV_INFO_REGS_OFFSET]; + idev->dev_cmd = (union ionic_dev_cmd_regs *) + &bar0_base[IONIC_BAR0_DEV_CMD_REGS_OFFSET]; + idev->intr_status = (struct ionic_intr_status *) + &bar0_base[IONIC_BAR0_INTR_STATUS_OFFSET]; + idev->intr_ctrl = (struct ionic_intr *) + &bar0_base[IONIC_BAR0_INTR_CTRL_OFFSET]; + + sig = ioread32(&idev->dev_info->signature); + if (sig != IONIC_DEV_INFO_SIGNATURE) { + IONIC_PRINT(ERR, "Incompatible firmware signature %#x", + sig); + return -EFAULT; + } + + for (i = 0; i < IONIC_DEVINFO_FWVERS_BUFLEN; i++) + adapter->fw_version[i] = + ioread8(&idev->dev_info->fw_version[i]); + adapter->fw_version[IONIC_DEVINFO_FWVERS_BUFLEN - 1] = '\0'; + + adapter->name = bus_dev->device.name; + + IONIC_PRINT(DEBUG, "%s firmware version: %s", + adapter->name, adapter->fw_version); + + /* BAR1: doorbells */ + bar++; + if (num_bars < 2) { + IONIC_PRINT(ERR, "Doorbell bar missing, aborting\n"); + return -EFAULT; + } + + idev->db_pages = bar->vaddr; + + return 0; +} + +static void +ionic_pci_copy_bus_info(struct ionic_adapter *adapter, + struct rte_eth_dev *eth_dev) +{ + rte_eth_copy_pci_info(eth_dev, adapter->bus_dev); +} + +static int +ionic_pci_configure_intr(struct ionic_adapter *adapter) +{ + struct rte_pci_device *pci_dev = + (struct rte_pci_device *)(adapter->bus_dev); + struct rte_intr_handle *intr_handle = pci_dev->intr_handle; + int err; + + IONIC_PRINT(ERR, "Configuring %u intrs", adapter->nintrs); + + if (rte_intr_efd_enable(intr_handle, adapter->nintrs)) { + IONIC_PRINT(ERR, "Fail to create eventfd"); + return -1; + } + + if (rte_intr_dp_is_en(intr_handle)) { + IONIC_PRINT(NOTICE, + "Packet I/O interrupt on datapath is enabled"); + if (rte_intr_vec_list_alloc(intr_handle, "intr_vec", + adapter->nintrs)) { + IONIC_PRINT(ERR, "Failed to allocate %u vectors", + adapter->nintrs); + return -ENOMEM; + } + } + + err = rte_intr_callback_register(intr_handle, + ionic_dev_interrupt_handler, + adapter); + if (err) { + IONIC_PRINT(ERR, + "Failure registering interrupts handler (%d)", err); + return err; + } + + /* enable intr mapping */ + err = rte_intr_enable(intr_handle); + if (err) { + IONIC_PRINT(ERR, "Failure enabling interrupts (%d)", err); + return err; + } + + return 0; +} + +static void +ionic_pci_unconfigure_intr(struct ionic_adapter *adapter) +{ + struct rte_pci_device *pci_dev = + (struct rte_pci_device *)(adapter->bus_dev); + struct rte_intr_handle *intr_handle = pci_dev->intr_handle; + + rte_intr_disable(intr_handle); + + rte_intr_callback_unregister(intr_handle, + ionic_dev_interrupt_handler, + adapter); +} + +static const struct ionic_dev_intf ionic_pci_intf = { + .setup = ionic_pci_setup, + .copy_bus_info = ionic_pci_copy_bus_info, + .configure_intr = ionic_pci_configure_intr, + .unconfigure_intr = ionic_pci_unconfigure_intr, +}; + +static int +eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, + struct rte_pci_device *pci_dev) +{ + struct rte_mem_resource *resource; + struct ionic_bars bars; + unsigned long i; + + IONIC_PRINT(NOTICE, "Initializing device %s %s", + pci_dev->device.name, + rte_eal_process_type() == RTE_PROC_SECONDARY ? + "[SECONDARY]" : ""); + + bars.num_bars = 0; + for (i = 0; i < PCI_MAX_RESOURCE && i < IONIC_BARS_MAX; i++) { + resource = &pci_dev->mem_resource[i]; + if (resource->phys_addr == 0 || resource->len == 0) + continue; + + bars.bar[bars.num_bars].vaddr = resource->addr; + bars.bar[bars.num_bars].bus_addr = resource->phys_addr; + bars.bar[bars.num_bars].len = resource->len; + bars.num_bars++; + } + + return eth_ionic_dev_probe((void *)pci_dev, + &pci_dev->device, + &bars, + &ionic_pci_intf, + pci_dev->id.device_id, + pci_dev->id.vendor_id); +} + +static int +eth_ionic_pci_remove(struct rte_pci_device *pci_dev) +{ + return eth_ionic_dev_remove(&pci_dev->device); +} + +static struct rte_pci_driver rte_pci_ionic_pmd = { + .id_table = pci_id_ionic_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, + .probe = eth_ionic_pci_probe, + .remove = eth_ionic_pci_remove, +}; + +RTE_PMD_REGISTER_PCI(net_ionic_pci, rte_pci_ionic_pmd); +RTE_PMD_REGISTER_PCI_TABLE(net_ionic_pci, pci_id_ionic_map); +RTE_PMD_REGISTER_KMOD_DEP(net_ionic_pci, "* igb_uio | uio_pci_generic | vfio-pci"); diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index cabdfa1f21..7d95e52346 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -2,12 +2,9 @@ * Copyright 2018-2022 Advanced Micro Devices, Inc. */ -#include -#include #include #include #include -#include #include "ionic_logs.h" #include "ionic.h" @@ -57,13 +54,6 @@ static int ionic_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, static int ionic_dev_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version, size_t fw_size); -static const struct rte_pci_id pci_id_ionic_map[] = { - { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_PF) }, - { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_VF) }, - { RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_MGMT) }, - { .vendor_id = 0, /* sentinel */ }, -}; - static const struct rte_eth_desc_lim rx_desc_lim = { .nb_max = IONIC_MAX_RING_DESC, .nb_min = IONIC_MIN_RING_DESC, @@ -328,7 +318,7 @@ ionic_dev_link_update(struct rte_eth_dev *eth_dev, * @return * void */ -static void +void ionic_dev_interrupt_handler(void *param) { struct ionic_adapter *adapter = (struct ionic_adapter *)param; @@ -946,8 +936,6 @@ ionic_dev_stop(struct rte_eth_dev *eth_dev) return 0; } -static void ionic_unconfigure_intr(struct ionic_adapter *adapter); - /* * Reset and stop device. */ @@ -966,22 +954,24 @@ ionic_dev_close(struct rte_eth_dev *eth_dev) ionic_lif_free_queues(lif); IONIC_PRINT(NOTICE, "Removing device %s", eth_dev->device->name); - ionic_unconfigure_intr(adapter); + if (adapter->intf->unconfigure_intr) + (*adapter->intf->unconfigure_intr)(adapter); rte_eth_dev_destroy(eth_dev, eth_ionic_dev_uninit); ionic_port_reset(adapter); ionic_reset(adapter); + if (adapter->intf->unmap_bars) + (*adapter->intf->unmap_bars)(adapter); rte_free(adapter); return 0; } -static int +int eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params) { - struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); struct ionic_adapter *adapter = (struct ionic_adapter *)init_params; int err; @@ -997,7 +987,8 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; - rte_eth_copy_pci_info(eth_dev, pci_dev); + if (adapter->intf->copy_bus_info) + (*adapter->intf->copy_bus_info)(adapter, eth_dev); eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; lif->eth_dev = eth_dev; @@ -1068,73 +1059,12 @@ eth_ionic_dev_uninit(struct rte_eth_dev *eth_dev) return 0; } -static int -ionic_configure_intr(struct ionic_adapter *adapter) -{ - struct rte_pci_device *pci_dev = adapter->pci_dev; - struct rte_intr_handle *intr_handle = pci_dev->intr_handle; - int err; - - IONIC_PRINT(DEBUG, "Configuring %u intrs", adapter->nintrs); - - if (rte_intr_efd_enable(intr_handle, adapter->nintrs)) { - IONIC_PRINT(ERR, "Fail to create eventfd"); - return -1; - } - - if (rte_intr_dp_is_en(intr_handle)) { - IONIC_PRINT(DEBUG, - "Packet I/O interrupt on datapath is enabled"); - - if (rte_intr_vec_list_alloc(intr_handle, "intr_vec", - adapter->nintrs)) { - IONIC_PRINT(ERR, "Failed to allocate %u vectors", - adapter->nintrs); - return -ENOMEM; - } - } - - err = rte_intr_callback_register(intr_handle, - ionic_dev_interrupt_handler, - adapter); - - if (err) { - IONIC_PRINT(ERR, - "Failure registering interrupts handler (%d)", - err); - return err; - } - - /* enable intr mapping */ - err = rte_intr_enable(intr_handle); - - if (err) { - IONIC_PRINT(ERR, "Failure enabling interrupts (%d)", err); - return err; - } - - return 0; -} - -static void -ionic_unconfigure_intr(struct ionic_adapter *adapter) -{ - struct rte_pci_device *pci_dev = adapter->pci_dev; - struct rte_intr_handle *intr_handle = pci_dev->intr_handle; - - rte_intr_disable(intr_handle); - - rte_intr_callback_unregister(intr_handle, - ionic_dev_interrupt_handler, - adapter); -} - -static int -eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, - struct rte_pci_device *pci_dev) +int +eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev, + struct ionic_bars *bars, const struct ionic_dev_intf *intf, + uint16_t device_id, uint16_t vendor_id) { char name[RTE_ETH_NAME_MAX_LEN]; - struct rte_mem_resource *resource; struct ionic_adapter *adapter; struct ionic_hw *hw; unsigned long i; @@ -1149,9 +1079,6 @@ eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, goto err; } - IONIC_PRINT(DEBUG, "Initializing device %s", - pci_dev->device.name); - adapter = rte_zmalloc("ionic", sizeof(*adapter), 0); if (!adapter) { IONIC_PRINT(ERR, "OOM"); @@ -1159,11 +1086,12 @@ eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, goto err; } - adapter->pci_dev = pci_dev; + adapter->bus_dev = bus_dev; hw = &adapter->hw; - hw->device_id = pci_dev->id.device_id; - hw->vendor_id = pci_dev->id.vendor_id; + /* Vendor and Device ID need to be set before init of shared code */ + hw->device_id = device_id; + hw->vendor_id = vendor_id; err = ionic_init_mac(hw); if (err != 0) { @@ -1172,19 +1100,21 @@ eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, goto err_free_adapter; } - adapter->num_bars = 0; - for (i = 0; i < PCI_MAX_RESOURCE && i < IONIC_BARS_MAX; i++) { - resource = &pci_dev->mem_resource[i]; - if (resource->phys_addr == 0 || resource->len == 0) - continue; - adapter->bars[adapter->num_bars].vaddr = resource->addr; - adapter->bars[adapter->num_bars].bus_addr = resource->phys_addr; - adapter->bars[adapter->num_bars].len = resource->len; - adapter->num_bars++; + adapter->bars.num_bars = bars->num_bars; + for (i = 0; i < bars->num_bars; i++) { + adapter->bars.bar[i].vaddr = bars->bar[i].vaddr; + adapter->bars.bar[i].bus_addr = bars->bar[i].bus_addr; + adapter->bars.bar[i].len = bars->bar[i].len; } - /* Discover ionic dev resources */ + if (intf->setup == NULL) { + IONIC_PRINT(ERR, "Device setup function is mandatory"); + goto err_free_adapter; + } + + adapter->intf = intf; + /* Discover ionic dev resources */ err = ionic_setup(adapter); if (err) { IONIC_PRINT(ERR, "Cannot setup device: %d, aborting", err); @@ -1241,20 +1171,20 @@ eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, goto err_free_adapter; } - snprintf(name, sizeof(name), "%s_lif", pci_dev->device.name); - err = rte_eth_dev_create(&pci_dev->device, - name, sizeof(struct ionic_lif), + snprintf(name, sizeof(name), "%s_lif", rte_dev->name); + err = rte_eth_dev_create(rte_dev, name, sizeof(struct ionic_lif), NULL, NULL, eth_ionic_dev_init, adapter); if (err) { IONIC_PRINT(ERR, "Cannot create eth device for %s", name); goto err_free_adapter; } - err = ionic_configure_intr(adapter); - - if (err) { - IONIC_PRINT(ERR, "Failed to configure interrupts"); - goto err_free_adapter; + if (adapter->intf->configure_intr) { + err = (*adapter->intf->configure_intr)(adapter); + if (err) { + IONIC_PRINT(ERR, "Failed to configure interrupts"); + goto err_free_adapter; + } } return 0; @@ -1265,33 +1195,22 @@ eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, return err; } -static int -eth_ionic_pci_remove(struct rte_pci_device *pci_dev) +int +eth_ionic_dev_remove(struct rte_device *rte_dev) { char name[RTE_ETH_NAME_MAX_LEN]; struct rte_eth_dev *eth_dev; /* Adapter lookup is using the eth_dev name */ - snprintf(name, sizeof(name), "%s_lif", pci_dev->device.name); + snprintf(name, sizeof(name), "%s_lif", rte_dev->name); eth_dev = rte_eth_dev_allocated(name); if (eth_dev) ionic_dev_close(eth_dev); else - IONIC_PRINT(DEBUG, "Cannot find device %s", - pci_dev->device.name); + IONIC_PRINT(DEBUG, "Cannot find device %s", rte_dev->name); return 0; } -static struct rte_pci_driver rte_ionic_pmd = { - .id_table = pci_id_ionic_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, - .probe = eth_ionic_pci_probe, - .remove = eth_ionic_pci_remove, -}; - -RTE_PMD_REGISTER_PCI(net_ionic, rte_ionic_pmd); -RTE_PMD_REGISTER_PCI_TABLE(net_ionic, pci_id_ionic_map); -RTE_PMD_REGISTER_KMOD_DEP(net_ionic, "* igb_uio | uio_pci_generic | vfio-pci"); RTE_LOG_REGISTER_DEFAULT(ionic_logtype, NOTICE); diff --git a/drivers/net/ionic/ionic_ethdev.h b/drivers/net/ionic/ionic_ethdev.h index 16077e2786..8dddef80d5 100644 --- a/drivers/net/ionic/ionic_ethdev.h +++ b/drivers/net/ionic/ionic_ethdev.h @@ -18,6 +18,15 @@ #define IONIC_ETH_DEV_TO_LIF(eth_dev) ((struct ionic_lif *) \ (eth_dev)->data->dev_private) +struct ionic_bars; +struct ionic_dev_intf; + +int eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev, + struct ionic_bars *bars, const struct ionic_dev_intf *intf, + uint16_t device_id, uint16_t vendor_id); +int eth_ionic_dev_remove(struct rte_device *rte_dev); + +void ionic_dev_interrupt_handler(void *param); int ionic_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete); #endif /* _IONIC_ETHDEV_H_ */ diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c index 11b8a8a44b..05f1e90e30 100644 --- a/drivers/net/ionic/ionic_main.c +++ b/drivers/net/ionic/ionic_main.c @@ -336,7 +336,7 @@ ionic_dev_cmd_wait_check(struct ionic_dev *idev, unsigned long max_wait) int ionic_setup(struct ionic_adapter *adapter) { - return ionic_dev_setup(adapter); + return (*adapter->intf->setup)(adapter); } int diff --git a/drivers/net/ionic/meson.build b/drivers/net/ionic/meson.build index d122686b5a..00865c2139 100644 --- a/drivers/net/ionic/meson.build +++ b/drivers/net/ionic/meson.build @@ -9,6 +9,7 @@ endif sources = files( 'ionic_dev.c', + 'ionic_dev_pci.c', 'ionic_ethdev.c', 'ionic_lif.c', 'ionic_mac_api.c', From patchwork Tue Oct 18 19:41:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118480 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 66320A0560; Tue, 18 Oct 2022 21:45:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A25641145; Tue, 18 Oct 2022 21:45:06 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2051.outbound.protection.outlook.com [40.107.94.51]) by mails.dpdk.org (Postfix) with ESMTP id 6FD32410EE for ; Tue, 18 Oct 2022 21:45:04 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iqE8StBsp7mtQQzj3RHoSYs/WnyMWZ3DZA397PjoyEMTz2iJBZuNDe81vYWwNk5Y411lKI61cR0wPQQFqGV0xGRirFRtb/DNTv3eFIvNbUTYpu1oMcCyBJ9S6FbGwYykzQoq1fnWbBIYJzZO3g4P/KtCLJXaQHqJOsOZNAf5dNRAn/velgsWsLcvEPi5jLmgnCLYwa+qyAc+aYL3tnq0mEnEw9Zlkj69Yct+Eurpm2KbyqDx81k4USJVCO2OEcr6RBpjIPFmGq9R07n+SrfSLzYIGqvQKIRAUTzJzvzo3MVkb2WAV6mlynw3ezYMelQJ7Othe7t7IUlUbUAwB5tuLQ== 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=bYQ/2R8nkyiyryLK3YHdeRx1Hry+iJHZVVjooasybL8=; b=AyZrvKY7i8oghqOWusHIu4twtaj5K8rfmi7fftjJaB3SToP8M78RdWP5BboysLnHKXJM/CWDTjA0cjwkiPFZCpqoj6v/VaEhYJg0rkR7XVm+kqoNt+hcbdPYlqtz8FVHiVpE3K8waoMZ5iL/sDc8JwfVhZ6kX4GpYOKUOchGEbCnVABbfo7KUgq744GSA7QptzarKpQRvnncI9dGN1XUgS66yp97JHUM9gIELbNYEQtaeCU/IAXiuGIKCb+R4VM7Ta0oHqEOVL4DY1BcdcRPsXYhqmoeQnOTQ9P9BKSfBk4H4fQkOaOIKSwL2OVfQtFwr2nPWJOdrk0JKWUXpKBXpg== 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=bYQ/2R8nkyiyryLK3YHdeRx1Hry+iJHZVVjooasybL8=; b=OKuVNnkD/jC9kMMjml8jHNu2PinXpPB8/Gp9feXFpSwnFd6LVNVJWzYdbJI/qY0KJG1lQnE6OuqK0ieCE2FDPLB0Evgnl/SdlInVbfRfx4JuY6L8+zmixXEwHOfLG2nUTQpUvl6uE2JnLqxJYWpwz0/mnhRsdmGW5rF6o7ce5pg= Received: from DM6PR18CA0028.namprd18.prod.outlook.com (2603:10b6:5:15b::41) by BL3PR12MB6620.namprd12.prod.outlook.com (2603:10b6:208:38f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32; Tue, 18 Oct 2022 19:45:00 +0000 Received: from DM6NAM11FT008.eop-nam11.prod.protection.outlook.com (2603:10b6:5:15b:cafe::8f) by DM6PR18CA0028.outlook.office365.com (2603:10b6:5:15b::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:44:59 +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 DM6NAM11FT008.mail.protection.outlook.com (10.13.172.85) 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:44:59 +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:44:58 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 14/36] net/ionic: only request notifyq interrupt if supported Date: Tue, 18 Oct 2022 12:41:09 -0700 Message-ID: <20221018194131.23006-15-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 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: DM6NAM11FT008:EE_|BL3PR12MB6620:EE_ X-MS-Office365-Filtering-Correlation-Id: dd58bef4-3fbc-44e3-a05e-08dab1413e0f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5Mqbaa68bmx95jJ6R5/MRGrWgs1fbQHDj9HeJqeGWQWnluy25uyH0qwPENR6PotU/f1elSnrY7mxQQBpq2D66UuJnL14azBcAKWQFIpnLmt7GUiQ6EJO+txhY7kQUv0/83uJa2DEWA5lF5zxTE8FLLZw1H/wzPVQkHzwHPZg3ykonDDqhXFgO66zPAqZ4qE1OgBTKEZT0MZ2/UfqTgfVm7td8f/w5ZfNSi7KFYUOR1v5Cfl9JuEHsom4x0lmEmqrUOFWgt84Y/0M6qCmqWm+YNpIybHhn01RcefhZqnHWNCEvZUj/vAHLsV9sibJzwvuvthgaqaO6tNH9e76BZC8kfOKsg8hS3UdoGVThW7MsSoMQ2izQRNYMX+UTzYssqhMG4SP7ftW8FoilLjelXSkF2r7yCwH8j7Rc3NZBvTZ6duLLs01z3y/Qcen4ZCEdRJVPxyjBNwHkOTU9Q3YEMTh+56eJl1x5PkyJKYtCTsHVFHM1MFc5jr5JMsiWlSXY/0HJsEF1OfkHbj4RGirVrQCSes+Y1J9eNvYjpnETQsRnv7pCDre5/M4gtYhMNdAvGqv411caFPusxq8eSE361uTR4mI7v6OGCFDrLNLD7d2ZVZDMlhlI6cJkAxJU4ElFIDHQZj7k0J0UQRKYqYdh0bErDJF84MUx9eOPXlRK+yze1cZgnVMxoEzYVXpduIWQw+DzBD2Re9sXzPd2WqEtcd47jg2XnPn/QSg4S5iyrA0aVr/J+LIrAMZ/+Lyc6OYP2zwxhQ4yzZVSOWXSjNsFIUiE2z7d/wVTdOPpiyO+7jnOi0XT9tQprkNlES3sGdMpAUJ 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)(376002)(346002)(396003)(39860400002)(451199015)(36840700001)(40470700004)(46966006)(16526019)(2906002)(2616005)(83380400001)(1076003)(336012)(186003)(426003)(40460700003)(26005)(4326008)(8676002)(41300700001)(82740400003)(47076005)(40480700001)(86362001)(81166007)(82310400005)(356005)(316002)(36860700001)(5660300002)(36756003)(44832011)(8936002)(70206006)(6916009)(70586007)(6666004)(478600001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:44:59.7767 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd58bef4-3fbc-44e3-a05e-08dab1413e0f 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: DM6NAM11FT008.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6620 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 Enable the interrupt if the platform & device support it. This prevents spurious interrupts on virtual platforms. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 637473cca5..ccd7ea68bb 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -1350,6 +1350,7 @@ ionic_lif_notifyq_init(struct ionic_lif *lif) struct ionic_dev *idev = &lif->adapter->idev; struct ionic_notify_qcq *nqcq = lif->notifyqcq; struct ionic_queue *q = &nqcq->qcq.q; + uint16_t flags = IONIC_QINIT_F_ENA; int err; struct ionic_admin_ctx ctx = { @@ -1359,14 +1360,19 @@ ionic_lif_notifyq_init(struct ionic_lif *lif) .type = q->type, .ver = lif->qtype_info[q->type].version, .index = rte_cpu_to_le_32(q->index), - .intr_index = rte_cpu_to_le_16(nqcq->intr.index), - .flags = rte_cpu_to_le_16(IONIC_QINIT_F_IRQ | - IONIC_QINIT_F_ENA), + .intr_index = rte_cpu_to_le_16(IONIC_INTR_NONE), .ring_size = rte_log2_u32(q->num_descs), .ring_base = rte_cpu_to_le_64(q->base_pa), } }; + /* Only enable an interrupt if the device supports them */ + if (lif->adapter->intf->configure_intr != NULL) { + flags |= IONIC_QINIT_F_IRQ; + ctx.cmd.q_init.intr_index = rte_cpu_to_le_16(nqcq->intr.index); + } + ctx.cmd.q_init.flags = rte_cpu_to_le_16(flags); + IONIC_PRINT(DEBUG, "notifyq_init.index %d", q->index); IONIC_PRINT(DEBUG, "notifyq_init.ring_base 0x%" PRIx64 "", q->base_pa); IONIC_PRINT(DEBUG, "notifyq_init.ring_size %d", From patchwork Tue Oct 18 19:41:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118481 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7EE9EA0560; Tue, 18 Oct 2022 21:45:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 54828427F4; Tue, 18 Oct 2022 21:45:09 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2057.outbound.protection.outlook.com [40.107.100.57]) by mails.dpdk.org (Postfix) with ESMTP id E445240395 for ; Tue, 18 Oct 2022 21:45:07 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ainHfL0h41RCCvbpce24TUBJStn2qKDOxIo7OOm40yhPgo7/X90y46Naql+UAt7B3vceEa+MMHosEIUGI3hm+MYNspw8RfmjE33GNBh0wyQsQet3VLFlDQjBs9GCrR/b2uMLdZzPjMwGaHBG0hlyEuWcNh9TCCUNQlyDXsPgsIuzYS02SKy1whW69mpIYvipY8qim1RUHEo/VNfxzIGZ0FiKXhbxCBdj0KCB3EI5gunZk6CgR9gIlcQBXO1CeL6m3kBAucrY2x8eu7gUcuGmaCe8iHVGO9qiQAVzBDTztVVSSp3gXr4N24s21Yl+y138OPO8CLKM5sP3bx3yydifYA== 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=WiDidyto0MGFmUSf4Vficiu/kyE+Qc60fVZU4MgMEdU=; b=Mb9Gvyef9b4fS++/aURvJwpuof4NXHk6TSubhS7OgVQUzb9obaP5NH7Z/q687EJ11HK3kRIWcKv+IyFzY13+wPezi+081fkI5d8g6C66dtsEd+A6eLjlxqN3TvKvqPwV3lyoPJ64nQ2FKoCRCa12g/cce4pYZBBReVN+nkook5FO90mrEtZW2O6FqicxPp+5cPT2kUxjKAHf90jIgNR9bOtHBbQhb3Rn3IohbLpGunI9wghHR3v4f9J6ABBj40jeSWsrRftZB35kfnlrOWBQiaK+OFBOs72XW213yKmkvBJa7QK+TAjzFhFH/pMA9rZB17r5xlzcKuLpRfQcJZmqjg== 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=WiDidyto0MGFmUSf4Vficiu/kyE+Qc60fVZU4MgMEdU=; b=wuhN556ScMliqMy9DrCA13sBuMxix358vMguAqYjda9dRAOTsolx1bBg7nTh7iWpQiGbf1Y+hKBrukNWMqZbjxgofa4mdipphwb1UoMmu/JUFiFksaqIx23grB9c6njQ2FLlvMCL7Bv06lo1zJbUOqJbwIC1hoz0bKqlviPj8xc= Received: from DS7P222CA0013.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::22) by MW4PR12MB7437.namprd12.prod.outlook.com (2603:10b6:303:223::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 18 Oct 2022 19:45:06 +0000 Received: from DM6NAM11FT114.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2e:cafe::c) by DS7P222CA0013.outlook.office365.com (2603:10b6:8:2e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30 via Frontend Transport; Tue, 18 Oct 2022 19:45: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 DM6NAM11FT114.mail.protection.outlook.com (10.13.172.206) 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:45: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.31; Tue, 18 Oct 2022 14:45:03 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 15/36] net/ionic: replace void pointer with actual type Date: Tue, 18 Oct 2022 12:41:10 -0700 Message-ID: <20221018194131.23006-16-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 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: DM6NAM11FT114:EE_|MW4PR12MB7437:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a787bb1-5ff8-4ecc-82f3-08dab1414096 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5mS5bxLerfCSRqcJEGgsTJSBhMPeEqJzzMik8SUjBLo2Y1NX6CbWKcgysw3PzVERzobLLjWwHlJtrcHzCcxuAPUfYTKWkLCcCL6tDWfbccaxj2EFQhai+4GBBgDo14AhBldaBIcJB9OvK2uKznvexhCjKV1xfgRUf9dXlZRwFYuyJg7UMDQdW+k7m3G6lkZpihGpaIyb1I+wo2xTspI7EG0QFKkNSDZleVLMrNM8NWkLiIw3mrCM5masqFXXsQuwSNWeDyEgxtdQ+hke16ijcvhE0mgM1ZSksopFDS8YprEnFCnsZswsdCr4vaXiKqHhSOesyiMFYMHJ/T29ww5kkRX80b5rPTT3DBtuYZIA7z6Zx+x0H8xX4ty90dO9fQhqiX88kDZx3WSBioQ4Z0AY5Ov7d4kndUgutGeWcCUZXYvqpAf5R5WnzI4iaxRvfhrnpzETRWO7oRpV+UEyZzvGPG82tQGoFYizesRBFYGHrterVFhXcFYZuvjsHpYbkPtMfnwOfyGFlML5UntIp5pxGrlpzTqaBVQacByCEHcQPHtAue7/K+yjJyj0/kNTqNTksJOFf7GkBxydhsOF9lKQUlP6WNUHc5JrSv+RJbMai0bbikWCtfBGrGUnFoyAW0KgrvXz/3xE58/Z+gAuU9dtmBONVqNSArvL5lVU7rXiW7ovNwwqRUiGt9eCXo5Rl5n0w3CWfDBOuIDuEOhKKS+idMn0sIfONt37c0zTP27D54R6yGx3JoM3IZZJYL+HoRiyCiIt8SsY/WDECztSJde97CLYOg6SUVA37IJoNL+UN76WflrkGCWslbYMpdDe7lla 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)(346002)(376002)(39860400002)(396003)(451199015)(36840700001)(46966006)(40470700004)(478600001)(81166007)(356005)(8936002)(83380400001)(316002)(6916009)(82740400003)(41300700001)(82310400005)(186003)(26005)(36756003)(40480700001)(4326008)(426003)(6666004)(1076003)(16526019)(40460700003)(2616005)(336012)(2906002)(5660300002)(47076005)(8676002)(86362001)(70586007)(36860700001)(44832011)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:45:04.0161 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4a787bb1-5ff8-4ecc-82f3-08dab1414096 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: DM6NAM11FT114.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7437 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 makes the code safer by helping the compiler catch errors. Rename the variables, too; they're not callbacks anymore. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_rxtx.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index ce1bdbc2c3..c90d3d62f3 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -765,7 +765,7 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, static __rte_always_inline void ionic_rx_clean(struct ionic_rx_qcq *rxq, uint32_t q_desc_index, uint32_t cq_desc_index, - void *service_cb_arg) + struct ionic_rx_service *rx_svc) { struct ionic_queue *q = &rxq->qcq.q; struct ionic_cq *cq = &rxq->qcq.cq; @@ -775,8 +775,6 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq, uint64_t pkt_flags = 0; uint32_t pkt_type; struct ionic_rx_stats *stats = &rxq->stats; - struct ionic_rx_service *recv_args = (struct ionic_rx_service *) - service_cb_arg; uint32_t buf_size = (uint16_t) (rte_pktmbuf_data_room_size(rxq->mb_pool) - RTE_PKTMBUF_HEADROOM); @@ -789,7 +787,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq, rxm = info[0]; - if (!recv_args) { + if (!rx_svc) { stats->no_cb_arg++; /* Flush */ rte_pktmbuf_free(rxm); @@ -806,7 +804,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq, return; } - if (recv_args->nb_rx >= recv_args->nb_pkts) { + if (rx_svc->nb_rx >= rx_svc->nb_pkts) { stats->no_room++; ionic_rx_recycle(q, q_desc_index, rxm); return; @@ -907,8 +905,8 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq, rxm->packet_type = pkt_type; - recv_args->rx_pkts[recv_args->nb_rx] = rxm; - recv_args->nb_rx++; + rx_svc->rx_pkts[rx_svc->nb_rx] = rxm; + rx_svc->nb_rx++; stats->packets++; stats->bytes += rxm->pkt_len; @@ -1052,7 +1050,7 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) static __rte_always_inline void ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do, - void *service_cb_arg) + struct ionic_rx_service *rx_svc) { struct ionic_cq *cq = &rxq->qcq.cq; struct ionic_queue *q = &rxq->qcq.q; @@ -1088,7 +1086,7 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do, rte_prefetch0(&q->info[q->tail_idx]); ionic_rx_clean(rxq, curr_q_tail_idx, curr_cq_tail_idx, - service_cb_arg); + rx_svc); } while (more); @@ -1127,15 +1125,15 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { struct ionic_rx_qcq *rxq = rx_queue; - struct ionic_rx_service service_cb_arg; + struct ionic_rx_service rx_svc; - service_cb_arg.rx_pkts = rx_pkts; - service_cb_arg.nb_pkts = nb_pkts; - service_cb_arg.nb_rx = 0; + rx_svc.rx_pkts = rx_pkts; + rx_svc.nb_pkts = nb_pkts; + rx_svc.nb_rx = 0; - ionic_rxq_service(rxq, nb_pkts, &service_cb_arg); + ionic_rxq_service(rxq, nb_pkts, &rx_svc); ionic_rx_fill(rxq); - return service_cb_arg.nb_rx; + return rx_svc.nb_rx; } From patchwork Tue Oct 18 19:41:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118482 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CB685A0560; Tue, 18 Oct 2022 21:45:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BEEE1410EE; Tue, 18 Oct 2022 21:45:32 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id 80B19410EE for ; Tue, 18 Oct 2022 21:45:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I9GWeE6OPNqMUO4R2tvVTlhuHkst/QdkRogXuqWm9qjEKX+wTdaVwNZHrDnIPeglKPhJFh82hE1n+EPsr+9AXoxjpj3FmdFS50kU3z9EmOZH23WM++SQIoFm6E7z0DOXaIOP+gTkVR1CdM53JLUi4JyiJohvAT+KPOAKdo0eQCNhYqZRQR1tY7l6Wws15ySS9dxea4Bf2Sajq3aPsLvKCKpQ5UyIj6ZtmM8sJ45OSFubjXqPat+g/48J45bX4ltXK+8ZH+AgJnnAjnBHXz+8LIt1RjiX6H2Paes3N7xsnOxLE7/BjPRPIoMGqe1CU9GSc1Ps9F/fOKZ4tH28Dwta3A== 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=/blywBohpRAVyMYcXh0XcsCxdC1aLdu1CP9P54GtcU0=; b=BfCLsl1WDNRCu6NWYxupAN7jXC5MUQldDEDSCB0cpDuJ2hifRg7gsRksgVK7HsLlHUySD6f5I6IodIN3+m+kJUyHMm05kkQ+I54V7uzfaE1VklCGryED+sC6bMiRFqBgr+vxucfCnOytMQ3fbArJkK5ricD/rqvvRV/gOAo1kBkVPsV5rUfChArbEXbTv04YgcXyR80sg4ssLNaipHoypa+Si8UezvEjiV6wlRvBchzLzvrG8AAYaWDAetg+0WcNDXQkwRyYQ7De3242VEVobOGuV4zHHHobgkqO8EWTyXrMezKFSbVaZ0eqAw0IGXRkluwNknE40L+mW/tWP3Okuw== 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=/blywBohpRAVyMYcXh0XcsCxdC1aLdu1CP9P54GtcU0=; b=hSNSpeztSpsf+t4s1I/i5s098YZ+AdOyxtYCr9IPaBQlIqLXOHSg/22bVVJ1dpKiWnAGLl3YhSNCWoL0qKDcrn4Pgr9yYbpNfN3OSjYJ/P6Jsak4crNHqosjKjK+v5Gw9j3Fzb2gBRf0+py5ynJwTRqSgTkFO/ocvy0dBHl4PVE= Received: from DS7PR03CA0041.namprd03.prod.outlook.com (2603:10b6:5:3b5::16) by SA3PR12MB7950.namprd12.prod.outlook.com (2603:10b6:806:31c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 18 Oct 2022 19:45:30 +0000 Received: from DM6NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b5:cafe::37) by DS7PR03CA0041.outlook.office365.com (2603:10b6:5:3b5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.31 via Frontend Transport; Tue, 18 Oct 2022 19:45:30 +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 DM6NAM11FT034.mail.protection.outlook.com (10.13.173.47) 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:45:29 +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:45:07 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 16/36] net/ionic: free all buffers during Rx queue stop Date: Tue, 18 Oct 2022 12:41:11 -0700 Message-ID: <20221018194131.23006-17-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 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: DM6NAM11FT034:EE_|SA3PR12MB7950:EE_ X-MS-Office365-Filtering-Correlation-Id: af8154d1-0f5f-4457-0d75-08dab1415003 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jeZ9bjNud8kcZhpYzaQbaFzE93MvK1OaV/NaCVI/wM0sNlLymjvdQEuge0pxTicK2CprDBt3n/Drl9tNh0aX8AIN2PxBCGZUgd28N3Un9CP2W8QoO05e7q5ngVJzR1+XiFe8KZZQc4bFLnFjylTl1NkwEQ2RSEKSiIGf2pBOyI6YDKRuNBOJvfcxVRK5yuKqBk2N16O2Gz1/i92ijtfHagTX8WXRMlZAgW5mgtqd+MuCFMov4hAvYNUS3O4VeAvqssjHeTwTFAT0LmyiOjppWbawlFuMZRb8unaKToRECrfxNZoZsAmsVimrNzi/j79MNxr+7BWZKu3JvmB46cF3fnzfAoHLywCJbjl1xQ3WGHWtPgriAtU7r3PHH18gjIEU4Qva88QC6UerYnXrjsO0FybksdYoXc+F3c/DsbZZdEL4E6eTAX/vYfGDoiOp+BSydpLW+CsJitrWHsUGRAjeHPy5NyMzCzWoIvXIXigND5QoeNzrgjn/1v9/8k6LxCYFBf39HSrvymIgnsqJfw2/5Dizn2CX7OcykMk7Q/bZBD5Co1bkuLvhWycG4xdwDQHCubgtuM39+C4j2VDsb8COxOKcGp5vSfkWUaqU0F9olAjsTnYZoxKfVV+fZm0rkJrM6dV+rWWLPnfa1nY45HhylIj2lxlFAeWWdos5Ct7N38GMcGfihix6N25PVW7thVo2viz3qwdZI61YZgqgGQO9yZknmKEe3YPygAStqlyQmFetNzT8eiQWQMEAJVlWEz/wEE7U92iK9jWlwuF1Ky06vLTD08u2Ug377Wnd0sz5zfBJ0ImX4xDOK2y/+EqxBO9d 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)(376002)(396003)(39860400002)(346002)(451199015)(46966006)(40470700004)(36840700001)(186003)(426003)(47076005)(336012)(36860700001)(16526019)(1076003)(2906002)(82310400005)(5660300002)(316002)(6916009)(2616005)(86362001)(82740400003)(41300700001)(26005)(6666004)(8676002)(70206006)(70586007)(30864003)(83380400001)(40480700001)(81166007)(4326008)(356005)(8936002)(40460700003)(44832011)(478600001)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:45:29.8933 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: af8154d1-0f5f-4457-0d75-08dab1415003 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: DM6NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7950 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 Free all of the mbufs in the receive queue when the queue is stopped. This will allow them to be resized when the MTU is changed. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_dev.c | 16 +++++ drivers/net/ionic/ionic_dev.h | 2 + drivers/net/ionic/ionic_lif.c | 32 ++++----- drivers/net/ionic/ionic_lif.h | 4 -- drivers/net/ionic/ionic_rxtx.c | 116 +++++++++++++++------------------ 5 files changed, 81 insertions(+), 89 deletions(-) diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c index 1082a007d3..70c14882ed 100644 --- a/drivers/net/ionic/ionic_dev.c +++ b/drivers/net/ionic/ionic_dev.c @@ -317,6 +317,15 @@ ionic_cq_init(struct ionic_cq *cq, uint16_t num_descs) return 0; } +void +ionic_cq_reset(struct ionic_cq *cq) +{ + cq->tail_idx = 0; + cq->done_color = 1; + + memset(cq->base, 0, sizeof(struct ionic_nop_comp) * cq->num_descs); +} + void ionic_cq_map(struct ionic_cq *cq, void *base, rte_iova_t base_pa) { @@ -379,3 +388,10 @@ ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa) q->sg_base = base; q->sg_base_pa = base_pa; } + +void +ionic_q_reset(struct ionic_queue *q) +{ + q->head_idx = 0; + q->tail_idx = 0; +} diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index 6dab7e5bbd..b77de30de1 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -225,6 +225,7 @@ struct ionic_doorbell __iomem *ionic_db_map(struct ionic_lif *lif, struct ionic_queue *q); int ionic_cq_init(struct ionic_cq *cq, uint16_t num_descs); +void ionic_cq_reset(struct ionic_cq *cq); void ionic_cq_map(struct ionic_cq *cq, void *base, rte_iova_t base_pa); typedef bool (*ionic_cq_cb)(struct ionic_cq *cq, uint16_t cq_desc_index, void *cb_arg); @@ -232,6 +233,7 @@ uint32_t ionic_cq_service(struct ionic_cq *cq, uint32_t work_to_do, ionic_cq_cb cb, void *cb_arg); int ionic_q_init(struct ionic_queue *q, uint32_t index, uint16_t num_descs); +void ionic_q_reset(struct ionic_queue *q); void ionic_q_map(struct ionic_queue *q, void *base, rte_iova_t base_pa); void ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa); diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index ccd7ea68bb..e7cb9e2ea3 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -30,25 +30,7 @@ static const uint8_t ionic_qtype_vers[IONIC_QTYPE_MAX] = { static int ionic_lif_addr_add(struct ionic_lif *lif, const uint8_t *addr); static int ionic_lif_addr_del(struct ionic_lif *lif, const uint8_t *addr); -int -ionic_qcq_enable(struct ionic_qcq *qcq) -{ - struct ionic_queue *q = &qcq->q; - struct ionic_lif *lif = qcq->lif; - struct ionic_admin_ctx ctx = { - .pending_work = true, - .cmd.q_control = { - .opcode = IONIC_CMD_Q_CONTROL, - .type = q->type, - .index = rte_cpu_to_le_32(q->index), - .oper = IONIC_Q_ENABLE, - }, - }; - - return ionic_adminq_post_wait(lif, &ctx); -} - -int +static int ionic_qcq_disable(struct ionic_qcq *qcq) { struct ionic_queue *q = &qcq->q; @@ -133,7 +115,6 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats for (i = 0; i < lif->nrxqcqs; i++) { struct ionic_rx_stats *rx_stats = &lif->rxqcqs[i]->stats; stats->ierrors += - rx_stats->no_cb_arg + rx_stats->bad_cq_status + rx_stats->no_room + rx_stats->bad_len; @@ -154,7 +135,6 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats stats->q_ipackets[i] = rx_stats->packets; stats->q_ibytes[i] = rx_stats->bytes; stats->q_errors[i] = - rx_stats->no_cb_arg + rx_stats->bad_cq_status + rx_stats->no_room + rx_stats->bad_len; @@ -1146,12 +1126,16 @@ ionic_lif_rss_teardown(struct ionic_lif *lif) void ionic_lif_txq_deinit(struct ionic_tx_qcq *txq) { + ionic_qcq_disable(&txq->qcq); + txq->flags &= ~IONIC_QCQ_F_INITED; } void ionic_lif_rxq_deinit(struct ionic_rx_qcq *rxq) { + ionic_qcq_disable(&rxq->qcq); + rxq->flags &= ~IONIC_QCQ_F_INITED; } @@ -1488,6 +1472,9 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq) ctx.cmd.q_init.ring_size); IONIC_PRINT(DEBUG, "txq_init.ver %u", ctx.cmd.q_init.ver); + ionic_q_reset(q); + ionic_cq_reset(cq); + err = ionic_adminq_post_wait(lif, &ctx); if (err) return err; @@ -1536,6 +1523,9 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq) ctx.cmd.q_init.ring_size); IONIC_PRINT(DEBUG, "rxq_init.ver %u", ctx.cmd.q_init.ver); + ionic_q_reset(q); + ionic_cq_reset(cq); + err = ionic_adminq_post_wait(lif, &ctx); if (err) return err; diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index c87f981803..a8f7458327 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -39,7 +39,6 @@ struct ionic_tx_stats { struct ionic_rx_stats { uint64_t packets; uint64_t bytes; - uint64_t no_cb_arg; uint64_t bad_cq_status; uint64_t no_room; uint64_t bad_len; @@ -207,9 +206,6 @@ int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, struct ionic_tx_qcq **qcq_out); void ionic_qcq_free(struct ionic_qcq *qcq); -int ionic_qcq_enable(struct ionic_qcq *qcq); -int ionic_qcq_disable(struct ionic_qcq *qcq); - int ionic_lif_rxq_init(struct ionic_rx_qcq *rxq); void ionic_lif_rxq_deinit(struct ionic_rx_qcq *rxq); diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index c90d3d62f3..b2c3639e51 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -47,6 +47,34 @@ #include "ionic_lif.h" #include "ionic_rxtx.h" +static void +ionic_empty_array(void **array, uint32_t cnt, uint16_t idx) +{ + uint32_t i; + + for (i = idx; i < cnt; i++) + if (array[i]) + rte_pktmbuf_free_seg(array[i]); + + memset(array, 0, sizeof(void *) * cnt); +} + +static void __rte_cold +ionic_tx_empty(struct ionic_tx_qcq *txq) +{ + struct ionic_queue *q = &txq->qcq.q; + + ionic_empty_array(q->info, q->num_descs, 0); +} + +static void __rte_cold +ionic_rx_empty(struct ionic_rx_qcq *rxq) +{ + struct ionic_queue *q = &rxq->qcq.q; + + ionic_empty_array(q->info, q->num_descs, 0); +} + /********************************************************************* * * TX functions @@ -121,21 +149,16 @@ void __rte_cold ionic_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid) { struct ionic_tx_qcq *txq = dev->data->tx_queues[qid]; - struct ionic_tx_stats *stats = &txq->stats; IONIC_PRINT_CALL(); - IONIC_PRINT(DEBUG, "TX queue %u pkts %ju tso %ju", - txq->qcq.q.index, stats->packets, stats->tso); - - ionic_lif_txq_deinit(txq); - ionic_qcq_free(&txq->qcq); } int __rte_cold ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) { + struct ionic_tx_stats *stats; struct ionic_tx_qcq *txq; IONIC_PRINT(DEBUG, "Stopping TX queue %u", tx_queue_id); @@ -150,9 +173,14 @@ ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) * before disabling Tx queue */ - ionic_qcq_disable(&txq->qcq); + ionic_lif_txq_deinit(txq); - ionic_tx_flush(txq); + /* Free all buffers from descriptor ring */ + ionic_tx_empty(txq); + + stats = &txq->stats; + IONIC_PRINT(DEBUG, "TX queue %u pkts %ju tso %ju", + txq->qcq.q.index, stats->packets, stats->tso); return 0; } @@ -236,13 +264,9 @@ ionic_dev_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) IONIC_PRINT(DEBUG, "Starting TX queue %u, %u descs", tx_queue_id, txq->qcq.q.num_descs); - if (!(txq->flags & IONIC_QCQ_F_INITED)) { - err = ionic_lif_txq_init(txq); - if (err) - return err; - } else { - ionic_qcq_enable(&txq->qcq); - } + err = ionic_lif_txq_init(txq); + if (err) + return err; tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED; @@ -648,42 +672,16 @@ ionic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, qinfo->conf.offloads = dev->data->dev_conf.rxmode.offloads; } -static void __rte_cold -ionic_rx_empty(struct ionic_rx_qcq *rxq) -{ - struct ionic_queue *q = &rxq->qcq.q; - struct rte_mbuf *mbuf; - void **info; - - while (q->tail_idx != q->head_idx) { - info = IONIC_INFO_PTR(q, q->tail_idx); - mbuf = info[0]; - rte_mempool_put(rxq->mb_pool, mbuf); - - q->tail_idx = Q_NEXT_TO_SRVC(q, 1); - } -} - void __rte_cold ionic_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid) { struct ionic_rx_qcq *rxq = dev->data->rx_queues[qid]; - struct ionic_rx_stats *stats; if (!rxq) return; IONIC_PRINT_CALL(); - stats = &rxq->stats; - - IONIC_PRINT(DEBUG, "RX queue %u pkts %ju mtod %ju", - rxq->qcq.q.index, stats->packets, stats->mtods); - - ionic_rx_empty(rxq); - - ionic_lif_rxq_deinit(rxq); - ionic_qcq_free(&rxq->qcq); } @@ -787,17 +785,6 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq, rxm = info[0]; - if (!rx_svc) { - stats->no_cb_arg++; - /* Flush */ - rte_pktmbuf_free(rxm); - /* - * Note: rte_mempool_put is faster with no segs - * rte_mempool_put(rxq->mb_pool, rxm); - */ - return; - } - if (cq_desc->status) { stats->bad_cq_status++; ionic_rx_recycle(q, q_desc_index, rxm); @@ -1028,13 +1015,9 @@ 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", rx_queue_id, rxq->qcq.q.num_descs, rxq->frame_size); - if (!(rxq->flags & IONIC_QCQ_F_INITED)) { - err = ionic_lif_rxq_init(rxq); - if (err) - return err; - } else { - ionic_qcq_enable(&rxq->qcq); - } + err = ionic_lif_rxq_init(rxq); + if (err) + return err; /* Allocate buffers for descriptor rings */ if (ionic_rx_fill(rxq) != 0) { @@ -1103,19 +1086,24 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do, int __rte_cold ionic_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) { + uint8_t *rx_queue_state = eth_dev->data->rx_queue_state; + struct ionic_rx_stats *stats; struct ionic_rx_qcq *rxq; IONIC_PRINT(DEBUG, "Stopping RX queue %u", rx_queue_id); rxq = eth_dev->data->rx_queues[rx_queue_id]; - eth_dev->data->rx_queue_state[rx_queue_id] = - RTE_ETH_QUEUE_STATE_STOPPED; + rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED; + + ionic_lif_rxq_deinit(rxq); - ionic_qcq_disable(&rxq->qcq); + /* Free all buffers from descriptor ring */ + ionic_rx_empty(rxq); - /* Flush */ - ionic_rxq_service(rxq, -1, NULL); + stats = &rxq->stats; + IONIC_PRINT(DEBUG, "RX queue %u pkts %ju mtod %ju", + rxq->qcq.q.index, stats->packets, stats->mtods); return 0; } From patchwork Tue Oct 18 19:41:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118483 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D2643A0560; Tue, 18 Oct 2022 21:45:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 172214281C; Tue, 18 Oct 2022 21:45:36 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2060.outbound.protection.outlook.com [40.107.94.60]) by mails.dpdk.org (Postfix) with ESMTP id 4210B415D7 for ; Tue, 18 Oct 2022 21:45:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U65bNM+7HGiXc8SrMZ7/ve1gAzKbJ/ZieAG01KMFhkwpob30qbPn+M5R7Cs3hS0hdL9NcIc7ryGHD7a82CYz/yjWMrjM7UA4xnS11L7HWQdtfMcy2dCmArOiyzPtYZ1yWrZvn8zCMgydc2zhPL/vMgdXpqR6Ir3gVTKI6xtyMdpFEmFLD/Y+hLl1+W4kXOHQk7TUz+KE7PkTSX7fAdiUG0bpbKJCYTBhOill/7J8RpAJesCAuTBf9kVGjQPl3XszCsUGaBGmbTUNWLaqY6HJs80/wPelsB5dlhwmQUWGqFXRJsfS7lbzAE9mJ1PHPz72N+GJcBzdlYvYcWZgsgIZBw== 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=/plRzEbidZa0fRUb9wPjdVOElRgH16MrksZpkMTytdA=; b=hc4LhtYT2w+ehkNqASkWFyBw4TL/6n9PITMGeuNE6aIiVvD2DHQh3tZE4rb0XIA9CK//w3cBSzDjxP4SOQpK3BEDFI6/k9Vwa8sIWpNGBXKy4MZS1EutQmH25GStQ9ouo6lxtS/D+RB5vmV7kOJS2IeHrfvrghnrKf7vQWdvFOzFxMyENLTb0GqaqO/BgQRGb7y0OoABjoKuP6DFSE5cO1phQe2KtNIqR/dpp0LrBJ0YAVERLno81IJWooM7453DtsLLiMa7fUdCse1uwgr0FLZOKiwSwhp7QE1m3bGgEtlVIs3ldOdCOHBicRMzcvxScDpy7lJDIvpPj++aK/2GNw== 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=/plRzEbidZa0fRUb9wPjdVOElRgH16MrksZpkMTytdA=; b=NiDOAycKp74JzzEUSDCJSv6uXPVLR/Fnpz3BophQs5aL2nYv2bQvv0bYZ3Ak6qr3g6r/5RVXnmg1sNaF+6NLcAgzVViuUOLTJEJD6uvHpGQe1ILVLbuzd+k26TVRV0h3CJu+1haA6DnUv3Siq4BIeiJqGtcz26H+o8O1XfqTzdE= Received: from BN9P221CA0027.NAMP221.PROD.OUTLOOK.COM (2603:10b6:408:10a::21) by DM4PR12MB5104.namprd12.prod.outlook.com (2603:10b6:5:393::24) 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:45:31 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10a:cafe::4a) by BN9P221CA0027.outlook.office365.com (2603:10b6:408:10a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30 via Frontend Transport; Tue, 18 Oct 2022 19:45:31 +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 BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) 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:45:31 +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:45:29 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 17/36] net/ionic: precalculate segment lengths on receive side Date: Tue, 18 Oct 2022 12:41:12 -0700 Message-ID: <20221018194131.23006-18-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 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: BN8NAM11FT016:EE_|DM4PR12MB5104:EE_ X-MS-Office365-Filtering-Correlation-Id: 99528f1c-3ee9-41fd-175a-08dab14150ab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PmYv7G084E8+cqonS18537EF1GmBPF+CI18uDK2rVwE4zKTAyYezUG40UA4YELsz6/bF/ccyyaFUZeBTeHIhf/muHTqEjIH5rGlqTZGSf+AYiYmlOv9yefHIK/E1h/Od2g3eRc/eC7gMDgpst+YnA+1eUBfXuBIrdXEAur+4KFXxehcrHmLJxZTXmCjU3wc+pRVO+HWYEmlwzlbQs9NmivrqC0ZVcittkvwbddkKbEfMrRQDY3TK7NbTPGswZXrapAYzpP+2b4kfIWSVp1L/6C8rwjCHvoBnm3l6x2DfVZ2pBXuQ7XnCVh/2zy0XxVUZLQIr5zZ84fZy5LLnGsw6PFTVlrRfXO6s2l0O6J20aFMmevOYy5iqtQE8lfj1QowGXbNnHnG2M2HbIay4NOwp+pRpLalhBkUZRVpVraBhr9xQW3Boq4smm8z1d9iJuKaIhVOb1XZWz+zgnYxweHsTRVTegpfc/8M9hVe4c4WhDm4bLpX5CjC22eA9K1Ce+abxcmTZRmd0Go2n1cTwlyhEj22mDXHm2fgPeHiAIaSzmhIXxGAZJncj6aPPiqzE5M9HirVT6y3y31asqfN53boaEqu06cJxxIIcUZSTPPdPiG6sIc2PZZjccFcxwd+1Nc+4cIWETXXI9qvaFj016LEbtohhqPwuMtV2y7JPsfdyjZjCclVGDFGD7kgcqatBbtX3anqcbqw/vrAyRNOcELNYi4Ryzp6yzsn2p6d27Bznly6z21FpWzn7z0Gm6U4YGIS2vUCm20w20BFGy4pNMjiYtmcBvEahtBqtMqgXDgDTPPU= 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)(136003)(396003)(346002)(376002)(451199015)(46966006)(36840700001)(40470700004)(82310400005)(44832011)(356005)(81166007)(83380400001)(47076005)(316002)(70586007)(40480700001)(70206006)(426003)(2616005)(26005)(478600001)(5660300002)(8936002)(36756003)(82740400003)(16526019)(86362001)(1076003)(36860700001)(6916009)(4326008)(8676002)(41300700001)(186003)(2906002)(336012)(40460700003)(6666004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:45:31.0258 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 99528f1c-3ee9-41fd-175a-08dab14150ab 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: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5104 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 The first (header) segment includes the standard headroom. Subsequent segments do not. Store the fragment counts in the queue structure. Precalculating improves performance by reducing how much work must be done in the hot path. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_dev.h | 1 + drivers/net/ionic/ionic_lif.c | 36 ++++++++++++++++++++++++-- drivers/net/ionic/ionic_lif.h | 4 ++- drivers/net/ionic/ionic_rxtx.c | 46 ++++++++++++++-------------------- 4 files changed, 57 insertions(+), 30 deletions(-) diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index b77de30de1..aff49ae34d 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -137,6 +137,7 @@ struct ionic_dev { struct ionic_queue { uint16_t num_descs; + uint16_t num_segs; uint16_t head_idx; uint16_t tail_idx; uint16_t size_mask; diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index e7cb9e2ea3..2bc2362453 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -566,6 +566,7 @@ ionic_qcq_alloc(struct ionic_lif *lif, const char *type_name, uint16_t flags, uint16_t num_descs, + uint16_t num_segs, uint16_t desc_size, uint16_t cq_desc_size, uint16_t sg_desc_size, @@ -616,6 +617,7 @@ ionic_qcq_alloc(struct ionic_lif *lif, goto err_out_free_qcq; } + new->q.num_segs = num_segs; new->q.type = type; err = ionic_q_init(&new->q, index, num_descs); @@ -698,14 +700,38 @@ ionic_qcq_free(struct ionic_qcq *qcq) int ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, - uint16_t nrxq_descs, struct ionic_rx_qcq **rxq_out) + uint16_t nrxq_descs, struct rte_mempool *mb_pool, + struct ionic_rx_qcq **rxq_out) { struct ionic_rx_qcq *rxq; - uint16_t flags; + uint16_t flags, seg_size, hdr_seg_size, max_segs, max_segs_fw; + uint32_t max_mtu; int err; flags = IONIC_QCQ_F_SG; + seg_size = rte_pktmbuf_data_room_size(mb_pool); + + /* The first mbuf needs to leave headroom */ + hdr_seg_size = seg_size - RTE_PKTMBUF_HEADROOM; + + max_mtu = rte_le_to_cpu_32(lif->adapter->ident.lif.eth.max_mtu); + + max_segs_fw = IONIC_RX_MAX_SG_ELEMS + 1; + + /* + * Calculate how many fragment pointers might be stored in queue. + */ + max_segs = 1 + (max_mtu + RTE_PKTMBUF_HEADROOM - 1) / seg_size; + + IONIC_PRINT(DEBUG, "rxq %u frame_size %u seg_size %u max_segs %u", + index, lif->frame_size, seg_size, max_segs); + if (max_segs > max_segs_fw) { + IONIC_PRINT(ERR, "Rx mbuf size insufficient (%d > %d avail)", + max_segs, max_segs_fw); + return -EINVAL; + } + err = ionic_qcq_alloc(lif, IONIC_QTYPE_RXQ, sizeof(struct ionic_rx_qcq), @@ -714,6 +740,7 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, "rx", flags, nrxq_descs, + max_segs, sizeof(struct ionic_rxq_desc), sizeof(struct ionic_rxq_comp), sizeof(struct ionic_rxq_sg_desc), @@ -722,6 +749,8 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, return err; rxq->flags = flags; + rxq->seg_size = seg_size; + rxq->hdr_seg_size = hdr_seg_size; lif->rxqcqs[index] = rxq; *rxq_out = rxq; @@ -749,6 +778,7 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, "tx", flags, ntxq_descs, + 1, sizeof(struct ionic_txq_desc), sizeof(struct ionic_txq_comp), sizeof(struct ionic_txq_sg_desc_v1), @@ -779,6 +809,7 @@ ionic_admin_qcq_alloc(struct ionic_lif *lif) "admin", flags, IONIC_ADMINQ_LENGTH, + 1, sizeof(struct ionic_admin_cmd), sizeof(struct ionic_admin_comp), 0, @@ -805,6 +836,7 @@ ionic_notify_qcq_alloc(struct ionic_lif *lif) "notify", flags, IONIC_NOTIFYQ_LENGTH, + 1, sizeof(struct ionic_notifyq_cmd), sizeof(union ionic_notifyq_comp), 0, diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index a8f7458327..8650200ec7 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -81,6 +81,8 @@ struct ionic_rx_qcq { /* cacheline2 */ struct rte_mempool *mb_pool; uint16_t frame_size; /* Based on configured MTU */ + uint16_t hdr_seg_size; /* Length of first segment of RX chain */ + uint16_t seg_size; /* Length of all subsequent segments */ uint16_t flags; /* cacheline3 (inside stats) */ @@ -199,7 +201,7 @@ int ionic_dev_allmulticast_enable(struct rte_eth_dev *dev); int ionic_dev_allmulticast_disable(struct rte_eth_dev *dev); int ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, - uint32_t index, uint16_t nrxq_descs, + uint32_t index, uint16_t nrxq_descs, struct rte_mempool *mp, struct ionic_rx_qcq **qcq_out); int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, uint16_t ntxq_descs, diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index b2c3639e51..27678ccb6e 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -732,7 +732,7 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, eth_dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED; - err = ionic_rx_qcq_alloc(lif, socket_id, rx_queue_id, nb_desc, + err = ionic_rx_qcq_alloc(lif, socket_id, rx_queue_id, nb_desc, mp, &rxq); if (err) { IONIC_PRINT(ERR, "Queue %d allocation failure", rx_queue_id); @@ -773,9 +773,6 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq, uint64_t pkt_flags = 0; uint32_t pkt_type; struct ionic_rx_stats *stats = &rxq->stats; - uint32_t buf_size = (uint16_t) - (rte_pktmbuf_data_room_size(rxq->mb_pool) - - RTE_PKTMBUF_HEADROOM); uint32_t left; void **info; @@ -809,14 +806,12 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq, rxm->pkt_len = cq_desc->len; rxm->port = rxq->qcq.lif->port_id; - left = cq_desc->len; - - rxm->data_len = RTE_MIN(buf_size, left); - left -= rxm->data_len; + rxm->data_len = RTE_MIN(rxq->hdr_seg_size, cq_desc->len); + left = cq_desc->len - rxm->data_len; rxm_seg = rxm->next; while (rxm_seg && left) { - rxm_seg->data_len = RTE_MIN(buf_size, left); + rxm_seg->data_len = RTE_MIN(rxq->seg_size, left); left -= rxm_seg->data_len; rxm_seg = rxm_seg->next; @@ -926,10 +921,7 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq) struct ionic_rxq_sg_elem *elem; void **info; rte_iova_t dma_addr; - uint32_t i, j, nsegs, buf_size, size; - - buf_size = (uint16_t)(rte_pktmbuf_data_room_size(rxq->mb_pool) - - RTE_PKTMBUF_HEADROOM); + uint32_t i, j; /* Initialize software ring entries */ for (i = ionic_q_space_avail(q); i; i--) { @@ -943,21 +935,18 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq) info = IONIC_INFO_PTR(q, q->head_idx); - nsegs = (rxq->frame_size + buf_size - 1) / buf_size; - 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 = buf_size; - size = buf_size; - desc->opcode = (nsegs > 1) ? IONIC_RXQ_DESC_OPCODE_SG : + 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; sg_desc = &sg_desc_base[q->head_idx]; elem = sg_desc->elems; - for (j = 0; j < nsegs - 1 && j < IONIC_RX_MAX_SG_ELEMS; j++) { + for (j = 0; j < q->num_segs - 1u; j++) { struct rte_mbuf *rxm_seg; rte_iova_t data_iova; @@ -967,21 +956,18 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq) return -ENOMEM; } + rxm_seg->data_off = 0; data_iova = rte_mbuf_data_iova(rxm_seg); dma_addr = rte_cpu_to_le_64(data_iova); elem->addr = dma_addr; - elem->len = buf_size; - size += buf_size; + elem->len = rxq->seg_size; elem++; + rxm_seg->next = NULL; prev_rxm_seg->next = rxm_seg; prev_rxm_seg = rxm_seg; } - if (size < rxq->frame_size) - IONIC_PRINT(ERR, "Rx SG size is not sufficient (%d < %d)", - size, rxq->frame_size); - info[0] = rxm; q->head_idx = Q_NEXT_TO_POST(q, 1); @@ -1000,6 +986,7 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) { uint8_t *rx_queue_state = eth_dev->data->rx_queue_state; struct ionic_rx_qcq *rxq; + struct ionic_queue *q; int err; if (rx_queue_state[rx_queue_id] == RTE_ETH_QUEUE_STATE_STARTED) { @@ -1009,11 +996,16 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) } rxq = eth_dev->data->rx_queues[rx_queue_id]; + q = &rxq->qcq.q; rxq->frame_size = rxq->qcq.lif->frame_size - RTE_ETHER_CRC_LEN; - IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs, size %u", - rx_queue_id, rxq->qcq.q.num_descs, rxq->frame_size); + /* Recalculate segment count based on MTU */ + q->num_segs = 1 + + (rxq->frame_size + RTE_PKTMBUF_HEADROOM - 1) / rxq->seg_size; + + 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); err = ionic_lif_rxq_init(rxq); if (err) From patchwork Tue Oct 18 19:41:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118484 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 37D6BA0560; Tue, 18 Oct 2022 21:45:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 42D6F4114A; Tue, 18 Oct 2022 21:45:41 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2044.outbound.protection.outlook.com [40.107.243.44]) by mails.dpdk.org (Postfix) with ESMTP id AC36F427EB for ; Tue, 18 Oct 2022 21:45:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hx3v6+9Fs+c43rlpz/EXtv9PLhLiUs5+PGLdt61iK6HZsMDnaA5xxhdXEhN0hypVjO6E5DZ9fAeBUzV9cXINZ2pgT4giZsb/ILvKEBrwZtKy80WVWXw/HPwuIlnZxBpzKqX62GovI8gdLMVoxw0cN9+gbzppZO0ru2sApnGeXkoXYT73YuzBEBW5GxHEadB/W77DJXZ0nuUf2VLeUgzss9U/Ud1OCSrxvz5rE7nsZDCo6+LkJt6ZL+UGg0RHPrS3Sf29KpGtrlSl4HygtS69Eu6m0bHb5XPDAKwjaZNCwNrEFDtkOyp6VRN1NhD4jIg4SV2h/7o0JUNqeW/mpS5KeA== 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=R6pIdxgqZKO+FPAmzNLkSa9VhmjrGzRheXzlcoG8LRg=; b=OR3PEu6aHzd5L8kiIKsIuXuXMyQ63f9PAxFP/GamKlETPGhwP8c5kugiBqrrvauqSYdkkT3XPWaWFsQpyHNyyrTlms1lInFnr7/LCZxNuiT7YhRDoyDgOe35XhPpqQR8p+8Uktf82XwXdh4fxHu1hX211zHRuG8NIiyz2BYVnyigeoWU7F/fbJWZ5PPWr51rTGC+VU6fYTNuky3EFI+N0NDyqFCPP9cvF0svX0605cNcmF8HbjLtCtLvAOdjq6dTVlI7UXHZxSCQjUJU97sOUgKcBc6yhcZWLLplsAu05STLRPzIyJZ6LgPPHBfHby0cru/PbeO/SDXyxxYPgHE7dQ== 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=R6pIdxgqZKO+FPAmzNLkSa9VhmjrGzRheXzlcoG8LRg=; b=ehrWq7c+pCn0FgHrCd68NPOGnOAIxRWyI8SCxtsKkyEE7AnPg5iJT0dV3x7zUkUu1gA2Is7V2vzkup1W+ZBRf2TxIleoFyDUos+BzGvpJfCQa1A/HiQanej8LlGF3fK9ebFvLxce5kJrQBo8AfNpoVcIgEh3NG1VGINxQ+WyIh8= Received: from BN9P221CA0019.NAMP221.PROD.OUTLOOK.COM (2603:10b6:408:10a::34) by PH7PR12MB7116.namprd12.prod.outlook.com (2603:10b6:510:1ef::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32; Tue, 18 Oct 2022 19:45:35 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10a:cafe::c2) by BN9P221CA0019.outlook.office365.com (2603:10b6:408:10a::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30 via Frontend Transport; Tue, 18 Oct 2022 19:45:35 +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 BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) 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:45:35 +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:45:34 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 18/36] net/ionic: use a helper variable in packet Tx function Date: Tue, 18 Oct 2022 12:41:13 -0700 Message-ID: <20221018194131.23006-19-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 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: BN8NAM11FT016:EE_|PH7PR12MB7116:EE_ X-MS-Office365-Filtering-Correlation-Id: c8037347-9e2c-4ab1-ee62-08dab1415335 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bqge+nn7ln5+5wc6aGbE8vPUQZlfrnIri16sS3LZ5QzOozoO3Bnnc0VZcEeMrDbax71S1UyEEUx3EzaI0k24FWHx6lWfCUs/gqiBx7Bss4x3ezD323NRGN9KaUG7sG5kbsV+pRw1qEpLlWYAj2F0OVEaPjLQrRFlKG0AAXtigV6WB0bi4rFrNouZGWzSG2sreOKJmN11tKJahNwpGg/RkDTG2zXunuQVK97AfsR1Luv0uNRcGuaVpyx2hwparqIiuf8atcg3iftwJ6PZ92Ooupg9iAGBQ+tgh0XKHCRFWN7Pit2mek5/dJnLO34DViSOE26gMPxEqQ5AwKfqyQZ3DTIvFHby+31vU5N5tEGK1LdUV5Jo0r69SiwOFhzyIXdW4IqsxrvwqHG9S0lFcXzUtf99I1+xyxUIPqx0wS9ubtsfNh7ZsrHjs6tVFqQlAj+aqBo0Lfzt0q4vQP+Nhu6olyaLsYHZd9dCsldEsbSXLkwvh5g5koMfJttIYVZ1L+OYN1K2QF4nfsJCjWQcZeJ+5H02PBTc9cJEipefjQHTO6wjzrzW5xSgP8YVYaOPmzDvEZ2xbZeXVyGO3oTHSiJKiptDYlXNgX6vsookKmBVhbNY3Dg7eCOktGTDoX6gBz/C0Pz+I6FoIaWHlmAAcNX86Wr8RWTtgT0Xruftbw1Imsz6qGGKwi7y56RjDzKmaDQMLpPV4he5e7ta3zc/zh9Rh9CarENrmFprOQ7VGKMdoclEpkQw18G1JsZM5MDqfy82hJFawlBLVAdPmVOsOKQzSc0OfDy1BPrl6unUgRgF5zCB/YyIF63vqUgWNoRbBucX 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)(39860400002)(136003)(346002)(376002)(451199015)(40470700004)(46966006)(36840700001)(478600001)(82310400005)(36860700001)(40460700003)(40480700001)(316002)(426003)(47076005)(8936002)(83380400001)(82740400003)(2906002)(6916009)(8676002)(36756003)(86362001)(6666004)(70206006)(70586007)(4326008)(41300700001)(2616005)(1076003)(356005)(186003)(16526019)(26005)(44832011)(5660300002)(81166007)(336012)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:45:35.2911 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8037347-9e2c-4ab1-ee62-08dab1415335 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: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7116 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 readability. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_rxtx.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 27678ccb6e..93a29a0326 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -560,6 +560,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, struct ionic_tx_qcq *txq = tx_queue; struct ionic_queue *q = &txq->qcq.q; struct ionic_tx_stats *stats = &txq->stats; + struct rte_mbuf *mbuf; uint32_t next_q_head_idx; uint32_t bytes_tx = 0; uint16_t nb_avail, nb_tx = 0; @@ -582,16 +583,18 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, rte_prefetch0(&q->info[next_q_head_idx]); } - if (tx_pkts[nb_tx]->ol_flags & RTE_MBUF_F_TX_TCP_SEG) - err = ionic_tx_tso(txq, tx_pkts[nb_tx]); + mbuf = tx_pkts[nb_tx]; + + if (mbuf->ol_flags & RTE_MBUF_F_TX_TCP_SEG) + err = ionic_tx_tso(txq, mbuf); else - err = ionic_tx(txq, tx_pkts[nb_tx]); + err = ionic_tx(txq, mbuf); if (err) { stats->drop += nb_pkts - nb_tx; break; } - bytes_tx += tx_pkts[nb_tx]->pkt_len; + bytes_tx += mbuf->pkt_len; nb_tx++; } From patchwork Tue Oct 18 19:41:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118485 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 71233A0560; Tue, 18 Oct 2022 21:45:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 32CD040A8B; Tue, 18 Oct 2022 21:45:44 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id 2EDFB427EE for ; Tue, 18 Oct 2022 21:45:42 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=chYuSvBvUZHL9zPZLruGB1fJMkFp7s3rvJ5vMRHAWPtq1kNgzxWR1+q0+IoMu/KH/njKywTdD041GzknFKIzxKanQ4dBkyZ3I14GruolY8XShlmWAalkRGk3PAFcpPBfnaXGq/tCunQeVqt5yuwm31fD284oFpv2pJqxOdnP7LWnYztEkn39Ye/Vb11u2ScBluL2V0HDggUin89oy+JgTWs/YcAiAiWVag08qxk46l+7LwEdhqth0gGQtZ5wkN7nMQwvIDG4rV/tVJXWw3tcM2eVcIqO+F5PgfKcTw7RgyWd6WHn+BEC8VqctzUEvxYCZXsb2ZTqqB9grFa9IcnRJg== 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=++7Aq6SVfmeh7NggLwUH9NQkRhnJPAMAlJKGu8DW8UE=; b=k1Jv4NqfTVymXvLntavf5U4SDlsEfWir5Wc1HbpqficPwK+4RY1wJT0nOIJ5mAeWsEY66JOHydiRm/pCdzl3G5IlYjx/pW2ihLrDX6u9HlcLOn9P6o2I58MxR2zKYVdW5PpJ09vGrkd0dwzbf4Hk1EaIdWt/nweJyyfXHZuLwKj5hqvkqmMBzDvP5Fpk5CLpy8z669ZmoW8DlS9U80cBQLO/CmK0odGuS027IytnjJFHsZafk0zxgyz8Pxl+aOKTkp7/zPApuax/dyW6zuYfkHPbs4WFY9dCbii3TYizS5U2W/hZEl+GRmPQBCBv82S2+kNvmnUQP1UhJC0LOqrbdg== 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=++7Aq6SVfmeh7NggLwUH9NQkRhnJPAMAlJKGu8DW8UE=; b=xHRelLvTO8PjH+kz6YSMGwWey1Mb6zbn1WC2Yuvr69oSzCWMm77U85ajvohJ9l+3XRrJ9Zalm+dv/S11LbJsJEktP3vdMFTwX1uT3JTyD15p8BsV+6g4uim3omnIkVBsT92rE9yLG+VaUaEd1XvYQBuYXApRaoOYEPOBevIPkwg= Received: from DS7PR03CA0225.namprd03.prod.outlook.com (2603:10b6:5:3ba::20) by PH7PR12MB6936.namprd12.prod.outlook.com (2603:10b6:510:1ba::7) 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:45:40 +0000 Received: from DM6NAM11FT083.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ba:cafe::18) by DS7PR03CA0225.outlook.office365.com (2603:10b6:5:3ba::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.33 via Frontend Transport; Tue, 18 Oct 2022 19:45:40 +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 DM6NAM11FT083.mail.protection.outlook.com (10.13.173.97) 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:45:39 +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:45:39 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 19/36] net/ionic: do one-time init of receive descriptors Date: Tue, 18 Oct 2022 12:41:14 -0700 Message-ID: <20221018194131.23006-20-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 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: DM6NAM11FT083:EE_|PH7PR12MB6936:EE_ X-MS-Office365-Filtering-Correlation-Id: ac94913c-d826-475f-fc89-08dab1415603 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fKVUmtIjyjUcCjzzLegGN+WQUVXzTjBZEeLsnU6bgC0Vz9MgcsM5F5YIyGkMFDV+wf61F0D2yNXHEO9kpTIupSD0BXziOJ6CZlUecOhS0Sd0Eq+/aRwGjhJoVsqPYMglZGSjsgqlTVoNyGMJHXG+mCMhLIFYv3LhfHnFJhVxJhSug9ogjhDJ4jN0XWuMOqCZmFJkk6gEaufwF6aoWeMJ1fO1HueRKKMpwk13egtqHQrw3q71K1BJHke0jvJIFb1/K0RwG/aTB+eOBdA6XQ0G2Ho0x7HDCImDYW0rFff1bbi01dOGcgwy4wBMkLl4iyDc63yFvQMr/DYwhwU1gJtr0ukHBPElT1IxQxMaMSJGu0U0bukTa7rMdXP22HC/WAE2I6/ynaykqres4qTLf9u8GepITPqzIUlkD0kkQJ87SjMXDAvbblYcZgAMRteONEh8C24wOwy17qAPIt9Ftxg50cIkSmg+NOgYwewlj8YlHwcl6cDXMWDaoZk3zfi0lL+UCAIZlVPsEtN9rTJGdX4KSjVUGiRI/HxizVkvJVlxMY58aeTE/ZkR8Yen+lG5nNCGzkg4VsS2hTdYfpFiu4noni4yF4nK+M8eZh95F37AHbyus3u6Cw2RfPMKwPfBPSvMxdpFaIW5PAnaMsfOPPYUImdWRAEclm1w8j+QwKV6BzEYj+aG1qNP2s1HwXTFZ1sHVROec4mdXJ4JsK4xNazDuVpcgUoY0ggqVNmgftj309TH6bg0BGnbGBTc+T+ewiNt4dXtPb1bfBUZdD5tllfu8lvekkmzPGQJAIYPo5Ay9Ww= 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)(346002)(396003)(136003)(376002)(39860400002)(451199015)(46966006)(40470700004)(36840700001)(36756003)(86362001)(81166007)(356005)(82740400003)(2906002)(83380400001)(6666004)(40460700003)(5660300002)(40480700001)(44832011)(26005)(16526019)(336012)(1076003)(186003)(2616005)(47076005)(426003)(36860700001)(478600001)(82310400005)(6916009)(41300700001)(316002)(70586007)(70206006)(8676002)(4326008)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:45:39.9657 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac94913c-d826-475f-fc89-08dab1415603 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: DM6NAM11FT083.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6936 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 93a29a0326..9812604c3f 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; From patchwork Tue Oct 18 19:41:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118487 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 12C6DA0560; Tue, 18 Oct 2022 21:46:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A063F4281B; Tue, 18 Oct 2022 21:45:58 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2064.outbound.protection.outlook.com [40.107.94.64]) by mails.dpdk.org (Postfix) with ESMTP id 6AE4340395 for ; Tue, 18 Oct 2022 21:45:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S/oVVsTCW74v2pT0Qx38kXLPlBMiY7EzN6mu7D9NJBJcgDY2VFG2n+gcQ5Lv48ut/od7kf0e7R2Ei30OIqONss/vjq4KMq8jtbUJeIf211+y+iF/tNsYDhCWhcAtqD1UQYtvViAcx4TjGG3aYaIb8sLT/j3nH9pv2MlVy4lzhVB7ZQy8wBipyjYEFmNmEBsgS71SjQ45+vR6XbBOa8cTzUxstMONGl/jckJhIaxYU8BIMNG/R+puCSdgeQp12MtCgxnY6gR7mwSvoUvzgOovDNTb/C8iwPw9yBnK/QLBV1l0zLGBUuMjRLzLThGaGOnZtl2Me85xu7kw/7tBp79djA== 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=JFuj9AALrPJkvJ5AC3J1WUNnugCrimCIydVhWUkYuqM=; b=XLvHckvJIM0wtofUzlmKtJjM+9uFjpyGhJg628VOFuJEAXO45L42CHNIBFIiUdCeH45ktKIh+kNEnTeGaBjSI/kqpZq44+wunEYId3y0YhzSUyECbtzxXr8CnEkKz6g+12qyxWhZ8/efxtpAI3gHPfEujFH2EgkDpvHJQWgk2rZRWaNGUgUmtoulYXSf3SqbYuTLpGDAv3sZXh1kwDVga0mfWNEEm8nv8jLVk5mtA1rOO2ZUYqM2QS9T07lpHEKBaKaTs4TL0ZjmA1XusJotpcP2W3SRrf236qx3RlKEhcw5vW2rKzMUp8H9Pnaej3pR7Bv63871ZnQDZpyXsU8u3A== 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=JFuj9AALrPJkvJ5AC3J1WUNnugCrimCIydVhWUkYuqM=; b=h4ufgyMbdizPKt7GqaZi1Ljjfe4J3gT2fsFb8e59J8QMhogJ7f1vZK2jOLlGvaYTyI+FpK84OBzlGsijf8zRNHoEyoHmdMHCCFeu7vgb33L39ntH0Xa0IM5s4CD9AEnNNvaxotYvtBgTLVrTD4nMarIbr46sc84wtUoZhicWOBc= Received: from DM6PR18CA0033.namprd18.prod.outlook.com (2603:10b6:5:15b::46) by CO6PR12MB5457.namprd12.prod.outlook.com (2603:10b6:5:355::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Tue, 18 Oct 2022 19:45:53 +0000 Received: from DM6NAM11FT090.eop-nam11.prod.protection.outlook.com (2603:10b6:5:15b:cafe::6f) by DM6PR18CA0033.outlook.office365.com (2603:10b6:5:15b::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26 via Frontend Transport; Tue, 18 Oct 2022 19:45:53 +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 DM6NAM11FT090.mail.protection.outlook.com (10.13.172.184) 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:45:53 +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:45:52 -0500 From: Andrew Boyer To: CC: Andrew Boyer , Neel Patel Subject: [PATCH v2 20/36] net/ionic: overhaul receive side for performance Date: Tue, 18 Oct 2022 12:41:15 -0700 Message-ID: <20221018194131.23006-21-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 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: DM6NAM11FT090:EE_|CO6PR12MB5457:EE_ X-MS-Office365-Filtering-Correlation-Id: 745796b9-8248-4821-6756-08dab1415df1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WuZLzeB2IwA3XWUWO7eLU1zhSYerG+IK/7SIof7vIOofQ4/t+3LclL6viXUf8w+sHhI4GVouahkEccoDfDZKQCd8Fzi10gbZUd61J1NH8VLlBQ7HZo3oIXPuGAZUCW7prxJVCDzqEkV/qx5XhxI41ErN+XFNZQSU1HPCaXasO9CZCu0EnhjDem6R+4v5YlxKdDfIEU/L1uv/dExMgNFj2/oZaGvOYgx6SjvN8h+NZv4UpWDphI0KOUClBaEfW5ibpEsLQNCkSu5Txphd7O3ApB9cE8N6o377vyYo+7o1ARl2cmMsjlzbG4Xgrp6W6fhjM7osbkfr8AcTnHwkRJ2CIpHVncgoG56PojWywfsBeEuWFk749bWDvqR9svBBvOFDpVEt1o95JqrQxSNy2Tl1p3cYTVCsMKv6YE1Bk39F0Q15GkJ3eIHkRz20MJ/NrfwwWy+cMESbmqadTgiEVG3qo8rz0nGItHCg3Id9HbgeU6n5U5cquFkM+9iHgL0qQZ11kZQzUe4Zd+AeKEkOC7gZNSqYM9ZXcaN0TeX6X2HQBS8aB6jkAwWVnfGwkvZK2ksvJGokY7DaJOu0yjOjuRJllvRDK2z+rPGtTlkjqvCFPoPttLGHccjggdbsTUut6Z8Q3CwMvonOk7j1xaOczqEWUZ+d8HYpvDB5fX3c5S6ISleLisRrvfOS7TNqtqM7RURON3peUexp0Eravw6RlPT6grV+jMAo2oq1l230m+Y0TozbAIIob/okxx7H0um2X95k7X3BWDUSg2Glw4PK6dXveQQLqXHSqspciK31Fpp+DygQF3MJYhuJ6y3rCxETIcEd 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)(136003)(39860400002)(376002)(346002)(451199015)(40470700004)(46966006)(36840700001)(81166007)(478600001)(356005)(82740400003)(82310400005)(40460700003)(8676002)(186003)(1076003)(16526019)(2616005)(316002)(54906003)(6916009)(70586007)(70206006)(6666004)(86362001)(36756003)(5660300002)(36860700001)(26005)(41300700001)(8936002)(30864003)(4326008)(40480700001)(2906002)(44832011)(47076005)(426003)(83380400001)(336012)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:45:53.2813 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 745796b9-8248-4821-6756-08dab1415df1 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: DM6NAM11FT090.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5457 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 Linearize RX mbuf chains in the expanded info array. Clean one and fill one per CQE (completions are not coalesced). Touch the mbufs as little as possible in the fill stage. When touching the mbuf in the clean stage, use the rearm_data unions. Ring the doorbell once at the end of the bulk clean/fill. Signed-off-by: Neel Patel Signed-off-by: Andrew Boyer --- doc/guides/rel_notes/release_22_11.rst | 1 + drivers/net/ionic/ionic_dev.h | 2 +- drivers/net/ionic/ionic_lif.c | 49 +++++- drivers/net/ionic/ionic_lif.h | 3 +- drivers/net/ionic/ionic_rxtx.c | 225 ++++++++++++------------- drivers/net/ionic/ionic_rxtx.h | 1 - 6 files changed, 159 insertions(+), 122 deletions(-) diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index 4656607aae..72ddb43f51 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -145,6 +145,7 @@ New Features Updated the ionic PMD with new features and improvements, including: * Updated to reflect that Pensando has been acquired by AMD. + * Enhanced data path to provide substantial performance improvements. * **Updated Intel iavf driver.** diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index aff49ae34d..312f195e58 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -132,7 +132,7 @@ struct ionic_dev { #define Q_NEXT_TO_POST(_q, _n) (((_q)->head_idx + (_n)) & ((_q)->size_mask)) #define Q_NEXT_TO_SRVC(_q, _n) (((_q)->tail_idx + (_n)) & ((_q)->size_mask)) -#define IONIC_INFO_IDX(_q, _i) (_i) +#define IONIC_INFO_IDX(_q, _i) ((_i) * (_q)->num_segs) #define IONIC_INFO_PTR(_q, _i) (&(_q)->info[IONIC_INFO_IDX((_q), _i)]) struct ionic_queue { diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 2bc2362453..ede368d8ca 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -116,7 +116,6 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats struct ionic_rx_stats *rx_stats = &lif->rxqcqs[i]->stats; stats->ierrors += rx_stats->bad_cq_status + - rx_stats->no_room + rx_stats->bad_len; } @@ -136,7 +135,6 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats stats->q_ibytes[i] = rx_stats->bytes; stats->q_errors[i] = rx_stats->bad_cq_status + - rx_stats->no_room + rx_stats->bad_len; } @@ -608,8 +606,9 @@ ionic_qcq_alloc(struct ionic_lif *lif, new->lif = lif; + /* Most queue types will store 1 ptr per descriptor */ new->q.info = rte_calloc_socket("ionic", - num_descs, sizeof(void *), + num_descs * num_segs, sizeof(void *), rte_mem_page_size(), socket_id); if (!new->q.info) { IONIC_PRINT(ERR, "Cannot allocate queue info"); @@ -698,6 +697,42 @@ ionic_qcq_free(struct ionic_qcq *qcq) rte_free(qcq); } +static uint64_t +ionic_rx_rearm_data(struct ionic_lif *lif) +{ + struct rte_mbuf rxm; + + memset(&rxm, 0, sizeof(rxm)); + + rte_mbuf_refcnt_set(&rxm, 1); + rxm.data_off = RTE_PKTMBUF_HEADROOM; + rxm.nb_segs = 1; + rxm.port = lif->port_id; + + rte_compiler_barrier(); + + RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data[0]) != sizeof(uint64_t)); + return rxm.rearm_data[0]; +} + +static uint64_t +ionic_rx_seg_rearm_data(struct ionic_lif *lif) +{ + struct rte_mbuf rxm; + + memset(&rxm, 0, sizeof(rxm)); + + rte_mbuf_refcnt_set(&rxm, 1); + rxm.data_off = 0; /* no headroom */ + rxm.nb_segs = 1; + rxm.port = lif->port_id; + + rte_compiler_barrier(); + + RTE_BUILD_BUG_ON(sizeof(rxm.rearm_data[0]) != sizeof(uint64_t)); + return rxm.rearm_data[0]; +} + int ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, uint16_t nrxq_descs, struct rte_mempool *mb_pool, @@ -721,11 +756,13 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, /* * Calculate how many fragment pointers might be stored in queue. + * This is the worst-case number, so that there's enough room in + * the info array. */ max_segs = 1 + (max_mtu + RTE_PKTMBUF_HEADROOM - 1) / seg_size; - IONIC_PRINT(DEBUG, "rxq %u frame_size %u seg_size %u max_segs %u", - index, lif->frame_size, seg_size, max_segs); + IONIC_PRINT(DEBUG, "rxq %u max_mtu %u seg_size %u max_segs %u", + index, max_mtu, seg_size, max_segs); if (max_segs > max_segs_fw) { IONIC_PRINT(ERR, "Rx mbuf size insufficient (%d > %d avail)", max_segs, max_segs_fw); @@ -751,6 +788,8 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, rxq->flags = flags; rxq->seg_size = seg_size; rxq->hdr_seg_size = hdr_seg_size; + rxq->rearm_data = ionic_rx_rearm_data(lif); + rxq->rearm_seg_data = ionic_rx_seg_rearm_data(lif); lif->rxqcqs[index] = rxq; *rxq_out = rxq; diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index 8650200ec7..ce31b66a1e 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -40,7 +40,6 @@ struct ionic_rx_stats { uint64_t packets; uint64_t bytes; uint64_t bad_cq_status; - uint64_t no_room; uint64_t bad_len; uint64_t mtods; }; @@ -80,6 +79,8 @@ struct ionic_rx_qcq { /* cacheline2 */ struct rte_mempool *mb_pool; + uint64_t rearm_data; + uint64_t rearm_seg_data; uint16_t frame_size; /* Based on configured MTU */ uint16_t hdr_seg_size; /* Length of first segment of RX chain */ uint16_t seg_size; /* Length of all subsequent segments */ diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 9812604c3f..a4082e9ba4 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -72,7 +72,11 @@ ionic_rx_empty(struct ionic_rx_qcq *rxq) { struct ionic_queue *q = &rxq->qcq.q; - ionic_empty_array(q->info, q->num_descs, 0); + /* + * Walk the full info array so that the clean up includes any + * fragments that were left dangling for later reuse + */ + ionic_empty_array(q->info, q->num_descs * q->num_segs, 0); } /********************************************************************* @@ -658,9 +662,6 @@ ionic_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) * **********************************************************************/ -static void ionic_rx_recycle(struct ionic_queue *q, uint32_t q_desc_index, - struct rte_mbuf *mbuf); - void ionic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_rxq_info *qinfo) @@ -763,64 +764,67 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, return 0; } +/* + * Cleans one descriptor. Connects the filled mbufs into a chain. + * Does not advance the tail index. + */ static __rte_always_inline void -ionic_rx_clean(struct ionic_rx_qcq *rxq, - uint32_t q_desc_index, uint32_t cq_desc_index, +ionic_rx_clean_one(struct ionic_rx_qcq *rxq, + struct ionic_rxq_comp *cq_desc, struct ionic_rx_service *rx_svc) { struct ionic_queue *q = &rxq->qcq.q; - struct ionic_cq *cq = &rxq->qcq.cq; - struct ionic_rxq_comp *cq_desc_base = cq->base; - struct ionic_rxq_comp *cq_desc = &cq_desc_base[cq_desc_index]; - struct rte_mbuf *rxm, *rxm_seg; + struct rte_mbuf *rxm, *rxm_seg, *prev_rxm; + struct ionic_rx_stats *stats = &rxq->stats; uint64_t pkt_flags = 0; uint32_t pkt_type; - struct ionic_rx_stats *stats = &rxq->stats; - uint32_t left; + uint32_t left, i; + uint16_t cq_desc_len; void **info; - assert(q_desc_index == cq_desc->comp_index); + cq_desc_len = rte_le_to_cpu_16(cq_desc->len); - info = IONIC_INFO_PTR(q, cq_desc->comp_index); + info = IONIC_INFO_PTR(q, q->tail_idx); rxm = info[0]; if (cq_desc->status) { stats->bad_cq_status++; - ionic_rx_recycle(q, q_desc_index, rxm); - return; - } - - if (rx_svc->nb_rx >= rx_svc->nb_pkts) { - stats->no_room++; - ionic_rx_recycle(q, q_desc_index, rxm); return; } - if (cq_desc->len > rxq->frame_size || cq_desc->len == 0) { + if (cq_desc_len > rxq->frame_size || cq_desc_len == 0) { stats->bad_len++; - ionic_rx_recycle(q, q_desc_index, rxm); return; } - rxm->data_off = RTE_PKTMBUF_HEADROOM; - rte_prefetch1((char *)rxm->buf_addr + rxm->data_off); - rxm->nb_segs = 1; /* cq_desc->num_sg_elems */ - rxm->pkt_len = cq_desc->len; - rxm->port = rxq->qcq.lif->port_id; + info[0] = NULL; - rxm->data_len = RTE_MIN(rxq->hdr_seg_size, cq_desc->len); - left = cq_desc->len - rxm->data_len; + /* Set the mbuf metadata based on the cq entry */ + rxm->rearm_data[0] = rxq->rearm_data; + rxm->pkt_len = cq_desc_len; + rxm->data_len = RTE_MIN(rxq->hdr_seg_size, cq_desc_len); + left = cq_desc_len - rxm->data_len; + rxm->nb_segs = cq_desc->num_sg_elems + 1; + prev_rxm = rxm; - rxm_seg = rxm->next; - while (rxm_seg && left) { + for (i = 1; i < rxm->nb_segs && left; i++) { + rxm_seg = info[i]; + info[i] = NULL; + + /* Set the chained mbuf metadata */ + rxm_seg->rearm_data[0] = rxq->rearm_seg_data; rxm_seg->data_len = RTE_MIN(rxq->seg_size, left); left -= rxm_seg->data_len; - rxm_seg = rxm_seg->next; - rxm->nb_segs++; + /* Link the mbuf */ + prev_rxm->next = rxm_seg; + prev_rxm = rxm_seg; } + /* Terminate the mbuf chain */ + prev_rxm->next = NULL; + /* RSS */ pkt_flags |= RTE_MBUF_F_RX_RSS_HASH; rxm->hash.rss = rte_le_to_cpu_32(cq_desc->rss_hash); @@ -897,77 +901,74 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq, stats->bytes += rxm->pkt_len; } -static void -ionic_rx_recycle(struct ionic_queue *q, uint32_t q_desc_index, - struct rte_mbuf *mbuf) -{ - struct ionic_rxq_desc *desc_base = q->base; - struct ionic_rxq_desc *old = &desc_base[q_desc_index]; - struct ionic_rxq_desc *new = &desc_base[q->head_idx]; - - new->addr = old->addr; - new->len = old->len; - - q->info[q->head_idx] = mbuf; - - q->head_idx = Q_NEXT_TO_POST(q, 1); - - ionic_q_flush(q); -} - +/* + * Fills one descriptor with mbufs. Does not advance the head index. + */ static __rte_always_inline int -ionic_rx_fill(struct ionic_rx_qcq *rxq) +ionic_rx_fill_one(struct ionic_rx_qcq *rxq) { struct ionic_queue *q = &rxq->qcq.q; + struct rte_mbuf *rxm, *rxm_seg; struct ionic_rxq_desc *desc, *desc_base = q->base; struct ionic_rxq_sg_desc *sg_desc, *sg_desc_base = q->sg_base; - struct ionic_rxq_sg_elem *elem; + rte_iova_t data_iova; + uint32_t i; void **info; - rte_iova_t dma_addr; - uint32_t i, j; - /* Initialize software ring entries */ - for (i = ionic_q_space_avail(q); i; i--) { - struct rte_mbuf *rxm = rte_mbuf_raw_alloc(rxq->mb_pool); - struct rte_mbuf *prev_rxm_seg; + info = IONIC_INFO_PTR(q, q->head_idx); + desc = &desc_base[q->head_idx]; + sg_desc = &sg_desc_base[q->head_idx]; + + /* mbuf is unused => whole chain is unused */ + if (unlikely(info[0])) + return 0; + + rxm = rte_mbuf_raw_alloc(rxq->mb_pool); + if (unlikely(rxm == NULL)) { + assert(0); + return -ENOMEM; + } + + info[0] = rxm; + + data_iova = rte_mbuf_data_iova_default(rxm); + desc->addr = rte_cpu_to_le_64(data_iova); - if (rxm == NULL) { - IONIC_PRINT(ERR, "RX mbuf alloc failed"); + for (i = 1; i < q->num_segs; i++) { + /* mbuf is unused => rest of the chain is unused */ + if (info[i]) + return 0; + + rxm_seg = rte_mbuf_raw_alloc(rxq->mb_pool); + if (rxm_seg == NULL) { + assert(0); return -ENOMEM; } - info = IONIC_INFO_PTR(q, q->head_idx); + info[i] = rxm_seg; - desc = &desc_base[q->head_idx]; - dma_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(rxm)); - desc->addr = dma_addr; - rxm->next = NULL; - - prev_rxm_seg = rxm; - sg_desc = &sg_desc_base[q->head_idx]; - elem = sg_desc->elems; - for (j = 0; j < q->num_segs - 1u; j++) { - struct rte_mbuf *rxm_seg; - rte_iova_t data_iova; - - rxm_seg = rte_mbuf_raw_alloc(rxq->mb_pool); - if (rxm_seg == NULL) { - IONIC_PRINT(ERR, "RX mbuf alloc failed"); - return -ENOMEM; - } + /* The data_off does not get set to 0 until later */ + data_iova = rxm_seg->buf_iova; + sg_desc->elems[i - 1].addr = rte_cpu_to_le_64(data_iova); + } - rxm_seg->data_off = 0; - data_iova = rte_mbuf_data_iova(rxm_seg); - dma_addr = rte_cpu_to_le_64(data_iova); - elem->addr = dma_addr; - elem++; + return 0; +} - rxm_seg->next = NULL; - prev_rxm_seg->next = rxm_seg; - prev_rxm_seg = rxm_seg; - } +/* + * Fills all descriptors with mbufs. + */ +static int __rte_cold +ionic_rx_fill(struct ionic_rx_qcq *rxq) +{ + struct ionic_queue *q = &rxq->qcq.q; + uint32_t i; + int err; - info[0] = rxm; + for (i = 1; i < q->num_descs; i++) { + err = ionic_rx_fill_one(rxq); + if (err) + return err; q->head_idx = Q_NEXT_TO_POST(q, 1); } @@ -1056,53 +1057,52 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) return 0; } +/* + * Walk the CQ to find completed receive descriptors. + * Any completed descriptor found is refilled. + */ static __rte_always_inline void ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do, struct ionic_rx_service *rx_svc) { struct ionic_cq *cq = &rxq->qcq.cq; struct ionic_queue *q = &rxq->qcq.q; + struct ionic_rxq_desc *q_desc_base = q->base; struct ionic_rxq_comp *cq_desc, *cq_desc_base = cq->base; - bool more; - uint32_t curr_q_tail_idx, curr_cq_tail_idx; uint32_t work_done = 0; - if (work_to_do == 0) - return; - cq_desc = &cq_desc_base[cq->tail_idx]; + while (color_match(cq_desc->pkt_type_color, cq->done_color)) { - curr_cq_tail_idx = cq->tail_idx; cq->tail_idx = Q_NEXT_TO_SRVC(cq, 1); if (cq->tail_idx == 0) cq->done_color = !cq->done_color; - /* Prefetch the next 4 descriptors */ - if ((cq->tail_idx & 0x3) == 0) - rte_prefetch0(&cq_desc_base[cq->tail_idx]); - - do { - more = (q->tail_idx != cq_desc->comp_index); + /* Prefetch 8 x 8B bufinfo */ + rte_prefetch0(IONIC_INFO_PTR(q, Q_NEXT_TO_SRVC(q, 8))); + /* Prefetch 4 x 16B comp */ + rte_prefetch0(&cq_desc_base[Q_NEXT_TO_SRVC(cq, 4)]); + /* Prefetch 4 x 16B descriptors */ + rte_prefetch0(&q_desc_base[Q_NEXT_TO_POST(q, 4)]); - curr_q_tail_idx = q->tail_idx; - q->tail_idx = Q_NEXT_TO_SRVC(q, 1); + ionic_rx_clean_one(rxq, cq_desc, rx_svc); - /* Prefetch the next 4 descriptors */ - if ((q->tail_idx & 0x3) == 0) - /* q desc info */ - rte_prefetch0(&q->info[q->tail_idx]); + q->tail_idx = Q_NEXT_TO_SRVC(q, 1); - ionic_rx_clean(rxq, curr_q_tail_idx, curr_cq_tail_idx, - rx_svc); + (void)ionic_rx_fill_one(rxq); - } while (more); + q->head_idx = Q_NEXT_TO_POST(q, 1); if (++work_done == work_to_do) break; cq_desc = &cq_desc_base[cq->tail_idx]; } + + /* Update the queue indices and ring the doorbell */ + if (work_done) + ionic_q_flush(q); } /* @@ -1141,12 +1141,9 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, struct ionic_rx_service rx_svc; rx_svc.rx_pkts = rx_pkts; - rx_svc.nb_pkts = nb_pkts; rx_svc.nb_rx = 0; ionic_rxq_service(rxq, nb_pkts, &rx_svc); - ionic_rx_fill(rxq); - return rx_svc.nb_rx; } diff --git a/drivers/net/ionic/ionic_rxtx.h b/drivers/net/ionic/ionic_rxtx.h index e55e86c8b3..6f9f3f92c6 100644 --- a/drivers/net/ionic/ionic_rxtx.h +++ b/drivers/net/ionic/ionic_rxtx.h @@ -10,7 +10,6 @@ struct ionic_rx_service { /* cb in */ struct rte_mbuf **rx_pkts; - uint16_t nb_pkts; /* cb out */ uint16_t nb_rx; }; From patchwork Tue Oct 18 19:41:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118488 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 60359A0560; Tue, 18 Oct 2022 21:46:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 894E0427EB; Tue, 18 Oct 2022 21:46:01 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2079.outbound.protection.outlook.com [40.107.223.79]) by mails.dpdk.org (Postfix) with ESMTP id 02D7942829 for ; Tue, 18 Oct 2022 21:45:59 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k/oXbesVEZMeE2gR+aBvNKDmbuOm0eFO6CWNkOQvdBMDnLOxaSqF4L1NNkUmWkS2b+nUreexN1rX8yqw6HTDgx+8w5GwnHQ/aWZAVfQzjdemCZC+lN85lbkd1J7GUyGUdXSLv4f7832gl/av1CCpHe4zi0N3byNt5m/CvONXMdJhRqJvTVbI4AClOIrqVuwtVV8bnMqO9iEecP0aUiE5uyM3WXKqVFEXJEku1KfhRJFrbdvWmdAsxpvsd2ALP3/8qD1WGOsFGOh3OH9Hst5hd4I5x+i9MpIxfuuxoyw7wYEiv1it1sHOGxJqjHVmiTgL5bveN8IsmxNh9Zv9pjc/tA== 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=Q1U7vBTyWlTxK1R+HcSMQAHiYyssv4+UuCVvovtLfcw=; b=EOQm/BueKGxgnI5433vUWLFnszAMujeO9mNlwpdpNCVei6pI6T+8LjV8W/K1toViob+eAmBRyre6PL1zEowjwPwdrweFv+i5oPEjs+c3h7w5PRruQnICM05WQugqzanG0M+L22CrjaJQDi2RLtOuJcJT4XVXKSDhhlCAKQLr3ZQAn5P1jUXOtouhl3dXug7a1doXyM9ZnZMf5PsMzWSRZhJV2/4ODFZEZT9c7sgF25VO+REseLWyHR827/wIiGvwFfsCJ9g+bc6oxsrQ68VJhkkKhi8x10MxXerl1/LaHrK4YBortge52WE8b6QaX2DF2tiWKu8wTZM9pol26Fk3qg== 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=Q1U7vBTyWlTxK1R+HcSMQAHiYyssv4+UuCVvovtLfcw=; b=Gsz4/aF9eeVpH4jEioaGDv0djY0b+mLtm4sn4MY/eLpvJs04eXZqRFFNXoYGZlxW+CFP6N6mIyhMTi7Q+ERTI4cZN5VYvw+d7l+W43G2ofKU8uzbpH9JTauyifsJ4vaVHAFGfMwwORluXy5KDuGwWfEknePLgod2pcNYpOwLRq0= Received: from DS7P222CA0001.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::7) by DM6PR12MB4250.namprd12.prod.outlook.com (2603:10b6:5:21a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34; Tue, 18 Oct 2022 19:45:57 +0000 Received: from DM6NAM11FT084.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2e:cafe::25) by DS7P222CA0001.outlook.office365.com (2603:10b6:8:2e::7) 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:45:57 +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 DM6NAM11FT084.mail.protection.outlook.com (10.13.172.132) 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:45:57 +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:45:56 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 21/36] net/ionic: overhaul transmit side for performance Date: Tue, 18 Oct 2022 12:41:16 -0700 Message-ID: <20221018194131.23006-22-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 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: DM6NAM11FT084:EE_|DM6PR12MB4250:EE_ X-MS-Office365-Filtering-Correlation-Id: 195a3abb-66b1-4ab0-d26d-08dab1416038 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wKJqWPaeSmnZn437fkbLVGSrv+f5Q8FYaJXT2kBrBbttm3PNs1hX6wu+40nxLAKkGugrxzgSs0wIvJkQ1efp9Z1KjEQGf7EBaWKZOf5GcTG/JLmFu6vuvkgno/Z29CxyIxJmDhX6Zmxr1QPv83lGDZzyfBU3SdvSZtTR6eleARABrg85o4EDYqymh28DGmTk0y6G/IJKf1ajfXACrONevapcPjV8iS5PQrDoMBFa9boZgZyzvJj5QFwGF1GFeBsKkyNlHVBPY8dE96WjjONTVn3n78OXV+bpawldWq6BbQz2X855Esh13sHYs0u4ZJ8UsPQSVo2F/P3m5gmwQuvoWpm5exHRoIDUCxB5KcRlapx+eKhXaUS1ZO8QRZW1mxPB2UpiAvN7DmLsjBVwfit3k1IgZUJ5nIJE72WV67Vfr62yGIP2KEN/iu85DpPhidsPufhpvImDwulfSX9gDKtDvZhCrkjfj+3YWOQ0hCA2Gg6A2R637/Gx8xT487B1CNeQiRUgVogkeAndGkbk2mAdR5nRG5CiKC86D7AS+k4GO9YpwpzqLZYQz8KElS8k6259UVGsv3gke6ulzZrPFBKcavmJqGlaZBQ2p8/8TqKAX9TiiKTMIMCPLnx7Bqk0SzOvk+3TE/PJ7v6Fe8t5CcjQKI0M56WhyCFoApsOcqcKw11bLhNrttXClKblZN497B5Kxm8SFS46bgg/ULMkxAGorOujkPZ4OUu9GBY5D6gs88f/5AHNGrqdaZF2/vna7YWEuttSmgHowkCuJlPh3wtAF8z5UdLbB+WwYvC/3K7yo/DJ4huezsge0UdGeWb/HCG27qgiVtCiaXv8i6+/BKdo4qOW0iWpEqHEU+TbXJDiMLc= 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)(376002)(346002)(396003)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(86362001)(36756003)(356005)(81166007)(82740400003)(2906002)(83380400001)(336012)(40460700003)(40480700001)(5660300002)(8936002)(44832011)(2616005)(16526019)(186003)(1076003)(47076005)(426003)(6666004)(26005)(36860700001)(478600001)(316002)(82310400005)(4326008)(6916009)(70586007)(70206006)(8676002)(41300700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:45:57.1048 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 195a3abb-66b1-4ab0-d26d-08dab1416038 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: DM6NAM11FT084.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4250 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 Linearize Tx mbuf chains in the info array. This avoids walking the mbuf chain during flush. Move a few branches out of the hot path. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 2 +- drivers/net/ionic/ionic_rxtx.c | 143 ++++++++++++++++++++------------- 2 files changed, 87 insertions(+), 58 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index ede368d8ca..4305587fe0 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -817,7 +817,7 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, "tx", flags, ntxq_descs, - 1, + num_segs_fw, sizeof(struct ionic_txq_desc), sizeof(struct ionic_txq_comp), sizeof(struct ionic_txq_sg_desc_v1), diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index a4082e9ba4..56701e90d4 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -64,7 +64,7 @@ ionic_tx_empty(struct ionic_tx_qcq *txq) { struct ionic_queue *q = &txq->qcq.q; - ionic_empty_array(q->info, q->num_descs, 0); + ionic_empty_array(q->info, q->num_descs * q->num_segs, 0); } static void __rte_cold @@ -102,50 +102,49 @@ ionic_tx_flush(struct ionic_tx_qcq *txq) { struct ionic_cq *cq = &txq->qcq.cq; struct ionic_queue *q = &txq->qcq.q; - struct rte_mbuf *txm, *next; - struct ionic_txq_comp *cq_desc_base = cq->base; - struct ionic_txq_comp *cq_desc; + struct rte_mbuf *txm; + struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base; void **info; - u_int32_t comp_index = (u_int32_t)-1; + uint32_t i; cq_desc = &cq_desc_base[cq->tail_idx]; + while (color_match(cq_desc->color, cq->done_color)) { cq->tail_idx = Q_NEXT_TO_SRVC(cq, 1); - - /* Prefetch the next 4 descriptors (not really useful here) */ - if ((cq->tail_idx & 0x3) == 0) - rte_prefetch0(&cq_desc_base[cq->tail_idx]); - if (cq->tail_idx == 0) cq->done_color = !cq->done_color; - comp_index = cq_desc->comp_index; + /* Prefetch 4 x 16B comp at cq->tail_idx + 4 */ + if ((cq->tail_idx & 0x3) == 0) + rte_prefetch0(&cq_desc_base[Q_NEXT_TO_SRVC(cq, 4)]); - cq_desc = &cq_desc_base[cq->tail_idx]; - } + while (q->tail_idx != rte_le_to_cpu_16(cq_desc->comp_index)) { + /* Prefetch 8 mbuf ptrs at q->tail_idx + 2 */ + rte_prefetch0(IONIC_INFO_PTR(q, Q_NEXT_TO_SRVC(q, 2))); - if (comp_index != (u_int32_t)-1) { - while (q->tail_idx != comp_index) { - info = IONIC_INFO_PTR(q, q->tail_idx); + /* Prefetch next mbuf */ + void **next_info = + IONIC_INFO_PTR(q, Q_NEXT_TO_SRVC(q, 1)); + if (next_info[0]) + rte_mbuf_prefetch_part2(next_info[0]); + if (next_info[1]) + rte_mbuf_prefetch_part2(next_info[1]); - q->tail_idx = Q_NEXT_TO_SRVC(q, 1); + info = IONIC_INFO_PTR(q, q->tail_idx); + for (i = 0; i < q->num_segs; i++) { + txm = info[i]; + if (!txm) + break; - /* Prefetch the next 4 descriptors */ - if ((q->tail_idx & 0x3) == 0) - /* q desc info */ - rte_prefetch0(&q->info[q->tail_idx]); - - /* - * Note: you can just use rte_pktmbuf_free, - * but this loop is faster - */ - txm = info[0]; - while (txm != NULL) { - next = txm->next; rte_pktmbuf_free_seg(txm); - txm = next; + + info[i] = NULL; } + + q->tail_idx = Q_NEXT_TO_SRVC(q, 1); } + + cq_desc = &cq_desc_base[cq->tail_idx]; } } @@ -327,9 +326,12 @@ ionic_tx_tso_post(struct ionic_queue *q, struct ionic_txq_desc *desc, uint16_t vlan_tci, bool has_vlan, bool start, bool done) { + struct rte_mbuf *txm_seg; void **info; uint64_t cmd; uint8_t flags = 0; + int i; + flags |= has_vlan ? IONIC_TXQ_DESC_FLAG_VLAN : 0; flags |= encap ? IONIC_TXQ_DESC_FLAG_ENCAP : 0; flags |= start ? IONIC_TXQ_DESC_FLAG_TSO_SOT : 0; @@ -345,7 +347,13 @@ ionic_tx_tso_post(struct ionic_queue *q, struct ionic_txq_desc *desc, if (done) { info = IONIC_INFO_PTR(q, q->head_idx); - info[0] = txm; + + /* Walk the mbuf chain to stash pointers in the array */ + txm_seg = txm; + for (i = 0; i < txm->nb_segs; i++) { + info[i] = txm_seg; + txm_seg = txm_seg->next; + } } q->head_idx = Q_NEXT_TO_POST(q, 1); @@ -497,8 +505,7 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) struct ionic_tx_stats *stats = &txq->stats; struct rte_mbuf *txm_seg; void **info; - bool encap; - bool has_vlan; + rte_iova_t data_iova; uint64_t ol_flags = txm->ol_flags; uint64_t addr, cmd; uint8_t opcode = IONIC_TXQ_DESC_OPCODE_CSUM_NONE; @@ -524,32 +531,44 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) if (opcode == IONIC_TXQ_DESC_OPCODE_CSUM_NONE) stats->no_csum++; - has_vlan = (ol_flags & RTE_MBUF_F_TX_VLAN); - encap = ((ol_flags & RTE_MBUF_F_TX_OUTER_IP_CKSUM) || - (ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM)) && - ((ol_flags & RTE_MBUF_F_TX_OUTER_IPV4) || - (ol_flags & RTE_MBUF_F_TX_OUTER_IPV6)); + if (((ol_flags & RTE_MBUF_F_TX_OUTER_IP_CKSUM) || + (ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM)) && + ((ol_flags & RTE_MBUF_F_TX_OUTER_IPV4) || + (ol_flags & RTE_MBUF_F_TX_OUTER_IPV6))) { + flags |= IONIC_TXQ_DESC_FLAG_ENCAP; + } - flags |= has_vlan ? IONIC_TXQ_DESC_FLAG_VLAN : 0; - flags |= encap ? IONIC_TXQ_DESC_FLAG_ENCAP : 0; + if (ol_flags & RTE_MBUF_F_TX_VLAN) { + flags |= IONIC_TXQ_DESC_FLAG_VLAN; + desc->vlan_tci = rte_cpu_to_le_16(txm->vlan_tci); + } addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm)); cmd = encode_txq_desc_cmd(opcode, flags, txm->nb_segs - 1, addr); desc->cmd = rte_cpu_to_le_64(cmd); desc->len = rte_cpu_to_le_16(txm->data_len); - desc->vlan_tci = rte_cpu_to_le_16(txm->vlan_tci); info[0] = txm; - elem = sg_desc_base[q->head_idx].elems; + if (txm->nb_segs > 1) { + txm_seg = txm->next; - txm_seg = txm->next; - while (txm_seg != NULL) { - elem->len = rte_cpu_to_le_16(txm_seg->data_len); - elem->addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm_seg)); - elem++; - txm_seg = txm_seg->next; + elem = sg_desc_base[q->head_idx].elems; + + while (txm_seg != NULL) { + /* Stash the mbuf ptr in the array */ + info++; + *info = txm_seg; + + /* Configure the SGE */ + data_iova = rte_mbuf_data_iova(txm_seg); + elem->len = rte_cpu_to_le_16(txm_seg->data_len); + elem->addr = rte_cpu_to_le_64(data_iova); + elem++; + + txm_seg = txm_seg->next; + } } q->head_idx = Q_NEXT_TO_POST(q, 1); @@ -565,11 +584,19 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, struct ionic_queue *q = &txq->qcq.q; struct ionic_tx_stats *stats = &txq->stats; struct rte_mbuf *mbuf; - uint32_t next_q_head_idx; uint32_t bytes_tx = 0; uint16_t nb_avail, nb_tx = 0; int err; + struct ionic_txq_desc *desc_base = q->base; + rte_prefetch0(&desc_base[q->head_idx]); + rte_prefetch0(IONIC_INFO_PTR(q, q->head_idx)); + + if (tx_pkts) { + rte_mbuf_prefetch_part1(tx_pkts[0]); + rte_mbuf_prefetch_part2(tx_pkts[0]); + } + /* Cleaning old buffers */ ionic_tx_flush(txq); @@ -580,11 +607,13 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, } while (nb_tx < nb_pkts) { - next_q_head_idx = Q_NEXT_TO_POST(q, 1); - if ((next_q_head_idx & 0x3) == 0) { - struct ionic_txq_desc *desc_base = q->base; - rte_prefetch0(&desc_base[next_q_head_idx]); - rte_prefetch0(&q->info[next_q_head_idx]); + uint16_t next_idx = Q_NEXT_TO_POST(q, 1); + rte_prefetch0(&desc_base[next_idx]); + rte_prefetch0(IONIC_INFO_PTR(q, next_idx)); + + if (nb_tx + 1 < nb_pkts) { + rte_mbuf_prefetch_part1(tx_pkts[nb_tx + 1]); + rte_mbuf_prefetch_part2(tx_pkts[nb_tx + 1]); } mbuf = tx_pkts[nb_tx]; @@ -605,10 +634,10 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, if (nb_tx > 0) { rte_wmb(); ionic_q_flush(q); - } - stats->packets += nb_tx; - stats->bytes += bytes_tx; + stats->packets += nb_tx; + stats->bytes += bytes_tx; + } return nb_tx; } From patchwork Tue Oct 18 19:41:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118489 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9D699A0560; Tue, 18 Oct 2022 21:46:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E1CA742B6C; Tue, 18 Oct 2022 21:46:05 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2073.outbound.protection.outlook.com [40.107.102.73]) by mails.dpdk.org (Postfix) with ESMTP id 596D440395 for ; Tue, 18 Oct 2022 21:46:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UNpfkzQ7VHNuthIF8IjQXkHrLGxnODGz9A0dBYEBkFP8obZjY0ewGPZxDl46zRh/Tp6MhZp88I4J3qglz+4obaAkRGGm/aGJgFLscRo1x4pPeb5eKPu4Pf5EGh46VPbG0sk4pcL/OQkAJGb2djIvpj/kuA/o/nBij+92n7ySF958Hub1JbqNguQB4ly9x0fJRGwjUS+XYfeZlc8dSdsW59pL/EOn0P8EPBaEV4EB/PKaA2DsBpWQK0tk2+X4XbpLcFeeCPibTS0oZFT/hTnMJ8bwgSOUQxEMo0Sdfyc1slIJ4H5IbVCsifMiQWmY96CDwW2TPJe6gPRIBoDiWqL6qg== 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=lAyDPG64GYEdfusXEI9C+32iTguxhOi3hdQ0bFwMP08=; b=i5y56uOuPpX/jv+HGye8ohxQAZkEtxjWmQC2zncBt/2HImumkNsFZlUxxRBq8a7wXJf0v2qOG5Q7QRoSlKmUj3XJwnFwDWz4Q8d7Ljz4PNvBNrxuBLRzrUFq1AvcDPFEgj3C8voB5dXoZ74DPKrQjR//AcrPRDdxZQboWxmTZMWhlt2LzJpyw5sKWX2U4s0l+n0hjMVgkdm/4FDQx6meeCfAoxoBohMmAlWEL7WdEUL4P78h719XeYUDO1c8j0hGqOUaGyw+kTJrbhyqvIVDCWF0Bq2sD59R651kXNknjpd+kLcCdBixRq6jbTeoMj37HDFaBycrPSgBHrzp41uRkg== 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=lAyDPG64GYEdfusXEI9C+32iTguxhOi3hdQ0bFwMP08=; b=uOCAVP/6YjZ9YurO0kKcHEzo3zeMCNbTHgk2UF17q/8jZ1M0zu/QdRUWRUbeXTjdCnkQYzhIdBiWA1r/NvuoqpoyDhMMnY+k3A9HLBdrip67TidPgKzNLbp/NB4CLIn9AYt9jdSqi+SFtbUOu82qiahIDsG+d2pE7GM/6dMg5KA= Received: from DS7PR05CA0105.namprd05.prod.outlook.com (2603:10b6:8:56::19) by CH0PR12MB5267.namprd12.prod.outlook.com (2603:10b6:610:d2::18) 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:01 +0000 Received: from DM6NAM11FT108.eop-nam11.prod.protection.outlook.com (2603:10b6:8:56:cafe::63) by DS7PR05CA0105.outlook.office365.com (2603:10b6:8:56::19) 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:01 +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 DM6NAM11FT108.mail.protection.outlook.com (10.13.172.95) 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:01 +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:00 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 22/36] net/ionic: add support for mbuf fast free Date: Tue, 18 Oct 2022 12:41:17 -0700 Message-ID: <20221018194131.23006-23-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 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: DM6NAM11FT108:EE_|CH0PR12MB5267:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ca71a71-0c50-4547-aea7-08dab14162ed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 92lhXCifoTmO3FkaK2aeSi0FsPqV60Y8zmkPkIBvG2H5wahhkW7kRlMpUZfipgQLiJUbHALFMzS65Yo25bqnMDDX91y2Hxn0cN96MVsjFYGEbufYcsL/WU65uVdUCs2XiLAb1KFt2fqf9jlnXpirwAsmwKWC9jsoLbt3W3BjuP8IFlDI1/c8H0CiWtEaJtHNwX8Ajixkxl0cLMEuzhIdmK/ukdScvT/hYouiL1SIhchm7xK2L5IHsJMEjxz4EC8rGEywM1421DEvYhUKJd+1FDIYK8kEiN8j7B0Zu81HT/u+QCVYHDiiWrjMup8+1HD4im8WydODJlg2yV0xKF8tUH7ERPwgWmVQfZ/77VXWeansn2Qfes444l+4uxRcL8WykJ3taEdIdN13E5XZneIEFGqVMhnnRX1YCLzCM9ja2703CaLY/mqL9njLbdoIA5hwsjLOlKr8fL0zP0nLunkfaiKH+Mt5DqcpBmZCo/i8qhdOG+VT3uKRYJ35h+Js67+ANJTq3tx3EREXvklQVIlyzOY6ktNR6JxWKRgz/BD+ApAkV7MwXrElkhMmgdjYtLLCJw8j8j8hOjrwL5k9YAljboK9hcvvM3kd58rxQKiKpNeWK7g00QA5ZhaNfy2kxtN+K7Hu5WE5uTgOerDYNGfVB4rEk5ek2Rtk7s/KsNlRF9zUQBEVKgO9OGUIx75qXyvRL+5G4200H2be9IuYE1XS4NfpL4AXM56q2XyWu0PDnQqECgsIc18Fz87Y0NpAYQNfdUTrSTUL6yemF2x8+ZFVfJKVRphn7RJDftDcNkQME8cURoLKIml2zvjj1bRJMMqJ 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)(346002)(376002)(396003)(136003)(39860400002)(451199015)(36840700001)(40470700004)(46966006)(86362001)(36756003)(81166007)(356005)(82740400003)(2906002)(336012)(40460700003)(5660300002)(40480700001)(44832011)(6666004)(26005)(1076003)(186003)(16526019)(2616005)(47076005)(426003)(83380400001)(36860700001)(316002)(478600001)(82310400005)(6916009)(41300700001)(70586007)(70206006)(8676002)(4326008)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:46:01.6456 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9ca71a71-0c50-4547-aea7-08dab14162ed 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: DM6NAM11FT108.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5267 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 Use a put() rather than a free() in the optimized case. Signed-off-by: Andrew Boyer --- doc/guides/nics/features/ionic.ini | 1 + doc/guides/rel_notes/release_22_11.rst | 1 + drivers/net/ionic/ionic_ethdev.c | 2 +- drivers/net/ionic/ionic_lif.h | 1 + drivers/net/ionic/ionic_rxtx.c | 9 ++++++++- 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/features/ionic.ini b/doc/guides/nics/features/ionic.ini index 5bd18e39e9..77947bfd22 100644 --- a/doc/guides/nics/features/ionic.ini +++ b/doc/guides/nics/features/ionic.ini @@ -7,6 +7,7 @@ Speed capabilities = Y Link status = Y Link status event = Y +Fast mbuf free = Y Queue start/stop = Y MTU update = Y Scattered Rx = Y diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index 72ddb43f51..4ad525375f 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -146,6 +146,7 @@ New Features * Updated to reflect that Pensando has been acquired by AMD. * Enhanced data path to provide substantial performance improvements. + * Added support for mbuf fast free. * **Updated Intel iavf driver.** diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 7d95e52346..7d21bc0a9b 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -396,7 +396,7 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev, */ dev_info->rx_queue_offload_capa = 0; - dev_info->tx_queue_offload_capa = 0; + dev_info->tx_queue_offload_capa = RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE; /* * Per-port capabilities diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index ce31b66a1e..547d4873be 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -50,6 +50,7 @@ struct ionic_rx_stats { #define IONIC_QCQ_F_CSUM_L3 BIT(7) #define IONIC_QCQ_F_CSUM_UDP BIT(8) #define IONIC_QCQ_F_CSUM_TCP BIT(9) +#define IONIC_QCQ_F_FAST_FREE BIT(10) /* Queue / Completion Queue */ struct ionic_qcq { diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 56701e90d4..64766f2652 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -94,6 +94,8 @@ ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, qinfo->nb_desc = q->num_descs; qinfo->conf.offloads = dev->data->dev_conf.txmode.offloads; + if (txq->flags & IONIC_QCQ_F_FAST_FREE) + qinfo->conf.offloads |= RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE; qinfo->conf.tx_deferred_start = txq->flags & IONIC_QCQ_F_DEFERRED; } @@ -136,7 +138,10 @@ ionic_tx_flush(struct ionic_tx_qcq *txq) if (!txm) break; - rte_pktmbuf_free_seg(txm); + if (txq->flags & IONIC_QCQ_F_FAST_FREE) + rte_mempool_put(txm->pool, txm); + else + rte_pktmbuf_free_seg(txm); info[i] = NULL; } @@ -240,6 +245,8 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id, txq->flags |= IONIC_QCQ_F_CSUM_TCP; if (offloads & RTE_ETH_TX_OFFLOAD_UDP_CKSUM) txq->flags |= IONIC_QCQ_F_CSUM_UDP; + if (offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) + txq->flags |= IONIC_QCQ_F_FAST_FREE; eth_dev->data->tx_queues[tx_queue_id] = txq; From patchwork Tue Oct 18 19:41:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118490 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org 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 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 */ From patchwork Tue Oct 18 19:41:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118491 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D6902A0560; Tue, 18 Oct 2022 21:46:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CBF064114A; Tue, 18 Oct 2022 21:46:34 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2078.outbound.protection.outlook.com [40.107.223.78]) by mails.dpdk.org (Postfix) with ESMTP id 0FB624281C for ; Tue, 18 Oct 2022 21:46:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nWV15TL0ob0W8wrIRRfW00tn0bKEwhanL+r5OdVz/rRc3YPNKXe//7fqjnDoI7Z8LzJE2u8Kq+1Ipk14KcHL+1XP0Ftw5IyQRBGRIodPWlZM845OP7ufe2k260/2LOzP3uLxGPt+pP6P8qvbaZdsrKFpBVzWgy8xYt1NB9w45zncjYxdkVmbB/A7vhXsJ4V5gNwoPMeEYK2G7iOw7xJbB3LhK30X63CZo8iVuSwrOD+1ETuthcf8m5eYUmt1z8KRcmvjRDLLE35A2qCWRFR/n57GJ6Ma6SnCrb/5Iu1VFFvcZZsg4hR7yh9olg5aBrk4RGiDgIVYeixYAoy77H5eaw== 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=B5T9vMP4GDIptQNqMrHeInHQ7CXw1zOO1HnXeMfcjBA=; b=Rq0ehsVVJtrtH3KW8IguQYX/q4TziUe8DjzmmXy6OqvNTfBxXXMwxspzdOhXFlmx2jdM9yyzQ20IMmzgqw+4h9UR/SQ5tU70kJcFUU7wi+McangZpIaRjpzh6GD721LeODWeszEWzG+1CO3W3Mz4AKr0duRB/kDoAypOHBYNSs0uNjaV97MmeAW7aCIjNCFC+hUiKN+pM7plgqlzGQtywx0o7VI5FgUL8XBGnbDN63MWU/MARPgK3ieq2odVAURfMG7cwvROKsDzG8je6GC13I2e1B4h2eFjhAYgUZH21DC8DWU9Zs8XQg3BDHla4L/6TcFnqEpocDzV8z6PMmQXTA== 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=B5T9vMP4GDIptQNqMrHeInHQ7CXw1zOO1HnXeMfcjBA=; b=OZENeGVaC0Cul9oQcxAfb94NqBUx8+SDF6oTQDreIl6YRyql40vptsjTpOcvuI3Do1SsDYNTC0/AR7RWQcHe8QoAOmcHvwz5eJUTz4BOiJ0WXi3bFKxUlG0CHINXtdxBb3dpQpVSeUFGVaSjl7jnYe8dKxZNppJSWDieyUUiMOM= Received: from DM6PR07CA0047.namprd07.prod.outlook.com (2603:10b6:5:74::24) by DM4PR12MB5231.namprd12.prod.outlook.com (2603:10b6:5:39b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32; Tue, 18 Oct 2022 19:46:27 +0000 Received: from DM6NAM11FT052.eop-nam11.prod.protection.outlook.com (2603:10b6:5:74:cafe::4d) by DM6PR07CA0047.outlook.office365.com (2603:10b6:5:74::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30 via Frontend Transport; Tue, 18 Oct 2022 19:46:27 +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:27 +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:26 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 24/36] net/ionic: add a lookup table for packet type Date: Tue, 18 Oct 2022 12:41:19 -0700 Message-ID: <20221018194131.23006-25-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 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_|DM4PR12MB5231:EE_ X-MS-Office365-Filtering-Correlation-Id: 5dbe2ac8-2a8c-49e8-5dac-08dab1417236 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fVS6EYP+wDdpREH7f7IDf0f+ScxcOcfn151u5ZR2u6rvTo62YGn24YL1XJXojbSepmYkc00oy6UAVj3KDY6zI9c5nWyZRpxlkphbWcdoucPZ6PMFaENLcxOqm+p1Jw7N0c2qhFA22P9+oIhji573YOi+9x292gf4zKoFTqk/7RGvxK3QijA4wlcFVtd1xJ9B5bPL1i7kbOWNqVOh0vOsQNqTTrtvWG67uw4spD1lbqoXdgwD0pO+KxM9kqzDSw3TosSWWSqKU4x/ko4KQZaalYqf9g+rolivGiDIvdQtSLFeTB6h3UVQ+fSM+Tp5FDHqUf6CR7S+cZU36Fpn5EuSJLNBYeKEM6s529XX2AkcZmRrf5bdBql5AkKCoB+fUBMqc7OTCf6OUyuWGRYfYKIUj7afaTTZkwYYYHfA27QyQ0OyshxLY9rrRKsu7xXXBzQvmi4UnzejYlb5hsECP7fmDhf9QTZjb+gdCTaAzeNV0tmA358P3XVeQ87CwdqsA2M2DWeDfreWtKJrQjcW5J6iMqA6Xha4tjL+tytha+AhX0mQF/S4h3mt0JXAHkTFsbNSfODEXtCf58fFrp9CBSgE+2QS9R5XpzvV24sWv6He7gR3jXc5SRyu84U0iyOg5KAf8wXwJxjAoza1W+XE7ZvXz/PPBER3RR5ds9nK2Uxf4scD2NJtlg1COQkJ1KtJpQrySgcGpenNrZfxkvVcjgrPJd8OvWTuBxmRerxnGcG0O0+TdzAED+2phitBJuQNPBZKyV8llmq7Z1wks6Pc4Qeq+jY0I3CLeRLGeTrkGmKH/FgCUwq4kp/n7rgyYp7A6mwD 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)(346002)(396003)(39860400002)(376002)(136003)(451199015)(40470700004)(46966006)(36840700001)(2906002)(36756003)(8936002)(82310400005)(5660300002)(86362001)(4326008)(6666004)(40460700003)(41300700001)(26005)(2616005)(44832011)(16526019)(1076003)(186003)(478600001)(336012)(8676002)(426003)(82740400003)(70586007)(81166007)(356005)(70206006)(83380400001)(47076005)(6916009)(316002)(40480700001)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:46:27.2721 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5dbe2ac8-2a8c-49e8-5dac-08dab1417236 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: DM4PR12MB5231 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 | 63 ++++++++++++++++------------------ 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index cb5ae7671d..8a544c03d3 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -804,6 +804,22 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, return 0; } +/* RTE_PTYPE_UNKNOWN is 0x0 */ +static const uint32_t ionic_ptype_table[IONIC_RXQ_COMP_PKT_TYPE_MASK] + __rte_cache_aligned = { + [IONIC_PKT_TYPE_NON_IP] = RTE_PTYPE_UNKNOWN, + [IONIC_PKT_TYPE_IPV4] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4, + [IONIC_PKT_TYPE_IPV4_TCP] = + RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_TCP, + [IONIC_PKT_TYPE_IPV4_UDP] = + RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_UDP, + [IONIC_PKT_TYPE_IPV6] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6, + [IONIC_PKT_TYPE_IPV6_TCP] = + RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_TCP, + [IONIC_PKT_TYPE_IPV6_UDP] = + RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_UDP, +}; + /* * Cleans one descriptor. Connects the filled mbufs into a chain. * Does not advance the tail index. @@ -820,6 +836,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; void **info; cq_desc_len = rte_le_to_cpu_16(cq_desc->len); @@ -895,41 +912,19 @@ ionic_rx_clean_one(struct ionic_rx_qcq *rxq, rxm->ol_flags = pkt_flags; /* Packet Type */ - switch (cq_desc->pkt_type_color & IONIC_RXQ_COMP_PKT_TYPE_MASK) { - case IONIC_PKT_TYPE_IPV4: - pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4; - break; - case IONIC_PKT_TYPE_IPV6: - pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6; - break; - case IONIC_PKT_TYPE_IPV4_TCP: - pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 | - RTE_PTYPE_L4_TCP; - break; - case IONIC_PKT_TYPE_IPV6_TCP: - pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | - RTE_PTYPE_L4_TCP; - break; - case IONIC_PKT_TYPE_IPV4_UDP: - pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 | - RTE_PTYPE_L4_UDP; - break; - case IONIC_PKT_TYPE_IPV6_UDP: - pkt_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | - RTE_PTYPE_L4_UDP; - break; - default: - { - struct rte_ether_hdr *eth_h = rte_pktmbuf_mtod(rxm, + ptype = cq_desc->pkt_type_color & IONIC_RXQ_COMP_PKT_TYPE_MASK; + pkt_type = ionic_ptype_table[ptype]; + if (pkt_type == RTE_PTYPE_UNKNOWN) { + struct rte_ether_hdr *eth_h = rte_pktmbuf_mtod(rxm, struct rte_ether_hdr *); - uint16_t ether_type = eth_h->ether_type; - if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) - pkt_type = RTE_PTYPE_L2_ETHER_ARP; - else - pkt_type = RTE_PTYPE_UNKNOWN; - stats->mtods++; - break; - } + uint16_t ether_type = eth_h->ether_type; + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) + pkt_type = RTE_PTYPE_L2_ETHER_ARP; + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_LLDP)) + pkt_type = RTE_PTYPE_L2_ETHER_LLDP; + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_1588)) + pkt_type = RTE_PTYPE_L2_ETHER_TIMESYNC; + stats->mtods++; } rxm->packet_type = pkt_type; From patchwork Tue Oct 18 19:41:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118492 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org 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 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; From patchwork Tue Oct 18 19:41:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118493 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C6C0CA0560; Tue, 18 Oct 2022 21:47:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AC2364114A; Tue, 18 Oct 2022 21:47:03 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2054.outbound.protection.outlook.com [40.107.223.54]) by mails.dpdk.org (Postfix) with ESMTP id A5533410E8 for ; Tue, 18 Oct 2022 21:47:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jjhFpo1kp6TpZAx+sGV+uyv4cr0Ui5GvoQ30oAFzVg+IUk2lNd33AxhIIv6jmx0yx2nDcEirT+qxS4f+U1U8giwCt8RaKCvQKem0nJWNHJY/Ag9tBme9TW0WY4veqf0diuGJFv50gb/pRG+xkgN1q62XoBTgQW1t0PT61zvFu+6uFiANsbs6+tN6ejavJI/RRKl33bCjPgn1qHRl6PGCHvG545gX+VtxfEFuIc3qpKBoLpfaEK7pCZWjLT2mZlmyTxsr8Qv1PDex+8nCBNN3rpOVIYAqFUF2ZXaMpol9phgTrKBAbPzddsjf9tMa/WzRj9OgMOYl6PbwWrmNVcXj1w== 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=j4JSo6ijUZmOGKDlK4y1T49EIKysdvyyLqEt95pXBEI=; b=gfresJTaGFRbTuF5p5TN2EKUFOd5/OSU2xTGBu1oIF166TKtfGRM4hWi5xHn48lJClR6860Ed8nlU83KUeMOqQLTAikweLF5yiey2DD8pgrJywrBICZFIfGdE4Sf08E3xbnze9Vphgzcb4QZwWENrOz89m/K4ZZAK2ixj9HQsFJOek8SwzL4cen42x3dV256avrqUb1ia26nIJot0uNHAnKAg2JaI2JYP3B+33FFOO4Ufrq4TOdXulh0F7qBNiCWI3/oQ1dZCKpdnOYhGgF7rDhePDuvv+RfcaB69OXcDbU53zo57IB7ujd+RK1yohxzSs8IIb8EM9Vq/Y9k/BuBFg== 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=j4JSo6ijUZmOGKDlK4y1T49EIKysdvyyLqEt95pXBEI=; b=S9pkNmJlP5SCgrW8qkbeCW91Pnu7H5j1pQFEEpzy2+vKMUFTu8bjpEImpb5sJZhUntRsYLL5RsZaxcmzsHu2Kl9XeiKV15DRahgglGVSb/CcAscFMaLrCvABSuQj7K/04xjlxPS47P8s7FPIj2AMBtA/UglNGoHZypphfZ+a4zY= Received: from DS7PR05CA0044.namprd05.prod.outlook.com (2603:10b6:8:2f::10) by CH2PR12MB4248.namprd12.prod.outlook.com (2603:10b6:610:7a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 18 Oct 2022 19:47:00 +0000 Received: from DM6NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2f:cafe::3a) by DS7PR05CA0044.outlook.office365.com (2603:10b6:8:2f::10) 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:47:00 +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 DM6NAM11FT064.mail.protection.outlook.com (10.13.172.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5723.20 via Frontend Transport; Tue, 18 Oct 2022 19:46:59 +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:37 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 26/36] net/ionic: advertise supported packet types Date: Tue, 18 Oct 2022 12:41:21 -0700 Message-ID: <20221018194131.23006-27-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 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: DM6NAM11FT064:EE_|CH2PR12MB4248:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c20461b-5c5e-47ce-eb91-08dab14185a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: erjiTeDrkyWIiitCCSgv6SoqQOWBLexeMntw6e0b6KjjdIUkJ8/lMR2tgKS76F4I1e0X4OvFOUA9/ODYAI8SJGFFNMOC2uAaE4XE5ZM60ikr/XuzxEdxel73FbkZ7MUM/60yNOaYuSChKyHYBxZElhOjmZvzupVj4MjYV5KRuwV3urAMyO2G1V9OVrgtaemTrU+KNhDXo5L5XFuK4iZjTusMpQiBVY2fGyg0JRtrtx1FJALLYYYgIyS2OB23Fs+aeU3+dRabc2Gke1VJgASdTOKzjyQMT4uT2KZOCy2kNdTMFDIrPtiYhZq/nfn8FiwrdST61iFngEsj+9ms+HYobb5XyGMr+60YuFf6GlTzFwDBmUAxvBv624RBKSnp7Bjv6VCdtaQPeBX5UJjnxoAdtEN6ATjf6LwjeKfKUVK45959gOnfi2lQv2FjNtevPjBGE1HNiIC4Lx//M9G5Kli9M+32r90JPBSj0O5xTYY7wryvkXaz+g4WshZla+9UMe4q7pzArzJIiwj70UjBDYzbpEhgXTZ6NloRuk7jrDw+5vTovFbHc4s3qd/9MoPvcB921jzFtF/sVIaLoCG4c0AbMM7JcaMJ+rii7tWsrn+s0PZ5k4pzW4dqf2ZCg5OiOQLp9ZlfABg/bpZ8bGCc11eRibyJiDFuKWpMempWARyp+3TZC9x8wXA0RFusY5GiwXaVITXuHdnXP/41HEwRqr2Z/BLCODpmvBh1JOyCH51JjKZK3zZ2YEaFgy5C6A0XdhPoUYfKSqsjsVfFCqMLEl29QdlswQ0D3SWERQ8tWAysl2A= 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)(36840700001)(40470700004)(36860700001)(82310400005)(81166007)(356005)(478600001)(82740400003)(186003)(40460700003)(2616005)(36756003)(4326008)(44832011)(6916009)(316002)(6666004)(70586007)(70206006)(47076005)(16526019)(336012)(8676002)(5660300002)(40480700001)(426003)(2906002)(1076003)(26005)(8936002)(86362001)(83380400001)(41300700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:46:59.9061 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1c20461b-5c5e-47ce-eb91-08dab14185a9 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: DM6NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4248 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, since clients may be able to skip SW packet classification. Signed-off-by: Andrew Boyer --- doc/guides/rel_notes/release_22_11.rst | 1 + drivers/net/ionic/ionic_ethdev.c | 1 + drivers/net/ionic/ionic_rxtx.c | 19 +++++++++++++++++++ drivers/net/ionic/ionic_rxtx.h | 2 ++ 4 files changed, 23 insertions(+) diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index 4ad525375f..0db516157c 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -147,6 +147,7 @@ New Features * Updated to reflect that Pensando has been acquired by AMD. * Enhanced data path to provide substantial performance improvements. * Added support for mbuf fast free. + * Added support for advertising packet types. * **Updated Intel iavf driver.** diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 7d21bc0a9b..2560a30fe4 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -70,6 +70,7 @@ static const struct rte_eth_desc_lim tx_desc_lim_v1 = { static const struct eth_dev_ops ionic_eth_dev_ops = { .dev_infos_get = ionic_dev_info_get, + .dev_supported_ptypes_get = ionic_dev_supported_ptypes_get, .dev_configure = ionic_dev_configure, .mtu_set = ionic_dev_mtu_set, .dev_start = ionic_dev_start, diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 697e6dcc15..f92cf3fb46 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -850,6 +850,25 @@ static const uint32_t ionic_ptype_table[IONIC_RXQ_COMP_PKT_TYPE_MASK] RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_UDP, }; +const uint32_t * +ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) +{ + /* See ionic_ptype_table[] */ + static const uint32_t ptypes[] = { + RTE_PTYPE_L2_ETHER, + RTE_PTYPE_L2_ETHER_TIMESYNC, + RTE_PTYPE_L2_ETHER_LLDP, + RTE_PTYPE_L2_ETHER_ARP, + RTE_PTYPE_L3_IPV4, + RTE_PTYPE_L3_IPV6, + RTE_PTYPE_L4_TCP, + RTE_PTYPE_L4_UDP, + RTE_PTYPE_UNKNOWN + }; + + return ptypes; +} + /* * Cleans one descriptor. Connects the filled mbufs into a chain. * Does not advance the tail index. diff --git a/drivers/net/ionic/ionic_rxtx.h b/drivers/net/ionic/ionic_rxtx.h index 6f9f3f92c6..e4c56d734d 100644 --- a/drivers/net/ionic/ionic_rxtx.h +++ b/drivers/net/ionic/ionic_rxtx.h @@ -40,4 +40,6 @@ void ionic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, void ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_txq_info *qinfo); +const uint32_t *ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev); + #endif /* _IONIC_RXTX_H_ */ From patchwork Tue Oct 18 19:41:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118494 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id ECB75A0560; Tue, 18 Oct 2022 21:47:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A0F0542802; Tue, 18 Oct 2022 21:47:05 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2066.outbound.protection.outlook.com [40.107.223.66]) by mails.dpdk.org (Postfix) with ESMTP id 0A8904161A for ; Tue, 18 Oct 2022 21:47:04 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AL56DQn4s6B2K2/sTMONV04RX8AFqpwvFt7h0djY7Idpa2gF3xl0VuoaJSR3r9Br9+CzO05j3plp4wSsOASs3UOPjml8vcRXU65HH8JnW/cffBB7pbudOLPGSYbzdpa8bVpSmFTWwqIAk/SOwBDoKgTBzCzXTbj66APxtWU5dNkkrdTgbRmdeRSOLGIYGHEresjaf5EeLbJEnzP1yddTDJ7bRV4NK6gDEehM/RJj8WDvzq7C/spPQINtleCqNrJ1SyZnHV+JeXVSS5+qaUkCE5nBXCVqTLy3EJjXP2bwwK31DTs1POsEmXmqpzVIHhNeMhrcGlovEcoCbYIwTsZMdA== 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=r+DQiap/YeXBxAINWqdK3WLa9Mk0Own5M58mnEipfnA=; b=bOA8ZyD3bcobXRerkiuQ4F3NG3dYyFWSSO2Q09HxtgmQYZhksh8Mj0B1mqEEx1LsgtqbrNuvbuiDR/n7RRp68R9TIsWHUdnSCIelITKowpFGxl79SGexNWPwVvv7pkhroriK9SrR/lYqKtAJerGhzWDkm3NmS3vNCM0dPuQLECh/yACeQFJ+JxXXCrrquHkb9ZYFRMbjUFhluIyR7GIoBZ2J1gzz1BFRr33QGlloOnlnZBAEEFLO8hGf5V2A7SqTM/cFg9xb9USAyc+GdhHlteZdWGH7mwkvVfIp52cHdgSol1L4ow/MYdpuWbjo4vy+6hcC6Q4R73nYDGQe8tesFg== 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=r+DQiap/YeXBxAINWqdK3WLa9Mk0Own5M58mnEipfnA=; b=Vwwwz67wR+Exxu91+AyzAywuVq3c/ZEZbjSkkFMZaFwtQ6tery9NegKcepATeyQKpe74izz8HGrBLRLvH6kVdG94vCJ9rmWLemrrC9jtV+tHO4ufaLeSiZOwMvlZRsFiP8T2mS7otGw7hgJl8OiIQz6eigcAn/zgJz3JmOlQ0kQ= Received: from DS7PR05CA0049.namprd05.prod.outlook.com (2603:10b6:8:2f::27) by CH2PR12MB5018.namprd12.prod.outlook.com (2603:10b6:610:6e::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Tue, 18 Oct 2022 19:47:02 +0000 Received: from DM6NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2f:cafe::db) by DS7PR05CA0049.outlook.office365.com (2603:10b6:8:2f::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.9 via Frontend Transport; Tue, 18 Oct 2022 19:47:02 +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 DM6NAM11FT064.mail.protection.outlook.com (10.13.172.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5723.20 via Frontend Transport; Tue, 18 Oct 2022 19:47:02 +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:59 -0500 From: Andrew Boyer To: CC: Andrew Boyer , Allen Hubbe Subject: [PATCH v2 27/36] net/ionic: add Rx descriptor status functions Date: Tue, 18 Oct 2022 12:41:22 -0700 Message-ID: <20221018194131.23006-28-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 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: DM6NAM11FT064:EE_|CH2PR12MB5018:EE_ X-MS-Office365-Filtering-Correlation-Id: 81cd58e0-bed2-49b0-eb05-08dab14186f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5Rc7/l+ov4cChVo+e142SesZn09nUJGOpLukEccsf8qNFqVwPxEYve9L3Wv/gxpuS/9c3Rr9SRoh4HHyjI2Tey+WOqnEbzmHB7dMzx2AFe+BPiKhgN/QQf98M+a2j3Z9vDay6FYVmSwi1/NDMYU8nnYmv7obcS/S7YLDBlD013mAQcZAS46kH8cyUQIoCfRaJMibVSbhmLzN31GE/1N3+XOo+eILmQjl3KIzaYvK3cSqVph/RlASsZPVYxuV92f+IGkiOo6yZZlQWj5RiGNgNJf9/IEe/NS9vQN0XXnfCWzeMslfu/xIUBkGvS0poQ6JAEeiCaq+niB7Sw1h+UP60aZ0tXQcaIHLC9Jlku3/I1w/xUyVxQ5T7KW+lt53MvhAuGsyhl+l4t/gwIcUz2E0du8b4YxZPMWWAkf/GVkzfbf4payQPixNlcSg6DKezvr8kwRJtW2PqHL8fgX0BY+M10mcrThL1vacXOdcrNLPvStppgLYNzXGy5HluRhWTVdXg2CZaFeSZK7m/sgArm5WNNR3N1zIx+cXDkOzmnfSHnWqRe84yRyeg0AWTGxNDeYpHVb/Q8sjiP/tyjqaCXstnXER7hYczn5EXgtknQiSEPdkY8CWN6AYVH7c0vyw+zi+0urQtpdIh4uYZIXwaSbeSTfXUdEgXWiBS4TxZ2WNQHJKXQcISiuxaEfAUZqMvNMHlikdqXhs6XG/JvdNviZxinFoKgDI8JKYxxfHNwB3PjA28/OGLk3++KVm3slJGKwnthXR/ag5AGHiPDbF6xpru8PXpqPH9UGQNFh84kJgdq8= 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)(376002)(346002)(396003)(39860400002)(451199015)(40470700004)(36840700001)(46966006)(36756003)(36860700001)(86362001)(5660300002)(82740400003)(44832011)(2906002)(2616005)(47076005)(186003)(1076003)(54906003)(426003)(16526019)(336012)(81166007)(83380400001)(356005)(316002)(478600001)(26005)(41300700001)(6666004)(6916009)(70586007)(70206006)(82310400005)(8936002)(40480700001)(4326008)(8676002)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:47:02.0622 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81cd58e0-bed2-49b0-eb05-08dab14186f2 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: DM6NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB5018 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 may be useful for clients. Signed-off-by: Andrew Boyer Signed-off-by: Allen Hubbe --- doc/guides/nics/features/ionic.ini | 1 + doc/guides/rel_notes/release_22_11.rst | 1 + drivers/net/ionic/ionic_ethdev.c | 2 ++ drivers/net/ionic/ionic_rxtx.c | 39 ++++++++++++++++++++++++++ drivers/net/ionic/ionic_rxtx.h | 2 ++ 5 files changed, 45 insertions(+) diff --git a/doc/guides/nics/features/ionic.ini b/doc/guides/nics/features/ionic.ini index 77947bfd22..e01ba87135 100644 --- a/doc/guides/nics/features/ionic.ini +++ b/doc/guides/nics/features/ionic.ini @@ -27,6 +27,7 @@ CRC offload = Y L3 checksum offload = Y L4 checksum offload = Y Packet type parsing = Y +Rx descriptor status = Y Basic stats = Y Extended stats = Y Stats per queue = Y diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index 0db516157c..fcbb3228a4 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -148,6 +148,7 @@ New Features * Enhanced data path to provide substantial performance improvements. * Added support for mbuf fast free. * Added support for advertising packet types. + * Added support for descriptor status functions. * **Updated Intel iavf driver.** diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 2560a30fe4..f9b05e4a90 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -984,6 +984,8 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params) eth_dev->tx_pkt_burst = &ionic_xmit_pkts; eth_dev->tx_pkt_prepare = &ionic_prep_pkts; + eth_dev->rx_descriptor_status = ionic_dev_rx_descriptor_status; + /* Multi-process not supported, primary does initialization anyway */ if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index f92cf3fb46..2c46a64dd2 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -1235,3 +1235,42 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, return rx_svc.nb_rx; } + +int +ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) +{ + struct ionic_rx_qcq *rxq = rx_queue; + struct ionic_qcq *qcq = &rxq->qcq; + struct ionic_rxq_comp *cq_desc; + uint16_t mask, head, tail, pos; + bool done_color; + + mask = qcq->q.size_mask; + + /* offset must be within the size of the ring */ + if (offset > mask) + return -EINVAL; + + head = qcq->q.head_idx; + tail = qcq->q.tail_idx; + + /* offset is beyond what is posted */ + if (offset >= ((head - tail) & mask)) + return RTE_ETH_RX_DESC_UNAVAIL; + + /* interested in this absolute position in the rxq */ + pos = (tail + offset) & mask; + + /* rx cq position == rx q position */ + cq_desc = qcq->cq.base; + cq_desc = &cq_desc[pos]; + + /* expected done color at this position */ + done_color = qcq->cq.done_color != (pos < tail); + + /* has the hw indicated the done color at this position? */ + if (color_match(cq_desc->pkt_type_color, done_color)) + return RTE_ETH_RX_DESC_DONE; + + return RTE_ETH_RX_DESC_AVAIL; +} diff --git a/drivers/net/ionic/ionic_rxtx.h b/drivers/net/ionic/ionic_rxtx.h index e4c56d734d..09d8c9b152 100644 --- a/drivers/net/ionic/ionic_rxtx.h +++ b/drivers/net/ionic/ionic_rxtx.h @@ -40,6 +40,8 @@ void ionic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, void ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_txq_info *qinfo); +int ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset); + const uint32_t *ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev); #endif /* _IONIC_RXTX_H_ */ From patchwork Tue Oct 18 19:41:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118495 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DD191A0560; Tue, 18 Oct 2022 21:47:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA7D242B6C; Tue, 18 Oct 2022 21:47:12 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2041.outbound.protection.outlook.com [40.107.95.41]) by mails.dpdk.org (Postfix) with ESMTP id A5A8C40E03 for ; Tue, 18 Oct 2022 21:47:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JDAiWG7L5OjJjJ9rz1z9tbxBOUVGbn7mruCYBy0fTBjDI8QMU21XVqkA+qCTWJpTkGvnxVPpf69Su2ZdveTtOv4xBTU1c4S0KpdjWRnIq3VebV7rCTde+5CRITTLB91INO1azrFE4K1x7WfH88sR0fjWmpELPJHGw0rctixuM660BqCwufiYG+2NV74FQC7NXizLFSdTCXWyh/syyAAg0Lu6PfbUfW6Qz/NwxfQg+q80xTwVl2CgxKSMCE664j2NM4M4HNasuDIvqR1y5oeHVEVz70sRALVN2iQGOJWVaGWBm5iUbZ1bzcD2zI7/7tdJTHUQkwsmyk1DJu/7s3Sk7A== 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=HwVEpa5ivV8AbnWXjCY9NNfjsNcEyJGMcdiPfN5Trdg=; b=DIUOaw+LxmI0SSFcFl2xzf+hPzmTzXIrXYUiR+IcWwkFDPhlDb/mLpUeC3PxZz4ny4KJ5M3OCd3k6u1kGTgcgCgN36yWatlJeVh448z34ol7TLiyMgeT8CZFa8VJzKspgCv9FAOL+vSLz8uPnqW8ec1SwhbOHXCPJIuW3/XYSQ2bXHg42vpixfVPtQPZMCO5ado+HjbK+9DandDsmcF2GdjVjteJ60IRyyIKA37Bhe8484hCxEFAngXTP52P41xy8rts5d2T8pHWizGZgo61NgR4wqVrIY0Blg7Sx4vuu4NGRBZnn1OJ2whV3CZ/uM0PdcjRHP6WNdQdK6IlUh+wZg== 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=HwVEpa5ivV8AbnWXjCY9NNfjsNcEyJGMcdiPfN5Trdg=; b=RZoZoi/Mxof3nB1dilv2DeV/6EC19cOmxt9pmVdpNpUJJ0weR6cL6wRvq+qnrCxFNrUgGzN5rp5P5D8eKUqsqmpCNyRLam/wYip7FL9afkz6nwlZZ86tjCyoDkt8diQmKjNywLcIMFqxrlejTWbHXD0XmjyFDkpOppY3xqyD+Yg= Received: from DM6PR06CA0067.namprd06.prod.outlook.com (2603:10b6:5:54::44) by MW4PR12MB6730.namprd12.prod.outlook.com (2603:10b6:303:1ec::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 18 Oct 2022 19:47:06 +0000 Received: from DM6NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:5:54:cafe::4d) by DM6PR06CA0067.outlook.office365.com (2603:10b6:5:54::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.31 via Frontend Transport; Tue, 18 Oct 2022 19:47:05 +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 DM6NAM11FT032.mail.protection.outlook.com (10.13.173.93) 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:47:05 +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:47:03 -0500 From: Andrew Boyer To: CC: Andrew Boyer , Allen Hubbe Subject: [PATCH v2 28/36] net/ionic: add Tx descriptor status function Date: Tue, 18 Oct 2022 12:41:23 -0700 Message-ID: <20221018194131.23006-29-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 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: DM6NAM11FT032:EE_|MW4PR12MB6730:EE_ X-MS-Office365-Filtering-Correlation-Id: 25c0e7b1-edc1-463c-f7b6-08dab141891e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q68A+7s/KN2mk+x+lRMgyxc1IGgEmRNfkToqC6o8uo/wgSGgV7inNHj3PcfNmU4FOhxCEPd1qN2WkVspem1hZZS+K+2269MCHjuYxpNo0L2OfZkWW5Pvzuh4yLQfK5r89yGWluhF1tMZEEjWWevzA/2SfusdMfkeTAMM/wnsv3MCpgc5TbINNAzn/kvvZh9yMZC5B6nO46ZGtos+sEAg3XEYKuXBqAiD5pCo1mAWqPWWHVLm/vwDLvJtasluagyqpoLI/zMWE/Yx9C53nz7MuQRqQWfWknOU6TmNhDFd6WvpQdgxY3DZei0Z+ezJXJ544e/zOXVVEpxYmJKVu6VKnu8rkht1P71mQo92MdKv1d6BJ4m1W3+45ixlvBzXCKvZjdH91Br/Rn94vJVI9teg170zUQYb7aBSPDAN6rf4oxJCMSwCTYX8kbWzgj4sga3btKrtpCcvZuqsCG4Sx2TYT7ys6glpvv9Buj78rlb04PdsVyUF4frsG/nFcE3lOTlsFQlXdpUW/xqoAaRrM2vlebXb2giDyBLWSuFPCAedvSyJt0SojDA3CILqblQsA12D1x8tE98h8yJKGlfpcV1r0GWiYn0dZGL+lLnN+aSiWxfSlowVQXDT0PR2uc0ltQAM/40pkzXn2X5p0gsNI1JRry2wT+la2FFvJU3czfYu/p9nw7waUjAMtwMZpLEMNJjT88L+/5lDCvxt1ee7mdS6C9+AIhS6RobY9ao4kPkklJuaoBQWXF894e19JyhXMRz9WmU4ftrE7vAyFTBdr2RMuwWoxKadXwnrhrix8Di8Q/A= 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)(346002)(376002)(39860400002)(396003)(451199015)(46966006)(36840700001)(40470700004)(478600001)(356005)(81166007)(6916009)(54906003)(8936002)(316002)(82740400003)(41300700001)(82310400005)(186003)(26005)(36756003)(40480700001)(4326008)(426003)(6666004)(1076003)(16526019)(40460700003)(2616005)(336012)(2906002)(5660300002)(47076005)(8676002)(86362001)(70586007)(36860700001)(44832011)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:47:05.7063 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 25c0e7b1-edc1-463c-f7b6-08dab141891e 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: DM6NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6730 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 may be useful for clients. Signed-off-by: Andrew Boyer Signed-off-by: Allen Hubbe --- doc/guides/nics/features/ionic.ini | 1 + drivers/net/ionic/ionic_ethdev.c | 1 + drivers/net/ionic/ionic_rxtx.c | 51 ++++++++++++++++++++++++++++++ drivers/net/ionic/ionic_rxtx.h | 1 + 4 files changed, 54 insertions(+) diff --git a/doc/guides/nics/features/ionic.ini b/doc/guides/nics/features/ionic.ini index e01ba87135..af0fc5462a 100644 --- a/doc/guides/nics/features/ionic.ini +++ b/doc/guides/nics/features/ionic.ini @@ -28,6 +28,7 @@ L3 checksum offload = Y L4 checksum offload = Y Packet type parsing = Y Rx descriptor status = Y +Tx descriptor status = Y Basic stats = Y Extended stats = Y Stats per queue = Y diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index f9b05e4a90..393d36d946 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -985,6 +985,7 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params) eth_dev->tx_pkt_prepare = &ionic_prep_pkts; eth_dev->rx_descriptor_status = ionic_dev_rx_descriptor_status; + eth_dev->tx_descriptor_status = ionic_dev_tx_descriptor_status; /* Multi-process not supported, primary does initialization anyway */ if (rte_eal_process_type() != RTE_PROC_PRIMARY) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 2c46a64dd2..24f498d910 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -1274,3 +1274,54 @@ ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) return RTE_ETH_RX_DESC_AVAIL; } + +int +ionic_dev_tx_descriptor_status(void *tx_queue, uint16_t offset) +{ + struct ionic_tx_qcq *txq = tx_queue; + struct ionic_qcq *qcq = &txq->qcq; + struct ionic_txq_comp *cq_desc; + uint16_t mask, head, tail, pos, cq_pos; + bool done_color; + + mask = qcq->q.size_mask; + + /* offset must be within the size of the ring */ + if (offset > mask) + return -EINVAL; + + head = qcq->q.head_idx; + tail = qcq->q.tail_idx; + + /* offset is beyond what is posted */ + if (offset >= ((head - tail) & mask)) + return RTE_ETH_TX_DESC_DONE; + + /* interested in this absolute position in the txq */ + pos = (tail + offset) & mask; + + /* tx cq position != tx q position, need to walk cq */ + cq_pos = qcq->cq.tail_idx; + cq_desc = qcq->cq.base; + cq_desc = &cq_desc[cq_pos]; + + /* how far behind is pos from head? */ + offset = (head - pos) & mask; + + /* walk cq descriptors that match the expected done color */ + done_color = qcq->cq.done_color; + while (color_match(cq_desc->color, done_color)) { + /* is comp index no further behind than pos? */ + tail = rte_cpu_to_le_16(cq_desc->comp_index); + if (((head - tail) & mask) <= offset) + return RTE_ETH_TX_DESC_DONE; + + cq_pos = (cq_pos + 1) & mask; + cq_desc = qcq->cq.base; + cq_desc = &cq_desc[cq_pos]; + + done_color = done_color != (cq_pos == 0); + } + + return RTE_ETH_TX_DESC_FULL; +} diff --git a/drivers/net/ionic/ionic_rxtx.h b/drivers/net/ionic/ionic_rxtx.h index 09d8c9b152..5b9d9eac80 100644 --- a/drivers/net/ionic/ionic_rxtx.h +++ b/drivers/net/ionic/ionic_rxtx.h @@ -41,6 +41,7 @@ void ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_txq_info *qinfo); int ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset); +int ionic_dev_tx_descriptor_status(void *tx_queue, uint16_t offset); const uint32_t *ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev); From patchwork Tue Oct 18 19:41:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118496 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EA771A0560; Tue, 18 Oct 2022 21:47:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA1874282F; Tue, 18 Oct 2022 21:47:15 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2059.outbound.protection.outlook.com [40.107.93.59]) by mails.dpdk.org (Postfix) with ESMTP id 1C01A42B72 for ; Tue, 18 Oct 2022 21:47:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HSPdp7ND3dL+R7GkdimZKnqMBvfo8CqBa1eD8mM/Q1d3VvbTZQ0nff1eHafUeIyXEG1eHiCiOlqyRz0m2CbZgTjrvipBzls2o+kORobbuWnyjJaK9e2KJc9KJx6OqSyuSbX2duM7kDen9O7Q0c2Xh+/Gw9g6AJ3AkZwUY2aWlmo+aJoddpnOJnaD43mjFDXct0WHuHOH+5VMf1GowAw340XKZubNm7XYPiWiLzAiWb434UU6jAqAb/otPeOK368iyag2EZG5s+vloUsGmhkUMZXStBfQjoBDHTFZ1Eb/2C14LIoANzW6O3GRifXwxi6xRvtvhScjDn9MJLtvoFoa7g== 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=4W3stXh2diKZWkSVAc6TmTmJiwVj6VMnZNTjjmMLatc=; b=DTF5pZu4a44Seoy9HG3cSnDGj2l6uRHGyU6/By/Y24behRyO4G2KN6sj8dcsMp7lHa2fYfF8HMrBw1VOBEjMQXEMCJQzVFpMgsRd5ik+/yUbk3gw+eHfaLbQZ48v3yKYfD/wvZpDO1A8JAY3xNLFqpJpNn42Syg70nEDvWCnLZ004x1zYvHVA7Gq/zXDt+3qpzcPP7Aq6VeF5gkmRGjOXDvt9tw2KRNB245Eqq6/NDJhBnhjJpU5L/kg+Su9Nvq4/lZMInGVNOl256+/XcGOvqV4wSwwhX7IEIPai9MXFSQD3eutTbwofjg/u8YuA4w3k9UlTR94WuyeDhGsq3WLuA== 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=4W3stXh2diKZWkSVAc6TmTmJiwVj6VMnZNTjjmMLatc=; b=M490LN20RIhTbn6qs9MfwvfsJu15m03a2mKncIKt0u/5XK+VSrEA8Acueseuo2xBfqASdbD4MrA6UCeM/amJvZruVl5dSPWEANquqJrHhWmHLEteoRSbGYEkH3Na62TtYzxFP2216g14Mgaa+njTipLjQPDoCnPRH+J/kLn57ck= Received: from DS7PR07CA0003.namprd07.prod.outlook.com (2603:10b6:5:3af::11) by SJ0PR12MB6808.namprd12.prod.outlook.com (2603:10b6:a03:47a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 18 Oct 2022 19:47:11 +0000 Received: from DM6NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3af:cafe::f) by DS7PR07CA0003.outlook.office365.com (2603:10b6:5:3af::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34 via Frontend Transport; Tue, 18 Oct 2022 19:47: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 DM6NAM11FT025.mail.protection.outlook.com (10.13.172.197) 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:47: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.31; Tue, 18 Oct 2022 14:47:09 -0500 From: Andrew Boyer To: CC: Andrew Boyer , Neel Patel Subject: [PATCH v2 29/36] net/ionic: add Q-in-CMB option controlled by devarg Date: Tue, 18 Oct 2022 12:41:24 -0700 Message-ID: <20221018194131.23006-30-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 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: DM6NAM11FT025:EE_|SJ0PR12MB6808:EE_ X-MS-Office365-Filtering-Correlation-Id: a2c46525-a7ea-49de-f91b-08dab1418c5a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OjMpg106b9ebFrC7XdDqyJ2aqJL/x3c5Ufc15B8vpfADaF3iQ9PwyCUfx0TIjLqMRcCi0mQbmkKG+rsFx1AKWvAKkik7CQGycURgU1ATjN9MOzMNjD493A3b0h3ZFIZtmgJnuk/BSREcAFAbbvY8FVKazYqpjKg1bTD/HirL7PkDICoPyTR9Ab6+5a9miyqKGGo8Ieqg29C0IwfkIGmFVGVR9tGvML/fprzWzo6kX8KiVKJIcQqbQTIz5fnIA3eGpO6i9XSIThOdYpNYGH2QI8gOWZ1GZN9pK+wn+YFFvp+SIKg/tmMOuaq3ta3wNZe6YSHYLoBlqYzuGiW8teUR2XHeL4B3wZTBT9GNuwm6HuRx5VVCydcib6lRWJLE6TYOlPAw/U28jG+VWxqm1/aSqGvbqVDF/8LYUPCkmrvxRRK7Np3TwRZ6G3Djm+uMR9tbiF9/oeNfd9h38Fx8zt7WsSQVnEtciYXS4cPWBtH+EFoGwHxQETD2c5TZhcoTBuxL7AQWneVTTTGeeDZV0VhFjXgROtH9JQmNd/EX9W3tIj+1EOevgQAdmFEbpgsxZrHftMiGlB0X20F03/ZZ4I+/0SgT1F7o5KbW1BTFCcg+c2POSUfp1FvqZ/XeWD58UObv0YHhom4emlEeqXTfQMYQf1tOcATWNs8ertxG1IJrqNnsU4r2eXLQBN4h8kzLIvh+gsYHRYcOUTFcMnW6EhLRBgMgNpECNbcSKfCAWMSV2jbH9z2Dyb0vbD2ofM8VmKK99PTZeAfOiRpnp/hKhETgQM+gJtFv/5Nm3tZ9ddkVvXfup0L+WVaaJL2QNA4B1sVF 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)(346002)(376002)(39860400002)(136003)(451199015)(46966006)(36840700001)(40470700004)(83380400001)(40480700001)(356005)(81166007)(86362001)(336012)(426003)(47076005)(82310400005)(36756003)(82740400003)(36860700001)(316002)(54906003)(6916009)(6666004)(40460700003)(478600001)(2616005)(8936002)(5660300002)(26005)(2906002)(44832011)(16526019)(30864003)(70206006)(70586007)(41300700001)(8676002)(1076003)(186003)(4326008)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:47:11.1171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a2c46525-a7ea-49de-f91b-08dab1418c5a 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: DM6NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6808 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 When 'ionic_cmb' is set to '1', queue memory will be allocated from the device's onboard memory (Controller Memory Buffer). In some configurations, this will dramatically reduce packet latency and increase PPS. Add the WC_ACTIVATE flag to the PCI driver flags. Write combining must be enabled to achieve the maximum PPS. When the queue is in the CMB, descriptors cannot be prefetched. Signed-off-by: Andrew Boyer Signed-off-by: Neel Patel --- doc/guides/nics/ionic.rst | 12 ++++++ doc/guides/rel_notes/release_22_11.rst | 1 + drivers/net/ionic/ionic.h | 5 +++ drivers/net/ionic/ionic_dev.h | 3 ++ drivers/net/ionic/ionic_dev_pci.c | 60 +++++++++++++++++++++++++- drivers/net/ionic/ionic_ethdev.c | 9 ++++ drivers/net/ionic/ionic_lif.c | 38 ++++++++++++++++ drivers/net/ionic/ionic_lif.h | 2 + drivers/net/ionic/ionic_rxtx.c | 9 ++-- 9 files changed, 135 insertions(+), 4 deletions(-) diff --git a/doc/guides/nics/ionic.rst b/doc/guides/nics/ionic.rst index 216f820736..e0eb1b5c9a 100644 --- a/doc/guides/nics/ionic.rst +++ b/doc/guides/nics/ionic.rst @@ -32,6 +32,18 @@ The ionic PMD requires firmware which supports 16 segment transmit SGLs. This support was added prior to version 1.0. For help upgrading older versions, please contact AMD Pensando support. +Runtime Configuration +--------------------- + +- ``Queue in CMB support`` (default ``0``) + + Queue memory can be allocated from the Controller Memory Buffer (CMB) using + the ``ionic_cmb`` ``devargs`` parameter. + + For example:: + + -a 0000:b5:00.0,ionic_cmb=1 + Building DPDK ------------- diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index fcbb3228a4..c98c64d24d 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -149,6 +149,7 @@ New Features * Added support for mbuf fast free. * Added support for advertising packet types. * Added support for descriptor status functions. + * Added Q-in-CMB feature controlled by devarg ionic_cmb. * **Updated Intel iavf driver.** diff --git a/drivers/net/ionic/ionic.h b/drivers/net/ionic/ionic.h index 8b0e85ea26..c479eaba74 100644 --- a/drivers/net/ionic/ionic.h +++ b/drivers/net/ionic/ionic.h @@ -24,6 +24,9 @@ #define IONIC_DEV_ID_ETH_VF 0x1003 #define IONIC_DEV_ID_ETH_MGMT 0x1004 +/* Devargs */ +#define PMD_IONIC_CMB_KVARG "ionic_cmb" + enum ionic_mac_type { IONIC_MAC_UNKNOWN = 0, IONIC_MAC_CAPRI, @@ -62,9 +65,11 @@ struct ionic_adapter { uint32_t link_speed; uint32_t nintrs; bool intrs[IONIC_INTR_CTRL_REGS_MAX]; + bool q_in_cmb; bool link_up; char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN]; void *bus_dev; + uint64_t cmb_offset; }; /** ionic_admin_ctx - Admin command context. diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index 312f195e58..7ac86396be 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -176,9 +176,12 @@ struct ionic_adapter; struct ionic_qcq; struct rte_mempool; struct rte_eth_dev; +struct rte_devargs; struct ionic_dev_intf { int (*setup)(struct ionic_adapter *adapter); + int (*devargs)(struct ionic_adapter *adapter, + struct rte_devargs *devargs); void (*copy_bus_info)(struct ionic_adapter *adapter, struct rte_eth_dev *eth_dev); int (*configure_intr)(struct ionic_adapter *adapter); diff --git a/drivers/net/ionic/ionic_dev_pci.c b/drivers/net/ionic/ionic_dev_pci.c index 5366cee56a..5e74a6da71 100644 --- a/drivers/net/ionic/ionic_dev_pci.c +++ b/drivers/net/ionic/ionic_dev_pci.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "ionic.h" #include "ionic_if.h" @@ -92,6 +93,58 @@ ionic_pci_setup(struct ionic_adapter *adapter) return 0; } +const char *ionic_pci_devargs_arr[] = { + PMD_IONIC_CMB_KVARG, + NULL, +}; + +static int +ionic_pci_devarg_cmb(const char *key __rte_unused, const char *val, void *arg) +{ + struct ionic_adapter *adapter = arg; + + if (!strcmp(val, "1")) { + IONIC_PRINT(NOTICE, "%s enabled", PMD_IONIC_CMB_KVARG); + adapter->q_in_cmb = true; + } else if (!strcmp(val, "0")) { + IONIC_PRINT(DEBUG, "%s disabled (default)", + PMD_IONIC_CMB_KVARG); + } else { + IONIC_PRINT(ERR, "%s=%s invalid, use 1 or 0", + PMD_IONIC_CMB_KVARG, val); + return -ERANGE; + } + + return 0; +} + +static int +ionic_pci_devargs(struct ionic_adapter *adapter, struct rte_devargs *devargs) +{ + struct rte_kvargs *kvlist; + int err = 0; + + if (!devargs) + return 0; + + kvlist = rte_kvargs_parse(devargs->args, ionic_pci_devargs_arr); + if (!kvlist) { + IONIC_PRINT(ERR, "Couldn't parse args '%s'", devargs->args); + return -EINVAL; + } + + if (rte_kvargs_count(kvlist, PMD_IONIC_CMB_KVARG) == 1) { + err = rte_kvargs_process(kvlist, PMD_IONIC_CMB_KVARG, + ionic_pci_devarg_cmb, adapter); + if (err < 0) + goto free_kvlist; + } + +free_kvlist: + rte_kvargs_free(kvlist); + return err; +} + static void ionic_pci_copy_bus_info(struct ionic_adapter *adapter, struct rte_eth_dev *eth_dev) @@ -160,6 +213,7 @@ ionic_pci_unconfigure_intr(struct ionic_adapter *adapter) static const struct ionic_dev_intf ionic_pci_intf = { .setup = ionic_pci_setup, + .devargs = ionic_pci_devargs, .copy_bus_info = ionic_pci_copy_bus_info, .configure_intr = ionic_pci_configure_intr, .unconfigure_intr = ionic_pci_unconfigure_intr, @@ -206,7 +260,8 @@ eth_ionic_pci_remove(struct rte_pci_device *pci_dev) static struct rte_pci_driver rte_pci_ionic_pmd = { .id_table = pci_id_ionic_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | + RTE_PCI_DRV_WC_ACTIVATE, .probe = eth_ionic_pci_probe, .remove = eth_ionic_pci_remove, }; @@ -214,3 +269,6 @@ static struct rte_pci_driver rte_pci_ionic_pmd = { RTE_PMD_REGISTER_PCI(net_ionic_pci, rte_pci_ionic_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_ionic_pci, pci_id_ionic_map); RTE_PMD_REGISTER_KMOD_DEP(net_ionic_pci, "* igb_uio | uio_pci_generic | vfio-pci"); +RTE_PMD_REGISTER_PARAM_STRING(net_ionic_pci, + PMD_IONIC_CMB_KVARG "=<0|1>" +); diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 393d36d946..0184ffb02e 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -1118,6 +1118,15 @@ eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev, adapter->intf = intf; + /* Parse device arguments */ + if (adapter->intf->devargs) { + err = (*adapter->intf->devargs)(adapter, rte_dev->devargs); + if (err) { + IONIC_PRINT(ERR, "Cannot parse device arguments"); + goto err_free_adapter; + } + } + /* Discover ionic dev resources */ err = ionic_setup(adapter); if (err) { diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 4305587fe0..db0893acb8 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -660,6 +660,21 @@ ionic_qcq_alloc(struct ionic_lif *lif, ionic_q_sg_map(&new->q, sg_base, sg_base_pa); } + if (flags & IONIC_QCQ_F_CMB) { + /* alloc descriptor ring from nic memory */ + if (lif->adapter->cmb_offset + q_size > + lif->adapter->bars.bar[2].len) { + IONIC_PRINT(ERR, "Cannot reserve queue from NIC mem"); + return -ENOMEM; + } + q_base = (void *) + ((uintptr_t)lif->adapter->bars.bar[2].vaddr + + (uintptr_t)lif->adapter->cmb_offset); + /* CMB PA is a relative address */ + q_base_pa = lif->adapter->cmb_offset; + lif->adapter->cmb_offset += q_size; + } + IONIC_PRINT(DEBUG, "Q-Base-PA = %#jx CQ-Base-PA = %#jx " "SG-base-PA = %#jx", q_base_pa, cq_base_pa, sg_base_pa); @@ -744,6 +759,8 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, int err; flags = IONIC_QCQ_F_SG; + if (lif->state & IONIC_LIF_F_Q_IN_CMB) + flags |= IONIC_QCQ_F_CMB; seg_size = rte_pktmbuf_data_room_size(mb_pool); @@ -806,6 +823,8 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, int err; flags = IONIC_QCQ_F_SG; + if (lif->state & IONIC_LIF_F_Q_IN_CMB) + flags |= IONIC_QCQ_F_CMB; num_segs_fw = IONIC_TX_MAX_SG_ELEMS_V1 + 1; @@ -994,6 +1013,19 @@ ionic_lif_alloc(struct ionic_lif *lif) return -ENXIO; } + if (adapter->q_in_cmb) { + if (adapter->bars.num_bars >= 3 && + lif->qtype_info[IONIC_QTYPE_RXQ].version >= 2 && + lif->qtype_info[IONIC_QTYPE_TXQ].version >= 3) { + IONIC_PRINT(INFO, "%s enabled on %s", + PMD_IONIC_CMB_KVARG, lif->name); + lif->state |= IONIC_LIF_F_Q_IN_CMB; + } else { + IONIC_PRINT(ERR, "%s not supported on %s, disabled", + PMD_IONIC_CMB_KVARG, lif->name); + } + } + IONIC_PRINT(DEBUG, "Allocating Lif Info"); rte_spinlock_init(&lif->adminq_lock); @@ -1537,6 +1569,9 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq) }; int err; + if (txq->flags & IONIC_QCQ_F_CMB) + ctx.cmd.q_init.flags |= rte_cpu_to_le_16(IONIC_QINIT_F_CMB); + IONIC_PRINT(DEBUG, "txq_init.index %d", q->index); IONIC_PRINT(DEBUG, "txq_init.ring_base 0x%" PRIx64 "", q->base_pa); IONIC_PRINT(DEBUG, "txq_init.ring_size %d", @@ -1588,6 +1623,9 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq) }; int err; + if (rxq->flags & IONIC_QCQ_F_CMB) + ctx.cmd.q_init.flags |= rte_cpu_to_le_16(IONIC_QINIT_F_CMB); + IONIC_PRINT(DEBUG, "rxq_init.index %d", q->index); IONIC_PRINT(DEBUG, "rxq_init.ring_base 0x%" PRIx64 "", q->base_pa); IONIC_PRINT(DEBUG, "rxq_init.ring_size %d", diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index f1cc0f60fc..b9d2e879fb 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -49,6 +49,7 @@ struct ionic_rx_stats { #define IONIC_QCQ_F_INITED BIT(0) #define IONIC_QCQ_F_SG BIT(1) #define IONIC_QCQ_F_DEFERRED BIT(4) +#define IONIC_QCQ_F_CMB BIT(5) #define IONIC_QCQ_F_CSUM_L3 BIT(7) #define IONIC_QCQ_F_CSUM_UDP BIT(8) #define IONIC_QCQ_F_CSUM_TCP BIT(9) @@ -126,6 +127,7 @@ struct ionic_qtype_info { #define IONIC_LIF_F_LINK_CHECK_NEEDED BIT(1) #define IONIC_LIF_F_UP BIT(2) #define IONIC_LIF_F_FW_RESET BIT(3) +#define IONIC_LIF_F_Q_IN_CMB BIT(4) #define IONIC_LIF_NAME_MAX_SZ (32) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 24f498d910..1885c5961e 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -600,7 +600,8 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, int err; struct ionic_txq_desc *desc_base = q->base; - rte_prefetch0(&desc_base[q->head_idx]); + if (!(txq->flags & IONIC_QCQ_F_CMB)) + rte_prefetch0(&desc_base[q->head_idx]); rte_prefetch0(IONIC_INFO_PTR(q, q->head_idx)); if (tx_pkts) { @@ -619,7 +620,8 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, while (nb_tx < nb_pkts) { uint16_t next_idx = Q_NEXT_TO_POST(q, 1); - rte_prefetch0(&desc_base[next_idx]); + if (!(txq->flags & IONIC_QCQ_F_CMB)) + rte_prefetch0(&desc_base[next_idx]); rte_prefetch0(IONIC_INFO_PTR(q, next_idx)); if (nb_tx + 1 < nb_pkts) { @@ -1172,7 +1174,8 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do, /* Prefetch 4 x 16B comp */ rte_prefetch0(&cq_desc_base[Q_NEXT_TO_SRVC(cq, 4)]); /* Prefetch 4 x 16B descriptors */ - rte_prefetch0(&q_desc_base[Q_NEXT_TO_POST(q, 4)]); + if (!(rxq->flags & IONIC_QCQ_F_CMB)) + rte_prefetch0(&q_desc_base[Q_NEXT_TO_POST(q, 4)]); ionic_rx_clean_one(rxq, cq_desc, rx_svc); From patchwork Tue Oct 18 19:41:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118497 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AA91CA0560; Tue, 18 Oct 2022 21:47:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DCC8E4161A; Tue, 18 Oct 2022 21:47:23 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2080.outbound.protection.outlook.com [40.107.93.80]) by mails.dpdk.org (Postfix) with ESMTP id 052F542B79 for ; Tue, 18 Oct 2022 21:47:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nA5b4y6Wa5n5pDd0TC31LA9RnhyX+DLydE3jV7yFrp3adRv4odkyeDU3qdaHAvbQvhIzpwLPSUIGBtqqJy436qJ7A4j/Kp0SRJleVEA6WREBWhlj5Af1FKNEkVGLdGYl/1Ne/6GtLHAEblXbaXjSluXVOlJjk8u6sT+em/E5RB/J0IDeA43fajgOs/uLPG8mUo6M6/JJiUc0VGMLqsZZ8pp1t/RerXCF7z2h9vZyLhAUnI+fmKX5tkZeM+aE6u1CPZS3r5gULDSppfKH+3XONkFvVMyKpS6EO9vi2pPk6k9aXZQ55FrXiV3vew9njgYEcsb+OFTDJvSGgwF/gJT5Hg== 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=Eu4ZZSERRaayfdNVuWwa9lBa02MugG01U7DOYZG7DD0=; b=cj2JU2e9pHJvGq1Wp+i3L4oVPfXuX0KAilcZpW3qrx59zNzNwJe3aOfqFxuy3Zz9nfFlZ6goJnPii1UWK9XEkU+SHdUngOWiqetUQqVKgYIgN98niXTfrAaczVoHfbfU+Pt1camA40BMB7Oi3qP4TFrA7OY32oiuvtJv93ZkEWs7QGycroZsuNgyAJGfH1ay8zluZ5W72vrqR1T4h9i6Mp7p2hDVD+r4fRo+NsTb0nHnb5vcG62PXiypQJRBIZsc3ijlWCu2NYmvtv75nVhuPIyLGFFeujjKjAaMtctGTBqJQsLGj1vHLfLSt87cd5G14uplnx0kE13wihPUmYMqVQ== 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=Eu4ZZSERRaayfdNVuWwa9lBa02MugG01U7DOYZG7DD0=; b=jt2yQdMWAMf9Z4Z9nXADhFwk4ECN/2gwf6N69SZvT1nniBH7uO4R5TFjdZQF3Z5qqXx9PnrQZ47Rxch1gmLLFG5tvxJlt+ULE/y3I8gg2VhJSw+4j4IY2rl5mvf64ScXLEskVc1g9sgsNu9tc19Mk0fKeti9yxgvOGvB6QItq84= Received: from DS7PR05CA0095.namprd05.prod.outlook.com (2603:10b6:8:56::29) by MN0PR12MB6247.namprd12.prod.outlook.com (2603:10b6:208:3c1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32; Tue, 18 Oct 2022 19:47:20 +0000 Received: from DM6NAM11FT115.eop-nam11.prod.protection.outlook.com (2603:10b6:8:56:cafe::b9) by DS7PR05CA0095.outlook.office365.com (2603:10b6:8:56::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.11 via Frontend Transport; Tue, 18 Oct 2022 19:47:19 +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 DM6NAM11FT115.mail.protection.outlook.com (10.13.173.33) 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:47:19 +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:47:18 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 30/36] net/ionic: update array allocations to use calloc Date: Tue, 18 Oct 2022 12:41:25 -0700 Message-ID: <20221018194131.23006-31-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 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: DM6NAM11FT115:EE_|MN0PR12MB6247:EE_ X-MS-Office365-Filtering-Correlation-Id: 415e0fc1-e382-482b-ca84-08dab1419172 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qM9TyvwW71sR81jcWy0XAy9Wek+463kFtRXeFIPmjFrJlfrRuTg0LcRlBRt88a4H6amy57uN4rJ1ab99Y+fhfsz9wQTD6IvN5iJnL1pp+dD932Us4iSnkXq7ofOUtE1NwnjKEo5QmkvgKkXToT3zB4ehMyWEgcnCFPDymWNzK5c2A0OOr+cYYgyRlpVlmhsiazX35b5NYOl+TJAMSflUjiCIwbMvH9VTDE8DG5Gy/uGzNQV15+fJQox+qJuchgSOoRw6q9+KEICJNGJAZqppAiGyLVMhPEeyN/JV65Ldwssa44Ja7N2KxFh3dsOLPNJYQIeQVgExUd1QdI03IWOs/dfl799UyKH5BRsswA9wrAXctLMFXHz2CFWI7dQb+m8uoskD35gGPUE+zGahlH5FKo2WfrT1/ys8cUOTMA3eFH4WQhWUZyz4YBQWZlZGvtVtls0h7f2r2r0VkeKwbvkqGcwsBMNbcuTy0Mk1x8/58poCV4ulkoPMljynwxizBL386RjlNcd4rW2I2BzpqIuskDa0+12QzDoEbUbjygnGEGO/LY1NfIrw21695yjpYeC9cCYldUSqscb6vkc3VzWHOVSX+X9vf19oyLxFaZsetHzg59Y9gaUJf36pkDmgZ3Ox94vfwLlPjf+LQ54q/LzYowndvZsZUSbReRJDVrdTe6wca13SmuZXdl8a7EmKzDjul+Jf8O4+wtA6hs2GWYd2qBm6vuO9EH6n3kAn31FVv1mnoLw4PD5xj88SllZQsg0E4AehFcbK7Wj3X+jxxaBWNugqZSizBFdU2L4c43+6WAFT0jz1ITAKw8qx+2ZUfaP/ 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)(346002)(39860400002)(136003)(376002)(396003)(451199015)(36840700001)(40470700004)(46966006)(6916009)(44832011)(8676002)(316002)(4326008)(26005)(41300700001)(186003)(2906002)(1076003)(336012)(5660300002)(2616005)(478600001)(16526019)(8936002)(81166007)(36756003)(82740400003)(356005)(82310400005)(426003)(47076005)(36860700001)(6666004)(83380400001)(70586007)(70206006)(86362001)(40460700003)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:47:19.6931 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 415e0fc1-e382-482b-ca84-08dab1419172 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: DM6NAM11FT115.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6247 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 Use rte_calloc() where appropriate. This makes the code clearer. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_ethdev.c | 6 +++--- drivers/net/ionic/ionic_lif.c | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 0184ffb02e..b1d8663329 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -1003,9 +1003,9 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params) adapter->max_mac_addrs); /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("ionic", - RTE_ETHER_ADDR_LEN * adapter->max_mac_addrs, 0); - + eth_dev->data->mac_addrs = rte_calloc("ionic", + adapter->max_mac_addrs, + RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { IONIC_PRINT(ERR, "Failed to allocate %u bytes needed to " "store MAC addresses", diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index db0893acb8..8b10b26266 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -1037,17 +1037,17 @@ ionic_lif_alloc(struct ionic_lif *lif) return -ENOMEM; } - lif->txqcqs = rte_zmalloc("ionic", sizeof(*lif->txqcqs) * - adapter->max_ntxqs_per_lif, 0); - + lif->txqcqs = rte_calloc("ionic", + adapter->max_ntxqs_per_lif, + sizeof(*lif->txqcqs), 0); if (!lif->txqcqs) { IONIC_PRINT(ERR, "Cannot allocate tx queues array"); return -ENOMEM; } - lif->rxqcqs = rte_zmalloc("ionic", sizeof(*lif->rxqcqs) * - adapter->max_nrxqs_per_lif, 0); - + lif->rxqcqs = rte_calloc("ionic", + adapter->max_nrxqs_per_lif, + sizeof(*lif->rxqcqs), 0); if (!lif->rxqcqs) { IONIC_PRINT(ERR, "Cannot allocate rx queues array"); return -ENOMEM; From patchwork Tue Oct 18 19:41:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118498 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7885AA0560; Tue, 18 Oct 2022 21:47:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1C41142B7E; Tue, 18 Oct 2022 21:47:26 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2066.outbound.protection.outlook.com [40.107.93.66]) by mails.dpdk.org (Postfix) with ESMTP id 1AAA74284D for ; Tue, 18 Oct 2022 21:47:25 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TNVqgMlDvSwmaO+ArXdjdYmj7NYg2Uiq9lvezIQiG+YC+/k7rDwXvgZI7BjQYoqwG0+o2rkE0okcoV/X8xc+eaTkgUVuywjqpdv8uqRBTC8XL014hVSWI4338jeO0fLIx6o+WhnZ6FDvftOJg4k1jButEUwTdKLgvK0A5moOZWCFw325lF88aYAWyvJz+IXFPXI7z00U/dGpJLc6xFlwLmTkqoVu/z/D437II1tgFmtEE5fnjfLTBU4pNVOVrc5XZWno9RN5wwbxkmfw4Y0K68u3EmsN6jO7UalTDVpuqh2AKgBEHtLDwMSfOsJBR0GZbcd3aHX+6CGbYJLLdIWi7g== 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=U6vYHqv5ZDhhB1KH1ABCDdp9AYPDyvFRdEe4Tpmz8Fg=; b=fMtRM7PmZGh3qbbmw3mNHqkPj6nqX2RqKx8qPxFod13LQ1U2uOG693qJ/uUrpu1OD6cFKQrnABlHe63XQDOPwzYP6vRotFbtfnyr4IuMwnz6gAlstB9CLIwrRgcAVy4g0Gen5oHRUSizUmstxqtMqB9g/feQ+6cwqdv/qCidx8YgCbGO7C/XomL8MywqX1pfOaBi+uoLKzbvbt6tSXawRzbPEwz+7xtkleHRDC+6IPa2LnULAuoSGicUTCd7o5Bw5yWrh3/3tnpc5kTNd6Fp0519b++nd1uNBZ5fl3ZJhMsf9X91xiaGzVWjxh/6BNGioeDnfzRw4gCaHIvUsm7V/A== 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=U6vYHqv5ZDhhB1KH1ABCDdp9AYPDyvFRdEe4Tpmz8Fg=; b=xRUWaJxlwxjRxAsFKc1MxU7vdDJf6gXrk9vwFw4qiS4SyJR9d/Ashag6OGE0+Bgx4quaUq0Ch0O2hWuXVTqUOlNnSTM5ZAGcmtv5fyEHs7FoZD5BneiER6vhiaoWPbtGMPFF5JvwkBQpyvcOkF4PYgcw7LNHsNoxKWisape3e4w= Received: from DS7PR05CA0087.namprd05.prod.outlook.com (2603:10b6:8:56::9) by PH7PR12MB6811.namprd12.prod.outlook.com (2603:10b6:510:1b5::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 18 Oct 2022 19:47:23 +0000 Received: from DM6NAM11FT115.eop-nam11.prod.protection.outlook.com (2603:10b6:8:56:cafe::bb) by DS7PR05CA0087.outlook.office365.com (2603:10b6:8:56::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.14 via Frontend Transport; Tue, 18 Oct 2022 19:47:23 +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 DM6NAM11FT115.mail.protection.outlook.com (10.13.173.33) 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:47:23 +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:47:22 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 31/36] net/ionic: add alignment and socket info in allocations Date: Tue, 18 Oct 2022 12:41:26 -0700 Message-ID: <20221018194131.23006-32-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 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: DM6NAM11FT115:EE_|PH7PR12MB6811:EE_ X-MS-Office365-Filtering-Correlation-Id: 05e67ac3-1405-46ce-4700-08dab141937f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gcp//ubpERo1eMeiKwtYrp3ZKdW2608AnrhgMY/PcJcCY2EXVxVZ1aYdHV5z5eI7KdA/8RIV1fd4DDQxFj7TP9nvnDiNBqy5AxgxZ4jlCw5Ovuix6tUxuTR7NKft9xY4plhw4tkmcyjJkz6zMsI5jUb2DFXNqtl3+1O3HbL7XGekNy9y9ZgsMTbFmtwQC6pnJrX6R+AAUTekCdfSS0HlBWOCcznhY9/KhZuvKn118U8qWxKrMnqXXoM6yy04H6TkkXHUz0SiW3Z0oyF7rJ+Q3doYsCmHdBTq34sQU0cZgTNy/EKaJmaYVBdJrJtkyeLSAPolpWDlZtVQr4MCKub1gE73b5JBLNoutmAp1NKE62BkZXz9ZEN59grf3mME1xFZ2xWXkmbhe+dqInEnt4TU/vBbE96LxkQ7yRCL1+TACvF13LDK9dOFSrpAcjz7I/8hKLFJ7QXGtM+euMsulgDrD/rwpB9hWHDNWwTkDWebsn4MBKmW0B78CtRpmxSQ9qf/Zr7oYaXjqlcMOULFnZSQum53rnru5cC/bS9Wk4tGIPiyvj4BXRJMjSZ9Tn3JnSUrZ9GhsthdDGpE9N/BnxVogkaJw4QihJlNALlu6ELLs2XYYzYp9DiCDuecshs02AJOQuK/+7XPSnEZ5OJL8yS4yh0zdcGn7Z0cRVRylUr3s/MxJEGUSWMOiXS2mQaW8RJWbceMyTfEeZcHTJHRw+nK99dFyl2CJGTByg9dKO0xAY7jtV0lKFAQ5oQ4zlpibgTDt10FFshkWPg6uOf18tV30w35Z530pYVWjVKdCnlhy/0LnpiPc7PDm6PhevDeugdD 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)(376002)(346002)(396003)(136003)(451199015)(46966006)(40470700004)(36840700001)(81166007)(356005)(47076005)(426003)(336012)(2616005)(82740400003)(1076003)(16526019)(82310400005)(2906002)(186003)(70586007)(6916009)(44832011)(36756003)(316002)(478600001)(40480700001)(41300700001)(83380400001)(86362001)(26005)(5660300002)(70206006)(36860700001)(40460700003)(4326008)(8676002)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:47:23.1304 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05e67ac3-1405-46ce-4700-08dab141937f 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: DM6NAM11FT115.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6811 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 will avoid memory access penalties on NUMA systems. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_ethdev.c | 5 +++-- drivers/net/ionic/ionic_lif.c | 13 ++++++++----- drivers/net/ionic/ionic_rx_filter.c | 3 +-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index b1d8663329..2f720315c3 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -1005,7 +1005,8 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params) /* Allocate memory for storing MAC addresses */ eth_dev->data->mac_addrs = rte_calloc("ionic", adapter->max_mac_addrs, - RTE_ETHER_ADDR_LEN, 0); + RTE_ETHER_ADDR_LEN, + RTE_CACHE_LINE_SIZE); if (eth_dev->data->mac_addrs == NULL) { IONIC_PRINT(ERR, "Failed to allocate %u bytes needed to " "store MAC addresses", @@ -1083,7 +1084,7 @@ eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev, goto err; } - adapter = rte_zmalloc("ionic", sizeof(*adapter), 0); + adapter = rte_zmalloc("ionic", sizeof(*adapter), RTE_CACHE_LINE_SIZE); if (!adapter) { IONIC_PRINT(ERR, "OOM"); err = -ENOMEM; diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 8b10b26266..eeec4860ba 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -598,7 +598,8 @@ ionic_qcq_alloc(struct ionic_lif *lif, total_size += rte_mem_page_size(); } - new = rte_zmalloc("ionic", struct_size, 0); + new = rte_zmalloc_socket("ionic", struct_size, + RTE_CACHE_LINE_SIZE, socket_id); if (!new) { IONIC_PRINT(ERR, "Cannot allocate queue structure"); return -ENOMEM; @@ -1037,17 +1038,19 @@ ionic_lif_alloc(struct ionic_lif *lif) return -ENOMEM; } - lif->txqcqs = rte_calloc("ionic", + lif->txqcqs = rte_calloc_socket("ionic", adapter->max_ntxqs_per_lif, - sizeof(*lif->txqcqs), 0); + sizeof(*lif->txqcqs), + RTE_CACHE_LINE_SIZE, socket_id); if (!lif->txqcqs) { IONIC_PRINT(ERR, "Cannot allocate tx queues array"); return -ENOMEM; } - lif->rxqcqs = rte_calloc("ionic", + lif->rxqcqs = rte_calloc_socket("ionic", adapter->max_nrxqs_per_lif, - sizeof(*lif->rxqcqs), 0); + sizeof(*lif->rxqcqs), + RTE_CACHE_LINE_SIZE, socket_id); if (!lif->rxqcqs) { IONIC_PRINT(ERR, "Cannot allocate rx queues array"); return -ENOMEM; diff --git a/drivers/net/ionic/ionic_rx_filter.c b/drivers/net/ionic/ionic_rx_filter.c index bbfc217826..cfcfd2a1ea 100644 --- a/drivers/net/ionic/ionic_rx_filter.c +++ b/drivers/net/ionic/ionic_rx_filter.c @@ -55,8 +55,7 @@ ionic_rx_filter_save(struct ionic_lif *lif, uint32_t flow_id, struct ionic_rx_filter *f; uint32_t key; - f = rte_zmalloc("ionic", sizeof(*f), 0); - + f = rte_zmalloc("ionic", sizeof(*f), RTE_CACHE_LINE_SIZE); if (!f) return -ENOMEM; From patchwork Tue Oct 18 19:41:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118499 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CDB2CA0560; Tue, 18 Oct 2022 21:47:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C35F44281C; Tue, 18 Oct 2022 21:47:57 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2077.outbound.protection.outlook.com [40.107.94.77]) by mails.dpdk.org (Postfix) with ESMTP id 27CFB42802 for ; Tue, 18 Oct 2022 21:47:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=faDBFnTpNKh2w8ogm8/xz/BvznZ7Se+np8rkFjZ606ASkK5ggHjU0bSsCEazOOTvG50JNSMGitVXM7FZUX6KdKVIQhu3NieEItUx6yyoXcHw48wjNQgIvHZwb8uaHebl05H1gEJXHctY062mgcsI0N8tdMu/rFzz2VTre3t9nxk8k0NF22edIBuhQquZ94QCCqEo8rk4JtU0dp1or7smG7VnDvhiEpWJNs81MKX036D0bd2Mk+2ftC+I3OGStYuq/jBhKVY3Fv/M9KMDEyxy6rWlREfHdM6vTWWi0rGwLUJgOTs1aL/3tQKU5Mv56UZx/ZOKk8sfbacDsUKog06sYw== 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=RdEiJouBQAUAbVhTfHI+3frGVwy8s8g4zKnqMRnk0+8=; b=Ds0pUQoJ1wZpDtXsIz0hVMhyRwVcpi8FA65Sh7ICyAeyjlaDayJqQbmgT+NFePl5egrsWQJOLWTEmjuMH0PlIwvOjBTQHDrrk+QamZdOMgAWSwjjyTdysr/zsAgLMfg1UBcdFOKXZVi0p7/93bg1aJWINb2qSeCQGx8LX1tM+bOZTMq3igcPYGhzPwpwCtipdjOt1DWwyq1Lh7ThqWfCbk1+Rw6Mv2Eax3Or+NjLdQ3zPqrHwMp3DiFqujVQ3Pn5XyKnmnv5sKNc56ujHrcV60fsfCgpN5EuAR+Kyq1ia1hLVgo8kv5nz20WI7AN0zSX2pziwQpnY6WVyLMHYj54mQ== 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=RdEiJouBQAUAbVhTfHI+3frGVwy8s8g4zKnqMRnk0+8=; b=bH30Phtyezs83J0lTOOtvUv81qx388KbG9+wasTZoI7N6x2ZSqVCPayL+D+BzoHnevXLTgn8IaHyH51Hg1/KtLELyt+MxnB4bXgiAcbt0645Jrl4P9fNj/0y/C1OE2KpEE9X1ZcJZHVDglJJd4KHFwC5vktcserfmQcwdin8A9I= Received: from DS7PR03CA0341.namprd03.prod.outlook.com (2603:10b6:8:55::23) by SJ0PR12MB6807.namprd12.prod.outlook.com (2603:10b6:a03:479::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 18 Oct 2022 19:47:54 +0000 Received: from DM6NAM11FT111.eop-nam11.prod.protection.outlook.com (2603:10b6:8:55:cafe::10) by DS7PR03CA0341.outlook.office365.com (2603:10b6:8:55::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30 via Frontend Transport; Tue, 18 Oct 2022 19:47:53 +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 DM6NAM11FT111.mail.protection.outlook.com (10.13.173.26) 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:47:53 +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:47:52 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 32/36] net/ionic: allow client to specify Tx free threshold Date: Tue, 18 Oct 2022 12:41:27 -0700 Message-ID: <20221018194131.23006-33-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 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: DM6NAM11FT111:EE_|SJ0PR12MB6807:EE_ X-MS-Office365-Filtering-Correlation-Id: f8c47a90-94f3-478c-c914-08dab141a575 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RiVgsi5z0o8fwq9o1PqPl1QRM9EBzkpvWa/9UUfoHJj/1Ilc+Gr1ySEinR1+Qi9E3tweTZ0lvwZJNuJ6yP2hl0VheDYsiddf4PTrY4LkzQONMnUMfzxKjxhtRPMp2elN93+0Geun3vRquMf40L0eFCJe56YdYQu2uuNK7ra3o8tlj+ErWoykKAd8uoIHMIS64dEawkDAeDE82joPYpe4OW9Q/xaSmsFv9sL2HRT1/NI7QuQ8ghALh4HkfjEqzz9V3KL0QsHswknPjYP/L/AvlgIgcDxv2Dsp7ijbeMyVGvfwRTdLNHVAI3K41DhhzkttoUF2FeOMDzEa22n8Dvqyr2r03q4FD5Lduzlvs/zDGo8d2WHLw83szV+RyXFgzv+BLyoQTQoVIVNa47DFxLb9A9pGvb4mbzk4IePF0nul0wu7VQzb6kOcrXvpNaK0jWzSi0NVWCEIdh9wQj675XOA4XQX/fKjb3L2/mpYhkEsw2L4DYH3Mkn9FxXvywuI3LizLDl8/UQTb4uGle69g3TcpPv2aR445OBfOajFw1vkP9isjV/8/8Ghx/Um7PJYIUC1YXZj+6X7CYVoOGB40hP5q+/j05RgLXCu3MpWjjboKqbBMiNGJmd/uaY495va2mB/wE47qv1RfvJ9FkEsdzK4kyhImuVri8xzdU+e9rIHPHIf137uRi+10a0Pvu9KQZN9a6N7OdTIzkaAhZzaYgtknFs8ys5vzb2XZYCsbvFBkxq/xDO9vH/SgRkEiXs/CbTPcG3jcHexXwtuTFHsmxgbeB82Hci1jqVbxk4/VYy6nEuGipyMnTQCNHF8yAXjG4o4 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)(39860400002)(136003)(451199015)(40470700004)(36840700001)(46966006)(36756003)(86362001)(356005)(81166007)(82740400003)(26005)(1076003)(186003)(16526019)(47076005)(426003)(40480700001)(36860700001)(40460700003)(2906002)(44832011)(5660300002)(6666004)(2616005)(478600001)(336012)(83380400001)(8676002)(316002)(6916009)(82310400005)(41300700001)(70586007)(70206006)(4326008)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:47:53.2515 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f8c47a90-94f3-478c-c914-08dab141a575 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: DM6NAM11FT111.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6807 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 Some clients have opinions about how often to flush the transmit ring. The default value is the number of Tx descriptors minus the default Tx burst size. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_dev.h | 1 + drivers/net/ionic/ionic_ethdev.c | 4 ++-- drivers/net/ionic/ionic_lif.h | 1 + drivers/net/ionic/ionic_rxtx.c | 17 +++++++++++++++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index 7ac86396be..46434f81a4 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -20,6 +20,7 @@ #define IONIC_MAX_RING_DESC 32768 #define IONIC_MIN_RING_DESC 16 #define IONIC_DEF_TXRX_DESC 4096 +#define IONIC_DEF_TXRX_BURST 32 #define IONIC_DEVCMD_TIMEOUT 5 /* devcmd_timeout */ #define IONIC_DEVCMD_CHECK_PERIOD_US 10 /* devcmd status chk period */ diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 2f720315c3..1092c7a921 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -429,8 +429,8 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev, dev_info->tx_desc_lim = tx_desc_lim_v1; /* Driver-preferred Rx/Tx parameters */ - dev_info->default_rxportconf.burst_size = 32; - dev_info->default_txportconf.burst_size = 32; + dev_info->default_rxportconf.burst_size = IONIC_DEF_TXRX_BURST; + dev_info->default_txportconf.burst_size = IONIC_DEF_TXRX_BURST; dev_info->default_rxportconf.nb_queues = 1; dev_info->default_txportconf.nb_queues = 1; dev_info->default_rxportconf.ring_size = IONIC_DEF_TXRX_DESC; diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index b9d2e879fb..09ebca7e89 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -104,6 +104,7 @@ struct ionic_tx_qcq { /* cacheline2 */ uint16_t num_segs_fw; /* # segs supported by current FW */ + uint16_t free_thresh; uint16_t flags; struct ionic_tx_stats stats; diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 1885c5961e..f43f9c1149 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -223,6 +223,13 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id, if (!rte_is_power_of_2(nb_desc) || nb_desc < IONIC_MIN_RING_DESC) return -EINVAL; /* or use IONIC_DEFAULT_RING_DESC */ + if (tx_conf->tx_free_thresh > nb_desc) { + IONIC_PRINT(ERR, + "tx_free_thresh must be less than nb_desc (%u)", + nb_desc); + return -EINVAL; + } + /* Free memory prior to re-allocation if needed... */ if (eth_dev->data->tx_queues[tx_queue_id] != NULL) { ionic_dev_tx_queue_release(eth_dev, tx_queue_id); @@ -252,6 +259,10 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id, if (offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) txq->flags |= IONIC_QCQ_F_FAST_FREE; + txq->free_thresh = + tx_conf->tx_free_thresh ? tx_conf->tx_free_thresh : + nb_desc - IONIC_DEF_TXRX_BURST; + eth_dev->data->tx_queues[tx_queue_id] = txq; return 0; @@ -609,8 +620,10 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, rte_mbuf_prefetch_part2(tx_pkts[0]); } - /* Cleaning old buffers */ - ionic_tx_flush(txq); + if (unlikely(ionic_q_space_avail(q) < txq->free_thresh)) { + /* Cleaning old buffers */ + ionic_tx_flush(txq); + } nb_avail = ionic_q_space_avail(q); if (unlikely(nb_avail < nb_pkts)) { From patchwork Tue Oct 18 19:41:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118500 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A59A0A0560; Tue, 18 Oct 2022 21:48:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 987FE42B6F; Tue, 18 Oct 2022 21:48:02 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2058.outbound.protection.outlook.com [40.107.223.58]) by mails.dpdk.org (Postfix) with ESMTP id 8D0C44282F for ; Tue, 18 Oct 2022 21:48:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cQEgKHEO6vu9zfRskv7c6JURVWSxKjPkNhzbclTEQqTkMyQ2QBw4pMy9bbVQIBcOgNgA2XCl4G79ENquPDNWdPZ/r3WXHJ1ECo1Fr0Agii4lIMbb7aiSz4bNkEoz7oQSszKxa5JA17HeSWOjJm4T1rk7wNhhrFVjiujMpu+gLQ1hVqEhi0oUUNnIMZG9TtyjAfHQBONxo8kKEF6MJ4DEuZM8DvzbUiZbuXhjNa21pRsczitcHBY0FpiEfjL69UfIHMP80gOKUk/NaCZcBvWXICkQsKtZkaFNU89OUBvEkFab13oKdSmImmkAnNrLAkEgGdZN0I4QbDrzRqLOVTkrhw== 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=ralif1IdElOgHLClUEMkK+CnEiu2mYKL44wAEDqp2Gs=; b=Oyg8UqceTES+fNdZiuYyln4cPwKN8Ozqdix0I4aouUtFhFM0i4RhIAOvi2FHI27N+Z5KxfGqiJqendlpPzsLnwi7bVJ6V5lr7ePm3s2sVwZlW6Hpm3NncCba7BAfduhR6yjUnlZ3x1LKxBOuK3fpvlj4yxwdbI8QQ47Hm2zLQAx6St/VFQP9mFj+v2IvIV0H5Q1ZMQ1BQM+QOeBh8QSNYVPnhmQszPOTTas2/2IUUISqLti5KjCK86J91ovrImPIhPK6D1egGWaXlUrdB4UCsASLopqwE5AUV0w9elP/oxRh3AXZLfwZZp3PlfAdNnjn4SWiW4/nWYQzhkKuWGZd/Q== 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=ralif1IdElOgHLClUEMkK+CnEiu2mYKL44wAEDqp2Gs=; b=xcETZzS45qhRJnh6/yFjBRiB05Byl7WK8UlHilRm+ZSAqv2gmjwTZuqeSPBbrgh5QJlqs42TF5n/uxt8ZWdEIDbkztQ4zra/ApHn8xXkAYM+TmQc893UyILVLxKZ2WAD1CLXKY4RhIGFhpazWrHgxatcYJNSBxeYhv/AIEyuBWA= Received: from DS7PR06CA0050.namprd06.prod.outlook.com (2603:10b6:8:54::32) by DS7PR12MB6311.namprd12.prod.outlook.com (2603:10b6:8:94::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 18 Oct 2022 19:47:58 +0000 Received: from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:8:54:cafe::e5) by DS7PR06CA0050.outlook.office365.com (2603:10b6:8:54::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.31 via Frontend Transport; Tue, 18 Oct 2022 19:47:58 +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 DM6NAM11FT024.mail.protection.outlook.com (10.13.172.159) 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:47:58 +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:47:57 -0500 From: Andrew Boyer To: CC: Andrew Boyer , R Mohamed Shah Subject: [PATCH v2 33/36] net/ionic: add optimized handlers for non-scattered Rx/Tx Date: Tue, 18 Oct 2022 12:41:28 -0700 Message-ID: <20221018194131.23006-34-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 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: DM6NAM11FT024:EE_|DS7PR12MB6311:EE_ X-MS-Office365-Filtering-Correlation-Id: 41e08eff-2628-4429-c9c2-08dab141a8c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4zy5+jW6pU3At/z4tE8sUurhIBQX6HQHQ/VjPcj3k4WcZwKCCyNqZPFduAlpS3LUTHNue/Hmo0JhT7b0cMyuaoeFI9RuLQXTsDOzTt96dG33L+KCowGoARZbWo4hXn5ks/U1V3kq9/ALOy2Mg3LvmQdiU8zwf5YjfQei44wniwy3xXP+SQUADw/B7rpTUFNMcJjuud/GWT29t8jeq9q3Fn6BjDVu9FO0HFlJ+FRIbWiKxrAJhdqCtuDFE7yb6mLIEASw23jQV6oVGWAY4ndfABFBMfrLIb8rMYBIqX3LHU1c42Wn/jsJxKXMXMLb5jWOjRQOpedsPM6gNHFdrLhVEAD7yrdOKVGrVDtoIThTSzd4CA1YFZoY15tuBnw7+OXPMTXCfalPJK8EunWc+nDSUJdQzX+PAw84cAs7Eb/Ydx5TTMdW+xYNAbhJDFp7PgBvlWXForxaRANf33W8GQvhEQQfi9aH/8bdrprqkmQFWhCOipovdmEnDcG7srhMlweiM0p0SfckkGn7KlN9KVtoiS/7pYdUIxkCy3QbOyBq0gtm3xfjsqJhKmHtPi9fP9rPHWu2mG74CluyG5LAw1r1+XgEW7W3smmyDFPOAG+LsiGZLfh3PtvzB2psQI/kD3taXKVqenDB/xTnBApFoK+jFNAT1Tsxq24vuwSq9ZcTSf8jA1xqZKG4zO3I7VeaCTYVDl60jq0ROf8Kd+NXbw2BQm4RmoUB3ZEO1VyPNZfkllPZo3H0llbYd/iOSB4KcWj3NvkKnHEMoQbab78cazFp6/yadY4hTlJls8aTBUbexsVck+KRkx8gnkfagU5o7s2W 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)(346002)(376002)(136003)(39860400002)(451199015)(36840700001)(40470700004)(46966006)(36860700001)(8936002)(426003)(478600001)(41300700001)(1076003)(16526019)(6916009)(2616005)(2906002)(6666004)(86362001)(4326008)(40460700003)(70206006)(8676002)(70586007)(316002)(26005)(40480700001)(54906003)(5660300002)(44832011)(356005)(82310400005)(81166007)(186003)(82740400003)(36756003)(30864003)(336012)(47076005)(83380400001)(36900700001)(559001)(579004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:47:58.8312 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 41e08eff-2628-4429-c9c2-08dab141a8c6 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: DM6NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6311 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 The code is very similar, but the simple case can skip a few branches in the hot path. This improves PPS when 10KB mbufs are used. S/G is enabled on the Rx side by offload DEV_RX_OFFLOAD_SCATTER. S/G is enabled on the Tx side by offload DEV_TX_OFFLOAD_MULTI_SEGS. S/G is automatically enabled on the Rx side if the provided mbufs are too small to hold the maximum possible frame. To enable S/G in testpmd, add these args: --rx-offloads=0x2000 --tx-offloads=0x8000 Signed-off-by: Andrew Boyer Signed-off-by: R Mohamed Shah --- doc/guides/rel_notes/release_22_11.rst | 1 + drivers/net/ionic/ionic_ethdev.c | 25 +- drivers/net/ionic/ionic_lif.c | 61 ++- drivers/net/ionic/ionic_lif.h | 1 + drivers/net/ionic/ionic_rxtx.c | 576 ++----------------------- drivers/net/ionic/ionic_rxtx.h | 46 +- drivers/net/ionic/ionic_rxtx_sg.c | 496 +++++++++++++++++++++ drivers/net/ionic/ionic_rxtx_simple.c | 417 ++++++++++++++++++ drivers/net/ionic/meson.build | 2 + 9 files changed, 1054 insertions(+), 571 deletions(-) create mode 100644 drivers/net/ionic/ionic_rxtx_sg.c create mode 100644 drivers/net/ionic/ionic_rxtx_simple.c diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index c98c64d24d..1c3daf141d 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -150,6 +150,7 @@ New Features * Added support for advertising packet types. * Added support for descriptor status functions. * Added Q-in-CMB feature controlled by devarg ionic_cmb. + * Added optimized handlers for non-scattered Rx and Tx. * **Updated Intel iavf driver.** diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 1092c7a921..340fd0cd59 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -828,8 +828,6 @@ ionic_dev_configure(struct rte_eth_dev *eth_dev) ionic_lif_configure(lif); - ionic_lif_set_features(lif); - return 0; } @@ -883,6 +881,13 @@ ionic_dev_start(struct rte_eth_dev *eth_dev) if (dev_conf->lpbk_mode) IONIC_PRINT(WARNING, "Loopback mode not supported"); + /* Re-set features in case SG flag was added in rx_queue_setup() */ + err = ionic_lif_set_features(lif); + if (err) { + IONIC_PRINT(ERR, "Cannot set LIF features: %d", err); + return err; + } + lif->frame_size = eth_dev->data->mtu + IONIC_ETH_OVERHEAD; err = ionic_lif_change_mtu(lif, eth_dev->data->mtu); @@ -917,6 +922,18 @@ ionic_dev_start(struct rte_eth_dev *eth_dev) speed); } + if (lif->hw_features & IONIC_ETH_HW_RX_SG) + eth_dev->rx_pkt_burst = &ionic_recv_pkts_sg; + else + eth_dev->rx_pkt_burst = &ionic_recv_pkts; + + if (lif->hw_features & IONIC_ETH_HW_TX_SG) + eth_dev->tx_pkt_burst = &ionic_xmit_pkts_sg; + else + eth_dev->tx_pkt_burst = &ionic_xmit_pkts; + + eth_dev->tx_pkt_prepare = &ionic_prep_pkts; + ionic_dev_link_update(eth_dev, 0); return 0; @@ -980,10 +997,6 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params) IONIC_PRINT_CALL(); eth_dev->dev_ops = &ionic_eth_dev_ops; - eth_dev->rx_pkt_burst = &ionic_recv_pkts; - eth_dev->tx_pkt_burst = &ionic_xmit_pkts; - eth_dev->tx_pkt_prepare = &ionic_prep_pkts; - eth_dev->rx_descriptor_status = ionic_dev_rx_descriptor_status; eth_dev->tx_descriptor_status = ionic_dev_tx_descriptor_status; diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index eeec4860ba..383fff9ffd 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -755,11 +755,10 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, struct ionic_rx_qcq **rxq_out) { struct ionic_rx_qcq *rxq; - uint16_t flags, seg_size, hdr_seg_size, max_segs, max_segs_fw; + uint16_t flags = 0, seg_size, hdr_seg_size, max_segs, max_segs_fw = 1; uint32_t max_mtu; int err; - flags = IONIC_QCQ_F_SG; if (lif->state & IONIC_LIF_F_Q_IN_CMB) flags |= IONIC_QCQ_F_CMB; @@ -770,7 +769,18 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, max_mtu = rte_le_to_cpu_32(lif->adapter->ident.lif.eth.max_mtu); - max_segs_fw = IONIC_RX_MAX_SG_ELEMS + 1; + /* If mbufs are too small to hold received packets, enable SG */ + if (max_mtu > hdr_seg_size) { + IONIC_PRINT(NOTICE, "Enabling RX_OFFLOAD_SCATTER"); + lif->eth_dev->data->dev_conf.rxmode.offloads |= + RTE_ETH_RX_OFFLOAD_SCATTER; + ionic_lif_configure_rx_sg_offload(lif); + } + + if (lif->features & IONIC_ETH_HW_RX_SG) { + flags |= IONIC_QCQ_F_SG; + max_segs_fw = IONIC_RX_MAX_SG_ELEMS + 1; + } /* * Calculate how many fragment pointers might be stored in queue. @@ -820,14 +830,17 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, uint16_t ntxq_descs, struct ionic_tx_qcq **txq_out) { struct ionic_tx_qcq *txq; - uint16_t flags, num_segs_fw; + uint16_t flags = 0, num_segs_fw = 1; int err; - flags = IONIC_QCQ_F_SG; + if (lif->features & IONIC_ETH_HW_TX_SG) { + flags |= IONIC_QCQ_F_SG; + num_segs_fw = IONIC_TX_MAX_SG_ELEMS_V1 + 1; + } if (lif->state & IONIC_LIF_F_Q_IN_CMB) flags |= IONIC_QCQ_F_CMB; - num_segs_fw = IONIC_TX_MAX_SG_ELEMS_V1 + 1; + IONIC_PRINT(DEBUG, "txq %u num_segs %u", index, num_segs_fw); err = ionic_qcq_alloc(lif, IONIC_QTYPE_TXQ, @@ -1561,8 +1574,7 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq) .type = q->type, .ver = lif->qtype_info[q->type].version, .index = rte_cpu_to_le_32(q->index), - .flags = rte_cpu_to_le_16(IONIC_QINIT_F_SG | - IONIC_QINIT_F_ENA), + .flags = rte_cpu_to_le_16(IONIC_QINIT_F_ENA), .intr_index = rte_cpu_to_le_16(IONIC_INTR_NONE), .ring_size = rte_log2_u32(q->num_descs), .ring_base = rte_cpu_to_le_64(q->base_pa), @@ -1572,6 +1584,8 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq) }; int err; + if (txq->flags & IONIC_QCQ_F_SG) + ctx.cmd.q_init.flags |= rte_cpu_to_le_16(IONIC_QINIT_F_SG); if (txq->flags & IONIC_QCQ_F_CMB) ctx.cmd.q_init.flags |= rte_cpu_to_le_16(IONIC_QINIT_F_CMB); @@ -1615,8 +1629,7 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq) .type = q->type, .ver = lif->qtype_info[q->type].version, .index = rte_cpu_to_le_32(q->index), - .flags = rte_cpu_to_le_16(IONIC_QINIT_F_SG | - IONIC_QINIT_F_ENA), + .flags = rte_cpu_to_le_16(IONIC_QINIT_F_ENA), .intr_index = rte_cpu_to_le_16(IONIC_INTR_NONE), .ring_size = rte_log2_u32(q->num_descs), .ring_base = rte_cpu_to_le_64(q->base_pa), @@ -1626,6 +1639,8 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq) }; int err; + if (rxq->flags & IONIC_QCQ_F_SG) + ctx.cmd.q_init.flags |= rte_cpu_to_le_16(IONIC_QINIT_F_SG); if (rxq->flags & IONIC_QCQ_F_CMB) ctx.cmd.q_init.flags |= rte_cpu_to_le_16(IONIC_QINIT_F_CMB); @@ -1791,6 +1806,20 @@ ionic_lif_configure_vlan_offload(struct ionic_lif *lif, int mask) } } +void +ionic_lif_configure_rx_sg_offload(struct ionic_lif *lif) +{ + struct rte_eth_rxmode *rxmode = &lif->eth_dev->data->dev_conf.rxmode; + + if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_SCATTER) { + lif->features |= IONIC_ETH_HW_RX_SG; + lif->eth_dev->data->scattered_rx = 1; + } else { + lif->features &= ~IONIC_ETH_HW_RX_SG; + lif->eth_dev->data->scattered_rx = 0; + } +} + void ionic_lif_configure(struct ionic_lif *lif) { @@ -1836,13 +1865,11 @@ ionic_lif_configure(struct ionic_lif *lif) else lif->features &= ~IONIC_ETH_HW_RX_CSUM; - if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_SCATTER) { - lif->features |= IONIC_ETH_HW_RX_SG; - lif->eth_dev->data->scattered_rx = 1; - } else { - lif->features &= ~IONIC_ETH_HW_RX_SG; - lif->eth_dev->data->scattered_rx = 0; - } + /* + * NB: RX_SG may be enabled later during rx_queue_setup() if + * required by the mbuf/mtu configuration + */ + ionic_lif_configure_rx_sg_offload(lif); /* Covers VLAN_STRIP */ ionic_lif_configure_vlan_offload(lif, RTE_ETH_VLAN_STRIP_MASK); diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index 09ebca7e89..00c8add95c 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -188,6 +188,7 @@ void ionic_lif_stop(struct ionic_lif *lif); void ionic_lif_configure(struct ionic_lif *lif); void ionic_lif_configure_vlan_offload(struct ionic_lif *lif, int mask); +void ionic_lif_configure_rx_sg_offload(struct ionic_lif *lif); void ionic_lif_reset(struct ionic_lif *lif); int ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr); diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index f43f9c1149..d216980450 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -2,50 +2,28 @@ * Copyright 2018-2022 Advanced Micro Devices, Inc. */ -#include #include -#include #include #include #include -#include -#include -#include -#include #include -#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include -#include -#include -#include -#include -#include -#include -#include #include -#include +#include +#include +#include -#include "ionic_logs.h" -#include "ionic_mac_api.h" -#include "ionic_ethdev.h" +#include "ionic.h" +#include "ionic_dev.h" #include "ionic_lif.h" +#include "ionic_ethdev.h" #include "ionic_rxtx.h" +#include "ionic_logs.h" static void ionic_empty_array(void **array, uint32_t cnt, uint16_t idx) @@ -103,60 +81,6 @@ ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, qinfo->conf.tx_deferred_start = txq->flags & IONIC_QCQ_F_DEFERRED; } -static __rte_always_inline void -ionic_tx_flush(struct ionic_tx_qcq *txq) -{ - struct ionic_cq *cq = &txq->qcq.cq; - struct ionic_queue *q = &txq->qcq.q; - struct rte_mbuf *txm; - struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base; - void **info; - uint32_t i; - - cq_desc = &cq_desc_base[cq->tail_idx]; - - while (color_match(cq_desc->color, cq->done_color)) { - cq->tail_idx = Q_NEXT_TO_SRVC(cq, 1); - if (cq->tail_idx == 0) - cq->done_color = !cq->done_color; - - /* Prefetch 4 x 16B comp at cq->tail_idx + 4 */ - if ((cq->tail_idx & 0x3) == 0) - rte_prefetch0(&cq_desc_base[Q_NEXT_TO_SRVC(cq, 4)]); - - while (q->tail_idx != rte_le_to_cpu_16(cq_desc->comp_index)) { - /* Prefetch 8 mbuf ptrs at q->tail_idx + 2 */ - rte_prefetch0(IONIC_INFO_PTR(q, Q_NEXT_TO_SRVC(q, 2))); - - /* Prefetch next mbuf */ - void **next_info = - IONIC_INFO_PTR(q, Q_NEXT_TO_SRVC(q, 1)); - if (next_info[0]) - rte_mbuf_prefetch_part2(next_info[0]); - if (next_info[1]) - rte_mbuf_prefetch_part2(next_info[1]); - - info = IONIC_INFO_PTR(q, q->tail_idx); - for (i = 0; i < q->num_segs; i++) { - txm = info[i]; - if (!txm) - break; - - if (txq->flags & IONIC_QCQ_F_FAST_FREE) - rte_mempool_put(txm->pool, txm); - else - rte_pktmbuf_free_seg(txm); - - info[i] = NULL; - } - - q->tail_idx = Q_NEXT_TO_SRVC(q, 1); - } - - cq_desc = &cq_desc_base[cq->tail_idx]; - } -} - void __rte_cold ionic_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid) { @@ -394,7 +318,7 @@ ionic_tx_tso_next(struct ionic_tx_qcq *txq, struct ionic_txq_sg_elem **elem) return desc; } -static int +int ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) { struct ionic_queue *q = &txq->qcq.q; @@ -405,7 +329,7 @@ ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) rte_iova_t data_iova; uint64_t desc_addr = 0, next_addr; uint16_t desc_len = 0; - uint8_t desc_nsge; + uint8_t desc_nsge = 0; uint32_t hdrlen; uint32_t mss = txm->tso_segsz; uint32_t frag_left = 0; @@ -416,6 +340,7 @@ ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) bool start, done; bool encap; bool has_vlan = !!(txm->ol_flags & RTE_MBUF_F_TX_VLAN); + bool use_sgl = !!(txq->flags & IONIC_QCQ_F_SG); uint16_t vlan_tci = txm->vlan_tci; uint64_t ol_flags = txm->ol_flags; @@ -438,48 +363,22 @@ ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) hdrlen = txm->l2_len + txm->l3_len + txm->l4_len; } - seglen = hdrlen + mss; - left = txm->data_len; - data_iova = rte_mbuf_data_iova(txm); - desc = ionic_tx_tso_next(txq, &elem); + txm_seg = txm; start = true; + seglen = hdrlen + mss; - /* Chop data up into desc segments */ - - while (left > 0) { - len = RTE_MIN(seglen, left); - frag_left = seglen - len; - desc_addr = rte_cpu_to_le_64(data_iova + offset); - desc_len = len; - desc_nsge = 0; - left -= len; - offset += len; - if (txm->nb_segs > 1 && frag_left > 0) - continue; - done = (txm->nb_segs == 1 && left == 0); - ionic_tx_tso_post(q, desc, txm, - desc_addr, desc_nsge, desc_len, - hdrlen, mss, - encap, - vlan_tci, has_vlan, - start, done); - desc = ionic_tx_tso_next(txq, &elem); - start = false; - seglen = mss; - } - - /* Chop frags into desc segments */ - - txm_seg = txm->next; + /* Walk the chain of mbufs */ while (txm_seg != NULL) { offset = 0; data_iova = rte_mbuf_data_iova(txm_seg); left = txm_seg->data_len; + /* Split the mbuf data up into multiple descriptors */ while (left > 0) { next_addr = rte_cpu_to_le_64(data_iova + offset); - if (frag_left > 0) { + if (frag_left > 0 && use_sgl) { + /* Fill previous descriptor's SGE */ len = RTE_MIN(frag_left, left); frag_left -= len; elem->addr = next_addr; @@ -487,16 +386,19 @@ ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) elem++; desc_nsge++; } else { - len = RTE_MIN(mss, left); - frag_left = mss - len; + /* Fill new descriptor's data field */ + len = RTE_MIN(seglen, left); + frag_left = seglen - len; desc_addr = next_addr; desc_len = len; desc_nsge = 0; } left -= len; offset += len; - if (txm_seg->next != NULL && frag_left > 0) - continue; + + /* Pack the next mbuf's data into the descriptor */ + if (txm_seg->next != NULL && frag_left > 0 && use_sgl) + break; done = (txm_seg->next == NULL && left == 0); ionic_tx_tso_post(q, desc, txm_seg, @@ -507,6 +409,7 @@ ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) start, done); desc = ionic_tx_tso_next(txq, &elem); start = false; + seglen = mss; } txm_seg = txm_seg->next; @@ -517,157 +420,6 @@ ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) return 0; } -static __rte_always_inline int -ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) -{ - struct ionic_queue *q = &txq->qcq.q; - struct ionic_txq_desc *desc, *desc_base = q->base; - struct ionic_txq_sg_desc_v1 *sg_desc_base = q->sg_base; - struct ionic_txq_sg_elem *elem; - struct ionic_tx_stats *stats = &txq->stats; - struct rte_mbuf *txm_seg; - void **info; - rte_iova_t data_iova; - uint64_t ol_flags = txm->ol_flags; - uint64_t addr, cmd; - uint8_t opcode = IONIC_TXQ_DESC_OPCODE_CSUM_NONE; - uint8_t flags = 0; - - desc = &desc_base[q->head_idx]; - info = IONIC_INFO_PTR(q, q->head_idx); - - if ((ol_flags & RTE_MBUF_F_TX_IP_CKSUM) && - (txq->flags & IONIC_QCQ_F_CSUM_L3)) { - opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW; - flags |= IONIC_TXQ_DESC_FLAG_CSUM_L3; - } - - if (((ol_flags & RTE_MBUF_F_TX_TCP_CKSUM) && - (txq->flags & IONIC_QCQ_F_CSUM_TCP)) || - ((ol_flags & RTE_MBUF_F_TX_UDP_CKSUM) && - (txq->flags & IONIC_QCQ_F_CSUM_UDP))) { - opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW; - flags |= IONIC_TXQ_DESC_FLAG_CSUM_L4; - } - - if (opcode == IONIC_TXQ_DESC_OPCODE_CSUM_NONE) - stats->no_csum++; - - if (((ol_flags & RTE_MBUF_F_TX_OUTER_IP_CKSUM) || - (ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM)) && - ((ol_flags & RTE_MBUF_F_TX_OUTER_IPV4) || - (ol_flags & RTE_MBUF_F_TX_OUTER_IPV6))) { - flags |= IONIC_TXQ_DESC_FLAG_ENCAP; - } - - if (ol_flags & RTE_MBUF_F_TX_VLAN) { - flags |= IONIC_TXQ_DESC_FLAG_VLAN; - desc->vlan_tci = rte_cpu_to_le_16(txm->vlan_tci); - } - - addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm)); - - cmd = encode_txq_desc_cmd(opcode, flags, txm->nb_segs - 1, addr); - desc->cmd = rte_cpu_to_le_64(cmd); - desc->len = rte_cpu_to_le_16(txm->data_len); - - info[0] = txm; - - if (txm->nb_segs > 1) { - txm_seg = txm->next; - - elem = sg_desc_base[q->head_idx].elems; - - while (txm_seg != NULL) { - /* Stash the mbuf ptr in the array */ - info++; - *info = txm_seg; - - /* Configure the SGE */ - data_iova = rte_mbuf_data_iova(txm_seg); - elem->len = rte_cpu_to_le_16(txm_seg->data_len); - elem->addr = rte_cpu_to_le_64(data_iova); - elem++; - - txm_seg = txm_seg->next; - } - } - - q->head_idx = Q_NEXT_TO_POST(q, 1); - - return 0; -} - -uint16_t -ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, - uint16_t nb_pkts) -{ - struct ionic_tx_qcq *txq = tx_queue; - struct ionic_queue *q = &txq->qcq.q; - struct ionic_tx_stats *stats = &txq->stats; - struct rte_mbuf *mbuf; - uint32_t bytes_tx = 0; - uint16_t nb_avail, nb_tx = 0; - int err; - - struct ionic_txq_desc *desc_base = q->base; - if (!(txq->flags & IONIC_QCQ_F_CMB)) - rte_prefetch0(&desc_base[q->head_idx]); - rte_prefetch0(IONIC_INFO_PTR(q, q->head_idx)); - - if (tx_pkts) { - rte_mbuf_prefetch_part1(tx_pkts[0]); - rte_mbuf_prefetch_part2(tx_pkts[0]); - } - - if (unlikely(ionic_q_space_avail(q) < txq->free_thresh)) { - /* Cleaning old buffers */ - ionic_tx_flush(txq); - } - - nb_avail = ionic_q_space_avail(q); - if (unlikely(nb_avail < nb_pkts)) { - stats->stop += nb_pkts - nb_avail; - nb_pkts = nb_avail; - } - - while (nb_tx < nb_pkts) { - uint16_t next_idx = Q_NEXT_TO_POST(q, 1); - if (!(txq->flags & IONIC_QCQ_F_CMB)) - rte_prefetch0(&desc_base[next_idx]); - rte_prefetch0(IONIC_INFO_PTR(q, next_idx)); - - if (nb_tx + 1 < nb_pkts) { - rte_mbuf_prefetch_part1(tx_pkts[nb_tx + 1]); - rte_mbuf_prefetch_part2(tx_pkts[nb_tx + 1]); - } - - mbuf = tx_pkts[nb_tx]; - - if (mbuf->ol_flags & RTE_MBUF_F_TX_TCP_SEG) - err = ionic_tx_tso(txq, mbuf); - else - err = ionic_tx(txq, mbuf); - if (err) { - stats->drop += nb_pkts - nb_tx; - break; - } - - bytes_tx += mbuf->pkt_len; - nb_tx++; - } - - if (nb_tx > 0) { - rte_wmb(); - ionic_q_flush(q); - - stats->packets += nb_tx; - stats->bytes += bytes_tx; - } - - return nb_tx; -} - /********************************************************************* * * TX prep functions @@ -820,7 +572,7 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, } #define IONIC_CSUM_FLAG_MASK (IONIC_RXQ_COMP_CSUM_F_VLAN - 1) -static const uint64_t ionic_csum_flags[IONIC_CSUM_FLAG_MASK] +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, @@ -850,7 +602,7 @@ static const uint64_t ionic_csum_flags[IONIC_CSUM_FLAG_MASK] }; /* RTE_PTYPE_UNKNOWN is 0x0 */ -static const uint32_t ionic_ptype_table[IONIC_RXQ_COMP_PKT_TYPE_MASK] +const uint32_t ionic_ptype_table[IONIC_RXQ_COMP_PKT_TYPE_MASK] __rte_cache_aligned = { [IONIC_PKT_TYPE_NON_IP] = RTE_PTYPE_UNKNOWN, [IONIC_PKT_TYPE_IPV4] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4, @@ -884,203 +636,6 @@ ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) return ptypes; } -/* - * Cleans one descriptor. Connects the filled mbufs into a chain. - * Does not advance the tail index. - */ -static __rte_always_inline void -ionic_rx_clean_one(struct ionic_rx_qcq *rxq, - struct ionic_rxq_comp *cq_desc, - struct ionic_rx_service *rx_svc) -{ - struct ionic_queue *q = &rxq->qcq.q; - struct rte_mbuf *rxm, *rxm_seg, *prev_rxm; - struct ionic_rx_stats *stats = &rxq->stats; - uint64_t pkt_flags = 0; - uint32_t pkt_type; - uint32_t left, i; - uint16_t cq_desc_len; - uint8_t ptype, cflags; - void **info; - - cq_desc_len = rte_le_to_cpu_16(cq_desc->len); - - info = IONIC_INFO_PTR(q, q->tail_idx); - - rxm = info[0]; - - if (cq_desc->status) { - stats->bad_cq_status++; - return; - } - - if (cq_desc_len > rxq->frame_size || cq_desc_len == 0) { - stats->bad_len++; - return; - } - - info[0] = NULL; - - /* Set the mbuf metadata based on the cq entry */ - rxm->rearm_data[0] = rxq->rearm_data; - rxm->pkt_len = cq_desc_len; - rxm->data_len = RTE_MIN(rxq->hdr_seg_size, cq_desc_len); - left = cq_desc_len - rxm->data_len; - rxm->nb_segs = cq_desc->num_sg_elems + 1; - prev_rxm = rxm; - - for (i = 1; i < rxm->nb_segs && left; i++) { - rxm_seg = info[i]; - info[i] = NULL; - - /* Set the chained mbuf metadata */ - rxm_seg->rearm_data[0] = rxq->rearm_seg_data; - rxm_seg->data_len = RTE_MIN(rxq->seg_size, left); - left -= rxm_seg->data_len; - - /* Link the mbuf */ - prev_rxm->next = rxm_seg; - prev_rxm = rxm_seg; - } - - /* Terminate the mbuf chain */ - prev_rxm->next = NULL; - - /* RSS */ - pkt_flags |= RTE_MBUF_F_RX_RSS_HASH; - rxm->hash.rss = rte_le_to_cpu_32(cq_desc->rss_hash); - - /* Vlan Strip */ - if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_VLAN) { - pkt_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED; - rxm->vlan_tci = rte_le_to_cpu_16(cq_desc->vlan_tci); - } - - /* Checksum */ - if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_CALC) { - cflags = cq_desc->csum_flags & IONIC_CSUM_FLAG_MASK; - pkt_flags |= ionic_csum_flags[cflags]; - } - - rxm->ol_flags = pkt_flags; - - /* Packet Type */ - ptype = cq_desc->pkt_type_color & IONIC_RXQ_COMP_PKT_TYPE_MASK; - pkt_type = ionic_ptype_table[ptype]; - if (pkt_type == RTE_PTYPE_UNKNOWN) { - struct rte_ether_hdr *eth_h = rte_pktmbuf_mtod(rxm, - struct rte_ether_hdr *); - uint16_t ether_type = eth_h->ether_type; - if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) - pkt_type = RTE_PTYPE_L2_ETHER_ARP; - else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_LLDP)) - pkt_type = RTE_PTYPE_L2_ETHER_LLDP; - else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_1588)) - pkt_type = RTE_PTYPE_L2_ETHER_TIMESYNC; - stats->mtods++; - } - - rxm->packet_type = pkt_type; - - rx_svc->rx_pkts[rx_svc->nb_rx] = rxm; - rx_svc->nb_rx++; - - stats->packets++; - stats->bytes += rxm->pkt_len; -} - -/* - * Fills one descriptor with mbufs. Does not advance the head index. - */ -static __rte_always_inline int -ionic_rx_fill_one(struct ionic_rx_qcq *rxq) -{ - struct ionic_queue *q = &rxq->qcq.q; - struct rte_mbuf *rxm, *rxm_seg; - struct ionic_rxq_desc *desc, *desc_base = q->base; - struct ionic_rxq_sg_desc *sg_desc, *sg_desc_base = q->sg_base; - 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]; - sg_desc = &sg_desc_base[q->head_idx]; - - /* mbuf is unused => whole chain is unused */ - if (unlikely(info[0])) - return 0; - - 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); - desc->addr = rte_cpu_to_le_64(data_iova); - - for (i = 1; i < q->num_segs; i++) { - /* mbuf is unused => rest of the chain is unused */ - if (info[i]) - return 0; - - 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 */ - data_iova = rxm_seg->buf_iova; - sg_desc->elems[i - 1].addr = rte_cpu_to_le_64(data_iova); - } - - return 0; -} - -/* - * Fills all descriptors with mbufs. - */ -static int __rte_cold -ionic_rx_fill(struct ionic_rx_qcq *rxq) -{ - struct ionic_queue *q = &rxq->qcq.q; - uint32_t i; - int err; - - for (i = 1; i < q->num_descs; i++) { - err = ionic_rx_fill_one(rxq); - if (err) - return err; - - q->head_idx = Q_NEXT_TO_POST(q, 1); - } - - ionic_q_flush(q); - - return 0; -} - /* * Perform one-time initialization of descriptor fields * which will not change for the life of the queue. @@ -1148,10 +703,13 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) if (err) return err; - /* Allocate buffers for descriptor rings */ - if (ionic_rx_fill(rxq) != 0) { - IONIC_PRINT(ERR, "Could not alloc mbuf for queue:%d", - rx_queue_id); + /* Allocate buffers for descriptor ring */ + if (rxq->flags & IONIC_QCQ_F_SG) + err = ionic_rx_fill_sg(rxq); + else + err = ionic_rx_fill(rxq); + if (err != 0) { + IONIC_PRINT(ERR, "Could not fill queue %d", rx_queue_id); return -1; } @@ -1160,55 +718,6 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) return 0; } -/* - * Walk the CQ to find completed receive descriptors. - * Any completed descriptor found is refilled. - */ -static __rte_always_inline void -ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do, - struct ionic_rx_service *rx_svc) -{ - struct ionic_cq *cq = &rxq->qcq.cq; - struct ionic_queue *q = &rxq->qcq.q; - struct ionic_rxq_desc *q_desc_base = q->base; - struct ionic_rxq_comp *cq_desc, *cq_desc_base = cq->base; - uint32_t work_done = 0; - - cq_desc = &cq_desc_base[cq->tail_idx]; - - while (color_match(cq_desc->pkt_type_color, cq->done_color)) { - cq->tail_idx = Q_NEXT_TO_SRVC(cq, 1); - - if (cq->tail_idx == 0) - cq->done_color = !cq->done_color; - - /* Prefetch 8 x 8B bufinfo */ - rte_prefetch0(IONIC_INFO_PTR(q, Q_NEXT_TO_SRVC(q, 8))); - /* Prefetch 4 x 16B comp */ - rte_prefetch0(&cq_desc_base[Q_NEXT_TO_SRVC(cq, 4)]); - /* Prefetch 4 x 16B descriptors */ - if (!(rxq->flags & IONIC_QCQ_F_CMB)) - rte_prefetch0(&q_desc_base[Q_NEXT_TO_POST(q, 4)]); - - ionic_rx_clean_one(rxq, cq_desc, rx_svc); - - q->tail_idx = Q_NEXT_TO_SRVC(q, 1); - - (void)ionic_rx_fill_one(rxq); - - q->head_idx = Q_NEXT_TO_POST(q, 1); - - if (++work_done == work_to_do) - break; - - cq_desc = &cq_desc_base[cq->tail_idx]; - } - - /* Update the queue indices and ring the doorbell */ - if (work_done) - ionic_q_flush(q); -} - /* * Stop Receive Units for specified queue. */ @@ -1237,21 +746,6 @@ ionic_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) return 0; } -uint16_t -ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts) -{ - struct ionic_rx_qcq *rxq = rx_queue; - struct ionic_rx_service rx_svc; - - rx_svc.rx_pkts = rx_pkts; - rx_svc.nb_rx = 0; - - ionic_rxq_service(rxq, nb_pkts, &rx_svc); - - return rx_svc.nb_rx; -} - int ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) { diff --git a/drivers/net/ionic/ionic_rxtx.h b/drivers/net/ionic/ionic_rxtx.h index 5b9d9eac80..8537141597 100644 --- a/drivers/net/ionic/ionic_rxtx.h +++ b/drivers/net/ionic/ionic_rxtx.h @@ -5,7 +5,19 @@ #ifndef _IONIC_RXTX_H_ #define _IONIC_RXTX_H_ -#include +#include + +#include "ionic_if.h" + +struct ionic_rx_qcq; +struct ionic_tx_qcq; +struct rte_eth_dev; +struct rte_eth_rxconf; +struct rte_eth_rxq_info; +struct rte_eth_txconf; +struct rte_eth_txq_info; +struct rte_mbuf; +struct rte_mempool; struct ionic_rx_service { /* cb in */ @@ -14,13 +26,12 @@ struct ionic_rx_service { uint16_t nb_rx; }; -uint16_t ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts); -uint16_t ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, - uint16_t nb_pkts); -uint16_t ionic_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, - uint16_t nb_pkts); +#define IONIC_CSUM_FLAG_MASK (IONIC_RXQ_COMP_CSUM_F_VLAN - 1) + +extern const uint64_t ionic_csum_flags[IONIC_CSUM_FLAG_MASK]; +extern const uint32_t ionic_ptype_table[IONIC_RXQ_COMP_PKT_TYPE_MASK]; +/* ionic_rxtx.c */ int ionic_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, uint16_t nb_desc, uint32_t socket_id, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mp); @@ -45,4 +56,25 @@ int ionic_dev_tx_descriptor_status(void *tx_queue, uint16_t offset); const uint32_t *ionic_dev_supported_ptypes_get(struct rte_eth_dev *dev); +int ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm); + +uint16_t ionic_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts); + +/* ionic_rxtx_simple.c */ +uint16_t ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts); +uint16_t ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts); + +int ionic_rx_fill(struct ionic_rx_qcq *rxq); + +/* ionic_rxtx_sg.c */ +uint16_t ionic_recv_pkts_sg(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts); +uint16_t ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts); + +int ionic_rx_fill_sg(struct ionic_rx_qcq *rxq); + #endif /* _IONIC_RXTX_H_ */ diff --git a/drivers/net/ionic/ionic_rxtx_sg.c b/drivers/net/ionic/ionic_rxtx_sg.c new file mode 100644 index 0000000000..4e4a18e5d7 --- /dev/null +++ b/drivers/net/ionic/ionic_rxtx_sg.c @@ -0,0 +1,496 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018-2022 Advanced Micro Devices, Inc. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "ionic.h" +#include "ionic_if.h" +#include "ionic_dev.h" +#include "ionic_lif.h" +#include "ionic_rxtx.h" + +static __rte_always_inline void +ionic_tx_flush_sg(struct ionic_tx_qcq *txq) +{ + struct ionic_cq *cq = &txq->qcq.cq; + struct ionic_queue *q = &txq->qcq.q; + struct rte_mbuf *txm; + struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base; + void **info; + uint32_t i; + + cq_desc = &cq_desc_base[cq->tail_idx]; + + while (color_match(cq_desc->color, cq->done_color)) { + cq->tail_idx = Q_NEXT_TO_SRVC(cq, 1); + if (cq->tail_idx == 0) + cq->done_color = !cq->done_color; + + /* Prefetch 4 x 16B comp at cq->tail_idx + 4 */ + if ((cq->tail_idx & 0x3) == 0) + rte_prefetch0(&cq_desc_base[Q_NEXT_TO_SRVC(cq, 4)]); + + while (q->tail_idx != rte_le_to_cpu_16(cq_desc->comp_index)) { + /* Prefetch 8 mbuf ptrs at q->tail_idx + 2 */ + rte_prefetch0(IONIC_INFO_PTR(q, Q_NEXT_TO_SRVC(q, 2))); + + /* Prefetch next mbuf */ + void **next_info = + IONIC_INFO_PTR(q, Q_NEXT_TO_SRVC(q, 1)); + if (next_info[0]) + rte_mbuf_prefetch_part2(next_info[0]); + if (next_info[1]) + rte_mbuf_prefetch_part2(next_info[1]); + + info = IONIC_INFO_PTR(q, q->tail_idx); + for (i = 0; i < q->num_segs; i++) { + txm = info[i]; + if (!txm) + break; + + if (txq->flags & IONIC_QCQ_F_FAST_FREE) + rte_mempool_put(txm->pool, txm); + else + rte_pktmbuf_free_seg(txm); + + info[i] = NULL; + } + + q->tail_idx = Q_NEXT_TO_SRVC(q, 1); + } + + cq_desc = &cq_desc_base[cq->tail_idx]; + } +} + +static __rte_always_inline int +ionic_tx_sg(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) +{ + struct ionic_queue *q = &txq->qcq.q; + struct ionic_txq_desc *desc, *desc_base = q->base; + struct ionic_txq_sg_desc_v1 *sg_desc, *sg_desc_base = q->sg_base; + struct ionic_txq_sg_elem *elem; + struct ionic_tx_stats *stats = &txq->stats; + struct rte_mbuf *txm_seg; + rte_iova_t data_iova; + void **info; + uint64_t ol_flags = txm->ol_flags; + uint64_t addr, cmd; + uint8_t opcode = IONIC_TXQ_DESC_OPCODE_CSUM_NONE; + uint8_t flags = 0; + + desc = &desc_base[q->head_idx]; + sg_desc = &sg_desc_base[q->head_idx]; + info = IONIC_INFO_PTR(q, q->head_idx); + + if ((ol_flags & RTE_MBUF_F_TX_IP_CKSUM) && + (txq->flags & IONIC_QCQ_F_CSUM_L3)) { + opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW; + flags |= IONIC_TXQ_DESC_FLAG_CSUM_L3; + } + + if (((ol_flags & RTE_MBUF_F_TX_TCP_CKSUM) && + (txq->flags & IONIC_QCQ_F_CSUM_TCP)) || + ((ol_flags & RTE_MBUF_F_TX_UDP_CKSUM) && + (txq->flags & IONIC_QCQ_F_CSUM_UDP))) { + opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW; + flags |= IONIC_TXQ_DESC_FLAG_CSUM_L4; + } + + if (opcode == IONIC_TXQ_DESC_OPCODE_CSUM_NONE) + stats->no_csum++; + + if (((ol_flags & RTE_MBUF_F_TX_OUTER_IP_CKSUM) || + (ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM)) && + ((ol_flags & RTE_MBUF_F_TX_OUTER_IPV4) || + (ol_flags & RTE_MBUF_F_TX_OUTER_IPV6))) { + flags |= IONIC_TXQ_DESC_FLAG_ENCAP; + } + + if (ol_flags & RTE_MBUF_F_TX_VLAN) { + flags |= IONIC_TXQ_DESC_FLAG_VLAN; + desc->vlan_tci = rte_cpu_to_le_16(txm->vlan_tci); + } + + addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm)); + + cmd = encode_txq_desc_cmd(opcode, flags, txm->nb_segs - 1, addr); + desc->cmd = rte_cpu_to_le_64(cmd); + desc->len = rte_cpu_to_le_16(txm->data_len); + + info[0] = txm; + + if (txm->nb_segs > 1) { + txm_seg = txm->next; + + elem = sg_desc->elems; + + while (txm_seg != NULL) { + /* Stash the mbuf ptr in the array */ + info++; + *info = txm_seg; + + /* Configure the SGE */ + data_iova = rte_mbuf_data_iova(txm_seg); + elem->len = rte_cpu_to_le_16(txm_seg->data_len); + elem->addr = rte_cpu_to_le_64(data_iova); + elem++; + + txm_seg = txm_seg->next; + } + } + + q->head_idx = Q_NEXT_TO_POST(q, 1); + + return 0; +} + +uint16_t +ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts) +{ + struct ionic_tx_qcq *txq = tx_queue; + struct ionic_queue *q = &txq->qcq.q; + struct ionic_tx_stats *stats = &txq->stats; + struct rte_mbuf *mbuf; + uint32_t bytes_tx = 0; + uint16_t nb_avail, nb_tx = 0; + int err; + + struct ionic_txq_desc *desc_base = q->base; + if (!(txq->flags & IONIC_QCQ_F_CMB)) + rte_prefetch0(&desc_base[q->head_idx]); + rte_prefetch0(IONIC_INFO_PTR(q, q->head_idx)); + + if (tx_pkts) { + rte_mbuf_prefetch_part1(tx_pkts[0]); + rte_mbuf_prefetch_part2(tx_pkts[0]); + } + + if (ionic_q_space_avail(q) < txq->free_thresh) { + /* Cleaning old buffers */ + ionic_tx_flush_sg(txq); + } + + nb_avail = ionic_q_space_avail(q); + if (nb_avail < nb_pkts) { + stats->stop += nb_pkts - nb_avail; + nb_pkts = nb_avail; + } + + while (nb_tx < nb_pkts) { + uint16_t next_idx = Q_NEXT_TO_POST(q, 1); + if (!(txq->flags & IONIC_QCQ_F_CMB)) + rte_prefetch0(&desc_base[next_idx]); + rte_prefetch0(IONIC_INFO_PTR(q, next_idx)); + + if (nb_tx + 1 < nb_pkts) { + rte_mbuf_prefetch_part1(tx_pkts[nb_tx + 1]); + rte_mbuf_prefetch_part2(tx_pkts[nb_tx + 1]); + } + + mbuf = tx_pkts[nb_tx]; + + if (mbuf->ol_flags & RTE_MBUF_F_TX_TCP_SEG) + err = ionic_tx_tso(txq, mbuf); + else + err = ionic_tx_sg(txq, mbuf); + if (err) { + stats->drop += nb_pkts - nb_tx; + break; + } + + bytes_tx += mbuf->pkt_len; + nb_tx++; + } + + if (nb_tx > 0) { + rte_wmb(); + ionic_q_flush(q); + + stats->packets += nb_tx; + stats->bytes += bytes_tx; + } + + return nb_tx; +} + +/* + * Cleans one descriptor. Connects the filled mbufs into a chain. + * Does not advance the tail index. + */ +static __rte_always_inline void +ionic_rx_clean_one_sg(struct ionic_rx_qcq *rxq, + struct ionic_rxq_comp *cq_desc, + struct ionic_rx_service *rx_svc) +{ + struct ionic_queue *q = &rxq->qcq.q; + struct rte_mbuf *rxm; + struct rte_mbuf *rxm_seg, *prev_rxm; + struct ionic_rx_stats *stats = &rxq->stats; + uint64_t pkt_flags = 0; + uint32_t pkt_type; + uint32_t left, i; + uint16_t cq_desc_len; + uint8_t ptype, cflags; + void **info; + + cq_desc_len = rte_le_to_cpu_16(cq_desc->len); + + info = IONIC_INFO_PTR(q, q->tail_idx); + + rxm = info[0]; + + if (cq_desc->status) { + stats->bad_cq_status++; + return; + } + + if (cq_desc_len > rxq->frame_size || cq_desc_len == 0) { + stats->bad_len++; + return; + } + + info[0] = NULL; + + /* Set the mbuf metadata based on the cq entry */ + rxm->rearm_data[0] = rxq->rearm_data; + rxm->pkt_len = cq_desc_len; + rxm->data_len = RTE_MIN(rxq->hdr_seg_size, cq_desc_len); + left = cq_desc_len - rxm->data_len; + rxm->nb_segs = cq_desc->num_sg_elems + 1; + + prev_rxm = rxm; + + for (i = 1; i < rxm->nb_segs && left; i++) { + rxm_seg = info[i]; + info[i] = NULL; + + /* Set the chained mbuf metadata */ + rxm_seg->rearm_data[0] = rxq->rearm_seg_data; + rxm_seg->data_len = RTE_MIN(rxq->seg_size, left); + left -= rxm_seg->data_len; + + /* Link the mbuf */ + prev_rxm->next = rxm_seg; + prev_rxm = rxm_seg; + } + + /* Terminate the mbuf chain */ + prev_rxm->next = NULL; + + /* RSS */ + pkt_flags |= RTE_MBUF_F_RX_RSS_HASH; + rxm->hash.rss = rte_le_to_cpu_32(cq_desc->rss_hash); + + /* Vlan Strip */ + if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_VLAN) { + pkt_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED; + rxm->vlan_tci = rte_le_to_cpu_16(cq_desc->vlan_tci); + } + + /* Checksum */ + if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_CALC) { + cflags = cq_desc->csum_flags & IONIC_CSUM_FLAG_MASK; + pkt_flags |= ionic_csum_flags[cflags]; + } + + rxm->ol_flags = pkt_flags; + + /* Packet Type */ + ptype = cq_desc->pkt_type_color & IONIC_RXQ_COMP_PKT_TYPE_MASK; + pkt_type = ionic_ptype_table[ptype]; + if (pkt_type == RTE_PTYPE_UNKNOWN) { + struct rte_ether_hdr *eth_h = rte_pktmbuf_mtod(rxm, + struct rte_ether_hdr *); + uint16_t ether_type = eth_h->ether_type; + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) + pkt_type = RTE_PTYPE_L2_ETHER_ARP; + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_LLDP)) + pkt_type = RTE_PTYPE_L2_ETHER_LLDP; + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_1588)) + pkt_type = RTE_PTYPE_L2_ETHER_TIMESYNC; + stats->mtods++; + } else if (pkt_flags & RTE_MBUF_F_RX_VLAN) { + pkt_type |= RTE_PTYPE_L2_ETHER_VLAN; + } else { + pkt_type |= RTE_PTYPE_L2_ETHER; + } + + rxm->packet_type = pkt_type; + + rx_svc->rx_pkts[rx_svc->nb_rx] = rxm; + rx_svc->nb_rx++; + + stats->packets++; + stats->bytes += rxm->pkt_len; +} + +/* + * Fills one descriptor with mbufs. Does not advance the head index. + */ +static __rte_always_inline int +ionic_rx_fill_one_sg(struct ionic_rx_qcq *rxq) +{ + struct ionic_queue *q = &rxq->qcq.q; + struct rte_mbuf *rxm; + struct rte_mbuf *rxm_seg; + struct ionic_rxq_desc *desc, *desc_base = q->base; + struct ionic_rxq_sg_desc *sg_desc, *sg_desc_base = q->sg_base; + 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]; + sg_desc = &sg_desc_base[q->head_idx]; + + /* mbuf is unused => whole chain is unused */ + if (info[0]) + return 0; + + 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); + desc->addr = rte_cpu_to_le_64(data_iova); + + for (i = 1; i < q->num_segs; i++) { + /* mbuf is unused => rest of the chain is unused */ + if (info[i]) + return 0; + + 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 */ + data_iova = rxm_seg->buf_iova; + sg_desc->elems[i - 1].addr = rte_cpu_to_le_64(data_iova); + } + + return 0; +} + +/* + * Walk the CQ to find completed receive descriptors. + * Any completed descriptor found is refilled. + */ +static __rte_always_inline void +ionic_rxq_service_sg(struct ionic_rx_qcq *rxq, uint32_t work_to_do, + struct ionic_rx_service *rx_svc) +{ + struct ionic_cq *cq = &rxq->qcq.cq; + struct ionic_queue *q = &rxq->qcq.q; + struct ionic_rxq_desc *q_desc_base = q->base; + struct ionic_rxq_comp *cq_desc, *cq_desc_base = cq->base; + uint32_t work_done = 0; + + cq_desc = &cq_desc_base[cq->tail_idx]; + + while (color_match(cq_desc->pkt_type_color, cq->done_color)) { + cq->tail_idx = Q_NEXT_TO_SRVC(cq, 1); + if (cq->tail_idx == 0) + cq->done_color = !cq->done_color; + + /* Prefetch 8 x 8B bufinfo */ + rte_prefetch0(IONIC_INFO_PTR(q, Q_NEXT_TO_SRVC(q, 8))); + /* Prefetch 4 x 16B comp */ + rte_prefetch0(&cq_desc_base[Q_NEXT_TO_SRVC(cq, 4)]); + /* Prefetch 4 x 16B descriptors */ + if (!(rxq->flags & IONIC_QCQ_F_CMB)) + rte_prefetch0(&q_desc_base[Q_NEXT_TO_POST(q, 4)]); + + /* Clean one descriptor */ + ionic_rx_clean_one_sg(rxq, cq_desc, rx_svc); + q->tail_idx = Q_NEXT_TO_SRVC(q, 1); + + /* Fill one descriptor */ + (void)ionic_rx_fill_one_sg(rxq); + + q->head_idx = Q_NEXT_TO_POST(q, 1); + + if (++work_done == work_to_do) + break; + + cq_desc = &cq_desc_base[cq->tail_idx]; + } + + /* Update the queue indices and ring the doorbell */ + if (work_done) + ionic_q_flush(q); +} + +uint16_t +ionic_recv_pkts_sg(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts) +{ + struct ionic_rx_qcq *rxq = rx_queue; + struct ionic_rx_service rx_svc; + + rx_svc.rx_pkts = rx_pkts; + rx_svc.nb_rx = 0; + + ionic_rxq_service_sg(rxq, nb_pkts, &rx_svc); + + return rx_svc.nb_rx; +} + +/* + * Fills all descriptors with mbufs. + */ +int __rte_cold +ionic_rx_fill_sg(struct ionic_rx_qcq *rxq) +{ + struct ionic_queue *q = &rxq->qcq.q; + uint32_t i; + int err = 0; + + for (i = 0; i < q->num_descs - 1u; i++) { + err = ionic_rx_fill_one_sg(rxq); + if (err) + break; + + q->head_idx = Q_NEXT_TO_POST(q, 1); + } + + ionic_q_flush(q); + + return err; +} diff --git a/drivers/net/ionic/ionic_rxtx_simple.c b/drivers/net/ionic/ionic_rxtx_simple.c new file mode 100644 index 0000000000..a191fd3ec9 --- /dev/null +++ b/drivers/net/ionic/ionic_rxtx_simple.c @@ -0,0 +1,417 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018-2022 Advanced Micro Devices, Inc. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "ionic.h" +#include "ionic_if.h" +#include "ionic_dev.h" +#include "ionic_lif.h" +#include "ionic_rxtx.h" + +static __rte_always_inline void +ionic_tx_flush(struct ionic_tx_qcq *txq) +{ + struct ionic_cq *cq = &txq->qcq.cq; + struct ionic_queue *q = &txq->qcq.q; + struct rte_mbuf *txm; + struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base; + void **info; + + cq_desc = &cq_desc_base[cq->tail_idx]; + + while (color_match(cq_desc->color, cq->done_color)) { + cq->tail_idx = Q_NEXT_TO_SRVC(cq, 1); + if (cq->tail_idx == 0) + cq->done_color = !cq->done_color; + + /* Prefetch 4 x 16B comp at cq->tail_idx + 4 */ + if ((cq->tail_idx & 0x3) == 0) + rte_prefetch0(&cq_desc_base[Q_NEXT_TO_SRVC(cq, 4)]); + + while (q->tail_idx != rte_le_to_cpu_16(cq_desc->comp_index)) { + /* Prefetch 8 mbuf ptrs at q->tail_idx + 2 */ + rte_prefetch0(&q->info[Q_NEXT_TO_SRVC(q, 2)]); + + /* Prefetch next mbuf */ + void **next_info = + &q->info[Q_NEXT_TO_SRVC(q, 1)]; + if (next_info[0]) + rte_mbuf_prefetch_part2(next_info[0]); + + info = &q->info[q->tail_idx]; + { + txm = info[0]; + + if (txq->flags & IONIC_QCQ_F_FAST_FREE) + rte_mempool_put(txm->pool, txm); + else + rte_pktmbuf_free_seg(txm); + + info[0] = NULL; + } + + q->tail_idx = Q_NEXT_TO_SRVC(q, 1); + } + + cq_desc = &cq_desc_base[cq->tail_idx]; + } +} + +static __rte_always_inline int +ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) +{ + struct ionic_queue *q = &txq->qcq.q; + struct ionic_txq_desc *desc, *desc_base = q->base; + struct ionic_tx_stats *stats = &txq->stats; + void **info; + uint64_t ol_flags = txm->ol_flags; + uint64_t addr, cmd; + uint8_t opcode = IONIC_TXQ_DESC_OPCODE_CSUM_NONE; + uint8_t flags = 0; + + if (txm->nb_segs > 1) + return -EINVAL; + + desc = &desc_base[q->head_idx]; + info = &q->info[q->head_idx]; + + if ((ol_flags & RTE_MBUF_F_TX_IP_CKSUM) && + (txq->flags & IONIC_QCQ_F_CSUM_L3)) { + opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW; + flags |= IONIC_TXQ_DESC_FLAG_CSUM_L3; + } + + if (((ol_flags & RTE_MBUF_F_TX_TCP_CKSUM) && + (txq->flags & IONIC_QCQ_F_CSUM_TCP)) || + ((ol_flags & RTE_MBUF_F_TX_UDP_CKSUM) && + (txq->flags & IONIC_QCQ_F_CSUM_UDP))) { + opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW; + flags |= IONIC_TXQ_DESC_FLAG_CSUM_L4; + } + + if (opcode == IONIC_TXQ_DESC_OPCODE_CSUM_NONE) + stats->no_csum++; + + if (((ol_flags & RTE_MBUF_F_TX_OUTER_IP_CKSUM) || + (ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM)) && + ((ol_flags & RTE_MBUF_F_TX_OUTER_IPV4) || + (ol_flags & RTE_MBUF_F_TX_OUTER_IPV6))) { + flags |= IONIC_TXQ_DESC_FLAG_ENCAP; + } + + if (ol_flags & RTE_MBUF_F_TX_VLAN) { + flags |= IONIC_TXQ_DESC_FLAG_VLAN; + desc->vlan_tci = rte_cpu_to_le_16(txm->vlan_tci); + } + + addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm)); + + cmd = encode_txq_desc_cmd(opcode, flags, 0, addr); + desc->cmd = rte_cpu_to_le_64(cmd); + desc->len = rte_cpu_to_le_16(txm->data_len); + + info[0] = txm; + + q->head_idx = Q_NEXT_TO_POST(q, 1); + + return 0; +} + +uint16_t +ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts) +{ + struct ionic_tx_qcq *txq = tx_queue; + struct ionic_queue *q = &txq->qcq.q; + struct ionic_tx_stats *stats = &txq->stats; + struct rte_mbuf *mbuf; + uint32_t bytes_tx = 0; + uint16_t nb_avail, nb_tx = 0; + int err; + + struct ionic_txq_desc *desc_base = q->base; + if (!(txq->flags & IONIC_QCQ_F_CMB)) + rte_prefetch0(&desc_base[q->head_idx]); + rte_prefetch0(&q->info[q->head_idx]); + + if (tx_pkts) { + rte_mbuf_prefetch_part1(tx_pkts[0]); + rte_mbuf_prefetch_part2(tx_pkts[0]); + } + + if (ionic_q_space_avail(q) < txq->free_thresh) { + /* Cleaning old buffers */ + ionic_tx_flush(txq); + } + + nb_avail = ionic_q_space_avail(q); + if (nb_avail < nb_pkts) { + stats->stop += nb_pkts - nb_avail; + nb_pkts = nb_avail; + } + + while (nb_tx < nb_pkts) { + uint16_t next_idx = Q_NEXT_TO_POST(q, 1); + if (!(txq->flags & IONIC_QCQ_F_CMB)) + rte_prefetch0(&desc_base[next_idx]); + rte_prefetch0(&q->info[next_idx]); + + if (nb_tx + 1 < nb_pkts) { + rte_mbuf_prefetch_part1(tx_pkts[nb_tx + 1]); + rte_mbuf_prefetch_part2(tx_pkts[nb_tx + 1]); + } + + mbuf = tx_pkts[nb_tx]; + + if (mbuf->ol_flags & RTE_MBUF_F_TX_TCP_SEG) + err = ionic_tx_tso(txq, mbuf); + else + err = ionic_tx(txq, mbuf); + if (err) { + stats->drop += nb_pkts - nb_tx; + break; + } + + bytes_tx += mbuf->pkt_len; + nb_tx++; + } + + if (nb_tx > 0) { + rte_wmb(); + ionic_q_flush(q); + + stats->packets += nb_tx; + stats->bytes += bytes_tx; + } + + return nb_tx; +} + +/* + * Cleans one descriptor. Connects the filled mbufs into a chain. + * Does not advance the tail index. + */ +static __rte_always_inline void +ionic_rx_clean_one(struct ionic_rx_qcq *rxq, + struct ionic_rxq_comp *cq_desc, + struct ionic_rx_service *rx_svc) +{ + struct ionic_queue *q = &rxq->qcq.q; + struct rte_mbuf *rxm; + struct ionic_rx_stats *stats = &rxq->stats; + uint64_t pkt_flags = 0; + uint32_t pkt_type; + uint16_t cq_desc_len; + uint8_t ptype, cflags; + void **info; + + cq_desc_len = rte_le_to_cpu_16(cq_desc->len); + + info = &q->info[q->tail_idx]; + + rxm = info[0]; + + if (cq_desc->status) { + stats->bad_cq_status++; + return; + } + + if (cq_desc_len > rxq->frame_size || cq_desc_len == 0) { + stats->bad_len++; + return; + } + + info[0] = NULL; + + /* Set the mbuf metadata based on the cq entry */ + rxm->rearm_data[0] = rxq->rearm_data; + rxm->pkt_len = cq_desc_len; + rxm->data_len = cq_desc_len; + + /* RSS */ + pkt_flags |= RTE_MBUF_F_RX_RSS_HASH; + rxm->hash.rss = rte_le_to_cpu_32(cq_desc->rss_hash); + + /* Vlan Strip */ + if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_VLAN) { + pkt_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED; + rxm->vlan_tci = rte_le_to_cpu_16(cq_desc->vlan_tci); + } + + /* Checksum */ + if (cq_desc->csum_flags & IONIC_RXQ_COMP_CSUM_F_CALC) { + cflags = cq_desc->csum_flags & IONIC_CSUM_FLAG_MASK; + pkt_flags |= ionic_csum_flags[cflags]; + } + + rxm->ol_flags = pkt_flags; + + /* Packet Type */ + ptype = cq_desc->pkt_type_color & IONIC_RXQ_COMP_PKT_TYPE_MASK; + pkt_type = ionic_ptype_table[ptype]; + if (pkt_type == RTE_PTYPE_UNKNOWN) { + struct rte_ether_hdr *eth_h = rte_pktmbuf_mtod(rxm, + struct rte_ether_hdr *); + uint16_t ether_type = eth_h->ether_type; + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) + pkt_type = RTE_PTYPE_L2_ETHER_ARP; + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_LLDP)) + pkt_type = RTE_PTYPE_L2_ETHER_LLDP; + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_1588)) + pkt_type = RTE_PTYPE_L2_ETHER_TIMESYNC; + stats->mtods++; + } else if (pkt_flags & RTE_MBUF_F_RX_VLAN) { + pkt_type |= RTE_PTYPE_L2_ETHER_VLAN; + } else { + pkt_type |= RTE_PTYPE_L2_ETHER; + } + + rxm->packet_type = pkt_type; + + rx_svc->rx_pkts[rx_svc->nb_rx] = rxm; + rx_svc->nb_rx++; + + stats->packets++; + stats->bytes += rxm->pkt_len; +} + +/* + * Fills one descriptor with mbufs. Does not advance the head index. + */ +static __rte_always_inline int +ionic_rx_fill_one(struct ionic_rx_qcq *rxq) +{ + struct ionic_queue *q = &rxq->qcq.q; + struct rte_mbuf *rxm; + struct ionic_rxq_desc *desc, *desc_base = q->base; + rte_iova_t data_iova; + void **info; + int ret; + + info = &q->info[q->head_idx]; + desc = &desc_base[q->head_idx]; + + /* mbuf is unused */ + if (info[0]) + return 0; + + 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); + desc->addr = rte_cpu_to_le_64(data_iova); + + return 0; +} + +/* + * Walk the CQ to find completed receive descriptors. + * Any completed descriptor found is refilled. + */ +static __rte_always_inline void +ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do, + struct ionic_rx_service *rx_svc) +{ + struct ionic_cq *cq = &rxq->qcq.cq; + struct ionic_queue *q = &rxq->qcq.q; + struct ionic_rxq_desc *q_desc_base = q->base; + struct ionic_rxq_comp *cq_desc, *cq_desc_base = cq->base; + uint32_t work_done = 0; + + cq_desc = &cq_desc_base[cq->tail_idx]; + + while (color_match(cq_desc->pkt_type_color, cq->done_color)) { + cq->tail_idx = Q_NEXT_TO_SRVC(cq, 1); + if (cq->tail_idx == 0) + cq->done_color = !cq->done_color; + + /* Prefetch 8 x 8B bufinfo */ + rte_prefetch0(&q->info[Q_NEXT_TO_SRVC(q, 8)]); + /* Prefetch 4 x 16B comp */ + rte_prefetch0(&cq_desc_base[Q_NEXT_TO_SRVC(cq, 4)]); + /* Prefetch 4 x 16B descriptors */ + if (!(rxq->flags & IONIC_QCQ_F_CMB)) + rte_prefetch0(&q_desc_base[Q_NEXT_TO_POST(q, 4)]); + + /* Clean one descriptor */ + ionic_rx_clean_one(rxq, cq_desc, rx_svc); + q->tail_idx = Q_NEXT_TO_SRVC(q, 1); + + /* Fill one descriptor */ + (void)ionic_rx_fill_one(rxq); + + q->head_idx = Q_NEXT_TO_POST(q, 1); + + if (++work_done == work_to_do) + break; + + cq_desc = &cq_desc_base[cq->tail_idx]; + } + + /* Update the queue indices and ring the doorbell */ + if (work_done) + ionic_q_flush(q); +} + +uint16_t +ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts) +{ + struct ionic_rx_qcq *rxq = rx_queue; + struct ionic_rx_service rx_svc; + + rx_svc.rx_pkts = rx_pkts; + rx_svc.nb_rx = 0; + + ionic_rxq_service(rxq, nb_pkts, &rx_svc); + + return rx_svc.nb_rx; +} + +/* + * Fills all descriptors with mbufs. + */ +int __rte_cold +ionic_rx_fill(struct ionic_rx_qcq *rxq) +{ + struct ionic_queue *q = &rxq->qcq.q; + uint32_t i; + int err = 0; + + for (i = 0; i < q->num_descs - 1u; i++) { + err = ionic_rx_fill_one(rxq); + if (err) + break; + + q->head_idx = Q_NEXT_TO_POST(q, 1); + } + + ionic_q_flush(q); + + return err; +} diff --git a/drivers/net/ionic/meson.build b/drivers/net/ionic/meson.build index 00865c2139..71c7f2311a 100644 --- a/drivers/net/ionic/meson.build +++ b/drivers/net/ionic/meson.build @@ -16,4 +16,6 @@ sources = files( 'ionic_main.c', 'ionic_rx_filter.c', 'ionic_rxtx.c', + 'ionic_rxtx_simple.c', + 'ionic_rxtx_sg.c', ) From patchwork Tue Oct 18 19:41:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118501 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F1B99A0560; Tue, 18 Oct 2022 21:48:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E65A742B77; Tue, 18 Oct 2022 21:48:22 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2071.outbound.protection.outlook.com [40.107.223.71]) by mails.dpdk.org (Postfix) with ESMTP id 7E0134282F for ; Tue, 18 Oct 2022 21:48:20 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TT+rarOOQ8aEmNaS3fBf6MsHbKyjmbPwed5Qza3Sfj6x/TzUPTbq/enh12c0jIjWMsHUKLJUCSWfima07TKSblYDgEygU47NnseTU00GlkuweAsuNrj/XHV1ZvDT5gs71NXZWjEh9STxtkcdUlt0K8mWRYjKW/t4eSLJtY6J53CA7O0ouwx5PVkoOAsWc6DRnlYu8s708/QPD4zzaR0EyCdxQxwcQ7OxK+RIODdRLH5Hjy9+LXQXp2eC8AJOOZBT2ehxB8vfoYURAy/zaU1b4VawNw/u1qUap81ZBneOKXtIHXg9bWU2GmvIhFAbbKLibccUc7jtluP4hSDJuZKuWw== 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=LlcvdoKp8bmaHhpUOyyVvE2v42bEkhEYKiFFkxD6trI=; b=jT6KZkeFbzTIGG9T7wa4AEFBFDEmWRLqUNdcRtFjp5LJSBHNwcQSBQ3JBVPp4deHK0qFJQmnDl00zMBmi94DVEZRfYg/6vjxPtNHoZ0vVjv4qXVkZTShIAjrIYtQRNL/nHskwwMxy3jp1/TgvDLXorygMEpywN++dCRCR5d1x18HfG6O5bR4oWZty5l/5ejX9NCxWAzBoo0XPAkLd0Atka1igkeUDXxTmI+UHBQ80V5AQgP7vA2gtP6xb4D9M23hA/YrfIsY9WOoMAF6nIP+ga5NI3+hrzvURwJ8mlo7nJbv4jtCNSlOBdRPxaD/DIYwwCgRE9YbDLUaKUCkLQ/yrw== 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=LlcvdoKp8bmaHhpUOyyVvE2v42bEkhEYKiFFkxD6trI=; b=wd3qs1Jr+z0fz73tIk5+RPo+LXLRl/My3+bZNZvk+xlZ5G6AVOa3xt5QJurGCrcw1tbKuP0JyFY6gXIT0h4W3tycHhrhGMQItkmospa7rZ0SwT7bDlXkhvYITyAYu9vlPBy1Bc8+GJQC5vPWosR916/qeXCPB2cZ4hPPVmAAxI4= Received: from DS7PR06CA0031.namprd06.prod.outlook.com (2603:10b6:8:54::11) by CY5PR12MB6624.namprd12.prod.outlook.com (2603:10b6:930:40::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32; Tue, 18 Oct 2022 19:48:19 +0000 Received: from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:8:54:cafe::3e) by DS7PR06CA0031.outlook.office365.com (2603:10b6:8:54::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.31 via Frontend Transport; Tue, 18 Oct 2022 19:48:18 +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 DM6NAM11FT024.mail.protection.outlook.com (10.13.172.159) 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:48:18 +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:48:18 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 34/36] net/ionic: use a helper variable for page size Date: Tue, 18 Oct 2022 12:41:29 -0700 Message-ID: <20221018194131.23006-35-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 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: DM6NAM11FT024:EE_|CY5PR12MB6624:EE_ X-MS-Office365-Filtering-Correlation-Id: e3d7cee3-6092-4f41-7b78-08dab141b4b9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZtjnH+qxUM6QD0IPvknb0KkB4tBHB2AKhm8TNjOqY+IRL27QT8l7ZxseJ6M/C0tmAJjwSW6TrtoLKY4eTYV6i85dOTMXcxe8e32+15B/Q8cPnZSat7uC21Xva7AKU/+EuJA7nP1OstkamlpXbGRZvgAYrT5+gK9kYk3xk4FQTxawQBnbPLY74Htf7Q3MHfGl3go8DrNmlWm5eGHvQlI/7KrFeLwi+RwxLxtUg2kr074qrRiasA0VcWVEzt/rawSOoUCDPh7UloT57hCfzbCGKUVorHRUIIWVaRCkZY5eUXSx+wOSsxlD4GYnDVLwymjdv/s9tpkYxJ5Bx3Jemd89kgminlVWmhWvsP/pg/PCbxNLP9j1BmxNw7NiiHdd8nPOFrTViv9BYwyGcs8oUjg04+DgucSsLchEudpQFDYbxfVsCWH59QHoTG+61OooUt5i/MRZ6LdHL4+tXnSTtyTihhcfY3mKNFTcMfu4J6YAtZ0lFs+2qfZqgo1IfA85YP1nlRGibr4KrYpoc/oZEAUM3aSpLb8TxaadwmUUY8lULJXqiVOPH0BBzy6jatSdjr5TYn6uzrckz5uWYcpCacx7wszAgSqeplp95l84o68b64g14k2cLG7t9pkIYqLa3Qmw8zEvME99LUqVdzbhb+Z2vAvU7/aa82LqT9uSwwmSpLPgng+gcOJcxFiwhq2S3tJOMxpV3GugwEd5wj8UrkvIK41N3alcKWMRRj8/dxpsCAbrO5vhfDwWDuJXZpe+ZkX0r+xZhBuvxrDu9DodPNrL8HayuLkaeEkXWS1SHJEzS5ZE0h2Iil9wyK2J+QGNztAB 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)(346002)(39860400002)(396003)(136003)(451199015)(36840700001)(40470700004)(46966006)(2616005)(41300700001)(6666004)(70206006)(8936002)(6916009)(36756003)(4326008)(478600001)(8676002)(70586007)(36860700001)(16526019)(26005)(44832011)(81166007)(356005)(40480700001)(82740400003)(1076003)(86362001)(186003)(40460700003)(82310400005)(426003)(83380400001)(47076005)(316002)(336012)(2906002)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:48:18.8766 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3d7cee3-6092-4f41-7b78-08dab141b4b9 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: DM6NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6624 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 readability. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 383fff9ffd..1b5932db12 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -576,6 +576,7 @@ ionic_qcq_alloc(struct ionic_lif *lif, rte_iova_t q_base_pa = 0; rte_iova_t cq_base_pa = 0; rte_iova_t sg_base_pa = 0; + size_t page_size = rte_mem_page_size(); int err; *qcq = NULL; @@ -584,18 +585,18 @@ ionic_qcq_alloc(struct ionic_lif *lif, cq_size = num_descs * cq_desc_size; sg_size = num_descs * sg_desc_size; - total_size = RTE_ALIGN(q_size, rte_mem_page_size()) + - RTE_ALIGN(cq_size, rte_mem_page_size()); + total_size = RTE_ALIGN(q_size, page_size) + + RTE_ALIGN(cq_size, page_size); /* * Note: aligning q_size/cq_size is not enough due to cq_base address * aligning as q_base could be not aligned to the page. - * Adding rte_mem_page_size(). + * Adding page_size. */ - total_size += rte_mem_page_size(); + total_size += page_size; if (flags & IONIC_QCQ_F_SG) { - total_size += RTE_ALIGN(sg_size, rte_mem_page_size()); - total_size += rte_mem_page_size(); + total_size += RTE_ALIGN(sg_size, page_size); + total_size += page_size; } new = rte_zmalloc_socket("ionic", struct_size, @@ -610,7 +611,7 @@ ionic_qcq_alloc(struct ionic_lif *lif, /* Most queue types will store 1 ptr per descriptor */ new->q.info = rte_calloc_socket("ionic", num_descs * num_segs, sizeof(void *), - rte_mem_page_size(), socket_id); + page_size, socket_id); if (!new->q.info) { IONIC_PRINT(ERR, "Cannot allocate queue info"); err = -ENOMEM; @@ -648,16 +649,13 @@ ionic_qcq_alloc(struct ionic_lif *lif, q_base = new->base; q_base_pa = new->base_pa; - cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size, - rte_mem_page_size()); - cq_base_pa = RTE_ALIGN(q_base_pa + q_size, - rte_mem_page_size()); + cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size, page_size); + cq_base_pa = RTE_ALIGN(q_base_pa + q_size, page_size); if (flags & IONIC_QCQ_F_SG) { sg_base = (void *)RTE_ALIGN((uintptr_t)cq_base + cq_size, - rte_mem_page_size()); - sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size, - rte_mem_page_size()); + page_size); + sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size, page_size); ionic_q_sg_map(&new->q, sg_base, sg_base_pa); } From patchwork Tue Oct 18 19:41:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118502 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 36B7BA0560; Tue, 18 Oct 2022 21:48:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2955642B76; Tue, 18 Oct 2022 21:48:37 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2084.outbound.protection.outlook.com [40.107.102.84]) by mails.dpdk.org (Postfix) with ESMTP id 688C042B7D for ; Tue, 18 Oct 2022 21:48:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DE80yPDGCav4XyrcgF7+CQ1S66/AMhf7KyKfSz+igTpmwcdY4zXRLXMSZ+aXN+YgY5c5ea+UHFOs73pdKEviGlfNikNwTV1chumUuc6NvlztrQC5INphfSdNu1eDzZt9Yhg7DR7vLg8am9RWeCpGD6INeb+e0pU57QcYwICgDWVhBHUhl4Rbo8fwwL9yXUTLHSLvYsdG4cx+XzB0V1xlIO6Urel6pmPQcT4AOnL92dpwbtdqk5y5nZjUN0Vzo4R2P7QlMMgZ7bDiVtTRq0dev0M2aagKInW0QtCqf3wTYBZQvpAy73n9j3sOoPzvEz9L5FFD6cZ+YUlU/UbTN587+Q== 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=V4ySZQ97TGRwubuwDJWykwiqnU8ddnnd5c4u4PknZsY=; b=nr6+GumJ3yCy4bEM0Ok22K27GsMBOHRbzwYW9YS+wgajqclVlkL4VgnQg9qUpRtvOIOodIhIim+mgHHGXohEXqYhsdwE9HkZKsmorPgEyXG+OQjp0hKrFLeyD/rlzppKOBmTD1bT2Au6hWDtvuXfalr66qz/1GCwLau3dQkE2jhknXFaiyZBf1BSiYJvKzIMCFSEDRNBwfE03qz9t/UXMsLJ3inlozPhZWBQisYsEB9ujCiHqXfSvHElNRdQuL9rI5ZRPkHvHWMCO5BIP2QUdW7/rKcXcz+9JKaEamHlmKpLi+0Z7fAYjEXLTuWSvBGorS6hkggrLj1KXo789p38Hg== 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=V4ySZQ97TGRwubuwDJWykwiqnU8ddnnd5c4u4PknZsY=; b=ik/sQ9cXzsMpcHT/ZgNFCRpSHb9GG1rG+2t39GVUSy0FWBa+WvBSL96eWEme7Jqdxk7K4KxIB4U5KsJyMJrrFcXLn3QlXfoEUoevxLa5rVgxgd334PMz7oz2SvDV9IjU7whi24SA6v7GOZpCegMyaPQVsotVIQhLpHH8cbAB/EU= Received: from DM6PR04CA0023.namprd04.prod.outlook.com (2603:10b6:5:334::28) by BL3PR12MB6379.namprd12.prod.outlook.com (2603:10b6:208:3b2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 18 Oct 2022 19:48:27 +0000 Received: from DM6NAM11FT103.eop-nam11.prod.protection.outlook.com (2603:10b6:5:334:cafe::1e) by DM6PR04CA0023.outlook.office365.com (2603:10b6:5:334::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34 via Frontend Transport; Tue, 18 Oct 2022 19:48:27 +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 DM6NAM11FT103.mail.protection.outlook.com (10.13.172.75) 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:48:27 +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:48:26 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 35/36] net/ionic: retry init commands up to five times Date: Tue, 18 Oct 2022 12:41:30 -0700 Message-ID: <20221018194131.23006-36-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 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: DM6NAM11FT103:EE_|BL3PR12MB6379:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ac91471-b971-4b01-cf09-08dab141b9b9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lNeM6OMHLD6hWN9+EomvtCn6yCJaTtopj3cc4gl/h9RbKg/HkUJSABLY50cY0xN02anWcqr2QDp+bPWzAxB26f9MzSKcFR8y9qTGfY6uImB6kvn0ej3kYZB+CTqrBMofhHTQRVaqweulWVrkV1iRk0U5u3I/OrD9kEN0nLpNT0Txio72e41W5VLhik/oO/y6Ro0ojfYFjdkzRmqQsfiY17ONgUhAY03tR2P0M03vbAzva9W2p9cK0QrFBIdfX2cI485yYU52t4xLKNyBqUOHrvPg/GrEVDfbt/zuZlDocszaz84gTlz3aQL+BjZRat0aM1hbf41MO/wHKzLfyog6lAvLbfw7p2zRc5uz2PZ6KEu/ccCWRmYr4MSZuPFD6eoza3FL+/skqFM66mBBDqpncTGJakLO6NQdsmD9uGS2HMbNWk/Ukc0bWMquHSd1fPSM3kxEBOBFcNmi5CPNTPddxNW8vQCn3J8lANTZi/LRv1X8PN1s/rxx/e1QRUIOmTrqcJ13BlxSeW0Md8bte2sYD2Fek96w2YXjwzaXHTl+5z0IRudWvGEdccTMz+jgCBrwt4JPx4R3foOYDePai2Rk+dIbXZCmug/4aZLmYykXemhgi+33CVvnylvWMcBQe/9cg8FrxKBCA1jJibQoSZlFDN1YGKMmsDj8UQJOSFNqClFZXj9Z7lsZLsVZzIkcBRuAFa+MwqM9lZ/yQVOZXBRLkRaULYm/0I6Vr0oyAkvYmaz9WMJdlUkT9hZKY02mWOAoo+N1oVmlNQcoWDOm9DCW1CcuQxQv69n0ojSdSJPkfsXn6WjfAGhzY+C9G51bbhDL 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)(346002)(39860400002)(396003)(136003)(376002)(451199015)(40470700004)(36840700001)(46966006)(36756003)(86362001)(81166007)(82740400003)(356005)(2906002)(426003)(1076003)(16526019)(186003)(47076005)(40460700003)(5660300002)(40480700001)(44832011)(2616005)(6666004)(36860700001)(26005)(478600001)(83380400001)(336012)(8676002)(82310400005)(316002)(6916009)(70586007)(70206006)(41300700001)(4326008)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:48:27.2674 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2ac91471-b971-4b01-cf09-08dab141b9b9 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: DM6NAM11FT103.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6379 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 In some configurations, the FW may return EAGAIN if it is not able to respond to commands immediately. Retry the init commands in this case to prevent errors from reaching the client. Fix up some return-code stuff while here, for clarity. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_dev.h | 1 + drivers/net/ionic/ionic_lif.c | 14 ++++++++++++++ drivers/net/ionic/ionic_main.c | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index 46434f81a4..5e238e8ab7 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -24,6 +24,7 @@ #define IONIC_DEVCMD_TIMEOUT 5 /* devcmd_timeout */ #define IONIC_DEVCMD_CHECK_PERIOD_US 10 /* devcmd status chk period */ +#define IONIC_DEVCMD_RETRY_WAIT_US 20000 #define IONIC_ALIGN 4096 diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 1b5932db12..63635a4b19 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -1423,10 +1423,17 @@ ionic_lif_adminq_init(struct ionic_lif *lif) struct ionic_admin_qcq *aqcq = lif->adminqcq; struct ionic_queue *q = &aqcq->qcq.q; struct ionic_q_init_comp comp; + uint32_t retries = 5; int err; +retry_adminq_init: ionic_dev_cmd_adminq_init(idev, &aqcq->qcq); err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); + if (err == -EAGAIN && retries > 0) { + retries--; + rte_delay_us_block(IONIC_DEVCMD_RETRY_WAIT_US); + goto retry_adminq_init; + } if (err) return err; @@ -1713,12 +1720,19 @@ ionic_lif_init(struct ionic_lif *lif) { struct ionic_dev *idev = &lif->adapter->idev; struct ionic_lif_init_comp comp; + uint32_t retries = 5; int err; memset(&lif->stats_base, 0, sizeof(lif->stats_base)); +retry_lif_init: ionic_dev_cmd_lif_init(idev, lif->info_pa); err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); + if (err == -EAGAIN && retries > 0) { + retries--; + rte_delay_us_block(IONIC_DEVCMD_RETRY_WAIT_US); + goto retry_lif_init; + } if (err) return err; diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c index 05f1e90e30..26e08d06c9 100644 --- a/drivers/net/ionic/ionic_main.c +++ b/drivers/net/ionic/ionic_main.c @@ -313,10 +313,10 @@ ionic_dev_cmd_check_error(struct ionic_dev *idev) uint8_t status; status = ionic_dev_cmd_status(idev); - if (status == 0) + if (status == IONIC_RC_SUCCESS) return 0; - return -EIO; + return (status == IONIC_RC_EAGAIN) ? -EAGAIN : -EIO; } int From patchwork Tue Oct 18 19:41:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 118503 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 56337A0560; Tue, 18 Oct 2022 21:48:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4A1D34281C; Tue, 18 Oct 2022 21:48:55 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2043.outbound.protection.outlook.com [40.107.244.43]) by mails.dpdk.org (Postfix) with ESMTP id 86338427F1 for ; Tue, 18 Oct 2022 21:48:53 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g2X6veHbvw4a0SHUnRFVndohtNTWEecA7U1qJ+DftX9iHiSQCE0GZqu6k+htck86pEGS/mOwWS7cMV2JUyP8aBbtzptnaXV2S+AmgGBfsSX5bCPojCsd/op6pxadXk/f+KeBV7ajEHW1GKlAG1I9kyKVTV09drcG7smV1P9317aS6IXOIxvARhYCVC7RXNfvR3QfA+AzYBjsFd5FqsZLxVmbZvEGPDOJxCtu2ilfWTn0DuL+7TjQqhYPoJRx13/kNu0vKA5a7Yx8qRnmMPjwm9Tx7pW2lKevkAreWaJw7WqydmSs2uYDm3iB5xba5pG5K4nolzjyrn3u3J5mtOtILQ== 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=9jyksuWp4IEy4q2EG2JU1Y1zvIgPRyXwtD2Aad5YVb4=; b=lqKbPgEG3IdQ1HirfJWCeLQZavRj8y2vQvqB2ixPPo/xWkFFWsoRMW5EdMc87Dl+3qkhmWffCwIdoCMjvuMKLCGTxn7/Yfh2WvekCIXcnC8f7Z9X1rpu482eaXCsoVSB76MgJNoG7ByJXQ4x2c3XXmNEzqCLMuverFJ2EOj4la1LPbhmTfE6S4LixasM2ClwXUzNa8RGRrdhndqoL2aQ9FjJCTgWWGexYMsjPen4t1clWgPe86vtHkum3BrJxAMj2Uha1Dz4udo9q0Wylr2zDZQNoYbExAGbkzv3SsaJ6EM9LJO7YJXNejfohcc+PxrTtODEpj7spcmxuuZfd0SZuQ== 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=9jyksuWp4IEy4q2EG2JU1Y1zvIgPRyXwtD2Aad5YVb4=; b=rZrJLzzUd/9a0ZjnuaYpN4jDNzGN77CqybRG0tn0eGsNHdtpp2rdESHLnwoZ1NN9bxjLJFTQ84fVZjWRyxzQkWN1AHogXlzetHGAfwyPhx/tZcYCpn1ItlbxjBWh9FYZHn9z7x23bE/B1M3Kh+wssV80wa6G+CV6Yb/6KVSrUYI= Received: from DS7PR07CA0022.namprd07.prod.outlook.com (2603:10b6:5:3af::24) by DM4PR12MB7575.namprd12.prod.outlook.com (2603:10b6:8:10d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 18 Oct 2022 19:48:51 +0000 Received: from DM6NAM11FT105.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3af:cafe::ba) by DS7PR07CA0022.outlook.office365.com (2603:10b6:5:3af::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34 via Frontend Transport; Tue, 18 Oct 2022 19:48:51 +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 DM6NAM11FT105.mail.protection.outlook.com (10.13.173.164) 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:48:51 +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:48:48 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 36/36] net/ionic: add watchdogs to protect each queue type Date: Tue, 18 Oct 2022 12:41:31 -0700 Message-ID: <20221018194131.23006-37-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 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: DM6NAM11FT105:EE_|DM4PR12MB7575:EE_ X-MS-Office365-Filtering-Correlation-Id: 49ad3e48-f88b-4233-3b68-08dab141c7f5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LSRPZ8zPT9RvcQ0n9SC5Vdx8zqg43Le1Q+tdG+aacbHmVDG5npChqxJwFj3Tzsw/OwIptf52UylYyi4dh0Ah6jjtsqQ+P/9zjfop0Rk4fDfe9SCqiefH01Y2lTFLWd7/i52XZplTW4NmabgBxtKHGErBzK61l/bnEto5sHR15lZIbTvDSgJ90yGObns6HhreUmcO80khV49q5DPstbKZVSv20OzbqbYiQc9BRd1ds+z7iZsE/HhregNYeKsXCHvbP5wEW81+K4C7cePVMRW8czTy7O8Ux9P1pY3FjrJYCqZaxQQAdXlmxTDNEx+nUU4VylI22MPrz7DYSSjdOdbNnREeUeirgsFi2k4YxkrzsnLoSnNm/wLPs/o/fU7OHqfOhYDeV4uYJL+vXLfv6pj4j4qTgSxYdLiTlUn7m9WeqXvw9Ny+5rrZcbCMQT8KRQfKJ0f9ZWTu2KxNWWNMtMGLK5fVabPOFrTjW1jxDLjUuNjx2nOCclxoWcKZ7+3F4EEj/7B71/jyjbXGdkhT2otNNB7cB5gwXlOctDR8YlHaiLTPTrbBJF5XZucxHNGbJMAIFzfRaI0BVS4fXdu8upA+KgZQE94J39mbRvicLAXvAYBtVd76xJz7iYNtvnW1QAlIRpdKB9qKacoV883hWZAGRTogI6Xd/geoj5DSowcRCJACzNDYPM2xlj2/3WR3W/+K6CxrRWw9ilD6qmjdHn2Tw/cjD45NPDxUef51LJO8+Vkvrww8r9bSiNnoVMDWbsKT03cMshYS+JLEYBLaxzfsSF9A4Zj+Q+4Vz4MbBLG6ZIgIPsuY8PXezFMmCOOcWfne 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)(39860400002)(346002)(136003)(451199015)(46966006)(40470700004)(36840700001)(36860700001)(82740400003)(82310400005)(478600001)(356005)(81166007)(186003)(4326008)(2616005)(40460700003)(36756003)(44832011)(6916009)(316002)(70586007)(70206006)(426003)(336012)(47076005)(83380400001)(6666004)(1076003)(5660300002)(8676002)(40480700001)(16526019)(2906002)(26005)(8936002)(86362001)(41300700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:48:51.1449 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 49ad3e48-f88b-4233-3b68-08dab141c7f5 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: DM6NAM11FT105.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7575 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 Ring the doorbell again for the following scenarios: * No receives posted but Rx queue not empty after deadline * No transmits posted but Tx work still pending after deadline * Admin queue work still pending after deadline This will help the queues recover in the extremely rare case that a doorbell is missed by the FW. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_dev.h | 4 +++ drivers/net/ionic/ionic_lif.h | 3 ++ drivers/net/ionic/ionic_main.c | 22 ++++++++++++ drivers/net/ionic/ionic_rxtx.c | 1 + drivers/net/ionic/ionic_rxtx_sg.c | 50 ++++++++++++++++++++++++++- drivers/net/ionic/ionic_rxtx_simple.c | 50 ++++++++++++++++++++++++++- 6 files changed, 128 insertions(+), 2 deletions(-) diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index 5e238e8ab7..b1e74fbd89 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -26,6 +26,10 @@ #define IONIC_DEVCMD_CHECK_PERIOD_US 10 /* devcmd status chk period */ #define IONIC_DEVCMD_RETRY_WAIT_US 20000 +#define IONIC_Q_WDOG_MS 10 /* 10ms */ +#define IONIC_Q_WDOG_MAX_MS 5000 /* 5s */ +#define IONIC_ADMINQ_WDOG_MS 500 /* 500ms */ + #define IONIC_ALIGN 4096 struct ionic_adapter; diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index 00c8add95c..36b3bcc5a9 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -85,6 +85,8 @@ struct ionic_rx_qcq { struct rte_mempool *mb_pool; uint64_t rearm_data; uint64_t rearm_seg_data; + uint64_t last_wdog_cycles; + uint64_t wdog_ms; uint16_t frame_size; /* Based on configured MTU */ uint16_t hdr_seg_size; /* Length of first segment of RX chain */ uint16_t seg_size; /* Length of all subsequent segments */ @@ -103,6 +105,7 @@ struct ionic_tx_qcq { struct ionic_qcq qcq; /* cacheline2 */ + uint64_t last_wdog_cycles; uint16_t num_segs_fw; /* # segs supported by current FW */ uint16_t free_thresh; uint16_t flags; diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c index 26e08d06c9..c957d55bf9 100644 --- a/drivers/net/ionic/ionic_main.c +++ b/drivers/net/ionic/ionic_main.c @@ -230,10 +230,16 @@ static int ionic_adminq_wait_for_completion(struct ionic_lif *lif, struct ionic_admin_ctx *ctx, unsigned long max_wait) { + struct ionic_queue *q = &lif->adminqcq->qcq.q; unsigned long step_usec = IONIC_DEVCMD_CHECK_PERIOD_US; + unsigned long step_deadline; unsigned long max_wait_usec = max_wait * 1000000L; unsigned long elapsed_usec = 0; int budget = 8; + uint16_t idx; + void **info; + + step_deadline = IONIC_ADMINQ_WDOG_MS * 1000 / step_usec; while (ctx->pending_work && elapsed_usec < max_wait_usec) { /* @@ -245,10 +251,26 @@ ionic_adminq_wait_for_completion(struct ionic_lif *lif, ionic_qcq_service(&lif->adminqcq->qcq, budget, ionic_adminq_service, NULL); + /* + * Ring the doorbell again if work is pending after deadline. + */ + if (ctx->pending_work && !step_deadline) { + step_deadline = IONIC_ADMINQ_WDOG_MS * + 1000 / step_usec; + + rte_spinlock_lock(&lif->adminq_lock); + idx = Q_NEXT_TO_POST(q, -1); + info = IONIC_INFO_PTR(q, idx); + if (info[0] == ctx) + ionic_q_flush(q); + rte_spinlock_unlock(&lif->adminq_lock); + } + rte_spinlock_unlock(&lif->adminq_service_lock); rte_delay_us_block(step_usec); elapsed_usec += step_usec; + step_deadline--; } return (!ctx->pending_work); diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index d216980450..b9e73b4871 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -551,6 +551,7 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, } rxq->mb_pool = mp; + rxq->wdog_ms = IONIC_Q_WDOG_MS; /* * Note: the interface does not currently support diff --git a/drivers/net/ionic/ionic_rxtx_sg.c b/drivers/net/ionic/ionic_rxtx_sg.c index 4e4a18e5d7..2752ba2acd 100644 --- a/drivers/net/ionic/ionic_rxtx_sg.c +++ b/drivers/net/ionic/ionic_rxtx_sg.c @@ -167,6 +167,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts, struct rte_mbuf *mbuf; uint32_t bytes_tx = 0; uint16_t nb_avail, nb_tx = 0; + uint64_t then, now, hz, delta; int err; struct ionic_txq_desc *desc_base = q->base; @@ -220,8 +221,26 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts, rte_wmb(); ionic_q_flush(q); + txq->last_wdog_cycles = rte_get_timer_cycles(); + stats->packets += nb_tx; stats->bytes += bytes_tx; + } else { + /* + * Ring the doorbell again if no work could be posted and work + * is still pending after the deadline. + */ + if (q->head_idx != q->tail_idx) { + then = txq->last_wdog_cycles; + now = rte_get_timer_cycles(); + hz = rte_get_timer_hz(); + delta = (now - then) * 1000; + + if (delta >= hz * IONIC_Q_WDOG_MS) { + ionic_q_flush(q); + txq->last_wdog_cycles = now; + } + } } return nb_tx; @@ -421,6 +440,7 @@ ionic_rxq_service_sg(struct ionic_rx_qcq *rxq, uint32_t work_to_do, struct ionic_rxq_desc *q_desc_base = q->base; struct ionic_rxq_comp *cq_desc, *cq_desc_base = cq->base; uint32_t work_done = 0; + uint64_t then, now, hz, delta; cq_desc = &cq_desc_base[cq->tail_idx]; @@ -453,8 +473,36 @@ ionic_rxq_service_sg(struct ionic_rx_qcq *rxq, uint32_t work_to_do, } /* Update the queue indices and ring the doorbell */ - if (work_done) + if (work_done) { ionic_q_flush(q); + rxq->last_wdog_cycles = rte_get_timer_cycles(); + rxq->wdog_ms = IONIC_Q_WDOG_MS; + } else { + /* + * Ring the doorbell again if no recvs were posted and the + * recv queue is not empty after the deadline. + * + * Exponentially back off the deadline to avoid excessive + * doorbells when the recv queue is idle. + */ + if (q->head_idx != q->tail_idx) { + then = rxq->last_wdog_cycles; + now = rte_get_timer_cycles(); + hz = rte_get_timer_hz(); + delta = (now - then) * 1000; + + if (delta >= hz * rxq->wdog_ms) { + ionic_q_flush(q); + rxq->last_wdog_cycles = now; + + delta = 2 * rxq->wdog_ms; + if (delta > IONIC_Q_WDOG_MAX_MS) + delta = IONIC_Q_WDOG_MAX_MS; + + rxq->wdog_ms = delta; + } + } + } } uint16_t diff --git a/drivers/net/ionic/ionic_rxtx_simple.c b/drivers/net/ionic/ionic_rxtx_simple.c index a191fd3ec9..0421fb32b2 100644 --- a/drivers/net/ionic/ionic_rxtx_simple.c +++ b/drivers/net/ionic/ionic_rxtx_simple.c @@ -140,6 +140,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, struct rte_mbuf *mbuf; uint32_t bytes_tx = 0; uint16_t nb_avail, nb_tx = 0; + uint64_t then, now, hz, delta; int err; struct ionic_txq_desc *desc_base = q->base; @@ -193,8 +194,26 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, rte_wmb(); ionic_q_flush(q); + txq->last_wdog_cycles = rte_get_timer_cycles(); + stats->packets += nb_tx; stats->bytes += bytes_tx; + } else { + /* + * Ring the doorbell again if no work could be posted and work + * is still pending after the deadline. + */ + if (q->head_idx != q->tail_idx) { + then = txq->last_wdog_cycles; + now = rte_get_timer_cycles(); + hz = rte_get_timer_hz(); + delta = (now - then) * 1000; + + if (delta >= hz * IONIC_Q_WDOG_MS) { + ionic_q_flush(q); + txq->last_wdog_cycles = now; + } + } } return nb_tx; @@ -342,6 +361,7 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do, struct ionic_rxq_desc *q_desc_base = q->base; struct ionic_rxq_comp *cq_desc, *cq_desc_base = cq->base; uint32_t work_done = 0; + uint64_t then, now, hz, delta; cq_desc = &cq_desc_base[cq->tail_idx]; @@ -374,8 +394,36 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do, } /* Update the queue indices and ring the doorbell */ - if (work_done) + if (work_done) { ionic_q_flush(q); + rxq->last_wdog_cycles = rte_get_timer_cycles(); + rxq->wdog_ms = IONIC_Q_WDOG_MS; + } else { + /* + * Ring the doorbell again if no recvs were posted and the + * recv queue is not empty after the deadline. + * + * Exponentially back off the deadline to avoid excessive + * doorbells when the recv queue is idle. + */ + if (q->head_idx != q->tail_idx) { + then = rxq->last_wdog_cycles; + now = rte_get_timer_cycles(); + hz = rte_get_timer_hz(); + delta = (now - then) * 1000; + + if (delta >= hz * rxq->wdog_ms) { + ionic_q_flush(q); + rxq->last_wdog_cycles = now; + + delta = 2 * rxq->wdog_ms; + if (delta > IONIC_Q_WDOG_MAX_MS) + delta = IONIC_Q_WDOG_MAX_MS; + + rxq->wdog_ms = delta; + } + } + } } uint16_t