lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 15 Apr 2021 12:17:13 +1000
From:   Stephen Rothwell <sfr@...b.auug.org.au>
To:     David Miller <davem@...emloft.net>,
        Networking <netdev@...r.kernel.org>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux Next Mailing List <linux-next@...r.kernel.org>,
        Ong Boon Leong <boon.leong.ong@...el.com>,
        Thierry Reding <treding@...dia.com>
Subject: linux-next: manual merge of the net-next tree with the net tree

Hi all,

Today's linux-next merge of the net-next tree got a conflict in:

  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

between commit:

  00423969d806 ("Revert "net: stmmac: re-init rx buffers when mac resume back"")

from the net tree and commits:

  bba2556efad6 ("net: stmmac: Enable RX via AF_XDP zero-copy")
  de0b90e52a11 ("net: stmmac: rearrange RX and TX desc init into per-queue basis")

from the net-next tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 4749bd0af160,3a5ca5833ce1..000000000000
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@@ -1380,8 -1519,182 +1519,131 @@@ static void stmmac_free_tx_buffer(struc
  }
  
  /**
-  * init_dma_rx_desc_rings - init the RX descriptor rings
-  * @dev: net device structure
+  * dma_free_rx_skbufs - free RX dma buffers
+  * @priv: private structure
+  * @queue: RX queue index
+  */
+ static void dma_free_rx_skbufs(struct stmmac_priv *priv, u32 queue)
+ {
+ 	int i;
+ 
+ 	for (i = 0; i < priv->dma_rx_size; i++)
+ 		stmmac_free_rx_buffer(priv, queue, i);
+ }
+ 
+ static int stmmac_alloc_rx_buffers(struct stmmac_priv *priv, u32 queue,
+ 				   gfp_t flags)
+ {
+ 	struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
+ 	int i;
+ 
+ 	for (i = 0; i < priv->dma_rx_size; i++) {
+ 		struct dma_desc *p;
+ 		int ret;
+ 
+ 		if (priv->extend_desc)
+ 			p = &((rx_q->dma_erx + i)->basic);
+ 		else
+ 			p = rx_q->dma_rx + i;
+ 
+ 		ret = stmmac_init_rx_buffers(priv, p, i, flags,
+ 					     queue);
+ 		if (ret)
+ 			return ret;
+ 
+ 		rx_q->buf_alloc_num++;
+ 	}
+ 
+ 	return 0;
+ }
+ 
+ /**
+  * dma_recycle_rx_skbufs - recycle RX dma buffers
+  * @priv: private structure
+  * @queue: RX queue index
+  */
+ static void dma_recycle_rx_skbufs(struct stmmac_priv *priv, u32 queue)
+ {
+ 	struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
+ 	int i;
+ 
+ 	for (i = 0; i < priv->dma_rx_size; i++) {
+ 		struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i];
+ 
+ 		if (buf->page) {
+ 			page_pool_recycle_direct(rx_q->page_pool, buf->page);
+ 			buf->page = NULL;
+ 		}
+ 
+ 		if (priv->sph && buf->sec_page) {
+ 			page_pool_recycle_direct(rx_q->page_pool, buf->sec_page);
+ 			buf->sec_page = NULL;
+ 		}
+ 	}
+ }
+ 
+ /**
+  * dma_free_rx_xskbufs - free RX dma buffers from XSK pool
+  * @priv: private structure
+  * @queue: RX queue index
+  */
+ static void dma_free_rx_xskbufs(struct stmmac_priv *priv, u32 queue)
+ {
+ 	struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
+ 	int i;
+ 
+ 	for (i = 0; i < priv->dma_rx_size; i++) {
+ 		struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i];
+ 
+ 		if (!buf->xdp)
+ 			continue;
+ 
+ 		xsk_buff_free(buf->xdp);
+ 		buf->xdp = NULL;
+ 	}
+ }
+ 
+ static int stmmac_alloc_rx_buffers_zc(struct stmmac_priv *priv, u32 queue)
+ {
+ 	struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
+ 	int i;
+ 
+ 	for (i = 0; i < priv->dma_rx_size; i++) {
+ 		struct stmmac_rx_buffer *buf;
+ 		dma_addr_t dma_addr;
+ 		struct dma_desc *p;
+ 
+ 		if (priv->extend_desc)
+ 			p = (struct dma_desc *)(rx_q->dma_erx + i);
+ 		else
+ 			p = rx_q->dma_rx + i;
+ 
+ 		buf = &rx_q->buf_pool[i];
+ 
+ 		buf->xdp = xsk_buff_alloc(rx_q->xsk_pool);
+ 		if (!buf->xdp)
+ 			return -ENOMEM;
+ 
+ 		dma_addr = xsk_buff_xdp_get_dma(buf->xdp);
+ 		stmmac_set_desc_addr(priv, p, dma_addr);
+ 		rx_q->buf_alloc_num++;
+ 	}
+ 
+ 	return 0;
+ }
+ 
 -/**
 - * stmmac_reinit_rx_buffers - reinit the RX descriptor buffer.
 - * @priv: driver private structure
 - * Description: this function is called to re-allocate a receive buffer, perform
 - * the DMA mapping and init the descriptor.
 - */
 -static void stmmac_reinit_rx_buffers(struct stmmac_priv *priv)
 -{
 -	u32 rx_count = priv->plat->rx_queues_to_use;
 -	u32 queue;
 -
 -	for (queue = 0; queue < rx_count; queue++) {
 -		struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
 -
 -		if (rx_q->xsk_pool)
 -			dma_free_rx_xskbufs(priv, queue);
 -		else
 -			dma_recycle_rx_skbufs(priv, queue);
 -
 -		rx_q->buf_alloc_num = 0;
 -	}
 -
 -	for (queue = 0; queue < rx_count; queue++) {
 -		struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
 -		int ret;
 -
 -		if (rx_q->xsk_pool) {
 -			/* RX XDP ZC buffer pool may not be populated, e.g.
 -			 * xdpsock TX-only.
 -			 */
 -			stmmac_alloc_rx_buffers_zc(priv, queue);
 -		} else {
 -			ret = stmmac_alloc_rx_buffers(priv, queue, GFP_KERNEL);
 -			if (ret < 0)
 -				goto err_reinit_rx_buffers;
 -		}
 -	}
 -
 -	return;
 -
 -err_reinit_rx_buffers:
 -	while (queue >= 0) {
 -		dma_free_rx_skbufs(priv, queue);
 -
 -		if (queue == 0)
 -			break;
 -
 -		queue--;
 -	}
 -}
 -
+ static struct xsk_buff_pool *stmmac_get_xsk_pool(struct stmmac_priv *priv, u32 queue)
+ {
+ 	if (!stmmac_xdp_is_enabled(priv) || !test_bit(queue, priv->af_xdp_zc_qps))
+ 		return NULL;
+ 
+ 	return xsk_get_pool_from_qid(priv->dev, queue);
+ }
+ 
+ /**
+  * __init_dma_rx_desc_rings - init the RX descriptor ring (per queue)
+  * @priv: driver private structure
+  * @queue: RX queue index
   * @flags: gfp flag.
   * Description: this function initializes the DMA RX descriptors
   * and allocates the socket buffers. It supports the chained and ring

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