From patchwork Tue Mar 5 17:29:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13582794 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 86AD115491; Tue, 5 Mar 2024 17:30:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709659812; cv=none; b=E5jloKzt85V9CR7NMUAnEOpddMDpxX3ZcVZ+aapAWr35e3VQCqTWKNtpo8qQZhXSkfQ6cHWHJzhh9ShPeA6y19uL58TVR2aDKnv2BXT03ICt3zOIwQi5SVYs991GccVLosXEMVQzedHGaPnRBFR+4UEKt/s92KIaDcss7FHUG+8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709659812; c=relaxed/simple; bh=i83sIDjjKPudBFgdyqqnfQA7lkVycKfNiSKW8y4nc4I=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=YUHn6c8p6kN+Vw9hgGitNwAo3YJ0oq5ldy1IKwxSmCocTcXLEaLQhH7ted/nFQrJRZnI4RJOX86KuzpXe3YPTv/mEH4c2pXN0PcSS4alcwq1OUfsx/2LCciApXyoOHVHqqYqk/99AXsfJ2BRsTHF3P60N53JemN2wyz1nFvFjpA= 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.167.52 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-lf1-f52.google.com with SMTP id 2adb3069b0e04-5133bd7eb47so4144106e87.3; Tue, 05 Mar 2024 09:30:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709659809; x=1710264609; 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=8uCFGf8k6iLjyjQShlF3nE625Y2fqYIQwzjxO+ZKG5o=; b=mJaL0kSf+xn0VrUW9dAGNVnnon2jWOW4jXIZkdlidecIePhtX4lnskLeTTtlekUd9e +xrpqvrEm17zctKQWxcp/MZIDiJhveStLnwdhqLGyNGIKzAUbXXgRRMd0yB/9rM5uav/ 4QpA0oawtTKrjYmAsSOnLhS49Kb4z3THj4jyeDqsbUAqVSOaUMWLIi6aYAY7BKMik/Fi NsuxO19+SkXw61deFdce7m2OcpTJda82BFcU9jjWTe0QadvT/jNpglDGDwqjBaUlvzy+ bN1ruKzAaCyK1u/SElfmf3qYuz2Id9xPkKbDDjxisFrQvkV+qVHoLerGWikGZZ//XqHn DlWw== X-Forwarded-Encrypted: i=1; AJvYcCURDcNB/quMdFq2XR3XjcCBij97DiVhajDFTHRLsQJkb/5GjRGi1dMjRmkNnni1KF/WVlxGaFEtV6rmFJYS7Fe03zs61I12CWDZR9sg X-Gm-Message-State: AOJu0YxfVtr8FmOA2Lv6Bx8s9D9hhbUN2Djj3/Pkb79OHVoQ2PoWnLk4 OorLoiWyaxdGyAUamHBigzcuDjLZs2Sv/m2eJkLD912lm7YAcSK1 X-Google-Smtp-Source: AGHT+IFZpeJfO55mMWttk3T8zfrOq8xAiIXry2kEpSLswfmlu4R5RZBB+3tNJNVFKX2QNOkXGCv2xw== X-Received: by 2002:a05:6512:b94:b0:513:5991:1481 with SMTP id b20-20020a0565120b9400b0051359911481mr701044lfv.29.1709659808351; Tue, 05 Mar 2024 09:30:08 -0800 (PST) Received: from localhost (fwdproxy-lla-004.fbsv.net. [2a03:2880:30ff:4::face:b00c]) by smtp.gmail.com with ESMTPSA id lk11-20020a170906cb0b00b00a4577ffe69csm1910623ejb.78.2024.03.05.09.30.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 09:30:08 -0800 (PST) From: Breno Leitao To: "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: geneve: Leverage core stats allocator Date: Tue, 5 Mar 2024 09:29:09 -0800 Message-ID: <20240305172911.502058-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 geneve driver and leverage the network core allocation instead. Signed-off-by: Breno Leitao Reviewed-by: Simon Horman --- drivers/net/geneve.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index e25e0a31126c..dc88d5600e2d 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -319,19 +319,12 @@ static int geneve_init(struct net_device *dev) struct geneve_dev *geneve = netdev_priv(dev); int err; - dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); - if (!dev->tstats) - return -ENOMEM; - err = gro_cells_init(&geneve->gro_cells, dev); - if (err) { - free_percpu(dev->tstats); + if (err) return err; - } err = dst_cache_init(&geneve->cfg.info.dst_cache, GFP_KERNEL); if (err) { - free_percpu(dev->tstats); gro_cells_destroy(&geneve->gro_cells); return err; } @@ -345,7 +338,6 @@ static void geneve_uninit(struct net_device *dev) dst_cache_destroy(&geneve->cfg.info.dst_cache); gro_cells_destroy(&geneve->gro_cells); - free_percpu(dev->tstats); } /* Callback from net/ipv4/udp.c to receive packets */ @@ -1189,6 +1181,7 @@ static void geneve_setup(struct net_device *dev) dev->hw_features |= NETIF_F_RXCSUM; dev->hw_features |= NETIF_F_GSO_SOFTWARE; + dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS; /* MTU range: 68 - (something less than 65535) */ dev->min_mtu = ETH_MIN_MTU; /* The max_mtu calculation does not take account of GENEVE From patchwork Tue Mar 5 17:29:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13582795 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (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 04CF91643A; Tue, 5 Mar 2024 17:30:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709659813; cv=none; b=lKaGiZv+JI8j1fWpm9jBVSWLMZts2F1GI6PMICfp0VZVgwfoVk4ptqHhMCGgP8bQG6rWnglInEBQ8eV1sskqyMqCkgQJu8/KRuk31zm5iPrA8LVSldAOt97aDYO7HozVFh9OVeTwbvBIVcTybfMFd+YrQaNw4q89a13Q7e/Ysn4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709659813; c=relaxed/simple; bh=ludxbi9ALL5K0z1E3t3o/BEQhQJGn/ohaY9vv2ZVk/k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ScLYFmALY3+secfvNqFHA1EeN2a2RJvW8L/NMPcHyoCmiknWL0lWQXYECKwrm43R19Qr8BqqQoyLrw9fQmjT3C7vrbzbGw1Ts81AKug9Zhh1rLL752ed4QQaZ4TMXL6stQerxXSt0YbY2QXHX3b9S0SXxLP/dxHymPIr5u54DO0= 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.44 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-f44.google.com with SMTP id a640c23a62f3a-a3ed9cae56fso1294564866b.1; Tue, 05 Mar 2024 09:30:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709659810; x=1710264610; 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=I5TkMqojTLZpA5UqkaoAVqcHhIBmGns3HqgAQY26vLc=; b=tDnuUhcUTKzUYr4n4ePy9ajhrAN4lT21m/cvFjzVPE71b0lGMhHr0CUAWWzGM26xpv 42nL8dZeHCd0vCNSbr5q8Zrjg8U5l5X/aLjCT/B6XeJGNIdJGQ+HChUBGyNfqknn19ns xhJjwQH7zuASTAUzsJ14MJXdX/1SHYDdeRTtQP6yfO7KhxrA+gXPmobSmWThvjHNL/rD mX9/BqA7uA6f7W8Xg/GZEmp+12rFThiyxj5KFxkCWf81ugRKwt0a6q3/+RaQT29LYOoX myWcPeqxe5rxYH2CMVCgF4oBSBdwZSTW26W++CeTxNt6V0SDAoKaQOVLNmwLC4X8ve+Y 4wPA== X-Forwarded-Encrypted: i=1; AJvYcCXkTz8EDN2yYXsYNVQbJsbLHsYNHt/KIkSMV6Q0QedfiqEbzfKtdZwQ1KwUEh9DjUFwLE5bkjlOQ0/xefkeXr2XYkwe6rSxVNtQItHX X-Gm-Message-State: AOJu0Yw1NtKCN4azrxw2UANTbgTJ31Py9Y+oFhX+eZjZ8sspfMn0ce16 crgaAN9aRKDm+g2SlC3bvXaUTGUt9EeyLGGdxwUFY3SvfoZVpyPf X-Google-Smtp-Source: AGHT+IG1Nnz+0eMzPKg51FULw5QqhNSE/Hvg2wjIjit4ehtBwKGdOJ+xLJVjAay11UktcF1a2kbRlw== X-Received: by 2002:a17:906:2358:b0:a44:2cc3:2ba8 with SMTP id m24-20020a170906235800b00a442cc32ba8mr3705208eja.27.1709659810092; Tue, 05 Mar 2024 09:30:10 -0800 (PST) Received: from localhost (fwdproxy-lla-116.fbsv.net. [2a03:2880:30ff:74::face:b00c]) by smtp.gmail.com with ESMTPSA id ld13-20020a170906f94d00b00a451ab833c5sm3129280ejb.21.2024.03.05.09.30.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 09:30:09 -0800 (PST) From: Breno Leitao To: "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: geneve: Remove generic .ndo_get_stats64 Date: Tue, 5 Mar 2024 09:29:10 -0800 Message-ID: <20240305172911.502058-2-leitao@debian.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240305172911.502058-1-leitao@debian.org> References: <20240305172911.502058-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: Simon Horman --- drivers/net/geneve.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index dc88d5600e2d..ff0d7bdaa4ee 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -1114,7 +1114,6 @@ static const struct net_device_ops geneve_netdev_ops = { .ndo_open = geneve_open, .ndo_stop = geneve_stop, .ndo_start_xmit = geneve_xmit, - .ndo_get_stats64 = dev_get_tstats64, .ndo_change_mtu = geneve_change_mtu, .ndo_validate_addr = eth_validate_addr, .ndo_set_mac_address = eth_mac_addr,