pull request for net-next: batman-adv 2023-08-16
Subsystems (3)
Simon Wunderlich
maintainercover pull request for net-next: batman-adv 2023-08-16
Hi Jakub, hi David,
here is a cleanup pull request of batman-adv to go into net-next.
Please pull or let me know of any problem!
Thank you,
Simon
The following changes since commit 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5:
Linux 6.5-rc1 (2023-07-09 13:53:13 -0700)
are available in the Git repository at:
git://git.open-mesh.org/linux-merge.git tags/batadv-next-pullrequest-20230816
for you to fetch changes up to 6f96d46f9a1ad1c02589b598c56ea881094129d8:
batman-adv: Drop per algo GW section class code (2023-08-14 18:01:21 +0200)
----------------------------------------------------------------
This cleanup patchset includes the following patches:
- bump version strings, by Simon Wunderlich
- Remove unused declarations, by Yue Haibing
- Clean up MTU handling, by Sven Eckelmann (2 patches)
- Clean up/remove (obsolete) functions, by Sven Eckelmann (3 patches)
----------------------------------------------------------------
Simon Wunderlich (1):
batman-adv: Start new development cycle
Sven Eckelmann (5):
batman-adv: Avoid magic value for minimum MTU
batman-adv: Check hardif MTU against runtime MTU
batman-adv: Drop unused function batadv_gw_bandwidth_set
batman-adv: Keep batadv_netlink_notify_* static
batman-adv: Drop per algo GW section class code
YueHaibing (1):
batman-adv: Remove unused declarations
net/batman-adv/bat_iv_ogm.c | 1 + net/batman-adv/bat_v.c | 23 +----- net/batman-adv/gateway_common.c | 162 +--------------------------------------- net/batman-adv/gateway_common.h | 7 -- net/batman-adv/hard-interface.c | 20 +++-- net/batman-adv/main.h | 2 +- net/batman-adv/netlink.c | 15 ++-- net/batman-adv/netlink.h | 6 -- net/batman-adv/routing.h | 4 - net/batman-adv/soft-interface.c | 2 +- net/batman-adv/types.h | 7 +- 11 files changed, 28 insertions(+), 221 deletions(-)
Simon Wunderlich
maintainerPATCH 1/7 batman-adv: Start new development cycle
This version will contain all the (major or even only minor) changes for Linux 6.6.
The version number isn't a semantic version number with major and minor information. It is just encoding the year of the expected publishing as Linux -rc1 and the number of published versions this year (starting at 0).
--- net/batman-adv/main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/main.h +1 -1
@@ -13,7 +13,7 @@#define BATADV_DRIVER_DEVICE "batman-adv"#ifndef BATADV_SOURCE_VERSION -#define BATADV_SOURCE_VERSION "2023.1" +#define BATADV_SOURCE_VERSION "2023.3"#endif /* B.A.T.M.A.N. parameters */
Signature · 1 line
2.39.2
Re: [PATCH 1/7] batman-adv: Start new development cycle
This series was applied to netdev/net-next.git (main) by Simon Wunderlich <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Simon Wunderlich <[email protected]>:
Quoted 8 lines · On Wed, 16 Aug 2023 18:39:54 +0200 you wrote:
This version will contain all the (major or even only minor) changes for Linux 6.6.
The version number isn't a semantic version number with major and minor information. It is just encoding the year of the expected publishing as Linux -rc1 and the number of published versions this year (starting at 0).
[...]
Here is the summary with links:
- [1/7] batman-adv: Start new development cycle
https://git.kernel.org/netdev/net-next/c/2744cefe0337 - [2/7] batman-adv: Remove unused declarations https://git.kernel.org/netdev/net-next/c/bbfb428a0cf6 - [3/7] batman-adv: Avoid magic value for minimum MTU https://git.kernel.org/netdev/net-next/c/e4b817804579 - [4/7] batman-adv: Check hardif MTU against runtime MTU https://git.kernel.org/netdev/net-next/c/112cbcb4af90 - [5/7] batman-adv: Drop unused function batadv_gw_bandwidth_set https://git.kernel.org/netdev/net-next/c/950c92bbaa8f - [6/7] batman-adv: Keep batadv_netlink_notify_* static https://git.kernel.org/netdev/net-next/c/02e61f06a97e - [7/7] batman-adv: Drop per algo GW section class code https://git.kernel.org/netdev/net-next/c/6f96d46f9a1a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Simon Wunderlich
maintainerPATCH 2/7 batman-adv: Remove unused declarations
In reply to Simon WunderlichFrom: YueHaibing <[email protected]>
Since commit 335fbe0f5d25 ("batman-adv: tvlv - convert tt query packet to use tvlv unicast packets") batadv_recv_tt_query() is not used.
And commit 122edaa05940 ("batman-adv: tvlv - convert roaming adv packet to use tvlv unicast packets") left behind batadv_recv_roam_adv().
--- net/batman-adv/routing.h | 4 ---- 1 file changed, 4 deletions(-)
net/batman-adv/routing.h +0 -4
@@ -27,10 +27,6 @@ int batadv_recv_frag_packet(struct sk_buff *skb, struct batadv_hard_iface *iface);int batadv_recv_bcast_packet (struct sk_buff *skb,struct batadv_hard_iface *recv_if); -int batadv_recv_tt_query (struct sk_buff *skb, -struct batadv_hard_iface *recv_if); -int batadv_recv_roam_adv (struct sk_buff *skb, -struct batadv_hard_iface *recv_if);int batadv_recv_unicast_tvlv (struct sk_buff *skb,struct batadv_hard_iface *recv_if); int batadv_recv_unhandled_unicast_packet(struct sk_buff *skb,
Signature · 1 line
2.39.2
Simon Wunderlich
maintainerPATCH 3/7 batman-adv: Avoid magic value for minimum MTU
In reply to Simon WunderlichFrom: Sven Eckelmann <[email protected]>
The header linux/if_ether.h already defines a constant for the minimum MTU. So simply use it instead of having a magic constant in the code.
--- net/batman-adv/soft-interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/soft-interface.c +1 -1
@@ -154,7 +154,7 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p)static int batadv_interface_change_mtu (struct net_device *dev,int new_mtu) {/* check ranges */ -if (new_mtu <68 || new_mtu >batadv_hardif_min_mtu (dev)) +if (new_mtu <ETH_MIN_MTU || new_mtu >batadv_hardif_min_mtu (dev))return -EINVAL ; dev->mtu = new_mtu;
Signature · 1 line
2.39.2
Simon Wunderlich
maintainerPATCH 4/7 batman-adv: Check hardif MTU against runtime MTU
In reply to Simon WunderlichFrom: Sven Eckelmann <[email protected]>
If the MTU of the soft/mesh interface was already reduced (enough), it is not necessary to print a warning about a hard interface not having a MTU to transport ethernet payloads of 1500 bytes.
--- net/batman-adv/hard-interface.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
net/batman-adv/hard-interface.c +13 -7
@@ -9,6 +9,7 @@#include <linux/atomic.h> #include <linux/byteorder/generic.h> +#include <linux/compiler.h> #include <linux/container_of.h> #include <linux/errno.h> #include <linux/gfp.h>
@@ -699,9 +700,14 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,struct batadv_priv *bat_priv;__be16 ethertype =htons (ETH_P_BATMAN );int max_header_len =batadv_max_header_len (); +unsigned int required_mtu; +unsigned int hardif_mtu;int ret; -if (hard_iface->net_dev->mtu <ETH_MIN_MTU + max_header_len) + hardif_mtu =READ_ONCE (hard_iface->net_dev->mtu); + required_mtu =READ_ONCE (soft_iface->mtu) + max_header_len; + +if (hardif_mtu <ETH_MIN_MTU + max_header_len)return -EINVAL ;if (hard_iface->if_status !=BATADV_IF_NOT_IN_USE )
@@ -734,18 +740,18 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, hard_iface->net_dev->name);if (atomic_read (&bat_priv->fragmentation) && - hard_iface->net_dev->mtu <ETH_DATA_LEN + max_header_len) + hardif_mtu < required_mtu)batadv_info (hard_iface->soft_iface,"The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to %i would solve the problem.\n" , - hard_iface->net_dev->name, hard_iface->net_dev->mtu, -ETH_DATA_LEN + max_header_len); + hard_iface->net_dev->name, hardif_mtu, + required_mtu);if (!atomic_read (&bat_priv->fragmentation) && - hard_iface->net_dev->mtu <ETH_DATA_LEN + max_header_len) + hardif_mtu < required_mtu)batadv_info (hard_iface->soft_iface,"The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. If you experience problems getting traffic through try increasing the MTU to %i.\n" , - hard_iface->net_dev->name, hard_iface->net_dev->mtu, -ETH_DATA_LEN + max_header_len); + hard_iface->net_dev->name, hardif_mtu, + required_mtu);if (batadv_hardif_is_iface_up (hard_iface))batadv_hardif_activate_interface (hard_iface);
Signature · 1 line
2.39.2
Simon Wunderlich
maintainerPATCH 5/7 batman-adv: Drop unused function batadv_gw_bandwidth_set
In reply to Simon WunderlichFrom: Sven Eckelmann <[email protected]>
This function is no longer used since the sysfs support was removed from batman-adv.
--- net/batman-adv/gateway_common.c | 88 --------------------------------- net/batman-adv/gateway_common.h | 2 - 2 files changed, 90 deletions(-)
net/batman-adv/gateway_common.c +0 -88
@@ -9,7 +9,6 @@#include <linux/atomic.h> #include <linux/byteorder/generic.h> -#include <linux/errno.h> #include <linux/kstrtox.h> #include <linux/limits.h> #include <linux/math64.h>
@@ -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
net/batman-adv/gateway_common.h +0 -2
@@ -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);
Signature · 1 line
2.39.2
Simon Wunderlich
maintainerPATCH 6/7 batman-adv: Keep batadv_netlink_notify_* static
In reply to Simon WunderlichFrom: Sven Eckelmann <[email protected]>
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.
--- net/batman-adv/netlink.c | 10 +++++----- net/batman-adv/netlink.h | 6 ------ 2 files changed, 5 insertions(+), 11 deletions(-)
net/batman-adv/netlink.c +5 -5
@@ -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;
net/batman-adv/netlink.h +0 -6
@@ -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_ */
Signature · 1 line
2.39.2
Simon Wunderlich
maintainerPATCH 7/7 batman-adv: Drop per algo GW section class code
In reply to Simon WunderlichFrom: Sven Eckelmann <[email protected]>
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.
--- 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(-)
net/batman-adv/bat_iv_ogm.c +1 -0
@@ -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,
net/batman-adv/bat_v.c +2 -21
@@ -14,6 +14,7 @@#include <linux/init.h> #include <linux/jiffies.h> #include <linux/kref.h> +#include <linux/limits.h> #include <linux/list.h> #include <linux/minmax.h> #include <linux/netdevice.h>
@@ -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,
net/batman-adv/gateway_common.c +1 -73
87 lines not on this page · raw message
net/batman-adv/gateway_common.h +0 -5
@@ -9,9 +9,6 @@#include "main.h" -#include <linux/netdevice.h> -#include <linux/types.h> -/** * 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_ */
net/batman-adv/netlink.c +1 -4
@@ -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);
net/batman-adv/types.h +3 -4
@@ -2191,11 +2191,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)
Signature · 1 line
2.39.2