aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2020-05-20 16:07:37 +0000
committerKristof Provost <kp@FreeBSD.org>2020-05-20 16:07:37 +0000
commit5fcaec1a0ba80f8594c53028b876358d824551f0 (patch)
treed141202c5fae7e02517d03cf41e0d0b85bed36ca
parentdb7ec3c3e66b29aa1aee328d77a9a32dd3f8e812 (diff)
downloadsrc-5fcaec1a0ba80f8594c53028b876358d824551f0.tar.gz
src-5fcaec1a0ba80f8594c53028b876358d824551f0.zip
bnxt: isc_nrxd_max and isc_ntxd_max must be powers of two
Reviewed by: gallatin, rpokala MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24922
Notes
Notes: svn path=/head/; revision=361279
-rw-r--r--sys/dev/bnxt/bnxt.h5
-rw-r--r--sys/dev/bnxt/if_bnxt.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/bnxt/bnxt.h b/sys/dev/bnxt/bnxt.h
index bd0691487cdc..b4dfb50281b0 100644
--- a/sys/dev/bnxt/bnxt.h
+++ b/sys/dev/bnxt/bnxt.h
@@ -87,6 +87,11 @@ __FBSDID("$FreeBSD$");
#define NETXTREME_E_VF2 0x16d3
#define NETXTREME_E_VF3 0x16dc
+/* Maximum numbers of RX and TX descriptors. iflib requires this to be a power
+ * of two. The hardware has no particular limitation. */
+#define BNXT_MAX_RXD ((INT32_MAX >> 1) + 1)
+#define BNXT_MAX_TXD ((INT32_MAX >> 1) + 1)
+
#define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \
CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \
CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP)
diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c
index 50827106024b..0d330976b96d 100644
--- a/sys/dev/bnxt/if_bnxt.c
+++ b/sys/dev/bnxt/if_bnxt.c
@@ -316,11 +316,11 @@ static struct if_shared_ctx bnxt_sctx_init = {
.isc_nrxd_default = {PAGE_SIZE / sizeof(struct cmpl_base) * 8,
PAGE_SIZE / sizeof(struct rx_prod_pkt_bd),
PAGE_SIZE / sizeof(struct rx_prod_pkt_bd)},
- .isc_nrxd_max = {INT32_MAX, INT32_MAX, INT32_MAX},
+ .isc_nrxd_max = {BNXT_MAX_RXD, BNXT_MAX_RXD, BNXT_MAX_RXD},
.isc_ntxd_min = {16, 16, 16},
.isc_ntxd_default = {PAGE_SIZE / sizeof(struct cmpl_base) * 2,
PAGE_SIZE / sizeof(struct tx_bd_short)},
- .isc_ntxd_max = {INT32_MAX, INT32_MAX, INT32_MAX},
+ .isc_ntxd_max = {BNXT_MAX_TXD, BNXT_MAX_TXD, BNXT_MAX_TXD},
.isc_admin_intrcnt = 1,
.isc_vendor_info = bnxt_vendor_info_array,