All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net next 1/2] udp: Remove unused parameter (exact_dif)
@ 2019-06-14  4:41 Tim Beale
  2019-06-14  4:41 ` [PATCH net next 2/2] udp: Remove unused variable/function (exact_dif) Tim Beale
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tim Beale @ 2019-06-14  4:41 UTC (permalink / raw
  To: netdev; +Cc: davem, kuznet, yoshfuji, Tim Beale

Originally this was used by the VRF logic in compute_score(), but that
was later replaced by udp_sk_bound_dev_eq() and the parameter became
unused.

Note this change adds an 'unused variable' compiler warning that will be
removed in the next patch (I've split the removal in two to make review
slightly easier).

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
---
 net/ipv4/udp.c | 10 +++++-----
 net/ipv6/udp.c | 13 ++++++-------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 86de412..21febf1 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -364,7 +364,7 @@ int udp_v4_get_port(struct sock *sk, unsigned short snum)
 static int compute_score(struct sock *sk, struct net *net,
 			 __be32 saddr, __be16 sport,
 			 __be32 daddr, unsigned short hnum,
-			 int dif, int sdif, bool exact_dif)
+			 int dif, int sdif)
 {
 	int score;
 	struct inet_sock *inet;
@@ -420,7 +420,7 @@ static u32 udp_ehashfn(const struct net *net, const __be32 laddr,
 static struct sock *udp4_lib_lookup2(struct net *net,
 				     __be32 saddr, __be16 sport,
 				     __be32 daddr, unsigned int hnum,
-				     int dif, int sdif, bool exact_dif,
+				     int dif, int sdif,
 				     struct udp_hslot *hslot2,
 				     struct sk_buff *skb)
 {
@@ -432,7 +432,7 @@ static struct sock *udp4_lib_lookup2(struct net *net,
 	badness = 0;
 	udp_portaddr_for_each_entry_rcu(sk, &hslot2->head) {
 		score = compute_score(sk, net, saddr, sport,
-				      daddr, hnum, dif, sdif, exact_dif);
+				      daddr, hnum, dif, sdif);
 		if (score > badness) {
 			if (sk->sk_reuseport) {
 				hash = udp_ehashfn(net, daddr, hnum,
@@ -468,7 +468,7 @@ struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
 
 	result = udp4_lib_lookup2(net, saddr, sport,
 				  daddr, hnum, dif, sdif,
-				  exact_dif, hslot2, skb);
+				  hslot2, skb);
 	if (!result) {
 		hash2 = ipv4_portaddr_hash(net, htonl(INADDR_ANY), hnum);
 		slot2 = hash2 & udptable->mask;
@@ -476,7 +476,7 @@ struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
 
 		result = udp4_lib_lookup2(net, saddr, sport,
 					  htonl(INADDR_ANY), hnum, dif, sdif,
-					  exact_dif, hslot2, skb);
+					  hslot2, skb);
 	}
 	if (IS_ERR(result))
 		return NULL;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 6935183..8acd24e 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -111,7 +111,7 @@ void udp_v6_rehash(struct sock *sk)
 static int compute_score(struct sock *sk, struct net *net,
 			 const struct in6_addr *saddr, __be16 sport,
 			 const struct in6_addr *daddr, unsigned short hnum,
-			 int dif, int sdif, bool exact_dif)
+			 int dif, int sdif)
 {
 	int score;
 	struct inet_sock *inet;
@@ -155,8 +155,8 @@ static int compute_score(struct sock *sk, struct net *net,
 static struct sock *udp6_lib_lookup2(struct net *net,
 		const struct in6_addr *saddr, __be16 sport,
 		const struct in6_addr *daddr, unsigned int hnum,
-		int dif, int sdif, bool exact_dif,
-		struct udp_hslot *hslot2, struct sk_buff *skb)
+		int dif, int sdif, struct udp_hslot *hslot2,
+		struct sk_buff *skb)
 {
 	struct sock *sk, *result;
 	int score, badness;
@@ -166,7 +166,7 @@ static struct sock *udp6_lib_lookup2(struct net *net,
 	badness = -1;
 	udp_portaddr_for_each_entry_rcu(sk, &hslot2->head) {
 		score = compute_score(sk, net, saddr, sport,
-				      daddr, hnum, dif, sdif, exact_dif);
+				      daddr, hnum, dif, sdif);
 		if (score > badness) {
 			if (sk->sk_reuseport) {
 				hash = udp6_ehashfn(net, daddr, hnum,
@@ -202,7 +202,7 @@ struct sock *__udp6_lib_lookup(struct net *net,
 	hslot2 = &udptable->hash2[slot2];
 
 	result = udp6_lib_lookup2(net, saddr, sport,
-				  daddr, hnum, dif, sdif, exact_dif,
+				  daddr, hnum, dif, sdif,
 				  hslot2, skb);
 	if (!result) {
 		hash2 = ipv6_portaddr_hash(net, &in6addr_any, hnum);
@@ -212,8 +212,7 @@ struct sock *__udp6_lib_lookup(struct net *net,
 
 		result = udp6_lib_lookup2(net, saddr, sport,
 					  &in6addr_any, hnum, dif, sdif,
-					  exact_dif, hslot2,
-					  skb);
+					  hslot2, skb);
 	}
 	if (IS_ERR(result))
 		return NULL;
-- 
2.7.4


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

* [PATCH net next 2/2] udp: Remove unused variable/function (exact_dif)
  2019-06-14  4:41 [PATCH net next 1/2] udp: Remove unused parameter (exact_dif) Tim Beale
@ 2019-06-14  4:41 ` Tim Beale
  2019-06-15  0:50   ` David Ahern
  2019-06-15  2:52   ` David Miller
  2019-06-15  0:49 ` [PATCH net next 1/2] udp: Remove unused parameter (exact_dif) David Ahern
  2019-06-15  2:52 ` David Miller
  2 siblings, 2 replies; 6+ messages in thread
