diff mbox series

[net-next] tipc: delete tipc_mtu_bad from tipc_udp_enable

Message ID 282f1f5cc40e6cad385aa1c60569e6c5b70e2fb3.1685371933.git.lucien.xin@gmail.com (mailing list archive)
State Accepted
Commit 6cd8ec58c1bf65adcdf346fe241ba69e0b56e6bd
Delegated to: Netdev Maintainers
Headers show
Series [net-next] tipc: delete tipc_mtu_bad from tipc_udp_enable | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers warning 1 maintainers not CCed: ying.xue@windriver.com
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 37 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Xin Long May 29, 2023, 2:52 p.m. UTC
Since commit a4dfa72d0acd ("tipc: set default MTU for UDP media"), it's
been no longer using dev->mtu for b->mtu, and the issue described in
commit 3de81b758853 ("tipc: check minimum bearer MTU") doesn't exist
in UDP bearer any more.

Besides, dev->mtu can still be changed to a too small mtu after the UDP
bearer is created even with tipc_mtu_bad() check in tipc_udp_enable().
Note that NETDEV_CHANGEMTU event processing in tipc_l2_device_event()
doesn't really work for UDP bearer.

So this patch deletes the unnecessary tipc_mtu_bad from tipc_udp_enable.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/tipc/bearer.c    | 4 ++--
 net/tipc/bearer.h    | 4 ++--
 net/tipc/udp_media.c | 4 ----
 3 files changed, 4 insertions(+), 8 deletions(-)

Comments

