Received: by 10.213.65.68 with SMTP id h4csp1857882imn; Mon, 19 Mar 2018 15:25:37 -0700 (PDT) X-Google-Smtp-Source: AG47ELuJxtRB96PUtRHV4GHUEAsPvFFaYqmchzf8gVIKD4Y4O9PzqTVeHzsIoWaEwlgf1hcwJ6oe X-Received: by 2002:a17:902:96a:: with SMTP id 97-v6mr13989811plm.183.1521498337513; Mon, 19 Mar 2018 15:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521498337; cv=none; d=google.com; s=arc-20160816; b=YWOCDeA+jPHJbwnzoAsIJd9DXZy/o8ZRobdRiObN09kOEWq+0yil8XCtGG/atbKCio L2ijAbgNFHgYUv33xEg+c8fPX0w9/WViTGWoHahnCST+gTF8vMWddQVMayLAagBh0joQ 0SnP4g7F8QtJ+0VRvwKcatgEN5LjrwPp6dhyM6DN8l+HjeGEqd1qvmCLkmpW4C5x6NDf tgmHYcdWCWSPDrqz83igk8mT06rIi03pFJ0vuq5rkAb6zZuTT366z732zZfd92u8TesV S2D/BhjC81Aem3KSgt6H9rspUkrF1dGN5HeasSL5ZevS+kBnBs6/5laJw0pqcECHGHBJ sdXQ== 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=/qqzdc15InV0ir0cUiMaqDrz8yNaQYO0RwHBeueyKrk=; b=TsvoAejGK3gPOf/bycepzvXvdQbq2lezPWrsPp11k+eF396mYI3E6g2vBtUIYdmR8I DpCsIQj7NP0GRyHZ1i97Nhxfx0NAAkz19QsKj+8VHPRMGiRjI4EwQddqYsSiSZ/3/zix X/TS46aBNksYA8OV2D2H0s0Ryxrncxs4mQrcJCIWy/kiCCjB0ycB7ccBwQ89ARaGbTvN Xf044jrqRSCPux2JbJE3sQxjPGn0zUziCUtlmGlh2X8jucHkuLH9kB4gWdpOAWQD/690 W2UqoHfO76heQOloWXKYSHcx1QiUu/mhOME8bTKN6/JaPbjjLi69nFozaGfDQPMIqyzj K/qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=l301xuag; 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 f62-v6si42381plb.313.2018.03.19.15.24.52; Mon, 19 Mar 2018 15:25:37 -0700 (PDT) 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=l301xuag; 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 S1032460AbeCSWRY (ORCPT + 99 others); Mon, 19 Mar 2018 18:17:24 -0400 Received: from mail-by2nam01on0114.outbound.protection.outlook.com ([104.47.34.114]:57771 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934011AbeCSPtt (ORCPT ); Mon, 19 Mar 2018 11:49:49 -0400 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=/qqzdc15InV0ir0cUiMaqDrz8yNaQYO0RwHBeueyKrk=; b=l301xuag0SU9NHUlkXq5bHWyU7n6RSaIF+OAyMS0BvMZ60NuNYkfr9e/jJ/oKLRj7vNRxv4kwW1GdyyvgF/3jfcvwKehsDx+GWgqrR5Gpchti008xpjK8tAeRil0EZqXkzCaTki9vNQaWA7pju5Qbon7fbzjThmnO1/202WSk3w= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1109.namprd21.prod.outlook.com (52.132.130.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 15:49:43 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:49:43 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Arjun Vynipadath , Ganesh Goudar , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 103/124] cxgb4vf: Fix SGE FL buffer initialization logic for 64K pages Thread-Topic: [PATCH AUTOSEL for 4.15 103/124] cxgb4vf: Fix SGE FL buffer initialization logic for 64K pages Thread-Index: AQHTv5nJ9Dlooindz0uT4c5u1C9gCA== Date: Mon, 19 Mar 2018 15:48:55 +0000 Message-ID: <20180319154645.11350-103-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-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;DM5PR2101MB1109;7:lsdiU6l+qqCTpSzM089MuSt5fRhZV8fo2xGwhbHr8RqMeG9O6LQ4VHXfYUTgXZdAHYqqL74gd/44PeK1CdBUYK9rDZ+Ek3w72Qpsm5TKmmBnBBV4IASmTbmn9FBaks6rfjp7UF6KzLFkct5EUnI4AuWThTVTknt6VEvwH0Azqfgc9cYVTAc+yPQ9BA1Q7FxAQQu8nISgZluE9IM43n2ASvu+/wi1HJ3qNt5xS4nX7YGCLTB6HJSJO95/WK++akYD;20:qARogn/e0JFobsE2aIsmK1ZNWYt6BIlAPLZbmEEGf62rKTzFa6US2VCsYH4dzQpXLXCFfVbBrJXb5QKc7exd9xDn/e9lwPtte9a02em4yMTN0ARfb5trUjXBCsnZFc4058piF4IN4yUlHxp22RM+NiDcTkwVTnGdECf2c9zJ92Q= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: fc380848-9604-4c2b-e0d7-08d58db10881 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1109; x-ms-traffictypediagnostic: DM5PR2101MB1109: 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)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB1109;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1109; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(396003)(39860400002)(39380400002)(376002)(346002)(199004)(189003)(81166006)(10290500003)(107886003)(81156014)(106356001)(6506007)(8676002)(3846002)(36756003)(8936002)(97736004)(6116002)(1076002)(102836004)(68736007)(6666003)(3280700002)(2950100002)(3660700001)(478600001)(72206003)(59450400001)(2906002)(14454004)(76176011)(66066001)(6512007)(5250100002)(10090500001)(2501003)(53936002)(6486002)(6436002)(26005)(316002)(22452003)(305945005)(7736002)(4326008)(25786009)(86362001)(575784001)(86612001)(5660300001)(2900100001)(99286004)(54906003)(186003)(105586002)(110136005)(22906009)(32563001)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1109;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: /uZzjjYHXUiVXO560h6u4OEz4vm+54C8Ac+7+iEdpds1vMS1p3+ZujjaqvYcqt5511YKWEZVJG3J9ZLP9f4RAu+GeJJd3R86Ct3EnNFzSrHK7a9ohPjlE57WhkeKf7kIebQEYKyeynzRKPFdvFuiRQm9ZjNYc/S0Ps5AMwXcyyzq0UTylQIZMzOLMgqGBEHi7kyzfU5OnLKWzcrLRjTcPQN25eiyrdLNrsd4MWekvq3qFuO4XOH7q+AWRjyEwon9P8HC6QecYJxU2wgKs4i8tSkgevN1cNRUnQNfLgbBlMSXVt2fkz5YULGAzOBVp4k+tX2Y9q3wQEIti8B3W/Mg8w== 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: fc380848-9604-4c2b-e0d7-08d58db10881 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:48:55.1643 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1109 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arjun Vynipadath [ Upstream commit ea0a42109aee7b92e631c4eb3f2219fadf58acdd ] We'd come in with SGE_FL_BUFFER_SIZE[0] and [1] both equal to 64KB and the extant logic would flag that as an error. This was already fixed in cxgb4 driver with "92ddcc7 cxgb4: Fix some small bugs in t4_sge_init_soft() when our Page Size is 64KB". Original Work by: Casey Leedom Signed-off-by: Arjun Vynipadath Signed-off-by: Ganesh Goudar Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ether= net/chelsio/cxgb4vf/sge.c index 14d7e673c656..129b914a434c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c @@ -2619,8 +2619,8 @@ void t4vf_sge_stop(struct adapter *adapter) int t4vf_sge_init(struct adapter *adapter) { struct sge_params *sge_params =3D &adapter->params.sge; - u32 fl0 =3D sge_params->sge_fl_buffer_size[0]; - u32 fl1 =3D sge_params->sge_fl_buffer_size[1]; + u32 fl_small_pg =3D sge_params->sge_fl_buffer_size[0]; + u32 fl_large_pg =3D sge_params->sge_fl_buffer_size[1]; struct sge *s =3D &adapter->sge; =20 /* @@ -2628,9 +2628,20 @@ int t4vf_sge_init(struct adapter *adapter) * the Physical Function Driver. Ideally we should be able to deal * with _any_ configuration. Practice is different ... */ - if (fl0 !=3D PAGE_SIZE || (fl1 !=3D 0 && fl1 <=3D fl0)) { + + /* We only bother using the Large Page logic if the Large Page Buffer + * is larger than our Page Size Buffer. + */ + if (fl_large_pg <=3D fl_small_pg) + fl_large_pg =3D 0; + + /* The Page Size Buffer must be exactly equal to our Page Size and the + * Large Page Size Buffer should be 0 (per above) or a power of 2. + */ + if (fl_small_pg !=3D PAGE_SIZE || + (fl_large_pg & (fl_large_pg - 1)) !=3D 0) { dev_err(adapter->pdev_dev, "bad SGE FL buffer sizes [%d, %d]\n", - fl0, fl1); + fl_small_pg, fl_large_pg); return -EINVAL; } if ((sge_params->sge_control & RXPKTCPLMODE_F) !=3D @@ -2642,8 +2653,8 @@ int t4vf_sge_init(struct adapter *adapter) /* * Now translate the adapter parameters into our internal forms. */ - if (fl1) - s->fl_pg_order =3D ilog2(fl1) - PAGE_SHIFT; + if (fl_large_pg) + s->fl_pg_order =3D ilog2(fl_large_pg) - PAGE_SHIFT; s->stat_len =3D ((sge_params->sge_control & EGRSTATUSPAGESIZE_F) ? 128 : 64); s->pktshift =3D PKTSHIFT_G(sge_params->sge_control); --=20 2.14.1