From patchwork Wed Feb 15 13:46:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Mayer X-Patchwork-Id: 57571 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp213672wrn; Wed, 15 Feb 2023 06:12:44 -0800 (PST) X-Google-Smtp-Source: AK7set+FC3M9JmAlZENq0NkWk+cwudL/PDARady0KGVlmdjnzEjDuOJuO/GKcho8WN/GUPfjtiWU X-Received: by 2002:a05:6402:124e:b0:4ab:4d69:f9e3 with SMTP id l14-20020a056402124e00b004ab4d69f9e3mr2013335edw.20.1676470364635; Wed, 15 Feb 2023 06:12:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676470364; cv=none; d=google.com; s=arc-20160816; b=Ugci6Enrpl4IZTjq2+nrDaaOel7zj/5cvcPQdZcAI6+qrikK/021xq92hZlN4aT19j DN/gYZ7E4obxsgBY4uG8SBkHxdFe8icF67AcBri6zw3YOiGivVAacbm+8eNYl25YGUI3 AIMZmIX1rjAKXL2WH8Bk5bwQjpyrNDy3NKHe1uVZEXX65R0M1tbwrvXxsF8k24Wd9JaV LrJ6Nnk5UyaVa79WPKBwFFJHxnL2gnUoBv6kWwVUJBuUyUh6kwnnayNUAQncyXK1Bpcj nMphFZcvthgQEGKHm1JifZOFzPRgOfBtbghvDDJbKZRYGM1/47apdxQMW+xDHVEG+HQw sQdw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1yjDE1rzM8iYrigNVvO/2HGAnsmOmIP+FmCeudr9E8U=; b=gpGwY83reOsbianaaF449E1XaPJ7tXQxJdijlQ5DHmVscHXQiK6IqEFNd9NKX4YJxz UWOQa4TvqjckYBBs+bfQ45KgVmhDerb+DVSKqynHYO0xE5PppIDDMLQ7i5ulpKVYG6QT KKbgorJNVnfK8sEBr9amEQMNz1AKBFGJ6ep0RrLe5rSSfGps9bid5eqh8g+OS8lNQ310 ehg9i6bDIF9GV5vzxuSjIbAP5dGppzY+CZsolz3inssIWqhbsYiqD867hH2Z+oYZadj1 ETNe19tYXRPV96GhdPux8T7ws8Wq/9yXzty5dses2te2J0sZFwP0pp0yLZbIUIdH3A/i +t0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=uniroma2.it Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n1-20020a05640204c100b00469b79303b6si22402022edw.195.2023.02.15.06.12.10; Wed, 15 Feb 2023 06:12:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=uniroma2.it Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229611AbjBOOJz (ORCPT + 99 others); Wed, 15 Feb 2023 09:09:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbjBOOJy (ORCPT ); Wed, 15 Feb 2023 09:09:54 -0500 X-Greylist: delayed 1327 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 15 Feb 2023 06:09:52 PST Received: from smtp.uniroma2.it (smtp.uniroma2.it [160.80.6.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C96452D14D; Wed, 15 Feb 2023 06:09:51 -0800 (PST) Received: from localhost.localdomain ([160.80.103.126]) by smtp-2015.uniroma2.it (8.14.4/8.14.4/Debian-8) with ESMTP id 31FDlD5K003217 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 15 Feb 2023 14:47:14 +0100 From: Andrea Mayer To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Shuah Khan , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: Stefano Salsano , Paolo Lungaroni , Ahmed Abdelsalam , Andrea Mayer Subject: [net-next 1/3] seg6: factor out End lookup nexthop processing to a dedicated function Date: Wed, 15 Feb 2023 14:46:57 +0100 Message-Id: <20230215134659.7613-2-andrea.mayer@uniroma2.it> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230215134659.7613-1-andrea.mayer@uniroma2.it> References: <20230215134659.7613-1-andrea.mayer@uniroma2.it> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.100.0 at smtp-2015 X-Virus-Status: Clean X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757906588663442934?= X-GMAIL-MSGID: =?utf-8?q?1757906588663442934?= The End nexthop lookup/input operations are moved into a new helper function named input_action_end_finish(). This avoids duplicating the code needed to compute the nexthop in the different flavors of the End behavior. Signed-off-by: Andrea Mayer Reviewed-by: David Ahern --- net/ipv6/seg6_local.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c index 487f8e98deaa..765e89a24bc2 100644 --- a/net/ipv6/seg6_local.c +++ b/net/ipv6/seg6_local.c @@ -364,6 +364,14 @@ static void seg6_next_csid_advance_arg(struct in6_addr *addr, memset(&addr->s6_addr[16 - fnc_octects], 0x00, fnc_octects); } +static int input_action_end_finish(struct sk_buff *skb, + struct seg6_local_lwt *slwt) +{ + seg6_lookup_nexthop(skb, NULL, 0); + + return dst_input(skb); +} + static int input_action_end_core(struct sk_buff *skb, struct seg6_local_lwt *slwt) { @@ -375,9 +383,7 @@ static int input_action_end_core(struct sk_buff *skb, advance_nextseg(srh, &ipv6_hdr(skb)->daddr); - seg6_lookup_nexthop(skb, NULL, 0); - - return dst_input(skb); + return input_action_end_finish(skb, slwt); drop: kfree_skb(skb); @@ -395,9 +401,7 @@ static int end_next_csid_core(struct sk_buff *skb, struct seg6_local_lwt *slwt) /* update DA */ seg6_next_csid_advance_arg(daddr, finfo); - seg6_lookup_nexthop(skb, NULL, 0); - - return dst_input(skb); + return input_action_end_finish(skb, slwt); } static bool seg6_next_csid_enabled(__u32 fops)