DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/5] Various patches to 1.6.0r2
@ 2014-05-02 23:42 Stephen Hemminger
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 1/5] spelling fixes Stephen Hemminger
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Stephen Hemminger @ 2014-05-02 23:42 UTC (permalink / raw)
  To: dev

These are updated versions of some of the earlier patches I sent.
Plus some more changes that are helpful when interacting with
mempool/zone etc.

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

* [dpdk-dev] [PATCH 1/5] spelling fixes
  2014-05-02 23:42 [dpdk-dev] [PATCH 0/5] Various patches to 1.6.0r2 Stephen Hemminger
@ 2014-05-02 23:42 ` Stephen Hemminger
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 2/5] dont inline string functions Stephen Hemminger
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Stephen Hemminger @ 2014-05-02 23:42 UTC (permalink / raw)
  To: dev

[-- Attachment #1: codespell.patch --]
[-- Type: text/plain, Size: 29445 bytes --]

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

---
 lib/librte_eal/bsdapp/eal/eal.c                               |    2 +-
 lib/librte_eal/bsdapp/eal/include/exec-env/rte_kni_common.h   |    2 +-
 lib/librte_eal/common/include/i686/arch/rte_atomic.h          |   10 +++++-----
 lib/librte_eal/common/include/rte_atomic.h                    |   10 +++++-----
 lib/librte_eal/common/include/rte_eal.h                       |    2 +-
 lib/librte_eal/common/include/rte_interrupts.h                |    2 +-
 lib/librte_eal/linuxapp/eal/eal.c                             |    2 +-
 lib/librte_eal/linuxapp/eal/eal_interrupts.c                  |    4 ++--
 lib/librte_eal/linuxapp/eal/eal_memory.c                      |    2 +-
 lib/librte_eal/linuxapp/eal/eal_xen_memory.c                  |    2 +-
 lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h |    2 +-
 lib/librte_eal/linuxapp/igb_uio/igb_uio.c                     |    2 +-
 lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_mbx.c           |    2 +-
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h                 |    2 +-
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c            |    2 +-
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ptp.c             |    2 +-
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c            |    4 ++--
 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h             |    2 +-
 lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c               |    2 +-
 lib/librte_kni/rte_kni.h                                      |    4 ++--
 lib/librte_mempool/rte_mempool.c                              |    4 ++--
 lib/librte_mempool/rte_mempool.h                              |    8 ++++----
 lib/librte_pmd_e1000/e1000/e1000_82571.c                      |    2 +-
 lib/librte_pmd_e1000/e1000/e1000_mbx.c                        |    4 ++--
 lib/librte_pmd_e1000/em_ethdev.c                              |    2 +-
 lib/librte_pmd_e1000/em_rxtx.c                                |    2 +-
 lib/librte_pmd_e1000/igb_ethdev.c                             |    2 +-
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_mbx.c                        |    4 ++--
 lib/librte_pmd_ixgbe/ixgbe_bypass.c                           |    6 +++---
 lib/librte_pmd_ixgbe/ixgbe_bypass_api.h                       |    4 ++--
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c                           |    2 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c                             |    2 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h                             |    4 ++--
 lib/librte_pmd_ring/rte_eth_ring.c                            |    2 +-
 lib/librte_pmd_virtio/virtio_rxtx.c                           |    2 +-
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c                         |    2 +-
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c                      |    2 +-
 lib/librte_ring/rte_ring.h                                    |    2 +-
 38 files changed, 59 insertions(+), 59 deletions(-)

--- a/lib/librte_eal/bsdapp/eal/eal.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/bsdapp/eal/eal.c	2014-05-02 16:31:11.279562742 -0700
@@ -782,7 +782,7 @@ int rte_eal_has_hugepages(void)
 	return !internal_config.no_hugetlbfs;
 }
 
-/* Abstraction for port I/0 privilage */
+/* Abstraction for port I/0 privilege */
 static int
 rte_eal_iopl_init(void)
 {
--- a/lib/librte_eal/bsdapp/eal/include/exec-env/rte_kni_common.h	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/bsdapp/eal/include/exec-env/rte_kni_common.h	2014-05-02 16:31:11.279562742 -0700
@@ -92,7 +92,7 @@ struct rte_kni_request {
 
 /*
  * Fifo struct mapped in a shared memory. It describes a circular buffer FIFO
- * Write and read should wrap arround. Fifo is empty when write == read
+ * Write and read should wrap around. Fifo is empty when write == read
  * Writing should never overwrite the read position
  */
 struct rte_kni_fifo {
--- a/lib/librte_eal/common/include/i686/arch/rte_atomic.h	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/common/include/i686/arch/rte_atomic.h	2014-05-02 16:31:11.279562742 -0700
@@ -216,7 +216,7 @@ rte_atomic64_add(rte_atomic64_t *v, int6
  * @param v
  *   A pointer to the atomic counter.
  * @param dec
- *   The value to be substracted from the counter.
+ *   The value to be subtracted from the counter.
  */
 static inline void
 rte_atomic64_sub(rte_atomic64_t *v, int64_t dec)
@@ -287,14 +287,14 @@ rte_atomic64_add_return(rte_atomic64_t *
  * Subtract a 64-bit value from an atomic counter and return the result.
  *
  * Atomically subtracts the 64-bit value (dec) from the atomic counter (v)
- * and returns the value of v after the substraction.
+ * and returns the value of v after the subtraction.
  *
  * @param v
  *   A pointer to the atomic counter.
  * @param dec
- *   The value to be substracted from the counter.
+ *   The value to be subtracted from the counter.
  * @return
- *   The value of v after the substraction.
+ *   The value of v after the subtraction.
  */
 static inline int64_t
 rte_atomic64_sub_return(rte_atomic64_t *v, int64_t dec)
@@ -336,7 +336,7 @@ static inline int rte_atomic64_inc_and_t
  * @param v
  *   A pointer to the atomic counter.
  * @return
- *   True if the result after substraction is 0; false otherwise.
+ *   True if the result after subtraction is 0; false otherwise.
  */
 static inline int rte_atomic64_dec_and_test(rte_atomic64_t *v)
 {
--- a/lib/librte_eal/common/include/rte_atomic.h	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/common/include/rte_atomic.h	2014-05-02 16:31:11.279562742 -0700
@@ -995,7 +995,7 @@ rte_atomic64_add(rte_atomic64_t *v, int6
  * @param v
  *   A pointer to the atomic counter.
  * @param dec
- *   The value to be substracted from the counter.
+ *   The value to be subtracted from the counter.
  */
 static inline void
 rte_atomic64_sub(rte_atomic64_t *v, int64_t dec)
@@ -1050,14 +1050,14 @@ rte_atomic64_add_return(rte_atomic64_t *
  * Subtract a 64-bit value from an atomic counter and return the result.
  *
  * Atomically subtracts the 64-bit value (dec) from the atomic counter (v)
- * and returns the value of v after the substraction.
+ * and returns the value of v after the subtraction.
  *
  * @param v
  *   A pointer to the atomic counter.
  * @param dec
- *   The value to be substracted from the counter.
+ *   The value to be subtracted from the counter.
  * @return
- *   The value of v after the substraction.
+ *   The value of v after the subtraction.
  */
 static inline int64_t
 rte_atomic64_sub_return(rte_atomic64_t *v, int64_t dec)
@@ -1090,7 +1090,7 @@ static inline int rte_atomic64_inc_and_t
  * @param v
  *   A pointer to the atomic counter.
  * @return
- *   True if the result after substraction is 0; false otherwise.
+ *   True if the result after subtraction is 0; false otherwise.
  */
 static inline int rte_atomic64_dec_and_test(rte_atomic64_t *v)
 {
--- a/lib/librte_eal/common/include/rte_eal.h	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/common/include/rte_eal.h	2014-05-02 16:31:11.279562742 -0700
@@ -93,7 +93,7 @@ struct rte_config {
 } __attribute__((__packed__));
 
 /* Flag definitions for rte_config flags */
-#define EAL_FLG_HIGH_IOPL 1 /**< indicates high IO privilage in a linux env */
+#define EAL_FLG_HIGH_IOPL 1 /**< indicates high IO privilege in a linux env */
 
 /**
  * Get the global configuration structure.
--- a/lib/librte_eal/common/include/rte_interrupts.h	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/common/include/rte_interrupts.h	2014-05-02 16:31:11.279562742 -0700
@@ -45,7 +45,7 @@
 extern "C" {
 #endif
 
-/** Interupt handle */
+/** Interrupt handle */
 struct rte_intr_handle;
 
 /** Function to be registered for the specific interrupt */
--- a/lib/librte_eal/linuxapp/eal/eal.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/linuxapp/eal/eal.c	2014-05-02 16:31:11.279562742 -0700
@@ -943,7 +943,7 @@ rte_eal_mcfg_complete(void)
 }
 
 /*
- * Request iopl priviledge for all RPL, returns 0 on success
+ * Request iopl privilege for all RPL, returns 0 on success
  */
 static int
 rte_eal_iopl_init(void)
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c	2014-05-02 16:31:11.279562742 -0700
@@ -276,7 +276,7 @@ rte_intr_enable(struct rte_intr_handle *
 	/* not used at this moment */
 	case RTE_INTR_HANDLE_ALARM:
 		return -1;
-	/* unkown handle type */
+	/* unknown handle type */
 	default:
 		RTE_LOG(ERR, EAL,
 			"Unknown handle type of fd %d\n",
@@ -308,7 +308,7 @@ rte_intr_disable(struct rte_intr_handle
 	/* not used at this moment */
 	case RTE_INTR_HANDLE_ALARM:
 		return -1;
-	/* unkown handle type */
+	/* unknown handle type */
 	default:
 		RTE_LOG(ERR, EAL,
 			"Unknown handle type of fd %d\n",
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c	2014-05-02 16:31:11.279562742 -0700
@@ -221,7 +221,7 @@ aslr_enabled(void)
 }
 
 /*
- * Try to mmap *size bytes in /dev/zero. If it is succesful, return the
+ * Try to mmap *size bytes in /dev/zero. If it is successful, return the
  * pointer to the mmap'd area and keep *size unmodified. Else, retry
  * with a smaller zone: decrease *size by hugepage_sz until it reaches
  * 0. In this case, return NULL. Note: this function returns an address
--- a/lib/librte_eal/linuxapp/eal/eal_xen_memory.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/linuxapp/eal/eal_xen_memory.c	2014-05-02 16:31:11.279562742 -0700
@@ -74,7 +74,7 @@ static int xen_fd = -1;
 static const char sys_dir_path[] = "/sys/kernel/mm/dom0-mm/memsize-mB";
 
 /*
- * Try to mmap *size bytes in /dev/zero. If it is succesful, return the
+ * Try to mmap *size bytes in /dev/zero. If it is successful, return the
  * pointer to the mmap'd area and keep *size unmodified. Else, retry
  * with a smaller zone: decrease *size by mem_size until it reaches
  * 0. In this case, return NULL. Note: this function returns an address
--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h	2014-05-02 16:31:11.279562742 -0700
@@ -92,7 +92,7 @@ struct rte_kni_request {
 
 /*
  * Fifo struct mapped in a shared memory. It describes a circular buffer FIFO
- * Write and read should wrap arround. Fifo is empty when write == read
+ * Write and read should wrap around. Fifo is empty when write == read
  * Writing should never overwrite the read position
  */
 struct rte_kni_fifo {
--- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c	2014-05-02 16:31:11.279562742 -0700
@@ -339,7 +339,7 @@ igbuio_dom0_mmap_phys(struct uio_info *i
 
 /**
  * This is uio device mmap method which will use igbuio mmap for Xen 
- * Dom0 enviroment.
+ * Dom0 environment.
  */
 static int
 igbuio_dom0_pci_mmap(struct uio_info *info, struct vm_area_struct *vma)
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_mbx.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_mbx.c	2014-05-02 16:31:11.279562742 -0700
@@ -60,7 +60,7 @@ static s32 e1000_null_mbx_transact(struc
  *  @size: Length of buffer
  *  @mbx_id: id of mailbox to read
  *
- *  returns SUCCESS if it successfuly read message from buffer
+ *  returns SUCCESS if it successfully read message from buffer
  **/
 s32 e1000_read_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
 {
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h	2014-05-02 16:31:11.279562742 -0700
@@ -92,7 +92,7 @@ struct igb_adapter;
 #define IGB_20K_ITR                      196
 #define IGB_70K_ITR                       56
 
-/* Interrupt modes, as used by the IntMode paramter */
+/* Interrupt modes, as used by the IntMode parameter */
 #define IGB_INT_MODE_LEGACY                0
 #define IGB_INT_MODE_MSI                   1
 #define IGB_INT_MODE_MSIX                  2
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c	2014-05-02 16:31:11.279562742 -0700
@@ -1007,7 +1007,7 @@ static void igb_set_interrupt_capability
 		/* start with one vector for every rx queue */
 		numvecs = adapter->num_rx_queues;
 
-		/* if tx handler is seperate add 1 for every tx queue */
+		/* if tx handler is separate add 1 for every tx queue */
 		if (!(adapter->flags & IGB_FLAG_QUEUE_PAIRS))
 			numvecs += adapter->num_tx_queues;
 
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ptp.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ptp.c	2014-05-02 16:31:11.283562765 -0700
@@ -46,7 +46,7 @@
  *
  * Neither the 82576 nor the 82580 offer registers wide enough to hold
  * nanoseconds time values for very long. For the 82580, SYSTIM always
- * counts nanoseconds, but the upper 24 bits are not availible. The
+ * counts nanoseconds, but the upper 24 bits are not available. The
  * frequency is adjusted by changing the 32 bit fractional nanoseconds
  * register, TIMINCA.
  *
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c	2014-05-02 16:31:11.283562765 -0700
@@ -180,7 +180,7 @@ void igb_vmdq_set_rx_mode(struct net_dev
 		} else {
 			/*
 			 * Write addresses to the MTA, if the attempt fails
-			 * then we should just turn on promiscous mode so
+			 * then we should just turn on promiscuous mode so
 			 * that we can at least receive multicast traffic
 			 */
 			if (igb_write_mc_addr_list(adapter->netdev) != 0)
@@ -190,7 +190,7 @@ void igb_vmdq_set_rx_mode(struct net_dev
 		/*
 		 * Write addresses to available RAR registers, if there is not
 		 * sufficient space to store all the addresses then enable
-		 * unicast promiscous mode
+		 * unicast promiscuous mode
 		 */
 		if (igb_write_vm_addr_list(dev) < 0)
 			vmolr |= E1000_VMOLR_UPE;
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h	2014-05-02 16:31:11.283562765 -0700
@@ -3618,7 +3618,7 @@ static inline u32 mmd_eee_cap_to_ethtool
  * mmd_eee_adv_to_ethtool_adv_t
  * @eee_adv: value of the MMD EEE Advertisement/Link Partner Ability registers
  *
- * A small helper function that translates the MMD EEE Advertisment (7.60)
+ * A small helper function that translates the MMD EEE Advertisement (7.60)
  * and MMD EEE Link Partner Ability (7.61) bits to ethtool advertisement
  * settings.
  */
--- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c	2014-05-02 16:31:11.283562765 -0700
@@ -224,7 +224,7 @@ dom0_memory_free(struct dom0_mm_data * m
 	if (num_block == 0)
 		return -1;
 
-	/* free memory and destory contiguous region in Xen*/
+	/* free memory and destroy contiguous region in Xen*/
 	for (i = 0; i< num_block; i++) {
 		vstart = mm_data->block_info[i].vir_addr;
 		if (vstart) {
--- a/lib/librte_kni/rte_kni.h	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_kni/rte_kni.h	2014-05-02 16:31:11.283562765 -0700
@@ -140,7 +140,7 @@ extern struct rte_kni *rte_kni_create(ui
  * context need to be stopped before calling this interface.
  *
  * @param kni
- *  The pointer to the context of an existant KNI interface.
+ *  The pointer to the context of an existent KNI interface.
  *
  * @return
  *  - 0 indicates success.
@@ -154,7 +154,7 @@ extern int rte_kni_release(struct rte_kn
  * Finally constructs the response mbuf and puts it back to the resp_q.
  *
  * @param kni
- *  The pointer to the context of an existant KNI interface.
+ *  The pointer to the context of an existent KNI interface.
  *
  * @return
  *  - 0 
--- a/lib/librte_mempool/rte_mempool.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_mempool/rte_mempool.c	2014-05-02 16:31:11.283562765 -0700
@@ -93,7 +93,7 @@ static unsigned get_gcd(unsigned a, unsi
 }
 
 /*
- * Depending on memory configuration, objects addresses are spreaded
+ * Depending on memory configuration, objects addresses are spread
  * between channels and ranks in RAM: the pool allocator will add
  * padding between objects. This function return the new size of the
  * object.
@@ -276,7 +276,7 @@ rte_mempool_calc_obj_size(uint32_t elt_s
 
 	/*
 	 * increase trailer to add padding between objects in order to
-	 * spread them accross memory channels/ranks
+	 * spread them across memory channels/ranks
 	 */
 	if ((flags & MEMPOOL_F_NO_SPREAD) == 0) {
 		unsigned new_size;
--- a/lib/librte_mempool/rte_mempool.h	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_mempool/rte_mempool.h	2014-05-02 16:31:11.283562765 -0700
@@ -474,7 +474,7 @@ typedef void (rte_mempool_ctor_t)(struct
  *   never be used. The access to the per-lcore table is of course
  *   faster than the multi-producer/consumer pool. The cache can be
  *   disabled if the cache_size argument is set to 0; it can be useful to
- *   avoid loosing objects in cache. Note that even if not used, the
+ *   avoid losing objects in cache. Note that even if not used, the
  *   memory space for cache is always reserved in a mempool structure,
  *   except if CONFIG_RTE_MEMPOOL_CACHE_MAX_SIZE is set to 0.
  * @param private_data_size
@@ -565,7 +565,7 @@ rte_mempool_create(const char *name, uns
  *   never be used. The access to the per-lcore table is of course
  *   faster than the multi-producer/consumer pool. The cache can be
  *   disabled if the cache_size argument is set to 0; it can be useful to
- *   avoid loosing objects in cache. Note that even if not used, the
+ *   avoid losing objects in cache. Note that even if not used, the
  *   memory space for cache is always reserved in a mempool structure,
  *   except if CONFIG_RTE_MEMPOOL_CACHE_MAX_SIZE is set to 0.
  * @param private_data_size
@@ -666,7 +666,7 @@ rte_mempool_xmem_create(const char *name
  *   never be used. The access to the per-lcore table is of course
  *   faster than the multi-producer/consumer pool. The cache can be
  *   disabled if the cache_size argument is set to 0; it can be useful to
- *   avoid loosing objects in cache. Note that even if not used, the
+ *   avoid losing objects in cache. Note that even if not used, the
  *   memory space for cache is always reserved in a mempool structure,
  *   except if CONFIG_RTE_MEMPOOL_CACHE_MAX_SIZE is set to 0.
  * @param private_data_size
@@ -1332,7 +1332,7 @@ uint32_t rte_mempool_calc_obj_size(uint3
 
 /**
  * Calculate maximum amount of memory required to store given number of objects.
- * Assumes that the memory buffer will be alligned at page boundary.
+ * Assumes that the memory buffer will be aligned at page boundary.
  * Note, that if object size is bigger then page size, then it assumes that
  * we have a subsets of physically continuous  pages big enough to store
  * at least one object.
--- a/lib/librte_pmd_e1000/e1000/e1000_82571.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_pmd_e1000/e1000/e1000_82571.c	2014-05-02 16:31:11.283562765 -0700
@@ -395,7 +395,7 @@ STATIC s32 e1000_init_mac_params_82571(s
 	}
 
 	/* Ensure that the inter-port SWSM.SMBI lock bit is clear before
-	 * first NVM or PHY acess. This should be done for single-port
+	 * first NVM or PHY access. This should be done for single-port
 	 * devices, and for one port only on dual-port devices so that
 	 * for those devices we can still use the SMBI lock to synchronize
 	 * inter-port accesses to the PHY & NVM.
--- a/lib/librte_pmd_e1000/e1000/e1000_mbx.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_pmd_e1000/e1000/e1000_mbx.c	2014-05-02 16:31:11.283562765 -0700
@@ -68,7 +68,7 @@ STATIC s32 e1000_null_mbx_transact(struc
  *  @size: Length of buffer
  *  @mbx_id: id of mailbox to read
  *
- *  returns SUCCESS if it successfuly read message from buffer
+ *  returns SUCCESS if it successfully read message from buffer
  **/
 s32 e1000_read_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
 {
@@ -492,7 +492,7 @@ out_no_write:
  *  @size: Length of buffer
  *  @mbx_id: id of mailbox to read
  *
- *  returns SUCCESS if it successfuly read message from buffer
+ *  returns SUCCESS if it successfully read message from buffer
  **/
 STATIC s32 e1000_read_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size,
 			     u16 E1000_UNUSEDARG mbx_id)
--- a/lib/librte_pmd_e1000/em_ethdev.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_pmd_e1000/em_ethdev.c	2014-05-02 16:31:11.283562765 -0700
@@ -644,7 +644,7 @@ em_hardware_init(struct e1000_hw *hw)
 	 *   frames to be received after sending an XOFF.
 	 * - Low water mark works best when it is very near the high water mark.
 	 *   This allows the receiver to restart by sending XON when it has
-	 *   drained a bit. Here we use an arbitary value of 1500 which will
+	 *   drained a bit. Here we use an arbitrary value of 1500 which will
 	 *   restart after one full frame is pulled from the buffer. There
 	 *   could be several smaller frames in the buffer and if so they will
 	 *   not trigger the XON until their total number reduces the buffer
--- a/lib/librte_pmd_e1000/em_rxtx.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_pmd_e1000/em_rxtx.c	2014-05-02 16:31:11.283562765 -0700
@@ -1703,7 +1703,7 @@ eth_em_rx_init(struct rte_eth_dev *dev)
 		 * limit for packet length, jumbo frame of any size
 		 * can be accepted, thus we have to enable scattered
 		 * rx if jumbo frames are enabled (or if buffer size
-		 * is too small to accomodate non-jumbo packets)
+		 * is too small to accommodate non-jumbo packets)
 		 * to avoid splitting packets that don't fit into
 		 * one buffer.
 		 */
--- a/lib/librte_pmd_e1000/igb_ethdev.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_pmd_e1000/igb_ethdev.c	2014-05-02 16:31:11.283562765 -0700
@@ -934,7 +934,7 @@ igb_hardware_init(struct e1000_hw *hw)
 	 *   frames to be received after sending an XOFF.
 	 * - Low water mark works best when it is very near the high water mark.
 	 *   This allows the receiver to restart by sending XON when it has
-	 *   drained a bit. Here we use an arbitary value of 1500 which will
+	 *   drained a bit. Here we use an arbitrary value of 1500 which will
 	 *   restart after one full frame is pulled from the buffer. There
 	 *   could be several smaller frames in the buffer and if so they will
 	 *   not trigger the XON until their total number reduces the buffer
--- a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_mbx.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_mbx.c	2014-05-02 16:31:11.283562765 -0700
@@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
  *  @size: Length of buffer
  *  @mbx_id: id of mailbox to read
  *
- *  returns SUCCESS if it successfuly read message from buffer
+ *  returns SUCCESS if it successfully read message from buffer
  **/
 s32 ixgbe_read_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
 {
@@ -448,7 +448,7 @@ out_no_write:
  *  @size: Length of buffer
  *  @mbx_id: id of mailbox to read
  *
- *  returns SUCCESS if it successfuly read message from buffer
+ *  returns SUCCESS if it successfully read message from buffer
  **/
 STATIC s32 ixgbe_read_mbx_vf(struct ixgbe_hw *hw, u32 *msg, u16 size,
 			     u16 mbx_id)
--- a/lib/librte_pmd_ixgbe/ixgbe_bypass.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_pmd_ixgbe/ixgbe_bypass.c	2014-05-02 16:31:11.283562765 -0700
@@ -95,9 +95,9 @@ ixgbe_bypass_set_time(struct ixgbe_adapt
 }
 
 /**
- * ixgbe_bypass_init - Make some enviroment changes for bypass
+ * ixgbe_bypass_init - Make some environment changes for bypass
  *
- * @adapter: pointer to ixgbe_adapter sturcture for access to state bits
+ * @adapter: pointer to ixgbe_adapter structure for access to state bits
  *
  * This function collects all the modifications needed by the bypass
  * driver.
@@ -173,7 +173,7 @@ ixgbe_bypass_state_store(struct rte_eth_
 	if (ret_val)
 		goto exit;
 
-	/* Set AUTO back on so FW can recieve events */
+	/* Set AUTO back on so FW can receive events */
 	ret_val = adapter->bps.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
 					 BYPASS_MODE_OFF_M, BYPASS_AUTO);
 
--- a/lib/librte_pmd_ixgbe/ixgbe_bypass_api.h	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_pmd_ixgbe/ixgbe_bypass_api.h	2014-05-02 16:31:11.283562765 -0700
@@ -155,7 +155,7 @@ static s32 ixgbe_bypass_rw_generic(struc
  *
  * If we send a write we can't be sure it took until we can read back
  * that same register.  It can be a problem as some of the feilds may
- * for valid reasons change inbetween the time wrote the register and
+ * for valid reasons change between the time wrote the register and
  * we read it again to verify.  So this function check everything we
  * can check and then assumes it worked.
  *
@@ -254,7 +254,7 @@ static s32 ixgbe_bypass_set_generic(stru
 }
 
 /**
- *  ixgbe_bypass_rd_eep_generic - Read the bypass FW eeprom addres.
+ *  ixgbe_bypass_rd_eep_generic - Read the bypass FW eeprom address.
  *
  *  @hw: pointer to hardware structure
  *  @addr: The bypass eeprom address to read.
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c	2014-05-02 16:31:11.283562765 -0700
@@ -1966,7 +1966,7 @@ ixgbe_dev_link_status_print(struct rte_e
 }
 
 /*
- * It executes link_update after knowing an interrupt occured.
+ * It executes link_update after knowing an interrupt occurred.
  *
  * @param dev
  *  Pointer to struct rte_eth_dev.
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c	2014-05-02 16:31:11.283562765 -0700
@@ -2139,7 +2139,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_
 		     rxq->sw_ring, rxq->rx_ring, rxq->rx_ring_phys_addr);
 
 	/*
-	 * Certain constaints must be met in order to use the bulk buffer
+	 * Certain constraints must be met in order to use the bulk buffer
 	 * allocation Rx burst function.
 	 */
 	use_def_burst_func = check_rx_burst_bulk_alloc_preconditions(rxq);
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h	2014-05-02 16:31:11.283562765 -0700
@@ -91,7 +91,7 @@ struct igb_tx_entry_v {
 };
 
 /**
- * continous entry sequence, gather by the same mempool 
+ * continuous entry sequence, gather by the same mempool
  */
 struct igb_tx_entry_seq {
 	const struct rte_mempool* pool;
@@ -165,7 +165,7 @@ struct igb_tx_queue {
 	uint64_t            tx_ring_phys_addr; /**< TX ring DMA address. */
 	struct igb_tx_entry *sw_ring;      /**< virtual address of SW ring. */
 #ifdef RTE_IXGBE_INC_VECTOR
-	/** continous tx entry sequence within the same mempool */
+	/** continuous tx entry sequence within the same mempool */
 	struct igb_tx_entry_seq *sw_ring_seq; 
 #endif
 	volatile uint32_t   *tdt_reg_addr; /**< Address of TDT register. */
--- a/lib/librte_pmd_ring/rte_eth_ring.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_pmd_ring/rte_eth_ring.c	2014-05-02 16:31:11.283562765 -0700
@@ -221,7 +221,7 @@ rte_eth_from_rings(struct rte_ring *cons
 	struct rte_eth_dev *eth_dev = NULL;
 	unsigned i;
 
-	/* do some paramter checking */
+	/* do some parameter checking */
 	if (rx_queues == NULL && nb_rx_queues > 0)
 		goto error;
 	if (tx_queues == NULL && nb_tx_queues > 0)
--- a/lib/librte_pmd_virtio/virtio_rxtx.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_pmd_virtio/virtio_rxtx.c	2014-05-02 16:31:11.283562765 -0700
@@ -144,7 +144,7 @@ void
 virtio_dev_rxtx_start(struct rte_eth_dev *dev)
 {
 	/*
-	 * Start recieve and transmit vrings
+	 * Start receive and transmit vrings
 	 * -	Setup vring structure for all queues
 	 * -	Initialize descriptor for the rx vring
 	 * -	Allocate blank mbufs for the each rx descriptor
--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c	2014-05-02 16:31:11.283562765 -0700
@@ -297,7 +297,7 @@ vmxnet3_xmit_pkts( void *tx_queue, struc
 
 			txd = (Vmxnet3_TxDesc *)(txq->cmd_ring.base + txq->cmd_ring.next2fill);
 
-			/* Fill the tx decriptor */
+			/* Fill the tx descriptor */
 			tbi = txq->cmd_ring.buf_info + txq->cmd_ring.next2fill;
 			tbi->bufPA = RTE_MBUF_DATA_DMA_ADDR(txm);
 			txd->addr = tbi->bufPA;
--- a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c	2014-05-02 16:31:11.283562765 -0700
@@ -374,7 +374,7 @@ eth_link_update(struct rte_eth_dev *dev
 
 /*
  * Create shared vring between guest and host.
- * Memory is allocated through grant alloc driver, so it is not physical continous.
+ * Memory is allocated through grant alloc driver, so it is not physical continuous.
  */
 static void *
 gntalloc_vring_create(int queue_type, uint32_t size, int vtidx)
--- a/lib/librte_ring/rte_ring.h	2014-05-02 16:31:11.287562789 -0700
+++ b/lib/librte_ring/rte_ring.h	2014-05-02 16:31:11.287562789 -0700
@@ -405,7 +405,7 @@ __rte_ring_mp_do_enqueue(struct rte_ring
 	}
 
 	/*
-	 * If there are other enqueues in progress that preceeded us,
+	 * If there are other enqueues in progress that preceded us,
 	 * we need to wait for them to complete
 	 */
 	while (unlikely(r->prod.tail != prod_head))

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

* [dpdk-dev] [PATCH 2/5] dont inline string functions
  2014-05-02 23:42 [dpdk-dev] [PATCH 0/5] Various patches to 1.6.0r2 Stephen Hemminger
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 1/5] spelling fixes Stephen Hemminger
@ 2014-05-02 23:42 ` Stephen Hemminger
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 3/5] mempool: add walk iterator Stephen Hemminger
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Stephen Hemminger @ 2014-05-02 23:42 UTC (permalink / raw)
  To: dev

