Commit 366c7bb0 authored by David S. Miller's avatar David S. Miller

Merge branch 'hns3-next'

Huazhong Tan says:

====================
net: hns3: some optimizaions related to work task

This series refactors the work task of the HNS3 ethernet driver.

[patch 1/5] uses delayed workqueue to replace the timer for
hclgevf_service task, make the code simpler.

[patch 2/5] & [patch 3/5] unifies current mailbox, reset and
service work into one.

[patch 4/5] allocates a private work queue with WQ_MEM_RECLAIM
for the HNS3 driver.

[patch 5/5] adds a new flag to indicate whether reset fails,
and prevent scheduling service task to handle periodic task
when this flag has been set.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 54e1f08b d5432455
...@@ -976,6 +976,14 @@ void hclge_dbg_dump_rst_info(struct hclge_dev *hdev) ...@@ -976,6 +976,14 @@ void hclge_dbg_dump_rst_info(struct hclge_dev *hdev)
dev_info(&hdev->pdev->dev, "hdev state: 0x%lx\n", hdev->state); dev_info(&hdev->pdev->dev, "hdev state: 0x%lx\n", hdev->state);
} }
static void hclge_dbg_dump_serv_info(struct hclge_dev *hdev)
{
dev_info(&hdev->pdev->dev, "last_serv_processed: %lu\n",
hdev->last_serv_processed);
dev_info(&hdev->pdev->dev, "last_serv_cnt: %lu\n",
hdev->serv_processed_cnt);
}
static void hclge_dbg_get_m7_stats_info(struct hclge_dev *hdev) static void hclge_dbg_get_m7_stats_info(struct hclge_dev *hdev)
{ {
struct hclge_desc *desc_src, *desc_tmp; struct hclge_desc *desc_src, *desc_tmp;
...@@ -1227,6 +1235,8 @@ int hclge_dbg_run_cmd(struct hnae3_handle *handle, const char *cmd_buf) ...@@ -1227,6 +1235,8 @@ int hclge_dbg_run_cmd(struct hnae3_handle *handle, const char *cmd_buf)
hclge_dbg_dump_reg_cmd(hdev, &cmd_buf[sizeof(DUMP_REG)]); hclge_dbg_dump_reg_cmd(hdev, &cmd_buf[sizeof(DUMP_REG)]);
} else if (strncmp(cmd_buf, "dump reset info", 15) == 0) { } else if (strncmp(cmd_buf, "dump reset info", 15) == 0) {
hclge_dbg_dump_rst_info(hdev); hclge_dbg_dump_rst_info(hdev);
} else if (strncmp(cmd_buf, "dump serv info", 14) == 0) {
hclge_dbg_dump_serv_info(hdev);
} else if (strncmp(cmd_buf, "dump m7 info", 12) == 0) { } else if (strncmp(cmd_buf, "dump m7 info", 12) == 0) {
hclge_dbg_get_m7_stats_info(hdev); hclge_dbg_get_m7_stats_info(hdev);
} else if (strncmp(cmd_buf, "dump ncl_config", 15) == 0) { } else if (strncmp(cmd_buf, "dump ncl_config", 15) == 0) {
......
...@@ -208,13 +208,14 @@ enum HCLGE_DEV_STATE { ...@@ -208,13 +208,14 @@ enum HCLGE_DEV_STATE {
HCLGE_STATE_NIC_REGISTERED, HCLGE_STATE_NIC_REGISTERED,
HCLGE_STATE_ROCE_REGISTERED, HCLGE_STATE_ROCE_REGISTERED,
HCLGE_STATE_SERVICE_INITED, HCLGE_STATE_SERVICE_INITED,
HCLGE_STATE_SERVICE_SCHED,
HCLGE_STATE_RST_SERVICE_SCHED, HCLGE_STATE_RST_SERVICE_SCHED,
HCLGE_STATE_RST_HANDLING, HCLGE_STATE_RST_HANDLING,
HCLGE_STATE_MBX_SERVICE_SCHED, HCLGE_STATE_MBX_SERVICE_SCHED,
HCLGE_STATE_MBX_HANDLING, HCLGE_STATE_MBX_HANDLING,
HCLGE_STATE_STATISTICS_UPDATING, HCLGE_STATE_STATISTICS_UPDATING,
HCLGE_STATE_CMD_DISABLE, HCLGE_STATE_CMD_DISABLE,
HCLGE_STATE_LINK_UPDATING,
HCLGE_STATE_RST_FAIL,
HCLGE_STATE_MAX HCLGE_STATE_MAX
}; };
...@@ -454,11 +455,7 @@ struct hclge_mac_stats { ...@@ -454,11 +455,7 @@ struct hclge_mac_stats {
u64 mac_rx_ctrl_pkt_num; u64 mac_rx_ctrl_pkt_num;
}; };
#define HCLGE_STATS_TIMER_INTERVAL (60 * 5) #define HCLGE_STATS_TIMER_INTERVAL 300UL
struct hclge_hw_stats {
struct hclge_mac_stats mac_stats;
u32 stats_timer;
};
struct hclge_vlan_type_cfg { struct hclge_vlan_type_cfg {
u16 rx_ot_fst_vlan_type; u16 rx_ot_fst_vlan_type;
...@@ -549,7 +546,7 @@ struct key_info { ...@@ -549,7 +546,7 @@ struct key_info {
/* assigned by firmware, the real filter number for each pf may be less */ /* assigned by firmware, the real filter number for each pf may be less */
#define MAX_FD_FILTER_NUM 4096 #define MAX_FD_FILTER_NUM 4096
#define HCLGE_FD_ARFS_EXPIRE_TIMER_INTERVAL 5 #define HCLGE_ARFS_EXPIRE_INTERVAL 5UL
enum HCLGE_FD_ACTIVE_RULE_TYPE { enum HCLGE_FD_ACTIVE_RULE_TYPE {
HCLGE_FD_RULE_NONE, HCLGE_FD_RULE_NONE,
...@@ -712,7 +709,7 @@ struct hclge_dev { ...@@ -712,7 +709,7 @@ struct hclge_dev {
struct hnae3_ae_dev *ae_dev; struct hnae3_ae_dev *ae_dev;
struct hclge_hw hw; struct hclge_hw hw;
struct hclge_misc_vector misc_vector; struct hclge_misc_vector misc_vector;
struct hclge_hw_stats hw_stats; struct hclge_mac_stats mac_stats;
unsigned long state; unsigned long state;
unsigned long flr_state; unsigned long flr_state;
unsigned long last_reset_time; unsigned long last_reset_time;
...@@ -774,8 +771,6 @@ struct hclge_dev { ...@@ -774,8 +771,6 @@ struct hclge_dev {
unsigned long service_timer_previous; unsigned long service_timer_previous;
struct timer_list reset_timer; struct timer_list reset_timer;
struct delayed_work service_task; struct delayed_work service_task;
struct work_struct rst_service_task;
struct work_struct mbx_service_task;
bool cur_promisc; bool cur_promisc;
int num_alloc_vfs; /* Actual number of VFs allocated */ int num_alloc_vfs; /* Actual number of VFs allocated */
...@@ -811,7 +806,8 @@ struct hclge_dev { ...@@ -811,7 +806,8 @@ struct hclge_dev {
struct hlist_head fd_rule_list; struct hlist_head fd_rule_list;
spinlock_t fd_rule_lock; /* protect fd_rule_list and fd_bmap */ spinlock_t fd_rule_lock; /* protect fd_rule_list and fd_bmap */
u16 hclge_fd_rule_num; u16 hclge_fd_rule_num;
u16 fd_arfs_expire_timer; unsigned long serv_processed_cnt;
unsigned long last_serv_processed;
unsigned long fd_bmap[BITS_TO_LONGS(MAX_FD_FILTER_NUM)]; unsigned long fd_bmap[BITS_TO_LONGS(MAX_FD_FILTER_NUM)];
enum HCLGE_FD_ACTIVE_RULE_TYPE fd_active_type; enum HCLGE_FD_ACTIVE_RULE_TYPE fd_active_type;
u8 fd_en; u8 fd_en;
......
...@@ -635,7 +635,6 @@ static void hclge_handle_link_change_event(struct hclge_dev *hdev, ...@@ -635,7 +635,6 @@ static void hclge_handle_link_change_event(struct hclge_dev *hdev,
#define LINK_STATUS_OFFSET 1 #define LINK_STATUS_OFFSET 1
#define LINK_FAIL_CODE_OFFSET 2 #define LINK_FAIL_CODE_OFFSET 2
clear_bit(HCLGE_STATE_SERVICE_SCHED, &hdev->state);
hclge_task_schedule(hdev, 0); hclge_task_schedule(hdev, 0);
if (!req->msg[LINK_STATUS_OFFSET]) if (!req->msg[LINK_STATUS_OFFSET])
......
...@@ -142,12 +142,13 @@ enum hclgevf_states { ...@@ -142,12 +142,13 @@ enum hclgevf_states {
HCLGEVF_STATE_REMOVING, HCLGEVF_STATE_REMOVING,
HCLGEVF_STATE_NIC_REGISTERED, HCLGEVF_STATE_NIC_REGISTERED,
/* task states */ /* task states */
HCLGEVF_STATE_SERVICE_SCHED,
HCLGEVF_STATE_RST_SERVICE_SCHED, HCLGEVF_STATE_RST_SERVICE_SCHED,
HCLGEVF_STATE_RST_HANDLING, HCLGEVF_STATE_RST_HANDLING,
HCLGEVF_STATE_MBX_SERVICE_SCHED, HCLGEVF_STATE_MBX_SERVICE_SCHED,
HCLGEVF_STATE_MBX_HANDLING, HCLGEVF_STATE_MBX_HANDLING,
HCLGEVF_STATE_CMD_DISABLE, HCLGEVF_STATE_CMD_DISABLE,
HCLGEVF_STATE_LINK_UPDATING,
HCLGEVF_STATE_RST_FAIL,
}; };
struct hclgevf_mac { struct hclgevf_mac {
...@@ -283,12 +284,7 @@ struct hclgevf_dev { ...@@ -283,12 +284,7 @@ struct hclgevf_dev {
struct hclgevf_mbx_resp_status mbx_resp; /* mailbox response */ struct hclgevf_mbx_resp_status mbx_resp; /* mailbox response */
struct hclgevf_mbx_arq_ring arq; /* mailbox async rx queue */ struct hclgevf_mbx_arq_ring arq; /* mailbox async rx queue */
struct timer_list service_timer; struct delayed_work service_task;
struct timer_list keep_alive_timer;
struct work_struct service_task;
struct work_struct keep_alive_task;
struct work_struct rst_service_task;
struct work_struct mbx_service_task;
struct hclgevf_tqp *htqp; struct hclgevf_tqp *htqp;
...@@ -298,7 +294,8 @@ struct hclgevf_dev { ...@@ -298,7 +294,8 @@ struct hclgevf_dev {
struct hnae3_client *nic_client; struct hnae3_client *nic_client;
struct hnae3_client *roce_client; struct hnae3_client *roce_client;
u32 flag; u32 flag;
u32 stats_timer; unsigned long serv_processed_cnt;
unsigned long last_serv_processed;
}; };
static inline bool hclgevf_is_reset_pending(struct hclgevf_dev *hdev) static inline bool hclgevf_is_reset_pending(struct hclgevf_dev *hdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment