From patchwork Fri Jul 15 12:58:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kovvuri X-Patchwork-Id: 9232035 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2F4CF6075D for ; Fri, 15 Jul 2016 13:08:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 190FF27FA4 for ; Fri, 15 Jul 2016 13:08:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DF2E28324; Fri, 15 Jul 2016 13:08:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8CDE227FA4 for ; Fri, 15 Jul 2016 13:08:19 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bO2pP-0008CH-1c; Fri, 15 Jul 2016 13:06:51 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bO2j3-0000xZ-KT for linux-arm-kernel@bombadil.infradead.org; Fri, 15 Jul 2016 13:00:17 +0000 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]) by merlin.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bO2j1-0002lC-Po for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2016 13:00:16 +0000 Received: by mail-pf0-x241.google.com with SMTP id i6so5993549pfe.0 for ; Fri, 15 Jul 2016 05:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HwabEUGVj+5XnbYteJ+l5FQQsDxgAMgqW1Md1gaDE5c=; b=m4Zeizl6lfm3ooEgO7VfxfsI7bIyH3YC/wHWe8sCmi/HmqR58lwsQX0Ft3Fhxl7sMV OhaAbfqWInIe/2+r6SEedfx9YUCdsCO0a+ONXvG25Ht9P6r8YugGFVniVsGDNhwB41bB IF3vVgglW8/SbnwK8mZvkUzIHakGa1zCjkqax4cW2u6XT/2pt9fjNhNllWjpUodKwaF7 eVnWYWPs+8GB3ZGuxkDMEkVmmXVmpR7QrpuKHgNN33JZNay82oUoyyIYrh/Gn3Hg9uNY aLNJXpOXWBuegOFNDyn9fkbdLt5q9xoeCzOUJAHsxi71D9CnZryciaQJ7mRITbYzeHxJ TvjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HwabEUGVj+5XnbYteJ+l5FQQsDxgAMgqW1Md1gaDE5c=; b=mWl4mFPAVKe36ZXBqeBbMqbc2nXNaKHpCObEGmzHVrse+04zaZuYiUxnzKwKEySf/e G3o73PxnPrTtEZSpCXOKMJCHHMN/2jQVcOgF/cljo353FQ80MyVuBAWP0BWz1FdGiMHJ SLEaOiVAIhjuiRU+hyvzISwz8InUAq+PYhtsEvaKscoiOrVj40tuFxLNQuHNziYJ/rSM 9KsjJ58kR2DbH7NjCGNcpYqIWC+detlyVavx2+6UySJiZOw2JLYEJWkpqD5a+lFZQFap tcW9etvswrfK2cwtWLW1hKCSvLjWq6+wJRlwND8N9SpbUjCwSLqcmSXbSBnSdI2/ldbQ A9Aw== X-Gm-Message-State: ALyK8tJoxxl1u5m/MuyXNU8zEQTNVS78KNmnJE7B5Yw+dylJSWma1Xu7PECh7O2aoQlVcw== X-Received: by 10.98.54.134 with SMTP id d128mr4705701pfa.150.1468587593683; Fri, 15 Jul 2016 05:59:53 -0700 (PDT) Received: from machine421.in.caveonetworks.com ([14.140.2.178]) by smtp.googlemail.com with ESMTPSA id t80sm5365880pfj.38.2016.07.15.05.59.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Jul 2016 05:59:52 -0700 (PDT) From: sunil.kovvuri@gmail.com To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 13/15] net: thunderx: Improvement for MBX interface debug messages Date: Fri, 15 Jul 2016 18:28:18 +0530 Message-Id: <1468587500-32103-14-git-send-email-sunil.kovvuri@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1468587500-32103-1-git-send-email-sunil.kovvuri@gmail.com> References: <1468587500-32103-1-git-send-email-sunil.kovvuri@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160715_090015_918835_825464D0 X-CRM114-Status: GOOD ( 14.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Radoslaw Biernacki , Sunil Goutham MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Radoslaw Biernacki Adding debug messages in case of NACK for a mailbox message, also did small cleanups. Signed-off-by: Radoslaw Biernacki Signed-off-by: Sunil Goutham --- 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; }