Skip to content

Commit f3b3fc1

Browse files
Michal Swiatkowskianguy11
authored andcommitted
ice, libie: move fwlog code to libie
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>
1 parent 4b5f288 commit f3b3fc1

File tree

9 files changed

+33
-9
lines changed

9 files changed

+33
-9
lines changed

drivers/net/ethernet/intel/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ config ICE
297297
select DIMLIB
298298
select LIBIE
299299
select LIBIE_ADMINQ
300+
select LIBIE_FWLOG
300301
select NET_DEVLINK
301302
select PACKING
302303
select PLDMFW

drivers/net/ethernet/intel/ice/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ ice-y := ice_main.o \
4242
ice_ethtool.o \
4343
ice_repr.o \
4444
ice_tc_lib.o \
45-
ice_fwlog.o \
4645
ice_debugfs.o \
4746
ice_adapter.o
4847
ice-$(CONFIG_PCI_IOV) += \

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ static const char ice_copyright[] = "Copyright (c) 2018, Intel Corporation.";
3939
MODULE_DESCRIPTION(DRV_SUMMARY);
4040
MODULE_IMPORT_NS("LIBIE");
4141
MODULE_IMPORT_NS("LIBIE_ADMINQ");
42+
MODULE_IMPORT_NS("LIBIE_FWLOG");
4243
MODULE_LICENSE("GPL v2");
4344
MODULE_FIRMWARE(ICE_DDP_PKG_FILE);
4445

drivers/net/ethernet/intel/ice/ice_type.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "ice_protocol_type.h"
1818
#include "ice_sbq_cmd.h"
1919
#include "ice_vlan_mode.h"
20-
#include "ice_fwlog.h"
20+
#include <linux/net/intel/libie/fwlog.h>
2121
#include <linux/wait.h>
2222
#include <net/dscp.h>
2323

drivers/net/ethernet/intel/libie/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,12 @@ config LIBIE_ADMINQ
1414
help
1515
Helper functions used by Intel Ethernet drivers for administration
1616
queue command interface (aka adminq).
17+
18+
config LIBIE_FWLOG
19+
tristate
20+
select LIBIE_ADMINQ
21+
help
22+
Library to support firmware logging on device that have support
23+
for it. Firmware logging is using admin queue interface to communicate
24+
with the device. Debugfs is a user interface used to config logging
25+
and dump all collected logs.

drivers/net/ethernet/intel/libie/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ libie-y := rx.o
88
obj-$(CONFIG_LIBIE_ADMINQ) += libie_adminq.o
99

1010
libie_adminq-y := adminq.o
11+
12+
obj-$(CONFIG_LIBIE_FWLOG) += libie_fwlog.o
13+
14+
libie_fwlog-y := fwlog.o

drivers/net/ethernet/intel/ice/ice_fwlog.c renamed to drivers/net/ethernet/intel/libie/fwlog.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
/* Copyright (c) 2022, Intel Corporation. */
33

44
#include <linux/debugfs.h>
5+
#include <linux/export.h>
56
#include <linux/fs.h>
7+
#include <linux/net/intel/libie/fwlog.h>
8+
#include <linux/pci.h>
69
#include <linux/random.h>
710
#include <linux/vmalloc.h>
8-
#include "ice.h"
9-
#include "ice_common.h"
10-
#include "ice_fwlog.h"
11+
12+
#define DEFAULT_SYMBOL_NAMESPACE "LIBIE_FWLOG"
1113

1214
/* create a define that has an extra module that doesn't really exist. this
1315
* 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)
10371039

10381040
return 0;
10391041
}
1042+
EXPORT_SYMBOL_GPL(libie_fwlog_init);
10401043

10411044
/**
10421045
* libie_fwlog_deinit - unroll FW logging configuration
@@ -1071,6 +1074,7 @@ void libie_fwlog_deinit(struct libie_fwlog *fwlog)
10711074
kfree(fwlog->ring.rings);
10721075
}
10731076
}
1077+
EXPORT_SYMBOL_GPL(libie_fwlog_deinit);
10741078

10751079
/**
10761080
* 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)
10951099
libie_fwlog_ring_increment(&fwlog->ring.head, fwlog->ring.size);
10961100
}
10971101
}
1102+
EXPORT_SYMBOL_GPL(libie_get_fwlog_data);
10981103

10991104
void libie_fwlog_reregister(struct libie_fwlog *fwlog)
11001105
{
@@ -1104,3 +1109,7 @@ void libie_fwlog_reregister(struct libie_fwlog *fwlog)
11041109
if (libie_fwlog_register(fwlog))
11051110
fwlog->cfg.options &= ~LIBIE_FWLOG_OPTION_IS_REGISTERED;
11061111
}
1112+
EXPORT_SYMBOL_GPL(libie_fwlog_reregister);
1113+
1114+
MODULE_DESCRIPTION("Intel(R) Ethernet common library");
1115+
MODULE_LICENSE("GPL");

include/linux/net/intel/libie/adminq.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ enum libie_aqc_fw_logging_mod {
265265
LIBIE_AQC_FW_LOG_ID_TSDRV,
266266
LIBIE_AQC_FW_LOG_ID_PFREG,
267267
LIBIE_AQC_FW_LOG_ID_MDLVER,
268-
LIBIE_AQC_FW_LOG_ID_MAX,
268+
LIBIE_AQC_FW_LOG_ID_MAX
269269
};
270270

271271
/* Set FW Logging configuration (indirect 0xFF30)
@@ -280,8 +280,8 @@ enum libie_aqc_fw_logging_mod {
280280
#define LIBIE_AQC_FW_LOG_AQ_REGISTER BIT(0)
281281
#define LIBIE_AQC_FW_LOG_AQ_QUERY BIT(2)
282282

283-
#define LIBIE_AQC_FW_LOG_MIN_RESOLUTION (1)
284-
#define LIBIE_AQC_FW_LOG_MAX_RESOLUTION (128)
283+
#define LIBIE_AQC_FW_LOG_MIN_RESOLUTION 1
284+
#define LIBIE_AQC_FW_LOG_MAX_RESOLUTION 128
285285

286286
struct libie_aqc_fw_log {
287287
u8 cmd_flags;

drivers/net/ethernet/intel/ice/ice_fwlog.h renamed to include/linux/net/intel/libie/fwlog.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
#ifndef _LIBIE_FWLOG_H_
55
#define _LIBIE_FWLOG_H_
6-
#include "ice_adminq_cmd.h"
6+
7+
#include <linux/net/intel/libie/adminq.h>
78

89
/* Only a single log level should be set and all log levels under the set value
910
* are enabled, e.g. if log level is set to LIBIE_FW_LOG_LEVEL_VERBOSE, then all

0 commit comments

Comments
 (0)