From patchwork Thu Feb 29 17:04:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 208432 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp543771dyb; Thu, 29 Feb 2024 09:08:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUig20O9JeslD8NxGgOM6Rr4DhKnPlOjZ6FscGLn2Ykw2rEGUIkIZRVvNJHo6A9scr963fieZXs6crxdjmKBs9nWFLUNA== X-Google-Smtp-Source: AGHT+IHMNsNoS3jGsQvwRv+11iLRwGwWDBkQK35YU13Hf8L2Vg7dcMBEUiSUwrQe1Nrogw7HNTy5 X-Received: by 2002:a17:906:418:b0:a40:2994:723d with SMTP id d24-20020a170906041800b00a402994723dmr1973523eja.14.1709226491509; Thu, 29 Feb 2024 09:08:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709226491; cv=pass; d=google.com; s=arc-20160816; b=C3cKWkTBNtAwDdATcyTbz+uDoWYQI+UeeMd6hv6pqEs43i3xQMRxkAaTNbcikgmOW9 o0R4YQzwjWmSx0HirEuVTflxBT42XrqoJgbv9JtNE/7UiL3j+M/js5FazUlwTzAjKdRz Jl/YpzD5Vv5Qeg0fuf8fL1c3oPuBmd/kAtF8H8ditnT/Vtm46c3okYVwmUvpE/6d+XTo visHRc3F2f0NPZ/CQCUSYU3g5gm64BGmTMe+tsjP0yQR+uDNQ83zTAXAcV8A6n+brSFs EhMyByWEZSbZyZ0SfsycQ0b98GUy1TsRCW4pGCrM/2Mn9F/is2epQIY2oDL4jugDYPzq gDUA== 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=C7eSu5LAngYuG4yyZo6XzjOmxDsHUKU5MZ0QDXjzOq8=; fh=n7g8pTjCglhBefjMh3NwCJgUNouuzTcxYczjonDuCcQ=; b=0Wk8tPV6WUEmNbaBFCyBywiAv01ECb57uodtG7Lq3JRJtxnuoXJFCMoHqta40vzxvl ipS+BcTm3P7seGnt0sCoElJSltYd6r3YQDFwlYjubNnslrGs/+83Pyoshr6gs/6oxq59 +np4Hamrq6tDKgtNqGg4hd6saLHJksBnYgurjl//KaFCeosIkbeiS86N1QHQEBLAST/x HXZ4qVfX6D7k8qf4Afhq0koYLUFszjtCXUs+lkgXuZSDqalEb5rCcSd5RaDr6IhK6l87 1uLu59St+Atc37vVUrjnXtHyIMf7BQO14O/z9CDX7I15zhAO3RgWN3Hq3LJ/7xA0UmA/ DXCQ==; 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-87143-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87143-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ne35-20020a1709077ba300b00a441fa30fe6si774612ejc.767.2024.02.29.09.08.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 09:08:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87143-ouuuleilei=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-87143-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87143-ouuuleilei=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 3A7AE1F21E76 for ; Thu, 29 Feb 2024 17:08:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EBEB913C9D5; Thu, 29 Feb 2024 17:04:58 +0000 (UTC) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (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 99D17160636; Thu, 29 Feb 2024 17:04:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709226297; cv=none; b=pBPNk/BA1L58cOusmqkHAzLWQ+K5KoRqsHfJXuOoadoZCLbGiaWPEUE0UA9zmm03/xEvpAjvp12LbroNKuygUAB3nAC/Vv4/gxuyDbKKJZFZx2HGFWzkJgcWBLhet/Mp2ZhqmWQJzCB00aRQLlFFzC8WVwtcouFJh9mGbThcwns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709226297; c=relaxed/simple; bh=tTf5DGA4/EdGbxqRxWUdMDKOzj/3epteLSgwhMqPiA4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=POAuBOu6rUa2fJVeEGfVdAM0DtGH24OmVZjI8OiZ2XgvJDF2U/F/VMgS0WO0UhMBx82/QKyHffJRBYKnyMz7quUeFwJlI3X7sxaVO3bhHIUqHWOO9V0++lHrAiz8P+OPeFC9H3S1uHrwMxRnbftbGGsB2s9CJlwMOx23K8qNuas= 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.208.180 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-lj1-f180.google.com with SMTP id 38308e7fff4ca-2d2fad80eacso11622911fa.2; Thu, 29 Feb 2024 09:04:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709226294; x=1709831094; 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=C7eSu5LAngYuG4yyZo6XzjOmxDsHUKU5MZ0QDXjzOq8=; b=hnqgUKFqH7cbMuRutH5//i0o1Mym0Vf++S1Zf+x8nmZPdLdGq4TkO9aWtgFWAW3vpf hPlcjLQvAIVb9DAn1yBwQpjGrvzQaocDaEPzioFYmrf4+w3bzVvFfjT4o21NexDRo3op Ml1DaiP1veK4iW8aQETg/kunJjduuir1oM6sR+d3rtfqpEoX/c4pEX5WZwhxFtWkuMXP Hn+6icMQDB5k7vh9t7fLaNu6sU+EswADkdfzzUbusU9oXytCVQccsmsRCCqnDiswcgpJ P1HYRMmE2+iVxB1JxkVcavlofhqyTYv9+foy56IKt6y71it1HOthsbp6Cztq28U5Bmfw UP7w== X-Forwarded-Encrypted: i=1; AJvYcCV7UUdIlJBuvkqSy8Jkqy6u2NDm6cM7nuI8BPr4HG7vK/UBjoj1h/1fCIlZFtwCfnOdvjJiKWJYHRVr70dieOre8NIbxyhnY0+188gt X-Gm-Message-State: AOJu0Yx1D7ccwsgJmyTnF63ZLdp3oa2d/wIiNv/czPLocl4iDpN/wT2x PW+JhI7qWMLo7xQ+PXwJcalc17S3a2r6ciUsCs6n6qhWzL0Xu+0a X-Received: by 2002:a2e:8194:0:b0:2d2:c937:6fea with SMTP id e20-20020a2e8194000000b002d2c9376feamr1960270ljg.6.1709226293467; Thu, 29 Feb 2024 09:04:53 -0800 (PST) Received: from localhost (fwdproxy-lla-118.fbsv.net. [2a03:2880:30ff:76::face:b00c]) by smtp.gmail.com with ESMTPSA id y16-20020a05600c365000b00412656ba919sm5599122wmq.20.2024.02.29.09.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 09:04:53 -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, dsahern@kernel.org Subject: [PATCH net-next 1/2] net: bareudp: Do not allocate stats in the driver Date: Thu, 29 Feb 2024 09:04:23 -0800 Message-ID: <20240229170425.3895238-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792253877700762051 X-GMAIL-MSGID: 1792253877700762051 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 bareudp driver and leverage the network core allocation. Signed-off-by: Breno Leitao Reviewed-by: Simon Horman --- drivers/net/bareudp.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c index 4db6122c9b43..27408f0b93d6 100644 --- a/drivers/net/bareudp.c +++ b/drivers/net/bareudp.c @@ -194,15 +194,10 @@ static int bareudp_init(struct net_device *dev) struct bareudp_dev *bareudp = netdev_priv(dev); int err; - dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); - if (!dev->tstats) - return -ENOMEM; - err = gro_cells_init(&bareudp->gro_cells, dev); - if (err) { - free_percpu(dev->tstats); + if (err) return err; - } + return 0; } @@ -211,7 +206,6 @@ static void bareudp_uninit(struct net_device *dev) struct bareudp_dev *bareudp = netdev_priv(dev); gro_cells_destroy(&bareudp->gro_cells); - free_percpu(dev->tstats); } static struct socket *bareudp_create_sock(struct net *net, __be16 port) @@ -567,6 +561,7 @@ static void bareudp_setup(struct net_device *dev) netif_keep_dst(dev); dev->priv_flags |= IFF_NO_QUEUE; dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; + dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS; } static int bareudp_validate(struct nlattr *tb[], struct nlattr *data[],