Tung Quang Nguyen May 30, 2023, 6:06 a.m. UTC | #1
>Subject: [PATCH net-next] tipc: delete tipc_mtu_bad from tipc_udp_enable
>
>Since commit a4dfa72d0acd ("tipc: set default MTU for UDP media"), it's
>been no longer using dev->mtu for b->mtu, and the issue described in
>commit 3de81b758853 ("tipc: check minimum bearer MTU") doesn't exist
>in UDP bearer any more.
>
>Besides, dev->mtu can still be changed to a too small mtu after the UDP
>bearer is created even with tipc_mtu_bad() check in tipc_udp_enable().
>Note that NETDEV_CHANGEMTU event processing in tipc_l2_device_event()
>doesn't really work for UDP bearer.
>
>So this patch deletes the unnecessary tipc_mtu_bad from tipc_udp_enable.
>
>Signed-off-by: Xin Long <lucien.xin@gmail.com>
>---
> net/tipc/bearer.c    | 4 ++--
> net/tipc/bearer.h    | 4 ++--
> net/tipc/udp_media.c | 4 ----
> 3 files changed, 4 insertions(+), 8 deletions(-)
>
>diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
>index 53881406e200..114140c49108 100644
>--- a/net/tipc/bearer.c
>+++ b/net/tipc/bearer.c
>@@ -431,7 +431,7 @@ int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b,
> 	dev = dev_get_by_name(net, dev_name);
> 	if (!dev)
> 		return -ENODEV;
>-	if (tipc_mtu_bad(dev, 0)) {
>+	if (tipc_mtu_bad(dev)) {
> 		dev_put(dev);
> 		return -EINVAL;
> 	}
>@@ -708,7 +708,7 @@ static int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt,
> 		test_and_set_bit_lock(0, &b->up);
> 		break;
> 	case NETDEV_CHANGEMTU:
>-		if (tipc_mtu_bad(dev, 0)) {
>+		if (tipc_mtu_bad(dev)) {
> 			bearer_disable(net, b);
> 			break;
> 		}
>diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
>index bd0cc5c287ef..1ee60649bd17 100644
>--- a/net/tipc/bearer.h
>+++ b/net/tipc/bearer.h
>@@ -257,9 +257,9 @@ static inline void tipc_loopback_trace(struct net *net,
> }
>
> /* check if device MTU is too low for tipc headers */
>-static inline bool tipc_mtu_bad(struct net_device *dev, unsigned int reserve)
>+static inline bool tipc_mtu_bad(struct net_device *dev)
> {
>-	if (dev->mtu >= TIPC_MIN_BEARER_MTU + reserve)
>+	if (dev->mtu >= TIPC_MIN_BEARER_MTU)
> 		return false;
> 	netdev_warn(dev, "MTU too low for tipc bearer\n");
> 	return true;
>diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
>index 0a85244fd618..926232557e77 100644
>--- a/net/tipc/udp_media.c
>+++ b/net/tipc/udp_media.c
>@@ -739,10 +739,6 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
> 		udp_conf.use_udp_checksums = false;
> 		ub->ifindex = dev->ifindex;
> 		b->encap_hlen = sizeof(struct iphdr) + sizeof(struct udphdr);
>-		if (tipc_mtu_bad(dev, b->encap_hlen)) {
>-			err = -EINVAL;
>-			goto err;
>-		}
> 		b->mtu = b->media->mtu;
> #if IS_ENABLED(CONFIG_IPV6)
> 	} else if (local.proto == htons(ETH_P_IPV6)) {
>--
>2.39.1
Reviewed-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
patchwork-bot+netdevbpf@kernel.org May 31, 2023, 7:10 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 29 May 2023 10:52:13 -0400 you wrote:
> Since commit a4dfa72d0acd ("tipc: set default MTU for UDP media"), it's
> been no longer using dev->mtu for b->mtu, and the issue described in
> commit 3de81b758853 ("tipc: check minimum bearer MTU") doesn't exist
> in UDP bearer any more.
> 
> Besides, dev->mtu can still be changed to a too small mtu after the UDP
> bearer is created even with tipc_mtu_bad() check in tipc_udp_enable().
> Note that NETDEV_CHANGEMTU event processing in tipc_l2_device_event()
> doesn't really work for UDP bearer.
> 
> [...]

Here is the summary with links:
  - [net-next] tipc: delete tipc_mtu_bad from tipc_udp_enable
    https://git.kernel.org/netdev/net-next/c/6cd8ec58c1bf

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 53881406e200..114140c49108 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -431,7 +431,7 @@  int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b,
 	dev = dev_get_by_name(net, dev_name);
 	if (!dev)
 		return -ENODEV;
-	if (tipc_mtu_bad(dev, 0)) {
+	if (tipc_mtu_bad(dev)) {
 		dev_put(dev);
 		return -EINVAL;
 	}
@@ -708,7 +708,7 @@  static int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt,
 		test_and_set_bit_lock(0, &b->up);
 		break;
 	case NETDEV_CHANGEMTU:
-		if (tipc_mtu_bad(dev, 0)) {
+		if (tipc_mtu_bad(dev)) {
 			bearer_disable(net, b);
 			break;
 		}
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
index bd0cc5c287ef..1ee60649bd17 100644
--- a/net/tipc/bearer.h
+++ b/net/tipc/bearer.h
@@ -257,9 +257,9 @@  static inline void tipc_loopback_trace(struct net *net,
 }
 
 /* check if device MTU is too low for tipc headers */
-static inline bool tipc_mtu_bad(struct net_device *dev, unsigned int reserve)
+static inline bool tipc_mtu_bad(struct net_device *dev)
 {
-	if (dev->mtu >= TIPC_MIN_BEARER_MTU + reserve)
+	if (dev->mtu >= TIPC_MIN_BEARER_MTU)
 		return false;
 	netdev_warn(dev, "MTU too low for tipc bearer\n");
 	return true;
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index 0a85244fd618..926232557e77 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -739,10 +739,6 @@  static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
 		udp_conf.use_udp_checksums = false;
 		ub->ifindex = dev->ifindex;
 		b->encap_hlen = sizeof(struct iphdr) + sizeof(struct udphdr);
-		if (tipc_mtu_bad(dev, b->encap_hlen)) {
-			err = -EINVAL;
-			goto err;
-		}
 		b->mtu = b->media->mtu;
 #if IS_ENABLED(CONFIG_IPV6)
 	} else if (local.proto == htons(ETH_P_IPV6)) {