[dpdk-dev] virtio: prettify log messages

Message ID 1455147934-15060-1-git-send-email-vincent.jardin@6wind.com (mailing list archive)
State Not Applicable, archived
Delegated to: Bruce Richardson
Headers

Commit Message

Vincent Jardin Feb. 10, 2016, 11:45 p.m. UTC
  PMD_TX_LOG() looks better with a \n

Signed-off-by: Vincent JARDIN <vincent.jardin@6wind.com>
---
 drivers/net/virtio/virtio_rxtx.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
  

Comments

Stephen Hemminger Feb. 11, 2016, 1:12 a.m. UTC | #1
On Thu, 11 Feb 2016 00:45:34 +0100
Vincent JARDIN <vincent.jardin@6wind.com> wrote:

> PMD_TX_LOG() looks better with a \n
> 
> Signed-off-by: Vincent JARDIN <vincent.jardin@6wind.com>

NAK. Yes the messages, are messed up, but this is not
the right way to fix it.

The logging wrappers are inconsistent in virtio.
PMD_INIT_LOG adds newline, but RX/TX/DRV do not.

I would rather the macros were aligned with ixgbe which always
adds newline for all the PMD_XXX_LOG() macros. And then remove
all extra newlines in virtio code.
  
Vincent Jardin Feb. 11, 2016, 6:45 a.m. UTC | #2
On 11/02/2016 02:12, Stephen Hemminger wrote:
> I would rather the macros were aligned with ixgbe which always
> adds newline for all the PMD_XXX_LOG() macros. And then remove
> all extra newlines in virtio code.
you right
  

Patch

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 41a1366..c03d36a 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -825,7 +825,7 @@  virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	if (unlikely(nb_pkts < 1))
 		return nb_pkts;
 
-	PMD_TX_LOG(DEBUG, "%d packets to xmit", nb_pkts);
+	PMD_TX_LOG(DEBUG, "%d packets to xmit\n", nb_pkts);
 	nb_used = VIRTQUEUE_NUSED(txvq);
 
 	virtio_rmb();
@@ -847,7 +847,7 @@  virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 			need = txm->nb_segs - txvq->vq_free_cnt + 1;
 			if (unlikely(need > 0)) {
 				PMD_TX_LOG(ERR,
-					   "No free tx descriptors to transmit");
+					   "No free tx descriptors to transmit\n");
 				break;
 			}
 		}
@@ -865,11 +865,11 @@  virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		error = virtqueue_enqueue_xmit(txvq, txm);
 		if (unlikely(error)) {
 			if (error == ENOSPC)
-				PMD_TX_LOG(ERR, "virtqueue_enqueue Free count = 0");
+				PMD_TX_LOG(ERR, "virtqueue_enqueue Free count = 0\n");
 			else if (error == EMSGSIZE)
-				PMD_TX_LOG(ERR, "virtqueue_enqueue Free count < 1");
+				PMD_TX_LOG(ERR, "virtqueue_enqueue Free count < 1\n");
 			else
-				PMD_TX_LOG(ERR, "virtqueue_enqueue error: %d", error);
+				PMD_TX_LOG(ERR, "virtqueue_enqueue error: %d\n", error);
 			break;
 		}
 
@@ -884,7 +884,7 @@  virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		if (unlikely(virtqueue_kick_prepare(txvq))) {
 			virtqueue_notify(txvq);
-			PMD_TX_LOG(DEBUG, "Notified backend after xmit");
+			PMD_TX_LOG(DEBUG, "Notified backend after xmit\n");
 		}
 	}