From patchwork Wed Jun 2 20:32:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 18336 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 A009F83EDD; Wed, 2 Jun 2021 22:42:31 +0200 (CEST) Received: from dvalin.narfation.org (dvalin.narfation.org [213.160.73.56]) by diktynna.open-mesh.org (Postfix) with ESMTPS id E35F980591 for ; Wed, 2 Jun 2021 22:42:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1622666077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=xfEVWRGRVFJiXDrH31x9TuTTNuxdpLAyaJpTB5qGhIM=; b=afSPY4M4xxlWdp6ER1s71Y59fGcC9SbNALtAf9QA9OydpGCwXKuefKZTy3k2oEE4FbVZyK Q5iu8x6Gmbo6oupagRa3dkj8ty780fharyNYJczVUr7erlz6kfiLS+zv/EMhOEGHDm6AZ0 khMYbySi+lqVcoYc5AfDI6KpBK3w/do= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Cc: Sven Eckelmann Subject: [PATCH 1/4] batman-adv: Drop implicit creation of batadv net_devices Date: Wed, 2 Jun 2021 22:32:32 +0200 Message-Id: <20210602203235.10659-1-sven@narfation.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1622666547; a=rsa-sha256; cv=none; b=V8bFsGgtFytceqMfw7TJ4qdLfEoqDDK7pgdiE7Iu+1h/eBBT5Pj93bJ4X3uBnDmgRf5FyS 5tsVhX/bgHc3vLGOp7njxH5sl5PUkTL3kAggRkxFVOhxtAoKqU8iUPmBrkMBmPggjdlQsG 0bs5HPnoVD4jIODzg1aDAU+iIyIMao0= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=narfation.org header.s=20121 header.b=afSPY4M4; spf=pass (diktynna.open-mesh.org: domain of sven@narfation.org designates 213.160.73.56 as permitted sender) smtp.mailfrom=sven@narfation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1622666547; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=xfEVWRGRVFJiXDrH31x9TuTTNuxdpLAyaJpTB5qGhIM=; b=lh3S1LPfOpKwQJNtVgmeww4voGLSDwcQBNc5mMRUHkyFHeIVXZ2ZzUF+BUwtTy1sYpFqsX QOeX/FFCFrZDC82RxCUPt04fFYvyRbjBOf9OJLXVKzfX/CYLku5UcH1hs1HW7xt4zK+jdv lD/LwY6eaZkhKE5X2SqxWl36EPw3esU= Message-ID-Hash: KFD2AUMYI3NQ2MULUVWBUW6WWHJQF5WZ X-Message-ID-Hash: KFD2AUMYI3NQ2MULUVWBUW6WWHJQF5WZ 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; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: The sysfs code in batman-adv was could create a new batadv interfaces on demand when a string (interface name) was written to the batman-adv/mesh_iface file. But the code no longer exists in the current batman-adv codebase. The helper code to implement this behavior must be considered as unused and can be dropped. Signed-off-by: Sven Eckelmann --- net/batman-adv/hard-interface.c | 12 ++---------- net/batman-adv/soft-interface.c | 34 +-------------------------------- net/batman-adv/soft-interface.h | 2 -- 3 files changed, 3 insertions(+), 45 deletions(-) diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 4a6a25d5..9a78789b 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -725,17 +725,9 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, kref_get(&hard_iface->refcount); soft_iface = dev_get_by_name(net, iface_name); - if (!soft_iface) { - soft_iface = batadv_softif_create(net, iface_name); - - if (!soft_iface) { - ret = -ENOMEM; - goto err; - } - - /* dev_get_by_name() increases the reference counter for us */ - dev_hold(soft_iface); + ret = -EINVAL; + goto err; } if (!batadv_softif_is_valid(soft_iface)) { diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index a21884c0..0c5b3425 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -37,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -1086,38 +1086,6 @@ static int batadv_softif_newlink(struct net *src_net, struct net_device *dev, return register_netdevice(dev); } -/** - * batadv_softif_create() - Create and register soft interface - * @net: the applicable net namespace - * @name: name of the new soft interface - * - * Return: newly allocated soft_interface, NULL on errors - */ -struct net_device *batadv_softif_create(struct net *net, const char *name) -{ - struct net_device *soft_iface; - int ret; - - soft_iface = alloc_netdev(sizeof(struct batadv_priv), name, - NET_NAME_UNKNOWN, batadv_softif_init_early); - if (!soft_iface) - return NULL; - - dev_net_set(soft_iface, net); - - soft_iface->rtnl_link_ops = &batadv_link_ops; - - ret = register_netdevice(soft_iface); - if (ret < 0) { - pr_err("Unable to register the batman interface '%s': %i\n", - name, ret); - free_netdev(soft_iface); - return NULL; - } - - return soft_iface; -} - /** * batadv_softif_destroy_netlink() - deletion of batadv_soft_interface via * netlink diff --git a/net/batman-adv/soft-interface.h b/net/batman-adv/soft-interface.h index 38b0ad18..67a2ddd6 100644 --- a/net/batman-adv/soft-interface.h +++ b/net/batman-adv/soft-interface.h @@ -12,14 +12,12 @@ #include #include #include -#include #include int batadv_skb_head_push(struct sk_buff *skb, unsigned int len); void batadv_interface_rx(struct net_device *soft_iface, struct sk_buff *skb, int hdr_size, struct batadv_orig_node *orig_node); -struct net_device *batadv_softif_create(struct net *net, const char *name); bool batadv_softif_is_valid(const struct net_device *net_dev); extern struct rtnl_link_ops batadv_link_ops; int batadv_softif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid); From patchwork Wed Jun 2 20:32:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 18334 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 49C9E80591; Wed, 2 Jun 2021 22:42:30 +0200 (CEST) Received: from dvalin.narfation.org (dvalin.narfation.org [IPv6:2a00:17d8:100::8b1]) by diktynna.open-mesh.org (Postfix) with ESMTPS id 086C382660 for ; Wed, 2 Jun 2021 22:42:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1622666080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xKzgCnnXvCQWf3uyQ7A4FXa7GeBcpRs+1wmanBAvhg4=; b=FiYlh16i0frAhv0HUomdGouJRnHjOYqkJhjD7KBiwh7AI5KmINh3myXwaEynfnjxpWwNUS 7o3BgJ56KGDm7JPxh1ZgG8aUDTghEp74No1rp4g8JaKq9akqw2AhAKyqWzBc7qbFe7nD/5 EJ8wjHL24S7Uoi6YbgPta+HBh6e5Stw= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Cc: Sven Eckelmann Subject: [PATCH 2/4] batman-adv: Avoid name based attaching of hard interfaces Date: Wed, 2 Jun 2021 22:32:33 +0200 Message-Id: <20210602203235.10659-2-sven@narfation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210602203235.10659-1-sven@narfation.org> References: <20210602203235.10659-1-sven@narfation.org> MIME-Version: 1.0 ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1622666548; a=rsa-sha256; cv=none; b=UH0TZ8XTDaLKiQoPoWLoQv0MVkVg3G2quBx60Ih/GW8U1FlduEUET+ad+Y/Gpi8xMct7vw gRMzmHF61fC6QUH4zjHTAAD8H39RChblqlDLElkRHlK4oHW+AvsyxX2Kon9zL88iO6Ru2k ny4TUheUJyjGF2Fw0+MmHDT7KgO2ADc= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=narfation.org header.s=20121 header.b=FiYlh16i; spf=pass (diktynna.open-mesh.org: domain of sven@narfation.org designates 2a00:17d8:100::8b1 as permitted sender) smtp.mailfrom=sven@narfation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1622666548; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=xKzgCnnXvCQWf3uyQ7A4FXa7GeBcpRs+1wmanBAvhg4=; b=sklThxp+RkhFlvNa2kziK9pycoEVjuLXomxAgRnpUu9PvbdehJk73Da+g++Syo0JnlVjvC Asx7nhImb8uEaqUFGjoFF1fqr2HTyCV6M3SQ8iWZAGk8lZ8ICn3HREuPOZyhd7MR31XU6f oXYRcjEk6xssPY8boQZxFf7RPRmL1fM= Message-ID-Hash: DR2DHETFFPSKDKOJH2XEC4DSF34KZ3IS X-Message-ID-Hash: DR2DHETFFPSKDKOJH2XEC4DSF34KZ3IS 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; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: The sysfs code for the batman-adv/mesh_iface file was receiving a string of the batadv interface. This interface name was then provided to the code which shared sysfs+rtnetlink code for attaching an hard-interface to an batadv interface. The rtnetlink code was also using the (extracted) interface name from the ndo_add_slave callback to increase the shared code - even when it would have been more efficient to use the provided net_device object directly instead of searching it again (based on its name) in batadv_hardif_enable_interface. But this indirect handling is no longer necessary because the sysfs code was dropped. There is now only a single code path which is using batadv_hardif_enable_interface. Signed-off-by: Sven Eckelmann --- net/batman-adv/hard-interface.c | 14 ++++---------- net/batman-adv/hard-interface.h | 3 +-- net/batman-adv/soft-interface.c | 3 +-- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 9a78789b..44b65fa4 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -705,16 +705,15 @@ static int batadv_master_del_slave(struct batadv_hard_iface *slave, /** * batadv_hardif_enable_interface() - Enslave hard interface to soft interface * @hard_iface: hard interface to add to soft interface - * @net: the applicable net namespace - * @iface_name: name of the soft interface + * @soft_iface: netdev struct of the mesh interface * * Return: 0 on success or negative error number in case of failure */ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, - struct net *net, const char *iface_name) + struct net_device *soft_iface) { struct batadv_priv *bat_priv; - struct net_device *soft_iface, *master; + struct net_device *master; __be16 ethertype = htons(ETH_P_BATMAN); int max_header_len = batadv_max_header_len(); int ret; @@ -724,11 +723,7 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, kref_get(&hard_iface->refcount); - soft_iface = dev_get_by_name(net, iface_name); - if (!soft_iface) { - ret = -EINVAL; - goto err; - } + dev_hold(soft_iface); if (!batadv_softif_is_valid(soft_iface)) { pr_err("Can't create batman mesh interface %s: already exists as regular interface\n", @@ -802,7 +797,6 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, err_dev: hard_iface->soft_iface = NULL; dev_put(soft_iface); -err: batadv_hardif_put(hard_iface); return ret; } diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h index 83d11b46..8cb2a1f1 100644 --- a/net/batman-adv/hard-interface.h +++ b/net/batman-adv/hard-interface.h @@ -16,7 +16,6 @@ #include #include #include -#include /** * enum batadv_hard_if_state - State of a hard interface @@ -75,7 +74,7 @@ bool batadv_is_wifi_hardif(struct batadv_hard_iface *hard_iface); struct batadv_hard_iface* batadv_hardif_get_by_netdev(const struct net_device *net_dev); int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, - struct net *net, const char *iface_name); + struct net_device *soft_iface); void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface); int batadv_hardif_min_mtu(struct net_device *soft_iface); void batadv_update_min_mtu(struct net_device *soft_iface); diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 0c5b3425..ae368a42 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@ -842,14 +842,13 @@ static int batadv_softif_slave_add(struct net_device *dev, struct netlink_ext_ack *extack) { struct batadv_hard_iface *hard_iface; - struct net *net = dev_net(dev); int ret = -EINVAL; hard_iface = batadv_hardif_get_by_netdev(slave_dev); if (!hard_iface || hard_iface->soft_iface) goto out; - ret = batadv_hardif_enable_interface(hard_iface, net, dev->name); + ret = batadv_hardif_enable_interface(hard_iface, dev); out: if (hard_iface) From patchwork Wed Jun 2 20:32:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 18337 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 36F2483EDA; Wed, 2 Jun 2021 22:42:37 +0200 (CEST) Received: from dvalin.narfation.org (dvalin.narfation.org [213.160.73.56]) by diktynna.open-mesh.org (Postfix) with ESMTPS id EF46C808DE for ; Wed, 2 Jun 2021 22:42:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1622666082; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=omSKb49EnYmEd3PGvhFwm0wFmRJlN2PtY5BdAap3PLY=; b=q8jfl7iOmiewQeiS6qHIO/klE4ebXkg+IyoM+ncSbKTp3sY+AkX+E8Kict7M9SGPwk1lKW jO8fbQdejpcuTeTVl++ItR1/WWQZGcQe4ZNegLy14ltNQVtN7SYnbVcxDfTJKXJcipXXkO d8FKNskozsg8Rb1Cj8NS405tbzFGjyk= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Cc: Sven Eckelmann Subject: [PATCH 3/4] batman-adv: Don't manually reattach hard-interface Date: Wed, 2 Jun 2021 22:32:34 +0200 Message-Id: <20210602203235.10659-3-sven@narfation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210602203235.10659-1-sven@narfation.org> References: <20210602203235.10659-1-sven@narfation.org> MIME-Version: 1.0 ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1622666548; a=rsa-sha256; cv=none; b=S213DjnwFBnJsXedUzY8dJv+jk3kbPUVopxOC1h4/m4egP/aIOi48z0F9qoiqwR852ioOp Pt9jmJDSJ52rXCoSgZn0OzdZX7SsMCwE3L7/1H+Kb4M38wt1TyUWwsjEfpUL8tVVp0CqMr sj0vRqLH6cEjPDW7+oYpXRyxhXJLbWg= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=narfation.org header.s=20121 header.b=q8jfl7iO; spf=pass (diktynna.open-mesh.org: domain of sven@narfation.org designates 213.160.73.56 as permitted sender) smtp.mailfrom=sven@narfation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1622666548; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=omSKb49EnYmEd3PGvhFwm0wFmRJlN2PtY5BdAap3PLY=; b=RbuGJNb031bqlBxQ4LH6/aWg41A8NQKeJ/Fj4ImImEH1cOe/oxdHFbti3j89fqVCOMwZFs HC8MO8D7orQ0l1iN20NEWmvK2xZ2D110sJ/P+NNYK/qAfRoRr+PEb1ZQBj/fVnNRWWG6s/ XR+0sdZhzAKmdjNmc6+hzmd+NqwCP80= Message-ID-Hash: 6DYDELTBTY7S55UYTTB6T2CBOKTOZB2Q X-Message-ID-Hash: 6DYDELTBTY7S55UYTTB6T2CBOKTOZB2Q 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; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: The batadv_hardif_enable_interface is now only called from the callback ndo_add_slave. This callback is only used by do_set_master in the rtnetlink code which only does two things: 1. remove the net_device from its old master 2. add the net_device to its new batadv master The code to replicate the first step in batman-adv is therefore unused since the sysfs code was dropped. Signed-off-by: Sven Eckelmann --- net/batman-adv/hard-interface.c | 34 --------------------------------- 1 file changed, 34 deletions(-) diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 44b65fa4..6ce75ec6 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -677,31 +677,6 @@ batadv_hardif_deactivate_interface(struct batadv_hard_iface *hard_iface) batadv_update_min_mtu(hard_iface->soft_iface); } -/** - * batadv_master_del_slave() - remove hard_iface from the current master iface - * @slave: the interface enslaved in another master - * @master: the master from which slave has to be removed - * - * Invoke ndo_del_slave on master passing slave as argument. In this way the - * slave is free'd and the master can correctly change its internal state. - * - * Return: 0 on success, a negative value representing the error otherwise - */ -static int batadv_master_del_slave(struct batadv_hard_iface *slave, - struct net_device *master) -{ - int ret; - - if (!master) - return 0; - - ret = -EBUSY; - if (master->netdev_ops->ndo_del_slave) - ret = master->netdev_ops->ndo_del_slave(master, slave->net_dev); - - return ret; -} - /** * batadv_hardif_enable_interface() - Enslave hard interface to soft interface * @hard_iface: hard interface to add to soft interface @@ -713,7 +688,6 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, struct net_device *soft_iface) { struct batadv_priv *bat_priv; - struct net_device *master; __be16 ethertype = htons(ETH_P_BATMAN); int max_header_len = batadv_max_header_len(); int ret; @@ -732,14 +706,6 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, goto err_dev; } - /* check if the interface is enslaved in another virtual one and - * in that case unlink it first - */ - master = netdev_master_upper_dev_get(hard_iface->net_dev); - ret = batadv_master_del_slave(hard_iface, master); - if (ret) - goto err_dev; - hard_iface->soft_iface = soft_iface; bat_priv = netdev_priv(hard_iface->soft_iface); From patchwork Wed Jun 2 20:32:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 18335 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 CB4FE83ED2; Wed, 2 Jun 2021 22:42:30 +0200 (CEST) Received: from dvalin.narfation.org (dvalin.narfation.org [IPv6:2a00:17d8:100::8b1]) by diktynna.open-mesh.org (Postfix) with ESMTPS id 26637839CB for ; Wed, 2 Jun 2021 22:42:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1622666085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w+BmgJ7u/J0ZCNsYIj8MrzumxlRDu8o2yLWcV26pAT8=; b=EExXfnfVISViiBtmAQj9HS/Y+kiaoAYByGgRZSe+LKvVVGLFGcCM/FMKRlc5/55wzWR9xw KmQD2+na7ypjgZd5rsxylnjggjdELlZtWgB5ThZaFfBRA07HxTYM+bwWR3nw/Px+9vc1Fg y24uE/QKMnullRuGIYTSnNunfXxXIxs= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Cc: Sven Eckelmann Subject: [PATCH 4/4] batman-adv: Drop reduntant batadv interface check Date: Wed, 2 Jun 2021 22:32:35 +0200 Message-Id: <20210602203235.10659-4-sven@narfation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210602203235.10659-1-sven@narfation.org> References: <20210602203235.10659-1-sven@narfation.org> MIME-Version: 1.0 ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1622666548; a=rsa-sha256; cv=none; b=fOSqQkcWtWEKV8fiOIjsjHmf1Z+y/AqqHNVWB07O0hvERw81RQw702i7kZA26nTjRKN5D/ uZ61OuIDJO0P8lWw+KAtRzSiMbhLrpAG4Xupco9MngPiN5lN7NQPAwdjL5pUOjhA49EPDg Ln6IsOyI63rqryUjy+jjC94zWcDQSbc= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=narfation.org header.s=20121 header.b=EExXfnfV; spf=pass (diktynna.open-mesh.org: domain of sven@narfation.org designates 2a00:17d8:100::8b1 as permitted sender) smtp.mailfrom=sven@narfation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1622666548; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=w+BmgJ7u/J0ZCNsYIj8MrzumxlRDu8o2yLWcV26pAT8=; b=gC46cUQ9fRup9LRCHAGHuC8DRX6rLwB36IDQr+C66BLs1o0YBgudnC4nhWuNC5X/WrRie1 t9sYXbD4QXL2+67FdWwD+/FQUEd3ASiBDBqe6k/8Qg4+IiST9xJ2ex0+JrF1QUGquxjJy+ igoWSM+vn8dauQI6TGEmJA50A7gAZ7s= Message-ID-Hash: MBRPXHASHGQY225OUZC24CEXI77RZBKY X-Message-ID-Hash: MBRPXHASHGQY225OUZC24CEXI77RZBKY 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; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: If batadv_hardif_enable_interface is called then its called from its callback ndo_add_slave. It is therefore not necessary to check if it is a batadv interface. Signed-off-by: Sven Eckelmann --- net/batman-adv/hard-interface.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 6ce75ec6..667b553c 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -9,7 +9,6 @@ #include #include -#include #include #include #include @@ -698,14 +697,6 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, kref_get(&hard_iface->refcount); dev_hold(soft_iface); - - if (!batadv_softif_is_valid(soft_iface)) { - pr_err("Can't create batman mesh interface %s: already exists as regular interface\n", - soft_iface->name); - ret = -EINVAL; - goto err_dev; - } - hard_iface->soft_iface = soft_iface; bat_priv = netdev_priv(hard_iface->soft_iface);