Skip to content

Commit 33bf1e8

Browse files
Michal Swiatkowskianguy11
authored andcommitted
ice: remove switchdev control plane VSI
For slow-path Rx and Tx PF VSI is used. There is no need to have control plane VSI. Remove all code related to it. Eswitch rebuild can't fail without rebuilding control plane VSI. Return void from ice_eswitch_rebuild(). Reviewed-by: Marcin Szycik <marcin.szycik@linux.intel.com> Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com> Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 9cba6e1 commit 33bf1e8

File tree

12 files changed

+13
-277
lines changed

12 files changed

+13
-277
lines changed

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,6 @@ enum ice_misc_thread_tasks {
522522
};
523523

524524
struct ice_eswitch {
525-
struct ice_vsi *control_vsi;
526525
struct ice_vsi *uplink_vsi;
527526
struct ice_esw_br_offloads *br_offloads;
528527
struct xarray reprs;

drivers/net/ethernet/intel/ice/ice_base.c

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -263,30 +263,6 @@ static u16 ice_calc_txq_handle(struct ice_vsi *vsi, struct ice_tx_ring *ring, u8
263263
return ring->q_index - vsi->tc_cfg.tc_info[tc].qoffset;
264264
}
265265

266-
/**
267-
* ice_eswitch_calc_txq_handle
268-
* @ring: pointer to ring which unique index is needed
269-
*
270-
* To correctly work with many netdevs ring->q_index of Tx rings on switchdev
271-
* VSI can repeat. Hardware ring setup requires unique q_index. Calculate it
272-
* here by finding index in vsi->tx_rings of this ring.
273-
*
274-
* Return ICE_INVAL_Q_INDEX when index wasn't found. Should never happen,
275-
* because VSI is get from ring->vsi, so it has to be present in this VSI.
276-
*/
277-
static u16 ice_eswitch_calc_txq_handle(struct ice_tx_ring *ring)
278-
{
279-
const struct ice_vsi *vsi = ring->vsi;
280-
int i;
281-
282-
ice_for_each_txq(vsi, i) {
283-
if (vsi->tx_rings[i] == ring)
284-
return i;
285-
}
286-
287-
return ICE_INVAL_Q_INDEX;
288-
}
289-
290266
/**
291267
* ice_cfg_xps_tx_ring - Configure XPS for a Tx ring
292268
* @ring: The Tx ring to configure
@@ -353,9 +329,6 @@ ice_setup_tx_ctx(struct ice_tx_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf
353329
tlan_ctx->vmvf_num = hw->func_caps.vf_base_id + vsi->vf->vf_id;
354330
tlan_ctx->vmvf_type = ICE_TLAN_CTX_VMVF_TYPE_VF;
355331
break;
356-
case ICE_VSI_SWITCHDEV_CTRL:
357-
tlan_ctx->vmvf_type = ICE_TLAN_CTX_VMVF_TYPE_VMQ;
358-
break;
359332
default:
360333
return;
361334
}
@@ -919,14 +892,7 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_tx_ring *ring,
919892
/* Add unique software queue handle of the Tx queue per
920893
* TC into the VSI Tx ring
921894
*/
922-
if (vsi->type == ICE_VSI_SWITCHDEV_CTRL) {
923-
ring->q_handle = ice_eswitch_calc_txq_handle(ring);
924-
925-
if (ring->q_handle == ICE_INVAL_Q_INDEX)
926-
return -ENODEV;
927-
} else {
928-
ring->q_handle = ice_calc_txq_handle(vsi, ring, tc);
929-
}
895+
ring->q_handle = ice_calc_txq_handle(vsi, ring, tc);
930896

931897
if (ch)
932898
status = ice_ena_vsi_txq(vsi->port_info, ch->ch_vsi->idx, 0,

drivers/net/ethernet/intel/ice/ice_dcb_lib.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ static void ice_dcb_ena_dis_vsi(struct ice_pf *pf, bool ena, bool locked)
291291

292292
switch (vsi->type) {
293293
case ICE_VSI_CHNL:
294-
case ICE_VSI_SWITCHDEV_CTRL:
295294
case ICE_VSI_PF:
296295
if (ena)
297296
ice_ena_vsi(vsi, locked);
@@ -776,8 +775,7 @@ void ice_pf_dcb_recfg(struct ice_pf *pf, bool locked)
776775
/* no need to proceed with remaining cfg if it is CHNL
777776
* or switchdev VSI
778777
*/
779-
if (vsi->type == ICE_VSI_CHNL ||
780-
vsi->type == ICE_VSI_SWITCHDEV_CTRL)
778+
if (vsi->type == ICE_VSI_CHNL)
781779
continue;
782780

783781
ice_vsi_map_rings_to_vectors(vsi);

drivers/net/ethernet/intel/ice/ice_eswitch.c

Lines changed: 4 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
static 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

6056
err_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);
6458
err_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,
287221
static 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
*/
352241
static 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

383267
err_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
*/
394276
static 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)
513392
static 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

519397
static 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-
545402
int
546403
ice_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
}

drivers/net/ethernet/intel/ice/ice_eswitch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
void ice_eswitch_detach(struct ice_pf *pf, struct ice_vf *vf);
1111
int
1212
ice_eswitch_attach(struct ice_pf *pf, struct ice_vf *vf);
13-
int ice_eswitch_rebuild(struct ice_pf *pf);
13+
void ice_eswitch_rebuild(struct ice_pf *pf);
1414

1515
int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode);
1616
int

0 commit comments

Comments
 (0)