Skip to contentSkip to conversation

Various patches to 1.6.0r2

PATCH In review Stephen Hemminger 5 participants 18 messages May 2, 2014 – May 16, 2014 10 messages not in the archive

lore
Share & tools
lore
#0 lore raw

cover Various patches to 1.6.0r2

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.

#1 lore raw

PATCH 1/5 spelling fixes

---
 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(-)
lib/librte_eal/bsdapp/eal/eal.c +1 -1
@@ -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)
 {
lib/librte_eal/bsdapp/eal/include/exec-env/rte_kni_common.h +1 -1
@@ -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 {
lib/librte_eal/common/include/i686/arch/rte_atomic.h +5 -5
@@ -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)
 {
lib/librte_eal/common/include/rte_atomic.h +5 -5
@@ -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)
 {
lib/librte_eal/common/include/rte_eal.h +1 -1
@@ -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.
lib/librte_eal/common/include/rte_interrupts.h +1 -1
@@ -45,7 +45,7 @@
 extern "C" {
 #endif
 
-/** Interupt handle */
+/** Interrupt handle */
 struct rte_intr_handle;
 
 /** Function to be registered for the specific interrupt */
lib/librte_eal/linuxapp/eal/eal.c +1 -1
@@ -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)
lib/librte_eal/linuxapp/eal/eal_interrupts.c +2 -2
@@ -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",
lib/librte_eal/linuxapp/eal/eal_memory.c +1 -1
@@ -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
lib/librte_eal/linuxapp/eal/eal_xen_memory.c +1 -1
@@ -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
lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h +1 -1
@@ -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 {
lib/librte_eal/linuxapp/igb_uio/igb_uio.c +1 -1
@@ -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)
lib/librte_eal/linuxapp/kni/ethtool/igb/e1000_mbx.c +1 -1
@@ -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)
 {
lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h +1 -1
@@ -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
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c +1 -1
@@ -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;
 
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ptp.c +1 -1
@@ -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.
  *
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_vmdq.c +2 -2
@@ -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;
lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h +1 -1
@@ -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.
  */
lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c +1 -1
@@ -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) {
lib/librte_kni/rte_kni.h +2 -2
@@ -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 
lib/librte_mempool/rte_mempool.c +2 -2
@@ -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;
lib/librte_mempool/rte_mempool.h +4 -4
@@ -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.
lib/librte_pmd_e1000/e1000/e1000_82571.c +1 -1
@@ -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.
lib/librte_pmd_e1000/e1000/e1000_mbx.c +2 -2
@@ -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)
lib/librte_pmd_e1000/em_ethdev.c +1 -1
@@ -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
lib/librte_pmd_e1000/em_rxtx.c +1 -1
@@ -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.
 		 */
lib/librte_pmd_e1000/igb_ethdev.c +1 -1
@@ -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
lib/librte_pmd_ixgbe/ixgbe/ixgbe_mbx.c +2 -2
@@ -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)
lib/librte_pmd_ixgbe/ixgbe_bypass.c +3 -3
@@ -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);
 
lib/librte_pmd_ixgbe/ixgbe_bypass_api.h +2 -2
@@ -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.
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -1
@@ -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.
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -1
@@ -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);
lib/librte_pmd_ixgbe/ixgbe_rxtx.h +2 -2
@@ -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. */
lib/librte_pmd_ring/rte_eth_ring.c +1 -1
@@ -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)
lib/librte_pmd_virtio/virtio_rxtx.c +1 -1
@@ -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
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +1 -1
@@ -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;
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c +1 -1
@@ -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)
lib/librte_ring/rte_ring.h +1 -1
@@ -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))
#2 lore raw

PATCH 2/5 dont inline string functions

In reply to Stephen Hemminger

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

---
 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(-)
lib/librte_eal/bsdapp/eal/Makefile +1 -0
@@ -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
lib/librte_eal/common/eal_common_string_fns.c new file +96 -0

96 lines not on this page · raw message

lib/librte_eal/common/include/rte_string_fns.h +4 -53

71 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/Makefile +1 -0
@@ -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
#3 lore raw

PATCH 3/5 mempool: add walk iterator

In reply to Stephen Hemminger

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

lib/librte_mempool/rte_mempool.c +21 -0
@@ -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);
+}
lib/librte_mempool/rte_mempool.h +11 -0
@@ -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

