From owner-svn-src-all@freebsd.org Sun Sep 11 17:22:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B6E0BD688B; Sun, 11 Sep 2016 17:22:56 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 18CC1BCC; Sun, 11 Sep 2016 17:22:56 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8BHMtSZ086887; Sun, 11 Sep 2016 17:22:55 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8BHMtCs086884; Sun, 11 Sep 2016 17:22:55 GMT (envelope-from np@FreeBSD.org) Message-Id: <201609111722.u8BHMtCs086884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sun, 11 Sep 2016 17:22:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305699 - in head/sys/dev/cxgbe: . common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2016 17:22:56 -0000 Author: np Date: Sun Sep 11 17:22:54 2016 New Revision: 305699 URL: https://svnweb.freebsd.org/changeset/base/305699 Log: cxgbe(4): Update the pad_boundary calculation for T6, which has a different range of boundaries. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/common/t4vf_hw.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Sun Sep 11 17:19:30 2016 (r305698) +++ head/sys/dev/cxgbe/common/t4_hw.c Sun Sep 11 17:22:54 2016 (r305699) @@ -7892,7 +7892,13 @@ int t4_init_sge_params(struct adapter *a sp->sge_control = r; sp->spg_len = r & F_EGRSTATUSPAGESIZE ? 128 : 64; sp->fl_pktshift = G_PKTSHIFT(r); - sp->pad_boundary = 1 << (G_INGPADBOUNDARY(r) + 5); + if (chip_id(adapter) <= CHELSIO_T5) { + sp->pad_boundary = 1 << (G_INGPADBOUNDARY(r) + + X_INGPADBOUNDARY_SHIFT); + } else { + sp->pad_boundary = 1 << (G_INGPADBOUNDARY(r) + + X_T6_INGPADBOUNDARY_SHIFT); + } if (is_t4(adapter)) sp->pack_boundary = sp->pad_boundary; else { Modified: head/sys/dev/cxgbe/common/t4vf_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4vf_hw.c Sun Sep 11 17:19:30 2016 (r305698) +++ head/sys/dev/cxgbe/common/t4vf_hw.c Sun Sep 11 17:22:54 2016 (r305699) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include "common.h" #include "t4_regs.h" +#include "t4_regs_values.h" #undef msleep #define msleep(x) do { \ @@ -169,7 +170,13 @@ int t4vf_get_sge_params(struct adapter * */ sp->spg_len = sp->sge_control & F_EGRSTATUSPAGESIZE ? 128 : 64; sp->fl_pktshift = G_PKTSHIFT(sp->sge_control); - sp->pad_boundary = 1 << (G_INGPADBOUNDARY(sp->sge_control) + 5); + if (chip_id(adapter) <= CHELSIO_T5) { + sp->pad_boundary = 1 << (G_INGPADBOUNDARY(sp->sge_control) + + X_INGPADBOUNDARY_SHIFT); + } else { + sp->pad_boundary = 1 << (G_INGPADBOUNDARY(sp->sge_control) + + X_T6_INGPADBOUNDARY_SHIFT); + } if (is_t4(adapter)) sp->pack_boundary = sp->pad_boundary; else { Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Sun Sep 11 17:19:30 2016 (r305698) +++ head/sys/dev/cxgbe/t4_sge.c Sun Sep 11 17:22:54 2016 (r305699) @@ -433,16 +433,20 @@ static inline void setup_pad_and_pack_boundaries(struct adapter *sc) { uint32_t v, m; - int pad, pack; + int pad, pack, pad_shift; + pad_shift = chip_id(sc) > CHELSIO_T5 ? X_T6_INGPADBOUNDARY_SHIFT : + X_INGPADBOUNDARY_SHIFT; pad = fl_pad; - if (fl_pad < 32 || fl_pad > 4096 || !powerof2(fl_pad)) { + if (fl_pad < (1 << pad_shift) || + fl_pad > (1 << (pad_shift + M_INGPADBOUNDARY)) || + !powerof2(fl_pad)) { /* * If there is any chance that we might use buffer packing and * the chip is a T4, then pick 64 as the pad/pack boundary. Set - * it to 32 in all other cases. + * it to the minimum allowed in all other cases. */ - pad = is_t4(sc) && buffer_packing ? 64 : 32; + pad = is_t4(sc) && buffer_packing ? 64 : 1 << pad_shift; /* * For fl_pad = 0 we'll still write a reasonable value to the @@ -456,7 +460,7 @@ setup_pad_and_pack_boundaries(struct ada } } m = V_INGPADBOUNDARY(M_INGPADBOUNDARY); - v = V_INGPADBOUNDARY(ilog2(pad) - 5); + v = V_INGPADBOUNDARY(ilog2(pad) - pad_shift); t4_set_reg_field(sc, A_SGE_CONTROL, m, v); if (is_t4(sc)) {