From patchwork Wed Aug 2 10:00:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 18577 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id 52AAE8317F for ; Wed, 2 Aug 2023 12:01:29 +0200 (CEST) ARC-Seal: i=2; cv=pass; a=rsa-sha256; d=open-mesh.org; s=20121; t=1690970489; b=kDbMFUF25O0KdmYd/SnnHdDHUUvQ4L1y6n6c1lP1TrX7Y29lRTKnzLdSF0vj2tLcyKeCX BxQviLEGUgqqjGj6+arzy/X2USWOTpw8boCEhbmW8gq9fN0Yva63bY2RkuNGHlMC8RwTMvV ApQSf/hfreHcQYIizZ0e6P14JXPPpgI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1690970489; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=PyWEl2ADGOEIH8PHWY9Wo65xHZhjP9kWt9AxXpKxeqM=; b=EvZf5zIvaBxszv5tbY6pQHDc+4DjbBEzThhg2OBhYaYfQV69bvb6nutqG5jpo9aUpbqVK UfqoLqZFovjLsXUUN572THeY4IWdXeR6zp/5OQ2VELcHWpEOuIXSpFJzGtCJptu6Ox597Me ug98lnusPULzp60b3Ji6gVgxwkc4yrU= ARC-Authentication-Results: i=2; open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Authentication-Results: open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Received: from dvalin.narfation.org (dvalin.narfation.org [IPv6:2a00:17d8:100::8b1]) by diktynna.open-mesh.org (Postfix) with ESMTPS id 7F45482DD5 for ; Wed, 2 Aug 2023 12:00:31 +0200 (CEST) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1690970431; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PyWEl2ADGOEIH8PHWY9Wo65xHZhjP9kWt9AxXpKxeqM=; b=tW6hMXxVpuncIHlxyclNkElbeydfyx0xLJb9xjoxI4BkuCtE2mJ+St5NAkOG3TnHJfns8I KjHISvrn+0kcTkcCtWuun4Wjp8dvxEf9yHYcUlcLhigOe5E30Ejo9JL+noMiN0pSVdnH6y +yVCCUPrHI2fRDblwndDd9r4/wX4yDM= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=narfation.org header.s=20121 header.b=snttJk1q; spf=pass (diktynna.open-mesh.org: domain of sven@narfation.org designates 2a00:17d8:100::8b1 as permitted sender) smtp.mailfrom=sven@narfation.org; dmarc=pass (policy=none) header.from=narfation.org ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1690970431; a=rsa-sha256; cv=none; b=dHbAEOPkE8aOgjRDOakhNlftl5yUlGu8adXpdIajBxHNTzY7VU8IIfjz2SwTGLV8xyJv2w 8XQvjM0hvByH9bppPISc4rUORr3mStTOvdEThGfDAxCsZa4BcBsy9M4TiYiANPP+VT7KWu LL/nt6Kcmssf+DiA8n0SEU7eCtEtqI8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1690970431; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PyWEl2ADGOEIH8PHWY9Wo65xHZhjP9kWt9AxXpKxeqM=; b=snttJk1qDD8WcSGhfef2zc+SiVqM6BZ/tlXRA3lUoIuZ4vYOI3ulbABIjSGIvCdkgOpsri x91VhmgNkVcHJbw4fAvdFXMHTQbpejdjjzSSw6xq9gQ2swdsXIN/QbS2rByTU+SfQi8mQD uE7DxTr1jl0HopyNQ2LrCvLBzMlu6+Y= From: Sven Eckelmann Date: Wed, 02 Aug 2023 12:00:22 +0200 Subject: [PATCH 1/3] batman-adv: Drop unused function batadv_gw_bandwidth_set MIME-Version: 1.0 Message-Id: <20230802-cleanup_functions-v1-1-1f9bfb914696@narfation.org> References: <20230802-cleanup_functions-v1-0-1f9bfb914696@narfation.org> In-Reply-To: <20230802-cleanup_functions-v1-0-1f9bfb914696@narfation.org> To: b.a.t.m.a.n@lists.open-mesh.org X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=4280; i=sven@narfation.org; h=from:subject:message-id; bh=l36GwvJf8OgASoa+NCqB/ZVAhdTUEmOX3JiSaPzAU+4=; b=owEBbQKS/ZANAwAKAV2HCgfBJntGAcsmYgBkyik3qhHeaxYQPgRuNRS/COU9fYFymUkVJubTB oUfWjY8M76JAjMEAAEKAB0WIQQXXSuHYSVz3OMy4AJdhwoHwSZ7RgUCZMopNwAKCRBdhwoHwSZ7 Rvr2D/94Ix6IB/oPdXWSOoB+J6W/S4At4rwK/cLWb7BDN1qnOtv9Dey7PngwA1mtHdAiEE8PT03 8VA3jU9w3pS3loD7ia9N8WUGA8bQzEkOvaMAOibPArdGf8uFakZvpHtd000cUlbptWHJ5Gm41N4 cT/evP/Onai3IEQ34n7+jpaqmjMz+GVaXy9DbH0lu7hIN3OFojNa03VVbossjh9slPkJS5r07Pb dOp4eyLzGp9S1RsSnkXaMNmBg5U9ZhMpuj7EQ3ZiDTMWrI2Ba4ZnU6wdHCtIiWYTbYQ2+lyI3En p/jFxKtUu4B2CTKQXJvhG9Oxl2j6nwWq0P05dvRQrpazVaub6DJ8uypapwM7jVNjg6+fzOq/hwv xEf+YvXuOXCPYd6VgEsCoFOg6+YG55R97kEk5QEcT0vpLsZxqEBfCplcxDomBgZ7yoLQC6vb/uu ErKG769eEtyH6ltzKa+18k9pQy7QfdMa9KYxqcF2Yrcq3VEeCsRa39/xTTFZ0EFaa1OGRj3cVOr hPCsAV2gEy49SOpwAGauMI+e7Csgk02Z6VNbUoz6q1fhFgfcP080EvmsBLYqhte0U7nD4UXmf2Q rT7tx/fsdK63avNE3ewZp37PbO8bMGy0c2SKkKznlzX9BYQ4nrSpP9k9eUxEEzxsYJdMHdemnVu K0tVBBMlcdbkjiA== X-Developer-Key: i=sven@narfation.org; a=openpgp; fpr=522D7163831C73A635D12FE5EC371482956781AF Message-ID-Hash: 6R27IZHL3VVHODHWJGVYOBEKXS2ROJSY X-Message-ID-Hash: 6R27IZHL3VVHODHWJGVYOBEKXS2ROJSY X-MailFrom: sven@narfation.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This function is no longer used since the sysfs support was removed from batman-adv. Signed-off-by: Sven Eckelmann --- net/batman-adv/gateway_common.c | 88 ----------------------------------------- net/batman-adv/gateway_common.h | 2 - 2 files changed, 90 deletions(-) diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c index 6a964a77..d9632607 100644 --- a/net/batman-adv/gateway_common.c +++ b/net/batman-adv/gateway_common.c @@ -9,7 +9,6 @@ #include #include -#include #include #include #include @@ -90,42 +89,6 @@ bool batadv_parse_throughput(struct net_device *net_dev, char *buff, return true; } -/** - * batadv_parse_gw_bandwidth() - parse supplied string buffer to extract - * download and upload bandwidth information - * @net_dev: the soft interface net device - * @buff: string buffer to parse - * @down: pointer holding the returned download bandwidth information - * @up: pointer holding the returned upload bandwidth information - * - * Return: false on parse error and true otherwise. - */ -static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, - u32 *down, u32 *up) -{ - char *slash_ptr; - bool ret; - - slash_ptr = strchr(buff, '/'); - if (slash_ptr) - *slash_ptr = 0; - - ret = batadv_parse_throughput(net_dev, buff, "download gateway speed", - down); - if (!ret) - return false; - - /* we also got some upload info */ - if (slash_ptr) { - ret = batadv_parse_throughput(net_dev, slash_ptr + 1, - "upload gateway speed", up); - if (!ret) - return false; - } - - return true; -} - /** * batadv_gw_tvlv_container_update() - update the gw tvlv container after * gateway setting change @@ -155,57 +118,6 @@ void batadv_gw_tvlv_container_update(struct batadv_priv *bat_priv) } } -/** - * batadv_gw_bandwidth_set() - Parse and set download/upload gateway bandwidth - * from supplied string buffer - * @net_dev: netdev struct of the soft interface - * @buff: the buffer containing the user data - * @count: number of bytes in the buffer - * - * Return: 'count' on success or a negative error code in case of failure - */ -ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, - size_t count) -{ - struct batadv_priv *bat_priv = netdev_priv(net_dev); - u32 down_curr; - u32 up_curr; - u32 down_new = 0; - u32 up_new = 0; - bool ret; - - down_curr = (unsigned int)atomic_read(&bat_priv->gw.bandwidth_down); - up_curr = (unsigned int)atomic_read(&bat_priv->gw.bandwidth_up); - - ret = batadv_parse_gw_bandwidth(net_dev, buff, &down_new, &up_new); - if (!ret) - return -EINVAL; - - if (!down_new) - down_new = 1; - - if (!up_new) - up_new = down_new / 5; - - if (!up_new) - up_new = 1; - - if (down_curr == down_new && up_curr == up_new) - return count; - - batadv_gw_reselect(bat_priv); - batadv_info(net_dev, - "Changing gateway bandwidth from: '%u.%u/%u.%u MBit' to: '%u.%u/%u.%u MBit'\n", - down_curr / 10, down_curr % 10, up_curr / 10, up_curr % 10, - down_new / 10, down_new % 10, up_new / 10, up_new % 10); - - atomic_set(&bat_priv->gw.bandwidth_down, down_new); - atomic_set(&bat_priv->gw.bandwidth_up, up_new); - batadv_gw_tvlv_container_update(bat_priv); - - return count; -} - /** * batadv_gw_tvlv_ogm_handler_v1() - process incoming gateway tvlv container * @bat_priv: the bat priv with all the soft interface information diff --git a/net/batman-adv/gateway_common.h b/net/batman-adv/gateway_common.h index 87c37f90..cb2e72d7 100644 --- a/net/batman-adv/gateway_common.h +++ b/net/batman-adv/gateway_common.h @@ -27,8 +27,6 @@ enum batadv_bandwidth_units { #define BATADV_GW_MODE_CLIENT_NAME "client" #define BATADV_GW_MODE_SERVER_NAME "server" -ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, - size_t count); void batadv_gw_tvlv_container_update(struct batadv_priv *bat_priv); void batadv_gw_init(struct batadv_priv *bat_priv); void batadv_gw_free(struct batadv_priv *bat_priv); From patchwork Wed Aug 2 10:00:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 18578 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id 527328324D for ; Wed, 2 Aug 2023 12:02:09 +0200 (CEST) ARC-Seal: i=2; cv=pass; a=rsa-sha256; d=open-mesh.org; s=20121; t=1690970529; b=dZMP+AK+cWQxttOC0OOlMTvDPFDieuOoGNlQKtk3w1TV4h5qV2ivZbPxJGQM+JZUwkPbm ukrQc9fJHvV51ETEMrb/Dez1cw01kq/xrk4lOS/qcoLcobvar+Chs6CxJSjsQ6vB3WlhWpn ghYMyTcniYkGM4DB79tzLEmwSqq4hxw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1690970529; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=u6pgN2cyyroZibvCzWWQm7wwqfAMucQmU9KwnVmuwYA=; b=oKI/60IkJ7LjrahYdC1+UnpZAOtMgdlbjbSFTfYy+1KahnOrFJs1Fai5ecfJjPXT4cnTR pr2jixIfJgkh6RCdHqEqlq7JLONOldSJc7WuWxCRb6sG81LWmcfmTKrRvxF8NIL1rBI4VYG CJxYoete7FDOkRYYse8RIiAzh0WGh0c= ARC-Authentication-Results: i=2; open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Authentication-Results: open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Received: from dvalin.narfation.org (dvalin.narfation.org [213.160.73.56]) by diktynna.open-mesh.org (Postfix) with ESMTPS id E07D682E82 for ; Wed, 2 Aug 2023 12:00:33 +0200 (CEST) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1690970433; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=u6pgN2cyyroZibvCzWWQm7wwqfAMucQmU9KwnVmuwYA=; b=Tbv3t8jlfOybS/lXJXnmpQJLcskoZO52iNi6HROQXi4kx7j0DxCJfJa9AaYiVtCvvbjSMj vV+KDcoJAvYlyRqvm6nUMUcWtKMbVm7TMgP7N1zrqs8bSsbawntNgoXu+Lci25Zae5ZN3f l6/Z1IS1zeA0nu/A6eNN21//H7o1iEc= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=narfation.org header.s=20121 header.b="KIL/jafS"; spf=pass (diktynna.open-mesh.org: domain of sven@narfation.org designates 213.160.73.56 as permitted sender) smtp.mailfrom=sven@narfation.org; dmarc=pass (policy=none) header.from=narfation.org ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1690970433; a=rsa-sha256; cv=none; b=nnC2wUGFUONEfMiJs8fkApgirIpj6Se2dQpdZGLwV4hwrA5Gvaj30oIu7gqAjzW9PEV/sX 7B8mC7f+HzXMkM0qwv18/Gc11eIbzKiw+/RNFHpD1IZumDdoT1DQAhIHFriIiMN2dbSzcs CeDZZC2Qwxk2H69dEru7kqwa8In1XK8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1690970433; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u6pgN2cyyroZibvCzWWQm7wwqfAMucQmU9KwnVmuwYA=; b=KIL/jafSyx+hwc+UP0I52YXsM5sk/48hgpJ/2j2xApDONkZ9bZHKTdQWB9VVJiYjs+MTrr IFq+Ax981cMYr7VYqlSns0UH1c/cJz3hILkRkA+r7MqcVjGZS3vD0OARpkIlThE68EmWhG yCtHYuxbpxPksslN9kjBovhCr+gIQyY= From: Sven Eckelmann Date: Wed, 02 Aug 2023 12:00:23 +0200 Subject: [PATCH 2/3] batman-adv: Keep batadv_netlink_notify_* static MIME-Version: 1.0 Message-Id: <20230802-cleanup_functions-v1-2-1f9bfb914696@narfation.org> References: <20230802-cleanup_functions-v1-0-1f9bfb914696@narfation.org> In-Reply-To: <20230802-cleanup_functions-v1-0-1f9bfb914696@narfation.org> To: b.a.t.m.a.n@lists.open-mesh.org X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2367; i=sven@narfation.org; h=from:subject:message-id; bh=tv5Fg8nIBJH+1gcRrZnqmBi0jIrSNnsVL8EZ6PkSVmU=; b=owEBbQKS/ZANAwAKAV2HCgfBJntGAcsmYgBkyik3w2lbDBp+294mm6ZpFKFGgIDT3qN1MVaOd o4DIKFj2U+JAjMEAAEKAB0WIQQXXSuHYSVz3OMy4AJdhwoHwSZ7RgUCZMopNwAKCRBdhwoHwSZ7 Rl3jEADU9/AlxEDg0/qRNQlG5NZpIOX3e2gcRYnzmJPsbBDW+v680BjCTTIiI3XPim80i1v4cxQ f7+r1YOH5BAtm+pviC/NGEnfUHr/xs6gF8+/W91wNnY6lYmRhfVlKXqBkkgk9s1cRsdFZlU9Llb J5qLjXl3AaX3Tg5lqgmahEIwD+JWxaZswp5R5IaGCV3pFW98RnAvooexQz0AfipojKLCmxqNpnq ORv7jYZ4jt32GyiL3e/SQnDBJ6z+if4wME1gbRP54bKg2PTLLGbYqIJWwMsVxeQ9mHpWNaT4Xbj 3987KJ8WtEV/t5WTfjg/lvIF0rw3lrFSABepNykWZU3zPZ6qVg2gwdJ0Zu6/XucajRsAsxwikA7 I0Mmhx5aID6zhuLweWlhbWmQQCcSes6yMAtw6HiYcWngzDMjKJMzrzr+p6mvhAB95fx2ZZcrxIr 2VtlAs5xTUz0EVJJmaE4P27mV0B4UCTF2Ib8C0Fm4wfaYGfQSrUldEQfDFq7qfekNJYwlyjjskT m8F1emTmE2mukHM8SYdUFZZLfX2xV4+mJ6CelDhtlVZlUaZO5EsmPtOua0db1FQCzA9irb0Wzcu 1WBlxWOI11ZJPsTIJToLHmXFZg14YkRElysuix0r1NfzVWpvNx8HqMB/wHyVwEJhLlnLh6hhBT5 j/jupSQ/a1DJ9Mw== X-Developer-Key: i=sven@narfation.org; a=openpgp; fpr=522D7163831C73A635D12FE5EC371482956781AF Message-ID-Hash: 7GMXRKAA6C2J3P5CYSZPYG6WDWINXA4E X-Message-ID-Hash: 7GMXRKAA6C2J3P5CYSZPYG6WDWINXA4E X-MailFrom: sven@narfation.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The batadv_netlink_notify_*() functions are not used by any other source file. Just keep them local to netlink.c to get informed by the compiler when they are not used anymore. Signed-off-by: Sven Eckelmann --- net/batman-adv/netlink.c | 10 +++++----- net/batman-adv/netlink.h | 6 ------ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c index 07f21cdb..09b76b0f 100644 --- a/net/batman-adv/netlink.c +++ b/net/batman-adv/netlink.c @@ -377,7 +377,7 @@ static int batadv_netlink_mesh_fill(struct sk_buff *msg, * * Return: 0 on success, < 0 on error */ -int batadv_netlink_notify_mesh(struct batadv_priv *bat_priv) +static int batadv_netlink_notify_mesh(struct batadv_priv *bat_priv) { struct sk_buff *msg; int ret; @@ -858,8 +858,8 @@ static int batadv_netlink_hardif_fill(struct sk_buff *msg, * * Return: 0 on success, < 0 on error */ -int batadv_netlink_notify_hardif(struct batadv_priv *bat_priv, - struct batadv_hard_iface *hard_iface) +static int batadv_netlink_notify_hardif(struct batadv_priv *bat_priv, + struct batadv_hard_iface *hard_iface) { struct sk_buff *msg; int ret; @@ -1073,8 +1073,8 @@ static int batadv_netlink_vlan_fill(struct sk_buff *msg, * * Return: 0 on success, < 0 on error */ -int batadv_netlink_notify_vlan(struct batadv_priv *bat_priv, - struct batadv_softif_vlan *vlan) +static int batadv_netlink_notify_vlan(struct batadv_priv *bat_priv, + struct batadv_softif_vlan *vlan) { struct sk_buff *msg; int ret; diff --git a/net/batman-adv/netlink.h b/net/batman-adv/netlink.h index 48102cc7..876d2806 100644 --- a/net/batman-adv/netlink.h +++ b/net/batman-adv/netlink.h @@ -21,12 +21,6 @@ int batadv_netlink_tpmeter_notify(struct batadv_priv *bat_priv, const u8 *dst, u8 result, u32 test_time, u64 total_bytes, u32 cookie); -int batadv_netlink_notify_mesh(struct batadv_priv *bat_priv); -int batadv_netlink_notify_hardif(struct batadv_priv *bat_priv, - struct batadv_hard_iface *hard_iface); -int batadv_netlink_notify_vlan(struct batadv_priv *bat_priv, - struct batadv_softif_vlan *vlan); - extern struct genl_family batadv_netlink_family; #endif /* _NET_BATMAN_ADV_NETLINK_H_ */ From patchwork Wed Aug 2 10:00:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 18579 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id 58D0183001 for ; Wed, 2 Aug 2023 12:02:49 +0200 (CEST) ARC-Seal: i=2; cv=pass; a=rsa-sha256; d=open-mesh.org; s=20121; t=1690970569; b=U5kgs4OW8gdUxVUO8MlAz9EYj0a6aesqnBsSyQZtKKH37U3EzezYRxeYTzpg24hGkESJc 0KDzhRb9lzw41mPzWJIjpJjtshrCPqic8i0tyQpoEAemGDY5PKJLpddSpCSljN6HUlt/dB9 R2ZtMz/riKH7BYQFcXKrQ11tI1Gvgug= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1690970569; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=2XSfUxLOFgQdChL2Fte7AAhyefhPKoz/VGDLjGIu/40=; b=KQ4rK7gdqR9NhYPF2x0xg2JLAcEyAERCWcyoATzIQj3zx+Y80VH090ZLYX+N1Js5NDci4 j56+C26Lo6aveUgl86ScKFpvzvfplW2oIZbNjoOWEVMxdShNbn3KGC8b8yt8pGM5FgdoIOa D1yL1xDcNdRfRtHptiah3kdW3y9tbFE= ARC-Authentication-Results: i=2; open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Authentication-Results: open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Received: from dvalin.narfation.org (dvalin.narfation.org [213.160.73.56]) by diktynna.open-mesh.org (Postfix) with ESMTPS id 7050582EE4 for ; Wed, 2 Aug 2023 12:00:36 +0200 (CEST) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1690970436; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=2XSfUxLOFgQdChL2Fte7AAhyefhPKoz/VGDLjGIu/40=; b=24WdVGzay1AtfRGdm17uA90uMQrm/wtNK6ktCYWxXG1HMHrf4seSOi1maxDy7mPUpcyuSf PCvFVBgKniy8iF3DRJ98wcV1DvlMtKnfOmjzHZI+Pah6yieI2n7dxypfQ7rOvzFf+iqbIh 0DacBn4PebXmFCLUzYf3gT7A8sgJG9I= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=narfation.org header.s=20121 header.b=rYeChhcj; spf=pass (diktynna.open-mesh.org: domain of sven@narfation.org designates 213.160.73.56 as permitted sender) smtp.mailfrom=sven@narfation.org; dmarc=pass (policy=none) header.from=narfation.org ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1690970436; a=rsa-sha256; cv=none; b=uU+Bqi3qzJh5gfeYyBi54oqLTRBmzD5vHHCUQQk/FeJug8CjwO46eyhlvY2ME+ZU7CJBnK jKrVQB3LlycKpaiTWkryhbW+Z2/+W2b6cDKx7dj/wwLaScKnPsv7d9EH650kUtaavExSZ1 +r8mQP7+n35IdXoZCUeY3QE+B4hz720= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1690970436; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2XSfUxLOFgQdChL2Fte7AAhyefhPKoz/VGDLjGIu/40=; b=rYeChhcjTh03aowSDsMSjFLegmKSldtt0yTb4OLba+apxB28crg5B0GMgsWDrWyU7UB/YS tHJ6QctcYvTEynKIjk4GrWuS9k0UiC2f4iVuOXhLpvmwfwwb8WY3tO8wmjl0X0uMSBlVaC 3iXq2Rlr7Zxouq0FLEFzL0Ko0QTXh58= From: Sven Eckelmann Date: Wed, 02 Aug 2023 12:00:24 +0200 Subject: [PATCH 3/3] batman-adv: Drop per algo GW section class code MIME-Version: 1.0 Message-Id: <20230802-cleanup_functions-v1-3-1f9bfb914696@narfation.org> References: <20230802-cleanup_functions-v1-0-1f9bfb914696@narfation.org> In-Reply-To: <20230802-cleanup_functions-v1-0-1f9bfb914696@narfation.org> To: b.a.t.m.a.n@lists.open-mesh.org X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=7631; i=sven@narfation.org; h=from:subject:message-id; bh=0XSIqEuEreAbkL1wMiVmJyRkmrHmcP1dUAT79fYG0tw=; b=owEBbQKS/ZANAwAKAV2HCgfBJntGAcsmYgBkyik4ilAg3yQEKJwNQfItBnreE4t2oQcOctiK+ MgMAS0l/4yJAjMEAAEKAB0WIQQXXSuHYSVz3OMy4AJdhwoHwSZ7RgUCZMopOAAKCRBdhwoHwSZ7 Rtf4EAC12Qu4uLaxl4nVdNhRNsAzQOCaluQikXgtcuRl6NtP/8JHrmhswYT6tW/3cKkyWFS03rb 8AW83tSNDw3UuPtCu81u70O+ldU6RzllSpT9u2auTMoxEraAUpY3kw0LHt2az4+dxPxCwKq3osW YF2XIQsTPB3S5/t0QpHBH3vvXKF0lnqTiNucxjwMFt7ayEH5476UuU16QkiqA/cOeOeliaurCtf ppLxRxX7OYQn9ZMNev7xtptWpIUc/D85X4G8Gy8eaf78f8xIL/KKF96bZP814EM2SBiaeIIpnUs 7lpK0/zznr/1ZZZ/Lxx+DgF6/+at1XqEQq5UvDMRTS+1jlcIuDkeBNCd9uleXTMx0WhPb1yhcxX mYk5zyvcaRFBmPDdcWGfPy4JGis4x7Qtar7VICMmteoanIWf88zS5/xBSZ5U90xWaDjyN7hdRXu cnV3Xt7JExGvIoPaTDZsfLGIl5af9QnPL6z3LQ5aTaW6oJHCSXDtOiuipDGDgg/zZ5WkICeW2LG Pzyw9uELPjf2DHB1vkVV24Cktcr1/i+XF1R29M0vPzOqYEwgRC6gtCVpUgGtRz2tV7x9PEopgET PReRENxr0Dif0Oi0T9W3tn80+uNXxf9TD0gAYA/eZfEt+oYsuD99kvjUH0jIWifFufAB9D3RMwT US7oZSeVsJP7weA== X-Developer-Key: i=sven@narfation.org; a=openpgp; fpr=522D7163831C73A635D12FE5EC371482956781AF Message-ID-Hash: QOIRESJOXRAXPY33X772JFBYTCQF4VER X-Message-ID-Hash: QOIRESJOXRAXPY33X772JFBYTCQF4VER X-MailFrom: sven@narfation.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This code was only used in the past for the sysfs interface. But since this was replace with netlink, it was never executed. The function pointer was only checked to figure out whether the limit 255 (B.A.T.M.A.N. IV) or 2**32-1 (B.A.T.M.A.N. V) should be used as limit. So instead of keeping the function pointer, just store the limits directly in struct batadv_algo_gw_ops. Signed-off-by: Sven Eckelmann --- net/batman-adv/bat_iv_ogm.c | 1 + net/batman-adv/bat_v.c | 23 ++----------- net/batman-adv/gateway_common.c | 74 +---------------------------------------- net/batman-adv/gateway_common.h | 5 --- net/batman-adv/netlink.c | 5 +-- net/batman-adv/types.h | 7 ++-- 6 files changed, 8 insertions(+), 107 deletions(-) diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 828fb393..74b49c35 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -2516,6 +2516,7 @@ static struct batadv_algo_ops batadv_batman_iv __read_mostly = { }, .gw = { .init_sel_class = batadv_iv_init_sel_class, + .sel_class_max = BATADV_TQ_MAX_VALUE, .get_best_gw_node = batadv_iv_gw_get_best_gw_node, .is_eligible = batadv_iv_gw_is_eligible, .dump = batadv_iv_gw_dump, diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c index 54e41fc7..ac11f1f0 100644 --- a/net/batman-adv/bat_v.c +++ b/net/batman-adv/bat_v.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -34,7 +35,6 @@ #include "bat_v_elp.h" #include "bat_v_ogm.h" #include "gateway_client.h" -#include "gateway_common.h" #include "hard-interface.h" #include "hash.h" #include "log.h" @@ -512,25 +512,6 @@ static void batadv_v_init_sel_class(struct batadv_priv *bat_priv) atomic_set(&bat_priv->gw.sel_class, 50); } -static ssize_t batadv_v_store_sel_class(struct batadv_priv *bat_priv, - char *buff, size_t count) -{ - u32 old_class, class; - - if (!batadv_parse_throughput(bat_priv->soft_iface, buff, - "B.A.T.M.A.N. V GW selection class", - &class)) - return -EINVAL; - - old_class = atomic_read(&bat_priv->gw.sel_class); - atomic_set(&bat_priv->gw.sel_class, class); - - if (old_class != class) - batadv_gw_reselect(bat_priv); - - return count; -} - /** * batadv_v_gw_throughput_get() - retrieve the GW-bandwidth for a given GW * @gw_node: the GW to retrieve the metric for @@ -818,7 +799,7 @@ static struct batadv_algo_ops batadv_batman_v __read_mostly = { }, .gw = { .init_sel_class = batadv_v_init_sel_class, - .store_sel_class = batadv_v_store_sel_class, + .sel_class_max = U32_MAX, .get_best_gw_node = batadv_v_gw_get_best_gw_node, .is_eligible = batadv_v_gw_is_eligible, .dump = batadv_v_gw_dump, diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c index d9632607..2dd36ef0 100644 --- a/net/batman-adv/gateway_common.c +++ b/net/batman-adv/gateway_common.c @@ -9,86 +9,14 @@ #include #include -#include -#include -#include -#include #include -#include +#include #include #include #include "gateway_client.h" -#include "log.h" #include "tvlv.h" -/** - * batadv_parse_throughput() - parse supplied string buffer to extract - * throughput information - * @net_dev: the soft interface net device - * @buff: string buffer to parse - * @description: text shown when throughput string cannot be parsed - * @throughput: pointer holding the returned throughput information - * - * Return: false on parse error and true otherwise. - */ -bool batadv_parse_throughput(struct net_device *net_dev, char *buff, - const char *description, u32 *throughput) -{ - enum batadv_bandwidth_units bw_unit_type = BATADV_BW_UNIT_KBIT; - u64 lthroughput; - char *tmp_ptr; - int ret; - - if (strlen(buff) > 4) { - tmp_ptr = buff + strlen(buff) - 4; - - if (strncasecmp(tmp_ptr, "mbit", 4) == 0) - bw_unit_type = BATADV_BW_UNIT_MBIT; - - if (strncasecmp(tmp_ptr, "kbit", 4) == 0 || - bw_unit_type == BATADV_BW_UNIT_MBIT) - *tmp_ptr = '\0'; - } - - ret = kstrtou64(buff, 10, <hroughput); - if (ret) { - batadv_err(net_dev, - "Invalid throughput speed for %s: %s\n", - description, buff); - return false; - } - - switch (bw_unit_type) { - case BATADV_BW_UNIT_MBIT: - /* prevent overflow */ - if (U64_MAX / 10 < lthroughput) { - batadv_err(net_dev, - "Throughput speed for %s too large: %s\n", - description, buff); - return false; - } - - lthroughput *= 10; - break; - case BATADV_BW_UNIT_KBIT: - default: - lthroughput = div_u64(lthroughput, 100); - break; - } - - if (lthroughput > U32_MAX) { - batadv_err(net_dev, - "Throughput speed for %s too large: %s\n", - description, buff); - return false; - } - - *throughput = lthroughput; - - return true; -} - /** * batadv_gw_tvlv_container_update() - update the gw tvlv container after * gateway setting change diff --git a/net/batman-adv/gateway_common.h b/net/batman-adv/gateway_common.h index cb2e72d7..5d097d6a 100644 --- a/net/batman-adv/gateway_common.h +++ b/net/batman-adv/gateway_common.h @@ -9,9 +9,6 @@ #include "main.h" -#include -#include - /** * enum batadv_bandwidth_units - bandwidth unit types */ @@ -30,7 +27,5 @@ enum batadv_bandwidth_units { void batadv_gw_tvlv_container_update(struct batadv_priv *bat_priv); void batadv_gw_init(struct batadv_priv *bat_priv); void batadv_gw_free(struct batadv_priv *bat_priv); -bool batadv_parse_throughput(struct net_device *net_dev, char *buff, - const char *description, u32 *throughput); #endif /* _NET_BATMAN_ADV_GATEWAY_COMMON_H_ */ diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c index 09b76b0f..4ddcc21b 100644 --- a/net/batman-adv/netlink.c +++ b/net/batman-adv/netlink.c @@ -548,15 +548,12 @@ static int batadv_netlink_set_mesh(struct sk_buff *skb, struct genl_info *info) * algorithm in use implements the GW API */ - u32 sel_class_max = 0xffffffffu; + u32 sel_class_max = bat_priv->algo_ops->gw.sel_class_max; u32 sel_class; attr = info->attrs[BATADV_ATTR_GW_SEL_CLASS]; sel_class = nla_get_u32(attr); - if (!bat_priv->algo_ops->gw.store_sel_class) - sel_class_max = BATADV_TQ_MAX_VALUE; - if (sel_class >= 1 && sel_class <= sel_class_max) { atomic_set(&bat_priv->gw.sel_class, sel_class); batadv_gw_reselect(bat_priv); diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index cf1a0eaf..17d5ea1d 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h @@ -2197,11 +2197,10 @@ struct batadv_algo_gw_ops { void (*init_sel_class)(struct batadv_priv *bat_priv); /** - * @store_sel_class: parse and stores a new GW selection class - * (optional) + * @sel_class_max: maximum allowed GW selection class */ - ssize_t (*store_sel_class)(struct batadv_priv *bat_priv, char *buff, - size_t count); + u32 sel_class_max; + /** * @get_best_gw_node: select the best GW from the list of available * nodes (optional)