Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Sep 2016 17:22:55 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
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
Message-ID:  <201609111722.u8BHMtCs086884@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609111722.u8BHMtCs086884>