Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1520376pxb; Thu, 28 Oct 2021 05:23:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxl/L1iWA9Vzorw+9TEAl/nl7mfL6XmQR2fhovKDGq4bQSeVdYjbcxAgjkV8mCct9c/uApK X-Received: by 2002:a17:906:1848:: with SMTP id w8mr5029859eje.485.1635423813711; Thu, 28 Oct 2021 05:23:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635423813; cv=none; d=google.com; s=arc-20160816; b=CIr8dQIbqKLj/8Yuv6BBOgmLsZTcOSqBjtjDNd3NA6za0Ppmw3eRs6kouefWVk52vO LlJozzVXu5Mwk1pNcsiFzp3mlJMKhaioIyFAfD3DLgsWuJPJNo2ZvntYdZVq0Uzo9tia ivYy6ljTpcVu5emFFRxxEYTYSLJ8+cxZBawUGd2Ng/+CnCS99bBLWP0cfoUJBAigXYUF wYwNfOQsfvrBNsN8ob74AKxs4XDydbthd/V6wcdIRHawiIljuirQcI0we+xus0wkWf7G x5Nco+39JpBKlridJ5Fvm18g8uH8BnO9qmkS3CL0YnCiIEEjZxvIm/Gpp5qLdwDVz/Zm 4INA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=HuLmrknqKnj+uCiF1w4Lwe6N+b32tTBwksurG4f0/zw=; b=GivwqbOpb6R1ydE0uXXPHYNwxMhf3uPCOl9qFUOq5UL1QDjXr8Q2srOck280Tu8l/e Acq3q+UjTKaiA58bFB8O5h+1tzQ4eTzcZxF6E5oEbWpbcko4QHnmy0lrB56AL8p8GHPo GeW+o35WkQ8Y5yZx8X4tDGdivsGVXrKNq1DZXmhhN5xZN0ARWHlqTPM+oRjM8jei8mcx U99lP4J7al1ohdLuefCn328746FfTuTgRtJX2FCJWK9bfXHRAM+xK3asipBxIoAGyOPp Q8ZDVIwD8xFMfM+T3NDApm/gIMVnswUYjkaS9tMLwgRLQbnd8iuWYLyefZGfjgGJQg+N FgPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=XVCwugBD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t10si4801864edd.336.2021.10.28.05.23.08; Thu, 28 Oct 2021 05:23:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=XVCwugBD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230356AbhJ1MXI (ORCPT + 99 others); Thu, 28 Oct 2021 08:23:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbhJ1MXH (ORCPT ); Thu, 28 Oct 2021 08:23:07 -0400 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F31F2C061570; Thu, 28 Oct 2021 05:20:40 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1635423639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=HuLmrknqKnj+uCiF1w4Lwe6N+b32tTBwksurG4f0/zw=; b=XVCwugBDhR8XjESFAbqF6hw/6e0PR24MRPVDYfK/vsmUFCGwtmqdmRUCvOuDObqvz2voTu eaozg4OBZxpIRVB8GoiQgl6IoyAXxDrv3r67PdtPz6VPrhyQ0CnmcqV3N1wTNwDqyLiBgc CACoUtdAf/NztzSE28igDXJ97L5xyd4= From: Yajun Deng To: davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.org, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yajun Deng Subject: [PATCH net-next] neigh: use struct {arp, ndisc}_generic_ops for all case Date: Thu, 28 Oct 2021 20:20:22 +0800 Message-Id: <20211028122022.14879-1-yajun.deng@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: yajun.deng@linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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