[-- Attachment #1: snprintf-noinline.patch --]
[-- Type: text/plain, Size: 6544 bytes --]

It makes no sense to inline string functions, in fact snprintf
can't be inlined because the function supports variable number of
arguments.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>


---
 lib/librte_eal/bsdapp/eal/Makefile             |    1 
 lib/librte_eal/common/eal_common_string_fns.c  |   96 +++++++++++++++++++++++++
 lib/librte_eal/common/include/rte_string_fns.h |   57 +-------------
 lib/librte_eal/linuxapp/eal/Makefile           |    1 
 4 files changed, 102 insertions(+), 53 deletions(-)

--- a/lib/librte_eal/bsdapp/eal/Makefile	2014-05-02 16:31:12.519570116 -0700
+++ b/lib/librte_eal/bsdapp/eal/Makefile	2014-05-02 16:31:12.519570116 -0700
@@ -67,6 +67,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) +=
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_tailqs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_errno.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_cpuflags.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_string_fns.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_hexdump.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_vdev.c
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ b/lib/librte_eal/common/eal_common_string_fns.c	2014-05-02 16:31:12.519570116 -0700
@@ -0,0 +1,96 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#include <rte_string_fns.h>
+
+/* safe version os snprintf */
+int
+rte_snprintf(char *buffer, int buflen, const char *format, ...)
+{
+	int len;
+	va_list ap;
+
+	if (buffer == NULL && buflen != 0)
+		goto einval_error;
+	if (format == NULL) {
+		if (buflen > 0)
+			buffer[0] = '\0';
+		goto einval_error;
+	}
+
+	va_start(ap, format);
+	len = vsnprintf(buffer, buflen, format, ap);
+	va_end(ap);
+	if (len >= buflen && buflen > 0)
+		buffer[buflen - 1] = '\0';
+
+	return len;
+
+einval_error:
+	errno = EINVAL;
+	return -1;
+}
+
+/* split string into tokens */
+int
+rte_strsplit(char *string, int stringlen,
+	     char **tokens, int maxtokens, char delim)
+{
+	int i, tok = 0;
+	int tokstart = 1; /* first token is right at start of string */
+
+	if (string == NULL || tokens == NULL)
+		goto einval_error;
+
+	for (i = 0; i < stringlen; i++) {
+		if (string[i] == '\0' || tok >= maxtokens)
+			break;
+		if (tokstart) {
+			tokstart = 0;
+			tokens[tok++] = &string[i];
+		}
+		if (string[i] == delim) {
+			string[i] = '\0';
+			tokstart = 1;
+		}
+	}
+	return tok;
+
+einval_error:
+	errno = EINVAL;
+	return -1;
+}
--- a/lib/librte_eal/common/include/rte_string_fns.h	2014-05-02 16:31:12.519570116 -0700
+++ b/lib/librte_eal/common/include/rte_string_fns.h	2014-05-02 16:31:12.519570116 -0700
@@ -72,33 +72,9 @@ extern "C" {
  *   buffer been sufficiently big.
  *
  */
-static inline int
-rte_snprintf(char *buffer, int buflen, const char *format, ...)
-{
-	int len;
-	va_list ap;
-
-	if (buffer == NULL && buflen != 0)
-		goto einval_error;
-	if (format == NULL) {
-		if (buflen > 0)
-			buffer[0] = '\0';
-		goto einval_error;
-	}
-
-	va_start(ap, format);
-	len = vsnprintf(buffer, buflen, format, ap);
-	va_end(ap);
-	if (len >= buflen && buflen > 0)
-		buffer[buflen - 1] = '\0';
-
-	return len;
-
-einval_error:
-	errno = EINVAL;
-	return -1;
-}
 
+int
+rte_snprintf(char *buffer, int buflen, const char *format, ...);
 
 /**
  * Takes string "string" parameter and splits it at character "delim"
@@ -126,34 +102,9 @@ einval_error:
  * @return
  *   The number of tokens in the tokens array.
  */
-static inline int
+int
 rte_strsplit(char *string, int stringlen,
-		char **tokens, int maxtokens, char delim)
-{
-	int i, tok = 0;
-	int tokstart = 1; /* first token is right at start of string */
-
-	if (string == NULL || tokens == NULL)
-		goto einval_error;
-
-	for (i = 0; i < stringlen; i++) {
-		if (string[i] == '\0' || tok >= maxtokens)
-			break;
-		if (tokstart) {
-			tokstart = 0;
-			tokens[tok++] = &string[i];
-		}
-		if (string[i] == delim) {
-			string[i] = '\0';
-			tokstart = 1;
-		}
-	}
-	return tok;
-
-einval_error:
-	errno = EINVAL;
-	return -1;
-}
+	     char **tokens, int maxtokens, char delim);
 
 #ifdef __cplusplus
 }
