From nobody Tue Sep 3 10:27:18 2024 X-Original-To: dev-commits-src-all@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 4WyhdM2xjXz5MkjC; Tue, 03 Sep 2024 10:27:19 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WyhdL6Gjfz4sp7; Tue, 3 Sep 2024 10:27:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725359238; 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=cANU/sqJymckDMTDZfeRXN5Inxu9BwtfL+2Djc/OwMc=; b=n1HI6LqN3iS1AQqES/QJ1kiKpGuQf8UaisY1aAshFyALb/yzeKasvMx2TEXKVoDhYODwqK YXuBB8uPpM2UlpjU0T6E9EWRnQ7eYBPlx+QuwnFDPsyK2bN/0qbJdPWETMLKqnmj1SDrF6 VtNod4ZrZX3r8hvPo5qQS9+adKaJUgBFK/CN+HzVm8kCL3eKuJ4F1Z59jJwiKrUzghEMCe u76FFO0IhdGnbULdJlwbzt40kstxcZzEj3+T+1O1p6iHJaxV0Q8eu5Abqhhb4DI47DLTa6 9+08UzwstMV5rz7hTWz2iKm394nnmdMcYTsZDayl9OZUqhV9UfTHoqp/ZZAxiw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725359238; a=rsa-sha256; cv=none; b=p7vSrZVWfxz+A1t1pSGrRM5lS1bsg1q5OP+yW2T+ofgM9rC76Pt3q+jhLi1RhFNANaZ9u7 1QnldG78zdC67dKzZ79YpP0mgB0xNI8WxRipSlG1WujxNGVF8/cXu4/6EKhgTNHCg13Gqw Uda8Uo6N7y/VG4XG8YqIPDLhWsIj+TbhSW9bTEVRTaT1RYTRoZlKnPL/skEQdc+e+sdCYw eCOtKhhSUz/FQ1BEbGK9zxyPKrmbV2HW60YGLV8OHkqtuKQ0Gu1uEbmk0tFTQx78MjZosb 3kzNXMNM8cUruSRsg9yU7krJKN56tlBrgdZoohmfep/1/70bvcqqmDdy+H0Jkw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725359238; 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=cANU/sqJymckDMTDZfeRXN5Inxu9BwtfL+2Djc/OwMc=; b=U9GcFQzVrRmlgMUIwU2cYrYiW6RyOz3v5wMgRo7HDfX57/Y+YN6JoxQp1P2VMWHBae1xN3 dx1ypRdvFkvJxPLcwEBcwg/+todoa/VCOCuzk8y0HVjazOYYm3u6bY+Eyp/fdx6RMtLmaI qza/OU4le5qQIQOFhrr+LhRRT+tdqAuFGpZrKnoHUkofKNaHpP9dCJz6S5Uxwx/MZS+r48 RZASKsOQ3AFRiEJyiEIi4/Cs0bCclmhRIDbNA+MwGurGI8GInMmGEgnSwSPJ5y6FBGF3Dl QYlmmzOWGNebUEQfCbA3hM/Os9yRUfkvehF84ohEvG6BkYyQ9ui6uvOA99txug== 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 4WyhdL5rJwzcb7; Tue, 3 Sep 2024 10:27:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 483ARIjk010289; Tue, 3 Sep 2024 10:27:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 483ARIHD010286; Tue, 3 Sep 2024 10:27:18 GMT (envelope-from git) Date: Tue, 3 Sep 2024 10:27:18 GMT Message-Id: <202409031027.483ARIHD010286@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 5f97656fa334 - main - ice(4): Stop checking for failures from malloc(M_WAITOK) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5f97656fa334b494d70866cb1bfff406d3efd92d Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=5f97656fa334b494d70866cb1bfff406d3efd92d commit 5f97656fa334b494d70866cb1bfff406d3efd92d Author: Zhenlei Huang AuthorDate: 2024-09-03 10:25:29 +0000 Commit: Zhenlei Huang CommitDate: 2024-09-03 10:25:29 +0000 ice(4): Stop checking for failures from malloc(M_WAITOK) As a consequence now ice_alloc_vsi_qmap() does not fail. Remove unneeded error checks. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852 --- sys/dev/ice/ice_lib.c | 24 +++--------------------- sys/dev/ice/ice_lib.h | 2 +- sys/dev/ice/if_ice_iflib.c | 13 ++----------- 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/sys/dev/ice/ice_lib.c b/sys/dev/ice/ice_lib.c index 659412450fce..7077859cc877 100644 --- a/sys/dev/ice/ice_lib.c +++ b/sys/dev/ice/ice_lib.c @@ -426,31 +426,21 @@ ice_setup_pf_vsi(struct ice_softc *sc) * all queues for this VSI are not yet assigned an index and thus, * not ready for use. * - * Returns an error code on failure. */ -int +void ice_alloc_vsi_qmap(struct ice_vsi *vsi, const int max_tx_queues, const int max_rx_queues) { - struct ice_softc *sc = vsi->sc; int i; MPASS(max_tx_queues > 0); MPASS(max_rx_queues > 0); /* Allocate Tx queue mapping memory */ - if (!(vsi->tx_qmap = - (u16 *) malloc(sizeof(u16) * max_tx_queues, M_ICE, M_WAITOK))) { - device_printf(sc->dev, "Unable to allocate Tx qmap memory\n"); - return (ENOMEM); - } + vsi->tx_qmap = malloc(sizeof(u16) * max_tx_queues, M_ICE, M_WAITOK); /* Allocate Rx queue mapping memory */ - if (!(vsi->rx_qmap = - (u16 *) malloc(sizeof(u16) * max_rx_queues, M_ICE, M_WAITOK))) { - device_printf(sc->dev, "Unable to allocate Rx qmap memory\n"); - goto free_tx_qmap; - } + vsi->rx_qmap = malloc(sizeof(u16) * max_rx_queues, M_ICE, M_WAITOK); /* Mark every queue map as invalid to start with */ for (i = 0; i < max_tx_queues; i++) { @@ -459,14 +449,6 @@ ice_alloc_vsi_qmap(struct ice_vsi *vsi, const int max_tx_queues, for (i = 0; i < max_rx_queues; i++) { vsi->rx_qmap[i] = ICE_INVALID_RES_IDX; } - - return 0; - -free_tx_qmap: - free(vsi->tx_qmap, M_ICE); - vsi->tx_qmap = NULL; - - return (ENOMEM); } /** diff --git a/sys/dev/ice/ice_lib.h b/sys/dev/ice/ice_lib.h index cfd848d370bb..6c010cffc0fd 100644 --- a/sys/dev/ice/ice_lib.h +++ b/sys/dev/ice/ice_lib.h @@ -830,7 +830,7 @@ void ice_free_bar(device_t dev, struct ice_bar_info *bar); void ice_set_ctrlq_len(struct ice_hw *hw); void ice_release_vsi(struct ice_vsi *vsi); struct ice_vsi *ice_alloc_vsi(struct ice_softc *sc, enum ice_vsi_type type); -int ice_alloc_vsi_qmap(struct ice_vsi *vsi, const int max_tx_queues, +void ice_alloc_vsi_qmap(struct ice_vsi *vsi, const int max_tx_queues, const int max_rx_queues); void ice_free_vsi_qmaps(struct ice_vsi *vsi); int ice_initialize_vsi(struct ice_vsi *vsi); diff --git a/sys/dev/ice/if_ice_iflib.c b/sys/dev/ice/if_ice_iflib.c index 4e451bf3fb55..3de79787f6e8 100644 --- a/sys/dev/ice/if_ice_iflib.c +++ b/sys/dev/ice/if_ice_iflib.c @@ -631,12 +631,8 @@ reinit_hw: */ ice_setup_pf_vsi(sc); - err = ice_alloc_vsi_qmap(&sc->pf_vsi, scctx->isc_ntxqsets_max, + ice_alloc_vsi_qmap(&sc->pf_vsi, scctx->isc_ntxqsets_max, scctx->isc_nrxqsets_max); - if (err) { - device_printf(dev, "Unable to allocate VSI Queue maps\n"); - goto free_main_vsi; - } /* Allocate MSI-X vectors (due to isc_flags IFLIB_SKIP_MSIX) */ err = ice_allocate_msix(sc); @@ -3518,12 +3514,7 @@ ice_setup_mirror_vsi(struct ice_mirr_if *mif) mif->vsi = vsi; /* Reserve VSI queue allocation from PF queues */ - ret = ice_alloc_vsi_qmap(vsi, ICE_DEFAULT_VF_QUEUES, ICE_DEFAULT_VF_QUEUES); - if (ret) { - device_printf(dev, "%s: Unable to allocate mirror VSI queue maps (%d queues): %s\n", - __func__, ICE_DEFAULT_VF_QUEUES, ice_err_str(ret)); - goto release_vsi; - } + ice_alloc_vsi_qmap(vsi, ICE_DEFAULT_VF_QUEUES, ICE_DEFAULT_VF_QUEUES); vsi->num_tx_queues = vsi->num_rx_queues = ICE_DEFAULT_VF_QUEUES; /* Assign Tx queues from PF space */