From nobody Tue Sep 03 10:27:20 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 4WyhdP4hMZz5MkVS; Tue, 03 Sep 2024 10:27:21 +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 4WyhdP0RVrz4t0b; Tue, 3 Sep 2024 10:27:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725359241; 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=BXo68YeQAE+4AB4unaznuq4c8favXiybtQOQvy264AY=; b=T9hTyLNaKnbLa/DF7fhhOLjBsOevZozVPxx0IAX2j3K+KAONNxOGI2rUsAheG/lgnlqmKs ezhh5PFGTz12WnxMiTLeUkcAqLovy6Y+0t24xT8UNmE7aMCEqb4BzsU1C+vx3Th8O3uxJM /JRa4qYPJ4hQwHoOhp1OQTuwEJ4b1uoeAYrPnG+xSZ4/ZTSO+CJDXKaSQhvwCzhXHA7osl R+/JDbmt5LWNZIHbwDHRmYlCChvF56LCBezf6b0Xrgo8BX/vJfTLssUoHJegAK0FLDr8Vz 881huvjjc2CxAMmMD0GB8ZZtWCOoDXXCcvsFC+skSQL4N9yI+UeBF9ugjB7Q6g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725359241; a=rsa-sha256; cv=none; b=VFCVLle/fDnN9qqnkI7bxI97kQylgPA2VupOwfV+K4bufoGiYEVnsdwfGcS6R41JkyUxzf LEtl26lImUNWEi9AcV1XYE1QeWiahjrbUejOzxfiwNMtE6vTCpWQsp8250Op02txI/SPr2 vAtPA2ZWz4LKeXML1YYbb3CZfdFAmde7EkKqMS9U5JUHmypk8h+PWJIq8V962EH0Tvwnof 8icdZcSf7fElv/9nhUmKfs+ZIIld9X+KSvwYiby3Hh38WUqBfKvSewdJf/iIB9qMcVG8mp 4d2OoiZ0riGA3nsFZ5/58jlneBu1VH/qiq6XS6jQIxIMVYyXBV5U8uMwdryvHg== 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=1725359241; 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=BXo68YeQAE+4AB4unaznuq4c8favXiybtQOQvy264AY=; b=d2j+KV2wRuZM0KC7JJxsPVO2zrJx2ZS9kRe2SUXFD758uUO9lq2m82vRbWy0LJJrquoJla uA+zMjvy+h0sfYr1JRcVXDbTaxciCVSYRvYxbLVFjJVI7ThwfZm4z9+CgnORWzCPNnchhq 4UdPFww4+QsjiP3Q+taUyHQE4lxuRnysQraq0cpHMqKawNn/BZAuNtKfcA+kbgixkETupF 3/rqCp3ZWwJ4OVFKqIQnoOQRzTRwqZw42YK+qG5zgO/BRN5faYbL83s3eJC+9QNetGjx8l DZ8jmUGFGpQ6zSYjUA4Avk37nj2GbkKGkXv0oxcrsr4O+8M9eTiOvLEd+lWhhA== 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 4WyhdP03Pmzd15; Tue, 3 Sep 2024 10:27:21 +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 483ARK7C010385; Tue, 3 Sep 2024 10:27:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 483ARKpj010382; Tue, 3 Sep 2024 10:27:20 GMT (envelope-from git) Date: Tue, 3 Sep 2024 10:27:20 GMT Message-Id: <202409031027.483ARKpj010382@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: 1dc7a7b74b5a - main - mana: Stop checking for failures from malloc/mallocarray/buf_ring_alloc(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: 1dc7a7b74b5ad37ff7c8dc22f1a710460a5f1dcd Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=1dc7a7b74b5ad37ff7c8dc22f1a710460a5f1dcd commit 1dc7a7b74b5ad37ff7c8dc22f1a710460a5f1dcd Author: Zhenlei Huang AuthorDate: 2024-09-03 10:25:30 +0000 Commit: Zhenlei Huang CommitDate: 2024-09-03 10:25:30 +0000 mana: Stop checking for failures from malloc/mallocarray/buf_ring_alloc(M_WAITOK) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852 --- sys/dev/mana/gdma_main.c | 19 ------------------- sys/dev/mana/hw_channel.c | 17 ----------------- sys/dev/mana/mana_en.c | 41 ----------------------------------------- 3 files changed, 77 deletions(-) diff --git a/sys/dev/mana/gdma_main.c b/sys/dev/mana/gdma_main.c index 6f3e182ba1eb..13f2617ad7d4 100644 --- a/sys/dev/mana/gdma_main.c +++ b/sys/dev/mana/gdma_main.c @@ -868,9 +868,6 @@ int mana_gd_create_hwc_queue(struct gdma_dev *gd, int err; queue = malloc(sizeof(*queue), M_DEVBUF, M_WAITOK | M_ZERO); - if (!queue) - return ENOMEM; - gmi = &queue->mem_info; err = mana_gd_alloc_memory(gc, spec->queue_size, gmi); if (err) @@ -962,9 +959,6 @@ mana_gd_create_dma_region(struct gdma_dev *gd, } req = malloc(req_msg_size, M_DEVBUF, M_WAITOK | M_ZERO); - if (!req) - return ENOMEM; - mana_gd_init_req_hdr(&req->hdr, GDMA_CREATE_DMA_REGION, req_msg_size, sizeof(resp)); req->length = length; @@ -1008,9 +1002,6 @@ mana_gd_create_mana_eq(struct gdma_dev *gd, return EINVAL; queue = malloc(sizeof(*queue), M_DEVBUF, M_WAITOK | M_ZERO); - if (!queue) - return ENOMEM; - gmi = &queue->mem_info; err = mana_gd_alloc_memory(gc, spec->queue_size, gmi); if (err) @@ -1056,9 +1047,6 @@ int mana_gd_create_mana_wq_cq(struct gdma_dev *gd, return EINVAL; queue = malloc(sizeof(*queue), M_DEVBUF, M_WAITOK | M_ZERO); - if (!queue) - return ENOMEM; - gmi = &queue->mem_info; err = mana_gd_alloc_memory(gc, spec->queue_size, gmi); if (err) @@ -1480,9 +1468,6 @@ mana_gd_alloc_res_map(uint32_t res_avail, r->map = malloc(n * sizeof(unsigned long), M_DEVBUF, M_WAITOK | M_ZERO); - if (!r->map) - return ENOMEM; - r->size = res_avail; mtx_init(&r->lock_spin, lock_name, NULL, MTX_SPIN); @@ -1616,10 +1601,6 @@ mana_gd_setup_irqs(device_t dev) gc->irq_contexts = malloc(nvec * sizeof(struct gdma_irq_context), M_DEVBUF, M_WAITOK | M_ZERO); - if (!gc->irq_contexts) { - rc = ENOMEM; - goto err_setup_irq_release; - } for (i = 0; i < nvec; i++) { gic = &gc->irq_contexts[i]; diff --git a/sys/dev/mana/hw_channel.c b/sys/dev/mana/hw_channel.c index 7a40a28894fb..5904389596a3 100644 --- a/sys/dev/mana/hw_channel.c +++ b/sys/dev/mana/hw_channel.c @@ -416,8 +416,6 @@ mana_hwc_create_cq(struct hw_channel_context *hwc, cq_size = MINIMUM_SUPPORTED_PAGE_SIZE; hwc_cq = malloc(sizeof(*hwc_cq), M_DEVBUF, M_WAITOK | M_ZERO); - if (!hwc_cq) - return ENOMEM; err = mana_hwc_create_gdma_eq(hwc, eq_size, ctx, callback, &eq); if (err) { @@ -438,10 +436,6 @@ mana_hwc_create_cq(struct hw_channel_context *hwc, comp_buf = mallocarray(q_depth, sizeof(struct gdma_comp), M_DEVBUF, M_WAITOK | M_ZERO); - if (!comp_buf) { - err = ENOMEM; - goto out; - } hwc_cq->hwc = hwc; hwc_cq->comp_buf = comp_buf; @@ -476,8 +470,6 @@ mana_hwc_alloc_dma_buf(struct hw_channel_context *hwc, uint16_t q_depth, dma_buf = malloc(sizeof(*dma_buf) + q_depth * sizeof(struct hwc_work_request), M_DEVBUF, M_WAITOK | M_ZERO); - if (!dma_buf) - return ENOMEM; dma_buf->num_reqs = q_depth; @@ -560,8 +552,6 @@ mana_hwc_create_wq(struct hw_channel_context *hwc, queue_size = MINIMUM_SUPPORTED_PAGE_SIZE; hwc_wq = malloc(sizeof(*hwc_wq), M_DEVBUF, M_WAITOK | M_ZERO); - if (!hwc_wq) - return ENOMEM; err = mana_hwc_create_gdma_wq(hwc, q_type, queue_size, &queue); if (err) @@ -669,8 +659,6 @@ mana_hwc_test_channel(struct hw_channel_context *hwc, uint16_t q_depth, ctx = malloc(q_depth * sizeof(struct hwc_caller_ctx), M_DEVBUF, M_WAITOK | M_ZERO); - if (!ctx) - return ENOMEM; for (i = 0; i < q_depth; ++i) init_completion(&ctx[i].comp_event); @@ -719,9 +707,6 @@ mana_hwc_establish_channel(struct gdma_context *gc, uint16_t *q_depth, gc->cq_table = malloc(gc->max_num_cqs * sizeof(struct gdma_queue *), M_DEVBUF, M_WAITOK | M_ZERO); - if (!gc->cq_table) - return ENOMEM; - gc->cq_table[cq->id] = cq; return 0; @@ -782,8 +767,6 @@ mana_hwc_create_channel(struct gdma_context *gc) int err; hwc = malloc(sizeof(*hwc), M_DEVBUF, M_WAITOK | M_ZERO); - if (!hwc) - return ENOMEM; gd->gdma_context = gc; gd->driver_data = hwc; diff --git a/sys/dev/mana/mana_en.c b/sys/dev/mana/mana_en.c index 961399172688..90db036ff59b 100644 --- a/sys/dev/mana/mana_en.c +++ b/sys/dev/mana/mana_en.c @@ -921,13 +921,6 @@ mana_init_port_context(struct mana_port_context *apc) apc->rxqs = mallocarray(apc->num_queues, sizeof(struct mana_rxq *), M_DEVBUF, M_WAITOK | M_ZERO); - if (!apc->rxqs) { - bus_dma_tag_destroy(apc->tx_buf_tag); - bus_dma_tag_destroy(apc->rx_buf_tag); - apc->rx_buf_tag = NULL; - return ENOMEM; - } - return 0; } @@ -1156,8 +1149,6 @@ mana_cfg_vport_steering(struct mana_port_context *apc, req_buf_size = sizeof(*req) + sizeof(mana_handle_t) * num_entries; req = malloc(req_buf_size, M_DEVBUF, M_WAITOK | M_ZERO); - if (!req) - return ENOMEM; mana_gd_init_req_hdr(&req->hdr, MANA_CONFIG_VPORT_RX, req_buf_size, sizeof(resp)); @@ -1325,8 +1316,6 @@ mana_create_eq(struct mana_context *ac) ac->eqs = mallocarray(gc->max_num_queues, sizeof(struct mana_eq), M_DEVBUF, M_WAITOK | M_ZERO); - if (!ac->eqs) - return ENOMEM; spec.type = GDMA_EQ; spec.monitor_avl_buf = false; @@ -2043,8 +2032,6 @@ mana_create_txq(struct mana_port_context *apc, if_t net) apc->tx_qp = mallocarray(apc->num_queues, sizeof(struct mana_tx_qp), M_DEVBUF, M_WAITOK | M_ZERO); - if (!apc->tx_qp) - return ENOMEM; /* The minimum size of the WQE is 32 bytes, hence * MAX_SEND_BUFFERS_PER_QUEUE represents the maximum number of WQEs @@ -2141,14 +2128,6 @@ mana_create_txq(struct mana_port_context *apc, if_t net) txq->tx_buf_info = malloc(MAX_SEND_BUFFERS_PER_QUEUE * sizeof(struct mana_send_buf_info), M_DEVBUF, M_WAITOK | M_ZERO); - if (unlikely(txq->tx_buf_info == NULL)) { - if_printf(net, - "Failed to allocate tx buf info for SQ %u\n", - txq->gdma_sq->id); - err = ENOMEM; - goto out; - } - snprintf(txq->txq_mtx_name, nitems(txq->txq_mtx_name), "mana:tx(%d)", i); @@ -2156,13 +2135,6 @@ mana_create_txq(struct mana_port_context *apc, if_t net) txq->txq_br = buf_ring_alloc(4 * MAX_SEND_BUFFERS_PER_QUEUE, M_DEVBUF, M_WAITOK, &txq->txq_mtx); - if (unlikely(txq->txq_br == NULL)) { - if_printf(net, - "Failed to allocate buf ring for SQ %u\n", - txq->gdma_sq->id); - err = ENOMEM; - goto out; - } /* Allocate taskqueue for deferred send */ TASK_INIT(&txq->enqueue_task, 0, mana_xmit_taskfunc, txq); @@ -2353,9 +2325,6 @@ mana_create_rxq(struct mana_port_context *apc, uint32_t rxq_idx, rxq = malloc(sizeof(*rxq) + RX_BUFFERS_PER_QUEUE * sizeof(struct mana_recv_buf_oob), M_DEVBUF, M_WAITOK | M_ZERO); - if (!rxq) - return NULL; - rxq->ndev = ndev; rxq->num_rx_buf = RX_BUFFERS_PER_QUEUE; rxq->rxq_idx = rxq_idx; @@ -2808,12 +2777,6 @@ mana_probe_port(struct mana_context *ac, int port_idx, *ndev_storage = ndev; apc = malloc(sizeof(*apc), M_DEVBUF, M_WAITOK | M_ZERO); - if (!apc) { - mana_err(NULL, "Failed to allocate port context\n"); - err = ENOMEM; - goto free_net; - } - apc->ac = ac; apc->ndev = ndev; apc->max_queues = gc->max_num_queues; @@ -2892,7 +2855,6 @@ mana_probe_port(struct mana_context *ac, int port_idx, reset_apc: free(apc, M_DEVBUF); -free_net: *ndev_storage = NULL; if_printf(ndev, "Failed to probe vPort %d: %d\n", port_idx, err); if_free(ndev); @@ -2915,9 +2877,6 @@ int mana_probe(struct gdma_dev *gd) return err; ac = malloc(sizeof(*ac), M_DEVBUF, M_WAITOK | M_ZERO); - if (!ac) - return ENOMEM; - ac->gdma_dev = gd; ac->num_ports = 1; gd->driver_data = ac;