From patchwork Fri Jun 7 10:20:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13689616 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (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 CE802156F5A; Fri, 7 Jun 2024 10:21:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717755662; cv=none; b=ojytE89jeLCSJ2zd/fDISk2RRySW2lAO0Iznwy7JTe4dfBsb/AIDRzwhZ7mD1Yrq+xu1VOR58dBUfTZS6Hu7ljswcl3uigytP1ZXLOjl1LuObDg7n6mC4AUEIQqv9SwiMcGrvDNffF/dwBdGNYwDilHqq/6ad9+ww1sIT2cpQ7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717755662; c=relaxed/simple; bh=nd+4BToiRJXLGGA3mTGlxCpZ4MPw9XkWR9N7avm/dGs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=evnW25N8fOvFbXhs+WUCAunc2eemQfQZ2EJhXl+I8M15PZaBq0s6IYArIE0mICGJ8xBH1TZJD0G13BFRMsnqgzjMDeqO9qOlWlljKXQapjB8X5Is+kgO3p1f4BBZ91xWC1GXVyPP70ymqCegvG4c+VqXAQWVLobNvMW9q3XzPRk= 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.48 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-f48.google.com with SMTP id a640c23a62f3a-a6e349c0f2bso41964866b.2; Fri, 07 Jun 2024 03:21:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717755659; x=1718360459; 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=3wleu//OAE2cyfcBt+2g23v6CQm8bhtCW5SGTOJfzMc=; b=sw0Oxrroaq2bA4fbpgrPmgkbPMuAOAKXKyXx8PNktZUlu3VUx8wdYlogreO+Dw5hdQ CEy2gSsMCserFOBvI2mzpIxAkZT0ges901m7nrc8hU4wTCFVB1HTQ58gU/tJzNPDLQ2r hMTWVE3FHupWkL1r/K01pJ1uAYpktXEaQJG+iF5FWzke2gFqw+A9FALF28K9arQtKRgj nC4dq1w4b8EFNi+ft0mq38gu9wju2AUYYpxabewAQ9U9Q29lsolJePi/Y0XnTFgafGMC m4B0AR7cDiwvsyTZBJN1f7HHCVrjZZE8I/GW/DIycejeb9bSE+43mx++jF5V6f5Nr7Lm 2Tow== X-Forwarded-Encrypted: i=1; AJvYcCVuPGD+TcfWfFgaBZ4VKu2VOU/c8AJIpE3LUJcT7m+PR+yLN2sIL5bq/tbxyXbj7q1AVWJ9xGP5e7gITeTUM7cexvhPhuKn8dFrfyF+lkJsjuU8ZvBOxDAoddrxSPdmMx9NZRZwEf8sshumVWeF0czX4r2oLxrOfl6fF0B0KQb0wEZh0vk= X-Gm-Message-State: AOJu0YxGOGI3JvJxfiBSc825ZOrWpHzlnUXSnN1E8NdB2ZPQ/w89XQiy qLsALdMTVbg5dmYv9Eo7JfTeD+63/uo8OsGA3KR/htns9WYk12o7 X-Google-Smtp-Source: AGHT+IEyyLJRYOtiSgR04GeTyfW24MKvLfnpXDDvS3JofL34QAj8qDmKfpKJ/W6nPTYpqmlU81mH7w== X-Received: by 2002:a17:906:11c8:b0:a6c:704b:cff1 with SMTP id a640c23a62f3a-a6cd76a9344mr136254766b.41.1717755657977; Fri, 07 Jun 2024 03:20:57 -0700 (PDT) Received: from localhost (fwdproxy-lla-008.fbsv.net. [2a03:2880:30ff:8::face:b00c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6c80581a7esm226683666b.36.2024.06.07.03.20.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 03:20:57 -0700 (PDT) From: Breno Leitao To: kvalo@kernel.org, linux-wireless@vger.kernel.org, Johannes Berg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: horms@kernel.org, sbhatta@marvell.com, netdev@vger.kernel.org (open list:NETWORKING [GENERAL]), linux-kernel@vger.kernel.org (open list) Subject: [PATCH wifi-next 1/2] wifi: mac80211: Move stats allocation to core Date: Fri, 7 Jun 2024 03:20:43 -0700 Message-ID: <20240607102045.235071-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 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. Move mac80211 driver to leverage the core allocation. Signed-off-by: Breno Leitao Reviewed-by: Simon Horman --- net/mac80211/iface.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index dc42902e2693..605305cb3ff2 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1458,11 +1458,6 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) return res; } -static void ieee80211_if_free(struct net_device *dev) -{ - free_percpu(dev->tstats); -} - static void ieee80211_if_setup(struct net_device *dev) { ether_setup(dev); @@ -1470,7 +1465,6 @@ static void ieee80211_if_setup(struct net_device *dev) dev->priv_flags |= IFF_NO_QUEUE; dev->netdev_ops = &ieee80211_dataif_ops; dev->needs_free_netdev = true; - dev->priv_destructor = ieee80211_if_free; } static void ieee80211_iface_process_skb(struct ieee80211_local *local, @@ -2101,11 +2095,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, dev_net_set(ndev, wiphy_net(local->hw.wiphy)); - ndev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); - if (!ndev->tstats) { - free_netdev(ndev); - return -ENOMEM; - } + ndev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS; ndev->needed_headroom = local->tx_headroom + 4*6 /* four MAC addresses */ @@ -2118,7 +2108,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, ret = dev_alloc_name(ndev, ndev->name); if (ret < 0) { - ieee80211_if_free(ndev); free_netdev(ndev); return ret; } From patchwork Fri Jun 7 10:20:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13689617 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 B9D0215B99D; Fri, 7 Jun 2024 10:21:02 +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=1717755664; cv=none; b=BGghh8Zx4rFhEJoRChRbBw2AGCSkOD7C/afiufp85LESP61YheKe4PGd92VLhXn29hUVUwkLdubz0zz5KoBVjsa3QXba0yR8deHixB7vBfJx+ndaxk96LGf51CfjjVRlelJWk2ngpoFfwdDjuKGZUbIgBuOKnxBmVmo7thJWU4M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717755664; c=relaxed/simple; bh=gbzkN+HnRQiOXaIoiH0HNihHOHVKYAf+aBcWP/Am+xk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Fe4IOT7M6QjxWn5o8NtaEQ5NN+xNA4nsCWHeeqdq4FuSmXOfoG2B27F84pJucVmrUjXwETQiiG53FxajvFjkxeDmm9xL7mqAQFnU5o7Bax2FGzpSSr0QLLJnVHT528kazPZDwxkt4+NwDFmtm8JOcM6KWtdmJADA/bJcK3HF/L0= 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-57a32b0211aso2565765a12.2; Fri, 07 Jun 2024 03:21:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717755661; x=1718360461; 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=N3nNU9KpHJb0ZPufRdlZofVOg4CGXOzM45QLGnUwPxc=; b=fQnB0ABsnatbKNQUAlmC4rP14ggXYSqiPxCPk8U5PjuD3HwHsUbtXSxT6kDJECXkpA oRisKhRDz9rQFJjwZAfqIWTDacQAC8AxZXV4zoVlln9f3M+2/dG/BnvbZqMIoQJcuTFA EQPTOqxItOYwoRLREaBs9o3fYZ2rlKq4MzS1fxnpJBgrVYARNl4TkRMnmEH2OueHIFSh 8kVQ+gtY7teDLDJaNOa2rqts6GwsXw2iYRlGWf+ZBy8UrkkRZYP49QEFa5Y30brjSH3s hXWWm4ag3/6Li14wa1wClOFlNYqbqxgM98sTnfmdHrG7DFKjAWe8wVZlEx1wqTx8hoHW H3pg== X-Forwarded-Encrypted: i=1; AJvYcCXIraZj0W5FjV6m51tqnq0siNYK6mQwPV0skiWA/p3NpinqM6PkWmsJBDjbfh7Ty2HHetkExv/twDnkcD73hI7j0rJskswHz0OZDyr13rTRPDNVe4+Gztb0B9BtAe3XqBpR9G8Jvkmj0BFNqPmKYn6zUgjPNWO+/DfW53QWWZcWzEGE7+4= X-Gm-Message-State: AOJu0Yy79jzLa69tVl7vCjWxx836gnGrT/CiernHyQVdqNGcnb2jM24K lEfE5nKHWvYUqZdSeHTTfrAnt66QAD1E1OaHx69UOPJ70SINNf8I X-Google-Smtp-Source: AGHT+IFCVIxpP0OHrnh8NVA0zJEQxrVUDOw/7dZQgh4PFibqT5y/SjiCjtNuNTYPTxThSL3gNeMhTw== X-Received: by 2002:a50:8d1c:0:b0:57c:5f4c:b229 with SMTP id 4fb4d7f45d1cf-57c5f4cb36dmr565366a12.33.1717755660723; Fri, 07 Jun 2024 03:21:00 -0700 (PDT) Received: from localhost (fwdproxy-lla-000.fbsv.net. [2a03:2880:30ff::face:b00c]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57aae142816sm2519919a12.58.2024.06.07.03.21.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 03:21:00 -0700 (PDT) From: Breno Leitao To: kvalo@kernel.org, linux-wireless@vger.kernel.org, Johannes Berg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: horms@kernel.org, sbhatta@marvell.com, netdev@vger.kernel.org (open list:NETWORKING [GENERAL]), linux-kernel@vger.kernel.org (open list) Subject: [PATCH wifi-next 2/2] wifi: mac80211: Remove generic .ndo_get_stats64 Date: Fri, 7 Jun 2024 03:20:44 -0700 Message-ID: <20240607102045.235071-2-leitao@debian.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240607102045.235071-1-leitao@debian.org> References: <20240607102045.235071-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. In this driver specifically, .ndo_get_stats64 basically points to dev_fetch_sw_netstats(). Now it will point to dev_get_tstats64(), which calls netdev_stats_to_stats64() and dev_fetch_sw_netstats(). netdev_stats_to_stats64() seems irrelevant for this driver. Signed-off-by: Breno Leitao Reviewed-by: Simon Horman --- net/mac80211/iface.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 605305cb3ff2..8f5d5f5deb4d 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -815,12 +815,6 @@ static void ieee80211_uninit(struct net_device *dev) ieee80211_teardown_sdata(IEEE80211_DEV_TO_SUB_IF(dev)); } -static void -ieee80211_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) -{ - dev_fetch_sw_netstats(stats, dev->tstats); -} - static int ieee80211_netdev_setup_tc(struct net_device *dev, enum tc_setup_type type, void *type_data) { @@ -837,7 +831,6 @@ static const struct net_device_ops ieee80211_dataif_ops = { .ndo_start_xmit = ieee80211_subif_start_xmit, .ndo_set_rx_mode = ieee80211_set_multicast_list, .ndo_set_mac_address = ieee80211_change_mac, - .ndo_get_stats64 = ieee80211_get_stats64, .ndo_setup_tc = ieee80211_netdev_setup_tc, }; @@ -877,7 +870,6 @@ static const struct net_device_ops ieee80211_monitorif_ops = { .ndo_set_rx_mode = ieee80211_set_multicast_list, .ndo_set_mac_address = ieee80211_change_mac, .ndo_select_queue = ieee80211_monitor_select_queue, - .ndo_get_stats64 = ieee80211_get_stats64, }; static int ieee80211_netdev_fill_forward_path(struct net_device_path_ctx *ctx, @@ -945,7 +937,6 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = { .ndo_start_xmit = ieee80211_subif_start_xmit_8023, .ndo_set_rx_mode = ieee80211_set_multicast_list, .ndo_set_mac_address = ieee80211_change_mac, - .ndo_get_stats64 = ieee80211_get_stats64, .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path, .ndo_setup_tc = ieee80211_netdev_setup_tc, };