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 05/13] net/nfp: improve modularazation of common module
Date: Wed, 20 Sep 2023 19:34:46 +0800	[thread overview]
Message-ID: <20230920113454.739356-6-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_common.c | 51 +++++++++++++-----------------------
 drivers/net/nfp/nfp_common.h | 34 ++++--------------------
 2 files changed, 23 insertions(+), 62 deletions(-)

diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 160df27c94..40027dbdfc 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -5,47 +5,32 @@
  * Small portions derived from code Copyright(c) 2010-2015 Intel Corporation.
  */
 
-#include <rte_byteorder.h>
-#include <rte_common.h>
-#include <rte_log.h>
-#include <rte_debug.h>
-#include <ethdev_driver.h>
-#include <ethdev_pci.h>
-#include <dev_driver.h>
-#include <rte_ether.h>
-#include <rte_malloc.h>
-#include <rte_memzone.h>
-#include <rte_mempool.h>
-#include <rte_version.h>
+#include "nfp_common.h"
+
 #include <rte_alarm.h>
-#include <rte_spinlock.h>
-#include <rte_service_component.h>
 
-#include "nfpcore/nfp_cpp.h"
-#include "nfpcore/nfp_nffw.h"
-#include "nfpcore/nfp_hwinfo.h"
+#include "flower/nfp_flower_representor.h"
+#include "nfd3/nfp_nfd3.h"
+#include "nfdk/nfp_nfdk.h"
 #include "nfpcore/nfp_mip.h"
-#include "nfpcore/nfp_rtsym.h"
 #include "nfpcore/nfp_nsp.h"
+#include "nfp_logs.h"
 
-#include "flower/nfp_flower_representor.h"
+#define NFP_TX_MAX_SEG       UINT8_MAX
+#define NFP_TX_MAX_MTU_SEG   8
 
-#include "nfp_common.h"
-#include "nfp_ctrl.h"
-#include "nfp_rxtx.h"
-#include "nfp_logs.h"
-#include "nfp_cpp_bridge.h"
+/*
+ * This is used by the reconfig protocol. It sets the maximum time waiting in
+ * milliseconds before a reconfig timeout happens.
+ */
+#define NFP_NET_POLL_TIMEOUT    5000
 
-#include "nfd3/nfp_nfd3.h"
-#include "nfdk/nfp_nfdk.h"
+#define NFP_NET_LINK_DOWN_CHECK_TIMEOUT 4000 /* ms */
+#define NFP_NET_LINK_UP_CHECK_TIMEOUT   1000 /* ms */
 
-#include <stdint.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
+/* Maximum supported NFP frame size (MTU + layer 2 headers) */
+#define NFP_FRAME_SIZE_MAX        10048
+#define DEFAULT_FLBUF_SIZE        9216
 
 enum nfp_xstat_group {
 	NFP_XSTAT_GROUP_NET,
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 36ad4e1d32..b0372c3dc6 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -6,22 +6,14 @@
 #ifndef _NFP_COMMON_H_
 #define _NFP_COMMON_H_
 
+#include <bus_pci_driver.h>
+#include <ethdev_driver.h>
+#include <rte_io.h>
+#include <rte_spinlock.h>
+
 #include "nfp_ctrl.h"
 #include "nfpcore/nfp_dev.h"
 
-#define NFP_NET_PMD_VERSION "0.1"
-
-/* Forward declaration */
-struct nfp_net_adapter;
-
-#define NFP_TX_MAX_SEG     UINT8_MAX
-#define NFP_TX_MAX_MTU_SEG 8
-
-/* Bar allocation */
-#define NFP_NET_CRTL_BAR        0
-#define NFP_NET_TX_BAR          2
-#define NFP_NET_RX_BAR          2
-
 /* Macros for accessing the Queue Controller Peripheral 'CSRs' */
 #define NFP_QCP_QUEUE_OFF(_x)                 ((_x) * 0x800)
 #define NFP_QCP_QUEUE_ADD_RPTR                  0x0000
@@ -50,27 +42,11 @@ struct nfp_net_adapter;
 /* Alignment for dma zones */
 #define NFP_MEMZONE_ALIGN	128
 
-/*
- * This is used by the reconfig protocol. It sets the maximum time waiting in
- * milliseconds before a reconfig timeout happens.
- */
-#define NFP_NET_POLL_TIMEOUT    5000
-
 #define NFP_QCP_QUEUE_ADDR_SZ   (0x800)
 
-#define NFP_NET_LINK_DOWN_CHECK_TIMEOUT 4000 /* ms */
-#define NFP_NET_LINK_UP_CHECK_TIMEOUT   1000 /* ms */
-
 /* Number of supported physical ports */
 #define NFP_MAX_PHYPORTS	12
 
-/* Maximum supported NFP frame size (MTU + layer 2 headers) */
-#define NFP_FRAME_SIZE_MAX	10048
-#define DEFAULT_FLBUF_SIZE        9216
-
-#include <linux/types.h>
-#include <rte_io.h>
-
 /* Firmware application ID's */
 enum nfp_app_fw_id {
 	NFP_APP_FW_CORE_NIC               = 0x1,
-- 
2.39.1


  parent reply	other threads:[~2023-09-20 11:35 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 ` Chaoyong He [this message]
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 ` [PATCH 10/13] net/nfp: improve modularazation of flow module Chaoyong He
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-6-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).