2020static int ice_eswitch_setup_env (struct ice_pf * pf )
2121{
2222 struct ice_vsi * uplink_vsi = pf -> eswitch .uplink_vsi ;
23- struct ice_vsi * ctrl_vsi = pf -> eswitch .control_vsi ;
2423 struct net_device * netdev = uplink_vsi -> netdev ;
2524 struct ice_vsi_vlan_ops * vlan_ops ;
2625
@@ -49,17 +48,12 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)
4948 if (ice_vsi_update_security (uplink_vsi , ice_vsi_ctx_set_allow_override ))
5049 goto err_override_uplink ;
5150
52- if (ice_vsi_update_security (ctrl_vsi , ice_vsi_ctx_set_allow_override ))
53- goto err_override_control ;
54-
5551 if (ice_vsi_update_local_lb (uplink_vsi , true))
5652 goto err_override_local_lb ;
5753
5854 return 0 ;
5955
6056err_override_local_lb :
61- ice_vsi_update_security (ctrl_vsi , ice_vsi_ctx_clear_allow_override );
62- err_override_control :
6357 ice_vsi_update_security (uplink_vsi , ice_vsi_ctx_clear_allow_override );
6458err_override_uplink :
6559 vlan_ops -> ena_rx_filtering (uplink_vsi );
@@ -78,61 +72,6 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)
7872 return - ENODEV ;
7973}
8074
81- /**
82- * ice_eswitch_remap_rings_to_vectors - reconfigure rings of eswitch ctrl VSI
83- * @eswitch: pointer to eswitch struct
84- *
85- * In eswitch number of allocated Tx/Rx rings is equal.
86- *
87- * This function fills q_vectors structures associated with representor and
88- * move each ring pairs to port representor netdevs. Each port representor
89- * will have dedicated 1 Tx/Rx ring pair, so number of rings pair is equal to
90- * number of VFs.
91- */
92- static void ice_eswitch_remap_rings_to_vectors (struct ice_eswitch * eswitch )
93- {
94- struct ice_vsi * vsi = eswitch -> control_vsi ;
95- unsigned long repr_id = 0 ;
96- int q_id ;
97-
98- ice_for_each_txq (vsi , q_id ) {
99- struct ice_q_vector * q_vector ;
100- struct ice_tx_ring * tx_ring ;
101- struct ice_rx_ring * rx_ring ;
102- struct ice_repr * repr ;
103-
104- repr = xa_find (& eswitch -> reprs , & repr_id , U32_MAX ,
105- XA_PRESENT );
106- if (!repr )
107- break ;
108-
109- repr_id += 1 ;
110- repr -> q_id = q_id ;
111- q_vector = repr -> q_vector ;
112- tx_ring = vsi -> tx_rings [q_id ];
113- rx_ring = vsi -> rx_rings [q_id ];
114-
115- q_vector -> vsi = vsi ;
116- q_vector -> reg_idx = vsi -> q_vectors [0 ]-> reg_idx ;
117-
118- q_vector -> num_ring_tx = 1 ;
119- q_vector -> tx .tx_ring = tx_ring ;
120- tx_ring -> q_vector = q_vector ;
121- tx_ring -> next = NULL ;
122- tx_ring -> netdev = repr -> netdev ;
123- /* In switchdev mode, from OS stack perspective, there is only
124- * one queue for given netdev, so it needs to be indexed as 0.
125- */
126- tx_ring -> q_index = 0 ;
127-
128- q_vector -> num_ring_rx = 1 ;
129- q_vector -> rx .rx_ring = rx_ring ;
130- rx_ring -> q_vector = q_vector ;
131- rx_ring -> next = NULL ;
132- rx_ring -> netdev = repr -> netdev ;
133- }
134- }
135-
13675/**
13776 * ice_eswitch_release_repr - clear PR VSI configuration
13877 * @pf: poiner to PF struct
@@ -152,8 +91,6 @@ ice_eswitch_release_repr(struct ice_pf *pf, struct ice_repr *repr)
15291 repr -> dst = NULL ;
15392 ice_fltr_add_mac_and_broadcast (vsi , repr -> parent_mac ,
15493 ICE_FWD_TO_VSI );
155-
156- netif_napi_del (& repr -> q_vector -> napi );
15794}
15895
15996/**
@@ -179,9 +116,6 @@ static int ice_eswitch_setup_repr(struct ice_pf *pf, struct ice_repr *repr)
179116 if (ice_vsi_add_vlan_zero (vsi ))
180117 goto err_update_security ;
181118
182- netif_napi_add (repr -> netdev , & repr -> q_vector -> napi ,
183- ice_napi_poll );
184-
185119 netif_keep_dst (uplink_vsi -> netdev );
186120
187121 dst = repr -> dst ;
@@ -287,13 +221,11 @@ ice_eswitch_set_target_vsi(struct sk_buff *skb,
287221static void ice_eswitch_release_env (struct ice_pf * pf )
288222{
289223 struct ice_vsi * uplink_vsi = pf -> eswitch .uplink_vsi ;
290- struct ice_vsi * ctrl_vsi = pf -> eswitch .control_vsi ;
291224 struct ice_vsi_vlan_ops * vlan_ops ;
292225
293226 vlan_ops = ice_get_compat_vsi_vlan_ops (uplink_vsi );
294227
295228 ice_vsi_update_local_lb (uplink_vsi , false);
296- ice_vsi_update_security (ctrl_vsi , ice_vsi_ctx_clear_allow_override );
297229 ice_vsi_update_security (uplink_vsi , ice_vsi_ctx_clear_allow_override );
298230 vlan_ops -> ena_rx_filtering (uplink_vsi );
299231 ice_clear_dflt_vsi (uplink_vsi );
@@ -302,56 +234,13 @@ static void ice_eswitch_release_env(struct ice_pf *pf)
302234 ICE_FWD_TO_VSI );
303235}
304236
305- /**
306- * ice_eswitch_vsi_setup - configure eswitch control VSI
307- * @pf: pointer to PF structure
308- * @pi: pointer to port_info structure
309- */
310- static struct ice_vsi *
311- ice_eswitch_vsi_setup (struct ice_pf * pf , struct ice_port_info * pi )
312- {
313- struct ice_vsi_cfg_params params = {};
314-
315- params .type = ICE_VSI_SWITCHDEV_CTRL ;
316- params .pi = pi ;
317- params .flags = ICE_VSI_FLAG_INIT ;
318-
319- return ice_vsi_setup (pf , & params );
320- }
321-
322- /**
323- * ice_eswitch_napi_enable - enable NAPI for all port representors
324- * @reprs: xarray of reprs
325- */
326- static void ice_eswitch_napi_enable (struct xarray * reprs )
327- {
328- struct ice_repr * repr ;
329- unsigned long id ;
330-
331- xa_for_each (reprs , id , repr )
332- napi_enable (& repr -> q_vector -> napi );
333- }
334-
335- /**
336- * ice_eswitch_napi_disable - disable NAPI for all port representors
337- * @reprs: xarray of reprs
338- */
339- static void ice_eswitch_napi_disable (struct xarray * reprs )
340- {
341- struct ice_repr * repr ;
342- unsigned long id ;
343-
344- xa_for_each (reprs , id , repr )
345- napi_disable (& repr -> q_vector -> napi );
346- }
347-
348237/**
349238 * ice_eswitch_enable_switchdev - configure eswitch in switchdev mode
350239 * @pf: pointer to PF structure
351240 */
352241static int ice_eswitch_enable_switchdev (struct ice_pf * pf )
353242{
354- struct ice_vsi * ctrl_vsi , * uplink_vsi ;
243+ struct ice_vsi * uplink_vsi ;
355244
356245 uplink_vsi = ice_get_main_vsi (pf );
357246 if (!uplink_vsi )
@@ -363,15 +252,10 @@ static int ice_eswitch_enable_switchdev(struct ice_pf *pf)
363252 return - EINVAL ;
364253 }
365254
366- pf -> eswitch .control_vsi = ice_eswitch_vsi_setup (pf , pf -> hw .port_info );
367- if (!pf -> eswitch .control_vsi )
368- return - ENODEV ;
369-
370- ctrl_vsi = pf -> eswitch .control_vsi ;
371255 pf -> eswitch .uplink_vsi = uplink_vsi ;
372256
373257 if (ice_eswitch_setup_env (pf ))
374- goto err_vsi ;
258+ return - ENODEV ;
375259
376260 if (ice_eswitch_br_offloads_init (pf ))
377261 goto err_br_offloads ;
@@ -382,8 +266,6 @@ static int ice_eswitch_enable_switchdev(struct ice_pf *pf)
382266
383267err_br_offloads :
384268 ice_eswitch_release_env (pf );
385- err_vsi :
386- ice_vsi_release (ctrl_vsi );
387269 return - ENODEV ;
388270}
389271
@@ -393,11 +275,8 @@ static int ice_eswitch_enable_switchdev(struct ice_pf *pf)
393275 */
394276static void ice_eswitch_disable_switchdev (struct ice_pf * pf )
395277{
396- struct ice_vsi * ctrl_vsi = pf -> eswitch .control_vsi ;
397-
398278 ice_eswitch_br_offloads_deinit (pf );
399279 ice_eswitch_release_env (pf );
400- ice_vsi_release (ctrl_vsi );
401280
402281 pf -> eswitch .is_running = false;
403282}
@@ -513,40 +392,17 @@ void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf)
513392static void ice_eswitch_stop_reprs (struct ice_pf * pf )
514393{
515394 ice_eswitch_stop_all_tx_queues (pf );
516- ice_eswitch_napi_disable (& pf -> eswitch .reprs );
517395}
518396
519397static void ice_eswitch_start_reprs (struct ice_pf * pf )
520398{
521- ice_eswitch_napi_enable (& pf -> eswitch .reprs );
522399 ice_eswitch_start_all_tx_queues (pf );
523400}
524401
525- static void
526- ice_eswitch_cp_change_queues (struct ice_eswitch * eswitch , int change )
527- {
528- struct ice_vsi * cp = eswitch -> control_vsi ;
529- int queues = 0 ;
530-
531- if (queues ) {
532- cp -> req_txq = queues ;
533- cp -> req_rxq = queues ;
534- ice_vsi_close (cp );
535- ice_vsi_rebuild (cp , ICE_VSI_FLAG_NO_INIT );
536- ice_vsi_open (cp );
537- } else if (!change ) {
538- /* change == 0 means that VSI wasn't open, open it here */
539- ice_vsi_open (cp );
540- }
541-
542- ice_eswitch_remap_rings_to_vectors (eswitch );
543- }
544-
545402int
546403ice_eswitch_attach (struct ice_pf * pf , struct ice_vf * vf )
547404{
548405 struct ice_repr * repr ;
549- int change = 1 ;
550406 int err ;
551407
552408 if (pf -> eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY )
@@ -556,7 +412,6 @@ ice_eswitch_attach(struct ice_pf *pf, struct ice_vf *vf)
556412 err = ice_eswitch_enable_switchdev (pf );
557413 if (err )
558414 return err ;
559- change = 0 ;
560415 }
561416
562417 ice_eswitch_stop_reprs (pf );
@@ -578,7 +433,6 @@ ice_eswitch_attach(struct ice_pf *pf, struct ice_vf *vf)
578433
579434 vf -> repr_id = repr -> id ;
580435
581- ice_eswitch_cp_change_queues (& pf -> eswitch , change );
582436 ice_eswitch_start_reprs (pf );
583437
584438 return 0 ;
@@ -608,8 +462,6 @@ void ice_eswitch_detach(struct ice_pf *pf, struct ice_vf *vf)
608462
609463 if (xa_empty (& pf -> eswitch .reprs ))
610464 ice_eswitch_disable_switchdev (pf );
611- else
612- ice_eswitch_cp_change_queues (& pf -> eswitch , -1 );
613465
614466 ice_eswitch_release_repr (pf , repr );
615467 ice_repr_rem_vf (repr );
@@ -631,21 +483,14 @@ void ice_eswitch_detach(struct ice_pf *pf, struct ice_vf *vf)
631483 * ice_eswitch_rebuild - rebuild eswitch
632484 * @pf: pointer to PF structure
633485 */
634- int ice_eswitch_rebuild (struct ice_pf * pf )
486+ void ice_eswitch_rebuild (struct ice_pf * pf )
635487{
636488 struct ice_repr * repr ;
637489 unsigned long id ;
638- int err ;
639490
640491 if (!ice_is_switchdev_running (pf ))
641- return 0 ;
642-
643- err = ice_vsi_rebuild (pf -> eswitch .control_vsi , ICE_VSI_FLAG_INIT );
644- if (err )
645- return err ;
492+ return ;
646493
647494 xa_for_each (& pf -> eswitch .reprs , id , repr )
648495 ice_eswitch_detach (pf , repr -> vf );
649-
650- return 0 ;
651496}
0 commit comments