From: Tim Beale @ 2019-06-14  4:41 UTC (permalink / raw
  To: netdev; +Cc: davem, kuznet, yoshfuji, Tim Beale

This was originally passed through to the VRF logic in compute_score().
But that logic has now been replaced by udp_sk_bound_dev_eq() and so
this code is no longer used or needed.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
---
 net/ipv4/udp.c | 12 ------------
 net/ipv6/udp.c | 11 -----------
 2 files changed, 23 deletions(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 21febf1..211a8f3 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -125,17 +125,6 @@ EXPORT_SYMBOL(udp_memory_allocated);
 #define MAX_UDP_PORTS 65536
 #define PORTS_PER_CHAIN (MAX_UDP_PORTS / UDP_HTABLE_SIZE_MIN)
 
-/* IPCB reference means this can not be used from early demux */
-static bool udp_lib_exact_dif_match(struct net *net, struct sk_buff *skb)
-{
-#if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV)
-	if (!net->ipv4.sysctl_udp_l3mdev_accept &&
-	    skb && ipv4_l3mdev_skb(IPCB(skb)->flags))
-		return true;
-#endif
-	return false;
-}
-
 static int udp_lib_lport_inuse(struct net *net, __u16 num,
 			       const struct udp_hslot *hslot,
 			       unsigned long *bitmap,
@@ -460,7 +449,6 @@ struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
 	unsigned short hnum = ntohs(dport);
 	unsigned int hash2, slot2;
 	struct udp_hslot *hslot2;
-	bool exact_dif = udp_lib_exact_dif_match(net, skb);
 
 	hash2 = ipv4_portaddr_hash(net, daddr, hnum);
 	slot2 = hash2 & udptable->mask;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 8acd24e..b50ecac 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -54,16 +54,6 @@
 #include <trace/events/skb.h>
 #include "udp_impl.h"
 
-static bool udp6_lib_exact_dif_match(struct net *net, struct sk_buff *skb)
-{
-#if defined(CONFIG_NET_L3_MASTER_DEV)
-	if (!net->ipv4.sysctl_udp_l3mdev_accept &&
-	    skb && ipv6_l3mdev_skb(IP6CB(skb)->flags))
-		return true;
-#endif
-	return false;
-}
-
 static u32 udp6_ehashfn(const struct net *net,
 			const struct in6_addr *laddr,
 			const u16 lport,
@@ -195,7 +185,6 @@ struct sock *__udp6_lib_lookup(struct net *net,
 	unsigned int hash2, slot2;
 	struct udp_hslot *hslot2;
 	struct sock *result;
-	bool exact_dif = udp6_lib_exact_dif_match(net, skb);
 
 	hash2 = ipv6_portaddr_hash(net, daddr, hnum);
 	slot2 = hash2 & udptable->mask;
-- 
2.7.4


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

* Re: [PATCH net next 1/2] udp: Remove unused parameter (exact_dif)
  2019-06-14  4:41 [PATCH net next 1/2] udp: Remove unused parameter (exact_dif) Tim Beale
  2019-06-14  4:41 ` [PATCH net next 2/2] udp: Remove unused variable/function (exact_dif) Tim Beale
@ 2019-06-15  0:49 ` David Ahern
  2019-06-15  2:52 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2019-06-15  0:49 UTC (permalink / raw
  To: Tim Beale, netdev; +Cc: davem, kuznet, yoshfuji

On 6/13/19 10:41 PM, Tim Beale wrote:
> Originally this was used by the VRF logic in compute_score(), but that
> was later replaced by udp_sk_bound_dev_eq() and the parameter became
> unused.
> 
> Note this change adds an 'unused variable' compiler warning that will be
> removed in the next patch (I've split the removal in two to make review
> slightly easier).
> 
> Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
> ---
>  net/ipv4/udp.c | 10 +++++-----
>  net/ipv6/udp.c | 13 ++++++-------
>  2 files changed, 11 insertions(+), 12 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@gmail.com>



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

* Re: [PATCH net next 2/2] udp: Remove unused variable/function (exact_dif)
  2019-06-14  4:41 ` [PATCH net next 2/2] udp: Remove unused variable/function (exact_dif) Tim Beale
@ 2019-06-15  0:50   ` David Ahern
  2019-06-15  2:52   ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Ahern @ 2019-06-15  0:50 UTC (permalink / raw
  To: Tim Beale, netdev; +Cc: davem, kuznet, yoshfuji

On 6/13/19 10:41 PM, Tim Beale wrote:
> This was originally passed through to the VRF logic in compute_score().
> But that logic has now been replaced by udp_sk_bound_dev_eq() and so
> this code is no longer used or needed.
> 
> Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
> ---
>  net/ipv4/udp.c | 12 ------------
>  net/ipv6/udp.c | 11 -----------
>  2 files changed, 23 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@gmail.com>

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

* Re: [PATCH net next 1/2] udp: Remove unused parameter (exact_dif)
  2019-06-14  4:41 [PATCH net next 1/2] udp: Remove unused parameter (exact_dif) Tim Beale
  2019-06-14  4:41 ` [PATCH net next 2/2] udp: Remove unused variable/function (exact_dif) Tim Beale
  2019-06-15  0:49 ` [PATCH net next 1/2] udp: Remove unused parameter (exact_dif) David Ahern
@ 2019-06-15  2:52 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2019-06-15  2:52 UTC (permalink / raw
  To: timbeale; +Cc: netdev, kuznet, yoshfuji

From: Tim Beale <timbeale@catalyst.net.nz>
Date: Fri, 14 Jun 2019 16:41:26 +1200

> Originally this was used by the VRF logic in compute_score(), but that
> was later replaced by udp_sk_bound_dev_eq() and the parameter became
> unused.
> 
> Note this change adds an 'unused variable' compiler warning that will be
> removed in the next patch (I've split the removal in two to make review
> slightly easier).
> 
> Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>

Applied.

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

* Re: [PATCH net next 2/2] udp: Remove unused variable/function (exact_dif)
  2019-06-14  4:41 ` [PATCH net next 2/2] udp: Remove unused variable/function (exact_dif) Tim Beale
  2019-06-15  0:50   ` David Ahern
@ 2019-06-15  2:52   ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2019-06-15  2:52 UTC (permalink / raw
  To: timbeale; +Cc: netdev, kuznet, yoshfuji

From: Tim Beale <timbeale@catalyst.net.nz>
Date: Fri, 14 Jun 2019 16:41:27 +1200

> This was originally passed through to the VRF logic in compute_score().
> But that logic has now been replaced by udp_sk_bound_dev_eq() and so
> this code is no longer used or needed.
> 
> Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>

Applied.

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

end of thread, other threads:[~2019-06-15  2:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-14  4:41 [PATCH net next 1/2] udp: Remove unused parameter (exact_dif) Tim Beale
2019-06-14  4:41 ` [PATCH net next 2/2] udp: Remove unused variable/function (exact_dif) Tim Beale
2019-06-15  0:50   ` David Ahern
2019-06-15  2:52   ` David Miller
2019-06-15  0:49 ` [PATCH net next 1/2] udp: Remove unused parameter (exact_dif) David Ahern
2019-06-15  2:52 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.