A message that is not in the archive (sent off-list or not yet received): [email protected]

Acked-by
#5 lore raw

Re: [PATCH 3/5] mempool: add walk iterator

Hi Stephen,

lib/librte_mempool/rte_mempool.c rte_mempool_lookup(const char *name) · line 871

Quoted 11 lines
lib/librte_mempool/rte_mempool.c +11 -0
+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().

#6 lore raw

PATCH 4/5 memzone: add iterator function

In reply to Stephen Hemminger

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

lib/librte_eal/common/eal_common_memzone.c +17 -0
@@ -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);
+}
lib/librte_eal/common/include/rte_memzone.h +11 -0
@@ -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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

Re: [PATCH 4/5] memzone: add iterator function

Hi Stephen,

Quoted 3 lines

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

A message that is not in the archive (sent off-list or not yet received): C6ECDF3AB251BE4894318F4E45123697592AB62B-kPTMFJFq+rF9qrmMLTLiibfspsVTdybXVpNB7YpNyf8@public.gmane.org

#10 lore raw

Re: [PATCH 4/5] memzone: add iterator function

Quoted 6 lines · Anatoly

Hi Stephen,

Quoted 3 lines

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

Quoted 6 lines

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.

#12 lore raw

PATCH 5/5 add FILE arguement to debug functions

In reply to Stephen Hemminger

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.

---
 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(-)
app/test/commands.c +8 -8
@@ -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);
 	}
 }
 
app/test/test_ivshmem.c +2 -2
@@ -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;
 }
app/test/test_logs.c +1 -1
@@ -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;
 }
app/test/test_malloc.c +4 -4
@@ -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;
 }
 
app/test/test_mbuf.c +7 -7
@@ -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);
app/test/test_mempool.c +7 -7
@@ -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;
 }
app/test/test_mempool_perf.c +3 -3
@@ -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;
 }
app/test/test_ring.c +21 -21

114 lines not on this page · raw message

app/test/test_timer.c +1 -1
@@ -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;
 }
app/test-pmd/testpmd.c +1 -1
@@ -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);
 	}
 }
 
examples/l2fwd-ivshmem/host/host.c +1 -1
@@ -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;
 }
 
lib/librte_eal/common/eal_common_log.c +4 -4
@@ -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);
 }
lib/librte_eal/common/include/rte_log.h +5 -2
@@ -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.
lib/librte_ivshmem/rte_ivshmem.c +4 -5
@@ -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
lib/librte_ivshmem/rte_ivshmem.h +3 -1
@@ -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
lib/librte_malloc/rte_malloc.c +8 -8
@@ -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;
 }
lib/librte_malloc/rte_malloc.h +4 -1
@@ -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.
lib/librte_mbuf/rte_mbuf.c +5 -5
@@ -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 --;
lib/librte_mbuf/rte_mbuf.h +3 -1
@@ -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
 }
lib/librte_mempool/rte_mempool.c +36 -36

132 lines not on this page · raw message

lib/librte_mempool/rte_mempool.h +8 -2
@@ -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
lib/librte_ring/rte_ring.c +26 -26

84 lines not on this page · raw message

lib/librte_ring/rte_ring.h +8 -2
@@ -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
lib/librte_timer/rte_timer.c +7 -7
@@ -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
 }
lib/librte_timer/rte_timer.h +5 -1
@@ -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
 }
app/dump_cfg/main.c +3 -3
@@ -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;
app/test/test_memzone.c +16 -16
@@ -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");
lib/librte_eal/common/eal_common_devargs.c +6 -6
@@ -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);
 	}
 }
lib/librte_eal/common/eal_common_memory.c +2 -2
@@ -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,
lib/librte_eal/common/eal_common_memzone.c +2 -2
@@ -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,
lib/librte_eal/common/include/rte_devargs.h +5 -1
@@ -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
 }
lib/librte_eal/common/include/rte_memory.h +4 -1
@@ -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.
lib/librte_eal/common/include/rte_memzone.h +5 -1
@@ -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
lib/librte_eal/linuxapp/eal/eal_ivshmem.c +2 -2
@@ -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;
app/test-pmd/cmdline.c +8 -8
@@ -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);
 	}
 }
 
