From patchwork Tue Nov 15 15:50:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Long X-Patchwork-Id: 1704166 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=CjgJF0z5; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NBVyh56h0z20KC for ; Wed, 16 Nov 2022 02:51:07 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 0D84841634; Tue, 15 Nov 2022 15:51:05 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0D84841634 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=CjgJF0z5 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Jz49Isk20L-4; Tue, 15 Nov 2022 15:51:04 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id E55A6415FA; Tue, 15 Nov 2022 15:51:02 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org E55A6415FA Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B789EC0033; Tue, 15 Nov 2022 15:51:02 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1943DC002D for ; Tue, 15 Nov 2022 15:51:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id E675E403C1 for ; Tue, 15 Nov 2022 15:51:00 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org E675E403C1 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MJwJEaS1Qk-3 for ; Tue, 15 Nov 2022 15:51:00 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0589C415FA Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by smtp4.osuosl.org (Postfix) with ESMTPS id 0589C415FA for ; Tue, 15 Nov 2022 15:50:59 +0000 (UTC) Received: by mail-qk1-x736.google.com with SMTP id x21so9765647qkj.0 for ; Tue, 15 Nov 2022 07:50:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Xaat2VyLldoqJoQSYuOa4mB+mnE/6Fm7QgRB0AqRuJw=; b=CjgJF0z59pegNShpUwuJWbbVAJr4Bo0+i8J74NQy7oQPQ8RDnUzlXxKCh2RNZ4vUZ5 OtKOWPw/Gh+LMg3Lk4GsW3FYXWOPJ8MLB99q4omUnYorbKQ+/JFaMChwwOAIvfJsFwbz /W9/+AcpvfK9fWUWXRxldp8dLtfuM1wLINEW6PJH1ro7Ak3+FRRwd9zAQOUgPXFfywkR wCbtBLwCKZikWZvr54J154IE4bonyQLnukUxsE4ZN2easSZnRzPfttQbaTOJFRXcSwdd DdYRzlENYJwmh1qXnnmlu4SNkj4fdrxCRww9yB5CL/NMbXP4JK4FNL4BGRtJjXCE7XsD Dg9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Xaat2VyLldoqJoQSYuOa4mB+mnE/6Fm7QgRB0AqRuJw=; b=0RkVWY8BMDc1WxqCcGl3og3lG0hDughhI78osp6pVi4WzIGYt/bDquvJMi8Zs0u7R2 NA3RIyxRm9FUVnxWG3PEBYueI4WOzLntpP7kKAp8W7/miPqP1v/dTd9RYzmxX6MoC+mF clgLjwUOnsTW7qKz3N4OOXAY8S/YVDU+JSW79SeqSe3fLFxCQW7e4MH4aap5UfBocdIQ PivBu+duVhEfOlHi7RL3UMwiYGEc43AG3ibQ1PgVZ1jMYagp/o9vZd8BQD9H9sbjxAdI flJlh8LBm93QZIwmnN+7TPjb9kGC/OH+X/YDgVvRMZ2yjC5enx0T1grx9s/rQYN9c2YZ tauw== X-Gm-Message-State: ANoB5plQLn/nPlfqvxGbHRHCkXyJHWqKnUmMqHNgQDMoJN5r4W8tey90 1gNQ2Y6eiFe+eTH/njo4SkA= X-Google-Smtp-Source: AA0mqf5jVc5nvJ3XxNFrgupk8z+6K3zFn81xp4Ch1K4XofuU6hBB/c4mzKfHAGVbQhZaa8s3rhwsaQ== X-Received: by 2002:a05:620a:371d:b0:6fa:d35:8466 with SMTP id de29-20020a05620a371d00b006fa0d358466mr16069053qkb.486.1668527458831; Tue, 15 Nov 2022 07:50:58 -0800 (PST) Received: from wsfd-netdev15.ntdv.lab.eng.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id f9-20020a05620a280900b006eeb3165554sm8244351qkp.19.2022.11.15.07.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 07:50:58 -0800 (PST) From: Xin Long To: network dev , dev@openvswitch.org Date: Tue, 15 Nov 2022 10:50:52 -0500 Message-Id: X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Cc: Marcelo Ricardo Leitner , Jiri Pirko , Davide Caratti , Florian Westphal , Jamal Hadi Salim , Eric Dumazet , Cong Wang , kuba@kernel.org, Paolo Abeni , davem@davemloft.net, Pablo Neira Ayuso Subject: [ovs-dev] [PATCH net-next 0/5] net: eliminate the duplicate code in the ct nat functions of ovs and tc X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The changes in the patchset: "net: add helper support in tc act_ct for ovs offloading" had moved some common ct code used by both OVS and TC into netfilter. There are still some big functions pretty similar defined and used in each of OVS and TC. It is not good to maintain such similar code in 2 places. This patchset is to extract the functions for NAT processing from OVS and TC to netfilter. To make this change clear and safe, this patchset gets the common code out of OVS and TC step by step: The patch 1-4 make some minor changes in OVS and TC to make the NAT code of them completely the same, then the patch 5 moves the common code to the netfilter and exports one function called by each of OVS and TC. Xin Long (5): openvswitch: delete the unncessary skb_pull_rcsum call in ovs_ct_nat_execute openvswitch: return NF_ACCEPT when OVS_CT_NAT is net set in info nat net: sched: return NF_ACCEPT when fails to add nat ext in tcf_ct_act_nat net: sched: update the nat flag for icmp error packets in ct_nat_execute net: move the nat function to nf_nat_core for ovs and tc include/net/netfilter/nf_nat.h | 4 + net/netfilter/nf_nat_core.c | 131 +++++++++++++++++++++++++++++ net/openvswitch/conntrack.c | 146 +++------------------------------ net/sched/act_ct.c | 136 +++--------------------------- 4 files changed, 159 insertions(+), 258 deletions(-) Reviewed-by: Saeed Mahameed