--- a/lib/librte_eal/linuxapp/eal/Makefile	2014-05-02 16:31:12.519570116 -0700
+++ b/lib/librte_eal/linuxapp/eal/Makefile	2014-05-02 16:31:12.519570116 -0700
@@ -75,6 +75,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) +
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_tailqs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_errno.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_cpuflags.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_string_fns.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_hexdump.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_vdev.c

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

* [dpdk-dev] [PATCH 3/5] mempool: add walk iterator
  2014-05-02 23:42 [dpdk-dev] [PATCH 0/5] Various patches to 1.6.0r2 Stephen Hemminger
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 1/5] spelling fixes Stephen Hemminger
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 2/5] dont inline string functions Stephen Hemminger
@ 2014-05-02 23:42 ` Stephen Hemminger
  2014-05-16 12:36   ` Olivier MATZ
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 4/5] memzone: add iterator function Stephen Hemminger
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 18+ messages in thread
From: Stephen Hemminger @ 2014-05-02 23:42 UTC (permalink / raw)
  To: dev

[-- Attachment #1: mempool-walk.patch --]
[-- Type: text/plain, Size: 1525 bytes --]

Add function to iterate over mempool.
Useful for diagnostic code that wants to look at mempool usage patterns.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>


--- a/lib/librte_mempool/rte_mempool.c	2014-05-02 16:31:13.279574637 -0700
+++ b/lib/librte_mempool/rte_mempool.c	2014-05-02 16:31:13.279574637 -0700
@@ -857,3 +857,24 @@ rte_mempool_lookup(const char *name)
 
 	return mp;
 }
+
+void rte_mempool_walk(void (*func)(const struct rte_mempool *, void *),
+		      void *arg)
+{
+	struct rte_mempool *mp = NULL;
+	struct rte_mempool_list *mempool_list;
+
+	if ((mempool_list =
+	     RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_MEMPOOL, rte_mempool_list)) == NULL) {
+		rte_errno = E_RTE_NO_TAILQ;
+		return;
+	}
+
+	rte_rwlock_read_lock(RTE_EAL_MEMPOOL_RWLOCK);
+
+	TAILQ_FOREACH(mp, mempool_list, next) {
+		(*func)(mp, arg);
+	}
+
+	rte_rwlock_read_unlock(RTE_EAL_MEMPOOL_RWLOCK);
+}
--- a/lib/librte_mempool/rte_mempool.h	2014-05-02 16:31:13.279574637 -0700
+++ b/lib/librte_mempool/rte_mempool.h	2014-05-02 16:31:13.279574637 -0700
@@ -1374,6 +1374,17 @@ size_t rte_mempool_xmem_size(uint32_t el
 ssize_t rte_mempool_xmem_usage(void *vaddr, uint32_t elt_num, size_t elt_sz,
 	const phys_addr_t paddr[], uint32_t pg_num, uint32_t pg_shift);
 
+/**
+ * Walk list of all memory pools
+ *
+ * @param func
+ *   Iterator function
+ * @param arg
+ *   Argument passed to iterator
+ */
+void rte_mempool_walk(void (*func)(const struct rte_mempool *, void *arg),
+		      void *arg);
+
 #ifdef __cplusplus
 }
 #endif

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

* [dpdk-dev] [PATCH 4/5] memzone: add iterator function
  2014-05-02 23:42 [dpdk-dev] [PATCH 0/5] Various patches to 1.6.0r2 Stephen Hemminger
                   ` (2 preceding siblings ...)
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 3/5] mempool: add walk iterator Stephen Hemminger
@ 2014-05-02 23:42 ` Stephen Hemminger
  2014-05-06  9:17   ` Burakov, Anatoly
  2014-05-16 12:38   ` Olivier MATZ
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 5/5] add FILE arguement to debug functions Stephen Hemminger
  2014-05-16 14:42 ` [dpdk-dev] [PATCH 0/5] Various patches to 1.6.0r2 Thomas Monjalon
  5 siblings, 2 replies; 18+ messages in thread
From: Stephen Hemminger @ 2014-05-02 23:42 UTC (permalink / raw)
  To: dev

[-- Attachment #1: memzone-walk.patch --]
[-- Type: text/plain, Size: 1360 bytes --]

When doing diagnostic function, it is useful to have a ability
to iterate over all memzones.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>


--- a/lib/librte_eal/common/eal_common_memzone.c	2014-05-02 16:31:15.375587103 -0700
+++ b/lib/librte_eal/common/eal_common_memzone.c	2014-05-02 16:31:15.375587103 -0700
@@ -505,3 +505,20 @@ rte_eal_memzone_init(void)
 
 	return 0;
 }
+
+/* Walk all reserved memory zones */
+void rte_memzone_walk(void (*func)(const struct rte_memzone *, void *),
+		      void *arg)
+{
+	struct rte_mem_config *mcfg;
+	unsigned i;
+
+	mcfg = rte_eal_get_configuration()->mem_config;
+
+	rte_rwlock_read_lock(&mcfg->mlock);
+	for (i=0; i<RTE_MAX_MEMZONE; i++) {
+		if (mcfg->memzone[i].addr != NULL)
+			(*func)(&mcfg->memzone[i], arg);
+	}
+	rte_rwlock_read_unlock(&mcfg->mlock);
+}
--- a/lib/librte_eal/common/include/rte_memzone.h	2014-05-02 16:31:15.375587103 -0700
+++ b/lib/librte_eal/common/include/rte_memzone.h	2014-05-02 16:31:15.375587103 -0700
@@ -248,6 +248,17 @@ const struct rte_memzone *rte_memzone_lo
  */
 void rte_memzone_dump(void);
 
+/**
+ * Walk list of all memzones
+ *
+ * @param func
+ *   Iterator function
+ * @param arg
+ *   Argument passed to iterator
+ */
+void rte_memzone_walk(void (*func)(const struct rte_memzone *, void *arg),
+		      void *arg);
+
 #ifdef __cplusplus
 }
 #endif

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

* [dpdk-dev] [PATCH 5/5] add FILE arguement to debug functions
  2014-05-02 23:42 [dpdk-dev] [PATCH 0/5] Various patches to 1.6.0r2 Stephen Hemminger
                   ` (3 preceding siblings ...)
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 4/5] memzone: add iterator function Stephen Hemminger
@ 2014-05-02 23:42 ` Stephen Hemminger
  2014-05-04 12:20   ` Neil Horman
  2014-05-06 12:52   ` Burakov, Anatoly
  2014-05-16 14:42 ` [dpdk-dev] [PATCH 0/5] Various patches to 1.6.0r2 Thomas Monjalon
  5 siblings, 2 replies; 18+ messages in thread
From: Stephen Hemminger @ 2014-05-02 23:42 UTC (permalink / raw)
  To: dev

[-- Attachment #1: dump-to-file.patch --]
[-- Type: text/plain, Size: 53012 bytes --]

The DPDK dump functions are useful for remote debugging of an
applications. But when application runs as a daemon, stdout
is typically routed to /dev/null.

Instead change all these functions to take a stdio FILE * handle
instead. An application can then use open_memstream() to capture
the output.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

---
 app/dump_cfg/main.c                         |    6 +-
 app/test-pmd/cmdline.c                      |   16 +++---
 app/test-pmd/testpmd.c                      |    2 
 app/test/commands.c                         |   16 +++---
 app/test/test_common.c                      |    4 -
 app/test/test_ivshmem.c                     |    4 -
 app/test/test_logs.c                        |    2 
 app/test/test_malloc.c                      |    8 +--
 app/test/test_mbuf.c                        |   14 ++---
 app/test/test_memory.c                      |    2 
 app/test/test_mempool.c                     |   14 ++---
 app/test/test_mempool_perf.c                |    6 +-
 app/test/test_memzone.c                     |   32 ++++++------
 app/test/test_pci.c                         |    2 
 app/test/test_ring.c                        |   42 ++++++++--------
 app/test/test_timer.c                       |    2 
 examples/l2fwd-ivshmem/host/host.c          |    2 
 lib/librte_eal/common/eal_common_devargs.c  |   12 ++--
 lib/librte_eal/common/eal_common_hexdump.c  |   20 +++----
 lib/librte_eal/common/eal_common_log.c      |    8 +--
 lib/librte_eal/common/eal_common_memory.c   |    4 -
 lib/librte_eal/common/eal_common_memzone.c  |    4 -
 lib/librte_eal/common/eal_common_pci.c      |   12 ++--
 lib/librte_eal/common/eal_common_tailqs.c   |    4 -
 lib/librte_eal/common/include/rte_devargs.h |    6 +-
 lib/librte_eal/common/include/rte_hexdump.h |    8 ++-
 lib/librte_eal/common/include/rte_log.h     |    7 +-
 lib/librte_eal/common/include/rte_memory.h  |    5 +
 lib/librte_eal/common/include/rte_memzone.h |    6 +-
 lib/librte_eal/common/include/rte_pci.h     |    5 +
 lib/librte_eal/common/include/rte_tailq.h   |    5 +
 lib/librte_eal/linuxapp/eal/eal_ivshmem.c   |    4 -
 lib/librte_ivshmem/rte_ivshmem.c            |    9 +--
 lib/librte_ivshmem/rte_ivshmem.h            |    4 +
 lib/librte_malloc/rte_malloc.c              |   16 +++---
 lib/librte_malloc/rte_malloc.h              |    5 +
 lib/librte_mbuf/rte_mbuf.c                  |   10 +--
 lib/librte_mbuf/rte_mbuf.h                  |    4 +
 lib/librte_mempool/rte_mempool.c            |   72 ++++++++++++++--------------
 lib/librte_mempool/rte_mempool.h            |   10 +++
 lib/librte_ring/rte_ring.c                  |   52 ++++++++++----------
 lib/librte_ring/rte_ring.h                  |   10 +++
 lib/librte_timer/rte_timer.c                |   14 ++---
 lib/librte_timer/rte_timer.h                |    6 +-
 44 files changed, 271 insertions(+), 225 deletions(-)

--- a/app/test/commands.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/test/commands.c	2014-05-02 16:31:16.423593331 -0700
@@ -275,19 +275,19 @@ static void cmd_dump_parsed(void *parsed
 	struct cmd_dump_result *res = parsed_result;
 
 	if (!strcmp(res->dump, "dump_physmem"))
-		rte_dump_physmem_layout();
+		rte_dump_physmem_layout(stdout);
 	else if (!strcmp(res->dump, "dump_memzone"))
-		rte_memzone_dump();
+		rte_memzone_dump(stdout);
 	else if (!strcmp(res->dump, "dump_log_history"))
-		rte_log_dump_history();
+		rte_log_dump_history(stdout);
 	else if (!strcmp(res->dump, "dump_struct_sizes"))
 		dump_struct_sizes();
 	else if (!strcmp(res->dump, "dump_ring"))
-		rte_ring_list_dump();
+		rte_ring_list_dump(stdout);
 	else if (!strcmp(res->dump, "dump_mempool"))
-		rte_mempool_list_dump();
+		rte_mempool_list_dump(stdout);
 	else if (!strcmp(res->dump, "dump_devargs"))
-		rte_eal_devargs_dump();
+		rte_eal_devargs_dump(stdout);
 }
 
 cmdline_parse_token_string_t cmd_dump_dump =
@@ -325,7 +325,7 @@ static void cmd_dump_one_parsed(void *pa
 			cmdline_printf(cl, "Cannot find ring\n");
 			return;
 		}
-		rte_ring_dump(r);
+		rte_ring_dump(stdout, r);
 	}
 	else if (!strcmp(res->dump, "dump_mempool")) {
 		struct rte_mempool *mp;
@@ -334,7 +334,7 @@ static void cmd_dump_one_parsed(void *pa
 			cmdline_printf(cl, "Cannot find mempool\n");
 			return;
 		}
-		rte_mempool_dump(mp);
+		rte_mempool_dump(stdout, mp);
 	}
 }
 
