DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH 10/13] net/nfp: improve modularazation of flow module
Date: Wed, 20 Sep 2023 19:34:51 +0800	[thread overview]
Message-ID: <20230920113454.739356-11-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20230920113454.739356-1-chaoyong.he@corigine.com>

Make the header file self-containing by adding the correct include
statement.
Try to keep the API small by move the logic which need not expose from
header file to source file verbatim and remove the unused macro.
Also remove the unneeded header file include statement of source file.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/nfp/nfp_flow.c | 88 +++++++++++++++++++++++++++++++++-----
 drivers/net/nfp/nfp_flow.h | 78 +--------------------------------
 2 files changed, 79 insertions(+), 87 deletions(-)

diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c
index 9847eb0615..ff03bea6ce 100644
--- a/drivers/net/nfp/nfp_flow.c
+++ b/drivers/net/nfp/nfp_flow.c
@@ -3,24 +3,92 @@
  * All rights reserved.
  */
 
+#include "nfp_flow.h"
+
 #include <rte_flow_driver.h>
 #include <rte_hash.h>
 #include <rte_jhash.h>
-#include <bus_pci_driver.h>
 #include <rte_malloc.h>
 
-#include "nfp_common.h"
-#include "nfp_ctrl.h"
-#include "nfp_flow.h"
-#include "nfp_logs.h"
-#include "nfp_rxtx.h"
-#include "nfp_mtr.h"
-#include "flower/nfp_flower.h"
 #include "flower/nfp_flower_cmsg.h"
-#include "flower/nfp_flower_ctrl.h"
 #include "flower/nfp_flower_representor.h"
-#include "nfpcore/nfp_mip.h"
 #include "nfpcore/nfp_rtsym.h"
