From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 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 Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: 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); -- 2.17.1