From patchwork Thu Apr 21 06:57:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kovvuri X-Patchwork-Id: 8896661 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 71868BF29F for ; Thu, 21 Apr 2016 06:56:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 851E22025B for ; Thu, 21 Apr 2016 06:56:44 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 97DC820218 for ; Thu, 21 Apr 2016 06:56:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1at8WG-0008Tm-HX; Thu, 21 Apr 2016 06:55:20 +0000 Received: from mail-pa0-x244.google.com ([2607:f8b0:400e:c03::244]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1at8Vg-0006Vr-Es for linux-arm-kernel@lists.infradead.org; Thu, 21 Apr 2016 06:54:45 +0000 Received: by mail-pa0-x244.google.com with SMTP id yl2so3181533pac.1 for ; Wed, 20 Apr 2016 23:54:24 -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=NmZS/b7223m2JsjNDO5DHbFmIKJGs5PnsvrnNvNtnnc=; b=gawwTdexMnuFSI92rC3ikvztJo5A41Wj7MPfl58mPuhRdUH0Ls7wp88TePwxH3cRM2 x4pOdJCoYE/dilRoPrbwmidtmfa1qEaupWxFr4vGEvbUuWS18wC+ZYVQ9EM66RwZT+N3 WgCv8va4KlO7QWVkXgTSv6+86B61lsdTVBR8U0lPg2XBL3sJKLeZWl8mlYyjXklwzOCo xV2xnJWUzaHmMbb5L63skU+zgk8OmOk0O8Y0PTYh2hQfAZTWD2CwezxrCi3cuRYU9dgC bJZO5ueapqDOguTahM+oZ6paElQiQfx4HsDpLz/nJtcd59gGi4TNx0nG4FO2XNfgUCeH 4xmg== 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=NmZS/b7223m2JsjNDO5DHbFmIKJGs5PnsvrnNvNtnnc=; b=k7s0HkUnM5JgDBJeDTAJX3iPmKiDYl7b8RlWyeN11fqEK46j1K0p8PlwTRRo+xXiEe 60K3u12089EMJ8eNXjT5vlzadoR+ZuFH+XcKaV09LC55aFJegW5Jp+Jyu9TBOcEkkzcE kaT0XoXw1RCh0FF4r/PH4gsSC5LU4OFrt8wbZyCBi84+WK9Z72AmEexw2DSA4xPJMVg0 qtBI1Yz0wi9Ng/j6jhnlWlrmuTVu8vRM6dIKLvVaI3UaoczDRFRyRN05Z585Bn+WZ3ME t5UwH0FjjefTHj3T2ZJuPI4j+1z7jovZS2/CjlCwe5jo/SK+uPcl5WZ68Hs3aDpK7/0Q RefQ== X-Gm-Message-State: AOPr4FWCPhVffkMmb5J8qVGIV8Z4EzF8OxS1RKFR2Me3tUrnVCDtT5e0IH7TkclXTP0DHQ== X-Received: by 10.66.88.104 with SMTP id bf8mr18340282pab.129.1461221663750; Wed, 20 Apr 2016 23:54:23 -0700 (PDT) Received: from localhost.localdomain ([14.140.2.178]) by smtp.googlemail.com with ESMTPSA id n74sm2043963pfa.45.2016.04.20.23.54.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Apr 2016 23:54:22 -0700 (PDT) From: sunil.kovvuri@gmail.com To: netdev@vger.kernel.org Subject: [PATCH v2 4/4] net: thunderx: Improvement for MBX interface debug messages Date: Thu, 21 Apr 2016 12:27:52 +0530 Message-Id: <1461221872-38841-5-git-send-email-sunil.kovvuri@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1461221872-38841-1-git-send-email-sunil.kovvuri@gmail.com> References: <1461221872-38841-1-git-send-email-sunil.kovvuri@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160420_235444_703330_8A5D995B X-CRM114-Status: GOOD ( 14.15 ) X-Spam-Score: -2.7 (--) 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 , sgoutham@cavium.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robert.richter@caviumnetworks.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.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 02e9a75..6c99257 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c @@ -822,7 +822,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: @@ -832,8 +832,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); @@ -875,8 +874,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]); @@ -936,10 +937,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 87d0f56..12ea73a 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c @@ -134,15 +134,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; }