From patchwork Wed Aug 31 01:27:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasesh Mody X-Patchwork-Id: 112415 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 DDDC1B6F70 for ; Wed, 31 Aug 2011 11:28:38 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754743Ab1HaB21 (ORCPT ); Tue, 30 Aug 2011 21:28:27 -0400 Received: from mx0b-000f0801.pphosted.com ([67.231.152.113]:35103 "EHLO mx0b-000f0801.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754709Ab1HaB2U (ORCPT ); Tue, 30 Aug 2011 21:28:20 -0400 Received: from pps.filterd (m0000700 [127.0.0.1]) by mx0b-000f0801.pphosted.com (8.14.4/8.14.4) with SMTP id p7V1QZcr004181; Tue, 30 Aug 2011 18:28:18 -0700 Received: from hq1-exedge.brocade.com (hq1-exedge.brocade.com [144.49.140.11]) by mx0b-000f0801.pphosted.com with ESMTP id yh9en81w2-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Tue, 30 Aug 2011 18:28:18 -0700 Received: from HQ1WP-EXHUB02.corp.brocade.com (10.70.38.14) by HQ1WP-EXEDGE01.corp.brocade.com (144.49.140.11) with Microsoft SMTP Server (TLS) id 8.3.192.1; Tue, 30 Aug 2011 18:34:45 -0700 Received: from blc-10-4.brocade.com (10.70.4.104) by HQ1-HUB-1.brocade.com (10.70.38.12) with Microsoft SMTP Server (TLS) id 8.3.192.1; Tue, 30 Aug 2011 18:28:17 -0700 Received: from blc-10-4.brocade.com (localhost.localdomain [127.0.0.1]) by blc-10-4.brocade.com (8.13.1/8.13.8) with ESMTP id p7V1SHCH032439; Tue, 30 Aug 2011 18:28:17 -0700 Received: (from rmody@localhost) by blc-10-4.brocade.com (8.13.1/8.13.8/Submit) id p7V1SHWm032438; Tue, 30 Aug 2011 18:28:17 -0700 From: Rasesh Mody To: , CC: , Rasesh Mody , Gurunatha Karaje Subject: [net-next 08/12] bna: Async Mode Tx Rx Init Fix Date: Tue, 30 Aug 2011 18:27:44 -0700 Message-ID: <1314754068-31978-9-git-send-email-rmody@brocade.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1314754068-31978-1-git-send-email-rmody@brocade.com> References: <1314754068-31978-1-git-send-email-rmody@brocade.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.4.6813, 1.0.211, 0.0.0000 definitions=2011-08-31_01:2011-08-31, 2011-08-31, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1012030000 definitions=main-1108300345 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Change details: - Async mode of Tx/Rx queue initialization in BNAD from a task queue context runs into non-unique taskq allocation issues. Get rid of Tx/Rx initialization from task q context - In the attach function, wait for IOC enable, then do Tx/Rx queue initialization. Default BNA attributes are used when IOC enable from attach fails and values are set to: 1 TxQ, 1 RxQ, 1 Unicast MAC, 1 RIT entry Signed-off-by: Gurunatha Karaje Signed-off-by: Rasesh Mody --- drivers/net/ethernet/brocade/bna/bna_enet.c | 29 ++++++++++++++++++----- drivers/net/ethernet/brocade/bna/bna_hw_defs.h | 4 +++ drivers/net/ethernet/brocade/bna/bna_types.h | 1 + 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c b/drivers/net/ethernet/brocade/bna/bna_enet.c index 68a275d..26f5c5a 100644 --- a/drivers/net/ethernet/brocade/bna/bna_enet.c +++ b/drivers/net/ethernet/brocade/bna/bna_enet.c @@ -167,13 +167,14 @@ bna_bfi_attr_get_rsp(struct bna_ioceth *ioceth, * Store only if not set earlier, since BNAD can override the HW * attributes */ - if (!ioceth->attr.num_txq) + if (!ioceth->attr.fw_query_complete) { ioceth->attr.num_txq = ntohl(rsp->max_cfg); - if (!ioceth->attr.num_rxp) ioceth->attr.num_rxp = ntohl(rsp->max_cfg); - ioceth->attr.num_ucmac = ntohl(rsp->max_ucmac); - ioceth->attr.num_mcmac = BFI_ENET_MAX_MCAM; - ioceth->attr.max_rit_size = ntohl(rsp->rit_size); + ioceth->attr.num_ucmac = ntohl(rsp->max_ucmac); + ioceth->attr.num_mcmac = BFI_ENET_MAX_MCAM; + ioceth->attr.max_rit_size = ntohl(rsp->rit_size); + ioceth->attr.fw_query_complete = true; + } bfa_fsm_send_event(ioceth, IOCETH_E_ENET_ATTR_RESP); } @@ -1693,6 +1694,16 @@ static struct bfa_ioc_cbfn bna_ioceth_cbfn = { bna_cb_ioceth_reset }; +static void bna_attr_init(struct bna_ioceth *ioceth) +{ + ioceth->attr.num_txq = BFI_ENET_DEF_TXQ; + ioceth->attr.num_rxp = BFI_ENET_DEF_RXP; + ioceth->attr.num_ucmac = BFI_ENET_DEF_UCAM; + ioceth->attr.num_mcmac = BFI_ENET_MAX_MCAM; + ioceth->attr.max_rit_size = BFI_ENET_DEF_RITSZ; + ioceth->attr.fw_query_complete = false; +} + static void bna_ioceth_init(struct bna_ioceth *ioceth, struct bna *bna, struct bna_res_info *res_info) @@ -1738,6 +1749,8 @@ bna_ioceth_init(struct bna_ioceth *ioceth, struct bna *bna, ioceth->stop_cbfn = NULL; ioceth->stop_cbarg = NULL; + bna_attr_init(ioceth); + bfa_fsm_set_state(ioceth, bna_ioceth_sm_stopped); } @@ -2036,7 +2049,8 @@ bna_uninit(struct bna *bna) int bna_num_txq_set(struct bna *bna, int num_txq) { - if (num_txq > 0 && (num_txq <= bna->ioceth.attr.num_txq)) { + if (bna->ioceth.attr.fw_query_complete && + (num_txq <= bna->ioceth.attr.num_txq)) { bna->ioceth.attr.num_txq = num_txq; return BNA_CB_SUCCESS; } @@ -2047,7 +2061,8 @@ bna_num_txq_set(struct bna *bna, int num_txq) int bna_num_rxp_set(struct bna *bna, int num_rxp) { - if (num_rxp > 0 && (num_rxp <= bna->ioceth.attr.num_rxp)) { + if (bna->ioceth.attr.fw_query_complete && + (num_rxp <= bna->ioceth.attr.num_rxp)) { bna->ioceth.attr.num_rxp = num_rxp; return BNA_CB_SUCCESS; } diff --git a/drivers/net/ethernet/brocade/bna/bna_hw_defs.h b/drivers/net/ethernet/brocade/bna/bna_hw_defs.h index 7ecdca5..dde8a46 100644 --- a/drivers/net/ethernet/brocade/bna/bna_hw_defs.h +++ b/drivers/net/ethernet/brocade/bna/bna_hw_defs.h @@ -30,6 +30,10 @@ * SW imposed limits * */ +#define BFI_ENET_DEF_TXQ 1 +#define BFI_ENET_DEF_RXP 1 +#define BFI_ENET_DEF_UCAM 1 +#define BFI_ENET_DEF_RITSZ 1 #define BFI_ENET_MAX_MCAM 256 diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index 59417b1..242d799 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -323,6 +323,7 @@ struct bna_qpt { }; struct bna_attr { + bool fw_query_complete; int num_txq; int num_rxp; int num_ucmac;