From patchwork Mon Mar 11 11:24:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13588649 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 9A4A43A8C0; Mon, 11 Mar 2024 11:24:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710156299; cv=none; b=EUFxOt2fvgimuuPX/7dz0MWr8EX/mDZq1Pced4a8lZDnz8RAvSwAhZ625owspJuUE7it8m4tIErHTYP160qXQR02zBUwQlboIoh8iyo+elMQGvLwDoOc00srDCw3i8yrbiH56MRrdVV3f/3Glt/n/yOfDzFgZai+6cDZ7JxuqHY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710156299; c=relaxed/simple; bh=edscxhJ+ntq5cuIqMB4aCIAwEHOiuf4qwLeFkZGQS6k=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=IkcVIna5klLZ2KKIU9S+9utrDZ38n9i4mstAtetmZH3geGIIu6301R/lkeAB+JVAmDPA6/+DUso/Lp/9g0cVCLt3x5OGiGEdsJvwx9jTL/adW7LTQncqi87bpkLNUjujUjG7iQt7R1F12NQPlGKffNZrM8ChM4938CQnzu/GlfI= 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.218.53 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-ej1-f53.google.com with SMTP id a640c23a62f3a-a45f257b81fso327351066b.0; Mon, 11 Mar 2024 04:24:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710156296; x=1710761096; 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=2fwR9bgFz/hQ+RIWCBvp7Qx01qUpN78LiqG0Zncb2Gg=; b=Aom2ihYkW6PMYjL0QR0fAGHnrFETWSQJ2sOftVq9tK2zEtEz9Wgx+n1JZf+VmiTzzk 776HGpsea4/ExOW0QpEDJcSavfQPXVyexjiSc7a1SQMcJGeVueAsCIV1ldniaIdPRzM3 RiIEVGZizTMCcYyMPJLbu6t5M1BBl7HxXeDfr/tn9qay7hPPoq7+pEd/P2RvQJ8bcoL2 tFvf7lS/mVTx6ol0uVAEbFPCMQ0LcRb+fCg1qJy3ONzVjl4DfDb49/23wjmgUC+fa2dD MTX08e1f3+K/owyrJkllP4tgtQLjAS/ohITYgR9jAFaksLp+tbbsvFJ0R0Xy0d4C4AUn jlWA== X-Forwarded-Encrypted: i=1; AJvYcCW6ZJK7AeOTYAHrJJBZSlJNFmqugkWaIEkPn1+Xpk6ZKDSYLrzrH2DUoNlwcrnc1sUxbvg8x2yqFNZfV/ZzgnJUJi7K6ap52A0Q5F1i3ubxF28Til+6fLXvUQiQcW+VQxYkOkmR X-Gm-Message-State: AOJu0YyGIvnfrH8Brw0haJlWY+raZ7Fgx8zeOpz8EmupJoWPCk3mDDMe /h+nPM85QaHIaAS0aB5ONhJQ4jApsqqESJlVjuElqhZW7Yfht/xp X-Google-Smtp-Source: AGHT+IFxVLAfdf/vyE1mu/q3m3HsAChj0XG7vYC41Sd8p+N8tzM+AQzfNpmHPeFItPK77h3QlcTLNA== X-Received: by 2002:a17:907:d510:b0:a45:b3f5:8229 with SMTP id wb16-20020a170907d51000b00a45b3f58229mr4045406ejc.40.1710156295693; Mon, 11 Mar 2024 04:24:55 -0700 (PDT) Received: from localhost (fwdproxy-lla-006.fbsv.net. [2a03:2880:30ff:6::face:b00c]) by smtp.gmail.com with ESMTPSA id oz2-20020a170906cd0200b00a449026672esm2755408ejb.81.2024.03.11.04.24.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 04:24:55 -0700 (PDT) From: Breno Leitao To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: keescook@chromium.org, Ido Schimmel , Nikolay Aleksandrov , Amit Cohen , Petr Machata , Jiri Benc , Beniamino Galvani , Gavin Li , netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 1/2] vxlan: Do not alloc tstats manually Date: Mon, 11 Mar 2024 04:24:30 -0700 Message-ID: <20240311112437.3813987-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 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 vxlan driver and leverage the network core allocation instead. Signed-off-by: Breno Leitao Reviewed-by: Subbaraya Sundeep --- drivers/net/vxlan/vxlan_core.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index 386cbe4d3327..6f26003a3064 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -2841,15 +2841,9 @@ static int vxlan_init(struct net_device *dev) if (vxlan->cfg.flags & VXLAN_F_VNIFILTER) vxlan_vnigroup_init(vxlan); - dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); - if (!dev->tstats) { - err = -ENOMEM; - goto err_vnigroup_uninit; - } - err = gro_cells_init(&vxlan->gro_cells, dev); if (err) - goto err_free_percpu; + goto err_vnigroup_uninit; err = vxlan_mdb_init(vxlan); if (err) @@ -2860,8 +2854,6 @@ static int vxlan_init(struct net_device *dev) err_gro_cells_destroy: gro_cells_destroy(&vxlan->gro_cells); -err_free_percpu: - free_percpu(dev->tstats); err_vnigroup_uninit: if (vxlan->cfg.flags & VXLAN_F_VNIFILTER) vxlan_vnigroup_uninit(vxlan); @@ -2892,8 +2884,6 @@ static void vxlan_uninit(struct net_device *dev) gro_cells_destroy(&vxlan->gro_cells); vxlan_fdb_delete_default(vxlan, vxlan->cfg.vni); - - free_percpu(dev->tstats); } /* Start ageing timer and join group when device is brought up */ @@ -3316,6 +3306,7 @@ static void vxlan_setup(struct net_device *dev) dev->min_mtu = ETH_MIN_MTU; dev->max_mtu = ETH_MAX_MTU; + dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS; INIT_LIST_HEAD(&vxlan->next); timer_setup(&vxlan->age_timer, vxlan_cleanup, TIMER_DEFERRABLE); From patchwork Mon Mar 11 11:24:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13588650 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.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 048673C493; Mon, 11 Mar 2024 11:25:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710156302; cv=none; b=A1XTmy/Uxl98JXCCaRqKGo5tPeXWmjHCFnzu9mZUrMfb91FX7eP13e1L7MK64qYfOiMTnELQg0sYRpVo4DwrGHO30/BFEnuBeQYCHwEo8WROPGbIH01aaTSiRm4OqENZxtn5kcHMnR021wOhGEJjQdMXyu7TBxcoRpcUBb5/V7k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710156302; c=relaxed/simple; bh=4pDVnZkHej3RuwF5nxZLKJSsv+DmPh3nKITPhTPBN/U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Mw2b03VdF7HrlyYNRPFN929QA9H6X9XRlu4vdhBcaUoKA7/BV0V3QQRmulyMrUhsodC6Hcrs4lPdxMsSuoyuZOKkqAs0GTHMeGRjIaRY+D29Ejb6giom501uEN5heESwNaiNtsgmFv23MOIlGlLHvHU5di5PfomXp9kNTtZje3I= 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.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-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-5683576ea18so3148915a12.3; Mon, 11 Mar 2024 04:25:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710156299; x=1710761099; 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=Tn6DoL4XiC/1sb436SFq4XKysqpuHz83glo8mzdMNKA=; b=webuKl6a8bMD5uI8zBfuXQ+7PCNltcSy1cUx71RtwhXnEQQ0NGOa7HpQc5daMURovV pDpuZQYu2wvvBToQqD+bwhTaOSD9PHV0ngNoCh5F8jSpU0rjzsjAj8cL0pGdegHxgcgc E3L5aSXaVlYGP5iqRSYTft6BIbhBQF1eJT1dGntPPrqxw4E2UtaV5btmd5d0Wgif0gmr XD9BkZLCSnwP+AfEBo3HJ1MjpaHGyw9FBDFabLww0JUrtvG/4eYKH08N8HfUR49R/l59 d1S2zJWqndIHmd3x+J0OVJit6FAsVk39doywEEAc0GZOWnuljmYSej1Qma736tWOz3/p w6Kg== X-Forwarded-Encrypted: i=1; AJvYcCX5cTJd2iv3JXqAJNhvModqmpIIZjVoSAWPxcBeL1B2oMgOBM7BY/LbgwSGQMKIV4SfaEFDnBYKm/dlnzG7lupuX4jkY2tI7dY5pQegC3Jenypnmefx0O3r10Cn/gpeVqHuB9/S X-Gm-Message-State: AOJu0YxrTXNSfMfDu+13wr9FbrIte+KamM0X7A5q7LXmkzaR3HQqI2IS e5Vv1pyKSTBj2W1STS2Vne93zBJicYdVYp72Q9Yy/p4KDJP3Zcyw X-Google-Smtp-Source: AGHT+IFpol4GKbefX4gxusREijrPiCVSvlLD2YwUl3LIMYtv+crpJlIwGpJ9CLa9SEwoEMWtDjfNBA== X-Received: by 2002:a05:6402:907:b0:566:b91f:1980 with SMTP id g7-20020a056402090700b00566b91f1980mr4312961edz.31.1710156299225; Mon, 11 Mar 2024 04:24:59 -0700 (PDT) Received: from localhost (fwdproxy-lla-005.fbsv.net. [2a03:2880:30ff:5::face:b00c]) by smtp.gmail.com with ESMTPSA id ev19-20020a056402541300b0056742460f68sm2780020edb.66.2024.03.11.04.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 04:24:58 -0700 (PDT) From: Breno Leitao To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: keescook@chromium.org, Ido Schimmel , Nikolay Aleksandrov , Amit Cohen , Petr Machata , Jiri Benc , Beniamino Galvani , Gavin Li , netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 2/2] vxlan: Remove generic .ndo_get_stats64 Date: Mon, 11 Mar 2024 04:24:31 -0700 Message-ID: <20240311112437.3813987-2-leitao@debian.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240311112437.3813987-1-leitao@debian.org> References: <20240311112437.3813987-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: Subbaraya Sundeep --- drivers/net/vxlan/vxlan_core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index 6f26003a3064..3495591a5c29 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -3214,7 +3214,6 @@ static const struct net_device_ops vxlan_netdev_ether_ops = { .ndo_open = vxlan_open, .ndo_stop = vxlan_stop, .ndo_start_xmit = vxlan_xmit, - .ndo_get_stats64 = dev_get_tstats64, .ndo_set_rx_mode = vxlan_set_multicast_list, .ndo_change_mtu = vxlan_change_mtu, .ndo_validate_addr = eth_validate_addr, @@ -3238,7 +3237,6 @@ static const struct net_device_ops vxlan_netdev_raw_ops = { .ndo_open = vxlan_open, .ndo_stop = vxlan_stop, .ndo_start_xmit = vxlan_xmit, - .ndo_get_stats64 = dev_get_tstats64, .ndo_change_mtu = vxlan_change_mtu, .ndo_fill_metadata_dst = vxlan_fill_metadata_dst, };