aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhenlei Huang <zlei@FreeBSD.org>2024-09-03 10:25:29 +0000
committerZhenlei Huang <zlei@FreeBSD.org>2024-09-03 10:25:29 +0000
commit5f97656fa334b494d70866cb1bfff406d3efd92d (patch)
tree4ee3d9b9f4fae6ac1984c8028f70e18d0229a345
parent92b0370ec65d5287a1deec84fd513e320a8da736 (diff)
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
-rw-r--r--sys/dev/ice/ice_lib.c24
-rw-r--r--sys/dev/ice/ice_lib.h2
-rw-r--r--sys/dev/ice/if_ice_iflib.c13
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 */