From patchwork Tue Apr 19 13:33:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kovvuri X-Patchwork-Id: 8880061 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4F5849F1C1 for ; Tue, 19 Apr 2016 13:32:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 53C0A2026D for ; Tue, 19 Apr 2016 13:32:05 +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 4306020263 for ; Tue, 19 Apr 2016 13:32:04 +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 1asVjj-0003ql-IF; Tue, 19 Apr 2016 13:30:39 +0000 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1asVja-0003YO-Ca for linux-arm-kernel@lists.infradead.org; Tue, 19 Apr 2016 13:30:31 +0000 Received: by mail-pf0-x241.google.com with SMTP id r187so1838561pfr.2 for ; Tue, 19 Apr 2016 06:30:10 -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=Pvr000KWTYfR8GNFsh4fCBev2XBGVr+VjvhTPNqJpZU=; b=BgQw4pN+twOBV8cCvBq58bzmkgr109v1XSeH4AYb2KTNLeiVielaugLImUeHvjCuFI v5whTucdgs5ACTxKg9bN5j9/yz1Cr9Epo2o8rf8HD+FBDThtYZPKjXp7JFr8A4sM6dHL q5V/TUinClOwmbDNeGXDf9RaENPvJEDzDop4Ln0LKiNCefLghFWmqopFgOcUtim7QWdu 4eMoIvAZGH2LkhVschNS5hF3gH/RMKOHBPGcJwUyJqPifnRqIF9asheAVJoaHlZJ6hrE uDgJuiXcA/e0IQlA2tZQ+pobAovyDEj3Pwvx5OaNmuSwtZGbIHeq0EUMOR1o+Ds1jGnX zA5Q== 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=Pvr000KWTYfR8GNFsh4fCBev2XBGVr+VjvhTPNqJpZU=; b=ffC+rDzIkh7WiD9JSVJAQhIZhPgrvBLrh0jyJqwgAJGCCFCOiMYlDryhcT8Cq4kAAl BUzPYCTXi/k2+dl7Fk1eRhzCagG0WlGfaGlniJQ9dM4uwe+CkVVw1HE1SHy+Rz4cw2xN JcuM9L3moYVYRslAFb/5vpRDWgVqU9s9IfCy+34Ud8XOZkC+uNKKxDYGQft//vw3eM7Z TyQsNADLyzOx8EFZV2dC4nZKni1w4WAs9o6M1IHsFaLcibYh5OWjzU3DzB7ng7DVqeJS R/iYkyid2hQn9qLPe3+dheQQllNiWOQ3MldLLsfFMgWbfZtxf+qurcAmsUvupuonsgB/ yuPw== X-Gm-Message-State: AOPr4FVLIbGvz3Mx8EnS3+6Z2ebqdqTT2KHY9WtF2uCEjTRKgO3GA4iIv0Y4pX7qoWqSwA== X-Received: by 10.98.82.134 with SMTP id g128mr4075812pfb.113.1461072609888; Tue, 19 Apr 2016 06:30:09 -0700 (PDT) Received: from localhost.localdomain ([14.140.2.178]) by smtp.googlemail.com with ESMTPSA id s66sm91180360pfi.3.2016.04.19.06.30.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Apr 2016 06:30:09 -0700 (PDT) From: sunil.kovvuri@gmail.com To: netdev@vger.kernel.org Subject: [PATCH 4/4] net: thunderx: Improvement for MBX interface debug messages Date: Tue, 19 Apr 2016 19:03:32 +0530 Message-Id: <1461072812-44239-5-git-send-email-sunil.kovvuri@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1461072812-44239-1-git-send-email-sunil.kovvuri@gmail.com> References: <1461072812-44239-1-git-send-email-sunil.kovvuri@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160419_063030_487819_A3AF7F69 X-CRM114-Status: GOOD ( 14.49 ) 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 e2d8db9..550a950 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c @@ -820,7 +820,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: @@ -830,8 +830,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); @@ -873,8 +872,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]); @@ -934,10 +935,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; }