Skip to contentSkip to conversation

net: wan: Use dma_pool_zalloc

PATCH Souptick Joarder 2 participants 7 messages Dec 12, 2016 – Dec 17, 2016 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#2 lore raw
In reply to a message not in the archive
Quoted 17 lines · Krzysztof Hałasa
Quoted 15 lines · Souptick Joarder

We should use dma_pool_zalloc instead of dma_pool_alloc/memset

---
 drivers/net/wan/ixp4xx_hss.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wan/ixp4xx_hss.c +0 -0
index e7bbdb7..aaabf31 100644
@@ -976,10 +976,9 @@ static int init_hdlc_queues(struct port *port)
                      return -ENOMEM;
      }
 
Quoted 11 lines

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

Quoted 8 lines
drivers/net/wan/ixp4xx_hss.c +2 -3
-     if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL,
-                                           &port->desc_tab_phys)))
+     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));

This look fine, feel free to send it to the netdev mailing list for inclusion.

Including netdev mailing list based as requested.

Quoted 7 lines

--
Krzysztof Halasa

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

#3 lore raw
Quoted 30 lines · Souptick Joarder
Quoted 17 lines · Krzysztof Hałasa
Quoted 15 lines · Souptick Joarder

We should use dma_pool_zalloc instead of dma_pool_alloc/memset

---
 drivers/net/wan/ixp4xx_hss.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wan/ixp4xx_hss.c +0 -0
index e7bbdb7..aaabf31 100644
@@ -976,10 +976,9 @@ static int init_hdlc_queues(struct port *port)
                      return -ENOMEM;
      }
 
Quoted 11 lines

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

Quoted 8 lines
drivers/net/wan/ixp4xx_hss.c +2 -3
-     if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL,
-                                           &port->desc_tab_phys)))
+     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));

This look fine, feel free to send it to the netdev mailing list for inclusion.

Quoted 9 lines

Including netdev mailing list based as requested.

Quoted 7 lines

--
Krzysztof Halasa

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

Any comment on this patch ?

#4 lore raw
Quoted 5 lines · Souptick Joarder
Quoted 4 lines · Souptick Joarder
Quoted 3 lines · Krzysztof Hałasa
Quoted 1 line · Souptick Joarder

We should use dma_pool_zalloc instead of dma_pool_alloc/memset

[]

Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/net/wan/ixp4xx_hss.c

Quoted 1 line
drivers/net/wan/ixp4xx_hss.c +0 -0

[]

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines

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

Quoted 12 lines
drivers/net/wan/ixp4xx_hss.c +2 -3
@@ -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,
-                                           &port->desc_tab_phys)))
+     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));

This look fine, feel free to send it to the netdev mailing list for inclusion.

Quoted 2 lines
Quoted 2 lines

Including netdev mailing list based as requested.

Quoted 1 line

[]

Quoted 1 line

Any comment on this patch ?

Shouldn't the one in drivers/net/ethernet/xscale/ixp4xx_eth.c also be changed?

#6 lore raw
In reply to Souptick Joarder
Quoted 31 lines · Souptick Joarder
Quoted 30 lines · Joe Perches
Quoted 5 lines · Souptick Joarder
Quoted 4 lines · Souptick Joarder
Quoted 3 lines · Krzysztof Hałasa
Quoted 1 line · Souptick Joarder

We should use dma_pool_zalloc instead of dma_pool_alloc/memset

[]

Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/net/wan/ixp4xx_hss.c

Quoted 1 line
drivers/net/wan/ixp4xx_hss.c +0 -0

[]

Quoted 18 lines
Quoted 18 lines
Quoted 4 lines
Quoted 4 lines
drivers/net/wan/ixp4xx_hss.c +0 -0
@@ -976,10 +976,9 @@ static int init_hdlc_queues(struct port *port)
                      return -ENOMEM;
      }
 
Quoted 11 lines

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

Quoted 8 lines
drivers/net/wan/ixp4xx_hss.c +2 -3
-     if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL,
-                                           &port->desc_tab_phys)))
+     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));

This look fine, feel free to send it to the netdev mailing list for inclusion.

Including netdev mailing list based as requested.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

[]

Quoted 1 line

Any comment on this patch ?

