LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v3 net-next] net: bridge: change return type of br_handle_ingress_vlan_tunnel
@ 2021-08-23 10:21 Kangmin Park
  2021-08-23 10:25 ` Nikolay Aleksandrov
  0 siblings, 1 reply; 3+ messages in thread
From: Kangmin Park @ 2021-08-23 10:21 UTC (permalink / raw)
  To: Roopa Prabhu
  Cc: Nikolay Aleksandrov, David S. Miller, Jakub Kicinski, bridge,
	netdev, linux-kernel

br_handle_ingress_vlan_tunnel() is only referenced in
br_handle_frame(). If br_handle_ingress_vlan_tunnel() is called and
return non-zero value, goto drop in br_handle_frame().

But, br_handle_ingress_vlan_tunnel() always return 0. So, the
routines that check the return value and goto drop has no meaning.

Therefore, change return type of br_handle_ingress_vlan_tunnel() to
void and remove if statement of br_handle_frame().

Signed-off-by: Kangmin Park <l4stpr0gr4m@gmail.com>
---
v3:
 - remove unnecessary return statement

v2:
 - cleanup instead of modifying ingress function
 - change prototype of ingress function
 - cleanup br_handle_frame function
 - change commit message accordingly

 net/bridge/br_input.c          |  7 ++-----
 net/bridge/br_private_tunnel.h |  6 +++---
 net/bridge/br_vlan_tunnel.c    | 14 ++++++--------
 3 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 8a0c0cc55cb4..b50382f957c1 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -294,11 +294,8 @@ static rx_handler_result_t br_handle_frame(struct sk_buff **pskb)
 	memset(skb->cb, 0, sizeof(struct br_input_skb_cb));
 
 	p = br_port_get_rcu(skb->dev);
-	if (p->flags & BR_VLAN_TUNNEL) {
-		if (br_handle_ingress_vlan_tunnel(skb, p,
-						  nbp_vlan_group_rcu(p)))
-			goto drop;
-	}
+	if (p->flags & BR_VLAN_TUNNEL)
+		br_handle_ingress_vlan_tunnel(skb, p, nbp_vlan_group_rcu(p));
 
 	if (unlikely(is_link_local_ether_addr(dest))) {
 		u16 fwd_mask = p->br->group_fwd_mask_required;
diff --git a/net/bridge/br_private_tunnel.h b/net/bridge/br_private_tunnel.h
index c54cc26211d7..2b053289f016 100644
--- a/net/bridge/br_private_tunnel.h
+++ b/net/bridge/br_private_tunnel.h
@@ -38,9 +38,9 @@ int nbp_vlan_tunnel_info_add(const struct net_bridge_port *port, u16 vid,
 void nbp_vlan_tunnel_info_flush(struct net_bridge_port *port);
 void vlan_tunnel_info_del(struct net_bridge_vlan_group *vg,
 			  struct net_bridge_vlan *vlan);
-int br_handle_ingress_vlan_tunnel(struct sk_buff *skb,
-				  struct net_bridge_port *p,
-				  struct net_bridge_vlan_group *vg);
+void br_handle_ingress_vlan_tunnel(struct sk_buff *skb,
+				   struct net_bridge_port *p,
+				   struct net_bridge_vlan_group *vg);
 int br_handle_egress_vlan_tunnel(struct sk_buff *skb,
 				 struct net_bridge_vlan *vlan);
 bool vlan_tunid_inrange(const struct net_bridge_vlan *v_curr,
diff --git a/net/bridge/br_vlan_tunnel.c b/net/bridge/br_vlan_tunnel.c
index 01017448ebde..6399a8a69d07 100644
--- a/net/bridge/br_vlan_tunnel.c
+++ b/net/bridge/br_vlan_tunnel.c
@@ -158,30 +158,28 @@ void vlan_tunnel_deinit(struct net_bridge_vlan_group *vg)
 	rhashtable_destroy(&vg->tunnel_hash);
 }
 
-int br_handle_ingress_vlan_tunnel(struct sk_buff *skb,
-				  struct net_bridge_port *p,
-				  struct net_bridge_vlan_group *vg)
+void br_handle_ingress_vlan_tunnel(struct sk_buff *skb,
+				   struct net_bridge_port *p,
+				   struct net_bridge_vlan_group *vg)
 {
 	struct ip_tunnel_info *tinfo = skb_tunnel_info(skb);
 	struct net_bridge_vlan *vlan;
 
 	if (!vg || !tinfo)
-		return 0;
+		return;
 
 	/* if already tagged, ignore */
 	if (skb_vlan_tagged(skb))
-		return 0;
+		return;
 
 	/* lookup vid, given tunnel id */
 	vlan = br_vlan_tunnel_lookup(&vg->tunnel_hash, tinfo->key.tun_id);
 	if (!vlan)
-		return 0;
+		return;
 
 	skb_dst_drop(skb);
 
 	__vlan_hwaccel_put_tag(skb, p->br->vlan_proto, vlan->vid);
-
-	return 0;
 }
 
 int br_handle_egress_vlan_tunnel(struct sk_buff *skb,
-- 
2.26.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 net-next] net: bridge: change return type of br_handle_ingress_vlan_tunnel
  2021-08-23 10:21 [PATCH v3 net-next] net: bridge: change return type of br_handle_ingress_vlan_tunnel Kangmin Park
@ 2021-08-23 10:25 ` Nikolay Aleksandrov
  2021-08-24 23:52   ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Aleksandrov @ 2021-08-23 10:25 UTC (permalink / raw)
  To: Kangmin Park, Roopa Prabhu
  Cc: David S. Miller, Jakub Kicinski, bridge, netdev, linux-kernel

