Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1170780rbb; Mon, 26 Feb 2024 00:27:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXsRDHpX1QE9KCod7fq5DYVEEj790DMkaPOWFGbxFfgXkKGlyOpePUMC1RY4tRA1HXRj6okz06NBNgLEku7DniE6ARcYzszdW4r0CFyWg== X-Google-Smtp-Source: AGHT+IGQTcg3fTbWtd2k+p2L5B0zY18b9sRTXt3BPaBtmnVdyrgdJzzsYeqbjBnTiSo+ttS2MI9G X-Received: by 2002:a05:622a:5d4:b0:42e:884d:d871 with SMTP id d20-20020a05622a05d400b0042e884dd871mr1584541qtb.28.1708936058306; Mon, 26 Feb 2024 00:27:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708936058; cv=pass; d=google.com; s=arc-20160816; b=jqvb/WdMGZuHEtAG5iCEbICNy/IBIbVhEKNNfVyvtqPxrbfn8F1ZRfN1iGjdzKoaSJ /rZ1UnJot7332RqPzuXDtJ8ebEv2sYWPtwZ72TRjnwV8L2kctUcgPxoushE0k9oEfv0b sBQybRvoR0Ggn7ZhAgZez9CbkUvZD7u2dOCzDHoGA0BJ1QqA35If0XTVQ6ltKT+R2gZS FbE0HVF/cKRngv72oJl7mmUnBZNNSQOXOrw8XFvEYMdsLNJQMshgnxt+8MhmTZEtuEw4 s6OKDlHcvgt4nOJgqOem7Ncgle1F3glxDJEXDLvVdw2Nq7zQLdyCBA63+WgBECHfiDKE jXTA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=zGkEjPkjWA9B4Ml20UNQYktxGpIUURUmKif/cYqIu08=; fh=YGw8rJOg/DiwzQVOqQgZOi4E8Sk6Yi2mEKVyG07gUHw=; b=t7wuSaruA9TsIOyRqgeycM1W+XHeU1v9MEyNSsUQzjW5GdRcvs5aYIlFm5b26utxXC JpyFO/vW3NPw1xmefS8gDYRLyY5NBzApUqRSBYC/g9bzXOMgLsSUaUgGPJMTnqqmeRWP arkHeyd0qXHtngp19P01rx6nFv7Cti3P1f/c2mmAJ3Gp7Y9/EkHUKYUtP1KuKXFCdrUG hlB2EJeclJ6Pkgjko2NLgvvjFbgLkD7nzHOTPDOWOji7+ostgcrCMJLxePO2+0GWH5IL XdrxZRRFxp0tYQsr6tVN3O6Fi1icN4aT2NlYF8hsVCZ7thRECJEA4sfDQwwc15rdwQse h03w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="F/3QGtvt"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-80757-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80757-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o3-20020ac87c43000000b0042e882e8f7asi1154287qtv.142.2024.02.26.00.27.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 00:27:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80757-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="F/3QGtvt"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-80757-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80757-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0D1E11C2122B for ; Mon, 26 Feb 2024 08:27:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 098751CD3B; Mon, 26 Feb 2024 08:27:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="F/3QGtvt" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 982E61CAB7 for ; Mon, 26 Feb 2024 08:27:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708936035; cv=none; b=S7vr6GSJyf79aLgsX8Z2rjTV1LwmdCklC8G1AFwj+IqlNe9RJK5zQ5XWUAbbELCWX7VwwRrfqPfehONS6rIYx8fZ2d8tRYx1eb0bJBus4F+aSK5y6DCQNwEqxSiGgqSPkfisC2ygTPfYxfsxSZSrOzDcmV7fgt2I63+UC+tFE6o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708936035; c=relaxed/simple; bh=REK+VNCXI3WjyjsuKl+HSXiJRNqvxmX5KAPsA/J1Roo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lc/bC5u2RoF6V3MZM3UmA37dQBkXGlGHXMiElroLXW2yGsMGzngpU0xsH6OaOYz4KKb7Iga7xgkRE90/+F4ijtxphSo09Hv+H+Uc2u1YKsfZOfAuOiLL8lf/pV/yyZBKNevIw+N4WGGHT+uHJPDcoXfZba56xIhULR1+9kC4YSw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=F/3QGtvt; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708936031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zGkEjPkjWA9B4Ml20UNQYktxGpIUURUmKif/cYqIu08=; b=F/3QGtvtM1I2iFggDWwHePEnpi8MX4ZOtDb040D5cI7zMeZ2v1X/MClnAdidp0L7Q9iiL3 rDqkvRJSor4cNtBHyhfl5tB4QuBXkHWglqtd5p++b9c75ZDMpBSmd/EyJSHqS0WJ6Gez5y x/48822dX1tiUY1GI9e27dEC14q1aww= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-59-hUMJ_eIpOwShCEc_53iP4g-1; Mon, 26 Feb 2024 03:27:09 -0500 X-MC-Unique: hUMJ_eIpOwShCEc_53iP4g-1 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-559391de41bso2459174a12.3 for ; Mon, 26 Feb 2024 00:27:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708936028; x=1709540828; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zGkEjPkjWA9B4Ml20UNQYktxGpIUURUmKif/cYqIu08=; b=lrbagD1LApxWZ/RE2CB/V2qRFZbMX043628a6JbwEafyslBdfrO/G3jX53yh9KH7E+ Q4W7UtxRlIbr1mPUnj3sCYQeZrj+y9UBkAlxT7nE7YIucfHadBOnFjoxjA2y1M7fplgG yPcVy+5ifBEPztTNXbwnK+bH6bNrhJV98HzI12VWTI1K/LczgEx82MGiafpfA5B2y6uV LuSkDHNnwFd5TynDc6NNYSLFodt5X2AHaOHRaSFA2dzZHWgxHSOLvgzxzlXbOyAis5iy FtBFAlBoTFX45nqWoE348yXgpX84+F4ujJ2tTEp4aGtifSkFrFCnkN71OFcWsI4xnPdy FTFg== X-Forwarded-Encrypted: i=1; AJvYcCURFaT7+kszZSDHaY5T/OMw32m5PIQ73PO3Un4AKJXSpEN94nfsYgrVYk9o7Nas/YFKX+yOhR8CfQ+io7x4MM6j2IlAcYTrGzSX5CH5 X-Gm-Message-State: AOJu0Yxmza3Iwktsya3bMG9UpPKoq+UzOOsPiEZZxVDxNjcKPzkReH4o Fkq3kZyqoAQ/9ltQdO/UCHy0EYvsWkizAwygZOwzYVpit7eAPZHLFus61oSWRqWbffjoTbiBbX/ BRWHWKPQOxDMD88r86iuYlf/pzCRH1h0zc86N2fOTAsQL3PBHt0AD143IJE9A9g== X-Received: by 2002:a05:6402:1487:b0:565:7ce5:abd5 with SMTP id e7-20020a056402148700b005657ce5abd5mr3814990edv.18.1708936027997; Mon, 26 Feb 2024 00:27:07 -0800 (PST) X-Received: by 2002:a05:6402:1487:b0:565:7ce5:abd5 with SMTP id e7-20020a056402148700b005657ce5abd5mr3814973edv.18.1708936027632; Mon, 26 Feb 2024 00:27:07 -0800 (PST) Received: from sgarzare-redhat (host-87-11-6-148.retail.telecomitalia.it. [87.11.6.148]) by smtp.gmail.com with ESMTPSA id k1-20020a05640212c100b005653fe3f180sm2105105edx.70.2024.02.26.00.27.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 00:27:06 -0800 (PST) Date: Mon, 26 Feb 2024 09:27:04 +0100 From: Stefano Garzarella To: Breno Leitao Cc: kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org, "open list:VM SOCKETS (AF_VSOCK)" Subject: Re: [PATCH net-next 1/2] net/vsockmon: Leverage core stats allocator Message-ID: References: <20240223115839.3572852-1-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20240223115839.3572852-1-leitao@debian.org> On Fri, Feb 23, 2024 at 03:58:37AM -0800, Breno Leitao wrote: >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 vsockmon driver and leverage the network >core allocation instead. > >Signed-off-by: Breno Leitao >--- > drivers/net/vsockmon.c | 16 +--------------- > 1 file changed, 1 insertion(+), 15 deletions(-) Thanks for this patch! Reviewed-by: Stefano Garzarella > >diff --git a/drivers/net/vsockmon.c b/drivers/net/vsockmon.c >index b1bb1b04b664..a0b4dca36baf 100644 >--- a/drivers/net/vsockmon.c >+++ b/drivers/net/vsockmon.c >@@ -13,19 +13,6 @@ > #define DEFAULT_MTU (VIRTIO_VSOCK_MAX_PKT_BUF_SIZE + \ > sizeof(struct af_vsockmon_hdr)) > >-static int vsockmon_dev_init(struct net_device *dev) >-{ >- dev->lstats = netdev_alloc_pcpu_stats(struct pcpu_lstats); >- if (!dev->lstats) >- return -ENOMEM; >- return 0; >-} >- >-static void vsockmon_dev_uninit(struct net_device *dev) >-{ >- free_percpu(dev->lstats); >-} >- > struct vsockmon { > struct vsock_tap vt; > }; >@@ -79,8 +66,6 @@ static int vsockmon_change_mtu(struct net_device *dev, int new_mtu) > } > > static const struct net_device_ops vsockmon_ops = { >- .ndo_init = vsockmon_dev_init, >- .ndo_uninit = vsockmon_dev_uninit, > .ndo_open = vsockmon_open, > .ndo_stop = vsockmon_close, > .ndo_start_xmit = vsockmon_xmit, >@@ -112,6 +97,7 @@ static void vsockmon_setup(struct net_device *dev) > dev->flags = IFF_NOARP; > > dev->mtu = DEFAULT_MTU; >+ dev->pcpu_stat_type = NETDEV_PCPU_STAT_LSTATS; > } > > static struct rtnl_link_ops vsockmon_link_ops __read_mostly = { >-- >2.39.3 >