All of lore.kernel.org
 help / color / mirror / Atom feed
From: Camelia Groza <camelia.groza@nxp.com>
To: kuba@kernel.org, maciej.fijalkowski@intel.com, brouer@redhat.com,
	saeed@kernel.org, davem@davemloft.net
Cc: madalin.bucur@oss.nxp.com, ioana.ciornei@nxp.com,
	netdev@vger.kernel.org, Camelia Groza <camelia.groza@nxp.com>
Subject: [PATCH net-next v4 1/7] dpaa_eth: add struct for software backpointers
Date: Mon, 23 Nov 2020 19:36:19 +0200	[thread overview]
Message-ID: <f4e21424c6747502b1824fa41f67b0bc47732a33.1606150838.git.camelia.groza@nxp.com> (raw)
In-Reply-To: <cover.1606150838.git.camelia.groza@nxp.com>
In-Reply-To: <cover.1606150838.git.camelia.groza@nxp.com>

We maintain an skb backpointer in the software annotations area of Tx
frames. Introduce a structure for explicit handling.

Acked-by: Madalin Bucur <madalin.bucur@oss.nxp.com>
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 16 +++++++++-------
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h |  8 ++++++++
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 8867693..88533a2 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -1633,6 +1633,7 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv,
 	dma_addr_t addr = qm_fd_addr(fd);
 	void *vaddr = phys_to_virt(addr);
 	const struct qm_sg_entry *sgt;
+	struct dpaa_eth_swbp *swbp;
 	struct sk_buff *skb;
 	u64 ns;
 	int i;
@@ -1665,7 +1666,8 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv,
 				 dma_dir);
 	}
 
-	skb = *(struct sk_buff **)vaddr;
+	swbp = (struct dpaa_eth_swbp *)vaddr;
+	skb = swbp->skb;
 
 	/* DMA unmapping is required before accessing the HW provided info */
 	if (ts && priv->tx_tstamp &&
@@ -1879,8 +1881,8 @@ static int skb_to_contig_fd(struct dpaa_priv *priv,
 {
 	struct net_device *net_dev = priv->net_dev;
 	enum dma_data_direction dma_dir;
+	struct dpaa_eth_swbp *swbp;
 	unsigned char *buff_start;
-	struct sk_buff **skbh;
 	dma_addr_t addr;
 	int err;
 
@@ -1891,8 +1893,8 @@ static int skb_to_contig_fd(struct dpaa_priv *priv,
 	buff_start = skb->data - priv->tx_headroom;
 	dma_dir = DMA_TO_DEVICE;
 
-	skbh = (struct sk_buff **)buff_start;
-	*skbh = skb;
+	swbp = (struct dpaa_eth_swbp *)buff_start;
+	swbp->skb = skb;
 
 	/* Enable L3/L4 hardware checksum computation.
 	 *
@@ -1931,8 +1933,8 @@ static int skb_to_sg_fd(struct dpaa_priv *priv,
 	const enum dma_data_direction dma_dir = DMA_TO_DEVICE;
 	const int nr_frags = skb_shinfo(skb)->nr_frags;
 	struct net_device *net_dev = priv->net_dev;
+	struct dpaa_eth_swbp *swbp;
 	struct qm_sg_entry *sgt;
-	struct sk_buff **skbh;
 	void *buff_start;
 	skb_frag_t *frag;
 	dma_addr_t addr;
@@ -2005,8 +2007,8 @@ static int skb_to_sg_fd(struct dpaa_priv *priv,
 	qm_fd_set_sg(fd, priv->tx_headroom, skb->len);
 
 	/* DMA map the SGT page */
-	skbh = (struct sk_buff **)buff_start;
-	*skbh = skb;
+	swbp = (struct dpaa_eth_swbp *)buff_start;
+	swbp->skb = skb;
 
 	addr = dma_map_page(priv->tx_dma_dev, p, 0,
 			    priv->tx_headroom + DPAA_SGT_SIZE, dma_dir);
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
index fc2cc4c..da30e5d 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
@@ -144,6 +144,14 @@ struct dpaa_buffer_layout {
 	u16 priv_data_size;
 };
 
+/* Information to be used on the Tx confirmation path. Stored just
+ * before the start of the transmit buffer. Maximum size allowed
+ * is DPAA_TX_PRIV_DATA_SIZE bytes.
+ */
+struct dpaa_eth_swbp {
+	struct sk_buff *skb;
+};
+
 struct dpaa_priv {
 	struct dpaa_percpu_priv __percpu *percpu_priv;
 	struct dpaa_bp *dpaa_bp;
-- 
1.9.1


  reply	other threads:[~2020-11-23 17:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-23 17:36 [PATCH net-next v4 0/7] dpaa_eth: add XDP support Camelia Groza
2020-11-23 17:36 ` Camelia Groza [this message]
2020-11-23 17:36 ` [PATCH net-next v4 2/7] dpaa_eth: add basic " Camelia Groza
2020-11-24 13:51   ` Maciej Fijalkowski
2020-11-24 16:11     ` Camelia Alexandra Groza
2020-11-23 17:36 ` [PATCH net-next v4 3/7] dpaa_eth: limit the possible MTU range when XDP is enabled Camelia Groza
2020-11-24 19:11   ` Maciej Fijalkowski
2020-11-25 15:47     ` Camelia Alexandra Groza
2020-11-23 17:36 ` [PATCH net-next v4 4/7] dpaa_eth: add XDP_TX support Camelia Groza
2020-11-24 19:52   ` Maciej Fijalkowski
2020-11-25 15:49     ` Camelia Alexandra Groza
2020-11-27 14:29       ` Maciej Fijalkowski
2020-11-27 16:33         ` Camelia Alexandra Groza
2020-11-23 17:36 ` [PATCH net-next v4 5/7] dpaa_eth: add XDP_REDIRECT support Camelia Groza
2020-11-24 20:07   ` Maciej Fijalkowski
2020-11-23 17:36 ` [PATCH net-next v4 6/7] dpaa_eth: rename current skb A050385 erratum workaround Camelia Groza
2020-11-23 17:36 ` [PATCH net-next v4 7/7] dpaa_eth: implement the A050385 erratum workaround for XDP Camelia Groza
2020-11-24 20:50   ` Maciej Fijalkowski
2020-11-25 15:52     ` Camelia Alexandra Groza
2020-11-27 14:44       ` Maciej Fijalkowski
2020-11-27 17:35         ` Camelia Alexandra Groza
2020-11-28 23:02           ` Maciej Fijalkowski

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=f4e21424c6747502b1824fa41f67b0bc47732a33.1606150838.git.camelia.groza@nxp.com \
    --to=camelia.groza@nxp.com \
    --cc=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=ioana.ciornei@nxp.com \
    --cc=kuba@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=madalin.bucur@oss.nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeed@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.