All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] neigh: use struct {arp, ndisc}_generic_ops for all case
@ 2021-10-28 12:20 Yajun Deng
  2021-10-28 15:09 ` David Ahern
  0 siblings, 1 reply; 2+ messages in thread
From: Yajun Deng @ 2021-10-28 12:20 UTC (permalink / raw)
  To: davem, yoshfuji, dsahern, kuba; +Cc: netdev, linux-kernel, Yajun Deng

These struct {arp, ndisc}_generic_ops can cover all case, so those
struct {arp, ndisc}_hh_ops are no need, remove them.

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
 net/ipv4/arp.c   | 15 ++-------------
 net/ipv6/ndisc.c | 18 ++++--------------
 2 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 922dd73e5740..9ee59c2e419a 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -135,14 +135,6 @@ static const struct neigh_ops arp_generic_ops = {
 	.connected_output =	neigh_connected_output,
 };
 
-static const struct neigh_ops arp_hh_ops = {
-	.family =		AF_INET,
-	.solicit =		arp_solicit,
-	.error_report =		arp_error_report,
-	.output =		neigh_resolve_output,
-	.connected_output =	neigh_resolve_output,
-};
-
 static const struct neigh_ops arp_direct_ops = {
 	.family =		AF_INET,
 	.output =		neigh_direct_output,
@@ -277,12 +269,9 @@ static int arp_constructor(struct neighbour *neigh)
 			memcpy(neigh->ha, dev->broadcast, dev->addr_len);
 		}
 
-		if (dev->header_ops->cache)
-			neigh->ops = &arp_hh_ops;
-		else
-			neigh->ops = &arp_generic_ops;
+		neigh->ops = &arp_generic_ops;
 
-		if (neigh->nud_state & NUD_VALID)
+		if (!dev->header_ops->cache && (neigh->nud_state & NUD_VALID))
 			neigh->output = neigh->ops->connected_output;
 		else
 			neigh->output = neigh->ops->output;
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 184190b9ea25..a544bd7454c4 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -91,15 +91,6 @@ static const struct neigh_ops ndisc_generic_ops = {
 	.connected_output =	neigh_connected_output,
 };
 
-static const struct neigh_ops ndisc_hh_ops = {
-	.family =		AF_INET6,
-	.solicit =		ndisc_solicit,
-	.error_report =		ndisc_error_report,
-	.output =		neigh_resolve_output,
-	.connected_output =	neigh_resolve_output,
-};
-
-
 static const struct neigh_ops ndisc_direct_ops = {
 	.family =		AF_INET6,
 	.output =		neigh_direct_output,
@@ -357,11 +348,10 @@ static int ndisc_constructor(struct neighbour *neigh)
 			neigh->nud_state = NUD_NOARP;
 			memcpy(neigh->ha, dev->broadcast, dev->addr_len);
 		}
-		if (dev->header_ops->cache)
-			neigh->ops = &ndisc_hh_ops;
-		else
-			neigh->ops = &ndisc_generic_ops;
-		if (neigh->nud_state&NUD_VALID)
+
+		neigh->ops = &ndisc_generic_ops;
+
+		if (!dev->header_ops->cache && (neigh->nud_state & NUD_VALID))
 			neigh->output = neigh->ops->connected_output;
 		else
 			neigh->output = neigh->ops->output;
-- 
2.32.0


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

* Re: [PATCH net-next] neigh: use struct {arp, ndisc}_generic_ops for all case
  2021-10-28 12:20 [PATCH net-next] neigh: use struct {arp, ndisc}_generic_ops for all case Yajun Deng
@ 2021-10-28 15:09 ` David Ahern
  0 siblings, 0 replies; 2+ messages in thread
From: David Ahern @ 2021-10-28 15:09 UTC (permalink / raw)
  To: Yajun Deng, davem, yoshfuji, dsahern, kuba; +Cc: netdev, linux-kernel

On 10/28/21 6:20 AM, Yajun Deng wrote:
> diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
> index 922dd73e5740..9ee59c2e419a 100644
> --- a/net/ipv4/arp.c
> +++ b/net/ipv4/arp.c
> @@ -135,14 +135,6 @@ static const struct neigh_ops arp_generic_ops = {
>  	.connected_output =	neigh_connected_output,
>  };
>  
> -static const struct neigh_ops arp_hh_ops = {
> -	.family =		AF_INET,
> -	.solicit =		arp_solicit,
> -	.error_report =		arp_error_report,
> -	.output =		neigh_resolve_output,
> -	.connected_output =	neigh_resolve_output,
> -};
> -

neigh_ops are used by net/core/neighbour.c; this change breaks those
references.


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

end of thread, other threads:[~2021-10-28 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-28 12:20 [PATCH net-next] neigh: use struct {arp, ndisc}_generic_ops for all case Yajun Deng
2021-10-28 15:09 ` David Ahern

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.