Skip to content

Commit e74e024

Browse files
author
Paolo Abeni
committed
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/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents 1e71cfc + 7ed258f commit e74e024

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ struct hnae3_handle {
845845
struct dentry *hnae3_dbgfs;
846846
/* protects concurrent contention between debugfs commands */
847847
struct mutex dbgfs_lock;
848+
char **dbgfs_buf;
848849

849850
/* Network interface message level enabled bits */
850851
u32 msg_enable;

drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer,
12271227
return ret;
12281228

12291229
mutex_lock(&handle->dbgfs_lock);
1230-
save_buf = &hns3_dbg_cmd[index].buf;
1230+
save_buf = &handle->dbgfs_buf[index];
12311231

12321232
if (!test_bit(HNS3_NIC_STATE_INITED, &priv->state) ||
12331233
test_bit(HNS3_NIC_STATE_RESETTING, &priv->state)) {
@@ -1332,6 +1332,13 @@ int hns3_dbg_init(struct hnae3_handle *handle)
13321332
int ret;
13331333
u32 i;
13341334

1335+
handle->dbgfs_buf = devm_kcalloc(&handle->pdev->dev,
1336+
ARRAY_SIZE(hns3_dbg_cmd),
1337+
sizeof(*handle->dbgfs_buf),
1338+
GFP_KERNEL);
1339+
if (!handle->dbgfs_buf)
1340+
return -ENOMEM;
1341+
13351342
hns3_dbg_dentry[HNS3_DBG_DENTRY_COMMON].dentry =
13361343
debugfs_create_dir(name, hns3_dbgfs_root);
13371344
handle->hnae3_dbgfs = hns3_dbg_dentry[HNS3_DBG_DENTRY_COMMON].dentry;
@@ -1380,9 +1387,9 @@ void hns3_dbg_uninit(struct hnae3_handle *handle)
13801387
u32 i;
13811388

13821389
for (i = 0; i < ARRAY_SIZE(hns3_dbg_cmd); i++)
1383-
if (hns3_dbg_cmd[i].buf) {
1384-
kvfree(hns3_dbg_cmd[i].buf);
1385-
hns3_dbg_cmd[i].buf = NULL;
1390+
if (handle->dbgfs_buf[i]) {
1391+
kvfree(handle->dbgfs_buf[i]);
1392+
handle->dbgfs_buf[i] = NULL;
13861393
}
13871394

13881395
mutex_destroy(&handle->dbgfs_lock);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ struct hns3_dbg_cmd_info {
4949
enum hnae3_dbg_cmd cmd;
5050
enum hns3_dbg_dentry_type dentry;
5151
u32 buf_len;
52-
char *buf;
5352
int (*init)(struct hnae3_handle *handle, unsigned int cmd);
5453
};
5554

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10323,11 +10323,11 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto,
1032310323
}
1032410324

1032510325
if (!ret) {
10326-
if (is_kill)
10327-
hclge_rm_vport_vlan_table(vport, vlan_id, false);
10328-
else
10326+
if (!is_kill)
1032910327
hclge_add_vport_vlan_table(vport, vlan_id,
1033010328
writen_to_tbl);
10329+
else if (is_kill && vlan_id != 0)
10330+
hclge_rm_vport_vlan_table(vport, vlan_id, false);
1033110331
} else if (is_kill) {
1033210332
/* when remove hw vlan filter failed, record the vlan id,
1033310333
* and try to remove it from hw later, to be consistence

0 commit comments

Comments
 (0)