Skip to contentSkip to conversation

net: Use dma_pool_zalloc()

PATCH Souptick Joarder 2 participants 3 messages Mar 6, 2018 – Mar 8, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Any comment for this patch.

Quoted 43 lines · Souptick Joarder

Use dma_pool_zalloc() instead of dma_pool_alloc + memset

---
 drivers/net/ethernet/xscale/ixp4xx_eth.c | 3 +--
 drivers/net/wan/ixp4xx_hss.c             | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/xscale/ixp4xx_eth.c +1 -2
index aee55c0..5710ae8 100644
@@ -1108,10 +1108,9 @@ static int init_queues(struct port *port)
                        return -ENOMEM;
        }
 
-       if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL,
+       if (!(port->desc_tab = dma_pool_zalloc(dma_pool, GFP_KERNEL,
                                              &port->desc_tab_phys)))
                return -ENOMEM;
-       memset(port->desc_tab, 0, POOL_ALLOC_SIZE);
        memset(port->rx_buff_tab, 0, sizeof(port->rx_buff_tab)); /* tables */
        memset(port->tx_buff_tab, 0, sizeof(port->tx_buff_tab));
 
drivers/net/wan/ixp4xx_hss.c +1 -3
index 6a505c2..0caffbf 100644
@@ -976,10 +976,9 @@ static int init_hdlc_queues(struct port *port)
                        return -ENOMEM;
        }
 
-       if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL,
+       if (!(port->desc_tab = dma_pool_zalloc(dma_pool, GFP_KERNEL,
                                              &port->desc_tab_phys)))
                return -ENOMEM;
-       memset(port->desc_tab, 0, POOL_ALLOC_SIZE);
        memset(port->rx_buff_tab, 0, sizeof(port->rx_buff_tab)); /* tables */
        memset(port->tx_buff_tab, 0, sizeof(port->tx_buff_tab));
 
--

1.9.1

#2 lore raw
Quoted 1 line · Souptick Joarder

Any comment for this patch.

I thought something like this was already aplied.

Quoted 41 lines · Souptick Joarder
Quoted 40 lines

Use dma_pool_zalloc() instead of dma_pool_alloc + memset

---
 drivers/net/ethernet/xscale/ixp4xx_eth.c | 3 +--
 drivers/net/wan/ixp4xx_hss.c             | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/xscale/ixp4xx_eth.c +1 -2
index aee55c0..5710ae8 100644
@@ -1108,10 +1108,9 @@ static int init_queues(struct port *port)
                        return -ENOMEM;
        }
 
-       if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL,
+       if (!(port->desc_tab = dma_pool_zalloc(dma_pool, GFP_KERNEL,
                                              &port->desc_tab_phys)))
                return -ENOMEM;
-       memset(port->desc_tab, 0, POOL_ALLOC_SIZE);
        memset(port->rx_buff_tab, 0, sizeof(port->rx_buff_tab)); /* tables */
        memset(port->tx_buff_tab, 0, sizeof(port->tx_buff_tab));
 
drivers/net/wan/ixp4xx_hss.c +1 -2
index 6a505c2..0caffbf 100644
@@ -976,10 +976,9 @@ static int init_hdlc_queues(struct port *port)
                        return -ENOMEM;
        }
 
-       if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL,
+       if (!(port->desc_tab = dma_pool_zalloc(dma_pool, GFP_KERNEL,
                                              &port->desc_tab_phys)))
                return -ENOMEM;
-       memset(port->desc_tab, 0, POOL_ALLOC_SIZE);
        memset(port->rx_buff_tab, 0, sizeof(port->rx_buff_tab)); /* tables */
        memset(port->tx_buff_tab, 0, sizeof(port->tx_buff_tab));
 
Signature · 4 lines
Krzysztof Halasa

Industrial Research Institute for Automation and Measurements PIAP
Al. Jerozolimskie 202, 02-486 Warsaw, Poland
#3 lore raw
Quoted 5 lines · Krzysztof Hałasa
Quoted 1 line · Souptick Joarder

Any comment for this patch.

I thought something like this was already aplied.

I am not seeing anything similar till 4.16-rc4.
Is it going to merge in netdev git ?

Quoted 48 lines
Quoted 33 lines · Souptick Joarder
Quoted 32 lines

Use dma_pool_zalloc() instead of dma_pool_alloc + memset

---
 drivers/net/ethernet/xscale/ixp4xx_eth.c | 3 +--
 drivers/net/wan/ixp4xx_hss.c             | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/xscale/ixp4xx_eth.c +1 -2
index aee55c0..5710ae8 100644
@@ -1108,10 +1108,9 @@ static int init_queues(struct port *port)
                        return -ENOMEM;
        }
 
-       if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL,
+       if (!(port->desc_tab = dma_pool_zalloc(dma_pool, GFP_KERNEL,
                                              &port->desc_tab_phys)))
                return -ENOMEM;
-       memset(port->desc_tab, 0, POOL_ALLOC_SIZE);
        memset(port->rx_buff_tab, 0, sizeof(port->rx_buff_tab)); /* tables */
        memset(port->tx_buff_tab, 0, sizeof(port->tx_buff_tab));
 
drivers/net/wan/ixp4xx_hss.c +0 -0
index 6a505c2..0caffbf 100644
@@ -976,10 +976,9 @@ static int init_hdlc_queues(struct port *port)
                        return -ENOMEM;
        }
 
Quoted 8 lines

drivers/net/wan/ixp4xx_hss.c static int init_hdlc_queues(struct port *port) · line 984

Quoted 8 lines
drivers/net/wan/ixp4xx_hss.c +1 -2
-       if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL,
+       if (!(port->desc_tab = dma_pool_zalloc(dma_pool, GFP_KERNEL,
                                              &port->desc_tab_phys)))
                return -ENOMEM;
-       memset(port->desc_tab, 0, POOL_ALLOC_SIZE);
        memset(port->rx_buff_tab, 0, sizeof(port->rx_buff_tab)); /* tables */
        memset(port->tx_buff_tab, 0, sizeof(port->tx_buff_tab));
 

--
Krzysztof Halasa

Quoted 2 lines

Industrial Research Institute for Automation and Measurements PIAP Al. Jerozolimskie 202, 02-486 Warsaw, Poland

-Souptick