dpaa_eth: add struct for software backpointers

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>
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Camelia Groza 2020-11-25 18:53:30 +02:00 committed by Jakub Kicinski
parent e71d2b957e
commit fb9afd961c
2 changed files with 17 additions and 7 deletions

View File

@ -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);

View File

@ -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;