linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Esben Haabendal <esben@geanix.com>
To: netdev@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Michal Simek <michal.simek@xilinx.com>,
	Luis Chamberlain <mcgrof@kernel.org>,
	YueHaibing <yuehaibing@huawei.com>,
	Yang Wei <yang.wei9@zte.com.cn>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v3 03/12] net: ll_temac: Fix support for 64-bit platforms
Date: Tue, 30 Apr 2019 09:17:50 +0200	[thread overview]
Message-ID: <20190430071759.2481-4-esben@geanix.com> (raw)
In-Reply-To: <20190430071759.2481-1-esben@geanix.com>

The use of buffer descriptor APP4 field (32-bit) for storing skb pointer
obviously does not work on 64-bit platforms.
As APP3 is also unused, we can use that to store the other half of 64-bit
pointer values.

Contrary to what is hinted at in commit message of commit 15bfe05c8d63
("net: ethernet: xilinx: Mark XILINX_LL_TEMAC broken on 64-bit")
there are no other pointers stored in cdmac_bd.

Signed-off-by: Esben Haabendal <esben@geanix.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/ethernet/xilinx/Kconfig         |  1 -
 drivers/net/ethernet/xilinx/ll_temac_main.c | 35 ++++++++++++++++++++++++++---
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/Kconfig b/drivers/net/ethernet/xilinx/Kconfig
index da4ec57..6d68c8a 100644
--- a/drivers/net/ethernet/xilinx/Kconfig
+++ b/drivers/net/ethernet/xilinx/Kconfig
@@ -34,7 +34,6 @@ config XILINX_AXI_EMAC
 config XILINX_LL_TEMAC
 	tristate "Xilinx LL TEMAC (LocalLink Tri-mode Ethernet MAC) driver"
 	depends on (PPC || MICROBLAZE)
-	depends on !64BIT || BROKEN
 	select PHYLIB
 	---help---
 	  This driver supports the Xilinx 10/100/1000 LocalLink TEMAC
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index fddd1b3..bcafb89 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -619,11 +619,39 @@ static void temac_adjust_link(struct net_device *ndev)
 	mutex_unlock(&lp->indirect_mutex);
 }
 
