File Index
Files and directories
Sign in
FILE

fbnic_fw_log.h

File preview with syntax highlighting.

linux-6.19.14/drivers/net/ethernet/meta/fbnic/fbnic_fw_log.h C
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/* Copyright (c) Meta Platforms, Inc. and affiliates. */
 3
 4#ifndef _FBNIC_FW_LOG_H_
 5#define _FBNIC_FW_LOG_H_
 6
 7#include <linux/spinlock.h>
 8#include <linux/types.h>
 9
10/* A 512K log buffer was chosen fairly arbitrarily */
11#define FBNIC_FW_LOG_SIZE	(512 * 1024) /* bytes */
12
13/* Firmware log output is prepended with log index followed by a timestamp.
14 * The timestamp is similar to Zephyr's format DD:HH:MM:SS.MMM
15 */
16#define FBNIC_FW_LOG_FMT	"[%5lld] [%02ld:%02ld:%02ld:%02ld.%03ld] %s\n"
17
18struct fbnic_dev;
19
20struct fbnic_fw_log_entry {
21	struct list_head	list;
22	u64			index;
23	u32			timestamp;
24	u16			len;
25	char			msg[] __counted_by(len);
26};
27
28struct fbnic_fw_log {
29	void			*data_start;
30	void			*data_end;
31	size_t			size;
32	struct list_head	entries;
33	/* Spin lock for accessing or modifying entries */
34	spinlock_t		lock;
35};
36
37#define fbnic_fw_log_ready(_fbd)	(!!(_fbd)->fw_log.data_start)
38
39void fbnic_fw_log_enable(struct fbnic_dev *fbd, bool send_hist);
40void fbnic_fw_log_disable(struct fbnic_dev *fbd);
41int fbnic_fw_log_init(struct fbnic_dev *fbd);
42void fbnic_fw_log_free(struct fbnic_dev *fbd);
43int fbnic_fw_log_write(struct fbnic_dev *fbd, u64 index, u32 timestamp,
44		       const char *msg);
45#endif /* _FBNIC_FW_LOG_H_ */
~/ Read-only file preview.