From nobody Mon Dec 06 17:32:47 2021 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 CA52818C495C; Mon, 6 Dec 2021 17:32:48 +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 4J79Vl6cYyz3jXR; Mon, 6 Dec 2021 17:32:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 94C897976; Mon, 6 Dec 2021 17:32:47 +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 1B6HWl1h068558; Mon, 6 Dec 2021 17:32:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B6HWlDh068557; Mon, 6 Dec 2021 17:32:47 GMT (envelope-from git) Date: Mon, 6 Dec 2021 17:32:47 GMT Message-Id: <202112061732.1B6HWlDh068557@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 6ff4cac2ee9e - main - ifnet: initial if_grow() shall always succeed 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6ff4cac2ee9ee74911b538a67337bf510c4cffe4 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638811968; 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=dllkA7TDtQknamk03sw1gE5XwZ9rd9HReOSQC4wYwaA=; b=kdjXlJWJEurkmGwkEUifUZtp1MYF05D43OVYIu2vBn5wa1cLwhZRMmoaGBAKFATN+b6NpZ ROX3oK2LdiJPHKbYMsxX5CDVw7f85g1EUMBYm9tpPzxio1kw7cH21iXNaXlA9INEuDAWu6 KBGwNbgM/Ey0c6GoVSaHctyIJ70z19FQZDa6p+sNQKD5UDaTcpKn1cTmrhRg8PjtpriKRt fwPBLdJiYaz0nCj8ujP5hCjZved+TjL/ElZYTOl4a/UWIAy6xxIBL4iamP9R06+BvQmjuz f97U6uDthFTmGRuZ+gIfmOiz+vC+kASDJQrKytmjrSMBASPOEGD8mlHsiab0hw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638811968; a=rsa-sha256; cv=none; b=pOj6RXg2yuv2ST9p7JExOR8Woew44XXryIJ2RhksBD5U0OilsVBBkYg1xhYGPZe1+xodlJ 2W3CD6tAgdg1atEoFGaVDfTMjRj5HkohOgBhEDNfcZ6fWHqBezKuCEy1JXdPmGgFtIVT20 cjo8cLebJPtj9Ui16/jOpKYjllP0uNmsgtWAMo6TbxiAtyD7FDoVcLtWMHCcTj29H3D9Q1 J9eACc2oVwXt5jyh4mHIgHuOB0aOhWbt51/A46kDCiQ/ySEySXnsIfBNVfr2tpxXQ4kfeB 4p/yr8AobX+cVxO46oCZcY9KXJFrNSLRbtSFBYk3T2jsdEoFcAXui32HlP5tPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=6ff4cac2ee9ee74911b538a67337bf510c4cffe4 commit 6ff4cac2ee9ee74911b538a67337bf510c4cffe4 Author: Gleb Smirnoff AuthorDate: 2021-12-04 17:49:35 +0000 Commit: Gleb Smirnoff CommitDate: 2021-12-06 17:32:31 +0000 ifnet: initial if_grow() shall always succeed So let's just call malloc() directly. This also avoids hidden doubling of default V_if_indexlim. Reviewed by: melifaro, bz, kp Differential revision: https://reviews.freebsd.org/D33261 --- sys/net/if.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 8b820eb562ed..079ad734812b 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -441,15 +441,11 @@ ifaddr_byindex(u_short idx) static void vnet_if_init(const void *unused __unused) { - void *old; CK_STAILQ_INIT(&V_ifnet); CK_STAILQ_INIT(&V_ifg_head); - IFNET_WLOCK(); - old = if_grow(); /* create initial table */ - IFNET_WUNLOCK(); - epoch_wait_preempt(net_epoch_preempt); - free(old, M_IFNET); + V_ifindex_table = malloc(V_if_indexlim * sizeof(*V_ifindex_table), + M_IFNET, M_WAITOK | M_ZERO); vnet_if_clone_init(); } VNET_SYSINIT(vnet_if_init, SI_SUB_INIT_IF, SI_ORDER_SECOND, vnet_if_init,