From patchwork Fri Mar 8 16:26:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13587051 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 7925E3BBE0; Fri, 8 Mar 2024 16:26:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709915175; cv=none; b=H85KSAJa/OXBROqrah7rsV9gRj6m1yBMs45J6tW8yTuCCweCalry6AqFMxu5coBT4axfV8AtUQsjCL9dqTcyJvqJCKqBbqADCG9SJo7OIgDMNZ+yj4QMki14ygLQPx9co8aidLKVW/aNFKDw7xZesWDzcq9z6cT52lzf51YbhxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709915175; c=relaxed/simple; bh=ok5+BLxSyUMuLr8tfGG2vplVrLRe276RtWSLWqYOvUk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=F+Nj2AwDsgmAckN716mVePVGcMMoqwdUqqjxzR7zT4MCtmEoMtEHcPdWQshw+n+xyIDSpxfmFLp1UyK1cJbDhbWL9uu1oWzdZvC5wB2jk9v6RO2nn02grX9e8fByStZmxLKGemm9SiCMI80I5OdLOgDy6pnbra2oTHq6hV5pctg= 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.45 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-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-563cb3ba9daso2575827a12.3; Fri, 08 Mar 2024 08:26:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709915171; x=1710519971; 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=ChQHrGeHJWy8Gflyxs1kBU5l/y5oaijGtHOVZvY1p18=; b=FDUUbX5q1WoPQ0nXFmdzzPASFaRDT5gvHxQGj2H02verVIT7TsE2wDEIaAEixVP1Nd X6j2ZLAxOPBCZDfJqv0XiomVrK+Qgn3dbS5ep3ZAvj4J6xdIHvLcFbq9PqcjIwJPplKH 0/KlburneNkn+4OLeA9Q+npuSS7/B5taCTUE6nzI4MBkqZdjMLOI/4hwuFcxFzVyTB95 5SZwxoPUpG67IFis9j91JYLtobkofFSyqWTuxDAkSMZ0XMbI42rWxvtzyPUSkIktOoyx E5CfO8fOR7BHllmVaUrSYK/khrwczCJ8f+QrByFQ7/Z2Gputnax7BQtCgiaQ1Ep5soLt HOkg== X-Forwarded-Encrypted: i=1; AJvYcCVIvP7Ja+A5zZ1j7HbJSMTQq5MrqINrfCiZKMoEUI0YdurpwP8ZMjJg7EzWK0X2vyib+iEcVhecLHjZCGmK3Q9R5EVZb37FjkBpKclo X-Gm-Message-State: AOJu0YxO4ZKc0QCGOWUO3bkIf73EpkY/HhhpMwPuqvxmG1aIuXMFd7aS HmVz7jOeHSVXBBx9J5wLNuxxv4fUbPZtnvnGWaOFf1IKVTALvSxq X-Google-Smtp-Source: AGHT+IEyZiDNnfZQPy2YwGf3tNh95lYoIFf4NpsdjHMWmDuu7Yb6CP/Duir28KZxKG7jtrS56NQ9Pw== X-Received: by 2002:a50:d6de:0:b0:566:f3d:c0b6 with SMTP id l30-20020a50d6de000000b005660f3dc0b6mr2366541edj.8.1709915171401; Fri, 08 Mar 2024 08:26:11 -0800 (PST) Received: from localhost (fwdproxy-lla-003.fbsv.net. [2a03:2880:30ff:3::face:b00c]) by smtp.gmail.com with ESMTPSA id v17-20020a50d591000000b0056835320f76sm265725edi.8.2024.03.08.08.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 08:26:11 -0800 (PST) From: Breno Leitao To: Taehee Yoo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org, dsahern@kernel.org Subject: [PATCH net-next 1/2] net: amt: Move stats allocation to core Date: Fri, 8 Mar 2024 08:26:04 -0800 Message-ID: <20240308162606.1597287-1-leitao@debian.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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 amt driver to leverage the core allocation. Signed-off-by: Breno Leitao Reviewed-by: Taehee Yoo --- drivers/net/amt.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/amt.c b/drivers/net/amt.c index 68e79b1272f6..cb31d1990660 100644 --- a/drivers/net/amt.c +++ b/drivers/net/amt.c @@ -3063,15 +3063,10 @@ static int amt_dev_init(struct net_device *dev) int err; amt->dev = dev; - dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); - if (!dev->tstats) - return -ENOMEM; err = gro_cells_init(&amt->gro_cells, dev); - if (err) { - free_percpu(dev->tstats); + if (err) return err; - } return 0; } @@ -3081,7 +3076,6 @@ static void amt_dev_uninit(struct net_device *dev) struct amt_dev *amt = netdev_priv(dev); gro_cells_destroy(&amt->gro_cells); - free_percpu(dev->tstats); } static const struct net_device_ops amt_netdev_ops = { @@ -3111,6 +3105,7 @@ static void amt_link_setup(struct net_device *dev) dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM; dev->hw_features |= NETIF_F_FRAGLIST | NETIF_F_RXCSUM; dev->hw_features |= NETIF_F_GSO_SOFTWARE; + dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS; eth_hw_addr_random(dev); eth_zero_addr(dev->broadcast); ether_setup(dev); From patchwork Fri Mar 8 16:26:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13587052 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (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 21957250F3; Fri, 8 Mar 2024 16:26:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709915177; cv=none; b=WcaYzIOJgw7q3VO6UEnWQ+PNTCTfnTuIfGgzDJ8Z8ypu26I0ScnP40ZG6fAGcSd3lpf2n48GT644TGPEbax7hl/EDL2SU9HvXlI/dyEAUtaIqv94PuvMGJ7dmMkBBGo7b+9pwX1jviAWPlchxzuV/ERCSFiPDeXdrJkXm7fswOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709915177; c=relaxed/simple; bh=Q3Pupgvnu/q144qS+adWPKgFTyXP4WAJah2ban/vTUE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sTF2B1TTWHP+Y1/bcyXVC+PP65rURd2tF1EdRL5WXJR1hJ2rrdWdOn+8AZvsPasSO5/saRcLGQnULIkNCChzwe0cEFv5/leuIKx/k2nqTF5vVPyY62Uj2pevZBvII5v3qGhkMmFYDZHJ+a3cn4m1luf6xe6jKMD4OHLfBf/rmoU= 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.51 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-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-568107a9ff2so2612508a12.3; Fri, 08 Mar 2024 08:26:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709915173; x=1710519973; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tJxifVLROjGKsQmtNeatFoAmB7soq/2hZXteys/ymb0=; b=LG/k0gxPQXldCwiYsoftSOO72FHmW8W+uNVqNDIY/Fhy1Pn/AxskAf0lRvFDlT6A/Y Aou0JyorAZU/+T9zeyWe+Buk2ImBlGd6TrlIKAps2+Sp2CbCgc7BbB9AZFm9XjvdaLzS bNtS1ENJPANzdnEW5TFL8UtLLp5sNl36Yo5Ckn+bJA1Yo10F+P/wfxyiqp+0jSiZKZe2 xnSds3oedU88sLB7k1PISP9MZRKPmIBtqTocB382sq4M3Pn8LQTgMwudp6gYXlKDoqT0 UxtkJ6TOvYe3gBTL01wU7axdm1VVNkyy9C0zxkUruO8ql+BhUPC9pna7GW81ZNoiEiEU DoFg== X-Forwarded-Encrypted: i=1; AJvYcCUOEBiykJ8th/jRjosfhEjy5AaSEktVOzn3DDePEqRH5Cdc7vJvu7fBH1edTMEtbQtzlChrBt0R0mNLE6Qvd0YzGXLb2FIqE/7Lxne/ X-Gm-Message-State: AOJu0YzzZ63yyJ8CiqMlY8vwkI2EUjfWZLf8ZX/s8rq0Cpjxcn3ICFI2 oaRsJMindU8OZCSWLK8EnS+YnBBHThd08rrGHoM5Tz05seK7CqPynpTTKZ0z X-Google-Smtp-Source: AGHT+IHwwnuTPO7ooGyqdKCkHTuL+Ie2QGrwyj6O3FD9unLg4mC2+oTXN+5pvMFLRkkobPJyO84g9A== X-Received: by 2002:a17:906:eb17:b0:a45:9b1:f4b0 with SMTP id mb23-20020a170906eb1700b00a4509b1f4b0mr11448400ejb.40.1709915173148; Fri, 08 Mar 2024 08:26:13 -0800 (PST) Received: from localhost (fwdproxy-lla-000.fbsv.net. [2a03:2880:30ff::face:b00c]) by smtp.gmail.com with ESMTPSA id gg17-20020a170906e29100b00a45deac10fdsm1516767ejb.207.2024.03.08.08.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 08:26:12 -0800 (PST) From: Breno Leitao To: Taehee Yoo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org, dsahern@kernel.org Subject: [PATCH net-next 2/2] net: amt: Remove generic .ndo_get_stats64 Date: Fri, 8 Mar 2024 08:26:05 -0800 Message-ID: <20240308162606.1597287-2-leitao@debian.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240308162606.1597287-1-leitao@debian.org> References: <20240308162606.1597287-1-leitao@debian.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Commit 3e2f544dd8a33 ("net: get stats64 if device if driver is configured") moved the callback to dev_get_tstats64() to net core, so, unless the driver is doing some custom stats collection, it does not need to set .ndo_get_stats64. Since this driver is now relying in NETDEV_PCPU_STAT_TSTATS, then, it doesn't need to set the dev_get_tstats64() generic .ndo_get_stats64 function pointer. Signed-off-by: Breno Leitao Reviewed-by: Taehee Yoo --- drivers/net/amt.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/amt.c b/drivers/net/amt.c index cb31d1990660..6d15ab3bfbbc 100644 --- a/drivers/net/amt.c +++ b/drivers/net/amt.c @@ -3084,7 +3084,6 @@ static const struct net_device_ops amt_netdev_ops = { .ndo_open = amt_dev_open, .ndo_stop = amt_dev_stop, .ndo_start_xmit = amt_dev_xmit, - .ndo_get_stats64 = dev_get_tstats64, }; static void amt_link_setup(struct net_device *dev)