Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1143738rdb; Mon, 19 Feb 2024 05:52:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVI+OHg0dzewdaxWK+kjDB3Rn8wG/17WhfOMqcF9EJqufkkSmglCPx3YHhWP4FjHJCKRB/PNgWvSt+YMTMCRFgDaZbaMwxhPvpdK8RUYg== X-Google-Smtp-Source: AGHT+IH8KQPxmnK4LzVnZI0quqxhcdAB6noOt01CsENp1m+NOQub8RfJQ6jt+vUn8zc0mKszBdne X-Received: by 2002:a05:6512:4c8:b0:511:6985:d8d1 with SMTP id w8-20020a05651204c800b005116985d8d1mr7734678lfq.31.1708350737090; Mon, 19 Feb 2024 05:52:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708350737; cv=pass; d=google.com; s=arc-20160816; b=bQr6pklqejwGtZLJ0uAWruO4v1eqGtpWCDDA8GnCsfrwzqe/DChNilB5Vw6PJ/OAV1 HkV7CJHLuGRqLxBtT5arMNpu0qWYeXcWq+oVgwzPOJVF/PRPxWGRGubjHhCWkBVeNFvs d3oT+CgsR29GHuYBF903CcoQcv/sXO5r5Dau5BY+y+iZYAWM6Iqoh19sZE7+1LEUwckh B+Yqi/+tu6iPwS/Gn5pcYtbkp6KUYFa0iF/Xgn3VCqVQxLVjB+wXuvKvT/j2zDo+V1ZE bkBtrT1D0QHYLVSN7q1nKgXDMiLv2fgUABG5fKXRualTDxL9PwffdDyaj814SliS3qaY WcFg== 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=oOR3y9Zmm8Tuo993+z9hIy+5r2d0Ko/vjpAMAXO6LDc=; fh=a81TY6rPooICu3m3QRmgTTkCpyRYwuheFYj/WYZiRPE=; b=IbXyRhgFh7Ap498H1NN0+6ddi+xAngblnA/I//NW1Y/BhjVZhouGE3OMyeTqE/Womg sieJ9ddC76jFhK5Y1x/6EAYF6k1E8Hy1FYOB+q4/vaQrb2lde8h17oq5m3S3HNBchUZI U6HQ42QAY3kpCjkXhZm94KLw/60fhSFzFTf9ydaraS3lLVYBsdtEozfagD2LZjybgZun 8NquY05Qa6Wr8MdqJOWsJ8B0k+PulBcsjjqvZe2FLOsafC1CNogxno9SWIZtdV4sPZlz YDOQBM9cqxDEwzBJqKRcw3zaCX5HNjHMw7jBziXptzZ4nZSLwoys5OPuztHTLSNasxx2 H1hQ==; 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-71425-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71425-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id q28-20020a50aa9c000000b005649ddfe7ddsi395288edc.554.2024.02.19.05.52.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 05:52:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71425-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-71425-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71425-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4E93B1F25500 for ; Mon, 19 Feb 2024 13:43:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5573B364C6; Mon, 19 Feb 2024 13:43:40 +0000 (UTC) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 286803612C; Mon, 19 Feb 2024 13:43:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708350219; cv=none; b=Ji72jy0QxPKmVSK86SYjZfMLZkw0r+KTKfzU4P5IWIUAwi2zbAzXY8I+/Pw0pjZcBB2mJcXh9XXaSX9HYuYTVH+8i1cKlR8+AGDSiA1GuFD2ZYT7IvHl1RmLIc7m2K73HWXQpr9ORNpMYRvxqP9/RUcqiivDEnr96qVT/ITNwSo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708350219; c=relaxed/simple; bh=Gt5OwY2whQVuVaWFJk6JeoMSVY3zk5FlZi+HF/R3eks=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=OGFrYFFB/83kxVcATA0Ll7dvf5c5YLdvgNktVH+C5Tos9KnoPUCXy92Wj1iXG4u9xo0i1AaEp2Bpg1taOd6C8onkAg0RhCqJP3NVKeXRX8bR686FR4RzgnKl46Csn6t2IPy+Ti9Y7Ogp5HtBX7idvQIKF2QQjqoCcKfV+oisaWo= 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.42 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-f42.google.com with SMTP id 2adb3069b0e04-512bc0e8ce1so687217e87.0; Mon, 19 Feb 2024 05:43:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708350216; x=1708955016; 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=oOR3y9Zmm8Tuo993+z9hIy+5r2d0Ko/vjpAMAXO6LDc=; b=LRskpWjfriq+CsbFhTZ0HnZqbNN+0YI7GbpqJxBVHuGhhxSOLD8YRpyKXtrJnWNn0k hJ6Ad1y+MnsoGuPyIK3Z5Xe1y9esono2r+j6OawudMYD/AdUX/SpAY51Zyc1ffB54NWo rsIb66IG8BzZNemONVRAV+ES31wmgu0WZOve8sXEDCukkQFtnG4QmSCHp77iChU5i4Of T6FRrUGzZ1fdaF0bLM2QtfUoJuOz8ILaAGlht7+iCEpsyD1tYqvnkuyOcP4PYgbbxguM nrxuTJQDkt3BiMxryWFoKj79Sm1MsOSTBuv27ilYgaq0rqeFD0h06/+ohzfKJxUPeAPu lZdA== X-Forwarded-Encrypted: i=1; AJvYcCXO0u5MR6RXR4Jtqh7NmoL/I22rlWRSM7MrLgzEVh6jjGl+6mH9d9gTbxH+9kLKm8gafqa15OLeuH9p8eejplnU+rOdYj34OPWzC0XT X-Gm-Message-State: AOJu0Ywfdln/m0XDhx+bopYwkF7pC6Q4l9HO40+2rNiR3d+R6Z4JoWnx hL0ljpee0wTIMEhAV9L3ST0C3ft4YEY8NAe94ci1M+qS4uQRvPhi X-Received: by 2002:ac2:58ea:0:b0:512:b965:f61b with SMTP id v10-20020ac258ea000000b00512b965f61bmr1116788lfo.33.1708350216021; Mon, 19 Feb 2024 05:43:36 -0800 (PST) Received: from localhost (fwdproxy-lla-003.fbsv.net. [2a03:2880:30ff:3::face:b00c]) by smtp.gmail.com with ESMTPSA id u14-20020a17090626ce00b00a3d1580d702sm2973215ejc.185.2024.02.19.05.43.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 05:43:35 -0800 (PST) From: Breno Leitao To: kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, edumazet@google.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org Subject: [PATCH net-next] net/dummy: Move stats allocation to core Date: Mon, 19 Feb 2024 05:43:28 -0800 Message-Id: <20240219134328.1066787-1-leitao@debian.org> X-Mailer: git-send-email 2.39.3 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 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. Move dummy driver to leverage the core allocation. Suggested-by: Jakub Kicinski Signed-off-by: Breno Leitao --- drivers/net/dummy.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index 946bba0701a4..d29b5d7af0d7 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c @@ -67,19 +67,12 @@ static netdev_tx_t dummy_xmit(struct sk_buff *skb, struct net_device *dev) static int dummy_dev_init(struct net_device *dev) { - dev->lstats = netdev_alloc_pcpu_stats(struct pcpu_lstats); - if (!dev->lstats) - return -ENOMEM; + dev->pcpu_stat_type = NETDEV_PCPU_STAT_LSTATS; netdev_lockdep_set_classes(dev); return 0; } -static void dummy_dev_uninit(struct net_device *dev) -{ - free_percpu(dev->lstats); -} - static int dummy_change_carrier(struct net_device *dev, bool new_carrier) { if (new_carrier) @@ -91,7 +84,6 @@ static int dummy_change_carrier(struct net_device *dev, bool new_carrier) static const struct net_device_ops dummy_netdev_ops = { .ndo_init = dummy_dev_init, - .ndo_uninit = dummy_dev_uninit, .ndo_start_xmit = dummy_xmit, .ndo_validate_addr = eth_validate_addr, .ndo_set_rx_mode = set_multicast_list, -- 2.39.3