Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp296879lqg; Fri, 1 Mar 2024 05:44:26 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWWBEFrWLa8s8iYctI8IZ35LkFKRRY5mHE390hItan7kPSfN1gmBtHAsqY40fY6G6+5xcpw0SIQbWOaFvDfBaSXl23sJmM+KExLLpsDJQ== X-Google-Smtp-Source: AGHT+IHiNe7AjximPi4i6Az4WY+YWENhkwLLwfoxoqkrruxr8wXQRo4fiykALbgWEvj9WMRwBFWF X-Received: by 2002:a05:6214:14a3:b0:68f:5cf1:ffdc with SMTP id bo3-20020a05621414a300b0068f5cf1ffdcmr1561475qvb.51.1709300666108; Fri, 01 Mar 2024 05:44:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709300666; cv=pass; d=google.com; s=arc-20160816; b=o1WwsYKGrvx8pbXJc0Jf4Zr5nCZAdKUzAagWMhjY4ZXtB5glQZjWckWMpxTDeEjrEm p6CUyBjjk/ihFjwRqgmVmaRBMZP22UdXmR26v9nRJ+n0XgBk42dVKye4Lu73KN0Ys5SE B8NeUMGsr8t4DKRnl+e4ytZER8V23L8dp6mIoCbZWeEZ2EUa2nyQbm1qzJJgI390YYnw Pl6EDTwZraueoxX193MVMteBaQN8O0/EheshZbPKEBV4gPt3BR1AF2dISSVCi5Rw4EEo PhEe2hOk2ZWLuubrukgCgRrKKSheukQdYxdFzGDbPO1yBfWq2hsjgwkOKBREIoNPHYEF rS5A== 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=meK2UlP/dm3hH3i+lg2G+YANY+IJ/fxWJMq8pj0EJNc=; fh=94FzJyvittsAe+DfPdy45mg9BCBSVIKOpnYtjIwjd00=; b=ZO2rVPXjTqQythI9kPoxNxDhaDNxCx7zXRAGD1D5R96sAD509Ro9RNwtWcabq68Wau Vi4aHupSoC7dJM7m7mnZInrZ7Z3BJUTsA2U/0h6d2cluCuDVYhpl7tEhKYPEYCBgyOdT jkS9xYyDm0n/l7WbtuPELDDCpKPXgDsjzF+5TGBYsCUA99HKzZNNURlSeKSdivXLtJkC CC0jRcXKt/xU3+oE1aSHCwN/rvJjf4MmDLZzMnjtncQqb7/NHCALHLdy/fvEI+1aCyP5 8UjBqqgobZLtmT+qF8rhLAvIQIB7EI+7A0QzAnbrntFn/z4paXCDn2HUUoTVpaUp0uV8 JsJQ==; 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-88507-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88507-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id js4-20020a0562142aa400b0068f62f01575si3511062qvb.257.2024.03.01.05.44.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 05:44:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88507-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-88507-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88507-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C08EB1C20839 for ; Fri, 1 Mar 2024 13:44:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A6EF971B52; Fri, 1 Mar 2024 13:42:26 +0000 (UTC) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 733ED6EB64; Fri, 1 Mar 2024 13:42:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709300546; cv=none; b=S5GkJkHgb4GZLRrN0gWfOtQK+1S5nZH0UkTpqG/hxVERdbvZrrYhHK6dfXNrRMiNqPmgcbIXHkU5rhy6jgqvANwzzJNvu1uTf3fvFvrJ/a439XmBbR5jJfzQt/oXlWhp5P02DO9hiRKQsZUB4M580VP5RKYVlsqw2RsnRZrfXxg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709300546; c=relaxed/simple; bh=YcuzT144GY5Gzx8E8bB8mn4dTvPZBIq4nVBHbYj/FEQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=fy46HnJqApxGbc0400NYo8PatsrCTSVk6FTMp6zLY4WZ8W0jVYkufDDlTOfQJP/PSiEVPVcpQqnRofV3akWoa/HsicdsCp3XBKaUZ/wmZUJvpoQdkqpTYLhtzKmddkaQtPm5F7Js1XwWLZ4uVACSdqrwv7+asHfQkeSY8D7bizU= 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.221.41 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-wr1-f41.google.com with SMTP id ffacd0b85a97d-33d90dfe73cso1173724f8f.0; Fri, 01 Mar 2024 05:42:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709300543; x=1709905343; 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=meK2UlP/dm3hH3i+lg2G+YANY+IJ/fxWJMq8pj0EJNc=; b=X5oTSm82ftlIosrqcYRnZMnzIDsXqCiTAks3BQH43zQXrcO3KDMiaMJsZmkBVnYjeU Z6YVZMSGPkB25DUq2gQpTN0DGainUpHHyvl86nzb98ZBbDVsBnukZ29aeVfB4c2vW2nY Ju6fYfJMjZtneXOSxgvhaYsOg1nxdaOqLtLb1CYTPKh6bT/MQQyjxBGpXtSDZ6ZUXdkT JL8j4YZW15oGaGGw8svfPZMVkqsnT/gmcQIFQGCIumjLoXO1/JPYfGgWiZzIdrkyAChv d2TTfI2cKDekePyCNBjS9zf4pGakZbEvBUZlQruY4TBUd8UnkyMgISbRj+8nmeSynfyJ pYUA== X-Forwarded-Encrypted: i=1; AJvYcCUw2KVGj2EYYchDAsS3a3dN6dSpXy27I2NmlVxNfXAI3v5dhuNfwEBIrSLIRgTIGaPns9U4gW4k+n7+J9jY6oHroWyWdbZnPhgRJE8s X-Gm-Message-State: AOJu0Yz6Rw3IHAufX60ivzK3ruONBUzbW057o3ftPYR/OYcBXaAev3Qb 1XckXRsFssntrupf4Mjao9DW3+uTGE6CRIzs8aaZd96InRnjo3CV7fr54wch X-Received: by 2002:adf:cd8b:0:b0:33d:7ec9:f5d0 with SMTP id q11-20020adfcd8b000000b0033d7ec9f5d0mr1980963wrj.2.1709300542465; Fri, 01 Mar 2024 05:42:22 -0800 (PST) Received: from localhost (fwdproxy-lla-007.fbsv.net. [2a03:2880:30ff:7::face:b00c]) by smtp.gmail.com with ESMTPSA id y10-20020adff14a000000b0033e1be7f3d8sm2148066wro.70.2024.03.01.05.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 05:42:22 -0800 (PST) From: Breno Leitao To: kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, edumazet@google.com, daniel@iogearbox.net Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org, dsahern@kernel.org Subject: [PATCH net-next 1/2] net: nlmon: Remove init and uninit functions Date: Fri, 1 Mar 2024 05:42:13 -0800 Message-ID: <20240301134215.1264416-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 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 nlmon driver and leverage the network core allocation. Signed-off-by: Breno Leitao --- drivers/net/nlmon.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/net/nlmon.c b/drivers/net/nlmon.c index 5e19a6839dea..e026bfc83757 100644 --- a/drivers/net/nlmon.c +++ b/drivers/net/nlmon.c @@ -17,17 +17,6 @@ static netdev_tx_t nlmon_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; } -static int nlmon_dev_init(struct net_device *dev) -{ - dev->lstats = netdev_alloc_pcpu_stats(struct pcpu_lstats); - return dev->lstats == NULL ? -ENOMEM : 0; -} - -static void nlmon_dev_uninit(struct net_device *dev) -{ - free_percpu(dev->lstats); -} - struct nlmon { struct netlink_tap nt; }; @@ -72,8 +61,6 @@ static const struct ethtool_ops nlmon_ethtool_ops = { }; static const struct net_device_ops nlmon_ops = { - .ndo_init = nlmon_dev_init, - .ndo_uninit = nlmon_dev_uninit, .ndo_open = nlmon_open, .ndo_stop = nlmon_close, .ndo_start_xmit = nlmon_xmit, @@ -92,6 +79,7 @@ static void nlmon_setup(struct net_device *dev) dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | NETIF_F_LLTX; dev->flags = IFF_NOARP; + dev->pcpu_stat_type = NETDEV_PCPU_STAT_LSTATS; /* That's rather a softlimit here, which, of course, * can be altered. Not a real MTU, but what is to be -- 2.43.0