Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1444298

[PATCH v3 13/15] net: thunderx: Improvement for MBX interface debug messages

From sunil.kovvuri@gmail.com
Newsgroups linux.kernel
Subject [PATCH v3 13/15] net: thunderx: Improvement for MBX interface debug messages
Date 2016-07-15 15:10 +0200
Message-ID <rVb2r-7js-29@gated-at.bofh.it> (permalink)
References <rVaSK-70X-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Radoslaw Biernacki <rad@semihalf.com>

Adding debug messages in case of NACK for a mailbox message, also
did small cleanups.

Signed-off-by: Radoslaw Biernacki <rad@semihalf.com>
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
---
 drivers/net/ethernet/cavium/thunder/nic_main.c   | 16 ++++++++++------
 drivers/net/ethernet/cavium/thunder/nicvf_main.c |  8 ++++++--
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
index 91c575d..f15a54a 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
@@ -790,7 +790,7 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
 		mbx_addr += sizeof(u64);
 	}
 
-	dev_dbg(&nic->pdev->dev, "%s: Mailbox msg %d from VF%d\n",
+	dev_dbg(&nic->pdev->dev, "%s: Mailbox msg 0x%02x from VF%d\n",
 		__func__, mbx.msg.msg, vf);
 	switch (mbx.msg.msg) {
 	case NIC_MBOX_MSG_READY:
@@ -800,8 +800,7 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
 			nic->duplex[vf] = 0;
 			nic->speed[vf] = 0;
 		}
-		ret = 1;
-		break;
+		goto unlock;
 	case NIC_MBOX_MSG_QS_CFG:
 		reg_addr = NIC_PF_QSET_0_127_CFG |
 			   (mbx.qs.num << NIC_QS_ID_SHIFT);
@@ -850,8 +849,10 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
 		nic_tx_channel_cfg(nic, mbx.qs.num, &mbx.sq);
 		break;
 	case NIC_MBOX_MSG_SET_MAC:
-		if (vf >= nic->num_vf_en)
+		if (vf >= nic->num_vf_en) {
+			ret = -1; /* NACK */
 			break;
+		}
 		lmac = mbx.mac.vf_id;
 		bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[lmac]);
 		lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[lmac]);
@@ -906,10 +907,13 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
 		break;
 	}
 
-	if (!ret)
+	if (!ret) {
 		nic_mbx_send_ack(nic, vf);
-	else if (mbx.msg.msg != NIC_MBOX_MSG_READY)
+	} else if (mbx.msg.msg != NIC_MBOX_MSG_READY) {
+		dev_err(&nic->pdev->dev, "NACK for MBOX 0x%02x from VF %d\n",
+			mbx.msg.msg, vf);
 		nic_mbx_send_nack(nic, vf);
+	}
 unlock:
 	nic->mbx_lock[vf] = false;
 }
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index dbb61a8..300416a 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -144,15 +144,19 @@ int nicvf_send_msg_to_pf(struct nicvf *nic, union nic_mbx *mbx)
 
 	/* Wait for previous message to be acked, timeout 2sec */
 	while (!nic->pf_acked) {
-		if (nic->pf_nacked)
+		if (nic->pf_nacked) {
+			netdev_err(nic->netdev,
+				   "PF NACK to mbox msg 0x%02x from VF%d\n",
+				   (mbx->msg.msg & 0xFF), nic->vf_id);
 			return -EINVAL;
+		}
 		msleep(sleep);
 		if (nic->pf_acked)
 			break;
 		timeout -= sleep;
 		if (!timeout) {
 			netdev_err(nic->netdev,
-				   "PF didn't ack to mbox msg %d from VF%d\n",
+				   "PF didn't ACK to mbox msg 0x%02x from VF%d\n",
 				   (mbx->msg.msg & 0xFF), nic->vf_id);
 			return -EBUSY;
 		}
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 00/15] net: thunderx: Add support for 81xx and 83xx sunil.kovvuri@gmail.com - 2016-07-15 15:00 +0200
  [PATCH v3 05/15] net: thunderx: Enable CQE_RX desc's extension fields sunil.kovvuri@gmail.com - 2016-07-15 15:00 +0200
  [PATCH v3 07/15] net: thunderx: Support for different LMAC types within BGX sunil.kovvuri@gmail.com - 2016-07-15 15:00 +0200
  [PATCH v3 10/15] net: thunderx: Add RGMII interface type support sunil.kovvuri@gmail.com - 2016-07-15 15:10 +0200
  [PATCH v3 15/15] net: thunderx: Don't set mac address for secondary Qset VFs sunil.kovvuri@gmail.com - 2016-07-15 15:10 +0200
  [PATCH v3 06/15] net: thunderx: Enable mailbox interrupts on 81xx/83xx sunil.kovvuri@gmail.com - 2016-07-15 15:10 +0200
  [PATCH v3 12/15] net: thunderx: Use skb_add_rx_frag() for split buffer Rx pkts sunil.kovvuri@gmail.com - 2016-07-15 15:10 +0200
  [PATCH v3 08/15] net: thunderx: Add 81xx support to BGX driver sunil.kovvuri@gmail.com - 2016-07-15 15:10 +0200
  [PATCH v3 13/15] net: thunderx: Improvement for MBX interface debug messages sunil.kovvuri@gmail.com - 2016-07-15 15:10 +0200
  [PATCH v3 03/15] net: thunderx: Add support for 81xx and 83xx chips sunil.kovvuri@gmail.com - 2016-07-15 15:10 +0200
  [PATCH v3 11/15] net: thunderx: Use netdev's name for naming VF's interrupts sunil.kovvuri@gmail.com - 2016-07-15 15:10 +0200
  [PATCH v3 14/15] net: thunderx: Reset RXQ HW stats when interface is brought down sunil.kovvuri@gmail.com - 2016-07-15 15:10 +0200
  Re: [PATCH v3 00/15] net: thunderx: Add support for 81xx and 83xx Sunil Kovvuri <sunil.kovvuri@gmail.com> - 2016-07-21 08:00 +0200

csiph-web