@@ -5806,9 +5806,9 @@ static int hclge_add_fd_entry(struct hnae3_handle *handle,
5806
5806
/* to avoid rule conflict, when user configure rule by ethtool,
5807
5807
* we need to clear all arfs rules
5808
5808
*/
5809
+ spin_lock_bh (& hdev -> fd_rule_lock );
5809
5810
hclge_clear_arfs_rules (handle );
5810
5811
5811
- spin_lock_bh (& hdev -> fd_rule_lock );
5812
5812
ret = hclge_fd_config_rule (hdev , rule );
5813
5813
5814
5814
spin_unlock_bh (& hdev -> fd_rule_lock );
@@ -5851,6 +5851,7 @@ static int hclge_del_fd_entry(struct hnae3_handle *handle,
5851
5851
return ret ;
5852
5852
}
5853
5853
5854
+ /* make sure being called after lock up with fd_rule_lock */
5854
5855
static void hclge_del_all_fd_entries (struct hnae3_handle * handle ,
5855
5856
bool clear_list )
5856
5857
{
@@ -5863,7 +5864,6 @@ static void hclge_del_all_fd_entries(struct hnae3_handle *handle,
5863
5864
if (!hnae3_dev_fd_supported (hdev ))
5864
5865
return ;
5865
5866
5866
- spin_lock_bh (& hdev -> fd_rule_lock );
5867
5867
for_each_set_bit (location , hdev -> fd_bmap ,
5868
5868
hdev -> fd_cfg .rule_num [HCLGE_FD_STAGE_1 ])
5869
5869
hclge_fd_tcam_config (hdev , HCLGE_FD_STAGE_1 , true, location ,
@@ -5880,8 +5880,6 @@ static void hclge_del_all_fd_entries(struct hnae3_handle *handle,
5880
5880
bitmap_zero (hdev -> fd_bmap ,
5881
5881
hdev -> fd_cfg .rule_num [HCLGE_FD_STAGE_1 ]);
5882
5882
}
5883
-
5884
- spin_unlock_bh (& hdev -> fd_rule_lock );
5885
5883
}
5886
5884
5887
5885
static int hclge_restore_fd_entries (struct hnae3_handle * handle )
@@ -6263,7 +6261,7 @@ static int hclge_add_fd_entry_by_arfs(struct hnae3_handle *handle, u16 queue_id,
6263
6261
u16 flow_id , struct flow_keys * fkeys )
6264
6262
{
6265
6263
struct hclge_vport * vport = hclge_get_vport (handle );
6266
- struct hclge_fd_rule_tuples new_tuples ;
6264
+ struct hclge_fd_rule_tuples new_tuples = {} ;
6267
6265
struct hclge_dev * hdev = vport -> back ;
6268
6266
struct hclge_fd_rule * rule ;
6269
6267
u16 tmp_queue_id ;
@@ -6273,19 +6271,17 @@ static int hclge_add_fd_entry_by_arfs(struct hnae3_handle *handle, u16 queue_id,
6273
6271
if (!hnae3_dev_fd_supported (hdev ))
6274
6272
return - EOPNOTSUPP ;
6275
6273
6276
- memset (& new_tuples , 0 , sizeof (new_tuples ));
6277
- hclge_fd_get_flow_tuples (fkeys , & new_tuples );
6278
-
6279
- spin_lock_bh (& hdev -> fd_rule_lock );
6280
-
6281
6274
/* when there is already fd rule existed add by user,
6282
6275
* arfs should not work
6283
6276
*/
6277
+ spin_lock_bh (& hdev -> fd_rule_lock );
6284
6278
if (hdev -> fd_active_type == HCLGE_FD_EP_ACTIVE ) {
6285
6279
spin_unlock_bh (& hdev -> fd_rule_lock );
6286
6280
return - EOPNOTSUPP ;
6287
6281
}
6288
6282
6283
+ hclge_fd_get_flow_tuples (fkeys , & new_tuples );
6284
+
6289
6285
/* check is there flow director filter existed for this flow,
6290
6286
* if not, create a new filter for it;
6291
6287
* if filter exist with different queue id, modify the filter;
@@ -6368,6 +6364,7 @@ static void hclge_rfs_filter_expire(struct hclge_dev *hdev)
6368
6364
#endif
6369
6365
}
6370
6366
6367
+ /* make sure being called after lock up with fd_rule_lock */
6371
6368
static void hclge_clear_arfs_rules (struct hnae3_handle * handle )
6372
6369
{
6373
6370
#ifdef CONFIG_RFS_ACCEL
@@ -6420,10 +6417,14 @@ static void hclge_enable_fd(struct hnae3_handle *handle, bool enable)
6420
6417
6421
6418
hdev -> fd_en = enable ;
6422
6419
clear = hdev -> fd_active_type == HCLGE_FD_ARFS_ACTIVE ;
6423
- if (!enable )
6420
+
6421
+ if (!enable ) {
6422
+ spin_lock_bh (& hdev -> fd_rule_lock );
6424
6423
hclge_del_all_fd_entries (handle , clear );
6425
- else
6424
+ spin_unlock_bh (& hdev -> fd_rule_lock );
6425
+ } else {
6426
6426
hclge_restore_fd_entries (handle );
6427
+ }
6427
6428
}
6428
6429
6429
6430
static void hclge_cfg_mac_mode (struct hclge_dev * hdev , bool enable )
@@ -6886,8 +6887,9 @@ static void hclge_ae_stop(struct hnae3_handle *handle)
6886
6887
int i ;
6887
6888
6888
6889
set_bit (HCLGE_STATE_DOWN , & hdev -> state );
6889
-
6890
+ spin_lock_bh ( & hdev -> fd_rule_lock );
6890
6891
hclge_clear_arfs_rules (handle );
6892
+ spin_unlock_bh (& hdev -> fd_rule_lock );
6891
6893
6892
6894
/* If it is not PF reset, the firmware will disable the MAC,
6893
6895
* so it only need to stop phy here.
@@ -9040,11 +9042,12 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto,
9040
9042
bool writen_to_tbl = false;
9041
9043
int ret = 0 ;
9042
9044
9043
- /* When device is resetting, firmware is unable to handle
9044
- * mailbox. Just record the vlan id, and remove it after
9045
+ /* When device is resetting or reset failed , firmware is unable to
9046
+ * handle mailbox. Just record the vlan id, and remove it after
9045
9047
* reset finished.
9046
9048
*/
9047
- if (test_bit (HCLGE_STATE_RST_HANDLING , & hdev -> state ) && is_kill ) {
9049
+ if ((test_bit (HCLGE_STATE_RST_HANDLING , & hdev -> state ) ||
9050
+ test_bit (HCLGE_STATE_RST_FAIL , & hdev -> state )) && is_kill ) {
9048
9051
set_bit (vlan_id , vport -> vlan_del_fail_bmap );
9049
9052
return - EBUSY ;
9050
9053
}
0 commit comments