On 23/08/2021 13:21, Kangmin Park wrote:
> br_handle_ingress_vlan_tunnel() is only referenced in
> br_handle_frame(). If br_handle_ingress_vlan_tunnel() is called and
> return non-zero value, goto drop in br_handle_frame().
> 
> But, br_handle_ingress_vlan_tunnel() always return 0. So, the
> routines that check the return value and goto drop has no meaning.
> 
> Therefore, change return type of br_handle_ingress_vlan_tunnel() to
> void and remove if statement of br_handle_frame().
> 
> Signed-off-by: Kangmin Park <l4stpr0gr4m@gmail.com>
> ---
> v3:
>  - remove unnecessary return statement
> 
> v2:
>  - cleanup instead of modifying ingress function
>  - change prototype of ingress function
>  - cleanup br_handle_frame function
>  - change commit message accordingly
> 
>  net/bridge/br_input.c          |  7 ++-----
>  net/bridge/br_private_tunnel.h |  6 +++---
>  net/bridge/br_vlan_tunnel.c    | 14 ++++++--------
>  3 files changed, 11 insertions(+), 16 deletions(-)
> 

Looks good to me,
Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 net-next] net: bridge: change return type of br_handle_ingress_vlan_tunnel
  2021-08-23 10:25 ` Nikolay Aleksandrov
@ 2021-08-24 23:52   ` Jakub Kicinski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2021-08-24 23:52 UTC (permalink / raw)
  To: Nikolay Aleksandrov, Kangmin Park
  Cc: Roopa Prabhu, David S. Miller, bridge, netdev, linux-kernel

On Mon, 23 Aug 2021 13:25:20 +0300 Nikolay Aleksandrov wrote:
> On 23/08/2021 13:21, Kangmin Park wrote:
> > br_handle_ingress_vlan_tunnel() is only referenced in
> > br_handle_frame(). If br_handle_ingress_vlan_tunnel() is called and
> > return non-zero value, goto drop in br_handle_frame().
> > 
> > But, br_handle_ingress_vlan_tunnel() always return 0. So, the
> > routines that check the return value and goto drop has no meaning.
> > 
> > Therefore, change return type of br_handle_ingress_vlan_tunnel() to
> > void and remove if statement of br_handle_frame().
> > 
> > Signed-off-by: Kangmin Park <l4stpr0gr4m@gmail.com>
> 
> Looks good to me,
> Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-24 23:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23 10:21 [PATCH v3 net-next] net: bridge: change return type of br_handle_ingress_vlan_tunnel Kangmin Park
2021-08-23 10:25 ` Nikolay Aleksandrov
2021-08-24 23:52   ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).