Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp335115lqs; Tue, 5 Mar 2024 03:39:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWr33ciqa4QHpIo1AbhremvmIVuh/bRY3Q7RhkC3mPVsazF3yU8FjbNYZCidfgzWdltOCdTNF8ErBgGSMauW4fTmEHQrtlcyNKkbUQc4w== X-Google-Smtp-Source: AGHT+IHzLZlsVPpqiarbRbJhuklF1jPUb6Z7LFDSCBYYb1YGxmV8jLJ167TZnZELfSlLVSFVhSX2 X-Received: by 2002:a50:cbc9:0:b0:567:1947:d53f with SMTP id l9-20020a50cbc9000000b005671947d53fmr2281145edi.9.1709638762092; Tue, 05 Mar 2024 03:39:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709638762; cv=pass; d=google.com; s=arc-20160816; b=r8seMgU0FlDfdFvFeVxMl3B21fcHtoOoCsudRhOyLOtLJAyaMMShHMMw7Gm3j2ewZa XRgXf3q80bxITZNpViKQADaha3Y8IG59fALmuo2L9cfaqQbpis0GewbcY6go7qT3aP1r DExt0y9fv6uURVvHXTXZuxPP/1KTR4gQG6jbi99C84cJCwzFECegjTR3WQ34VjvCKsHO qw5nguSAd99k6BGx9MpbpniNPVJ5Tfd/PyHxydGRScfLNWQogf7cXtcQi3wMd6Lf2mys hq2G3xakWvOnw0JcWjBoiEvSGuHhK5atN1mJ4bn91p1wqI3SypG3e9RTqczcoA7gddBw Rl1Q== 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=PZcy/13YPJy/Q8JEq2MiymPPGsNdrglf5cJPZckjBCg=; fh=mXs61UQ1XEaydPiNbnaVNJ1S1flX+9BJzapiB8O5QaE=; b=QZe+Zb+i68qg1raW5NtO+P5+fYb+OV8M+SAJz897mQaj+IgZTFZksr2rpQ9yZLG/F0 kj7ap4gVwOtHtpCDygUt/aONWwWGzLqTaLm0P91vmae4p8T3Gmco82lArsAXx5D6onsR VMDJhH7T2zgD8bXJaTtjPy7sMQEaikQGB8s4D9nw46WBjV+TfWCy6ZbfAzJMhEQEY5Yr cC0+oCgcqlHkZvDcmhK/6W4WkMRucPgBn9usuI+sZstB/BQEb1SW2FEWVDlAIwWIbLYo iMFrbxqHwWGCgyj6Qg+S7kao9+FI3NpHg/VkAKkKgc1Qo3LuoDOxe8GA9js126p2fnOb 9Ljg==; 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-92297-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92297-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s5-20020aa7cb05000000b005661390c436si4879008edt.449.2024.03.05.03.39.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 03:39:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92297-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-92297-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92297-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5954C1F22DDF for ; Tue, 5 Mar 2024 11:38:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D9F55733F; Tue, 5 Mar 2024 11:38:08 +0000 (UTC) Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (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 D8B7F54908; Tue, 5 Mar 2024 11:38:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709638687; cv=none; b=d9mRPE0VhkO2vwPtTALzAf7QAYKGekwVO9KmLoyDoda3Zf2yKk6nRCB90Bme10s0OSjfH4WPj84BO7ZaSLgiKaSU99EmtCqiHWkaUtYeUBtg9XpNW+BbgyhOXwDdDrwL6BfWZABkQc4DE0fau/U7rSpDGt34yAXhqByIwRJjxsc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709638687; c=relaxed/simple; bh=an0mJ4yI+Taqndo6C5ZxyINal5TwXXDiYE/eX/dyfXU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ebkBXAazRcjaoia3Z416CeH2i79ASP3hhVw4ik7PVtuoe8laacfcErPNTyzWUJFlTVgiJtnQZkO4u8xFdC/JNbmxecd1HcSry0KfHOEKbT5rLH2PLqfVsVJNo5e5dsJZJW/whtWbzP7Xcc2IPAAL/ncI9a2Dl8p0FKsh/eX8K4E= 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.47 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-f47.google.com with SMTP id a640c23a62f3a-a3ddc13bbb3so1090130866b.0; Tue, 05 Mar 2024 03:38:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709638684; x=1710243484; 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=PZcy/13YPJy/Q8JEq2MiymPPGsNdrglf5cJPZckjBCg=; b=lKcJOcUevr9rztc+PQ7gzAo4I8r9yNwKmuwzzaDIj0Af93HCG7vEOk4WVec4IOSr8v iyr/0pbZvo4u+yiNG6zLMcF5ksNnPk5xi/yXqBH4gdpBKAyMaV6kbvYiqiF4t1XixyPj LMb5GmYStYz97CJu+TzTBGFKO/oFKBSz+DdySmowE/YU29deFz+DS3gU6w2+IxwKYGC2 xfGa19yVSNdZ8S7DAw3yxsDLYf6yyTSxjpMbJ1Fy9hRjQcplKBdE2xxfO4+bIS1QRQh7 5FUftRkCH02zTFVs0E+moYSoI2yEknTL0XddbKjR904W5vOO2dOQDOZbCd+dH977L67K YP8g== X-Forwarded-Encrypted: i=1; AJvYcCWEVsvSD9vwpQvl+sasR7f2HaDZEmdkxPzUZ/1K9nldQcvXbQHcHEy1UL0UI+mFeXI9PK70Tgeb7W6pkiiZNs40DVbeYGKs0gKrdXDV X-Gm-Message-State: AOJu0Yy+exG89NmNFGqGAeWGH97KD9HFHTwwwEY5dSd74rdcIVOiruIV WPtgsJNa246iZAHf/SRK6+y736rkCCZJEjtVRMMiCXaj5nllUPLY X-Received: by 2002:a17:906:340b:b0:a45:74fb:f5c3 with SMTP id c11-20020a170906340b00b00a4574fbf5c3mr2319199ejb.28.1709638683891; Tue, 05 Mar 2024 03:38:03 -0800 (PST) Received: from localhost (fwdproxy-lla-009.fbsv.net. [2a03:2880:30ff:9::face:b00c]) by smtp.gmail.com with ESMTPSA id rp25-20020a170906d97900b00a3d665c6778sm6038509ejb.12.2024.03.05.03.38.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 03:38:03 -0800 (PST) From: Breno Leitao To: kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, edumazet@google.com, Sabrina Dubroca Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org, dsahern@kernel.org Subject: [PATCH net-next] net: macsec: Leverage core stats allocator Date: Tue, 5 Mar 2024 03:37:27 -0800 Message-ID: <20240305113728.1974944-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 macsec driver and leverage the network core allocation instead. Signed-off-by: Breno Leitao --- drivers/net/macsec.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 4b5513c9c2be..0206b84284ab 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -3519,18 +3519,13 @@ static int macsec_dev_init(struct net_device *dev) struct net_device *real_dev = macsec->real_dev; int err; - dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); - if (!dev->tstats) - return -ENOMEM; - err = gro_cells_init(&macsec->gro_cells, dev); - if (err) { - free_percpu(dev->tstats); + if (err) return err; - } dev->features = real_dev->features & MACSEC_FEATURES; dev->features |= NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE; + dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS; macsec_set_head_tail_room(dev); @@ -3550,7 +3545,6 @@ static void macsec_dev_uninit(struct net_device *dev) struct macsec_dev *macsec = macsec_priv(dev); gro_cells_destroy(&macsec->gro_cells); - free_percpu(dev->tstats); } static netdev_features_t macsec_fix_features(struct net_device *dev, -- 2.43.0