Commit e74e0244 authored by Paolo Abeni's avatar Paolo Abeni

Merge branch 'net-hns3-add-two-fixes-for-net'

Guangbin Huang says:

====================
net: hns3: add two fixes for -net

This series adds two fixes for the HNS3 ethernet driver.
====================

Link: https://lore.kernel.org/r/20220330134506.36635-1-huangguangbin2@huawei.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents 1e71cfcf 7ed258f1
...@@ -845,6 +845,7 @@ struct hnae3_handle { ...@@ -845,6 +845,7 @@ struct hnae3_handle {
struct dentry *hnae3_dbgfs; struct dentry *hnae3_dbgfs;
/* protects concurrent contention between debugfs commands */ /* protects concurrent contention between debugfs commands */
struct mutex dbgfs_lock; struct mutex dbgfs_lock;
char **dbgfs_buf;
/* Network interface message level enabled bits */ /* Network interface message level enabled bits */
u32 msg_enable; u32 msg_enable;
......
...@@ -1227,7 +1227,7 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer, ...@@ -1227,7 +1227,7 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer,
return ret; return ret;
mutex_lock(&handle->dbgfs_lock); mutex_lock(&handle->dbgfs_lock);
save_buf = &hns3_dbg_cmd[index].buf; save_buf = &handle->dbgfs_buf[index];
if (!test_bit(HNS3_NIC_STATE_INITED, &priv->state) || if (!test_bit(HNS3_NIC_STATE_INITED, &priv->state) ||
test_bit(HNS3_NIC_STATE_RESETTING, &priv->state)) { test_bit(HNS3_NIC_STATE_RESETTING, &priv->state)) {
...@@ -1332,6 +1332,13 @@ int hns3_dbg_init(struct hnae3_handle *handle) ...@@ -1332,6 +1332,13 @@ int hns3_dbg_init(struct hnae3_handle *handle)
int ret; int ret;
u32 i; u32 i;
handle->dbgfs_buf = devm_kcalloc(&handle->pdev->dev,
ARRAY_SIZE(hns3_dbg_cmd),
sizeof(*handle->dbgfs_buf),
GFP_KERNEL);
if (!handle->dbgfs_buf)
return -ENOMEM;
hns3_dbg_dentry[HNS3_DBG_DENTRY_COMMON].dentry = hns3_dbg_dentry[HNS3_DBG_DENTRY_COMMON].dentry =
debugfs_create_dir(name, hns3_dbgfs_root); debugfs_create_dir(name, hns3_dbgfs_root);
handle->hnae3_dbgfs = hns3_dbg_dentry[HNS3_DBG_DENTRY_COMMON].dentry; handle->hnae3_dbgfs = hns3_dbg_dentry[HNS3_DBG_DENTRY_COMMON].dentry;
...@@ -1380,9 +1387,9 @@ void hns3_dbg_uninit(struct hnae3_handle *handle) ...@@ -1380,9 +1387,9 @@ void hns3_dbg_uninit(struct hnae3_handle *handle)
u32 i; u32 i;
for (i = 0; i < ARRAY_SIZE(hns3_dbg_cmd); i++) for (i = 0; i < ARRAY_SIZE(hns3_dbg_cmd); i++)
if (hns3_dbg_cmd[i].buf) { if (handle->dbgfs_buf[i]) {
kvfree(hns3_dbg_cmd[i].buf); kvfree(handle->dbgfs_buf[i]);
hns3_dbg_cmd[i].buf = NULL; handle->dbgfs_buf[i] = NULL;
} }
mutex_destroy(&handle->dbgfs_lock); mutex_destroy(&handle->dbgfs_lock);
......
...@@ -49,7 +49,6 @@ struct hns3_dbg_cmd_info { ...@@ -49,7 +49,6 @@ struct hns3_dbg_cmd_info {
enum hnae3_dbg_cmd cmd; enum hnae3_dbg_cmd cmd;
enum hns3_dbg_dentry_type dentry; enum hns3_dbg_dentry_type dentry;
u32 buf_len; u32 buf_len;
char *buf;
int (*init)(struct hnae3_handle *handle, unsigned int cmd); int (*init)(struct hnae3_handle *handle, unsigned int cmd);
}; };
......
...@@ -10323,11 +10323,11 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto, ...@@ -10323,11 +10323,11 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto,
} }
if (!ret) { if (!ret) {
if (is_kill) if (!is_kill)
hclge_rm_vport_vlan_table(vport, vlan_id, false);
else
hclge_add_vport_vlan_table(vport, vlan_id, hclge_add_vport_vlan_table(vport, vlan_id,
writen_to_tbl); writen_to_tbl);
else if (is_kill && vlan_id != 0)
hclge_rm_vport_vlan_table(vport, vlan_id, false);
} else if (is_kill) { } else if (is_kill) {
/* when remove hw vlan filter failed, record the vlan id, /* when remove hw vlan filter failed, record the vlan id,
* and try to remove it from hw later, to be consistence * and try to remove it from hw later, to be consistence
......
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