Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1195497

Re: [PATCH 2/2] net: netcp: Allocate RX packet buffers using __GFP_DMA

From Eric Dumazet <eric.dumazet@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] net: netcp: Allocate RX packet buffers using __GFP_DMA
Date 2015-07-29 23:10 +0200
Message-ID <pRGLU-2Uj-5@gated-at.bofh.it> (permalink)
References <pRBjb-3qg-1@gated-at.bofh.it> <pRBjb-3qg-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 2015-07-29 at 11:10 -0400, WingMan Kwok wrote:
> The Keystone II DMA hardware can only access addresses in the
> lower 2 GiB of SDRAM. This patch makes sure the RX buffers are
> allocated using the __GFP_DMA flag so they meet this requirement.
> 
> Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
> Signed-off-by: Reece R. Pollack <x0183204@ti.com>
> ---
>  drivers/net/ethernet/ti/netcp_core.c |   11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)

Following patch gets rid of netdev_alloc_frag() which is not GFP_DMA
ready (and wont be)

diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index 3ca87f26582a..0971c46d6cd5 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -808,14 +808,8 @@ static void netcp_allocate_rx_buf(struct netcp_intf *netcp, int fdq)
 		primary_buf_len = SKB_DATA_ALIGN(buf_len) +
 				SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
 
-		if (primary_buf_len <= PAGE_SIZE) {
-			bufptr = netdev_alloc_frag(primary_buf_len);
-			pad[1] = primary_buf_len;
-		} else {
-			bufptr = kmalloc(primary_buf_len, GFP_ATOMIC |
-					 GFP_DMA32 | __GFP_COLD);
-			pad[1] = 0;
-		}
+		bufptr = kmalloc(primary_buf_len, GFP_ATOMIC | GFP_DMA);
+		pad[1] = 0;
 
 		if (unlikely(!bufptr)) {
 			dev_warn_ratelimited(netcp->ndev_dev, "Primary RX buffer alloc failed\n");
@@ -827,7 +821,7 @@ static void netcp_allocate_rx_buf(struct netcp_intf *netcp, int fdq)
 
 	} else {
 		/* Allocate a secondary receive queue entry */
-		page = alloc_page(GFP_ATOMIC | GFP_DMA32 | __GFP_COLD);
+		page = alloc_page(GFP_ATOMIC | GFP_DMA | __GFP_COLD);
 		if (unlikely(!page)) {
 			dev_warn_ratelimited(netcp->ndev_dev, "Secondary page alloc failed\n");
 			goto fail;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH 2/2] net: netcp: Allocate RX packet buffers using  __GFP_DMA Eric Dumazet <eric.dumazet@gmail.com> - 2015-07-29 23:10 +0200

csiph-web