--- a/app/test/test_ivshmem.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/test/test_ivshmem.c	2014-05-02 16:31:16.423593331 -0700
@@ -263,10 +263,10 @@ test_ivshmem_api_test(void)
 	ASSERT(strnlen(buf, sizeof(buf)) != 0, "Buffer is empty");
 
 	/* make sure we don't segfault */
-	rte_ivshmem_metadata_dump(NULL);
+	rte_ivshmem_metadata_dump(stdout, NULL);
 
 	/* dump our metadata */
-	rte_ivshmem_metadata_dump(METADATA_NAME);
+	rte_ivshmem_metadata_dump(stdout, METADATA_NAME);
 
 	return 0;
 }
--- a/app/test/test_logs.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/test/test_logs.c	2014-05-02 16:31:16.423593331 -0700
@@ -86,7 +86,7 @@ test_logs(void)
 	RTE_LOG(DEBUG, TESTAPP1, "this is a debug level message\n");
 	RTE_LOG(DEBUG, TESTAPP2, "debug level message (not displayed)\n");
 
-	rte_log_dump_history();
+	rte_log_dump_history(stdout);
 
 	return 0;
 }
--- a/app/test/test_malloc.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/test/test_malloc.c	2014-05-02 16:31:16.423593331 -0700
@@ -162,7 +162,7 @@ test_align_overlap_per_lcore(__attribute
 		rte_free(p2);
 		rte_free(p3);
 	}
-	rte_malloc_dump_stats("dummy");
+	rte_malloc_dump_stats(stdout, "dummy");
 
 	return ret;
 }
@@ -258,7 +258,7 @@ test_reordered_free_per_lcore(__attribut
 			break;
 		}
 	}
-	rte_malloc_dump_stats("dummy");
+	rte_malloc_dump_stats(stdout, "dummy");
 
 	return ret;
 }
@@ -365,7 +365,7 @@ test_multi_alloc_statistics(void)
 	if (!p1)
 		return -1;
 	rte_free(p1);
-	rte_malloc_dump_stats("stats");
+	rte_malloc_dump_stats(stdout, "stats");
 
 	rte_malloc_get_socket_stats(socket,&post_stats);
 	/* Check statistics reported are correct */
@@ -466,7 +466,7 @@ test_rte_malloc_type_limits(void)
 	 */
 	const char *typename = "limit_test";
 	rte_malloc_set_limit(typename, 64 * 1024);
-	rte_malloc_dump_stats(typename);
+	rte_malloc_dump_stats(stdout, typename);
 	return 0;
 }
 
--- a/app/test/test_mbuf.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/test/test_mbuf.c	2014-05-02 16:31:16.423593331 -0700
@@ -158,7 +158,7 @@ test_pktmbuf_with_non_ascii_data(void)
 	memset(data, 0xff, rte_pktmbuf_pkt_len(m));
 	if (!rte_pktmbuf_is_contiguous(m))
 		GOTO_FAIL("Buffer should be continuous");
-	rte_pktmbuf_dump(m, MBUF_TEST_DATA_LEN);
+	rte_pktmbuf_dump(stdout, m, MBUF_TEST_DATA_LEN);
 
 	rte_pktmbuf_free(m);
 
@@ -191,7 +191,7 @@ test_one_pktmbuf(void)
 	if (rte_pktmbuf_pkt_len(m) != 0)
 		GOTO_FAIL("Bad length");
 
-	rte_pktmbuf_dump(m, 0);
+	rte_pktmbuf_dump(stdout, m, 0);
 
 	/* append data */
 
@@ -205,8 +205,8 @@ test_one_pktmbuf(void)
 	memset(data, 0x66, rte_pktmbuf_pkt_len(m));
 	if (!rte_pktmbuf_is_contiguous(m))
 		GOTO_FAIL("Buffer should be continuous");
-	rte_pktmbuf_dump(m, MBUF_TEST_DATA_LEN);
-	rte_pktmbuf_dump(m, 2*MBUF_TEST_DATA_LEN);
+	rte_pktmbuf_dump(stdout, m, MBUF_TEST_DATA_LEN);
+	rte_pktmbuf_dump(stdout, m, 2*MBUF_TEST_DATA_LEN);
 
 	/* this append should fail */
 
@@ -274,7 +274,7 @@ test_one_pktmbuf(void)
 
 	rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 1);
 	rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 0);
-	rte_pktmbuf_dump(m, 0);
+	rte_pktmbuf_dump(stdout, m, 0);
 
 	/* this prepend should fail */
 
@@ -713,8 +713,8 @@ test_refcnt_mbuf(void)
 		rte_panic("refernced mbufs: %u, freed mbufs: %u\n",
 		          tref, refcnt_lcore[master]);
 
-	rte_mempool_dump(refcnt_pool);
-	rte_ring_dump(refcnt_mbuf_ring);
+	rte_mempool_dump(stdout, refcnt_pool);
+	rte_ring_dump(stdout, refcnt_mbuf_ring);
 
 #endif
 	return (0);
--- a/app/test/test_mempool.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/test/test_mempool.c	2014-05-02 16:31:16.423593331 -0700
@@ -110,12 +110,12 @@ test_mempool_basic(void)
 	unsigned i, j;
 
 	/* dump the mempool status */
-	rte_mempool_dump(mp);
+	rte_mempool_dump(stdout, mp);
 
 	printf("get an object\n");
 	if (rte_mempool_get(mp, &obj) < 0)
 		return -1;
-	rte_mempool_dump(mp);
+	rte_mempool_dump(stdout, mp);
 
 	/* tests that improve coverage */
 	printf("get object count\n");
@@ -136,7 +136,7 @@ test_mempool_basic(void)
 
 	printf("put the object back\n");
 	rte_mempool_put(mp, obj);
-	rte_mempool_dump(mp);
+	rte_mempool_dump(stdout, mp);
 
 	printf("get 2 objects\n");
 	if (rte_mempool_get(mp, &obj) < 0)
@@ -145,12 +145,12 @@ test_mempool_basic(void)
 		rte_mempool_put(mp, obj);
 		return -1;
 	}
-	rte_mempool_dump(mp);
+	rte_mempool_dump(stdout, mp);
 
 	printf("put the objects back\n");
 	rte_mempool_put(mp, obj);
 	rte_mempool_put(mp, obj2);
-	rte_mempool_dump(mp);
+	rte_mempool_dump(stdout, mp);
 
 	/*
 	 * get many objects: we cannot get them all because the cache
@@ -488,7 +488,7 @@ test_mempool(void)
 		return -1;
 	}
 
-	rte_mempool_list_dump();
+	rte_mempool_list_dump(stdout);
 
 	/* basic tests without cache */
 	mp = mp_nocache;
@@ -517,7 +517,7 @@ test_mempool(void)
 	if (test_mempool_xmem_misc() < 0)
 		return -1;
 
-	rte_mempool_list_dump();
+	rte_mempool_list_dump(stdout);
 
 	return 0;
 }
--- a/app/test/test_mempool_perf.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/test/test_mempool_perf.c	2014-05-02 16:31:16.423593331 -0700
@@ -161,8 +161,8 @@ per_lcore_mempool_test(__attribute__((un
 				ret = rte_mempool_get_bulk(mp, &obj_table[idx],
 							   n_get_bulk);
 				if (unlikely(ret < 0)) {
-					rte_mempool_dump(mp);
-					rte_ring_dump(mp->ring);
+					rte_mempool_dump(stdout, mp);
+					rte_ring_dump(stdout, mp->ring);
 					/* in this case, objects are lost... */
 					return -1;
 				}
@@ -325,7 +325,7 @@ test_mempool_perf(void)
 	if (do_one_mempool_test(rte_lcore_count()) < 0)
 		return -1;
 
-	rte_mempool_list_dump();
+	rte_mempool_list_dump(stdout);
 
 	return 0;
 }
--- a/app/test/test_ring.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/test/test_ring.c	2014-05-02 16:31:16.423593331 -0700
@@ -112,7 +112,7 @@ static struct rte_ring *r;
 	if (!(exp)) {							\
 		printf("error at %s:%d\tcondition " #exp " failed\n",	\
 		    __func__, __LINE__);				\
-		rte_ring_dump(r);					\
+		rte_ring_dump(stdout, r);				\
 		return (-1);						\
 	}
 
@@ -273,7 +273,7 @@ test_ring_basic_full_empty(void * const
 
 		/* check data */
 		TEST_RING_VERIFY(0 == memcmp(src, dst, rsz));
-		rte_ring_dump(r);
+		rte_ring_dump(stdout, r);
 	}
 	return (0);
 }
@@ -341,8 +341,8 @@ test_ring_basic(void)
 
 	/* check data */
 	if (memcmp(src, dst, cur_dst - dst)) {
-		rte_hexdump("src", src, cur_src - src);
-		rte_hexdump("dst", dst, cur_dst - dst);
+		rte_hexdump(stdout, "src", src, cur_src - src);
+		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
 		printf("data after dequeue is not the same\n");
 		goto fail;
 	}
@@ -387,8 +387,8 @@ test_ring_basic(void)
 
 	/* check data */
 	if (memcmp(src, dst, cur_dst - dst)) {
-		rte_hexdump("src", src, cur_src - src);
-		rte_hexdump("dst", dst, cur_dst - dst);
+		rte_hexdump(stdout, "src", src, cur_src - src);
+		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
 		printf("data after dequeue is not the same\n");
 		goto fail;
 	}
@@ -409,8 +409,8 @@ test_ring_basic(void)
 
 	/* check data */
 	if (memcmp(src, dst, cur_dst - dst)) {
-		rte_hexdump("src", src, cur_src - src);
-		rte_hexdump("dst", dst, cur_dst - dst);
+		rte_hexdump(stdout, "src", src, cur_src - src);
+		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
 		printf("data after dequeue is not the same\n");
 		goto fail;
 	}
@@ -455,8 +455,8 @@ test_ring_basic(void)
 
 	/* check data */
 	if (memcmp(src, dst, cur_dst - dst)) {
-		rte_hexdump("src", src, cur_src - src);
-		rte_hexdump("dst", dst, cur_dst - dst);
+		rte_hexdump(stdout, "src", src, cur_src - src);
+		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
 		printf("data after dequeue is not the same\n");
 		goto fail;
 	}
@@ -550,8 +550,8 @@ test_ring_burst_basic(void)
 
 	/* check data */
 	if (memcmp(src, dst, cur_dst - dst)) {
-		rte_hexdump("src", src, cur_src - src);
-		rte_hexdump("dst", dst, cur_dst - dst);
+		rte_hexdump(stdout, "src", src, cur_src - src);
+		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
 		printf("data after dequeue is not the same\n");
 		goto fail;
 	}
@@ -616,8 +616,8 @@ test_ring_burst_basic(void)
 
 	/* check data */
 	if (memcmp(src, dst, cur_dst - dst)) {
-		rte_hexdump("src", src, cur_src - src);
-		rte_hexdump("dst", dst, cur_dst - dst);
+		rte_hexdump(stdout, "src", src, cur_src - src);
+		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
 		printf("data after dequeue is not the same\n");
 		goto fail;
 	}
@@ -665,8 +665,8 @@ test_ring_burst_basic(void)
 
 	/* check data */
 	if (memcmp(src, dst, cur_dst - dst)) {
-		rte_hexdump("src", src, cur_src - src);
-		rte_hexdump("dst", dst, cur_dst - dst);
+		rte_hexdump(stdout, "src", src, cur_src - src);
+		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
 		printf("data after dequeue is not the same\n");
 		goto fail;
 	}
@@ -688,8 +688,8 @@ test_ring_burst_basic(void)
 
 	/* check data */
 	if (memcmp(src, dst, cur_dst - dst)) {
-		rte_hexdump("src", src, cur_src - src);
-		rte_hexdump("dst", dst, cur_dst - dst);
+		rte_hexdump(stdout, "src", src, cur_src - src);
+		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
 		printf("data after dequeue is not the same\n");
 		goto fail;
 	}
@@ -738,8 +738,8 @@ test_ring_burst_basic(void)
 
 	/* check data */
 	if (memcmp(src, dst, cur_dst - dst)) {
-		rte_hexdump("src", src, cur_src - src);
-		rte_hexdump("dst", dst, cur_dst - dst);
+		rte_hexdump(stdout, "src", src, cur_src - src);
+		rte_hexdump(stdout, "dst", dst, cur_dst - dst);
 		printf("data after dequeue is not the same\n");
 		goto fail;
 	}
@@ -1388,7 +1388,7 @@ test_ring(void)
 		return -1;
 
 	/* dump the ring status */
-	rte_ring_list_dump();
+	rte_ring_list_dump(stdout);
 
 	return 0;
 }
--- a/app/test/test_timer.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/test/test_timer.c	2014-05-02 16:31:16.423593331 -0700
@@ -515,7 +515,7 @@ test_timer(void)
 		rte_timer_stop_sync(&mytiminfo[i].tim);
 	}
 
-	rte_timer_dump_stats();
+	rte_timer_dump_stats(stdout);
 
 	return 0;
 }
--- a/app/test-pmd/testpmd.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/test-pmd/testpmd.c	2014-05-02 16:31:16.423593331 -0700
@@ -471,7 +471,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size,
 		rte_exit(EXIT_FAILURE, "Creation of mbuf pool for socket %u "
 						"failed\n", socket_id);
 	} else if (verbose_level > 0) {
-		rte_mempool_dump(rte_mp);
+		rte_mempool_dump(stdout, rte_mp);
 	}
 }
 
--- a/examples/l2fwd-ivshmem/host/host.c	2014-05-02 16:31:16.431593380 -0700
+++ b/examples/l2fwd-ivshmem/host/host.c	2014-05-02 16:31:16.423593331 -0700
@@ -243,7 +243,7 @@ generate_ivshmem_cmdline(const char *con
 	if (print_to_file(cmdline, config_name) < 0)
 		return -1;
 
-	rte_ivshmem_metadata_dump(config_name);
+	rte_ivshmem_metadata_dump(stdout, config_name);
 	return 0;
 }
 
--- a/lib/librte_eal/common/eal_common_log.c	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_eal/common/eal_common_log.c	2014-05-02 16:31:16.423593331 -0700
@@ -202,9 +202,9 @@ int rte_log_cur_msg_logtype(void)
 	return log_cur_msg[lcore_id].logtype;
 }
 
-/* Dump log history on console */
+/* Dump log history to file */
 void
-rte_log_dump_history(void)
+rte_log_dump_history(FILE *out)
 {
 	struct log_history_list tmp_log_history;
 	struct log_history *hist_buf;
@@ -230,7 +230,7 @@ rte_log_dump_history(void)
 		STAILQ_REMOVE_HEAD(&tmp_log_history, next);
 
 		/* write on stdout */
-		if (fwrite(hist_buf->buf, hist_buf->size, 1, stdout) == 0) {
+		if (fwrite(hist_buf->buf, hist_buf->size, 1, out) == 0) {
 			rte_mempool_mp_put(log_history_mp, hist_buf);
 			break;
 		}
@@ -238,7 +238,7 @@ rte_log_dump_history(void)
 		/* put back message structure in pool */
 		rte_mempool_mp_put(log_history_mp, hist_buf);
 	}
-	fflush(stdout);
+	fflush(out);
 
 	rte_spinlock_unlock(&log_dump_lock);
 }
--- a/lib/librte_eal/common/include/rte_log.h	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_eal/common/include/rte_log.h	2014-05-02 16:31:16.423593331 -0700
@@ -173,9 +173,12 @@ int rte_log_cur_msg_logtype(void);
 void rte_log_set_history(int enable);
 
 /**
- * Dump the log history to the console.
+ * Dump the log history to a file
+ *
+ * @param f
+ *   A pointer to a file for output
  */
