Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE992C433DF for ; Tue, 23 Jun 2020 19:48:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1B95207E8 for ; Tue, 23 Jun 2020 19:48:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387527AbgFWTs7 (ORCPT ); Tue, 23 Jun 2020 15:48:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733307AbgFWTsz (ORCPT ); Tue, 23 Jun 2020 15:48:55 -0400 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A3E3C061573 for ; Tue, 23 Jun 2020 12:48:55 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1jnouZ-0000ZB-T3; Tue, 23 Jun 2020 21:48:51 +0200 From: Florian Westphal To: Steffen Klassert Cc: Subject: [PATCH ipsec-next 0/6] xfrm: remove xfrm replay indirections Date: Tue, 23 Jun 2020 21:48:37 +0200 Message-Id: <20200623194843.19612-1-fw@strlen.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The xfrm replay logic is implemented via indirect calls. xfrm_state struct holds a pointer to a 'struct xfrm_replay', which is one of several replay protection backends. XFRM then invokes the backend via state->repl->callback(). Due to retpoline all indirect calls have become a lot more expensive. Fortunately, there are no 'replay modules', all are available for direct calls. This series removes the 'struct xfrm_replay' and adds replay functions that can be called instead of the redirection. Example: - err = x->repl->overflow(x, skb); + err = xfrm_replay_overflow(x, skb); Instead of a pointer to a struct with function pointers, xfrm_state now holds an enum that tells the replay core what kind of replay test is to be done. Florian Westphal (6): xfrm: replay: avoid xfrm replay notify indirection xfrm: replay: get rid of duplicated notification code xfrm: replay: remove advance indirection xfrm: replay: remove recheck indirection xfrm: replay: avoid replay indirection xfrm: replay: remove last replay indirection include/net/xfrm.h | 29 ++++---- net/xfrm/xfrm_input.c | 6 +- net/xfrm/xfrm_output.c | 2 +- net/xfrm/xfrm_replay.c | 189 +++++++++++++++++++++++++++---------------------- net/xfrm/xfrm_state.c | 2 +- 5 files changed, 124 insertions(+), 104 deletions(-)