Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6462978rwb; Tue, 22 Nov 2022 13:51:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf6lHXcgV7jYFIx/UzRyhYzYvVLUw9RI0MaUcPC3l06h0fDX5JXMcYL2NMw5d3p86X2YyKvx X-Received: by 2002:a17:907:9010:b0:7ad:ba48:7e7c with SMTP id ay16-20020a170907901000b007adba487e7cmr21164419ejc.443.1669153896353; Tue, 22 Nov 2022 13:51:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669153896; cv=none; d=google.com; s=arc-20160816; b=NUOAbufr8iRrBMgnEM4BfKHu+T9PcUGnxrqhmOB3/7vttICnUqMyQmuUR7TJc4ng36 ZC9P9LG0dKuM9ULTzLGuTiZl27JeI6xfVlAA7jSyn7z7WPWDBfhOdMFF8dK4HR9msKcy XiLPMdIGJaBxGLbGrwiXDN+7gE6UJqxqPmRG6UTNwXRAsVIUte139sl/0h8UiQwTTYxK psfXPH47mkEdQyXLzHPKMmeHelPVbVuP+pJLvxLP3O+TwM5iHPTcgKEwQKEev9vjo9hD fWjenWbjh689sFtBcCtXbnOAj3U4GEkdAq0C0GjGZiJ806MxVr/Kzvq36Xxmjg9XC1Bj /ZGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kKwrvd8/fFlh1JVA0vDEJVmeT0R65k7sQ4HVRzZUOW4=; b=WgjwHLEJ08hFaBIv9j8UKew2qDbc/y8VP//f2sd0Cv5CJhJccl4muRfQLETIe032nq /h9aEfoIdqRGIQ0X9VRAv2E0etlFunnoI2y17l9MsH/gl+5/pd37vgfTnD+qwY4Lxs/P oRTjHzF8NoEcGCSwdl68rH6Y0EPW0kN8TkzB6ociLfTCriLslwGDXzQHplRtoG5OhMRB v7qeKT72S8ZHnq628RjrQPC/P71zk+Z2vngX12ullcAk+BJejPtKOzNeRa4JrBvPMYrK svG+eRs8oqhzlQ9xMupxBoKVALEcK8Sv9bDmJ58bXQ6oAVWInYDQcDIYgGcD/wXtUt3j 9v8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=pqc2GIYT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn42-20020a1709070d2a00b0078e319dcca7si13250636ejc.744.2022.11.22.13.51.14; Tue, 22 Nov 2022 13:51:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=pqc2GIYT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235080AbiKVVkX (ORCPT + 89 others); Tue, 22 Nov 2022 16:40:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235087AbiKVVkN (ORCPT ); Tue, 22 Nov 2022 16:40:13 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D43B5C6072; Tue, 22 Nov 2022 13:40:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1669153206; x=1700689206; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=q0Sn23Y5RcrLJJSzqjsvSLaJWPYpAiItTX0oz16kJUE=; b=pqc2GIYTKpBB5B1xae98Y2zPPjw+wYC/u8qtI+oYhnN+pXysSGpkC2aa KiNw5w6ypLKTQ5E7ZDYjU+aN9ceLR/cbS6zekZGdnnhbYuGd3UvRNoC5A UB6lyYdOnCKaEkajtCO5DR++H635ME5a4F/h9Iao75PUxcmjAI7YrfKe8 5xe3gewEvYNguhgRLXzkLYN/1PwdTuzrdPHK0MffQjBc2LEozXh6R5Nww Z+1A62SfIV8FBEuu0Kb94rr/HYS6uo2+8AU6KUFn+FOlaFEbWNVyCgIdi QGvkSLJVgf3XpHh9RUzzJLHbHODabpAXom929jPDWhEIM9NhBqb3/RlgS g==; X-IronPort-AV: E=Sophos;i="5.96,185,1665471600"; d="scan'208";a="184748246" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 22 Nov 2022 14:40:06 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 22 Nov 2022 14:40:02 -0700 Received: from soft-dev3-1.microsemi.net (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 22 Nov 2022 14:40:00 -0700 From: Horatiu Vultur To: , , CC: , , , , , , , , , , Horatiu Vultur Subject: [PATCH net-next v4 3/7] net: lan966x: Add len field to lan966x_tx_dcb_buf Date: Tue, 22 Nov 2022 22:44:09 +0100 Message-ID: <20221122214413.3446006-4-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221122214413.3446006-1-horatiu.vultur@microchip.com> References: <20221122214413.3446006-1-horatiu.vultur@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,T_SPF_TEMPERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently when a frame was transmitted, it is required to unamp the frame that was transmitted. The length of the frame was taken from the transmitted skb. In the future we might not have an skb, therefore store the length skb directly in the lan966x_tx_dcb_buf and use this one to unamp the frame. While at this, also arrange the members in lan966x_tx_dcb_buf not to have any holes. Signed-off-by: Horatiu Vultur --- drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c | 5 +++-- drivers/net/ethernet/microchip/lan966x/lan966x_main.h | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c index 94c720e59caee..384ed34197d58 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c @@ -391,12 +391,12 @@ static void lan966x_fdma_tx_clear_buf(struct lan966x *lan966x, int weight) continue; dcb_buf->dev->stats.tx_packets++; - dcb_buf->dev->stats.tx_bytes += dcb_buf->skb->len; + dcb_buf->dev->stats.tx_bytes += dcb_buf->len; dcb_buf->used = false; dma_unmap_single(lan966x->dev, dcb_buf->dma_addr, - dcb_buf->skb->len, + dcb_buf->len, DMA_TO_DEVICE); if (!dcb_buf->ptp) dev_kfree_skb_any(dcb_buf->skb); @@ -709,6 +709,7 @@ int lan966x_fdma_xmit(struct sk_buff *skb, __be32 *ifh, struct net_device *dev) /* Fill up the buffer */ next_dcb_buf = &tx->dcbs_buf[next_to_use]; next_dcb_buf->skb = skb; + next_dcb_buf->len = skb->len; next_dcb_buf->dma_addr = dma_addr; next_dcb_buf->used = true; next_dcb_buf->ptp = false; diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h index bc93051aa0798..c762e3732f88f 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h @@ -173,11 +173,12 @@ struct lan966x_rx { }; struct lan966x_tx_dcb_buf { + dma_addr_t dma_addr; struct net_device *dev; struct sk_buff *skb; - dma_addr_t dma_addr; - bool used; - bool ptp; + u32 len; + u32 used : 1; + u32 ptp : 1; }; struct lan966x_tx { -- 2.38.0