From patchwork Wed Apr 24 22:42:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jitendra Kalsaria X-Patchwork-Id: 239332 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 6D6512C00F3 for ; Thu, 25 Apr 2013 09:07:06 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932156Ab3DXXG7 (ORCPT ); Wed, 24 Apr 2013 19:06:59 -0400 Received: from tx2ehsobe005.messaging.microsoft.com ([65.55.88.15]:35711 "EHLO tx2outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757971Ab3DXXG5 (ORCPT ); Wed, 24 Apr 2013 19:06:57 -0400 Received: from mail79-tx2-R.bigfish.com (10.9.14.230) by TX2EHSOBE010.bigfish.com (10.9.40.30) with Microsoft SMTP Server id 14.1.225.23; Wed, 24 Apr 2013 23:06:57 +0000 Received: from mail79-tx2 (localhost [127.0.0.1]) by mail79-tx2-R.bigfish.com (Postfix) with ESMTP id EB57220675; Wed, 24 Apr 2013 23:06:56 +0000 (UTC) X-Forefront-Antispam-Report: CIP:198.70.193.116; KIP:(null); UIP:(null); IPV:NLI; H:avcashub1.qlogic.com; RD:avcashub2.qlogic.com; EFVD:NLI X-SpamScore: 1 X-BigFish: VPS1(zzzz1f42h1fc6h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ahzz8275bhz2ei2a8h668h839hd24he5bhf0ah107ah11b5h121eh1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h14afh1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1b0ah1d0ch1155h) Received-SPF: neutral (mail79-tx2: 198.70.193.116 is neither permitted nor denied by domain of qlogic.com) client-ip=198.70.193.116; envelope-from=jitendra.kalsaria@qlogic.com; helo=avcashub1.qlogic.com ; 1.qlogic.com ; Received: from mail79-tx2 (localhost.localdomain [127.0.0.1]) by mail79-tx2 (MessageSwitch) id 1366844813881601_10134; Wed, 24 Apr 2013 23:06:53 +0000 (UTC) Received: from TX2EHSMHS009.bigfish.com (unknown [10.9.14.235]) by mail79-tx2.bigfish.com (Postfix) with ESMTP id D402844005B; Wed, 24 Apr 2013 23:06:53 +0000 (UTC) Received: from avcashub1.qlogic.com (198.70.193.116) by TX2EHSMHS009.bigfish.com (10.9.99.109) with Microsoft SMTP Server (TLS) id 14.1.225.23; Wed, 24 Apr 2013 23:06:53 +0000 Received: from dut6217.mv.qlogic.com (172.29.56.217) by qlc.com (10.1.4.191) with Microsoft SMTP Server id 14.2.318.1; Wed, 24 Apr 2013 16:06:52 -0700 Received: by dut6217.mv.qlogic.com (Postfix, from userid 0) id 37DCA5220C3; Wed, 24 Apr 2013 18:42:58 -0400 (EDT) From: Jitendra Kalsaria To: CC: , , , , Manish Chopra Subject: [PATCH net-next 1/7] qlcnic: Enhance channel configuration logs Date: Wed, 24 Apr 2013 18:42:39 -0400 Message-ID: <1366843365-2787-2-git-send-email-jitendra.kalsaria@qlogic.com> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1366843365-2787-1-git-send-email-jitendra.kalsaria@qlogic.com> References: <1366843365-2787-1-git-send-email-jitendra.kalsaria@qlogic.com> MIME-Version: 1.0 X-OriginatorOrg: qlogic.com Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Manish Chopra o Add logs for various failure conditions during channel configuration. Signed-off-by: Manish Chopra Signed-off-by: Shahed Shaikh Signed-off-by: Jitendra Kalsaria --- drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 2 +- .../net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 2 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 32 ++++++++++++++++---- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index 8d02dd7..f699cce 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h @@ -1474,7 +1474,7 @@ void qlcnic_diag_free_res(struct net_device *netdev, int max_sds_rings); int qlcnic_diag_alloc_res(struct net_device *netdev, int test); netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev); int qlcnic_set_max_rss(struct qlcnic_adapter *, u8, size_t); -int qlcnic_validate_max_rss(u8, u8); +int qlcnic_validate_max_rss(struct qlcnic_adapter *, __u32); void qlcnic_alloc_lb_filters_mem(struct qlcnic_adapter *adapter); int qlcnic_enable_msix(struct qlcnic_adapter *, u32); diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 9f7aade..59350c2 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c @@ -635,7 +635,7 @@ static int qlcnic_set_channels(struct net_device *dev, channel->tx_count != channel->max_tx) return -EINVAL; - err = qlcnic_validate_max_rss(channel->max_rx, channel->rx_count); + err = qlcnic_validate_max_rss(adapter, channel->rx_count); if (err) return err; diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 247a9f9..0052953 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c @@ -3273,20 +3273,40 @@ qlcnicvf_start_firmware(struct qlcnic_adapter *adapter) return err; } -int qlcnic_validate_max_rss(u8 max_hw, u8 val) +int qlcnic_validate_max_rss(struct qlcnic_adapter *adapter, + __u32 val) { + struct net_device *netdev = adapter->netdev; + u8 max_hw = adapter->ahw->max_rx_ques; u32 max_allowed; - if (max_hw > QLC_MAX_SDS_RINGS) { - max_hw = QLC_MAX_SDS_RINGS; - pr_info("max rss reset to %d\n", QLC_MAX_SDS_RINGS); + if (val > QLC_MAX_SDS_RINGS) { + netdev_err(netdev, "RSS value should not be higher than %u\n", + QLC_MAX_SDS_RINGS); + return -EINVAL; } max_allowed = rounddown_pow_of_two(min_t(int, max_hw, num_online_cpus())); if ((val > max_allowed) || (val < 2) || !is_power_of_2(val)) { - pr_info("rss_ring valid range [2 - %x] in powers of 2\n", - max_allowed); + if (!is_power_of_2(val)) + netdev_err(netdev, "RSS value should be a power of 2\n"); + + if (val < 2) + netdev_err(netdev, "RSS value should not be lower than 2\n"); + + if (val > max_hw) + netdev_err(netdev, + "RSS value should not be higher than[%u], the max RSS rings supported by the adapter\n", + max_hw); + + if (val > num_online_cpus()) + netdev_err(netdev, + "RSS value should not be higher than[%u], number of online CPUs in the system\n", + num_online_cpus()); + + netdev_err(netdev, "Unable to configure %u RSS rings\n", val); + return -EINVAL; } return 0;