Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp334914lql; Mon, 11 Mar 2024 04:25:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX588skWrmUmfY31MbfpOdwdEtJJoe0Oe5Xss6dmPpk2/TSbSGvahjph99cOFBjiz5+phDL8rRIyHjdC8yIKPYG82m3yRHhqpIv1X7CRg== X-Google-Smtp-Source: AGHT+IFFuFPAkiyJQIZTTncQphPQlLe6TlemSNLqBzu0k7UFUd3AtePYIpDd+MYnOj0koJV6/sRx X-Received: by 2002:a17:902:bc8b:b0:1dc:2f30:e0dc with SMTP id bb11-20020a170902bc8b00b001dc2f30e0dcmr4403371plb.36.1710156320023; Mon, 11 Mar 2024 04:25:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710156320; cv=pass; d=google.com; s=arc-20160816; b=1F/AkduwkLivIjUM7uns7vOm4r1pzEH4XSK+tyT6tjEy7t05qnafQLiPgZvrL/Yq5F WnVw59btN+7/YkTquVYpCGoZ3XsRxx2zb7QF3HBK772QbFdAJxjTqvyK3nYGtMystjWc XtZ6rgJd8iS35ZBw9uLCDSWNU+HBPibWbzvtc9fNhobhyGWZ4vHFdxOsLQWr4qgfKbwM OUgTDZpaZlEGMXnkHgRgjBq6hOEpB4eRLGfR3bQXBJ+SPIdvOwWzymyWgVisYjmvPtNV AQpj7pTD+QgM2+JXR84wkYlov+HqaQj2y1pXmzeFk1/1Uz9YEI/djlRn89yf9XAHTUdb 4A8g== 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=2fwR9bgFz/hQ+RIWCBvp7Qx01qUpN78LiqG0Zncb2Gg=; fh=i8FwGp1i5H+9Q0FLSBPbrAJy98F91mZt+s2S2sQmpCU=; b=aE6SHQP7k3hY6ETJaH9ChRhQV6pi99QQpwNckUnD0Gf35ZM6aQ92KCOEstAAthhPgA FnDqsvdr5IfiM/05Ii3Ckce2DMd9Nlc4o+lc9DhbZxk2TXjf/5a1sXTT1yF064lRXNES jF07tnkiATJ6h7bE9YcBiBke1vMAh+LPW7lb7zGqCtFgM1qSIaWtu21ojlaLgA9LDH1r xP87PnTW9qTowh53AEfTEQH+StEDSFXon6eqicxSpAE5VMVoe+Am8oZnGmhQXE6G+5P0 gfcZhYA/E7LdydXyD0+0dC/v6h5gRoNBh21x8QsZxTMy3lJheXCdPxVTKD4ohYq4Gd0r lovQ==; 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-98760-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98760-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g13-20020a170902c98d00b001dbd81089e6si4394553plc.515.2024.03.11.04.25.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 04:25:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98760-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; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-98760-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98760-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id ADE25282149 for ; Mon, 11 Mar 2024 11:25:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 26C0A3C082; Mon, 11 Mar 2024 11:25:00 +0000 (UTC) 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-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: 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 vxlan driver and leverage the network core allocation instead. Signed-off-by: Breno Leitao --- 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); -- 2.43.0