diff mbox series

[net-next] neigh: use struct {arp, ndisc}_generic_ops for all case

Message ID 20211028122022.14879-1-yajun.deng@linux.dev (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series [net-next] neigh: use struct {arp, ndisc}_generic_ops for all case | expand

Checks

Context Check Description
netdev/cover_letter success Single patches do not need cover letters
netdev/fixes_present success Fixes tag not required for -next series
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 2 this patch: 2
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success No Fixes tag
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 58 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success No static functions without inline keyword in header files

Commit Message

Yajun Deng Oct. 28, 2021, 12:20 p.m. UTC
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(-)

Comments

David Ahern Oct. 28, 2021, 3:09 p.m. UTC | #1
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.
diff mbox series

Patch

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;