app/test/test_memory.c +1 -1
@@ -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();
lib/librte_eal/common/eal_common_tailqs.c +2 -2
@@ -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);
 	}
lib/librte_eal/common/include/rte_tailq.h +4 -1
@@ -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.
lib/librte_eal/common/eal_common_hexdump.c +10 -10
@@ -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);
 }
 
lib/librte_eal/common/eal_common_pci.c +6 -6
@@ -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);
 	}
 }
 
lib/librte_eal/common/include/rte_hexdump.h +6 -2
@@ -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
lib/librte_eal/common/include/rte_pci.h +4 -1
@@ -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.
app/test/test_common.c +2 -2
@@ -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();
 
app/test/test_pci.c +1 -1
@@ -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);

A message that is not in the archive (sent off-list or not yet received): [email protected]

#14 lore raw

Re: [PATCH 5/5] add FILE arguement to debug functions

Quoted 10 lines · Stephen Hemminger

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.

Why not convert these to rte_log calls? Seems like we already have the infrastrucutre here, we just need to use it.
Neil

A message that is not in the archive (sent off-list or not yet received): 20140504122053.GA5012-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]

#16 lore raw

Re: [PATCH 5/5] add FILE arguement to debug functions

Quoted 9 lines · On Sun, 4 May 2014 08:20:54 -0400 Neil Horman…
Quoted 8 lines · Stephen Hemminger

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.

Quoted 6 lines
Quoted 2 lines

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.

A message that is not in the archive (sent off-list or not yet received): 20140504131750.45409335-We1ePj4FEcvRI77zikRAJc56i+j3xesD0e7PPNI6Mm0@public.gmane.org

#18 lore raw

Re: [PATCH 5/5] add FILE arguement to debug functions

Quoted 14 lines · Stephen Hemminger
Quoted 11 lines · On Sun, 4 May 2014 08:20:54 -0400 Neil Horman…
Quoted 10 lines · Stephen Hemminger

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.

Quoted 8 lines
Quoted 4 lines

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

A message that is not in the archive (sent off-list or not yet received): 20140505105309.GD16114-B26myB8xz7F8NnZeBjwnZQMhkBWG/[email protected]

#20 lore raw

Re: [PATCH 5/5] add FILE arguement to debug functions

Quoted 20 lines · On Mon, 5 May 2014 06:53:09 -0400 Neil Horman…
Quoted 19 lines · Stephen Hemminger
Quoted 15 lines · On Sun, 4 May 2014 08:20:54 -0400 Neil Horman…
Quoted 10 lines · Stephen Hemminger

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.

Why not convert these to rte_log calls? Seems like we already have the infrastrucutre here, we just need to use it.
Neil

Quoted 8 lines
Quoted 3 lines

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.

A message that is not in the archive (sent off-list or not yet received): 20140505185531.4dbd94d4-We1ePj4FEcvRI77zikRAJc56i+j3xesD0e7PPNI6Mm0@public.gmane.org

#22 lore raw

Re: [PATCH 5/5] add FILE arguement to debug functions

Quoted 29 lines · Stephen Hemminger
Quoted 26 lines · On Mon, 5 May 2014 06:53:09 -0400 Neil Horman…
Quoted 14 lines · Stephen Hemminger
Quoted 11 lines · On Sun, 4 May 2014 08:20:54 -0400 Neil Horman…
Quoted 10 lines · Stephen Hemminger

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.

Quoted 8 lines
Quoted 4 lines

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);

Quoted 8 lines
Quoted 2 lines

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

Quoted 1 line
#23 lore raw

Re: [PATCH 5/5] add FILE arguement to debug functions

In reply to a message not in the archive

Hi Stephen,

Quoted 8 lines

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

A message that is not in the archive (sent off-list or not yet received): C6ECDF3AB251BE4894318F4E45123697592AB70B-kPTMFJFq+rF9qrmMLTLiibfspsVTdybXVpNB7YpNyf8@public.gmane.org

#25 lore raw

Re: [PATCH 5/5] add FILE arguement to debug functions

2014-05-06 12:52, Burakov, Anatoly:

Quoted 6 lines

Hi Stephen,

Quoted 4 lines

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.

Quoted 8 lines
Quoted 3 lines

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.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#27 lore raw

2014-05-02 16:42, Stephen Hemminger:

Quoted 3 lines

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

Signature · 1 line
Thomas