+#ifdef CONFIG_64BIT
+
+void ptr_to_txbd(void *p, struct cdmac_bd *bd)
+{
+	bd->app3 = (u32)(((u64)p) >> 32);
+	bd->app4 = (u32)((u64)p & 0xFFFFFFFF);
+}
+
+void *ptr_from_txbd(struct cdmac_bd *bd)
+{
+	return (void *)(((u64)(bd->app3) << 32) | bd->app4);
+}
+
+#else
+
+void ptr_to_txbd(void *p, struct cmdac_bd *bd)
+{
+	bd->app4 = (u32)p;
+}
+
+void *ptr_from_txbd(struct cdmac_bd *bd)
+{
+	return (void *)(bd->app4);
+}
+
+#endif
+
 static void temac_start_xmit_done(struct net_device *ndev)
 {
 	struct temac_local *lp = netdev_priv(ndev);
 	struct cdmac_bd *cur_p;
 	unsigned int stat = 0;
+	struct sk_buff *skb;
 
 	cur_p = &lp->tx_bd_v[lp->tx_bd_ci];
 	stat = cur_p->app0;
@@ -631,8 +659,9 @@ static void temac_start_xmit_done(struct net_device *ndev)
 	while (stat & STS_CTRL_APP0_CMPLT) {
 		dma_unmap_single(ndev->dev.parent, cur_p->phys, cur_p->len,
 				 DMA_TO_DEVICE);
-		if (cur_p->app4)
-			dev_consume_skb_irq((struct sk_buff *)cur_p->app4);
+		skb = (struct sk_buff *)ptr_from_txbd(cur_p);
+		if (skb)
+			dev_consume_skb_irq(skb);
 		cur_p->app0 = 0;
 		cur_p->app1 = 0;
 		cur_p->app2 = 0;
@@ -711,7 +740,7 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	cur_p->len = skb_headlen(skb);
 	cur_p->phys = dma_map_single(ndev->dev.parent, skb->data,
 				     skb_headlen(skb), DMA_TO_DEVICE);
-	cur_p->app4 = (unsigned long)skb;
+	ptr_to_txbd((void *)skb, cur_p);
 
 	for (ii = 0; ii < num_frag; ii++) {
 		lp->tx_bd_tail++;
-- 
2.4.11


  parent reply	other threads:[~2019-04-30  7:18 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-26  7:32 [PATCH 00/12] net: ll_temac: x86_64 support Esben Haabendal
2019-04-26  7:32 ` [PATCH 01/12] net: ll_temac: Fix and simplify error handling by using devres functions Esben Haabendal
2019-04-26  7:32 ` [PATCH 02/12] net: ll_temac: Extend support to non-device-tree platforms Esben Haabendal
2019-04-26 13:58   ` Andrew Lunn
2019-04-26  7:32 ` [PATCH 03/12] net: ll_temac: Fix support for 64-bit platforms Esben Haabendal
2019-04-26 18:40   ` Jakub Kicinski
2019-04-26 20:59     ` Andrew Lunn
2019-04-26 21:08       ` Jakub Kicinski
2019-04-26 22:02         ` Andrew Lunn
2019-04-26 22:30           ` Jakub Kicinski
2019-04-27  8:49             ` Esben Haabendal
2019-04-26  7:32 ` [PATCH 04/12] net: ll_temac: Add support for non-native register endianness Esben Haabendal
2019-04-26  7:32 ` [PATCH 05/12] net: ll_temac: Fix support for little-endian platforms Esben Haabendal
2019-04-26  7:32 ` [PATCH 06/12] net: ll_temac: Allow use on x86 platforms Esben Haabendal
2019-04-26 14:05   ` Andrew Lunn
2019-04-26  7:32 ` [PATCH 07/12] net: ll_temac: Support indirect_mutex share within TEMAC IP Esben Haabendal
2019-04-26 14:14   ` Andrew Lunn
2019-04-26  7:32 ` [PATCH 08/12] net: ll_temac: Fix iommu/swiotlb leak Esben Haabendal
2019-04-26 14:21   ` Andrew Lunn
2019-04-26 14:43     ` Robin Murphy
2019-04-26 15:37       ` Andrew Lunn
2019-04-26  7:32 ` [PATCH 09/12] net: ll_temac: Fix bug causing buffer descriptor overrun Esben Haabendal
2019-04-26  7:32 ` [PATCH 10/12] net: ll_temac: Replace bad usage of msleep() with usleep_range() Esben Haabendal
2019-04-26 14:01   ` Andrew Lunn
2019-04-26  7:32 ` [PATCH 11/12] net: ll_temac: Allow configuration of IRQ coalescing Esben Haabendal
2019-04-26  7:32 ` [PATCH 12/12] net: ll_temac: Enable DMA when ready, not before Esben Haabendal
2019-04-29  8:34 ` [PATCH 00/12] net: ll_temac: x86_64 support Esben Haabendal
2019-04-29  8:34   ` [PATCH 01/12] net: ll_temac: Fix and simplify error handling by using devres functions Esben Haabendal
2019-04-29  8:34   ` [PATCH 02/12] net: ll_temac: Extend support to non-device-tree platforms Esben Haabendal
2019-04-29  8:34   ` [PATCH 03/12] net: ll_temac: Fix support for 64-bit platforms Esben Haabendal
2019-04-29 22:06     ` Andrew Lunn
2019-04-29  8:34   ` [PATCH 04/12] net: ll_temac: Add support for non-native register endianness Esben Haabendal
2019-04-29  8:34   ` [PATCH 05/12] net: ll_temac: Fix support for little-endian platforms Esben Haabendal
2019-04-29  8:34   ` [PATCH 06/12] net: ll_temac: Allow use on x86 platforms Esben Haabendal
2019-04-29 22:06     ` Andrew Lunn
2019-04-29  8:34   ` [PATCH 07/12] net: ll_temac: Support indirect_mutex share within TEMAC IP Esben Haabendal
2019-04-29 22:12     ` Andrew Lunn
2019-04-30  6:54       ` Esben Haabendal
2019-04-29  8:34   ` [PATCH 08/12] net: ll_temac: Fix iommu/swiotlb leak Esben Haabendal
2019-04-29  8:34   ` [PATCH 09/12] net: ll_temac: Fix bug causing buffer descriptor overrun Esben Haabendal
2019-04-29  8:34   ` [PATCH 10/12] net: ll_temac: Replace bad usage of msleep() with usleep_range() Esben Haabendal
2019-04-29  8:34   ` [PATCH 11/12] net: ll_temac: Allow configuration of IRQ coalescing Esben Haabendal
2019-04-29  8:34   ` [PATCH 12/12] net: ll_temac: Enable DMA when ready, not before Esben Haabendal
2019-04-30  7:17   ` [PATCH v3 00/12] net: ll_temac: x86_64 support Esben Haabendal
2019-04-30  7:17     ` [PATCH v3 01/12] net: ll_temac: Fix and simplify error handling by using devres functions Esben Haabendal
2019-04-30  7:17     ` [PATCH v3 02/12] net: ll_temac: Extend support to non-device-tree platforms Esben Haabendal
2019-04-30  7:17     ` Esben Haabendal [this message]
2019-04-30  7:17     ` [PATCH v3 04/12] net: ll_temac: Add support for non-native register endianness Esben Haabendal
2019-04-30  7:17     ` [PATCH v3 05/12] net: ll_temac: Fix support for little-endian platforms Esben Haabendal
2019-04-30  7:17     ` [PATCH v3 06/12] net: ll_temac: Allow use on x86 platforms Esben Haabendal
2019-04-30  7:17     ` [PATCH v3 07/12] net: ll_temac: Support indirect_mutex share within TEMAC IP Esben Haabendal
2019-04-30 16:59       ` Andrew Lunn
2019-04-30  7:17     ` [PATCH v3 08/12] net: ll_temac: Fix iommu/swiotlb leak Esben Haabendal
2019-04-30 17:00       ` Andrew Lunn
2019-04-30  7:17     ` [PATCH v3 09/12] net: ll_temac: Fix bug causing buffer descriptor overrun Esben Haabendal
2019-04-30  7:17     ` [PATCH v3 10/12] net: ll_temac: Replace bad usage of msleep() with usleep_range() Esben Haabendal
2019-04-30  7:17     ` [PATCH v3 11/12] net: ll_temac: Allow configuration of IRQ coalescing Esben Haabendal
2019-04-30  7:17     ` [PATCH v3 12/12] net: ll_temac: Enable DMA when ready, not before Esben Haabendal
2019-05-01 18:33     ` [PATCH v3 00/12] net: ll_temac: x86_64 support David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190430071759.2481-4-esben@geanix.com \
    --to=esben@geanix.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=netdev@vger.kernel.org \
    --cc=yang.wei9@zte.com.cn \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).