DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/3] get rid of unnecessary memset's
@ 2015-06-03 21:13 Stephen Hemminger
  2015-06-03 21:13 ` [dpdk-dev] [PATCH 1/3] bonding: remove useless memset Stephen Hemminger
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Stephen Hemminger @ 2015-06-03 21:13 UTC (permalink / raw)
  To: dev

While looking at code is seems lots of drivers do not know the convention
that info_get and stats_get both clear the buffer for the caller.

Stephen Hemminger (3):
  bonding: remove useless memset
  ethdev: remove useless memset
  null: remove unnecessary memset

 drivers/net/bonding/rte_eth_bond_api.c | 1 -
 drivers/net/bonding/rte_eth_bond_pmd.c | 4 ----
 drivers/net/null/rte_eth_null.c        | 1 -
 lib/librte_ether/rte_ethdev.c          | 1 -
 4 files changed, 7 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 1/3] bonding: remove useless memset
  2015-06-03 21:13 [dpdk-dev] [PATCH 0/3] get rid of unnecessary memset's Stephen Hemminger
@ 2015-06-03 21:13 ` Stephen Hemminger
  2015-06-03 21:13 ` [dpdk-dev] [PATCH 2/3] ethdev: " Stephen Hemminger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2015-06-03 21:13 UTC (permalink / raw)
  To: dev

Remove 2 unneeded memset's.  The info area is already cleared rte_eth_dev_info_get
and the statistics buffer is cleared by rte_eth_stats_get

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bonding/rte_eth_bond_api.c | 1 -
 drivers/net/bonding/rte_eth_bond_pmd.c | 4 ----
 2 files changed, 5 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index e91a623..d4caa83 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -363,7 +363,6 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
 	/* Add slave details to bonded device */
 	slave_add(internals, slave_eth_dev);
 
-	memset(&dev_info, 0, sizeof(dev_info));
 	rte_eth_dev_info_get(slave_port_id, &dev_info);
 
 	if (internals->slave_count < 1) {
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index c937e6b..8bad2e1 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1730,12 +1730,8 @@ bond_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 {
 	struct bond_dev_private *internals = dev->data->dev_private;
 	struct rte_eth_stats slave_stats;
-
 	int i;
 
-	/* clear bonded stats before populating from slaves */
-	memset(stats, 0, sizeof(*stats));
-
 	for (i = 0; i < internals->slave_count; i++) {
 		rte_eth_stats_get(internals->slaves[i].port_id, &slave_stats);
 
-- 
2.1.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 2/3] ethdev: remove useless memset
  2015-06-03 21:13 [dpdk-dev] [PATCH 0/3] get rid of unnecessary memset's Stephen Hemminger
  2015-06-03 21:13 ` [dpdk-dev] [PATCH 1/3] bonding: remove useless memset Stephen Hemminger
@ 2015-06-03 21:13 ` Stephen Hemminger
  2015-06-03 21:13 ` [dpdk-dev] [PATCH 3/3] null: remove unnecessary memset Stephen Hemminger
  2015-06-04  8:47 ` [dpdk-dev] [PATCH 0/3] get rid of unnecessary memset's Thomas Monjalon
  3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2015-06-03 21:13 UTC (permalink / raw)
  To: dev

eth_stats is already cleared by rte_eth_stats_get

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_ether/rte_ethdev.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 024fe8b..5a94654 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1766,7 +1766,6 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats,
 	/* now fill the xstats structure */
 
 	count = 0;
-	memset(&eth_stats, 0, sizeof(eth_stats));
 	rte_eth_stats_get(port_id, &eth_stats);
 
 	/* global stats */
-- 
2.1.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 3/3] null: remove unnecessary memset
  2015-06-03 21:13 [dpdk-dev] [PATCH 0/3] get rid of unnecessary memset's Stephen Hemminger
  2015-06-03 21:13 ` [dpdk-dev] [PATCH 1/3] bonding: remove useless memset Stephen Hemminger
  2015-06-03 21:13 ` [dpdk-dev] [PATCH 2/3] ethdev: " Stephen Hemminger
@ 2015-06-03 21:13 ` Stephen Hemminger
  2015-06-04  8:47 ` [dpdk-dev] [PATCH 0/3] get rid of unnecessary memset's Thomas Monjalon
  3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2015-06-03 21:13 UTC (permalink / raw)
  To: dev

The stats area is already cleared before calling eth_stats_get().

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/null/rte_eth_null.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 7792315..e244595 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -296,7 +296,6 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats)
 		return;
 
 	internal = dev->data->dev_private;
-	memset(igb_stats, 0, sizeof(*igb_stats));
 	num_stats = RTE_MIN((unsigned)RTE_ETHDEV_QUEUE_STAT_CNTRS,
 			RTE_MIN(internal->nb_rx_queues,
 				RTE_DIM(internal->rx_null_queues)));
-- 
2.1.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 0/3] get rid of unnecessary memset's
  2015-06-03 21:13 [dpdk-dev] [PATCH 0/3] get rid of unnecessary memset's Stephen Hemminger
                   ` (2 preceding siblings ...)
  2015-06-03 21:13 ` [dpdk-dev] [PATCH 3/3] null: remove unnecessary memset Stephen Hemminger
@ 2015-06-04  8:47 ` Thomas Monjalon
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2015-06-04  8:47 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

2015-06-03 14:13, Stephen Hemminger:
> While looking at code is seems lots of drivers do not know the convention
> that info_get and stats_get both clear the buffer for the caller.
> 
> Stephen Hemminger (3):
>   bonding: remove useless memset
>   ethdev: remove useless memset
>   null: remove unnecessary memset

Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-06-04  8:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-03 21:13 [dpdk-dev] [PATCH 0/3] get rid of unnecessary memset's Stephen Hemminger
2015-06-03 21:13 ` [dpdk-dev] [PATCH 1/3] bonding: remove useless memset Stephen Hemminger
2015-06-03 21:13 ` [dpdk-dev] [PATCH 2/3] ethdev: " Stephen Hemminger
2015-06-03 21:13 ` [dpdk-dev] [PATCH 3/3] null: remove unnecessary memset Stephen Hemminger
2015-06-04  8:47 ` [dpdk-dev] [PATCH 0/3] get rid of unnecessary memset's Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).