From patchwork Wed Mar 1 00:11:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satish Kharat X-Patchwork-Id: 9597387 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 F005A60414 for ; Wed, 1 Mar 2017 03:27:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E740527F99 for ; Wed, 1 Mar 2017 03:27:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB1CD28452; Wed, 1 Mar 2017 03:27:17 +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=-14.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65BD526E96 for ; Wed, 1 Mar 2017 03:27:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751527AbdCAD1P (ORCPT ); Tue, 28 Feb 2017 22:27:15 -0500 Received: from alln-iport-7.cisco.com ([173.37.142.94]:48188 "EHLO alln-iport-7.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751473AbdCAD1O (ORCPT ); Tue, 28 Feb 2017 22:27:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2173; q=dns/txt; s=iport; t=1488338833; x=1489548433; h=from:to:cc:subject:date:message-id; bh=oaDL2jCFUjLG400nMhFuIXdZTYee7lz/tDMyt/9pfms=; b=TgudTKjemiFlv6a2iii2kqPU5oft1Ds8WcDnOC2dWclpkV13XLSK1ZtX cl66ur+3kE0WAQTMsVJbdgyHUVygYJkb1qjENww5a99PQBBdLqNu2lQzB wWKlIc9Y8ZER4/TaBb6QgU4SA/9FfqbwD7mlDSuVFK8dnvtRjX76UE02G I=; X-IronPort-AV: E=Sophos;i="5.35,222,1484006400"; d="scan'208";a="391732532" Received: from alln-core-3.cisco.com ([173.36.13.136]) by alln-iport-7.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 01 Mar 2017 00:12:02 +0000 Received: from satishkh.cisco.com ([10.157.132.70]) by alln-core-3.cisco.com (8.14.5/8.14.5) with ESMTP id v210C1th011638; Wed, 1 Mar 2017 00:12:02 GMT From: Satish Kharat To: linux-scsi@vger.kernel.org Cc: satishkh@cisco.com, sebaddel@cisco.com, Satish Kharat Subject: [PATCH 1/1] fnic: Ratelimit printks to avoid flooding when vlan is not set by the switch.i Date: Tue, 28 Feb 2017 16:11:57 -0800 Message-Id: <1488327117-8574-1-git-send-email-satishkh@cisco.com> X-Mailer: git-send-email 2.5.5 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Satish Kharat This is to avoid the log from being filled with vlan discovery messages when there is no vlan configured on the switch. Signed-off-by: Satish Kharat Signed-off-by: Sesidhar Baddela --- drivers/scsi/fnic/fnic_fcs.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic_fcs.c index 3b7da66..8d2d86e 100644 --- a/drivers/scsi/fnic/fnic_fcs.c +++ b/drivers/scsi/fnic/fnic_fcs.c @@ -342,8 +342,11 @@ static void fnic_fcoe_send_vlan_req(struct fnic *fnic) fnic_fcoe_reset_vlans(fnic); fnic->set_vlan(fnic, 0); - FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, - "Sending VLAN request...\n"); + + if (printk_ratelimit()) + FNIC_FCS_DBG(KERN_INFO, fnic->lport->host, + "Sending VLAN request...\n"); + skb = dev_alloc_skb(sizeof(struct fip_vlan)); if (!skb) return; @@ -1313,10 +1316,11 @@ void fnic_handle_fip_timer(struct fnic *fnic) spin_lock_irqsave(&fnic->vlans_lock, flags); if (list_empty(&fnic->vlans)) { - /* no vlans available, try again */ - FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, - "Start VLAN Discovery\n"); spin_unlock_irqrestore(&fnic->vlans_lock, flags); + /* no vlans available, try again */ + if (printk_ratelimit()) + FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, + "Start VLAN Discovery\n"); fnic_event_enq(fnic, FNIC_EVT_START_VLAN_DISC); return; } @@ -1332,10 +1336,11 @@ void fnic_handle_fip_timer(struct fnic *fnic) spin_unlock_irqrestore(&fnic->vlans_lock, flags); break; case FIP_VLAN_FAILED: - /* if all vlans are in failed state, restart vlan disc */ - FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, - "Start VLAN Discovery\n"); spin_unlock_irqrestore(&fnic->vlans_lock, flags); + /* if all vlans are in failed state, restart vlan disc */ + if (printk_ratelimit()) + FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, + "Start VLAN Discovery\n"); fnic_event_enq(fnic, FNIC_EVT_START_VLAN_DISC); break; case FIP_VLAN_SENT: