Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1226376lqa; Mon, 29 Apr 2024 01:56:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVNohHrEodmDXBHsO/MGGy+mx0xWd+EQFQAmqhKDYi2PkY5zok5YshGdEN2ParzMaYUr1voGMGQTq71emJs/E6w1Hzjlwq65VIXFoXaOQ== X-Google-Smtp-Source: AGHT+IGkGKUceWYQ2ZfIhk3nO5wimX46p7uwLboHeXlZJPK3NI/SmY58CqFVf0sUuBSvxrBF4aP6 X-Received: by 2002:a05:6a21:3989:b0:1ad:746:3f6e with SMTP id ad9-20020a056a21398900b001ad07463f6emr12550599pzc.54.1714380980346; Mon, 29 Apr 2024 01:56:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714380980; cv=pass; d=google.com; s=arc-20160816; b=iwUxhvcljDXibOJOCnxNJ8KX9jZphpo3S2vZGt6D1PcDKc86bTPAfFhmU8nskM2CZD K9rNhq6BTZyQ1I00FHbK7AJJDKKk64gNgpdy62jGW2SbUtFYSmMSObAmkxx4kDXNC4Dq 4KJBDNyPisr0pVwurPXDMv8a8MQWDd5vRkf7j4T5THfhvppckmpcX0haTZuapFkX22as KRqFOSZZopEc2w4CHIeNr3eblORxCC64kKtTPquYYspqIUzxfCpkds/WDYbtuUMMRn7h Xu/RWYMXxrTl6rXPPa2j0edBvq++l3eKfY7DbMrPuxY1lz9EPad5IadBeCSnhObm0Zzc bsTg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=42P8a0IUByEq2e/patLP18PTczZWOHTFsxOc5Y3WezM=; fh=9YUbCXKAFsAftPV79KFblIn3x6k+xsaURHNrmovxGbQ=; b=cO32yeWY7FVxz5uDBX8LCy8cglv+1EP/krYjEV7+vB1ybb3eoZvET+nMjOftxX5Z+7 e76STrkozIT0LjVv/B0GJwrmGZ6JbnwFT9ZQo8RzzXdbMyqi6Q2211PQBASti/IkKBEK bFTR666gFky7fobzN0mqHW7ixKX3ag/oDNFYKEDqRxQehnnaJr4oAhSSUf5j1pTGcEvV wqZVJB8ViscoFSZK0vWjmvEEpHcVym0TLQ40MlSrkX+YTRWZux0Epg7FDsLWV4Z+XFQn Mq8tE6soP39/24AR0yb4bxJwaRP2sEimFxaGs1LewBgBoBtGZtBNPjlQRLrILX/h6tP+ Gg8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-161938-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161938-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s3-20020a056a00178300b006f01771dab6si14429533pfg.190.2024.04.29.01.56.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 01:56:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161938-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-161938-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161938-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 76FA1281069 for ; Mon, 29 Apr 2024 08:56:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8775C182B3; Mon, 29 Apr 2024 08:56:11 +0000 (UTC) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E7FD17BB4; Mon, 29 Apr 2024 08:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714380971; cv=none; b=pBR2XTcKVq3tJkTurkNhKMEjCuKF9tFboR+nfcwwxldZv3uzPTv5lEDquqOaLf+kTw/A48IlkJ3U2NZLhI8gUN3qcsmyQProU118hcdO2j2XfTOWGMroCz4GO61KcaRUV3C52w0eNA7IiKHE3oHsU0V9sTJSemwkoXH0bdAFnSw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714380971; c=relaxed/simple; bh=n30UgSV1qzNHJ8b0nte2dL/KqEDeOoQVGhz9ly56ikw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=RJ7UfgoIGbShRe2RENKEdw8WCnKbPaogpKOLC1+Xl66ruF0CWthHfJnp6DyN+yO3AC1PXI8wEGNe8CNtgFzeQmB6lQCjrO6vPU61oE2e6rp8jsD0juvnZXs3KXQTx7KyVOjEt541oHSOUadz3+wMXv1THUzg59g4l7bp0HCbGH4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-518a56cdbcfso6509750e87.2; Mon, 29 Apr 2024 01:56:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714380967; x=1714985767; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=42P8a0IUByEq2e/patLP18PTczZWOHTFsxOc5Y3WezM=; b=LMQ6bmnAJgc84QzxeyTmGzYJq+l4b/EHzd3ypdYYhaboPOe4FCgFlkiDYQXANxfeRr /rftTWUyxjHbH+fu8aF17M8KVNfR8n518ppXNo/6XgMyD6yo6X9IDXDr3Ep/RC0O7wF7 YMP9SokdPMGto5Sg8uSIFnQQT+OXchAKXXVaLcAHcGq+bdtLbG1/P2THeOjd/3Xso/pd iiQBk+V0dxmOuyBly1KWqL6uCtMjytITvk/ktJ7n41uHV6YRtytiEKfciQHAmB1djfAd VQJr7secmFOTFi//gbskuHrjXXfNaWkpV34tkRSFmGokcV3fEGQofoVWtBNtO94nHzLI NG4A== X-Forwarded-Encrypted: i=1; AJvYcCVu1RQYC0WNp82gqJunAhi68lSVhloyEGIn2l1aOioI6lhao6UIEUHkr/5YoEGOWfd7B9ip0TTFD7P4uuN3rHU5YRA2SgLSdqg84FtbTvEuOuCK0i6sY2WiO+0oWwq5CUfWSdyC X-Gm-Message-State: AOJu0YxfycMva69u6Vru/eZgkSZxOrmMWCnH/oh5ait/gZQWpIn4ezQr JNfG9LdD3t9SX7cXkuD8fnEhSIhDMjB7xaxPE1Xl8ISGcFgior8T X-Received: by 2002:a19:5517:0:b0:51d:4c8a:bbdb with SMTP id n23-20020a195517000000b0051d4c8abbdbmr3768447lfe.3.1714380967255; Mon, 29 Apr 2024 01:56:07 -0700 (PDT) Received: from localhost (fwdproxy-lla-007.fbsv.net. [2a03:2880:30ff:7::face:b00c]) by smtp.gmail.com with ESMTPSA id 17-20020a170906311100b00a5599f3a057sm10995436ejx.107.2024.04.29.01.56.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 01:56:06 -0700 (PDT) From: Breno Leitao To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: leit@meta.com, netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next] net: loopback: Do not allocate tstats explicitly Date: Mon, 29 Apr 2024 01:55:58 -0700 Message-ID: <20240429085559.2841918-1-leitao@debian.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit With commit 34d21de99cea9 ("net: Move {l,t,d}stats allocation to core and convert veth & vrf"), stats allocation could be done on net core instead of in this driver. With this new approach, the driver doesn't have to bother with error handling (allocation failure checking, making sure free happens in the right spot, etc). This is core responsibility now. Remove the allocation in the loopback driver and leverage the network core allocation instead. Signed-off-by: Breno Leitao --- drivers/net/loopback.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index f6eab66c2660..2b486e7c749c 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -141,9 +141,6 @@ static const struct ethtool_ops loopback_ethtool_ops = { static int loopback_dev_init(struct net_device *dev) { - dev->lstats = netdev_alloc_pcpu_stats(struct pcpu_lstats); - if (!dev->lstats) - return -ENOMEM; netdev_lockdep_set_classes(dev); return 0; } @@ -151,7 +148,6 @@ static int loopback_dev_init(struct net_device *dev) static void loopback_dev_free(struct net_device *dev) { dev_net(dev)->loopback_dev = NULL; - free_percpu(dev->lstats); } static const struct net_device_ops loopback_ops = { @@ -191,6 +187,7 @@ static void gen_lo_setup(struct net_device *dev, dev->header_ops = hdr_ops; dev->netdev_ops = dev_ops; dev->needs_free_netdev = true; + dev->pcpu_stat_type = NETDEV_PCPU_STAT_LSTATS; dev->priv_destructor = dev_destructor; netif_set_tso_max_size(dev, GSO_MAX_SIZE); -- 2.43.0