From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from SA9PR02CU001.outbound.protection.outlook.com (mail-southcentralusazon11013066.outbound.protection.outlook.com [40.93.196.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B64A31283E; Mon, 13 Jul 2026 07:22:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.196.66 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783927341; cv=fail; b=ZUMcFu7zc/HLc6FoyOurOS3YzrjgWDoHTmaJe3W+FdKuijyTmYt8uM/Aa548+zUoVncg3y0d9vAhKvUkVNCBwKChmimVq/9ycXByvl1cHVyY5aLN+EjY43E4o78Kitw4uaikhH+q/vWRNthnQJ+z5h2YdkPaveHVrAyWMZj03bE= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783927341; c=relaxed/simple; bh=Fcy3E6eZFPIP4esuYSAkqsQ/udSXTba1AR7tt450Ano=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KQlzu5gHT6l+bFaNdEv/LqgrWpH8bAEeUoNHL2MEHAllVANEcQsBqykYHnZHZmPGZGNBzMj2V7B0SemANuwXIuviCOk4wNR+Wq9DaNXs2uOLAUWnE3trRq2NLItMlbHSvg8RiTGWedpIk+uSyDptIkISTseyb6oq2OEPuB4vLvc= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=F2Qk5kut; arc=fail smtp.client-ip=40.93.196.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="F2Qk5kut" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=B+l8cbDczx0+jxTkAerITySW+zUNdJg3sKrXylWQJ7G8tQhP4TeQN4y+J4K5DieMwHgfunK8FYJBnMQQi7HVEKhmme+uEcl2hKTN0vZR2hEvKtNr/QOF1ixvR/mz8ZccwZyUyxSzp69oYtHLNTfNAdDW1B0AOG5SfQVYlbcPZKxOPbHjCQKzBIUEohcAg8761HxsB6DfmRSF+CAuVpQA6rj7rS2Sob9Agrmt2K+A4SqZhohLePPD7T2XY9nDuIBFgVgusDT3IHWQTnOfZ9O8s2/INK4hmwTWDeUPJkC1S7Ko7p/Pu2Frbhdbt18VVp6K9VSv17VSvF/m3EkGnrpBYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=j9Nx89r/Z1rBeQVIr4b67OVpmsFeyYUVp9C7O53WU+8=; b=w4nIWAEa0RxTDosKmSnFhPj6naTFR2D+DFgAZi3e1UbEghlTczzI6eRXGB8qzjn5Ld5k+Cv1/TnUwDu8wfuKgmj+WzIlhmbwFkr0JwGG7Jrow8jX9HXnnQMygt3z7gCLdWnyuAELNzaKQfOed7mJuDThw1SRseQe0JZWYmJghi2OpI70Z3y3F5PaOU09TI2xv/Tayk1/TpzAsM3bEeEGlzhzardP6aWXBgF49sgPCTx2YL8A5g07/0WZ9NVo+yPv86swe4WNafLTEYCg/iTa5RLIuejXtFeMVQpQ6ieu7PrG5aDK1Yy1GAwGZkGfJOAgLpZr/HhtiJivIoLAK3dDRw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.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 (0) 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=j9Nx89r/Z1rBeQVIr4b67OVpmsFeyYUVp9C7O53WU+8=; b=F2Qk5kutFEOz4Nu80DIMXOs+sw8ziY9Y87cEa+lGpmPI1U30LboKZVg86KtXuyhIVJ4DetMOpdvo7DPn5ryK6TFDLVsW/QrvqRlcAN6wQCkcOLYRVq+PcyZrw1rmc+JpnLJHDU9FCOqK9ma5uT7gcwyiY/ZRoWiPY/REGXcA6ps= Received: from SJ0PR03CA0197.namprd03.prod.outlook.com (2603:10b6:a03:2ef::22) by LV3PR12MB9355.namprd12.prod.outlook.com (2603:10b6:408:216::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.202.18; Mon, 13 Jul 2026 07:22:13 +0000 Received: from SJ1PEPF000026C8.namprd04.prod.outlook.com (2603:10b6:a03:2ef:cafe::46) by SJ0PR03CA0197.outlook.office365.com (2603:10b6:a03:2ef::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.202.19 via Frontend Transport; Mon, 13 Jul 2026 07:22:13 +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=satlexmb08.amd.com; pr=C Received: from satlexmb08.amd.com (165.204.84.17) by SJ1PEPF000026C8.mail.protection.outlook.com (10.167.244.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.9 via Frontend Transport; Mon, 13 Jul 2026 07:22:13 +0000 Received: from satlexmb10.amd.com (10.181.42.219) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Mon, 13 Jul 2026 02:22:09 -0500 Received: from satlexmb08.amd.com (10.181.42.217) by satlexmb10.amd.com (10.181.42.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Mon, 13 Jul 2026 02:22:08 -0500 Received: from xhdsneeli41.xilinx.com (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.41 via Frontend Transport; Mon, 13 Jul 2026 02:22:03 -0500 From: Srinivas Neeli To: Vinod Koul , Radhey Shyam Pandey CC: Frank Li , Michal Simek , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Suraj Gupta , Marek Vasut , Tomi Valkeinen , Alex Bereza , "Folker Schwesinger" , , , , , Subject: [PATCH v4 3/4] net: xilinx: axienet: Derive RX frame length from residue in dmaengine path Date: Mon, 13 Jul 2026 12:51:45 +0530 Message-ID: <20260713072146.45269-4-srinivas.neeli@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260713072146.45269-1-srinivas.neeli@amd.com> References: <20260713072146.45269-1-srinivas.neeli@amd.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000026C8:EE_|LV3PR12MB9355:EE_ X-MS-Office365-Filtering-Correlation-Id: 6753c5ae-ffd8-4753-2c66-08dee0af75c0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700016|82310400026|23010399003|7416014|376014|3023799007|6133799003|18002099003|22082099003|56012099006|11063799006; X-Microsoft-Antispam-Message-Info: pTGL4bl7NF1vs8wxxN6pMQppazsE4cPP+RSOaHaPd5nOYEO0DKryN6RifPuIKWU8oS4OddpAHn7qv7uhcvRQUuzYI7wEe/tEjhiDkDNUTIbYWT1+6kvsLnbTtYhm6TPdPVn9qScIS6m1Dy6BKBh3/cZXfkeStXQw7f1+iLz6K18P6s/Hr9OfgSIWxsBT1UN1sdkioX0E9urReBmQPFKJLsuItyiUZJZ33/DKqHtY3nAUSe3DVNd9f9tRvaW5NLIopj2DluuiEYtkUv3S2FBl4zuP7ksdVo8EU4dNuctjyrnOfG7BRQsnkfa6KLqSGJx/xZBmEAcWJg0SO7XyqCcIia9OoEjLcIFOQrCGTnlYoXPri03BVDs8rCnp72KvEcJGBGoDbknNJB9XScEptiBSH/gj/4qNg0dStWKrOFKYOJefgbqnRRZ3RDNBTea5jFQI3OVAunITik8c81nW3bi6Mb8GiGGwwHmrrRubWmeQm6HCB0tG1WfXwYZ6GQQ8ZA3JvEuKcsGTIg8B/WhDlkeO6evGUwK97hAe0z/DoYUdcoX+z1wOwaI6JmjwLi/L3LUMYpXwVQ2wrzUImx8WtcDu/Fu3fofxkhZ9K2MgzydwC5jV5i2Xi+ZSDMfHOD+n2QMRZ7MASELT91bAP/M206p+hIkWScYQejzyWsqfp4UMFmgy9+6P4r2yFZMzCxp3QZ0aq759bwjdcrXgH13bYa/t8Q== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb08.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700016)(82310400026)(23010399003)(7416014)(376014)(3023799007)(6133799003)(18002099003)(22082099003)(56012099006)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tHfoXw9A9oa2NKdxDDUQUyRnw4fQlmfT4YFHIhptN/FPNuR3B34xrvKpqaDE071K4wUJGM2zYx7Y9omX7YqwsC6/E8/nobVtONQE5P7h/+pw+VLK5GP9jWhFT7ayzbLWobf7wJLC7hxxhCljffUWilqBhgzNRWCWR7V8upEB+RCWRMdQhsVMdc50DDkEN89JKA+hAGqktrKH+iTQD2VVV/i+/rpL0NAs4mw5qoDHMqUKwsxRIVhjub/rP7zM4AiyyQElPaQtwHlxiMwhbAamDcUtsIp4+TzqPuBPnV1FpZiKh72VaqxIHi3Vy7krpkDLGyqgfWfQylL3Pq6lWeHAEgyPr0q+4gp7SJzQ/V398A/+AZepFVUfh9BGx0aq8ljuiu+DEjdHN80NRBWmCFQQb9UIBG3OF2x5N8JSNVXo5Q73SSq9duXJsiKnYnoCCmqz X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2026 07:22:13.1282 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6753c5ae-ffd8-4753-2c66-08dee0af75c0 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=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF000026C8.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9355 The dmaengine RX path derived the received frame length from the descriptor APP metadata. That only works when the optional AXI4-Stream status/control interface is present, because the hardware populates the APP fields solely when that interface is enabled. On designs without it the length read back is invalid. The AXI DMA engine already reports how many bytes it wrote into the buffer through the standard dmaengine residue mechanism. Compute the RX frame length as the posted buffer length minus result->residue, which is independent of the status/control interface and correct across all designs, including multi-descriptor frames where the residue is summed over the chain. Drop the descriptor metadata lookup, which was only used for this purpose. Detect a failed transfer from dmaengine_result.result instead of the metadata pointer return value, and remove the now unused LEN_APP macro. The transmit path is unaffected. It still passes APP metadata for checksum offload and derives its length from the skb. Signed-off-by: Srinivas Neeli --- Changes in V4: - Renamed subject to "Derive RX frame length from residue in dmaengine path". - Condensed the commit message. - Dropped the Fixes tag. Changes in V3: - New patch in this series. - This patch enables axienet to work on designs where the AXI4-Stream status/control interface is not present. By using the standard dmaengine residue mechanism, the driver no longer depends on APP fields being populated by hardware. - This approach replaces the V2 xferred_bytes mechanism (V2 patch 5/5), making the dt-bindings patch (V2 patch 4/5) for xlnx,include-stscntrl-strm also unnecessary. Both V2 patches are dropped in this series. --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index fcf517069d16..67d1b8e91d68 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -53,7 +53,6 @@ #define TX_BD_NUM_MAX 4096 #define RX_BD_NUM_MAX 4096 #define DMA_NUM_APP_WORDS 5 -#define LEN_APP 4 #define RX_BUF_NUM_DEFAULT 128 /* Must be shorter than length of ethtool_drvinfo.driver field to fit */ @@ -1159,29 +1158,26 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) static void axienet_dma_rx_cb(void *data, const struct dmaengine_result *result) { struct skbuf_dma_descriptor *skbuf_dma; - size_t meta_len, meta_max_len, rx_len; struct axienet_local *lp = data; struct sk_buff *skb; - u32 *app_metadata; + size_t rx_len; int i; skbuf_dma = axienet_get_rx_desc(lp, lp->rx_ring_tail++); skb = skbuf_dma->skb; - app_metadata = dmaengine_desc_get_metadata_ptr(skbuf_dma->desc, &meta_len, - &meta_max_len); dma_unmap_single(lp->dev, skbuf_dma->dma_address, lp->max_frm_size, DMA_FROM_DEVICE); - if (IS_ERR(app_metadata)) { + if (result->result != DMA_TRANS_NOERROR) { if (net_ratelimit()) - netdev_err(lp->ndev, "Failed to get RX metadata pointer\n"); + netdev_err(lp->ndev, "RX DMA transfer failed\n"); dev_kfree_skb_any(skb); lp->ndev->stats.rx_dropped++; goto rx_submit; } - /* TODO: Derive app word index programmatically */ - rx_len = (app_metadata[LEN_APP] & 0xFFFF); + /* Actual length = posted buffer length - residue. */ + rx_len = lp->max_frm_size - result->residue; skb_put(skb, rx_len); skb->protocol = eth_type_trans(skb, lp->ndev); skb->ip_summed = CHECKSUM_NONE; -- 2.25.1