+#include "nfp_logs.h"
+#include "nfp_mtr.h"
+
+#define NFP_FLOWER_LAYER_EXT_META       RTE_BIT32(0)
+#define NFP_FLOWER_LAYER_PORT           RTE_BIT32(1)
+#define NFP_FLOWER_LAYER_MAC            RTE_BIT32(2)
+#define NFP_FLOWER_LAYER_TP             RTE_BIT32(3)
+#define NFP_FLOWER_LAYER_IPV4           RTE_BIT32(4)
+#define NFP_FLOWER_LAYER_IPV6           RTE_BIT32(5)
+#define NFP_FLOWER_LAYER_CT             RTE_BIT32(6)
+#define NFP_FLOWER_LAYER_VXLAN          RTE_BIT32(7)
+
+#define NFP_FLOWER_LAYER2_GRE           RTE_BIT32(0)
+#define NFP_FLOWER_LAYER2_QINQ          RTE_BIT32(4)
+#define NFP_FLOWER_LAYER2_GENEVE        RTE_BIT32(5)
+#define NFP_FLOWER_LAYER2_GENEVE_OP     RTE_BIT32(6)
+#define NFP_FLOWER_LAYER2_TUN_IPV6      RTE_BIT32(7)
+
+/* Compressed HW representation of TCP Flags */
+#define NFP_FL_TCP_FLAG_FIN             RTE_BIT32(0)
+#define NFP_FL_TCP_FLAG_SYN             RTE_BIT32(1)
+#define NFP_FL_TCP_FLAG_RST             RTE_BIT32(2)
+#define NFP_FL_TCP_FLAG_PSH             RTE_BIT32(3)
+#define NFP_FL_TCP_FLAG_URG             RTE_BIT32(4)
+
+#define NFP_FL_META_FLAG_MANAGE_MASK    RTE_BIT32(7)
+
+#define NFP_FLOWER_MASK_VLAN_CFI        RTE_BIT32(12)
+
+#define NFP_MASK_TABLE_ENTRIES          1024
+
+/* The maximum action list size (in bytes) supported by the NFP. */
+#define NFP_FL_MAX_A_SIZ                1216
+
+#define NFP_FL_SC_ACT_DROP      0x80000000
+#define NFP_FL_SC_ACT_USER      0x7D000000
+#define NFP_FL_SC_ACT_POPV      0x6A000000
+#define NFP_FL_SC_ACT_NULL      0x00000000
+
+/* GRE Tunnel flags */
+#define NFP_FL_GRE_FLAG_KEY         (1 << 2)
+
+/* Action opcodes */
+#define NFP_FL_ACTION_OPCODE_OUTPUT             0
+#define NFP_FL_ACTION_OPCODE_PUSH_VLAN          1
+#define NFP_FL_ACTION_OPCODE_POP_VLAN           2
+#define NFP_FL_ACTION_OPCODE_PUSH_MPLS          3
+#define NFP_FL_ACTION_OPCODE_POP_MPLS           4
+#define NFP_FL_ACTION_OPCODE_USERSPACE          5
+#define NFP_FL_ACTION_OPCODE_SET_TUNNEL         6
+#define NFP_FL_ACTION_OPCODE_SET_ETHERNET       7
+#define NFP_FL_ACTION_OPCODE_SET_MPLS           8
+#define NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS     9
+#define NFP_FL_ACTION_OPCODE_SET_IPV4_TTL_TOS   10
+#define NFP_FL_ACTION_OPCODE_SET_IPV6_SRC       11
+#define NFP_FL_ACTION_OPCODE_SET_IPV6_DST       12
+#define NFP_FL_ACTION_OPCODE_SET_IPV6_TC_HL_FL  13
+#define NFP_FL_ACTION_OPCODE_SET_UDP            14
+#define NFP_FL_ACTION_OPCODE_SET_TCP            15
+#define NFP_FL_ACTION_OPCODE_PRE_LAG            16
+#define NFP_FL_ACTION_OPCODE_PRE_TUNNEL         17
+#define NFP_FL_ACTION_OPCODE_PRE_GS             18
+#define NFP_FL_ACTION_OPCODE_GS                 19
+#define NFP_FL_ACTION_OPCODE_PUSH_NSH           20
+#define NFP_FL_ACTION_OPCODE_POP_NSH            21
+#define NFP_FL_ACTION_OPCODE_SET_QUEUE          22
+#define NFP_FL_ACTION_OPCODE_CONNTRACK          23
+#define NFP_FL_ACTION_OPCODE_METER              24
+#define NFP_FL_ACTION_OPCODE_CT_NAT_EXT         25
+#define NFP_FL_ACTION_OPCODE_PUSH_GENEVE        26
+#define NFP_FL_ACTION_OPCODE_NUM                32
+
+#define NFP_FL_OUT_FLAGS_LAST            RTE_BIT32(15)
+
+/* Tunnel ports */
+#define NFP_FL_PORT_TYPE_TUN            0x50000000
 
 /*
  * Maximum number of items in struct rte_flow_action_vxlan_encap.
diff --git a/drivers/net/nfp/nfp_flow.h b/drivers/net/nfp/nfp_flow.h
index 414bd4573b..7ce7f62453 100644
--- a/drivers/net/nfp/nfp_flow.h
+++ b/drivers/net/nfp/nfp_flow.h
@@ -6,87 +6,11 @@
 #ifndef _NFP_FLOW_H_
 #define _NFP_FLOW_H_
 
-#include <sys/queue.h>
-#include <rte_bitops.h>
-#include <ethdev_driver.h>
-
-#define NFP_FLOWER_LAYER_EXT_META       RTE_BIT32(0)
-#define NFP_FLOWER_LAYER_PORT           RTE_BIT32(1)
-#define NFP_FLOWER_LAYER_MAC            RTE_BIT32(2)
-#define NFP_FLOWER_LAYER_TP             RTE_BIT32(3)
-#define NFP_FLOWER_LAYER_IPV4           RTE_BIT32(4)
-#define NFP_FLOWER_LAYER_IPV6           RTE_BIT32(5)
-#define NFP_FLOWER_LAYER_CT             RTE_BIT32(6)
-#define NFP_FLOWER_LAYER_VXLAN          RTE_BIT32(7)
-
-#define NFP_FLOWER_LAYER2_GRE           RTE_BIT32(0)
-#define NFP_FLOWER_LAYER2_QINQ          RTE_BIT32(4)
-#define NFP_FLOWER_LAYER2_GENEVE        RTE_BIT32(5)
-#define NFP_FLOWER_LAYER2_GENEVE_OP     RTE_BIT32(6)
-#define NFP_FLOWER_LAYER2_TUN_IPV6      RTE_BIT32(7)
-
-/* Compressed HW representation of TCP Flags */
-#define NFP_FL_TCP_FLAG_FIN             RTE_BIT32(0)
-#define NFP_FL_TCP_FLAG_SYN             RTE_BIT32(1)
-#define NFP_FL_TCP_FLAG_RST             RTE_BIT32(2)
-#define NFP_FL_TCP_FLAG_PSH             RTE_BIT32(3)
-#define NFP_FL_TCP_FLAG_URG             RTE_BIT32(4)
-
-#define NFP_FL_META_FLAG_MANAGE_MASK    RTE_BIT32(7)
-
-#define NFP_FLOWER_MASK_VLAN_CFI        RTE_BIT32(12)
-
-#define NFP_MASK_TABLE_ENTRIES          1024
-
-/* The maximum action list size (in bytes) supported by the NFP. */
-#define NFP_FL_MAX_A_SIZ                1216
+#include "nfp_common.h"
 
 /* The firmware expects lengths in units of long words */
 #define NFP_FL_LW_SIZ                   2
 
