Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp135503lqi; Wed, 6 Mar 2024 12:14:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU+SmJ+HGPAR0XKSzKlkxRVohyBiKxIFKtdc2iP3lVnfgUqLdqm3ioG1B9J9PLqsJ5ltV408tSV33BkF3pDVhfApVidOww0iHJm+ed0ZQ== X-Google-Smtp-Source: AGHT+IH55ZW7TfO/8DUEEppbZJfAGjI7SBPg0lLOAzrVYG78nyyPEp5aV9g7ljwTiqHZH/qqnhee X-Received: by 2002:a05:6a20:748b:b0:1a1:6f54:ab91 with SMTP id p11-20020a056a20748b00b001a16f54ab91mr14735pzd.25.1709756040747; Wed, 06 Mar 2024 12:14:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709756040; cv=pass; d=google.com; s=arc-20160816; b=GQWdEDqnlHYfdoB/5Oh+6RBDB35yyFLiWeCnwc76nzd95te8XWd1/qs2tAN39yhsCl 2DFDuyEZ8FmC1NLkhPQncHTIISttQ+fzBBNAVOpjEha/bKDKX2pYvPi6xDFLHWQuTA+i 3/Ob/spxcYSJtu8TH59b+RZFE5XQLyGX0+2ITLBi1n64idlc3dje/VEDAYm0GYb95hAe Q2Fo9n13cluCwd1KcsFgDg+4vROWAjjXcC292UuG2Tw26cQwQ4MROVD2kjZDC/DMcTnk bQHE9p0SjDZF1Oof8n5nK3atYa2g/+v3Scwe9Yi3IAwtkqaHY4Xgn0AoWiu3z/YwEXg9 mP9g== 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:dkim-signature:dkim-filter; bh=9tB1JomMZgl3FN8ndQgoKz8tGrsVYNmNu/HZgGD0Qy8=; fh=kztpx2XisHdOzCUQvLwGW6848MKP5VCY75DFxoFgoKw=; b=bhOGgjAfA/YdNQmwGsGclLmTDhTCu27i36WSJx/TNHw2mqX64pRE6fUTzW4RX+mVb3 99fDE07iSjl08TwHBWT4Z55Di8VF5Hzl4hbFdt1ZjtWOeL8C43Mtu2eHNWd42XuwbiL+ igJAvDVqnlAoGPk17hzbjEZBrPNdYHmfp5LggtqpVJR8HSQPHjg71+a83w71yi5cnFW1 bfyLzlYV3xEEFBOIzoayCH4vG7hkOT2j6GAIBsQcwANyHBVPo5OnD+p6A8JSZJ8hcv7+ TTqUFNbdFkWGPKsHasQEFV6MoitfjIzMm6PRddU67eR9SJt9n+0JE70TChtw5ubJ9nCS xUaQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=kFyJm9c6; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-94550-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94550-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ld8-20020a056a004f8800b006e5f8fc1a17si7757160pfb.313.2024.03.06.12.14.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 12:14:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94550-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=kFyJm9c6; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-94550-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94550-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com 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 6D0162871A6 for ; Wed, 6 Mar 2024 20:14:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AEEA81419BC; Wed, 6 Mar 2024 20:13:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="kFyJm9c6" Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64E0060250; Wed, 6 Mar 2024 20:13:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.205 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709756030; cv=none; b=Zqkw7dLTLHpmk5WawbO6tnOUsDYm+LRE7M+uqM+edCL5U4OQSD21rGj95ueQIt2HhgdAYG3ukjk4PWE3f5AFFHrTHJlRmVGHCFmEEpYHNgUgwsVdE6u9k1NqK6ZM7zJeBTnX8jKSmMxA/ZM5j+MgRbePR+Pzpkp7P/yXEqnD3nk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709756030; c=relaxed/simple; bh=rAnJtzfRsWJZwGzIDXpwXhY4p4LSVYOL62mHk1jLZOw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=JvWn68g5DrDjLETiRdLcRbd04UzcEl0dAEZ6QVGPs1CVZ0c8p2jbvxAulodl/ly/s096fmXEIYuEKLBhxciRVurxEWw/qC8Mzr05EwYyBF+er/oPA6C3BvPDiQ8wLuTWSQuSf+xYai0NN5RR8cjY2cOdHwmGvxBUPmkgEALcl78= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=kFyJm9c6; arc=none smtp.client-ip=192.19.144.205 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id C2008C0000F5; Wed, 6 Mar 2024 12:04:48 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com C2008C0000F5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1709755488; bh=rAnJtzfRsWJZwGzIDXpwXhY4p4LSVYOL62mHk1jLZOw=; h=From:To:Cc:Subject:Date:From; b=kFyJm9c6s4H07GlIrjh+RboECL5o1RtQrDDT15LJhKYBFtto292h+wyC53+c5EmOm k3PRkTm4uB0mH+bigf4hyG3KPBxTbiOhik1ZM9GBW6HoohOPHGfdtQ4lSTllgmt1Ov +4swbldgKPtrR3PWtEi+JW2fc/ttu+GYGkSq/QiI= Received: from fainelli-desktop.igp.broadcom.net (fainelli-desktop.dhcp.broadcom.net [10.67.48.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id F320718041CAC4; Wed, 6 Mar 2024 12:04:46 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: leitao@debian.org, Florian Fainelli , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next] net: dsa: Leverage core stats allocator Date: Wed, 6 Mar 2024 12:04:09 -0800 Message-Id: <20240306200416.2973179-1-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 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 DSA user network device code and leverage the network core allocation instead. Signed-off-by: Florian Fainelli --- net/dsa/user.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/net/dsa/user.c b/net/dsa/user.c index 9c42a6edcdc8..16d395bb1a1f 100644 --- a/net/dsa/user.c +++ b/net/dsa/user.c @@ -2625,11 +2625,7 @@ int dsa_user_create(struct dsa_port *port) user_dev->vlan_features = conduit->vlan_features; p = netdev_priv(user_dev); - user_dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); - if (!user_dev->tstats) { - free_netdev(user_dev); - return -ENOMEM; - } + user_dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS; ret = gro_cells_init(&p->gcells, user_dev); if (ret) @@ -2695,7 +2691,6 @@ int dsa_user_create(struct dsa_port *port) out_gcells: gro_cells_destroy(&p->gcells); out_free: - free_percpu(user_dev->tstats); free_netdev(user_dev); port->user = NULL; return ret; @@ -2716,7 +2711,6 @@ void dsa_user_destroy(struct net_device *user_dev) dsa_port_phylink_destroy(dp); gro_cells_destroy(&p->gcells); - free_percpu(user_dev->tstats); free_netdev(user_dev); } -- 2.34.1