get rid of unnecessary memset's
Subsystems (2)
cover get rid of unnecessary memset's
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(-)
Signature · 1 line
2.1.4
PATCH 1/3 bonding: remove useless memset
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
--- drivers/net/bonding/rte_eth_bond_api.c | 1 - drivers/net/bonding/rte_eth_bond_pmd.c | 4 ---- 2 files changed, 5 deletions(-)
drivers/net/bonding/rte_eth_bond_api.c +0 -1
@@ -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 ) {
drivers/net/bonding/rte_eth_bond_pmd.c +0 -4
@@ -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);
Signature · 1 line
2.1.4
PATCH 2/3 ethdev: remove useless memset
In reply to Stephen Hemmingereth_stats is already cleared by rte_eth_stats_get
--- lib/librte_ether/rte_ethdev.c | 1 - 1 file changed, 1 deletion(-)
lib/librte_ether/rte_ethdev.c +0 -1
@@ -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 (ð_stats,0 ,sizeof (eth_stats));rte_eth_stats_get (port_id, ð_stats);/* global stats */
Signature · 1 line
2.1.4
PATCH 3/3 null: remove unnecessary memset
In reply to Stephen HemmingerThe stats area is already cleared before calling eth_stats_get().
--- drivers/net/null/rte_eth_null.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/null/rte_eth_null.c +0 -1
@@ -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)));
Signature · 1 line
2.1.4
2015-06-03 14:13, Stephen Hemminger:
Quoted 7 lines
While looking at code is seems lots of drivers do not know the convention that
info_getandstats_getboth clear the buffer for the caller.Stephen Hemminger (3):
bonding: remove useless memset
ethdev: remove useless memset
null: remove unnecessary memset
Applied, thanks