-void rte_log_dump_history(void);
+void rte_log_dump_history(FILE *f);
 
 /**
  * Add a log message to the history.
--- a/lib/librte_ivshmem/rte_ivshmem.c	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_ivshmem/rte_ivshmem.c	2014-05-02 16:31:16.423593331 -0700
@@ -821,9 +821,8 @@ rte_ivshmem_metadata_cmdline_generate(ch
 	return 0;
 }
 
-
 void
-rte_ivshmem_metadata_dump(const char *name)
+rte_ivshmem_metadata_dump(FILE *f, const char *name)
 {
 	unsigned i = 0;
 	struct ivshmem_config * config;
@@ -850,7 +849,7 @@ rte_ivshmem_metadata_dump(const char *na
 
 	while (entry->mz.addr != NULL && i < RTE_DIM(config->metadata->entry)) {
 
-		printf("Entry %u: name:<%-20s>, phys:0x%-15lx, len:0x%-15lx, "
+		fprintf(f, "Entry %u: name:<%-20s>, phys:0x%-15lx, len:0x%-15lx, "
 			"virt:%-15p, off:0x%-15lx\n",
 			i,
 			entry->mz.name,
@@ -861,7 +860,7 @@ rte_ivshmem_metadata_dump(const char *na
 		i++;
 
 #ifdef RTE_LIBRTE_IVSHMEM_DEBUG
-		printf("\tHugepage files:\n");
+		fprintf(f, "\tHugepage files:\n");
 
 		hugepage_sz = entry->mz.hugepage_sz;
 		addr = RTE_ALIGN_FLOOR(entry->mz.addr_64, hugepage_sz);
@@ -873,7 +872,7 @@ rte_ivshmem_metadata_dump(const char *na
 
 			get_hugefile_by_virt_addr(addr, &e);
 
-			printf("\t0x%"PRIx64 "-0x%" PRIx64 " offset: 0x%" PRIx64 " %s\n",
+			fprintf(f, "\t0x%"PRIx64 "-0x%" PRIx64 " offset: 0x%" PRIx64 " %s\n",
 					addr, addr + hugepage_sz, e.offset, e.filepath);
 		}
 #endif
--- a/lib/librte_ivshmem/rte_ivshmem.h	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_ivshmem/rte_ivshmem.h	2014-05-02 16:31:16.423593331 -0700
@@ -150,10 +150,12 @@ int rte_ivshmem_metadata_cmdline_generat
 /**
  * Dump all metadata entries from a given metadata file to the console.
  *
+ * @param f
+ *   A pointer to a file for output
  * @name
  *  Name of the metadata file to be dumped to console.
  */
-void rte_ivshmem_metadata_dump(const char *name);
+void rte_ivshmem_metadata_dump(FILE *f, const char *name);
 
 
 #ifdef __cplusplus
