From nobody Thu Jan 19 03:52:13 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ny7xB0qk6z2svWh; Thu, 19 Jan 2023 03:52:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ny7xB0cc4z3hpX; Thu, 19 Jan 2023 03:52:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674100334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pb1ydH9QxqO70ye0FgyP7MsvDYDDA4sPQ408VUD48ng=; b=egdd2ZfRTLPhXtZeGf3zFtBKRzuKrFDtdZQiPwxGNDItYOmJsfzLIwffgjvnJ46YCh4N4s BERLe1/7le+pl4ObmNO4CHjkQSOxbIF+8Byv7lNLs/NoS2AKiaiOKt/bv27zb+InKHgdCu n+6lAtC3nx8TAj3uDHV5v/UU+qr0vvgldA2IYYshqmA+6pnG5kMPfBj317yhVhDFTwLx/P nBdIfMxHrEOzonu97BnXaL3pLVOTz0FXLG1+2I/1m+HMqQNMeQWJ66vsIV4IOkY1YT4Ufg pJ3vxPgGR26kQ0K+mhnDa52z0PqtRR4bv6LCKQS0vLUZkevkptkq5OwRQGP90g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674100334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pb1ydH9QxqO70ye0FgyP7MsvDYDDA4sPQ408VUD48ng=; b=ZAOSuDpNkKZ025eP9623taim6ldoxGbutC+x1uglzNYOnumLCktiUq76d1/6BW7IdFZxfN jCFPRYaZ+TuxRymDt1xBcCosTpSkw+oyrwK2Jug/gQoUMlXoFYFH1O1ZouUVhvhwIZZdTg HP7rOuD8Lpsbh6tyfGhT3+2FxkaupuJUSDmR45p56M7cULSumbvayZSiU9/vSOrDd3x9Do bnhHbPR8rSDR4sGxGQwBhPO66Me89h/DehkOcQZJlnIuWnlPcl7jJqg8UrXTOwW5RTBGhl Xp+RifpKwh8iYCZhXUb2uWWpeQwD47+hdIsVTyrxOaNgijrYnKN6WqQfveFOFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674100334; a=rsa-sha256; cv=none; b=q+D2kxY81NNTW+S5zTBqh10Ou775zHaIJ05bPxVWdLw29L2uYLNKywUnewvDCg5OV7agpC H2hID0MP1KeNM9BEEkCjLvjTZKj8eSH2mGtE3yiqSdEotQFf/dZuI2BLghIaFfFYHYu/PQ bwhLt72F9WUbxH4/Wgm9jcyXYAMPjLSESbnkfTM3mGoRAZNkl9kQ8AjcLeXw8DuHXY0cjq Djf8Eqp46O4LeXIknN2OoAX7uj5lANYPasG3qz6NMY+uQevPMyMLumxRWn0DMRiz5qAuza 9RRB0asTSw8kLBgxhURgRUoZT2oBSNyC/n8ufEtiRovEd9riRX1ctEA5FJJFfQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Ny7x96qRfzcPZ; Thu, 19 Jan 2023 03:52:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30J3qDIQ021971; Thu, 19 Jan 2023 03:52:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30J3qDUP021970; Thu, 19 Jan 2023 03:52:13 GMT (envelope-from git) Date: Thu, 19 Jan 2023 03:52:13 GMT Message-Id: <202301190352.30J3qDUP021970@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: c4cad5c10820 - stable/13 - if_bnxt: Add support for admin down/up and jumbo List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c4cad5c10820b2196f123467ce39a182784533b8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c4cad5c10820b2196f123467ce39a182784533b8 commit c4cad5c10820b2196f123467ce39a182784533b8 Author: Sumit Saxena AuthorDate: 2022-11-04 22:11:10 +0000 Commit: Warner Losh CommitDate: 2023-01-19 01:00:06 +0000 if_bnxt: Add support for admin down/up and jumbo Make ifconfig up/down work, as well as adding support for jumbo frames. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D36439 (cherry picked from commit 055196a7d777509bebab0e718a0d333cf2660178) --- sys/dev/bnxt/bnxt.h | 1 + sys/dev/bnxt/bnxt_hwrm.c | 181 +++++++++++++++++++++++++++++++++++++++++++++-- sys/dev/bnxt/bnxt_hwrm.h | 10 ++- sys/dev/bnxt/bnxt_txrx.c | 2 +- sys/dev/bnxt/if_bnxt.c | 116 ++++++++++++++++++++++++++++-- 5 files changed, 296 insertions(+), 14 deletions(-) diff --git a/sys/dev/bnxt/bnxt.h b/sys/dev/bnxt/bnxt.h index 5a68b24e44f5..61c0a0f8bd36 100644 --- a/sys/dev/bnxt/bnxt.h +++ b/sys/dev/bnxt/bnxt.h @@ -714,6 +714,7 @@ struct bnxt_softc { struct bnxt_grp_info *grp_info; struct iflib_dma_info rx_stats[BNXT_MAX_NUM_QUEUES]; int nrxqsets; + uint16_t rx_buf_size; struct bnxt_cp_ring def_cp_ring; struct bnxt_cp_ring def_nq_ring; diff --git a/sys/dev/bnxt/bnxt_hwrm.c b/sys/dev/bnxt/bnxt_hwrm.c index 981bab37c181..761b08f6925d 100644 --- a/sys/dev/bnxt/bnxt_hwrm.c +++ b/sys/dev/bnxt/bnxt_hwrm.c @@ -913,6 +913,29 @@ bnxt_hwrm_set_link_setting(struct bnxt_softc *softc, bool set_pause, return rc; } +int +bnxt_hwrm_vnic_set_hds(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic) +{ + struct hwrm_vnic_plcmodes_cfg_input req = {0}; + + if (!BNXT_CHIP_P5(softc)) + return 0; + + bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_PLCMODES_CFG); + + /* + * TBD -- Explore these flags + * 1. VNIC_PLCMODES_CFG_REQ_FLAGS_HDS_IPV4 + * 2. VNIC_PLCMODES_CFG_REQ_FLAGS_HDS_IPV6 + * 3. req.jumbo_thresh + * 4. req.hds_threshold + */ + req.flags = htole32(HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_JUMBO_PLACEMENT); + req.vnic_id = htole16(vnic->id); + + return hwrm_send_message(softc, &req, sizeof(req)); +} + int bnxt_hwrm_vnic_cfg(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic) { @@ -950,6 +973,29 @@ bnxt_hwrm_vnic_cfg(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic) return hwrm_send_message(softc, &req, sizeof(req)); } +int +bnxt_hwrm_vnic_free(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic) +{ + struct hwrm_vnic_free_input req = {0}; + int rc = 0; + + if (vnic->id == (uint16_t)HWRM_NA_SIGNATURE) + return rc; + + bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_FREE); + + req.vnic_id = htole32(vnic->id); + + BNXT_HWRM_LOCK(softc); + rc = _hwrm_send_message(softc, &req, sizeof(req)); + if (rc) + goto fail; + +fail: + BNXT_HWRM_UNLOCK(softc); + return (rc); +} + int bnxt_hwrm_vnic_alloc(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic) { @@ -981,6 +1027,27 @@ fail: return (rc); } +int +bnxt_hwrm_vnic_ctx_free(struct bnxt_softc *softc, uint16_t ctx_id) +{ + struct hwrm_vnic_rss_cos_lb_ctx_free_input req = {0}; + int rc = 0; + + if (ctx_id == (uint16_t)HWRM_NA_SIGNATURE) + return rc; + + bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_RSS_COS_LB_CTX_FREE); + req.rss_cos_lb_ctx_id = htole16(ctx_id); + BNXT_HWRM_LOCK(softc); + rc = _hwrm_send_message(softc, &req, sizeof(req)); + if (rc) + goto fail; + +fail: + BNXT_HWRM_UNLOCK(softc); + return rc; +} + int bnxt_hwrm_vnic_ctx_alloc(struct bnxt_softc *softc, uint16_t *ctx_id) { @@ -1044,6 +1111,64 @@ fail: return rc; } +int +bnxt_hwrm_ring_grp_free(struct bnxt_softc *softc, struct bnxt_grp_info *grp) +{ + struct hwrm_ring_grp_free_input req = {0}; + int rc = 0; + + if (grp->grp_id == (uint16_t)HWRM_NA_SIGNATURE) + return 0; + + if (BNXT_CHIP_P5 (softc)) + return 0; + + bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_RING_GRP_FREE); + + req.ring_group_id = htole32(grp->grp_id); + + BNXT_HWRM_LOCK(softc); + rc = _hwrm_send_message(softc, &req, sizeof(req)); + if (rc) + goto fail; + +fail: + BNXT_HWRM_UNLOCK(softc); + return rc; +} + +int bnxt_hwrm_ring_free(struct bnxt_softc *softc, uint32_t ring_type, + struct bnxt_ring *ring, int cmpl_ring_id) +{ + struct hwrm_ring_free_input req = {0}; + struct hwrm_ring_free_output *resp; + int rc = 0; + uint16_t error_code; + + if (ring->phys_id == (uint16_t)HWRM_NA_SIGNATURE) + return 0; + + resp = (void *)softc->hwrm_cmd_resp.idi_vaddr; + bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_RING_FREE); + req.cmpl_ring = htole16(cmpl_ring_id); + req.ring_type = ring_type; + req.ring_id = htole16(ring->phys_id); + + BNXT_HWRM_LOCK(softc); + rc = _hwrm_send_message(softc, &req, sizeof(req)); + error_code = le16toh(resp->error_code); + + if (rc || error_code) { + device_printf(softc->dev, "hwrm_ring_free type %d failed. " + "rc:%x err:%x\n", ring_type, rc, error_code); + if (!rc) + rc = -EIO; + } + + BNXT_HWRM_UNLOCK(softc); + return rc; +} + /* * Ring allocation message to the firmware */ @@ -1091,8 +1216,7 @@ bnxt_hwrm_ring_alloc(struct bnxt_softc *softc, uint8_t type, cp_ring = &softc->rx_cp_rings[idx]; req.stat_ctx_id = htole32(cp_ring->stats_ctx_id); - req.rx_buf_size = htole16( - softc->scctx->isc_max_frame_size); + req.rx_buf_size = htole16(softc->rx_buf_size); req.enables |= htole32( HWRM_RING_ALLOC_INPUT_ENABLES_RX_BUF_SIZE_VALID | HWRM_RING_ALLOC_INPUT_ENABLES_STAT_CTX_ID_VALID); @@ -1107,8 +1231,7 @@ bnxt_hwrm_ring_alloc(struct bnxt_softc *softc, uint8_t type, req.rx_ring_id = htole16(softc->rx_rings[idx].phys_id); req.stat_ctx_id = htole32(cp_ring->stats_ctx_id); - req.rx_buf_size = htole16( - softc->scctx->isc_max_frame_size); + req.rx_buf_size = htole16(softc->rx_buf_size); req.enables |= htole32( HWRM_RING_ALLOC_INPUT_ENABLES_RX_RING_ID_VALID | HWRM_RING_ALLOC_INPUT_ENABLES_RX_BUF_SIZE_VALID | @@ -1145,6 +1268,29 @@ fail: return rc; } +int +bnxt_hwrm_stat_ctx_free(struct bnxt_softc *softc, struct bnxt_cp_ring *cpr) +{ + struct hwrm_stat_ctx_free_input req = {0}; + int rc = 0; + + if (cpr->stats_ctx_id == HWRM_NA_SIGNATURE) + return rc; + + bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_STAT_CTX_FREE); + + req.stat_ctx_id = htole16(cpr->stats_ctx_id); + BNXT_HWRM_LOCK(softc); + rc = _hwrm_send_message(softc, &req, sizeof(req)); + if (rc) + goto fail; + +fail: + BNXT_HWRM_UNLOCK(softc); + + return rc; +} + int bnxt_hwrm_stat_ctx_alloc(struct bnxt_softc *softc, struct bnxt_cp_ring *cpr, uint64_t paddr) @@ -1253,6 +1399,29 @@ bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt_softc *softc, return hwrm_send_message(softc, &req, sizeof(req)); } +int +bnxt_hwrm_free_filter(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic) +{ + struct hwrm_cfa_l2_filter_free_input req = {0}; + int rc = 0; + + if (vnic->filter_id == -1) + return rc; + + bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_CFA_L2_FILTER_FREE); + + req.l2_filter_id = htole64(vnic->filter_id); + + BNXT_HWRM_LOCK(softc); + rc = _hwrm_send_message(softc, &req, sizeof(req)); + if (rc) + goto fail; + +fail: + BNXT_HWRM_UNLOCK(softc); + return (rc); +} + int bnxt_hwrm_set_filter(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic) { @@ -1403,12 +1572,12 @@ bnxt_hwrm_vnic_tpa_cfg(struct bnxt_softc *softc) HWRM_VNIC_TPA_CFG_INPUT_FLAGS_ENCAP_TPA | HWRM_VNIC_TPA_CFG_INPUT_FLAGS_AGG_WITH_ECN | HWRM_VNIC_TPA_CFG_INPUT_FLAGS_AGG_WITH_SAME_GRE_SEQ; - + if (softc->hw_lro.is_mode_gro) flags |= HWRM_VNIC_TPA_CFG_INPUT_FLAGS_GRO; else flags |= HWRM_VNIC_TPA_CFG_INPUT_FLAGS_RSC_WND_UPDATE; - + req.flags = htole32(flags); req.enables = htole32(HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MAX_AGG_SEGS | diff --git a/sys/dev/bnxt/bnxt_hwrm.h b/sys/dev/bnxt/bnxt_hwrm.h index ef1071e0aad6..ad308f0bbbdd 100644 --- a/sys/dev/bnxt/bnxt_hwrm.h +++ b/sys/dev/bnxt/bnxt_hwrm.h @@ -43,6 +43,8 @@ int bnxt_alloc_hwrm_dma_mem(struct bnxt_softc *softc); void bnxt_free_hwrm_dma_mem(struct bnxt_softc *softc); int bnxt_hwrm_ring_alloc(struct bnxt_softc *softc, uint8_t type, struct bnxt_ring *ring); +int bnxt_hwrm_ring_free(struct bnxt_softc *softc, uint32_t type, + struct bnxt_ring *ring, int cmpl_ring_id); int bnxt_hwrm_ver_get(struct bnxt_softc *softc); int bnxt_hwrm_queue_qportcfg(struct bnxt_softc *softc); int bnxt_hwrm_func_drv_rgtr(struct bnxt_softc *softc); @@ -54,16 +56,22 @@ int bnxt_hwrm_set_link_setting(struct bnxt_softc *softc, bool set_pause, bool set_eee, bool set_link); int bnxt_hwrm_set_pause(struct bnxt_softc *softc); int bnxt_hwrm_vnic_ctx_alloc(struct bnxt_softc *softc, uint16_t *ctx_id); +int bnxt_hwrm_vnic_ctx_free(struct bnxt_softc *softc, uint16_t ctx_id); +int bnxt_hwrm_vnic_set_hds(struct bnxt_softc *sc, struct bnxt_vnic_info *vnic); int bnxt_hwrm_vnic_cfg(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic); +int bnxt_hwrm_vnic_alloc(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic); +int bnxt_hwrm_vnic_free(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic); int bnxt_hwrm_stat_ctx_alloc(struct bnxt_softc *softc, struct bnxt_cp_ring *cpr, uint64_t paddr); +int bnxt_hwrm_stat_ctx_free(struct bnxt_softc *softc, struct bnxt_cp_ring *cpr); int bnxt_hwrm_port_qstats(struct bnxt_softc *softc); int bnxt_hwrm_ring_grp_alloc(struct bnxt_softc *softc, struct bnxt_grp_info *grp); -int bnxt_hwrm_vnic_alloc(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic); +int bnxt_hwrm_ring_grp_free(struct bnxt_softc *softc, struct bnxt_grp_info *gr); int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic); int bnxt_hwrm_set_filter(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic); +int bnxt_hwrm_free_filter(struct bnxt_softc *softc, struct bnxt_vnic_info *vnc); int bnxt_hwrm_rss_cfg(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic, uint32_t hash_type); int bnxt_cfg_async_cr(struct bnxt_softc *softc); diff --git a/sys/dev/bnxt/bnxt_txrx.c b/sys/dev/bnxt/bnxt_txrx.c index 7ea5beab3180..c6e05be29e0e 100644 --- a/sys/dev/bnxt/bnxt_txrx.c +++ b/sys/dev/bnxt/bnxt_txrx.c @@ -282,7 +282,7 @@ bnxt_isc_rxd_refill(void *sc, if_rxd_update_t iru) for (i=0; iscctx->isc_max_frame_size); + rxbd[pidx].len = htole16(softc->rx_buf_size); /* No need to byte-swap the opaque value */ rxbd[pidx].opaque = (((rxqid & 0xff) << 24) | (flid << 16) | (frag_idxs[i])); diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c index 2bdae7f452d3..06b5bbfb907e 100644 --- a/sys/dev/bnxt/if_bnxt.c +++ b/sys/dev/bnxt/if_bnxt.c @@ -1560,6 +1560,8 @@ bnxt_attach_post(if_ctx_t ctx) softc->scctx->isc_max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + softc->rx_buf_size = min(softc->scctx->isc_max_frame_size, BNXT_PAGE_SIZE); + failed: return rc; } @@ -1613,6 +1615,108 @@ bnxt_detach(if_ctx_t ctx) return 0; } +static void +bnxt_hwrm_resource_free(struct bnxt_softc *softc) +{ + int i, rc = 0; + + rc = bnxt_hwrm_ring_free(softc, + HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL, + &softc->def_cp_ring.ring, + (uint16_t)HWRM_NA_SIGNATURE); + if (rc) + goto fail; + + for (i = 0; i < softc->ntxqsets; i++) { + rc = bnxt_hwrm_ring_free(softc, + HWRM_RING_ALLOC_INPUT_RING_TYPE_TX, + &softc->tx_rings[i], + softc->tx_cp_rings[i].ring.phys_id); + if (rc) + goto fail; + + rc = bnxt_hwrm_ring_free(softc, + HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL, + &softc->tx_cp_rings[i].ring, + (uint16_t)HWRM_NA_SIGNATURE); + if (rc) + goto fail; + + rc = bnxt_hwrm_stat_ctx_free(softc, &softc->tx_cp_rings[i]); + if (rc) + goto fail; + } + rc = bnxt_hwrm_free_filter(softc, &softc->vnic_info); + if (rc) + goto fail; + + rc = bnxt_hwrm_vnic_free(softc, &softc->vnic_info); + if (rc) + goto fail; + + rc = bnxt_hwrm_vnic_ctx_free(softc, softc->vnic_info.rss_id); + if (rc) + goto fail; + + for (i = 0; i < softc->nrxqsets; i++) { + rc = bnxt_hwrm_ring_grp_free(softc, &softc->grp_info[i]); + if (rc) + goto fail; + + rc = bnxt_hwrm_ring_free(softc, + HWRM_RING_ALLOC_INPUT_RING_TYPE_RX_AGG, + &softc->ag_rings[i], + (uint16_t)HWRM_NA_SIGNATURE); + if (rc) + goto fail; + + rc = bnxt_hwrm_ring_free(softc, + HWRM_RING_ALLOC_INPUT_RING_TYPE_RX, + &softc->rx_rings[i], + softc->rx_cp_rings[i].ring.phys_id); + if (rc) + goto fail; + + rc = bnxt_hwrm_ring_free(softc, + HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL, + &softc->rx_cp_rings[i].ring, + (uint16_t)HWRM_NA_SIGNATURE); + if (rc) + goto fail; + + if (BNXT_CHIP_P5(softc)) { + rc = bnxt_hwrm_ring_free(softc, + HWRM_RING_ALLOC_INPUT_RING_TYPE_NQ, + &softc->nq_rings[i].ring, + (uint16_t)HWRM_NA_SIGNATURE); + if (rc) + goto fail; + } + + rc = bnxt_hwrm_stat_ctx_free(softc, &softc->rx_cp_rings[i]); + if (rc) + goto fail; + } + +fail: + return; +} + + +static void +bnxt_func_reset(struct bnxt_softc *softc) +{ + + if (!BNXT_CHIP_P5(softc)) { + bnxt_hwrm_func_reset(softc); + return; + } + + bnxt_hwrm_resource_free(softc); + return; +} + + /* Device configuration */ static void bnxt_init(if_ctx_t ctx) @@ -1689,8 +1793,6 @@ skip_def_cp_ring: goto fail; softc->db_ops.bnxt_db_rx(&softc->rx_rings[i], 0); - if (!(softc->flags & BNXT_FLAG_TPA)) - goto skip_agg_rings; /* Allocate the AG ring */ rc = bnxt_hwrm_ring_alloc(softc, HWRM_RING_ALLOC_INPUT_RING_TYPE_RX_AGG, @@ -1698,7 +1800,6 @@ skip_def_cp_ring: if (rc) goto fail; softc->db_ops.bnxt_db_rx(&softc->ag_rings[i], 0); -skip_agg_rings: /* Allocate the ring group */ softc->grp_info[i].stats_ctx = @@ -1724,6 +1825,9 @@ skip_agg_rings: if (rc) goto fail; rc = bnxt_hwrm_vnic_cfg(softc, &softc->vnic_info); + if (rc) + goto fail; + rc = bnxt_hwrm_vnic_set_hds(softc, &softc->vnic_info); if (rc) goto fail; rc = bnxt_hwrm_set_filter(softc, &softc->vnic_info); @@ -1783,7 +1887,7 @@ skip_agg_rings: return; fail: - bnxt_hwrm_func_reset(softc); + bnxt_func_reset(softc); bnxt_clear_ids(softc); return; } @@ -1795,8 +1899,7 @@ bnxt_stop(if_ctx_t ctx) bnxt_do_disable_intr(&softc->def_cp_ring); bnxt_hwrm_func_reset(softc); - if (!BNXT_CHIP_P5(softc)) - bnxt_hwrm_func_reset(softc); + bnxt_func_reset(softc); bnxt_clear_ids(softc); return; } @@ -1853,6 +1956,7 @@ bnxt_mtu_set(if_ctx_t ctx, uint32_t mtu) return EINVAL; softc->scctx->isc_max_frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + softc->rx_buf_size = min(softc->scctx->isc_max_frame_size, BNXT_PAGE_SIZE); return 0; }