Skip to content

Commit c3886cc

Browse files
committed
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/[email protected] v1: https://lore.kernel.org/[email protected] ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents ce6030a + b0aabb3 commit c3886cc

File tree

8 files changed

+859
-1582
lines changed

8 files changed

+859
-1582
lines changed

drivers/net/ethernet/hisilicon/hns3/hnae3.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,10 @@ enum hnae3_dbg_cmd {
339339
HNAE3_DBG_CMD_UNKNOWN,
340340
};
341341

342+
#define hnae3_seq_file_to_ae_dev(s) (dev_get_drvdata((s)->private))
343+
#define hnae3_seq_file_to_handle(s) \
344+
(((struct hnae3_ae_dev *)hnae3_seq_file_to_ae_dev(s))->handle)
345+
342346
enum hnae3_tc_map_mode {
343347
HNAE3_TC_MAP_MODE_PRIO,
344348
HNAE3_TC_MAP_MODE_DSCP,
@@ -434,8 +438,11 @@ struct hnae3_ae_dev {
434438
u32 dev_version;
435439
DECLARE_BITMAP(caps, HNAE3_DEV_CAPS_MAX_NUM);
436440
void *priv;
441+
struct hnae3_handle *handle;
437442
};
438443

444+
typedef int (*read_func)(struct seq_file *s, void *data);
445+
439446
/* This struct defines the operation on the handle.
440447
*
441448
* init_ae_dev(): (mandatory)
@@ -580,8 +587,6 @@ struct hnae3_ae_dev {
580587
* Delete clsflower rule
581588
* cls_flower_active
582589
* Check if any cls flower rule exist
583-
* dbg_read_cmd
584-
* Execute debugfs read command.
585590
* set_tx_hwts_info
586591
* Save information for 1588 tx packet
587592
* get_rx_hwts
@@ -594,6 +599,8 @@ struct hnae3_ae_dev {
594599
* Get wake on lan info
595600
* set_wol
596601
* Config wake on lan
602+
* dbg_get_read_func
603+
* Return the read func for debugfs seq file
597604
*/
598605
struct hnae3_ae_ops {
599606
int (*init_ae_dev)(struct hnae3_ae_dev *ae_dev);
@@ -748,8 +755,6 @@ struct hnae3_ae_ops {
748755
void (*enable_fd)(struct hnae3_handle *handle, bool enable);
749756
int (*add_arfs_entry)(struct hnae3_handle *handle, u16 queue_id,
750757
u16 flow_id, struct flow_keys *fkeys);
751-
int (*dbg_read_cmd)(struct hnae3_handle *handle, enum hnae3_dbg_cmd cmd,
752-
char *buf, int len);
753758
pci_ers_result_t (*handle_hw_ras_error)(struct hnae3_ae_dev *ae_dev);
754759
bool (*get_hw_reset_stat)(struct hnae3_handle *handle);
755760
bool (*ae_dev_resetting)(struct hnae3_handle *handle);
@@ -796,6 +801,9 @@ struct hnae3_ae_ops {
796801
struct ethtool_wolinfo *wol);
797802
int (*set_wol)(struct hnae3_handle *handle,
798803
struct ethtool_wolinfo *wol);
804+
int (*dbg_get_read_func)(struct hnae3_handle *handle,
805+
enum hnae3_dbg_cmd cmd,
806+
read_func *func);
799807
};
800808

801809
struct hnae3_dcb_ops {

0 commit comments

Comments
 (0)