Received: by 10.223.185.116 with SMTP id b49csp1108338wrg; Sat, 3 Mar 2018 15:48:52 -0800 (PST) X-Google-Smtp-Source: AG47ELsuvOGrByVTuf4jhOpyoVZCKyGJ6k1VNp8bu9Vu2vD7hQ6/uXz0CEUjC43A/WwU0TVXCkui X-Received: by 2002:a17:902:4601:: with SMTP id o1-v6mr8976162pld.210.1520120932368; Sat, 03 Mar 2018 15:48:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520120932; cv=none; d=google.com; s=arc-20160816; b=TP4iJebeZ/W0hMATtN3M9wxJhwHWynRu60CnxWW/zxv11FwuaXTs56KM9PAOkuhXV9 YEeZsR8zG5/bBr3l1KSmLx7ObT26/iDRCF143hMK41eOkpM9wBt4/0nxcKjmM0VxpiLZ tHFJrhgAKmwYH7s7BtB81VHelVjkFzoXdxQ/gULZCmlL9kVuHAMXyaZl8tEGmMqx6BVh w1lm8pe7a/lkTqr05ReIjS/M5YbirrfJphtf9FWb4wBAaN9zmtG8DQvtoSwX71wzUxji gABcgAYuEJPykmgoK3EsFa4J/8tkvrMp7MG6ORpCUZfdLMZP1Hdw0zoyKeDSobv6XvPC 91TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=OenLXcGcacL8VfFHStGZFFsnRp4AOG8OlEh8o8QaMVc=; b=Z6NRj7zUoSv77hdR/gv+EsKKlCWun18YNWTSZ/z4fnMCtrcU0XvqyPUBWnDAk0JMho adsy+8hOIyYPoNYtB5v6J+ILK5TsvJ8aV9w7h716DIJs9Nz7LPO3lMZu753ZR8hZK27k bA77NS68B5++IaSdm4Itm3gXs+jCEaDYg0pujWS6ZUkvGNyToMVlo1bOtRsXa8+spsaw gjlkUCyxQLvZkFNyifWp7SuZQU4c+kisr3ARUVrKT5FKSVTyoNq5MkeMvSG9h+qOhIpm ys9pekTvweAKYsojfUANWtRguw+Op7yTulNkLUgMY+5/TtM99FU9Q6HaeZyEArK1psL6 GG1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=CTw3oCUk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 97-v6si5412100plb.23.2018.03.03.15.48.38; Sat, 03 Mar 2018 15:48:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=CTw3oCUk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934164AbeCCXsE (ORCPT + 99 others); Sat, 3 Mar 2018 18:48:04 -0500 Received: from mail-bn3nam01on0116.outbound.protection.outlook.com ([104.47.33.116]:3173 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934099AbeCCWeB (ORCPT ); Sat, 3 Mar 2018 17:34:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=OenLXcGcacL8VfFHStGZFFsnRp4AOG8OlEh8o8QaMVc=; b=CTw3oCUk7NAPtXihZrLOZKBprArxIXlZMNaaqQ31ciUgLXtBN9cgywT3jo+3yjQqe/TwQq2CessnF+2Ynh/GgdIqUCdCRWobZ20x/U2Rbd600L8hgBoiHYKHktZBAlKtelK86j1DZY+FW8dkxxtnA53uL6tLuH9vJ1hF5jp4sT4= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB1065.namprd21.prod.outlook.com (52.132.149.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.2; Sat, 3 Mar 2018 22:33:57 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:33:57 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Michal Kalderon , Yuval Mintz , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 103/219] qed: Fix TM block ILT allocation Thread-Topic: [PATCH AUTOSEL for 4.9 103/219] qed: Fix TM block ILT allocation Thread-Index: AQHTsz8DR5ASA27e5E+1JlNKkiXTWQ== Date: Sat, 3 Mar 2018 22:28:55 +0000 Message-ID: <20180303222716.26640-103-alexander.levin@microsoft.com> References: <20180303222716.26640-1-alexander.levin@microsoft.com> In-Reply-To: <20180303222716.26640-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MW2PR2101MB1065;7:f+BmKKT17W2JWUFVLupze25yvgTZxpZYwZwv1HnbJpQu/LjcnZ1VbG1uCckhPUGQJlEZMZQAAWq/ll6RKjznZ30tKaFKb1vtPuTs+mOJhogo56Iho3UFi1VFk+x+kM2aUg+e9ZkjEPXe5FGZsrRdeo0yFyRv6SrJLF1KAJYpNDyqVPfQFGdVvLFgEuSID1RYQ3fvwDeDrAOHTUOLWISSZLMP4GA/+4CMXm7AOFNMvS0Q87gGxaxvFWrew0urHzBl x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 739d1534-148d-474d-0893-08d58156da50 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:MW2PR2101MB1065; x-ms-traffictypediagnostic: MW2PR2101MB1065: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231220)(944501244)(52105095)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MW2PR2101MB1065;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB1065; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(346002)(376002)(396003)(39380400002)(39860400002)(189003)(199004)(6506007)(22452003)(54906003)(25786009)(186003)(2950100002)(102836004)(5250100002)(2501003)(110136005)(97736004)(316002)(2900100001)(36756003)(76176011)(6436002)(59450400001)(6486002)(26005)(4326008)(99286004)(68736007)(6512007)(6116002)(10090500001)(106356001)(105586002)(478600001)(66066001)(107886003)(3660700001)(305945005)(86612001)(14454004)(81166006)(7736002)(86362001)(1076002)(72206003)(2906002)(10290500003)(8676002)(8936002)(81156014)(3846002)(5660300001)(3280700002)(53936002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB1065;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 0C1oTNVk19SP04OgTLQlaVOjgJ+/c0cegSrPKS9Tuz5oF4cNFaB9rZrFW3zfF6rrxOJzD63SnMR/5wQwyL5xcx/tXB6WHiyTbIBHfmQbWGcGEB7M4asnP8zs4gc+qDH6RxfpdRq+9uSHLTvslczcDqUFUJIzxKR0X1UpcvW9Q34= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 739d1534-148d-474d-0893-08d58156da50 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:28:55.2757 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB1065 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michal Kalderon [ Upstream commit 44531ba45dbf3c23cc7ae0934ec9b33ef340ac56 ] When configuring the HW timers block we should set the number of CIDs up until the last CID that require timers, instead of only those CIDs whose protocol needs timers support. Today, the protocols that require HW timers' support have their CIDs before any other protocol, but that would change in future [when we add iWARP support]. Signed-off-by: Michal Kalderon Signed-off-by: Yuval Mintz Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/qlogic/qed/qed_cxt.c | 32 ++++++++++++++++++++++++---= ---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_cxt.c b/drivers/net/ethern= et/qlogic/qed/qed_cxt.c index ed014bdbbabd..457e30427535 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_cxt.c +++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.c @@ -271,16 +271,34 @@ struct qed_tm_iids { u32 per_vf_tids; }; =20 -static void qed_cxt_tm_iids(struct qed_cxt_mngr *p_mngr, +static void qed_cxt_tm_iids(struct qed_hwfn *p_hwfn, + struct qed_cxt_mngr *p_mngr, struct qed_tm_iids *iids) { - u32 i, j; - - for (i =3D 0; i < MAX_CONN_TYPES; i++) { + bool tm_vf_required =3D false; + bool tm_required =3D false; + int i, j; + + /* Timers is a special case -> we don't count how many cids require + * timers but what's the max cid that will be used by the timer block. + * therefore we traverse in reverse order, and once we hit a protocol + * that requires the timers memory, we'll sum all the protocols up + * to that one. + */ + for (i =3D MAX_CONN_TYPES - 1; i >=3D 0; i--) { struct qed_conn_type_cfg *p_cfg =3D &p_mngr->conn_cfg[i]; =20 - if (tm_cid_proto(i)) { + if (tm_cid_proto(i) || tm_required) { + if (p_cfg->cid_count) + tm_required =3D true; + iids->pf_cids +=3D p_cfg->cid_count; + } + + if (tm_cid_proto(i) || tm_vf_required) { + if (p_cfg->cids_per_vf) + tm_vf_required =3D true; + iids->per_vf_cids +=3D p_cfg->cids_per_vf; } } @@ -696,7 +714,7 @@ int qed_cxt_cfg_ilt_compute(struct qed_hwfn *p_hwfn) =20 /* TM PF */ p_cli =3D &p_mngr->clients[ILT_CLI_TM]; - qed_cxt_tm_iids(p_mngr, &tm_iids); + qed_cxt_tm_iids(p_hwfn, p_mngr, &tm_iids); total =3D tm_iids.pf_cids + tm_iids.pf_tids_total; if (total) { p_blk =3D &p_cli->pf_blks[0]; @@ -1591,7 +1609,7 @@ static void qed_tm_init_pf(struct qed_hwfn *p_hwfn) u8 i; =20 memset(&tm_iids, 0, sizeof(tm_iids)); - qed_cxt_tm_iids(p_mngr, &tm_iids); + qed_cxt_tm_iids(p_hwfn, p_mngr, &tm_iids); =20 /* @@@TBD No pre-scan for now */ =20 --=20 2.14.1