-#define NFP_FL_SC_ACT_DROP      0x80000000
-#define NFP_FL_SC_ACT_USER      0x7D000000
-#define NFP_FL_SC_ACT_POPV      0x6A000000
-#define NFP_FL_SC_ACT_NULL      0x00000000
-
-/* GRE Tunnel flags */
-#define NFP_FL_GRE_FLAG_KEY         (1 << 2)
-
-/* Action opcodes */
-#define NFP_FL_ACTION_OPCODE_OUTPUT             0
-#define NFP_FL_ACTION_OPCODE_PUSH_VLAN          1
-#define NFP_FL_ACTION_OPCODE_POP_VLAN           2
-#define NFP_FL_ACTION_OPCODE_PUSH_MPLS          3
-#define NFP_FL_ACTION_OPCODE_POP_MPLS           4
-#define NFP_FL_ACTION_OPCODE_USERSPACE          5
-#define NFP_FL_ACTION_OPCODE_SET_TUNNEL         6
-#define NFP_FL_ACTION_OPCODE_SET_ETHERNET       7
-#define NFP_FL_ACTION_OPCODE_SET_MPLS           8
-#define NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS     9
-#define NFP_FL_ACTION_OPCODE_SET_IPV4_TTL_TOS   10
-#define NFP_FL_ACTION_OPCODE_SET_IPV6_SRC       11
-#define NFP_FL_ACTION_OPCODE_SET_IPV6_DST       12
-#define NFP_FL_ACTION_OPCODE_SET_IPV6_TC_HL_FL  13
-#define NFP_FL_ACTION_OPCODE_SET_UDP            14
-#define NFP_FL_ACTION_OPCODE_SET_TCP            15
-#define NFP_FL_ACTION_OPCODE_PRE_LAG            16
-#define NFP_FL_ACTION_OPCODE_PRE_TUNNEL         17
-#define NFP_FL_ACTION_OPCODE_PRE_GS             18
-#define NFP_FL_ACTION_OPCODE_GS                 19
-#define NFP_FL_ACTION_OPCODE_PUSH_NSH           20
-#define NFP_FL_ACTION_OPCODE_POP_NSH            21
-#define NFP_FL_ACTION_OPCODE_SET_QUEUE          22
-#define NFP_FL_ACTION_OPCODE_CONNTRACK          23
-#define NFP_FL_ACTION_OPCODE_METER              24
-#define NFP_FL_ACTION_OPCODE_CT_NAT_EXT         25
-#define NFP_FL_ACTION_OPCODE_PUSH_GENEVE        26
-#define NFP_FL_ACTION_OPCODE_NUM                32
-
-#define NFP_FL_OUT_FLAGS_LAST            RTE_BIT32(15)
-
-/* Tunnel ports */
-#define NFP_FL_PORT_TYPE_TUN            0x50000000
-
 enum nfp_flower_tun_type {
 	NFP_FL_TUN_NONE   = 0,
 	NFP_FL_TUN_GRE    = 1,
-- 
2.39.1


  parent reply	other threads:[~2023-09-20 11:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20 11:34 [PATCH 00/13] improve the modularization of NFP PMD Chaoyong He
2023-09-20 11:34 ` [PATCH 01/13] net/nfp: make sure header file is self-containing Chaoyong He
2023-09-20 11:34 ` [PATCH 02/13] net/nfp: improve modularazation of rxtx module Chaoyong He
2023-09-20 11:34 ` [PATCH 03/13] net/nfp: improve modularazation of nfd3 module Chaoyong He
2023-09-20 11:34 ` [PATCH 04/13] net/nfp: improve modularazation of nfdk module Chaoyong He
2023-09-20 11:34 ` [PATCH 05/13] net/nfp: improve modularazation of common module Chaoyong He
2023-09-20 11:34 ` [PATCH 06/13] net/nfp: improve modularazation of flower module Chaoyong He
2023-09-20 11:34 ` [PATCH 07/13] net/nfp: improve modularazation of flower representor module Chaoyong He
2023-09-20 11:34 ` [PATCH 08/13] net/nfp: improve modularazation of flower ctrl module Chaoyong He
2023-09-20 11:34 ` [PATCH 09/13] net/nfp: improve modularazation of flower cmsg module Chaoyong He
2023-09-20 11:34 ` Chaoyong He [this message]
2023-09-20 11:34 ` [PATCH 11/13] net/nfp: improve modularazation of meter module Chaoyong He
2023-09-20 11:34 ` [PATCH 12/13] net/nfp: improve modularazation of CPP bridge module Chaoyong He
2023-09-20 11:34 ` [PATCH 13/13] net/nfp: cleanup the include statement of PMD Chaoyong He
2023-09-22 11:23 ` [PATCH 00/13] improve the modularization of NFP PMD Ferruh Yigit
2023-09-25  1:34   ` Chaoyong He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230920113454.739356-11-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=oss-drivers@corigine.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).