Skip to content

Commit 5a841e4

Browse files
Michal Swiatkowskianguy11
authored andcommitted
ice: rename switchdev to eswitch
Eswitch is used as a prefix for related functions. Main structure storing all data related to eswitch should also be named as eswitch instead of ice_switchdev_info. Rename it. Also rename switchdev to eswitch where the context is not about eswitch mode. ::uplink_netdev was changed to netdev for simplicity. There is no other netdev in function scope so it is obvious. Reviewed-by: Wojciech Drewek <[email protected]> Reviewed-by: Piotr Raczynski <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Signed-off-by: Michal Swiatkowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 89cdf9d commit 5a841e4

File tree

4 files changed

+43
-42
lines changed

4 files changed

+43
-42
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ enum ice_misc_thread_tasks {
522522
ICE_MISC_THREAD_NBITS /* must be last */
523523
};
524524

525-
struct ice_switchdev_info {
525+
struct ice_eswitch {
526526
struct ice_vsi *control_vsi;
527527
struct ice_vsi *uplink_vsi;
528528
struct ice_esw_br_offloads *br_offloads;
@@ -637,7 +637,7 @@ struct ice_pf {
637637
struct ice_link_default_override_tlv link_dflt_override;
638638
struct ice_lag *lag; /* Link Aggregation information */
639639

640-
struct ice_switchdev_info switchdev;
640+
struct ice_eswitch eswitch;
641641
struct ice_esw_br_port *br_port;
642642

643643
#define ICE_INVALID_AGG_NODE_ID 0
@@ -846,7 +846,7 @@ static inline struct ice_vsi *ice_find_vsi(struct ice_pf *pf, u16 vsi_num)
846846
*/
847847
static inline bool ice_is_switchdev_running(struct ice_pf *pf)
848848
{
849-
return pf->switchdev.is_running;
849+
return pf->eswitch.is_running;
850850
}
851851

852852
#define ICE_FD_STAT_CTR_BLOCK_COUNT 256

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

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
* @vf: pointer to VF struct
1717
*
1818
* This function adds advanced rule that forwards packets with
19-
* VF's VSI index to the corresponding switchdev ctrl VSI queue.
19+
* VF's VSI index to the corresponding eswitch ctrl VSI queue.
2020
*/
2121
static int
2222
ice_eswitch_add_vf_sp_rule(struct ice_pf *pf, struct ice_vf *vf)
2323
{
24-
struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi;
24+
struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi;
2525
struct ice_adv_rule_info rule_info = { 0 };
2626
struct ice_adv_lkup_elem *list;
2727
struct ice_hw *hw = &pf->hw;
@@ -59,7 +59,7 @@ ice_eswitch_add_vf_sp_rule(struct ice_pf *pf, struct ice_vf *vf)
5959
* @vf: pointer to the VF struct
6060
*
6161
* Delete the advanced rule that was used to forward packets with the VF's VSI
62-
* index to the corresponding switchdev ctrl VSI queue.
62+
* index to the corresponding eswitch ctrl VSI queue.
6363
*/
6464
static void ice_eswitch_del_vf_sp_rule(struct ice_vf *vf)
6565
{
@@ -70,26 +70,26 @@ static void ice_eswitch_del_vf_sp_rule(struct ice_vf *vf)
7070
}
7171

7272
/**
73-
* ice_eswitch_setup_env - configure switchdev HW filters
73+
* ice_eswitch_setup_env - configure eswitch HW filters
7474
* @pf: pointer to PF struct
7575
*
7676
* This function adds HW filters configuration specific for switchdev
7777
* mode.
7878
*/
7979
static int ice_eswitch_setup_env(struct ice_pf *pf)
8080
{
81-
struct ice_vsi *uplink_vsi = pf->switchdev.uplink_vsi;
82-
struct net_device *uplink_netdev = uplink_vsi->netdev;
83-
struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi;
81+
struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi;
82+
struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi;
83+
struct net_device *netdev = uplink_vsi->netdev;
8484
struct ice_vsi_vlan_ops *vlan_ops;
8585
bool rule_added = false;
8686

8787
ice_remove_vsi_fltr(&pf->hw, uplink_vsi->idx);
8888

89-
netif_addr_lock_bh(uplink_netdev);
90-
__dev_uc_unsync(uplink_netdev, NULL);
91-
__dev_mc_unsync(uplink_netdev, NULL);
92-
netif_addr_unlock_bh(uplink_netdev);
89+
netif_addr_lock_bh(netdev);
90+
__dev_uc_unsync(netdev, NULL);
91+
__dev_mc_unsync(netdev, NULL);
92+
netif_addr_unlock_bh(netdev);
9393

9494
if (ice_vsi_add_vlan_zero(uplink_vsi))
9595
goto err_def_rx;
@@ -132,10 +132,10 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)
132132
}
133133

134134
/**
135-
* ice_eswitch_remap_rings_to_vectors - reconfigure rings of switchdev ctrl VSI
135+
* ice_eswitch_remap_rings_to_vectors - reconfigure rings of eswitch ctrl VSI
136136
* @pf: pointer to PF struct
137137
*
138-
* In switchdev number of allocated Tx/Rx rings is equal.
138+
* In eswitch number of allocated Tx/Rx rings is equal.
139139
*
140140
* This function fills q_vectors structures associated with representor and
141141
* move each ring pairs to port representor netdevs. Each port representor
@@ -144,7 +144,7 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)
144144
*/
145145
static void ice_eswitch_remap_rings_to_vectors(struct ice_pf *pf)
146146
{
147-
struct ice_vsi *vsi = pf->switchdev.control_vsi;
147+
struct ice_vsi *vsi = pf->eswitch.control_vsi;
148148
int q_id;
149149

150150
ice_for_each_txq(vsi, q_id) {
@@ -189,7 +189,7 @@ static void ice_eswitch_remap_rings_to_vectors(struct ice_pf *pf)
189189
/**
190190
* ice_eswitch_release_reprs - clear PR VSIs configuration
191191
* @pf: poiner to PF struct
192-
* @ctrl_vsi: pointer to switchdev control VSI
192+
* @ctrl_vsi: pointer to eswitch control VSI
193193
*/
194194
static void
195195
ice_eswitch_release_reprs(struct ice_pf *pf, struct ice_vsi *ctrl_vsi)
@@ -223,7 +223,7 @@ ice_eswitch_release_reprs(struct ice_pf *pf, struct ice_vsi *ctrl_vsi)
223223
*/
224224
static int ice_eswitch_setup_reprs(struct ice_pf *pf)
225225
{
226-
struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi;
226+
struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi;
227227
int max_vsi_num = 0;
228228
struct ice_vf *vf;
229229
unsigned int bkt;
@@ -359,7 +359,7 @@ ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev)
359359
}
360360

361361
/**
362-
* ice_eswitch_set_target_vsi - set switchdev context in Tx context descriptor
362+
* ice_eswitch_set_target_vsi - set eswitch context in Tx context descriptor
363363
* @skb: pointer to send buffer
364364
* @off: pointer to offload struct
365365
*/
@@ -382,16 +382,16 @@ ice_eswitch_set_target_vsi(struct sk_buff *skb,
382382
}
383383

384384
/**
385-
* ice_eswitch_release_env - clear switchdev HW filters
385+
* ice_eswitch_release_env - clear eswitch HW filters
386386
* @pf: pointer to PF struct
387387
*
388388
* This function removes HW filters configuration specific for switchdev
389389
* mode and restores default legacy mode settings.
390390
*/
391391
static void ice_eswitch_release_env(struct ice_pf *pf)
392392
{
393-
struct ice_vsi *uplink_vsi = pf->switchdev.uplink_vsi;
394-
struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi;
393+
struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi;
394+
struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi;
395395
struct ice_vsi_vlan_ops *vlan_ops;
396396

397397
vlan_ops = ice_get_compat_vsi_vlan_ops(uplink_vsi);
@@ -407,7 +407,7 @@ static void ice_eswitch_release_env(struct ice_pf *pf)
407407
}
408408

409409
/**
410-
* ice_eswitch_vsi_setup - configure switchdev control VSI
410+
* ice_eswitch_vsi_setup - configure eswitch control VSI
411411
* @pf: pointer to PF structure
412412
* @pi: pointer to port_info structure
413413
*/
@@ -486,12 +486,12 @@ static int ice_eswitch_enable_switchdev(struct ice_pf *pf)
486486
return -EINVAL;
487487
}
488488

489-
pf->switchdev.control_vsi = ice_eswitch_vsi_setup(pf, pf->hw.port_info);
490-
if (!pf->switchdev.control_vsi)
489+
pf->eswitch.control_vsi = ice_eswitch_vsi_setup(pf, pf->hw.port_info);
490+
if (!pf->eswitch.control_vsi)
491491
return -ENODEV;
492492

493-
ctrl_vsi = pf->switchdev.control_vsi;
494-
pf->switchdev.uplink_vsi = uplink_vsi;
493+
ctrl_vsi = pf->eswitch.control_vsi;
494+
pf->eswitch.uplink_vsi = uplink_vsi;
495495

496496
if (ice_eswitch_setup_env(pf))
497497
goto err_vsi;
@@ -526,12 +526,12 @@ static int ice_eswitch_enable_switchdev(struct ice_pf *pf)
526526
}
527527

528528
/**
529-
* ice_eswitch_disable_switchdev - disable switchdev resources
529+
* ice_eswitch_disable_switchdev - disable eswitch resources
530530
* @pf: pointer to PF structure
531531
*/
532532
static void ice_eswitch_disable_switchdev(struct ice_pf *pf)
533533
{
534-
struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi;
534+
struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi;
535535

536536
ice_eswitch_napi_disable(pf);
537537
ice_eswitch_br_offloads_deinit(pf);
@@ -625,7 +625,7 @@ void ice_eswitch_release(struct ice_pf *pf)
625625
return;
626626

627627
ice_eswitch_disable_switchdev(pf);
628-
pf->switchdev.is_running = false;
628+
pf->eswitch.is_running = false;
629629
}
630630

631631
/**
@@ -636,14 +636,15 @@ int ice_eswitch_configure(struct ice_pf *pf)
636636
{
637637
int status;
638638

639-
if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY || pf->switchdev.is_running)
639+
if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY ||
640+
pf->eswitch.is_running)
640641
return 0;
641642

642643
status = ice_eswitch_enable_switchdev(pf);
643644
if (status)
644645
return status;
645646

646-
pf->switchdev.is_running = true;
647+
pf->eswitch.is_running = true;
647648
return 0;
648649
}
649650

@@ -693,7 +694,7 @@ void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf)
693694
*/
694695
int ice_eswitch_rebuild(struct ice_pf *pf)
695696
{
696-
struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi;
697+
struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi;
697698
int status;
698699

699700
ice_eswitch_napi_disable(pf);

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ ice_eswitch_br_vf_repr_port_init(struct ice_esw_br *bridge,
947947
static int
948948
ice_eswitch_br_uplink_port_init(struct ice_esw_br *bridge, struct ice_pf *pf)
949949
{
950-
struct ice_vsi *vsi = pf->switchdev.uplink_vsi;
950+
struct ice_vsi *vsi = pf->eswitch.uplink_vsi;
951951
struct ice_esw_br_port *br_port;
952952
int err;
953953

@@ -1185,7 +1185,7 @@ ice_eswitch_br_port_event(struct notifier_block *nb,
11851185
static void
11861186
ice_eswitch_br_offloads_dealloc(struct ice_pf *pf)
11871187
{
1188-
struct ice_esw_br_offloads *br_offloads = pf->switchdev.br_offloads;
1188+
struct ice_esw_br_offloads *br_offloads = pf->eswitch.br_offloads;
11891189

11901190
ASSERT_RTNL();
11911191

@@ -1194,7 +1194,7 @@ ice_eswitch_br_offloads_dealloc(struct ice_pf *pf)
11941194

11951195
ice_eswitch_br_deinit(br_offloads, br_offloads->bridge);
11961196

1197-
pf->switchdev.br_offloads = NULL;
1197+
pf->eswitch.br_offloads = NULL;
11981198
kfree(br_offloads);
11991199
}
12001200

@@ -1205,14 +1205,14 @@ ice_eswitch_br_offloads_alloc(struct ice_pf *pf)
12051205

12061206
ASSERT_RTNL();
12071207

1208-
if (pf->switchdev.br_offloads)
1208+
if (pf->eswitch.br_offloads)
12091209
return ERR_PTR(-EEXIST);
12101210

12111211
br_offloads = kzalloc(sizeof(*br_offloads), GFP_KERNEL);
12121212
if (!br_offloads)
12131213
return ERR_PTR(-ENOMEM);
12141214

1215-
pf->switchdev.br_offloads = br_offloads;
1215+
pf->eswitch.br_offloads = br_offloads;
12161216
br_offloads->pf = pf;
12171217

12181218
return br_offloads;
@@ -1223,7 +1223,7 @@ ice_eswitch_br_offloads_deinit(struct ice_pf *pf)
12231223
{
12241224
struct ice_esw_br_offloads *br_offloads;
12251225

1226-
br_offloads = pf->switchdev.br_offloads;
1226+
br_offloads = pf->eswitch.br_offloads;
12271227
if (!br_offloads)
12281228
return;
12291229

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ static int ice_tc_setup_redirect_action(struct net_device *filter_dev,
653653
ice_tc_is_dev_uplink(target_dev)) {
654654
repr = ice_netdev_to_repr(filter_dev);
655655

656-
fltr->dest_vsi = repr->src_vsi->back->switchdev.uplink_vsi;
656+
fltr->dest_vsi = repr->src_vsi->back->eswitch.uplink_vsi;
657657
fltr->direction = ICE_ESWITCH_FLTR_EGRESS;
658658
} else if (ice_tc_is_dev_uplink(filter_dev) &&
659659
ice_is_port_repr_netdev(target_dev)) {
@@ -765,7 +765,7 @@ ice_eswitch_add_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr)
765765
rule_info.sw_act.src = hw->pf_id;
766766
rule_info.flags_info.act = ICE_SINGLE_ACT_LB_ENABLE;
767767
} else if (fltr->direction == ICE_ESWITCH_FLTR_EGRESS &&
768-
fltr->dest_vsi == vsi->back->switchdev.uplink_vsi) {
768+
fltr->dest_vsi == vsi->back->eswitch.uplink_vsi) {
769769
/* VF to Uplink */
770770
rule_info.sw_act.flag |= ICE_FLTR_TX;
771771
rule_info.sw_act.src = vsi->idx;

0 commit comments

Comments
 (0)