10
10
#include "ice_devlink.h"
11
11
#include "ice_tc_lib.h"
12
12
13
- /**
14
- * ice_eswitch_del_sp_rules - delete adv rules added on PRs
15
- * @pf: pointer to the PF struct
16
- *
17
- * Delete all advanced rules that were used to forward packets with the
18
- * device's VSI index to the corresponding eswitch ctrl VSI queue.
19
- */
20
- static void ice_eswitch_del_sp_rules (struct ice_pf * pf )
21
- {
22
- struct ice_repr * repr ;
23
- unsigned long id ;
24
-
25
- xa_for_each (& pf -> eswitch .reprs , id , repr ) {
26
- if (repr -> sp_rule .rid )
27
- ice_rem_adv_rule_by_id (& pf -> hw , & repr -> sp_rule );
28
- }
29
- }
30
-
31
- /**
32
- * ice_eswitch_add_sp_rule - add adv rule with device's VSI index
33
- * @pf: pointer to PF struct
34
- * @repr: pointer to the repr struct
35
- *
36
- * This function adds advanced rule that forwards packets with
37
- * device's VSI index to the corresponding eswitch ctrl VSI queue.
38
- */
39
- static int ice_eswitch_add_sp_rule (struct ice_pf * pf , struct ice_repr * repr )
40
- {
41
- struct ice_vsi * ctrl_vsi = pf -> eswitch .control_vsi ;
42
- struct ice_adv_rule_info rule_info = { 0 };
43
- struct ice_adv_lkup_elem * list ;
44
- struct ice_hw * hw = & pf -> hw ;
45
- const u16 lkups_cnt = 1 ;
46
- int err ;
47
-
48
- list = kcalloc (lkups_cnt , sizeof (* list ), GFP_ATOMIC );
49
- if (!list )
50
- return - ENOMEM ;
51
-
52
- ice_rule_add_src_vsi_metadata (list );
53
-
54
- rule_info .sw_act .flag = ICE_FLTR_TX ;
55
- rule_info .sw_act .vsi_handle = ctrl_vsi -> idx ;
56
- rule_info .sw_act .fltr_act = ICE_FWD_TO_Q ;
57
- rule_info .sw_act .fwd_id .q_id = hw -> func_caps .common_cap .rxq_first_id +
58
- ctrl_vsi -> rxq_map [repr -> q_id ];
59
- rule_info .flags_info .act |= ICE_SINGLE_ACT_LB_ENABLE ;
60
- rule_info .flags_info .act_valid = true;
61
- rule_info .tun_type = ICE_SW_TUN_AND_NON_TUN ;
62
- rule_info .src_vsi = repr -> src_vsi -> idx ;
63
-
64
- err = ice_add_adv_rule (hw , list , lkups_cnt , & rule_info ,
65
- & repr -> sp_rule );
66
- if (err )
67
- dev_err (ice_pf_to_dev (pf ), "Unable to add slow-path rule for eswitch for PR %d" ,
68
- repr -> id );
69
-
70
- kfree (list );
71
- return err ;
72
- }
73
-
74
- static int
75
- ice_eswitch_add_sp_rules (struct ice_pf * pf )
76
- {
77
- struct ice_repr * repr ;
78
- unsigned long id ;
79
- int err ;
80
-
81
- xa_for_each (& pf -> eswitch .reprs , id , repr ) {
82
- err = ice_eswitch_add_sp_rule (pf , repr );
83
- if (err ) {
84
- ice_eswitch_del_sp_rules (pf );
85
- return err ;
86
- }
87
- }
88
-
89
- return 0 ;
90
- }
91
-
92
13
/**
93
14
* ice_eswitch_setup_env - configure eswitch HW filters
94
15
* @pf: pointer to PF struct
@@ -102,7 +23,6 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)
102
23
struct ice_vsi * ctrl_vsi = pf -> eswitch .control_vsi ;
103
24
struct net_device * netdev = uplink_vsi -> netdev ;
104
25
struct ice_vsi_vlan_ops * vlan_ops ;
105
- bool rule_added = false;
106
26
107
27
ice_remove_vsi_fltr (& pf -> hw , uplink_vsi -> idx );
108
28
@@ -112,17 +32,19 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)
112
32
netif_addr_unlock_bh (netdev );
113
33
114
34
if (ice_vsi_add_vlan_zero (uplink_vsi ))
35
+ goto err_vlan_zero ;
36
+
37
+ if (ice_cfg_dflt_vsi (uplink_vsi -> port_info , uplink_vsi -> idx , true,
38
+ ICE_FLTR_RX ))
115
39
goto err_def_rx ;
116
40
117
- if (!ice_is_dflt_vsi_in_use (uplink_vsi -> port_info )) {
118
- if (ice_set_dflt_vsi (uplink_vsi ))
119
- goto err_def_rx ;
120
- rule_added = true;
121
- }
41
+ if (ice_cfg_dflt_vsi (uplink_vsi -> port_info , uplink_vsi -> idx , true,
42
+ ICE_FLTR_TX ))
43
+ goto err_def_tx ;
122
44
123
45
vlan_ops = ice_get_compat_vsi_vlan_ops (uplink_vsi );
124
46
if (vlan_ops -> dis_rx_filtering (uplink_vsi ))
125
- goto err_dis_rx ;
47
+ goto err_vlan_filtering ;
126
48
127
49
if (ice_vsi_update_security (uplink_vsi , ice_vsi_ctx_set_allow_override ))
128
50
goto err_override_uplink ;
@@ -141,10 +63,15 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)
141
63
ice_vsi_update_security (uplink_vsi , ice_vsi_ctx_clear_allow_override );
142
64
err_override_uplink :
143
65
vlan_ops -> ena_rx_filtering (uplink_vsi );
144
- err_dis_rx :
145
- if (rule_added )
146
- ice_clear_dflt_vsi (uplink_vsi );
66
+ err_vlan_filtering :
67
+ ice_cfg_dflt_vsi (uplink_vsi -> port_info , uplink_vsi -> idx , false,
68
+ ICE_FLTR_TX );
69
+ err_def_tx :
70
+ ice_cfg_dflt_vsi (uplink_vsi -> port_info , uplink_vsi -> idx , false,
71
+ ICE_FLTR_RX );
147
72
err_def_rx :
73
+ ice_vsi_del_vlan_zero (uplink_vsi );
74
+ err_vlan_zero :
148
75
ice_fltr_add_mac_and_broadcast (uplink_vsi ,
149
76
uplink_vsi -> port_info -> mac .perm_addr ,
150
77
ICE_FWD_TO_VSI );
@@ -585,7 +512,6 @@ void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf)
585
512
586
513
static void ice_eswitch_stop_reprs (struct ice_pf * pf )
587
514
{
588
- ice_eswitch_del_sp_rules (pf );
589
515
ice_eswitch_stop_all_tx_queues (pf );
590
516
ice_eswitch_napi_disable (& pf -> eswitch .reprs );
591
517
}
@@ -594,7 +520,6 @@ static void ice_eswitch_start_reprs(struct ice_pf *pf)
594
520
{
595
521
ice_eswitch_napi_enable (& pf -> eswitch .reprs );
596
522
ice_eswitch_start_all_tx_queues (pf );
597
- ice_eswitch_add_sp_rules (pf );
598
523
}
599
524
600
525
static void
0 commit comments