Shouldn't the one in drivers/net/ethernet/xscale/ixp4xx_eth.c also be changed?

Yes, you are right. Do you want me to include it in same patch?

Your choice. I would use a single patch.

#5 lore raw
In reply to Joe Perches
Quoted 25 lines · Joe Perches
Quoted 5 lines · Souptick Joarder
Quoted 4 lines · Souptick Joarder
Quoted 3 lines · Krzysztof Hałasa
Quoted 1 line · Souptick Joarder

We should use dma_pool_zalloc instead of dma_pool_alloc/memset

[]

Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/net/wan/ixp4xx_hss.c

Quoted 1 line
drivers/net/wan/ixp4xx_hss.c +0 -0

[]

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines

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

Quoted 12 lines
drivers/net/wan/ixp4xx_hss.c +2 -3
@@ -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,
-                                           &port->desc_tab_phys)))
+     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));

This look fine, feel free to send it to the netdev mailing list for inclusion.

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Including netdev mailing list based as requested.

Quoted 1 line

[]

Quoted 1 line

Any comment on this patch ?

Shouldn't the one in drivers/net/ethernet/xscale/ixp4xx_eth.c also be changed?

Yes, you are right. Do you want me to include it in same patch?

Regards
Souptick

#7 lore raw
In reply to Joe Perches
Quoted 33 lines · Joe Perches
Quoted 32 lines · Souptick Joarder
Quoted 31 lines · Joe Perches
Quoted 5 lines · Souptick Joarder
Quoted 4 lines · Souptick Joarder
Quoted 3 lines · Krzysztof Hałasa
Quoted 1 line · Souptick Joarder

We should use dma_pool_zalloc instead of dma_pool_alloc/memset

[]

Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/net/wan/ixp4xx_hss.c

Quoted 1 line
drivers/net/wan/ixp4xx_hss.c +0 -0

[]

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines

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

Quoted 12 lines
drivers/net/wan/ixp4xx_hss.c +2 -3
@@ -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,
-                                           &port->desc_tab_phys)))
+     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));

This look fine, feel free to send it to the netdev mailing list for inclusion.

Quoted 2 lines
Quoted 2 lines

Including netdev mailing list based as requested.

Quoted 1 line

[]

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Any comment on this patch ?

Shouldn't the one in drivers/net/ethernet/xscale/ixp4xx_eth.c also be changed?

Yes, you are right. Do you want me to include it in same patch?

Your choice. I would use a single patch.

There are few other places where the same change is applicable. I am planning to put all those changes in a single patch. It includes changes in drivers/net/ethernet/xscale/ixp4xx_eth.c

You can review this patch separately.

Quoted 1 line
#8 lore raw
Quoted 41 lines · Souptick Joarder
Quoted 40 lines · Joe Perches
Quoted 38 lines · Souptick Joarder
Quoted 27 lines · Joe Perches
Quoted 5 lines · Souptick Joarder
Quoted 4 lines · Souptick Joarder
Quoted 3 lines · Krzysztof Hałasa
Quoted 1 line · Souptick Joarder

We should use dma_pool_zalloc instead of dma_pool_alloc/memset

[]

Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/net/wan/ixp4xx_hss.c

Quoted 1 line
drivers/net/wan/ixp4xx_hss.c +0 -0

[]

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines

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

Quoted 12 lines
drivers/net/wan/ixp4xx_hss.c +2 -3
@@ -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,
-                                           &port->desc_tab_phys)))
+     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));

This look fine, feel free to send it to the netdev mailing list for inclusion.

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

Including netdev mailing list based as requested.

Quoted 1 line

[]

Quoted 1 line

Any comment on this patch ?

Shouldn't the one in drivers/net/ethernet/xscale/ixp4xx_eth.c also be changed?

Yes, you are right. Do you want me to include it in same patch?

Quoted 7 lines
Quoted 1 line

Your choice. I would use a single patch.

There are few other places where the same change is applicable. I am planning to put all those changes in a single patch. It includes changes in drivers/net/ethernet/xscale/ixp4xx_eth.c

You can review this patch separately.

If you are spanning multiple drivers maintained by different groups, it's probably better to create a patch series, one for each driver, to allow the various maintainers to apply the patches to their individually maintained drivers.

Joe