]> www.infradead.org Git - users/hch/misc.git/commitdiff
ice, libie: move fwlog code to libie
authorMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tue, 12 Aug 2025 04:23:35 +0000 (06:23 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 11 Sep 2025 19:10:47 +0000 (12:10 -0700)
Move whole code from ice_fwlog.c/h to libie/fwlog.c/h.

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/Kconfig
drivers/net/ethernet/intel/ice/Makefile
drivers/net/ethernet/intel/ice/ice_main.c
drivers/net/ethernet/intel/ice/ice_type.h
drivers/net/ethernet/intel/libie/Kconfig
drivers/net/ethernet/intel/libie/Makefile
drivers/net/ethernet/intel/libie/fwlog.c [moved from drivers/net/ethernet/intel/ice/ice_fwlog.c with 98% similarity]
include/linux/net/intel/libie/adminq.h
include/linux/net/intel/libie/fwlog.h [moved from drivers/net/ethernet/intel/ice/ice_fwlog.h with 98% similarity]

index b05cc0d7a15dcc25ee8d049ee2dbe332822774cc..09f0af386af105db121b22646e727edf6c120b98 100644 (file)
@@ -297,6 +297,7 @@ config ICE
        select DIMLIB
        select LIBIE
        select LIBIE_ADMINQ
+       select LIBIE_FWLOG
        select NET_DEVLINK
        select PACKING
        select PLDMFW
index eac45d7c0cf1f2758ecef870b368e833a3b1b33f..5b2c666496e70a1c3a21d3c01b79e9198c5d798b 100644 (file)
@@ -42,7 +42,6 @@ ice-y := ice_main.o   \
         ice_ethtool.o  \
         ice_repr.o     \
         ice_tc_lib.o   \
-        ice_fwlog.o    \
         ice_debugfs.o  \
         ice_adapter.o
 ice-$(CONFIG_PCI_IOV) +=       \
index 44e184c6c4167bc63932d8a12c3320dcd68ad17f..f0d3aee24a93e9fd820932331ffe91ed29388ced 100644 (file)
@@ -39,6 +39,7 @@ static const char ice_copyright[] = "Copyright (c) 2018, Intel Corporation.";
 MODULE_DESCRIPTION(DRV_SUMMARY);
 MODULE_IMPORT_NS("LIBIE");
 MODULE_IMPORT_NS("LIBIE_ADMINQ");
+MODULE_IMPORT_NS("LIBIE_FWLOG");
 MODULE_LICENSE("GPL v2");
 MODULE_FIRMWARE(ICE_DDP_PKG_FILE);
 
index 14296bccc4c947c221afcc9e3d82de2414279a9c..b0a1b67071c5e4f69b76511b27eca09dc48e380d 100644 (file)
@@ -17,7 +17,7 @@
 #include "ice_protocol_type.h"
 #include "ice_sbq_cmd.h"
 #include "ice_vlan_mode.h"
-#include "ice_fwlog.h"
+#include <linux/net/intel/libie/fwlog.h>
 #include <linux/wait.h>
 #include <net/dscp.h>
 
index e6072758e3d84fd187a7db698e1060dacdedc8bb..70831c7e336e923d6112a9d3113ce281776a306e 100644 (file)
@@ -14,3 +14,12 @@ config LIBIE_ADMINQ
        help
          Helper functions used by Intel Ethernet drivers for administration
          queue command interface (aka adminq).
+
+config LIBIE_FWLOG
+       tristate
+       select LIBIE_ADMINQ
+       help
+         Library to support firmware logging on device that have support
+         for it. Firmware logging is using admin queue interface to communicate
+         with the device. Debugfs is a user interface used to config logging
+         and dump all collected logs.
index e98f00b865d361b86e7cb44fa5405a40aae105bb..db57fc6780ea30492900eba9a83238d811350201 100644 (file)
@@ -8,3 +8,7 @@ libie-y                 := rx.o
 obj-$(CONFIG_LIBIE_ADMINQ)     += libie_adminq.o
 
 libie_adminq-y                 := adminq.o
+
+obj-$(CONFIG_LIBIE_FWLOG)      += libie_fwlog.o
+
+libie_fwlog-y                  := fwlog.o
similarity index 98%
rename from drivers/net/ethernet/intel/ice/ice_fwlog.c
rename to drivers/net/ethernet/intel/libie/fwlog.c
index 8e708619103003e65626d69bbb235992d4b13e81..f39cc11cb7c56b33a4ca71139e4db76d16d3bae5 100644 (file)
@@ -2,12 +2,14 @@
 /* Copyright (c) 2022, Intel Corporation. */
 
 #include <linux/debugfs.h>
+#include <linux/export.h>
 #include <linux/fs.h>
+#include <linux/net/intel/libie/fwlog.h>
+#include <linux/pci.h>
 #include <linux/random.h>
 #include <linux/vmalloc.h>
-#include "ice.h"
-#include "ice_common.h"
-#include "ice_fwlog.h"
+
+#define DEFAULT_SYMBOL_NAMESPACE       "LIBIE_FWLOG"
 
 /* create a define that has an extra module that doesn't really exist. this
  * is so we can add a module 'all' to easily enable/disable all the modules
@@ -1037,6 +1039,7 @@ int libie_fwlog_init(struct libie_fwlog *fwlog, struct libie_fwlog_api *api)
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(libie_fwlog_init);
 
 /**
  * libie_fwlog_deinit - unroll FW logging configuration
@@ -1071,6 +1074,7 @@ void libie_fwlog_deinit(struct libie_fwlog *fwlog)
                kfree(fwlog->ring.rings);
        }
 }
+EXPORT_SYMBOL_GPL(libie_fwlog_deinit);
 
 /**
  * libie_get_fwlog_data - copy the FW log data from ARQ event
@@ -1095,6 +1099,7 @@ void libie_get_fwlog_data(struct libie_fwlog *fwlog, u8 *buf, u16 len)
                libie_fwlog_ring_increment(&fwlog->ring.head, fwlog->ring.size);
        }
 }
+EXPORT_SYMBOL_GPL(libie_get_fwlog_data);
 
 void libie_fwlog_reregister(struct libie_fwlog *fwlog)
 {
@@ -1104,3 +1109,7 @@ void libie_fwlog_reregister(struct libie_fwlog *fwlog)
        if (libie_fwlog_register(fwlog))
                fwlog->cfg.options &= ~LIBIE_FWLOG_OPTION_IS_REGISTERED;
 }
+EXPORT_SYMBOL_GPL(libie_fwlog_reregister);
+
+MODULE_DESCRIPTION("Intel(R) Ethernet common library");
+MODULE_LICENSE("GPL");
index 29420193889a5ac4b58f9add34051ee166ebeb71..ab13bd777a285ded762e9b0ff2bb1231deaa9299 100644 (file)
@@ -265,7 +265,7 @@ enum libie_aqc_fw_logging_mod {
        LIBIE_AQC_FW_LOG_ID_TSDRV,
        LIBIE_AQC_FW_LOG_ID_PFREG,
        LIBIE_AQC_FW_LOG_ID_MDLVER,
-       LIBIE_AQC_FW_LOG_ID_MAX,
+       LIBIE_AQC_FW_LOG_ID_MAX
 };
 
 /* Set FW Logging configuration (indirect 0xFF30)
@@ -280,8 +280,8 @@ enum libie_aqc_fw_logging_mod {
 #define LIBIE_AQC_FW_LOG_AQ_REGISTER           BIT(0)
 #define LIBIE_AQC_FW_LOG_AQ_QUERY              BIT(2)
 
-#define LIBIE_AQC_FW_LOG_MIN_RESOLUTION                (1)
-#define LIBIE_AQC_FW_LOG_MAX_RESOLUTION                (128)
+#define LIBIE_AQC_FW_LOG_MIN_RESOLUTION                1
+#define LIBIE_AQC_FW_LOG_MAX_RESOLUTION                128
 
 struct libie_aqc_fw_log {
        u8 cmd_flags;
similarity index 98%
rename from drivers/net/ethernet/intel/ice/ice_fwlog.h
rename to include/linux/net/intel/libie/fwlog.h
index e534205a2d0433dc48f74ecf19b59ba7aadbfdf9..36b13fabca9ec2a5956dbf843287b17de61c9d0a 100644 (file)
@@ -3,7 +3,8 @@
 
 #ifndef _LIBIE_FWLOG_H_
 #define _LIBIE_FWLOG_H_
-#include "ice_adminq_cmd.h"
+
+#include <linux/net/intel/libie/adminq.h>
 
 /* Only a single log level should be set and all log levels under the set value
  * are enabled, e.g. if log level is set to LIBIE_FW_LOG_LEVEL_VERBOSE, then all