Commit c3886cca authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'net-hns3-use-seq_file-for-debugfs'

Jijie Shao says:

====================
net: hns3: use seq_file for debugfs

Arnd reported that there are two build warning for on-stasck
buffer oversize. As Arnd's suggestion, using seq file way
to avoid the stack buffer or kmalloc buffer allocating.

v2: https://lore.kernel.org/20250711061725.225585-1-shaojijie@huawei.com
v1: https://lore.kernel.org/20250708130029.1310872-1-shaojijie@huawei.com
====================

Link: https://patch.msgid.link/20250714061037.2616413-1-shaojijie@huawei.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents ce6030af b0aabb3b
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -339,6 +339,10 @@ enum hnae3_dbg_cmd {
	HNAE3_DBG_CMD_UNKNOWN,
};

#define hnae3_seq_file_to_ae_dev(s)	(dev_get_drvdata((s)->private))
#define hnae3_seq_file_to_handle(s)	\
		(((struct hnae3_ae_dev *)hnae3_seq_file_to_ae_dev(s))->handle)

enum hnae3_tc_map_mode {
	HNAE3_TC_MAP_MODE_PRIO,
	HNAE3_TC_MAP_MODE_DSCP,
@@ -434,8 +438,11 @@ struct hnae3_ae_dev {
	u32 dev_version;
	DECLARE_BITMAP(caps, HNAE3_DEV_CAPS_MAX_NUM);
	void *priv;
	struct hnae3_handle *handle;
};

typedef int (*read_func)(struct seq_file *s, void *data);

/* This struct defines the operation on the handle.
 *
 * init_ae_dev(): (mandatory)
@@ -580,8 +587,6 @@ struct hnae3_ae_dev {
 *   Delete clsflower rule
 * cls_flower_active
 *   Check if any cls flower rule exist
 * dbg_read_cmd
 *   Execute debugfs read command.
 * set_tx_hwts_info
 *   Save information for 1588 tx packet
 * get_rx_hwts
@@ -594,6 +599,8 @@ struct hnae3_ae_dev {
 *   Get wake on lan info
 * set_wol
 *   Config wake on lan
 * dbg_get_read_func
 *   Return the read func for debugfs seq file
 */
struct hnae3_ae_ops {
	int (*init_ae_dev)(struct hnae3_ae_dev *ae_dev);
@@ -748,8 +755,6 @@ struct hnae3_ae_ops {
	void (*enable_fd)(struct hnae3_handle *handle, bool enable);
	int (*add_arfs_entry)(struct hnae3_handle *handle, u16 queue_id,
			      u16 flow_id, struct flow_keys *fkeys);
	int (*dbg_read_cmd)(struct hnae3_handle *handle, enum hnae3_dbg_cmd cmd,
			    char *buf, int len);
	pci_ers_result_t (*handle_hw_ras_error)(struct hnae3_ae_dev *ae_dev);
	bool (*get_hw_reset_stat)(struct hnae3_handle *handle);
	bool (*ae_dev_resetting)(struct hnae3_handle *handle);
@@ -796,6 +801,9 @@ struct hnae3_ae_ops {
			struct ethtool_wolinfo *wol);
	int (*set_wol)(struct hnae3_handle *handle,
		       struct ethtool_wolinfo *wol);
	int (*dbg_get_read_func)(struct hnae3_handle *handle,
				 enum hnae3_dbg_cmd cmd,
				 read_func *func);
};

struct hnae3_dcb_ops {
+301 −743

File changed.

Preview size limit exceeded, changes collapsed.

+0 −16
Original line number Diff line number Diff line
@@ -6,15 +6,6 @@

#include "hnae3.h"

#define HNS3_DBG_READ_LEN	65536
#define HNS3_DBG_READ_LEN_128KB	0x20000
#define HNS3_DBG_READ_LEN_1MB	0x100000
#define HNS3_DBG_READ_LEN_4MB	0x400000
#define HNS3_DBG_READ_LEN_5MB	0x500000
#define HNS3_DBG_WRITE_LEN	1024

#define HNS3_DBG_DATA_STR_LEN	32
#define HNS3_DBG_INFO_LEN	256
#define HNS3_DBG_ITEM_NAME_LEN	32
#define HNS3_DBG_FILE_NAME_LEN	16

@@ -49,16 +40,9 @@ struct hns3_dbg_cmd_info {
	const char *name;
	enum hnae3_dbg_cmd cmd;
	enum hns3_dbg_dentry_type dentry;
	u32 buf_len;
	int (*init)(struct hnae3_handle *handle, unsigned int cmd);
};

struct hns3_dbg_func {
	enum hnae3_dbg_cmd cmd;
	int (*dbg_dump)(struct hnae3_handle *handle, char *buf, int len);
	int (*dbg_dump_bd)(struct hns3_dbg_data *data, char *buf, int len);
};

struct hns3_dbg_cap_info {
	const char *name;
	enum HNAE3_DEV_CAP_BITS cap_bit;
+2 −0
Original line number Diff line number Diff line
@@ -5299,6 +5299,8 @@ static int hns3_client_init(struct hnae3_handle *handle)
	struct net_device *netdev;
	int ret;

	ae_dev->handle = handle;

	handle->ae_algo->ops->get_tqps_and_rss_info(handle, &alloc_tqps,
						    &max_rss_size);
	netdev = alloc_etherdev_mq(sizeof(struct hns3_nic_priv), alloc_tqps);
+540 −816

File changed.

Preview size limit exceeded, changes collapsed.

Loading