From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AIpwx49H1Eh3t/AlZWSJ1iwjmllqSUjmh8JRlTSN/dQ95J3P+BdZEzsz560lD5uQXU/1Cc7g/d4J ARC-Seal: i=1; a=rsa-sha256; t=1523472637; cv=none; d=google.com; s=arc-20160816; b=dYBjLprsIELMt62/4Y7HexXxbtCWjCHiBRYZc+X/H+L553slL2zvtE/eQdffSCIP6J 5hoFmhUQjnBT6PkmmJVVMX2JWoEYOU99UjQ7Bt7hZtHqRB7l8nx/QJ7DvHM301MhxY1N adEhVmFGWMvocTZy9WUoAS4tbsGa5FMU2ShwYtmPaBcPrxydLXShdjBAeK+S6/RYRyby NLTwGQn0N45gLWq96taIw/3mRi6k+p1cNSqF1dEHKqdGQu86kefYM39WrCTl/+UuPGuq OD6Oj/T9pjphM2hLNp8e8d1I+Tx/59ylPPVYDtkjopQw9XidFnkFzGMOzx7dui90LiX6 npKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Y0gudzEuivFhJV1y2ENMsXvtUvrdNi2EB10xrYPIzHw=; b=DnPBBVPGV/VjSZyw1LH2fvwNzmWiOX49q7WkJ+KA+tIoOLKD8/RdzlOMD4aqODq17b mYef+jsT0GWzaVqGvSURFdMGU5jhEQ5XFWQoZUUb2CHvJp97mSmSfrKA/r3y4VmqM8IH F6hlMWBpcNg3c/tFeOfZuBtU879v0tkrUnkobX97XlWLn9Z0y+p5eXNfpmwfma6DCre2 L9ECguwI+D97FObqLX1cGyf71nDRL1DetJPG2I/rsTDJgYrbtQsropuE0JCXx93FpDIO 60+WHzAK3PLeOdxTZATiIa4PQ0QxpFrjrjtD7kk4gTMtdZ0KV8R6J1yI0XJSjJTILlnL clHA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.61.202 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.61.202 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org 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.4 157/190] cxgb4vf: Fix SGE FL buffer initialization logic for 64K pages Date: Wed, 11 Apr 2018 20:36:43 +0200 Message-Id: <20180411183601.748756491@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183550.114495991@linuxfoundation.org> References: <20180411183550.114495991@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1597476844672021483?= X-GMAIL-MSGID: =?utf-8?q?1597476844672021483?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.4-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 @@ -2604,8 +2604,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; unsigned int ingpadboundary, ingpackboundary; @@ -2614,9 +2614,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) == 0) { @@ -2627,8 +2638,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);