--- a/lib/librte_malloc/rte_malloc.c	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_malloc/rte_malloc.c	2014-05-02 16:31:16.427593355 -0700
@@ -217,7 +217,7 @@ rte_malloc_get_socket_stats(int socket,
  * Print stats on memory type. If type is NULL, info on all types is printed
  */
 void
-rte_malloc_dump_stats(__rte_unused const char *type)
+rte_malloc_dump_stats(FILE *f, __rte_unused const char *type)
 {
 	unsigned int socket;
 	struct rte_malloc_socket_stats sock_stats;
@@ -226,14 +226,14 @@ rte_malloc_dump_stats(__rte_unused const
 		if ((rte_malloc_get_socket_stats(socket, &sock_stats) < 0))
 			continue;
 
-		printf("Socket:%u\n", socket);
-		printf("\tHeap_size:%zu,\n", sock_stats.heap_totalsz_bytes);
-		printf("\tFree_size:%zu,\n", sock_stats.heap_freesz_bytes);
-		printf("\tAlloc_size:%zu,\n", sock_stats.heap_allocsz_bytes);
-		printf("\tGreatest_free_size:%zu,\n",
+		fprintf(f, "Socket:%u\n", socket);
+		fprintf(f, "\tHeap_size:%zu,\n", sock_stats.heap_totalsz_bytes);
+		fprintf(f, "\tFree_size:%zu,\n", sock_stats.heap_freesz_bytes);
+		fprintf(f, "\tAlloc_size:%zu,\n", sock_stats.heap_allocsz_bytes);
+		fprintf(f, "\tGreatest_free_size:%zu,\n",
 				sock_stats.greatest_free_size);
-		printf("\tAlloc_count:%u,\n",sock_stats.alloc_count);
-		printf("\tFree_count:%u,\n", sock_stats.free_count);
+		fprintf(f, "\tAlloc_count:%u,\n",sock_stats.alloc_count);
+		fprintf(f, "\tFree_count:%u,\n", sock_stats.free_count);
 	}
 	return;
 }
--- a/lib/librte_malloc/rte_malloc.h	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_malloc/rte_malloc.h	2014-05-02 16:31:16.427593355 -0700
@@ -40,6 +40,7 @@
  * from hugepages.
  */
 
+#include <stdio.h>
 #include <stddef.h>
 #include <rte_memory.h>
 
@@ -296,12 +297,14 @@ rte_malloc_get_socket_stats(int socket,
  * Dump for the specified type to the console. If the type argument is
  * NULL, all memory types will be dumped.
  *
+ * @param f
+ *   A pointer to a file for output
  * @param type
  *   A string identifying the type of objects to dump, or NULL
  *   to dump all objects.
  */
 void
-rte_malloc_dump_stats(const char *type);
+rte_malloc_dump_stats(FILE *f, const char *type);
 
 /**
  * Set the maximum amount of allocated memory for this type.
--- a/lib/librte_mbuf/rte_mbuf.c	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_mbuf/rte_mbuf.c	2014-05-02 16:31:16.427593355 -0700
@@ -193,16 +193,16 @@ rte_mbuf_sanity_check(const struct rte_m
 
 /* dump a mbuf on console */
 void
-rte_pktmbuf_dump(const struct rte_mbuf *m, unsigned dump_len)
+rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)
 {
 	unsigned int len;
 	unsigned nb_segs;
 
 	__rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 1);
 
-	printf("dump mbuf at 0x%p, phys=%"PRIx64", buf_len=%u\n",
+	fprintf(f, "dump mbuf at 0x%p, phys=%"PRIx64", buf_len=%u\n",
 	       m, (uint64_t)m->buf_physaddr, (unsigned)m->buf_len);
-	printf("  pkt_len=%"PRIu32", ol_flags=%"PRIx16", nb_segs=%u, "
+	fprintf(f, "  pkt_len=%"PRIu32", ol_flags=%"PRIx16", nb_segs=%u, "
 	       "in_port=%u\n", m->pkt.pkt_len, m->ol_flags,
 	       (unsigned)m->pkt.nb_segs, (unsigned)m->pkt.in_port);
 	nb_segs = m->pkt.nb_segs;
@@ -210,13 +210,13 @@ rte_pktmbuf_dump(const struct rte_mbuf *
 	while (m && nb_segs != 0) {
 		__rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 0);
 
-		printf("  segment at 0x%p, data=0x%p, data_len=%u\n",
+		fprintf(f, "  segment at 0x%p, data=0x%p, data_len=%u\n",
 		       m, m->pkt.data, (unsigned)m->pkt.data_len);
 		len = dump_len;
 		if (len > m->pkt.data_len)
 			len = m->pkt.data_len;
 		if (len != 0)
-			rte_hexdump(NULL, m->pkt.data, len);
+			rte_hexdump(f, NULL, m->pkt.data, len);
 		dump_len -= len;
 		m = m->pkt.next;
 		nb_segs --;
--- a/lib/librte_mbuf/rte_mbuf.h	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_mbuf/rte_mbuf.h	2014-05-02 16:31:16.427593355 -0700
@@ -1026,13 +1026,15 @@ static inline int rte_pktmbuf_is_contigu
  * Dump all fields for the given packet mbuf and all its associated
  * segments (in the case of a chained buffer).
  *
+ * @param f
+ *   A pointer to a file for output
  * @param m
  *   The packet mbuf.
  * @param dump_len
  *   If dump_len != 0, also dump the "dump_len" first data bytes of
  *   the packet.
  */
-void rte_pktmbuf_dump(const struct rte_mbuf *m, unsigned dump_len);
+void rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len);
 
 #ifdef __cplusplus
 }
--- a/lib/librte_mempool/rte_mempool.c	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_mempool/rte_mempool.c	2014-05-02 16:31:16.427593355 -0700
@@ -626,25 +626,25 @@ rte_mempool_count(const struct rte_mempo
 
 /* dump the cache status */
 static unsigned
-rte_mempool_dump_cache(const struct rte_mempool *mp)
+rte_mempool_dump_cache(FILE *f, const struct rte_mempool *mp)
 {
 #if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
 	unsigned lcore_id;
 	unsigned count = 0;
 	unsigned cache_count;
 
-	printf("  cache infos:\n");
-	printf("    cache_size=%"PRIu32"\n", mp->cache_size);
+	fprintf(f, "  cache infos:\n");
+	fprintf(f, "    cache_size=%"PRIu32"\n", mp->cache_size);
 	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
 		cache_count = mp->local_cache[lcore_id].len;
-		printf("    cache_count[%u]=%u\n", lcore_id, cache_count);
+		fprintf(f, "    cache_count[%u]=%u\n", lcore_id, cache_count);
 		count += cache_count;
 	}
-	printf("    total_cache_count=%u\n", count);
+	fprintf(f, "    total_cache_count=%u\n", count);
 	return count;
 #else
 	RTE_SET_USED(mp);
-	printf("  cache disabled\n");
+	fprintf(f, "  cache disabled\n");
 	return 0;
 #endif
 }
@@ -744,7 +744,7 @@ rte_mempool_audit(const struct rte_mempo
 
 /* dump the status of the mempool on the console */
 void
-rte_mempool_dump(const struct rte_mempool *mp)
+rte_mempool_dump(FILE *f, const struct rte_mempool *mp)
 {
 #ifdef RTE_LIBRTE_MEMPOOL_DEBUG
 	struct rte_mempool_debug_stats sum;
@@ -753,35 +753,35 @@ rte_mempool_dump(const struct rte_mempoo
 	unsigned common_count;
 	unsigned cache_count;
 
-	printf("mempool <%s>@%p\n", mp->name, mp);
-	printf("  flags=%x\n", mp->flags);
-	printf("  ring=<%s>@%p\n", mp->ring->name, mp->ring);
-	printf("  phys_addr=0x%" PRIx64 "\n", mp->phys_addr);
-	printf("  size=%"PRIu32"\n", mp->size);
-	printf("  header_size=%"PRIu32"\n", mp->header_size);
-	printf("  elt_size=%"PRIu32"\n", mp->elt_size);
-	printf("  trailer_size=%"PRIu32"\n", mp->trailer_size);
-	printf("  total_obj_size=%"PRIu32"\n",
+	fprintf(f, "mempool <%s>@%p\n", mp->name, mp);
+	fprintf(f, "  flags=%x\n", mp->flags);
+	fprintf(f, "  ring=<%s>@%p\n", mp->ring->name, mp->ring);
+	fprintf(f, "  phys_addr=0x%" PRIx64 "\n", mp->phys_addr);
+	fprintf(f, "  size=%"PRIu32"\n", mp->size);
+	fprintf(f, "  header_size=%"PRIu32"\n", mp->header_size);
+	fprintf(f, "  elt_size=%"PRIu32"\n", mp->elt_size);
+	fprintf(f, "  trailer_size=%"PRIu32"\n", mp->trailer_size);
+	fprintf(f, "  total_obj_size=%"PRIu32"\n",
 	       mp->header_size + mp->elt_size + mp->trailer_size);
 
-	printf("  private_data_size=%"PRIu32"\n", mp->private_data_size);
-	printf("  pg_num=%"PRIu32"\n", mp->pg_num);
-	printf("  pg_shift=%"PRIu32"\n", mp->pg_shift);
-	printf("  pg_mask=%#tx\n", mp->pg_mask);
-	printf("  elt_va_start=%#tx\n", mp->elt_va_start);
-	printf("  elt_va_end=%#tx\n", mp->elt_va_end);
-	printf("  elt_pa[0]=0x%" PRIx64 "\n", mp->elt_pa[0]);
+	fprintf(f, "  private_data_size=%"PRIu32"\n", mp->private_data_size);
+	fprintf(f, "  pg_num=%"PRIu32"\n", mp->pg_num);
+	fprintf(f, "  pg_shift=%"PRIu32"\n", mp->pg_shift);
+	fprintf(f, "  pg_mask=%#tx\n", mp->pg_mask);
+	fprintf(f, "  elt_va_start=%#tx\n", mp->elt_va_start);
+	fprintf(f, "  elt_va_end=%#tx\n", mp->elt_va_end);
+	fprintf(f, "  elt_pa[0]=0x%" PRIx64 "\n", mp->elt_pa[0]);
 
 	if (mp->size != 0)
-		printf("  avg bytes/object=%#Lf\n",
+		fprintf(f, "  avg bytes/object=%#Lf\n",
 			(long double)(mp->elt_va_end - mp->elt_va_start) /
 			mp->size);
 
-	cache_count = rte_mempool_dump_cache(mp);
+	cache_count = rte_mempool_dump_cache(f, mp);
 	common_count = rte_ring_count(mp->ring);
 	if ((cache_count + common_count) > mp->size)
 		common_count = mp->size - cache_count;
-	printf("  common_pool_count=%u\n", common_count);
+	fprintf(f, "  common_pool_count=%u\n", common_count);
 
 	/* sum and dump statistics */
 #ifdef RTE_LIBRTE_MEMPOOL_DEBUG
@@ -794,15 +794,15 @@ rte_mempool_dump(const struct rte_mempoo
 		sum.get_fail_bulk += mp->stats[lcore_id].get_fail_bulk;
 		sum.get_fail_objs += mp->stats[lcore_id].get_fail_objs;
 	}
-	printf("  stats:\n");
-	printf("    put_bulk=%"PRIu64"\n", sum.put_bulk);
-	printf("    put_objs=%"PRIu64"\n", sum.put_objs);
-	printf("    get_success_bulk=%"PRIu64"\n", sum.get_success_bulk);
-	printf("    get_success_objs=%"PRIu64"\n", sum.get_success_objs);
-	printf("    get_fail_bulk=%"PRIu64"\n", sum.get_fail_bulk);
-	printf("    get_fail_objs=%"PRIu64"\n", sum.get_fail_objs);
+	fprintf(f, "  stats:\n");
+	fprintf(f, "    put_bulk=%"PRIu64"\n", sum.put_bulk);
+	fprintf(f, "    put_objs=%"PRIu64"\n", sum.put_objs);
+	fprintf(f, "    get_success_bulk=%"PRIu64"\n", sum.get_success_bulk);
+	fprintf(f, "    get_success_objs=%"PRIu64"\n", sum.get_success_objs);
+	fprintf(f, "    get_fail_bulk=%"PRIu64"\n", sum.get_fail_bulk);
+	fprintf(f, "    get_fail_objs=%"PRIu64"\n", sum.get_fail_objs);
 #else
-	printf("  no statistics available\n");
+	fprintf(f, "  no statistics available\n");
 #endif
 
 	rte_mempool_audit(mp);
@@ -810,7 +810,7 @@ rte_mempool_dump(const struct rte_mempoo
 
 /* dump the status of all mempools on the console */
 void
-rte_mempool_list_dump(void)
+rte_mempool_list_dump(FILE *f)
 {
 	const struct rte_mempool *mp = NULL;
 	struct rte_mempool_list *mempool_list;
@@ -824,7 +824,7 @@ rte_mempool_list_dump(void)
 	rte_rwlock_read_lock(RTE_EAL_MEMPOOL_RWLOCK);
 
 	TAILQ_FOREACH(mp, mempool_list, next) {
-		rte_mempool_dump(mp);
+		rte_mempool_dump(f, mp);
 	}
 
 	rte_rwlock_read_unlock(RTE_EAL_MEMPOOL_RWLOCK);
--- a/lib/librte_mempool/rte_mempool.h	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_mempool/rte_mempool.h	2014-05-02 16:31:16.427593355 -0700
@@ -59,6 +59,7 @@
  * that won't work as rte_lcore_id() will not return a correct value.
  */
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <errno.h>
@@ -733,10 +734,12 @@ rte_dom0_mempool_create(const char *name
 /**
  * Dump the status of the mempool to the console.
  *
+ * @param f
+ *   A pointer to a file for output
  * @param mp
  *   A pointer to the mempool structure.
  */
-void rte_mempool_dump(const struct rte_mempool *mp);
+void rte_mempool_dump(FILE *f, const struct rte_mempool *mp);
 
 /**
  * @internal Put several objects back in the mempool; used internally.
@@ -1298,8 +1301,11 @@ static inline void *rte_mempool_get_priv
 
 /**
  * Dump the status of all mempools on the console
+ *
+ * @param f
+ *   A pointer to a file for output
  */
-void rte_mempool_list_dump(void);
+void rte_mempool_list_dump(FILE *f);
 
 /**
  * Search a mempool from its name
--- a/lib/librte_ring/rte_ring.c	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_ring/rte_ring.c	2014-05-02 16:31:16.427593355 -0700
@@ -191,26 +191,26 @@ rte_ring_set_water_mark(struct rte_ring
 
 /* dump the status of the ring on the console */
 void
-rte_ring_dump(const struct rte_ring *r)
+rte_ring_dump(FILE *f, const struct rte_ring *r)
 {
 #ifdef RTE_LIBRTE_RING_DEBUG
 	struct rte_ring_debug_stats sum;
 	unsigned lcore_id;
 #endif
 
-	printf("ring <%s>@%p\n", r->name, r);
-	printf("  flags=%x\n", r->flags);
-	printf("  size=%"PRIu32"\n", r->prod.size);
-	printf("  ct=%"PRIu32"\n", r->cons.tail);
-	printf("  ch=%"PRIu32"\n", r->cons.head);
-	printf("  pt=%"PRIu32"\n", r->prod.tail);
-	printf("  ph=%"PRIu32"\n", r->prod.head);
-	printf("  used=%u\n", rte_ring_count(r));
-	printf("  avail=%u\n", rte_ring_free_count(r));
+	fprintf(f, "ring <%s>@%p\n", r->name, r);
+	fprintf(f, "  flags=%x\n", r->flags);
+	fprintf(f, "  size=%"PRIu32"\n", r->prod.size);
+	fprintf(f, "  ct=%"PRIu32"\n", r->cons.tail);
+	fprintf(f, "  ch=%"PRIu32"\n", r->cons.head);
+	fprintf(f, "  pt=%"PRIu32"\n", r->prod.tail);
+	fprintf(f, "  ph=%"PRIu32"\n", r->prod.head);
+	fprintf(f, "  used=%u\n", rte_ring_count(r));
+	fprintf(f, "  avail=%u\n", rte_ring_free_count(r));
 	if (r->prod.watermark == r->prod.size)
-		printf("  watermark=0\n");
+		fprintf(f, "  watermark=0\n");
 	else
-		printf("  watermark=%"PRIu32"\n", r->prod.watermark);
+		fprintf(f, "  watermark=%"PRIu32"\n", r->prod.watermark);
 
 	/* sum and dump statistics */
 #ifdef RTE_LIBRTE_RING_DEBUG
@@ -227,25 +227,25 @@ rte_ring_dump(const struct rte_ring *r)
 		sum.deq_fail_bulk += r->stats[lcore_id].deq_fail_bulk;
 		sum.deq_fail_objs += r->stats[lcore_id].deq_fail_objs;
 	}
-	printf("  size=%"PRIu32"\n", r->prod.size);
-	printf("  enq_success_bulk=%"PRIu64"\n", sum.enq_success_bulk);
-	printf("  enq_success_objs=%"PRIu64"\n", sum.enq_success_objs);
-	printf("  enq_quota_bulk=%"PRIu64"\n", sum.enq_quota_bulk);
-	printf("  enq_quota_objs=%"PRIu64"\n", sum.enq_quota_objs);
-	printf("  enq_fail_bulk=%"PRIu64"\n", sum.enq_fail_bulk);
-	printf("  enq_fail_objs=%"PRIu64"\n", sum.enq_fail_objs);
-	printf("  deq_success_bulk=%"PRIu64"\n", sum.deq_success_bulk);
-	printf("  deq_success_objs=%"PRIu64"\n", sum.deq_success_objs);
-	printf("  deq_fail_bulk=%"PRIu64"\n", sum.deq_fail_bulk);
-	printf("  deq_fail_objs=%"PRIu64"\n", sum.deq_fail_objs);
+	fprintf(f, "  size=%"PRIu32"\n", r->prod.size);
+	fprintf(f, "  enq_success_bulk=%"PRIu64"\n", sum.enq_success_bulk);
+	fprintf(f, "  enq_success_objs=%"PRIu64"\n", sum.enq_success_objs);
+	fprintf(f, "  enq_quota_bulk=%"PRIu64"\n", sum.enq_quota_bulk);
+	fprintf(f, "  enq_quota_objs=%"PRIu64"\n", sum.enq_quota_objs);
+	fprintf(f, "  enq_fail_bulk=%"PRIu64"\n", sum.enq_fail_bulk);
+	fprintf(f, "  enq_fail_objs=%"PRIu64"\n", sum.enq_fail_objs);
+	fprintf(f, "  deq_success_bulk=%"PRIu64"\n", sum.deq_success_bulk);
+	fprintf(f, "  deq_success_objs=%"PRIu64"\n", sum.deq_success_objs);
+	fprintf(f, "  deq_fail_bulk=%"PRIu64"\n", sum.deq_fail_bulk);
+	fprintf(f, "  deq_fail_objs=%"PRIu64"\n", sum.deq_fail_objs);
 #else
-	printf("  no statistics available\n");
+	fprintf(f, "  no statistics available\n");
 #endif
 }
 
 /* dump the status of all rings on the console */
 void
-rte_ring_list_dump(void)
+rte_ring_list_dump(FILE *f)
 {
 	const struct rte_ring *mp;
 	struct rte_ring_list *ring_list;
@@ -260,7 +260,7 @@ rte_ring_list_dump(void)
 	rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
 
 	TAILQ_FOREACH(mp, ring_list, next) {
-		rte_ring_dump(mp);
+		rte_ring_dump(f, mp);
 	}
 
 	rte_rwlock_read_unlock(RTE_EAL_TAILQ_RWLOCK);
--- a/lib/librte_ring/rte_ring.h	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_ring/rte_ring.h	2014-05-02 16:31:16.427593355 -0700
@@ -91,6 +91,7 @@
 extern "C" {
 #endif
 
+#include <stdio.h>
 #include <stdint.h>
 #include <sys/queue.h>
 #include <errno.h>
@@ -260,10 +261,12 @@ int rte_ring_set_water_mark(struct rte_r
 /**
  * Dump the status of the ring to the console.
  *
+ * @param f
+ *   A pointer to a file for output
  * @param r
  *   A pointer to the ring structure.
  */
-void rte_ring_dump(const struct rte_ring *r);
+void rte_ring_dump(FILE *f, const struct rte_ring *r);
 
 /* the actual enqueue of pointers on the ring. 
  * Placed here since identical code needed in both
@@ -996,8 +999,11 @@ rte_ring_free_count(const struct rte_rin
 
 /**
  * Dump the status of all rings on the console
+ *
+ * @param f
+ *   A pointer to a file for output
  */
-void rte_ring_list_dump(void);
+void rte_ring_list_dump(FILE *f);
 
 /**
  * Search a ring from its name
--- a/lib/librte_timer/rte_timer.c	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_timer/rte_timer.c	2014-05-02 16:31:16.427593355 -0700
@@ -582,7 +582,7 @@ done:
 }
 
 /* dump statistics about timers */
-void rte_timer_dump_stats(void)
+void rte_timer_dump_stats(FILE *f)
 {
 #ifdef RTE_LIBRTE_TIMER_DEBUG
 	struct rte_timer_debug_stats sum;
@@ -595,12 +595,12 @@ void rte_timer_dump_stats(void)
 		sum.manage += priv_timer[lcore_id].stats.manage;
 		sum.pending += priv_timer[lcore_id].stats.pending;
 	}
-	printf("Timer statistics:\n");
-	printf("  reset = %"PRIu64"\n", sum.reset);
-	printf("  stop = %"PRIu64"\n", sum.stop);
-	printf("  manage = %"PRIu64"\n", sum.manage);
-	printf("  pending = %"PRIu64"\n", sum.pending);
+	fprintf(f, "Timer statistics:\n");
+	fprintf(f, "  reset = %"PRIu64"\n", sum.reset);
+	fprintf(f, "  stop = %"PRIu64"\n", sum.stop);
+	fprintf(f, "  manage = %"PRIu64"\n", sum.manage);
+	fprintf(f, "  pending = %"PRIu64"\n", sum.pending);
 #else
-	printf("No timer statistics, RTE_LIBRTE_TIMER_DEBUG is disabled\n");
+	fprintf(f, "No timer statistics, RTE_LIBRTE_TIMER_DEBUG is disabled\n");
 #endif
 }
--- a/lib/librte_timer/rte_timer.h	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_timer/rte_timer.h	2014-05-02 16:31:16.427593355 -0700
@@ -63,6 +63,7 @@
  * design of this library.
  */
 
+#include <stdio.h>
 #include <stdint.h>
 #include <stddef.h>
 
@@ -321,8 +322,11 @@ void rte_timer_manage(void);
 
 /**
  * Dump statistics about timers.
+ *
+ * @param f
+ *   A pointer to a file for output
  */
-void rte_timer_dump_stats(void);
+void rte_timer_dump_stats(FILE *f);
 
 #ifdef __cplusplus
 }
--- a/app/dump_cfg/main.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/dump_cfg/main.c	2014-05-02 16:31:16.427593355 -0700
@@ -79,15 +79,15 @@ MAIN(int argc, char **argv)
 		rte_panic("Cannot init EAL\n");
 
 	printf("----------- MEMORY_SEGMENTS -----------\n");
-	rte_dump_physmem_layout();
+	rte_dump_physmem_layout(stdout);
 	printf("--------- END_MEMORY_SEGMENTS ---------\n");
 
 	printf("------------ MEMORY_ZONES -------------\n");
-	rte_memzone_dump();
+	rte_memzone_dump(stdout);
 	printf("---------- END_MEMORY_ZONES -----------\n");
 
 	printf("------------- TAIL_QUEUES -------------\n");
-	rte_dump_tailq();
+	rte_dump_tailq(stdout);
 	printf("---------- END_TAIL_QUEUES ------------\n");
 
 	return 0;
--- a/app/test/test_memzone.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/test/test_memzone.c	2014-05-02 16:31:16.427593355 -0700
@@ -294,9 +294,9 @@ test_memzone_reserve_max(void)
 
 			/* check if the memzone is in our memseg and subtract length */
 			if ((config->mem_config->memzone[memzone_idx].addr >=
-					ms[memseg_idx].addr) &&
-					(config->mem_config->memzone[memzone_idx].addr <
-					(RTE_PTR_ADD(ms[memseg_idx].addr, ms[memseg_idx].len)))) {
+			     ms[memseg_idx].addr) &&
+			    (config->mem_config->memzone[memzone_idx].addr <
+			     (RTE_PTR_ADD(ms[memseg_idx].addr, ms[memseg_idx].len)))) {
 				/* since the zones can now be aligned and occasionally skip
 				 * some space, we should calculate the length based on
 				 * reported length and start addresses difference. Addresses
@@ -304,11 +304,11 @@ test_memzone_reserve_max(void)
 				 * them being in the right order.
 				 */
 				len -= RTE_PTR_DIFF(
-						config->mem_config->memzone[memzone_idx].addr,
-						last_addr);
+						    config->mem_config->memzone[memzone_idx].addr,
+						    last_addr);
 				len -= config->mem_config->memzone[memzone_idx].len;
 				last_addr = RTE_PTR_ADD(config->mem_config->memzone[memzone_idx].addr,
-						(size_t) config->mem_config->memzone[memzone_idx].len);
+							(size_t) config->mem_config->memzone[memzone_idx].len);
 			}
 		}
 
@@ -326,17 +326,17 @@ test_memzone_reserve_max(void)
 	mz = rte_memzone_reserve("max_zone", 0, SOCKET_ID_ANY, 0);
 	if (mz == NULL){
 		printf("Failed to reserve a big chunk of memory\n");
-		rte_dump_physmem_layout();
-		rte_memzone_dump();
+		rte_dump_physmem_layout(stdout);
+		rte_memzone_dump(stdout);
 		return -1;
 	}
 
 	if (mz->len != maxlen) {
 		printf("Memzone reserve with 0 size did not return bigest block\n");
 		printf("Expected size = %zu, actual size = %zu\n",
-				maxlen, mz->len);
-		rte_dump_physmem_layout();
-		rte_memzone_dump();
+		       maxlen, mz->len);
+		rte_dump_physmem_layout(stdout);
+		rte_memzone_dump(stdout);
 
 		return -1;
 	}
@@ -422,8 +422,8 @@ test_memzone_reserve_max_aligned(void)
 			SOCKET_ID_ANY, 0, align);
 	if (mz == NULL){
 		printf("Failed to reserve a big chunk of memory\n");
-		rte_dump_physmem_layout();
-		rte_memzone_dump();
+		rte_dump_physmem_layout(stdout);
+		rte_memzone_dump(stdout);
 		return -1;
 	}
 
@@ -432,8 +432,8 @@ test_memzone_reserve_max_aligned(void)
 				" bigest block\n", align);
 		printf("Expected size = %zu, actual size = %zu\n",
 				maxlen, mz->len);
-		rte_dump_physmem_layout();
-		rte_memzone_dump();
+		rte_dump_physmem_layout(stdout);
+		rte_memzone_dump(stdout);
 
 		return -1;
 	}
@@ -947,7 +947,7 @@ test_memzone(void)
 	if (memzone1 == NULL || memzone2 == NULL || memzone4 == NULL)
 		return -1;
 
-	rte_memzone_dump();
+	rte_memzone_dump(stdout);
 
 	/* check cache-line alignments */
 	printf("check alignments and lengths\n");
--- a/lib/librte_eal/common/eal_common_devargs.c	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_eal/common/eal_common_devargs.c	2014-05-02 16:31:16.427593355 -0700
@@ -122,31 +122,31 @@ rte_eal_devargs_type_count(enum rte_devt
 
 /* dump the user devices on the console */
 void
-rte_eal_devargs_dump(void)
+rte_eal_devargs_dump(FILE *f)
 {
 	struct rte_devargs *devargs;
 
-	printf("User device white list:\n");
+	fprintf(f, "User device white list:\n");
 	TAILQ_FOREACH(devargs, &devargs_list, next) {
 		if (devargs->type == RTE_DEVTYPE_WHITELISTED_PCI)
-			printf("  PCI whitelist " PCI_PRI_FMT " %s\n",
+			fprintf(f, "  PCI whitelist " PCI_PRI_FMT " %s\n",
 			       devargs->pci.addr.domain,
 			       devargs->pci.addr.bus,
 			       devargs->pci.addr.devid,
 			       devargs->pci.addr.function,
 			       devargs->args);
 		else if (devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI)
-			printf("  PCI blacklist " PCI_PRI_FMT " %s\n",
+			fprintf(f, "  PCI blacklist " PCI_PRI_FMT " %s\n",
 			       devargs->pci.addr.domain,
 			       devargs->pci.addr.bus,
 			       devargs->pci.addr.devid,
 			       devargs->pci.addr.function,
 			       devargs->args);
 		else if (devargs->type == RTE_DEVTYPE_VIRTUAL)
-			printf("  VIRTUAL %s %s\n",
+			fprintf(f, "  VIRTUAL %s %s\n",
 			       devargs->virtual.drv_name,
 			       devargs->args);
 		else
-			printf("  UNKNOWN %s\n", devargs->args);
+			fprintf(f, "  UNKNOWN %s\n", devargs->args);
 	}
 }
--- a/lib/librte_eal/common/eal_common_memory.c	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_eal/common/eal_common_memory.c	2014-05-02 16:31:16.427593355 -0700
@@ -82,7 +82,7 @@ rte_eal_get_physmem_size(void)
 
 /* Dump the physical memory layout on console */
 void
-rte_dump_physmem_layout(void)
+rte_dump_physmem_layout(FILE *f)
 {
 	const struct rte_mem_config *mcfg;
 	unsigned i = 0;
@@ -94,7 +94,7 @@ rte_dump_physmem_layout(void)
 		if (mcfg->memseg[i].addr == NULL)
 			break;
 
-		printf("Segment %u: phys:0x%"PRIx64", len:%zu, "
+		fprintf(f, "Segment %u: phys:0x%"PRIx64", len:%zu, "
 		       "virt:%p, socket_id:%"PRId32", "
 		       "hugepage_sz:%zu, nchannel:%"PRIx32", "
 		       "nrank:%"PRIx32"\n", i,
--- a/lib/librte_eal/common/eal_common_memzone.c	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_eal/common/eal_common_memzone.c	2014-05-02 16:31:16.427593355 -0700
@@ -385,7 +385,7 @@ rte_memzone_lookup(const char *name)
 
 /* Dump all reserved memory zones on console */
 void
-rte_memzone_dump(void)
+rte_memzone_dump(FILE *f)
 {
 	struct rte_mem_config *mcfg;
 	unsigned i = 0;
@@ -398,7 +398,7 @@ rte_memzone_dump(void)
 	for (i=0; i<RTE_MAX_MEMZONE; i++) {
 		if (mcfg->memzone[i].addr == NULL)
 			break;
-		printf("Zone %u: name:<%s>, phys:0x%"PRIx64", len:0x%zx"
+		fprintf(f, "Zone %u: name:<%s>, phys:0x%"PRIx64", len:0x%zx"
 		       ", virt:%p, socket_id:%"PRId32", flags:%"PRIx32"\n", i,
 		       mcfg->memzone[i].name,
 		       mcfg->memzone[i].phys_addr,
--- a/lib/librte_eal/common/include/rte_devargs.h	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_eal/common/include/rte_devargs.h	2014-05-02 16:31:16.427593355 -0700
@@ -48,6 +48,7 @@
 extern "C" {
 #endif
 
+#include <stdio.h>
 #include <sys/queue.h>
 #include <rte_pci.h>
 
@@ -135,8 +136,11 @@ rte_eal_devargs_type_count(enum rte_devt
 
 /**
  * This function dumps the list of user device and their arguments.
+ *
+ * @param f
+ *   A pointer to a file for output
  */
-void rte_eal_devargs_dump(void);
+void rte_eal_devargs_dump(FILE *f);
 
 #ifdef __cplusplus
 }
--- a/lib/librte_eal/common/include/rte_memory.h	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_eal/common/include/rte_memory.h	2014-05-02 16:31:16.427593355 -0700
@@ -139,8 +139,11 @@ const struct rte_memseg *rte_eal_get_phy
 
 /**
  * Dump the physical memory layout to the console.
+ *
+ * @param f
+ *   A pointer to a file for output
  */
-void rte_dump_physmem_layout(void);
+void rte_dump_physmem_layout(FILE *f);
 
 /**
  * Get the total amount of available physical memory.
--- a/lib/librte_eal/common/include/rte_memzone.h	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_eal/common/include/rte_memzone.h	2014-05-02 16:31:16.427593355 -0700
@@ -51,6 +51,7 @@
  * be done at initialization time only.
  */
 
+#include <stdio.h>
 #include <rte_memory.h>
 
 #ifdef __cplusplus
@@ -245,8 +246,11 @@ const struct rte_memzone *rte_memzone_lo
 
 /**
  * Dump all reserved memzones to the console.
+ *
+ * @param f
+ *   A pointer to a file for output
  */
-void rte_memzone_dump(void);
+void rte_memzone_dump(FILE *);
 
 /**
  * Walk list of all memzones
--- a/lib/librte_eal/linuxapp/eal/eal_ivshmem.c	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_eal/linuxapp/eal/eal_ivshmem.c	2014-05-02 16:31:16.427593355 -0700
@@ -825,8 +825,8 @@ rte_eal_ivshmem_obj_init(void)
 	}
 
 #ifdef RTE_LIBRTE_IVSHMEM_DEBUG
-	rte_memzone_dump();
-	rte_ring_list_dump();
+	rte_memzone_dump(stdout);
+	rte_ring_list_dump(stdout);
 #endif
 
 	return 0;
--- a/app/test-pmd/cmdline.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/test-pmd/cmdline.c	2014-05-02 16:31:16.427593355 -0700
@@ -5023,19 +5023,19 @@ static void cmd_dump_parsed(void *parsed
 	struct cmd_dump_result *res = parsed_result;
 
 	if (!strcmp(res->dump, "dump_physmem"))
-		rte_dump_physmem_layout();
+		rte_dump_physmem_layout(stdout);
 	else if (!strcmp(res->dump, "dump_memzone"))
-		rte_memzone_dump();
+		rte_memzone_dump(stdout);
 	else if (!strcmp(res->dump, "dump_log_history"))
-		rte_log_dump_history();
+		rte_log_dump_history(stdout);
 	else if (!strcmp(res->dump, "dump_struct_sizes"))
 		dump_struct_sizes();
 	else if (!strcmp(res->dump, "dump_ring"))
-		rte_ring_list_dump();
+		rte_ring_list_dump(stdout);
 	else if (!strcmp(res->dump, "dump_mempool"))
-		rte_mempool_list_dump();
+		rte_mempool_list_dump(stdout);
 	else if (!strcmp(res->dump, "dump_devargs"))
-		rte_eal_devargs_dump();
+		rte_eal_devargs_dump(stdout);
 }
 
 cmdline_parse_token_string_t cmd_dump_dump =
@@ -5077,7 +5077,7 @@ static void cmd_dump_one_parsed(void *pa
 			cmdline_printf(cl, "Cannot find ring\n");
 			return;
 		}
-		rte_ring_dump(r);
+		rte_ring_dump(stdout, r);
 	} else if (!strcmp(res->dump, "dump_mempool")) {
 		struct rte_mempool *mp;
 		mp = rte_mempool_lookup(res->name);
@@ -5085,7 +5085,7 @@ static void cmd_dump_one_parsed(void *pa
 			cmdline_printf(cl, "Cannot find mempool\n");
 			return;
 		}
-		rte_mempool_dump(mp);
+		rte_mempool_dump(stdout, mp);
 	}
 }
 
--- a/app/test/test_memory.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/test/test_memory.c	2014-05-02 16:31:16.427593355 -0700
@@ -63,7 +63,7 @@ test_memory(void)
 	 * that at least one line is dumped
 	 */
 	printf("Dump memory layout\n");
-	rte_dump_physmem_layout();
+	rte_dump_physmem_layout(stdout);
 
 	/* check that memory size is != 0 */
 	s = rte_eal_get_physmem_size();
--- a/lib/librte_eal/common/eal_common_tailqs.c	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_eal/common/eal_common_tailqs.c	2014-05-02 16:31:16.427593355 -0700
@@ -108,7 +108,7 @@ rte_eal_tailq_reserve_by_idx(const unsig
 }
 
 void
-rte_dump_tailq(void)
+rte_dump_tailq(FILE *f)
 {
 	struct rte_mem_config *mcfg;
 	unsigned i = 0;
@@ -120,7 +120,7 @@ rte_dump_tailq(void)
 		const struct rte_tailq_head *tailq = &mcfg->tailq_head[i];
 		const struct rte_dummy_head *head = &tailq->tailq_head;
 
-		printf("Tailq %u: qname:<%s>, tqh_first:%p, tqh_last:%p\n", i,
+		fprintf(f, "Tailq %u: qname:<%s>, tqh_first:%p, tqh_last:%p\n", i,
 		       (rte_tailq_names[i] != NULL ? rte_tailq_names[i]:"nil"),
 		       head->tqh_first, head->tqh_last);
 	}
--- a/lib/librte_eal/common/include/rte_tailq.h	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_eal/common/include/rte_tailq.h	2014-05-02 16:31:16.427593355 -0700
@@ -170,8 +170,11 @@ struct rte_tailq_head *rte_eal_tailq_res
 
 /**
  * Dump tail queues to the console.
+ *
+ * @param f
+ *   A pointer to a file for output
  */
-void rte_dump_tailq(void);
+void rte_dump_tailq(FILE *f);
 
 /**
  * Lookup for a tail queue.
--- a/lib/librte_eal/common/eal_common_hexdump.c	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_eal/common/eal_common_hexdump.c	2014-05-02 16:31:16.427593355 -0700
@@ -53,13 +53,13 @@
 */
 
 void
-rte_hexdump(const char * title, const void * buf, unsigned int len)
+rte_hexdump(FILE *f, const char * title, const void * buf, unsigned int len)
 {
     unsigned int i, out, ofs;
     const unsigned char *data = buf;
     char line[LINE_LEN];    /* space needed 8+16*3+3+16 == 75 */
 
-    printf("%s at [%p], len=%u\n", (title)? title  : "  Dump data", data, len);
+    fprintf(f, "%s at [%p], len=%u\n", (title)? title  : "  Dump data", data, len);
     ofs = 0;
     while (ofs < len) {
         /* format the line in the buffer, then use printf to output to screen */
@@ -74,9 +74,9 @@ rte_hexdump(const char * title, const vo
                 c = '.';
             out += rte_snprintf(line+out, LINE_LEN - out, "%c", c);
         }
-        printf("%s\n", line);
+        fprintf(f, "%s\n", line);
     }
-    fflush(stdout);
+    fflush(f);
 }
 
 /**************************************************************************//**
@@ -92,20 +92,20 @@ rte_hexdump(const char * title, const vo
 */
 
 void
-rte_memdump(const char * title, const void * buf, unsigned int len)
+rte_memdump(FILE *f, const char * title, const void * buf, unsigned int len)
 {
     unsigned int i, out;
     const unsigned char *data = buf;
     char line[LINE_LEN];
 
     if ( title )
-    	printf("%s: ", title);
+	fprintf(f, "%s: ", title);
 
     line[0] = '\0';
     for (i = 0, out = 0; i < len; i++) {
     	// Make sure we do not overrun the line buffer length.
 		if ( out >= (LINE_LEN - 4) ) {
-			printf("%s", line);
+			fprintf(f, "%s", line);
 			out = 0;
 			line[out] = '\0';
 		}
@@ -113,9 +113,9 @@ rte_memdump(const char * title, const vo
 				(data[i] & 0xff), ((i+1) < len)? ":" : "");
     }
     if ( out > 0 )
-    	printf("%s", line);
-   	printf("\n");
+	fprintf(f, "%s", line);
+    fprintf(f, "\n");
 
-    fflush(stdout);
+    fflush(f);
 }
 
--- a/lib/librte_eal/common/eal_common_pci.c	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_eal/common/eal_common_pci.c	2014-05-02 16:31:16.427593355 -0700
@@ -171,18 +171,18 @@ rte_eal_pci_probe(void)
 
 /* dump one device */
 static int
-pci_dump_one_device(struct rte_pci_device *dev)
+pci_dump_one_device(FILE *f, struct rte_pci_device *dev)
 {
 	int i;
 
-	printf(PCI_PRI_FMT, dev->addr.domain, dev->addr.bus,
+	fprintf(f, PCI_PRI_FMT, dev->addr.domain, dev->addr.bus,
 	       dev->addr.devid, dev->addr.function);
-	printf(" - vendor:%x device:%x\n", dev->id.vendor_id,
+	fprintf(f, " - vendor:%x device:%x\n", dev->id.vendor_id,
 	       dev->id.device_id);
 
 	for (i = 0; i != sizeof(dev->mem_resource) /
 		sizeof(dev->mem_resource[0]); i++) {
-		printf("   %16.16"PRIx64" %16.16"PRIx64"\n",
+		fprintf(f, "   %16.16"PRIx64" %16.16"PRIx64"\n",
 			dev->mem_resource[i].phys_addr, 
 			dev->mem_resource[i].len);
 	}
@@ -191,12 +191,12 @@ pci_dump_one_device(struct rte_pci_devic
 
 /* dump devices on the bus */
 void
-rte_eal_pci_dump(void)
+rte_eal_pci_dump(FILE *f)
 {
 	struct rte_pci_device *dev = NULL;
 
 	TAILQ_FOREACH(dev, &pci_device_list, next) {
-		pci_dump_one_device(dev);
+		pci_dump_one_device(f, dev);
 	}
 }
 
--- a/lib/librte_eal/common/include/rte_hexdump.h	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_eal/common/include/rte_hexdump.h	2014-05-02 16:31:16.427593355 -0700
@@ -46,6 +46,8 @@ extern "C" {
 /**
 * Dump out memory in a special hex dump format.
 *
+* @param f
+*   		A pointer to a file for output
 * @param title
 * 		If not NULL this string is printed as a header to the output.
 * @param buf
@@ -57,11 +59,13 @@ extern "C" {
 */
 
 extern void
-rte_hexdump(const char * title, const void * buf, unsigned int len);
+rte_hexdump(FILE *f, const char * title, const void * buf, unsigned int len);
 
 /**
 * Dump out memory in a hex format with colons between bytes.
 *
+* @param f
+*   		A pointer to a file for output
 * @param title
 * 		If not NULL this string is printed as a header to the output.
 * @param buf
@@ -73,7 +77,7 @@ rte_hexdump(const char * title, const vo
 */
 
 void
-rte_memdump(const char * title, const void * buf, unsigned int len);
+rte_memdump(FILE *f, const char * title, const void * buf, unsigned int len);
 
 
 #ifdef __cplusplus
--- a/lib/librte_eal/common/include/rte_pci.h	2014-05-02 16:31:16.431593380 -0700
+++ b/lib/librte_eal/common/include/rte_pci.h	2014-05-02 16:31:16.427593355 -0700
@@ -271,8 +271,11 @@ int rte_eal_pci_probe(void);
 
 /**
  * Dump the content of the PCI bus.
+ *
+ * @param f
+ *   A pointer to a file for output
  */
-void rte_eal_pci_dump(void);
+void rte_eal_pci_dump(FILE *f);
 
 /**
  * Register a PCI driver.
--- a/app/test/test_common.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/test/test_common.c	2014-05-02 16:31:16.427593355 -0700
@@ -83,8 +83,8 @@ test_misc(void)
 	if (rte_bsf32(129))
 		FAIL("rte_bsf32");
 
-	rte_memdump("test", memdump, sizeof(memdump));
-	rte_hexdump("test", memdump, sizeof(memdump));
+	rte_memdump(stdout, "test", memdump, sizeof(memdump));
+	rte_hexdump(stdout, "test", memdump, sizeof(memdump));
 
 	rte_pause();
 
--- a/app/test/test_pci.c	2014-05-02 16:31:16.431593380 -0700
+++ b/app/test/test_pci.c	2014-05-02 16:31:16.427593355 -0700
@@ -153,7 +153,7 @@ test_pci(void)
 	struct rte_devargs_list save_devargs_list;
 
 	printf("Dump all devices\n");
-	rte_eal_pci_dump();
+	rte_eal_pci_dump(stdout);
 	if (driver_registered == 0) {
 		rte_eal_pci_register(&my_driver);
 		rte_eal_pci_register(&my_driver2);

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

* Re: [dpdk-dev] [PATCH 5/5] add FILE arguement to debug functions
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 5/5] add FILE arguement to debug functions Stephen Hemminger
@ 2014-05-04 12:20   ` Neil Horman
  2014-05-04 20:17     ` Stephen Hemminger
  2014-05-06 12:52   ` Burakov, Anatoly
  1 sibling, 1 reply; 18+ messages in thread
From: Neil Horman @ 2014-05-04 12:20 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

On Fri, May 02, 2014 at 04:42:56PM -0700, Stephen Hemminger wrote:
> The DPDK dump functions are useful for remote debugging of an
> applications. But when application runs as a daemon, stdout
> is typically routed to /dev/null.
> 
> Instead change all these functions to take a stdio FILE * handle
> instead. An application can then use open_memstream() to capture
> the output.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> 
Why not convert these to rte_log calls?  Seems like we already have the
infrastrucutre here, we just need to use it.
Neil

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

* Re: [dpdk-dev] [PATCH 5/5] add FILE arguement to debug functions
  2014-05-04 12:20   ` Neil Horman
@ 2014-05-04 20:17     ` Stephen Hemminger
  2014-05-05 10:53       ` Neil Horman
  0 siblings, 1 reply; 18+ messages in thread
From: Stephen Hemminger @ 2014-05-04 20:17 UTC (permalink / raw)
  To: Neil Horman; +Cc: dev

On Sun, 4 May 2014 08:20:54 -0400
Neil Horman <nhorman@tuxdriver.com> wrote:

> On Fri, May 02, 2014 at 04:42:56PM -0700, Stephen Hemminger wrote:
> > The DPDK dump functions are useful for remote debugging of an
> > applications. But when application runs as a daemon, stdout
> > is typically routed to /dev/null.
> > 
> > Instead change all these functions to take a stdio FILE * handle
> > instead. An application can then use open_memstream() to capture
> > the output.
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > 
> Why not convert these to rte_log calls?  Seems like we already have the
> infrastrucutre here, we just need to use it.
> Neil
> 

Because it is useful to have remote console like functionatlity,
and dumping this to log doesn't work for that.

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

* Re: [dpdk-dev] [PATCH 5/5] add FILE arguement to debug functions
  2014-05-04 20:17     ` Stephen Hemminger
@ 2014-05-05 10:53       ` Neil Horman
  2014-05-06  1:55         ` Stephen Hemminger
  0 siblings, 1 reply; 18+ messages in thread
From: Neil Horman @ 2014-05-05 10:53 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

On Sun, May 04, 2014 at 01:17:50PM -0700, Stephen Hemminger wrote:
> On Sun, 4 May 2014 08:20:54 -0400
> Neil Horman <nhorman@tuxdriver.com> wrote:
> 
> > On Fri, May 02, 2014 at 04:42:56PM -0700, Stephen Hemminger wrote:
> > > The DPDK dump functions are useful for remote debugging of an
> > > applications. But when application runs as a daemon, stdout
> > > is typically routed to /dev/null.
> > > 
> > > Instead change all these functions to take a stdio FILE * handle
> > > instead. An application can then use open_memstream() to capture
> > > the output.
> > > 
> > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > > 
> > Why not convert these to rte_log calls?  Seems like we already have the
> > infrastrucutre here, we just need to use it.
> > Neil
> > 
> 
> Because it is useful to have remote console like functionatlity,
> and dumping this to log doesn't work for that.
> 
Why not?  Looking at it it seems to me that you could get this exact same
functionality by calling rte_openlog_stream(stdout);

Neil

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

* Re: [dpdk-dev] [PATCH 5/5] add FILE arguement to debug functions
  2014-05-05 10:53       ` Neil Horman
@ 2014-05-06  1:55         ` Stephen Hemminger
  2014-05-06 11:04           ` Neil Horman
  0 siblings, 1 reply; 18+ messages in thread
From: Stephen Hemminger @ 2014-05-06  1:55 UTC (permalink / raw)
  To: Neil Horman; +Cc: dev

On Mon, 5 May 2014 06:53:09 -0400
Neil Horman <nhorman@tuxdriver.com> wrote:

> On Sun, May 04, 2014 at 01:17:50PM -0700, Stephen Hemminger wrote:
> > On Sun, 4 May 2014 08:20:54 -0400
> > Neil Horman <nhorman@tuxdriver.com> wrote:
> > 
> > > On Fri, May 02, 2014 at 04:42:56PM -0700, Stephen Hemminger wrote:
> > > > The DPDK dump functions are useful for remote debugging of an
> > > > applications. But when application runs as a daemon, stdout
> > > > is typically routed to /dev/null.
> > > > 
> > > > Instead change all these functions to take a stdio FILE * handle
> > > > instead. An application can then use open_memstream() to capture
> > > > the output.
> > > > 
> > > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > > > 
> > > Why not convert these to rte_log calls?  Seems like we already have the
> > > infrastrucutre here, we just need to use it.
> > > Neil
> > > 
> > 
> > Because it is useful to have remote console like functionatlity,
> > and dumping this to log doesn't work for that.
> > 
> Why not?  Looking at it it seems to me that you could get this exact same
> functionality by calling rte_openlog_stream(stdout);
> 
> Neil
> 

If you have a remote console (per connection) and a thread handling
those requests you want to direct output of a command like 'show mempool'
to respond to that request. An existing file descriptor don't work they are global
no per thread. There is a difference between log and response to request.

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

* Re: [dpdk-dev] [PATCH 4/5] memzone: add iterator function
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 4/5] memzone: add iterator function Stephen Hemminger
@ 2014-05-06  9:17   ` Burakov, Anatoly
  2014-05-07 16:33     ` Stephen Hemminger
  2014-05-16 12:38   ` Olivier MATZ
  1 sibling, 1 reply; 18+ messages in thread
From: Burakov, Anatoly @ 2014-05-06  9:17 UTC (permalink / raw)
  To: Stephen Hemminger, dev

Hi Stephen,

> When doing diagnostic function, it is useful to have a ability to iterate over all
> memzones.
> 

You can already access all memzones through rte_eal_get_configuration()->mem_config.memzone[idx].

Best regards,
Anatoly Burakov
DPDK SW Engineer

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

* Re: [dpdk-dev] [PATCH 5/5] add FILE arguement to debug functions
  2014-05-06  1:55         ` Stephen Hemminger
@ 2014-05-06 11:04           ` Neil Horman
  0 siblings, 0 replies; 18+ messages in thread
From: Neil Horman @ 2014-05-06 11:04 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

On Mon, May 05, 2014 at 06:55:31PM -0700, Stephen Hemminger wrote:
> On Mon, 5 May 2014 06:53:09 -0400
> Neil Horman <nhorman@tuxdriver.com> wrote:
> 
> > On Sun, May 04, 2014 at 01:17:50PM -0700, Stephen Hemminger wrote:
> > > On Sun, 4 May 2014 08:20:54 -0400
> > > Neil Horman <nhorman@tuxdriver.com> wrote:
> > > 
> > > > On Fri, May 02, 2014 at 04:42:56PM -0700, Stephen Hemminger wrote:
> > > > > The DPDK dump functions are useful for remote debugging of an
> > > > > applications. But when application runs as a daemon, stdout
> > > > > is typically routed to /dev/null.
> > > > > 
> > > > > Instead change all these functions to take a stdio FILE * handle
> > > > > instead. An application can then use open_memstream() to capture
> > > > > the output.
> > > > > 
> > > > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > > > > 
> > > > Why not convert these to rte_log calls?  Seems like we already have the
> > > > infrastrucutre here, we just need to use it.
> > > > Neil
> > > > 
> > > 
> > > Because it is useful to have remote console like functionatlity,
> > > and dumping this to log doesn't work for that.
> > > 
> > Why not?  Looking at it it seems to me that you could get this exact same
> > functionality by calling rte_openlog_stream(stdout);
> > 
> > Neil
> > 
> 
> If you have a remote console (per connection) and a thread handling
> those requests you want to direct output of a command like 'show mempool'
> to respond to that request. An existing file descriptor don't work they are global
> no per thread. There is a difference between log and response to request.
> 
ah, sorry, wasn't considering the multiuser case
Neil

> 

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

* Re: [dpdk-dev] [PATCH 5/5] add FILE arguement to debug functions
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 5/5] add FILE arguement to debug functions Stephen Hemminger
  2014-05-04 12:20   ` Neil Horman
@ 2014-05-06 12:52   ` Burakov, Anatoly
  2014-05-16 14:41     ` Thomas Monjalon
  1 sibling, 1 reply; 18+ messages in thread
From: Burakov, Anatoly @ 2014-05-06 12:52 UTC (permalink / raw)
  To: Stephen Hemminger, dev

Hi Stephen,

> The DPDK dump functions are useful for remote debugging of an
> applications. But when application runs as a daemon, stdout
> is typically routed to /dev/null.
> 
> Instead change all these functions to take a stdio FILE * handle
> instead. An application can then use open_memstream() to capture
> the output.
> 

Wouldn't it be better to leave old calls as wrappers with the FILE parameter defaulting to stdout? That way you wouldn't have to change so much code, keep backwards compatibility with old code, and get the additional functionality you need.

Best regards,
Anatoly Burakov
DPDK SW Engineer

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

* Re: [dpdk-dev] [PATCH 4/5] memzone: add iterator function
  2014-05-06  9:17   ` Burakov, Anatoly
@ 2014-05-07 16:33     ` Stephen Hemminger
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Hemminger @ 2014-05-07 16:33 UTC (permalink / raw)
  To: Burakov, Anatoly; +Cc: dev

On Tue, 6 May 2014 09:17:46 +0000
"Burakov, Anatoly" <anatoly.burakov@intel.com> wrote:

> Hi Stephen,
> 
> > When doing diagnostic function, it is useful to have a ability to iterate over all
> > memzones.
> > 
> 
> You can already access all memzones through rte_eal_get_configuration()->mem_config.memzone[idx].
> 
> Best regards,
> Anatoly Burakov
> DPDK SW Engineer
> 

Yes you can look at memzone[idx] to look at individual zones, but there
is no thread safe way to iterate.

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

* Re: [dpdk-dev] [PATCH 3/5] mempool: add walk iterator
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 3/5] mempool: add walk iterator Stephen Hemminger
@ 2014-05-16 12:36   ` Olivier MATZ
  0 siblings, 0 replies; 18+ messages in thread
From: Olivier MATZ @ 2014-05-16 12:36 UTC (permalink / raw)
  To: Stephen Hemminger, dev

Hi Stephen,

> +void rte_mempool_walk(void (*func)(const struct rte_mempool *, void *),
> +		      void *arg)
> +{
> +	struct rte_mempool *mp = NULL;
> +	struct rte_mempool_list *mempool_list;
> +
> +	if ((mempool_list =
> +	     RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_MEMPOOL, rte_mempool_list)) == NULL) {
> +		rte_errno = E_RTE_NO_TAILQ;
> +		return;
> +	}

At the first read, I thought it was better to return -E_RTE_NO_TAILQ
instead of returning void and setting rte_errno. But it seems it's the
usage, for instance in rte_ring_list_dump().

Acked-by: Olivier Matz <olivier.matz@6wind.com>

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

* Re: [dpdk-dev] [PATCH 4/5] memzone: add iterator function
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 4/5] memzone: add iterator function Stephen Hemminger
  2014-05-06  9:17   ` Burakov, Anatoly
@ 2014-05-16 12:38   ` Olivier MATZ
  1 sibling, 0 replies; 18+ messages in thread
From: Olivier MATZ @ 2014-05-16 12:38 UTC (permalink / raw)
  To: Stephen Hemminger, dev

> When doing diagnostic function, it is useful to have a ability
> to iterate over all memzones.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

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

* Re: [dpdk-dev] [PATCH 5/5] add FILE arguement to debug functions
  2014-05-06 12:52   ` Burakov, Anatoly
@ 2014-05-16 14:41     ` Thomas Monjalon
  0 siblings, 0 replies; 18+ messages in thread
From: Thomas Monjalon @ 2014-05-16 14:41 UTC (permalink / raw)
  To: Burakov, Anatoly; +Cc: dev

2014-05-06 12:52, Burakov, Anatoly:
> Hi Stephen,
> 
> > The DPDK dump functions are useful for remote debugging of an
> > applications. But when application runs as a daemon, stdout
> > is typically routed to /dev/null.
> > 
> > Instead change all these functions to take a stdio FILE * handle
> > instead. An application can then use open_memstream() to capture
> > the output.
> 
> Wouldn't it be better to leave old calls as wrappers with the FILE parameter
> defaulting to stdout? That way you wouldn't have to change so much code,
> keep backwards compatibility with old code, and get the additional
> functionality you need.

Refactoring code shouldn't be a problem. We didn't commit for API stability 
yet.

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

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

* Re: [dpdk-dev] [PATCH 0/5] Various patches to 1.6.0r2
  2014-05-02 23:42 [dpdk-dev] [PATCH 0/5] Various patches to 1.6.0r2 Stephen Hemminger
                   ` (4 preceding siblings ...)
  2014-05-02 23:42 ` [dpdk-dev] [PATCH 5/5] add FILE arguement to debug functions Stephen Hemminger
@ 2014-05-16 14:42 ` Thomas Monjalon
  5 siblings, 0 replies; 18+ messages in thread
From: Thomas Monjalon @ 2014-05-16 14:42 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

2014-05-02 16:42, Stephen Hemminger:
> These are updated versions of some of the earlier patches I sent.
> Plus some more changes that are helpful when interacting with
> mempool/zone etc.

commits:
356cb73 mempool: add iterator function
58f8a1d memzone: add iterator function
e5ac7c2 eal: don't inline string functions
591a9d7 add FILE argument to debug functions
c738c6a spelling fixes

Applied for version 1.7.0.

Thanks Stephen
-- 
Thomas

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

end of thread, other threads:[~2014-05-16 14:42 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-02 23:42 [dpdk-dev] [PATCH 0/5] Various patches to 1.6.0r2 Stephen Hemminger
2014-05-02 23:42 ` [dpdk-dev] [PATCH 1/5] spelling fixes Stephen Hemminger
2014-05-02 23:42 ` [dpdk-dev] [PATCH 2/5] dont inline string functions Stephen Hemminger
2014-05-02 23:42 ` [dpdk-dev] [PATCH 3/5] mempool: add walk iterator Stephen Hemminger
2014-05-16 12:36   ` Olivier MATZ
2014-05-02 23:42 ` [dpdk-dev] [PATCH 4/5] memzone: add iterator function Stephen Hemminger
2014-05-06  9:17   ` Burakov, Anatoly
2014-05-07 16:33     ` Stephen Hemminger
2014-05-16 12:38   ` Olivier MATZ
2014-05-02 23:42 ` [dpdk-dev] [PATCH 5/5] add FILE arguement to debug functions Stephen Hemminger
2014-05-04 12:20   ` Neil Horman
2014-05-04 20:17     ` Stephen Hemminger
2014-05-05 10:53       ` Neil Horman
2014-05-06  1:55         ` Stephen Hemminger
2014-05-06 11:04           ` Neil Horman
2014-05-06 12:52   ` Burakov, Anatoly
2014-05-16 14:41     ` Thomas Monjalon
2014-05-16 14:42 ` [dpdk-dev] [PATCH 0/5] Various patches to 1.6.0r2 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).