Received: by 10.192.165.156 with SMTP id m28csp65553imm; Tue, 10 Apr 2018 16:31:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx49txAEN0ABxFyLJHZ76AE7G9SbDdLcmqhF4tLsCFRFPSTwndDmEluqBzdq80Pvw45POP/I5 X-Received: by 2002:a17:902:788e:: with SMTP id q14-v6mr2518807pll.396.1523403079968; Tue, 10 Apr 2018 16:31:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523403079; cv=none; d=google.com; s=arc-20160816; b=0IyCRxsRNeI/FjojhAuKs8z3uP7L4hgrQsCN9qozlVpYVaUkL3UcM3BNDfD6zpui4r pdpyvn/MZIGeaCI+vEx6vXUoAzQcBxy+9uJyoPz9av0od1QcXBAHREe+2alfK/wY72V/ cYMFBtFdSC+EfKokZyIPcJWBxoe4VyeHiWsuILCPAGLJS+MyqCX+k4SeNdXGQR1UzJ1C N1BG/J/18OtutJpu2JpXMjW38eGQugVF/2IntYYwW6P8nOc+oiGrZSkARWoml+vv8Wgb rzuEmxf38YDn/SATK2dXU0glK+aN7904Y9JhuwR6JgGPgMHDl/XFUin2VsmkAvsGLqxz WKUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=PK17IMzNt4+/g7Wo7FU1A0Z5zcescpLYyf7zGAiSX8I=; b=v9YaRGzGoE6Tpb5IgbJ7Bzg+hoekfn6CL6MpRl4Ad0+WW+71ERhfYlatv9ftcO/kYe tpROBJB4KCFM09LSA0dMm9D34lAQCLC1jWWVdR/5wDN5Neiphmu3lmTaKD6pwei4XG7w DAhOr2RLpbD/OD5GA57CUaOmAEyazaUlDZ9pMB0f/7WaO/+JS7hPq3YL72F3msekiSHQ Osfj+ZPaNRrRrM4XHhUBOZeOgWcVFIV2RVFY3ACSHiCXJ7xzJ76e1FmKS7i3acWYfPMJ uY8h88Gn00HBbkjfbhN88zLlmLsv1mX8gQai5jK1mo7JWcqxM67wV+VCaxzfXTj8bxEW B6lw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f15-v6si3577474plr.310.2018.04.10.16.30.43; Tue, 10 Apr 2018 16:31:19 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754857AbeDJXZY (ORCPT + 99 others); Tue, 10 Apr 2018 19:25:24 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:39788 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754432AbeDJW36 (ORCPT ); Tue, 10 Apr 2018 18:29:58 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BFECED59; Tue, 10 Apr 2018 22:29:57 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arjun Vynipadath , Ganesh Goudar , "David S. Miller" , Sasha Levin Subject: [PATCH 4.15 092/168] cxgb4vf: Fix SGE FL buffer initialization logic for 64K pages Date: Wed, 11 Apr 2018 00:23:54 +0200 Message-Id: <20180410212804.168651435@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) --- 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 *adapt int t4vf_sge_init(struct adapter *adapter) { struct sge_params *sge_params = &adapter->params.sge; - u32 fl0 = sge_params->sge_fl_buffer_size[0]; - u32 fl1 = sge_params->sge_fl_buffer_size[1]; + u32 fl_small_pg = sge_params->sge_fl_buffer_size[0]; + u32 fl_large_pg = sge_params->sge_fl_buffer_size[1]; struct sge *s = &adapter->sge; /* @@ -2628,9 +2628,20 @@ int t4vf_sge_init(struct adapter *adapte * the Physical Function Driver. Ideally we should be able to deal * with _any_ configuration. Practice is different ... */ - if (fl0 != PAGE_SIZE || (fl1 != 0 && fl1 <= 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 <= fl_small_pg) + fl_large_pg = 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 != PAGE_SIZE || + (fl_large_pg & (fl_large_pg - 1)) != 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) != @@ -2642,8 +2653,8 @@ int t4vf_sge_init(struct adapter *adapte /* * Now translate the adapter parameters into our internal forms. */ - if (fl1) - s->fl_pg_order = ilog2(fl1) - PAGE_SHIFT; + if (fl_large_pg) + s->fl_pg_order = ilog2(fl_large_pg) - PAGE_SHIFT; s->stat_len = ((sge_params->sge_control & EGRSTATUSPAGESIZE_F) ? 128 : 64); s->pktshift = PKTSHIFT_G(sge_params->sge_control);