History

net/mlx5: E-Switch, Refactor eswitch SR-IOV interface

Devlink eswitch mode is not necessarily related to SR-IOV, e.g, ECPF can be at offload mode when SR-IOV is not enabled. Rename the interface and eswitch mode names to decouple from SR-IOV, and cleanup eswitch messages accordingly.

Bodong Wang committed 7 years ago

Commit f6455de1 parent e1d974d11 files · +77 −76Browse files

Unified · Split

11 files
  1. drivers/infiniband/hw/mlx5/ib_rep.h +1 −1
  2. drivers/infiniband/hw/mlx5/main.c +1 −1
  3. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 −1
  4. drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +3 −3
  5. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +1 −1
  6. drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +43 −42
  7. drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +4 −4
  8. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +16 −16
  9. drivers/net/ethernet/mellanox/mlx5/core/lag.c +2 −2
  10. drivers/net/ethernet/mellanox/mlx5/core/sriov.c +2 −2
  11. include/linux/mlx5/eswitch.h +3 −3
drivers/infiniband/hw/mlx5/ib_rep.h+1−1
@@ -28,7 +28,7 @@ struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw, · 27 unmodified lines
2828 #else /* CONFIG_MLX5_ESWITCH */
2929 static inline u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw)
3030 {
31− return SRIOV_NONE;
31+ return MLX5_ESWITCH_NONE;
3232 }
3333
3434 static inline
drivers/infiniband/hw/mlx5/main.c+1−1
@@ -6814,7 +6814,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) · 6813 unmodified lines
68146814 printk_once(KERN_INFO "%s", mlx5_version);
68156815
68166816 if (MLX5_ESWITCH_MANAGER(mdev) &&
6817− mlx5_ib_eswitch_mode(mdev->priv.eswitch) == SRIOV_OFFLOADS) {
6817+ mlx5_ib_eswitch_mode(mdev->priv.eswitch) == MLX5_ESWITCH_OFFLOADS) {
68186818 if (!mlx5_core_mp_enabled(mdev))
68196819 mlx5_ib_register_vport_reps(mdev);
68206820 return mdev;
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+1−1
@@ -5115,7 +5115,7 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev) · 5114 unmodified lines
51155115
51165116 #ifdef CONFIG_MLX5_ESWITCH
51175117 if (MLX5_ESWITCH_MANAGER(mdev) &&
5118− mlx5_eswitch_mode(mdev->priv.eswitch) == SRIOV_OFFLOADS) {
5118+ mlx5_eswitch_mode(mdev->priv.eswitch) == MLX5_ESWITCH_OFFLOADS) {
51195119 mlx5e_rep_register_vport_reps(mdev);
51205120 return mdev;
51215121 }
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c+3−3
@@ -391,7 +391,7 @@ static int mlx5e_rep_get_port_parent_id(struct net_device *dev, · 390 unmodified lines
391391 struct mlx5e_priv *uplink_priv = NULL;
392392 struct net_device *uplink_dev;
393393
394− if (esw->mode == SRIOV_NONE)
394+ if (esw->mode == MLX5_ESWITCH_NONE)
395395 return -EOPNOTSUPP;
396396
397397 uplink_dev = mlx5_eswitch_uplink_get_proto_dev(esw, REP_ETH);
@@ -419,7 +419,7 @@ static void mlx5e_sqs2vport_stop(struct mlx5_eswitch *esw, · 21 unmodified lines
419419 struct mlx5e_rep_sq *rep_sq, *tmp;
420420 struct mlx5e_rep_priv *rpriv;
421421
422− if (esw->mode != SRIOV_OFFLOADS)
422+ if (esw->mode != MLX5_ESWITCH_OFFLOADS)
423423 return;
424424
425425 rpriv = mlx5e_rep_to_rep_priv(rep);
@@ -440,7 +440,7 @@ static int mlx5e_sqs2vport_start(struct mlx5_eswitch *esw, · 14 unmodified lines
440440 int err;
441441 int i;
442442
443− if (esw->mode != SRIOV_OFFLOADS)
443+ if (esw->mode != MLX5_ESWITCH_OFFLOADS)
444444 return 0;
445445
446446 rpriv = mlx5e_rep_to_rep_priv(rep);
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+1−1
@@ -3342,7 +3342,7 @@ mlx5e_tc_add_flow(struct mlx5e_priv *priv, · 3341 unmodified lines
33423342 if (!tc_can_offload_extack(priv->netdev, f->common.extack))
33433343 return -EOPNOTSUPP;
33443344
3345− if (esw && esw->mode == SRIOV_OFFLOADS)
3345+ if (esw && esw->mode == MLX5_ESWITCH_OFFLOADS)
33463346 err = mlx5e_add_fdb_flow(priv, f, flow_flags,
33473347 filter_dev, flow);
33483348 else
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c+43−42
@@ -497,7 +497,7 @@ static int esw_add_uc_addr(struct mlx5_eswitch *esw, struct vport_addr *vaddr) · 496 unmodified lines
497497
498498 fdb_add:
499499 /* SRIOV is enabled: Forward UC MAC to vport */
500− if (esw->fdb_table.legacy.fdb && esw->mode == SRIOV_LEGACY)
500+ if (esw->fdb_table.legacy.fdb && esw->mode == MLX5_ESWITCH_LEGACY)
501501 vaddr->flow_rule = esw_fdb_set_vport_rule(esw, mac, vport);
502502
503503 esw_debug(esw->dev, "\tADDED UC MAC: vport[%d] %pM fr(%p)\n",
@@ -1577,7 +1577,7 @@ static void esw_apply_vport_conf(struct mlx5_eswitch *esw, · 1073 unmodified lines
15771577 flags);
15781578
15791579 /* Only legacy mode needs ACLs */
1580− if (esw->mode == SRIOV_LEGACY) {
1580+ if (esw->mode == MLX5_ESWITCH_LEGACY) {
15811581 esw_vport_ingress_config(esw, vport);
15821582 esw_vport_egress_config(esw, vport);
15831583 }
@@ -1629,7 +1629,7 @@ static void esw_enable_vport(struct mlx5_eswitch *esw, struct mlx5_vport *vport, · 45 unmodified lines
16291629 esw_debug(esw->dev, "Enabling VPORT(%d)\n", vport_num);
16301630
16311631 /* Create steering drop counters for ingress and egress ACLs */
1632− if (vport_num && esw->mode == SRIOV_LEGACY)
1632+ if (vport_num && esw->mode == MLX5_ESWITCH_LEGACY)
16331633 esw_vport_create_drop_counters(vport);
16341634
16351635 /* Restore old vport configuration */
@@ -1683,7 +1683,7 @@ static void esw_disable_vport(struct mlx5_eswitch *esw, · 47 unmodified lines
16831683 vport->enabled_events = 0;
16841684 esw_vport_disable_qos(esw, vport);
16851685 if (esw->manager_vport != vport_num &&
1686− esw->mode == SRIOV_LEGACY) {
1686+ esw->mode == MLX5_ESWITCH_LEGACY) {
16871687 mlx5_modify_vport_admin_state(esw->dev,
16881688 MLX5_VPORT_STATE_OP_MOD_ESW_VPORT,
16891689 vport_num, 1,
@@ -1728,7 +1728,7 @@ int mlx5_esw_query_functions(struct mlx5_core_dev *dev, u32 *out, int outlen) · 38 unmodified lines
17281728 /* Public E-Switch API */
17291729 #define ESW_ALLOWED(esw) ((esw) && MLX5_ESWITCH_MANAGER((esw)->dev))
17301730
1731−int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode)
1731+int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int nvfs, int mode)
17321732 {
17331733 struct mlx5_vport *vport;
17341734 int total_nvports = 0;
@@ -1737,19 +1737,17 @@ int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode) · 2 unmodified lines
17371737
17381738 if (!ESW_ALLOWED(esw) ||
17391739 !MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, ft_support)) {
1740− esw_warn(esw->dev, "E-Switch FDB is not supported, aborting ...\n");
1740+ esw_warn(esw->dev, "FDB is not supported, aborting ...\n");
17411741 return -EOPNOTSUPP;
17421742 }
17431743
17441744 if (!MLX5_CAP_ESW_INGRESS_ACL(esw->dev, ft_support))
1745− esw_warn(esw->dev, "E-Switch ingress ACL is not supported by FW\n");
1745+ esw_warn(esw->dev, "ingress ACL is not supported by FW\n");
17461746
17471747 if (!MLX5_CAP_ESW_EGRESS_ACL(esw->dev, ft_support))
1748− esw_warn(esw->dev, "E-Switch engress ACL is not supported by FW\n");
1748+ esw_warn(esw->dev, "engress ACL is not supported by FW\n");
17491749
1750− esw_info(esw->dev, "E-Switch enable SRIOV: nvfs(%d) mode (%d)\n", nvfs, mode);
1751−
1752− if (mode == SRIOV_OFFLOADS) {
1750+ if (mode == MLX5_ESWITCH_OFFLOADS) {
17531751 if (mlx5_core_is_ecpf_esw_manager(esw->dev))
17541752 total_nvports = esw->total_vports;
17551753 else
@@ -1760,7 +1758,7 @@ int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode) · 4 unmodified lines
17601758
17611759 mlx5_lag_update(esw->dev);
17621760
1763− if (mode == SRIOV_LEGACY) {
1761+ if (mode == MLX5_ESWITCH_LEGACY) {
17641762 err = esw_create_legacy_table(esw);
17651763 if (err)
17661764 goto abort;
@@ -1777,11 +1775,11 @@ int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode) · 10 unmodified lines
17771775 if (err)
17781776 esw_warn(esw->dev, "Failed to create eswitch TSAR");
17791777
1780− /* Don't enable vport events when in SRIOV_OFFLOADS mode, since:
1778+ /* Don't enable vport events when in MLX5_ESWITCH_OFFLOADS mode, since:
17811779 * 1. L2 table (MPFS) is programmed by PF/VF representors netdevs set_rx_mode
17821780 * 2. FDB/Eswitch is programmed by user space tools
17831781 */
1784− enabled_events = (mode == SRIOV_LEGACY) ? SRIOV_VPORT_EVENTS : 0;
1782+ enabled_events = (mode == MLX5_ESWITCH_LEGACY) ? SRIOV_VPORT_EVENTS : 0;
17851783
17861784 /* Enable PF vport */
17871785 vport = mlx5_eswitch_get_vport(esw, MLX5_VPORT_PF);
@@ -1797,19 +1795,21 @@ int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode) · 9 unmodified lines
17971795 mlx5_esw_for_each_vf_vport(esw, i, vport, nvfs)
17981796 esw_enable_vport(esw, vport, enabled_events);
17991797
1800− if (mode == SRIOV_LEGACY) {
1798+ if (mode == MLX5_ESWITCH_LEGACY) {
18011799 MLX5_NB_INIT(&esw->nb, eswitch_vport_event, NIC_VPORT_CHANGE);
18021800 mlx5_eq_notifier_register(esw->dev, &esw->nb);
18031801 }
18041802
1805− esw_info(esw->dev, "SRIOV enabled: active vports(%d)\n",
1806− esw->enabled_vports);
1803+ esw_info(esw->dev, "Enable: mode(%s), nvfs(%d), active vports(%d)\n",
1804+ mode == MLX5_ESWITCH_LEGACY ? "LEGACY" : "OFFLOADS",
1805+ nvfs, esw->enabled_vports);
1806+
18071807 return 0;
18081808
18091809 abort:
1810− esw->mode = SRIOV_NONE;
1810+ esw->mode = MLX5_ESWITCH_NONE;
18111811
1812− if (mode == SRIOV_OFFLOADS) {
1812+ if (mode == MLX5_ESWITCH_OFFLOADS) {
18131813 mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_IB);
18141814 mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_ETH);
18151815 }
@@ -1817,22 +1817,23 @@ abort: · 1 unmodified line
18171817 return err;
18181818 }
18191819
1820−void mlx5_eswitch_disable_sriov(struct mlx5_eswitch *esw)
1820+void mlx5_eswitch_disable(struct mlx5_eswitch *esw)
18211821 {
18221822 struct esw_mc_addr *mc_promisc;
18231823 struct mlx5_vport *vport;
18241824 int old_mode;
18251825 int i;
18261826
1827− if (!ESW_ALLOWED(esw) || esw->mode == SRIOV_NONE)
1827+ if (!ESW_ALLOWED(esw) || esw->mode == MLX5_ESWITCH_NONE)
18281828 return;
18291829
1830− esw_info(esw->dev, "disable SRIOV: active vports(%d) mode(%d)\n",
1831− esw->enabled_vports, esw->mode);
1830+ esw_info(esw->dev, "Disable: mode(%s), nvfs(%d), active vports(%d)\n",
1831+ esw->mode == MLX5_ESWITCH_LEGACY ? "LEGACY" : "OFFLOADS",
1832+ esw->dev->priv.sriov.num_vfs, esw->enabled_vports);
18321833
18331834 mc_promisc = &esw->mc_promisc;
18341835
1835− if (esw->mode == SRIOV_LEGACY)
1836+ if (esw->mode == MLX5_ESWITCH_LEGACY)
18361837 mlx5_eq_notifier_unregister(esw->dev, &esw->nb);
18371838
18381839 mlx5_esw_for_all_vports(esw, i, vport)
@@ -1843,17 +1844,17 @@ void mlx5_eswitch_disable_sriov(struct mlx5_eswitch *esw) · 4 unmodified lines
18431844
18441845 esw_destroy_tsar(esw);
18451846
1846− if (esw->mode == SRIOV_LEGACY)
1847+ if (esw->mode == MLX5_ESWITCH_LEGACY)
18471848 esw_destroy_legacy_table(esw);
1848− else if (esw->mode == SRIOV_OFFLOADS)
1849+ else if (esw->mode == MLX5_ESWITCH_OFFLOADS)
18491850 esw_offloads_cleanup(esw);
18501851
18511852 old_mode = esw->mode;
1852− esw->mode = SRIOV_NONE;
1853+ esw->mode = MLX5_ESWITCH_NONE;
18531854
18541855 mlx5_lag_update(esw->dev);
18551856
1856− if (old_mode == SRIOV_OFFLOADS) {
1857+ if (old_mode == MLX5_ESWITCH_OFFLOADS) {
18571858 mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_IB);
18581859 mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_ETH);
18591860 }
@@ -1914,7 +1915,7 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev) · 54 unmodified lines
19141915 }
19151916
19161917 esw->enabled_vports = 0;
1917− esw->mode = SRIOV_NONE;
1918+ esw->mode = MLX5_ESWITCH_NONE;
19181919 esw->offloads.inline_mode = MLX5_INLINE_MODE_NONE;
19191920 if (MLX5_CAP_ESW_FLOWTABLE_FDB(dev, reformat) &&
19201921 MLX5_CAP_ESW_FLOWTABLE_FDB(dev, decap))
@@ -1984,7 +1985,7 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw, · 63 unmodified lines
19841985
19851986 ether_addr_copy(evport->info.mac, mac);
19861987 evport->info.node_guid = node_guid;
1987− if (evport->enabled && esw->mode == SRIOV_LEGACY)
1988+ if (evport->enabled && esw->mode == MLX5_ESWITCH_LEGACY)
19881989 err = esw_vport_ingress_config(esw, evport);
19891990
19901991 unlock:
@@ -2068,7 +2069,7 @@ int __mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw, · 77 unmodified lines
20682069
20692070 evport->info.vlan = vlan;
20702071 evport->info.qos = qos;
2071− if (evport->enabled && esw->mode == SRIOV_LEGACY) {
2072+ if (evport->enabled && esw->mode == MLX5_ESWITCH_LEGACY) {
20722073 err = esw_vport_ingress_config(esw, evport);
20732074 if (err)
20742075 goto unlock;
@@ -2110,7 +2111,7 @@ int mlx5_eswitch_set_vport_spoofchk(struct mlx5_eswitch *esw, · 35 unmodified lines
21102111 mlx5_core_warn(esw->dev,
21112112 "Spoofchk in set while MAC is invalid, vport(%d)\n",
21122113 evport->vport);
2113− if (evport->enabled && esw->mode == SRIOV_LEGACY)
2114+ if (evport->enabled && esw->mode == MLX5_ESWITCH_LEGACY)
21142115 err = esw_vport_ingress_config(esw, evport);
21152116 if (err)
21162117 evport->info.spoofchk = pschk;
@@ -2206,7 +2207,7 @@ int mlx5_eswitch_set_vepa(struct mlx5_eswitch *esw, u8 setting) · 89 unmodified lines
22062207 return -EPERM;
22072208
22082209 mutex_lock(&esw->state_lock);
2209− if (esw->mode != SRIOV_LEGACY) {
2210+ if (esw->mode != MLX5_ESWITCH_LEGACY) {
22102211 err = -EOPNOTSUPP;
22112212 goto out;
22122213 }
@@ -2229,7 +2230,7 @@ int mlx5_eswitch_get_vepa(struct mlx5_eswitch *esw, u8 *setting) · 16 unmodified lines
22292230 return -EPERM;
22302231
22312232 mutex_lock(&esw->state_lock);
2232− if (esw->mode != SRIOV_LEGACY) {
2233+ if (esw->mode != MLX5_ESWITCH_LEGACY) {
22332234 err = -EOPNOTSUPP;
22342235 goto out;
22352236 }
@@ -2372,7 +2373,7 @@ static int mlx5_eswitch_query_vport_drop_stats(struct mlx5_core_dev *dev, · 136 unmodified lines
23722373 u64 bytes = 0;
23732374 int err = 0;
23742375
2375− if (!vport->enabled || esw->mode != SRIOV_LEGACY)
2376+ if (!vport->enabled || esw->mode != MLX5_ESWITCH_LEGACY)
23762377 return 0;
23772378
23782379 if (vport->egress.drop_counter)
@@ -2482,7 +2483,7 @@ free_out: · 103 unmodified lines
24822483
24832484 u8 mlx5_eswitch_mode(struct mlx5_eswitch *esw)
24842485 {
2485− return ESW_ALLOWED(esw) ? esw->mode : SRIOV_NONE;
2486+ return ESW_ALLOWED(esw) ? esw->mode : MLX5_ESWITCH_NONE;
24862487 }
24872488 EXPORT_SYMBOL_GPL(mlx5_eswitch_mode);
24882489
@@ -2499,10 +2500,10 @@ EXPORT_SYMBOL(mlx5_eswitch_get_encap_mode); · 10 unmodified lines
24992500
25002501 bool mlx5_esw_lag_prereq(struct mlx5_core_dev *dev0, struct mlx5_core_dev *dev1)
25012502 {
2502− if ((dev0->priv.eswitch->mode == SRIOV_NONE &&
2503− dev1->priv.eswitch->mode == SRIOV_NONE) ||
2504− (dev0->priv.eswitch->mode == SRIOV_OFFLOADS &&
2505− dev1->priv.eswitch->mode == SRIOV_OFFLOADS))
2503+ if ((dev0->priv.eswitch->mode == MLX5_ESWITCH_NONE &&
2504+ dev1->priv.eswitch->mode == MLX5_ESWITCH_NONE) ||
2505+ (dev0->priv.eswitch->mode == MLX5_ESWITCH_OFFLOADS &&
2506+ dev1->priv.eswitch->mode == MLX5_ESWITCH_OFFLOADS))
25062507 return true;
25072508
25082509 return false;
@@ -2511,6 +2512,6 @@ bool mlx5_esw_lag_prereq(struct mlx5_core_dev *dev0, struct mlx5_core_dev *dev1) · 2 unmodified lines
25112512 bool mlx5_esw_multipath_prereq(struct mlx5_core_dev *dev0,
25122513 struct mlx5_core_dev *dev1)
25132514 {
2514− return (dev0->priv.eswitch->mode == SRIOV_OFFLOADS &&
2515− dev1->priv.eswitch->mode == SRIOV_OFFLOADS);
2515+ return (dev0->priv.eswitch->mode == MLX5_ESWITCH_OFFLOADS &&
2516+ dev1->priv.eswitch->mode == MLX5_ESWITCH_OFFLOADS);
25162517 }
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h+4−4
@@ -253,8 +253,8 @@ void esw_vport_del_ingress_acl_modify_metadata(struct mlx5_eswitch *esw, · 252 unmodified lines
253253 /* E-Switch API */
254254 int mlx5_eswitch_init(struct mlx5_core_dev *dev);
255255 void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw);
256−int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode);
257−void mlx5_eswitch_disable_sriov(struct mlx5_eswitch *esw);
256+int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int nvfs, int mode);
257+void mlx5_eswitch_disable(struct mlx5_eswitch *esw);
258258 int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
259259 int vport, u8 mac[ETH_ALEN]);
260260 int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw,
@@ -528,8 +528,8 @@ bool mlx5_eswitch_is_vf_vport(const struct mlx5_eswitch *esw, u16 vport_num); · 267 unmodified lines
528528 /* eswitch API stubs */
529529 static inline int mlx5_eswitch_init(struct mlx5_core_dev *dev) { return 0; }
530530 static inline void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw) {}
531−static inline int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode) { return 0; }
532−static inline void mlx5_eswitch_disable_sriov(struct mlx5_eswitch *esw) {}
531+static inline int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int nvfs, int mode) { return 0; }
532+static inline void mlx5_eswitch_disable(struct mlx5_eswitch *esw) {}
533533 static inline bool mlx5_esw_lag_prereq(struct mlx5_core_dev *dev0, struct mlx5_core_dev *dev1) { return true; }
534534 static inline bool mlx5_eswitch_is_funcs_handler(struct mlx5_core_dev *dev) { return false; }
535535 static inline int
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c+16−16
@@ -147,7 +147,7 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw, · 146 unmodified lines
147147 struct mlx5_flow_table *fdb;
148148 int j, i = 0;
149149
150− if (esw->mode != SRIOV_OFFLOADS)
150+ if (esw->mode != MLX5_ESWITCH_OFFLOADS)
151151 return ERR_PTR(-EOPNOTSUPP);
152152
153153 flow_act.action = attr->action;
@@ -1358,19 +1358,19 @@ static int esw_offloads_start(struct mlx5_eswitch *esw, · 1204 unmodified lines
13581358 {
13591359 int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs;
13601360
1361− if (esw->mode != SRIOV_LEGACY &&
1361+ if (esw->mode != MLX5_ESWITCH_LEGACY &&
13621362 !mlx5_core_is_ecpf_esw_manager(esw->dev)) {
13631363 NL_SET_ERR_MSG_MOD(extack,
13641364 "Can't set offloads mode, SRIOV legacy not enabled");
13651365 return -EINVAL;
13661366 }
13671367
1368− mlx5_eswitch_disable_sriov(esw);
1369− err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_OFFLOADS);
1368+ mlx5_eswitch_disable(esw);
1369+ err = mlx5_eswitch_enable(esw, num_vfs, MLX5_ESWITCH_OFFLOADS);
13701370 if (err) {
13711371 NL_SET_ERR_MSG_MOD(extack,
13721372 "Failed setting eswitch to offloads");
1373− err1 = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY);
1373+ err1 = mlx5_eswitch_enable(esw, num_vfs, MLX5_ESWITCH_LEGACY);
13741374 if (err1) {
13751375 NL_SET_ERR_MSG_MOD(extack,
13761376 "Failed setting eswitch back to legacy");
@@ -2174,11 +2174,11 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw, · 797 unmodified lines
21742174 {
21752175 int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs;
21762176
2177− mlx5_eswitch_disable_sriov(esw);
2178− err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY);
2177+ mlx5_eswitch_disable(esw);
2178+ err = mlx5_eswitch_enable(esw, num_vfs, MLX5_ESWITCH_LEGACY);
21792179 if (err) {
21802180 NL_SET_ERR_MSG_MOD(extack, "Failed setting eswitch to legacy");
2181− err1 = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_OFFLOADS);
2181+ err1 = mlx5_eswitch_enable(esw, num_vfs, MLX5_ESWITCH_OFFLOADS);
21822182 if (err1) {
21832183 NL_SET_ERR_MSG_MOD(extack,
21842184 "Failed setting eswitch back to offloads");
@@ -2203,10 +2203,10 @@ static int esw_mode_from_devlink(u16 mode, u16 *mlx5_mode) · 18 unmodified lines
22032203 {
22042204 switch (mode) {
22052205 case DEVLINK_ESWITCH_MODE_LEGACY:
2206− *mlx5_mode = SRIOV_LEGACY;
2206+ *mlx5_mode = MLX5_ESWITCH_LEGACY;
22072207 break;
22082208 case DEVLINK_ESWITCH_MODE_SWITCHDEV:
2209− *mlx5_mode = SRIOV_OFFLOADS;
2209+ *mlx5_mode = MLX5_ESWITCH_OFFLOADS;
22102210 break;
22112211 default:
22122212 return -EINVAL;
@@ -2218,10 +2218,10 @@ static int esw_mode_from_devlink(u16 mode, u16 *mlx5_mode) · 5 unmodified lines
22182218 static int esw_mode_to_devlink(u16 mlx5_mode, u16 *mode)
22192219 {
22202220 switch (mlx5_mode) {
2221− case SRIOV_LEGACY:
2221+ case MLX5_ESWITCH_LEGACY:
22222222 *mode = DEVLINK_ESWITCH_MODE_LEGACY;
22232223 break;
2224− case SRIOV_OFFLOADS:
2224+ case MLX5_ESWITCH_OFFLOADS:
22252225 *mode = DEVLINK_ESWITCH_MODE_SWITCHDEV;
22262226 break;
22272227 default:
@@ -2285,7 +2285,7 @@ static int mlx5_devlink_eswitch_check(struct devlink *devlink) · 57 unmodified lines
22852285 if(!MLX5_ESWITCH_MANAGER(dev))
22862286 return -EPERM;
22872287
2288− if (dev->priv.eswitch->mode == SRIOV_NONE &&
2288+ if (dev->priv.eswitch->mode == MLX5_ESWITCH_NONE &&
22892289 !mlx5_core_is_ecpf_esw_manager(dev))
22902290 return -EOPNOTSUPP;
22912291
@@ -2408,7 +2408,7 @@ int mlx5_eswitch_inline_mode_get(struct mlx5_eswitch *esw, int nvfs, u8 *mode) · 116 unmodified lines
24082408 if (!MLX5_CAP_GEN(dev, vport_group_manager))
24092409 return -EOPNOTSUPP;
24102410
2411− if (esw->mode == SRIOV_NONE)
2411+ if (esw->mode == MLX5_ESWITCH_NONE)
24122412 return -EOPNOTSUPP;
24132413
24142414 switch (MLX5_CAP_ETH(dev, wqe_inline_mode)) {
@@ -2455,7 +2455,7 @@ int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink, · 40 unmodified lines
24552455 if (encap && encap != DEVLINK_ESWITCH_ENCAP_MODE_BASIC)
24562456 return -EOPNOTSUPP;
24572457
2458− if (esw->mode == SRIOV_LEGACY) {
2458+ if (esw->mode == MLX5_ESWITCH_LEGACY) {
24592459 esw->offloads.encap = encap;
24602460 return 0;
24612461 }
@@ -2522,7 +2522,7 @@ void mlx5_eswitch_unregister_vport_reps(struct mlx5_eswitch *esw, u8 rep_type) · 60 unmodified lines
25222522 struct mlx5_eswitch_rep *rep;
25232523 int i;
25242524
2525− if (esw->mode == SRIOV_OFFLOADS)
2525+ if (esw->mode == MLX5_ESWITCH_OFFLOADS)
25262526 __unload_reps_all_vport(esw, max_vf, rep_type);
25272527
25282528 mlx5_esw_for_all_reps(esw, i, rep)
drivers/net/ethernet/mellanox/mlx5/core/lag.c+2−2
@@ -305,8 +305,8 @@ static void mlx5_do_bond(struct mlx5_lag *ldev) · 304 unmodified lines
305305 !mlx5_sriov_is_enabled(dev1);
306306
307307 #ifdef CONFIG_MLX5_ESWITCH
308− roce_lag &= dev0->priv.eswitch->mode == SRIOV_NONE &&
309− dev1->priv.eswitch->mode == SRIOV_NONE;
308+ roce_lag &= dev0->priv.eswitch->mode == MLX5_ESWITCH_NONE &&
309+ dev1->priv.eswitch->mode == MLX5_ESWITCH_NONE;
310310 #endif
311311
312312 if (roce_lag)
drivers/net/ethernet/mellanox/mlx5/core/sriov.c+2−2
@@ -77,7 +77,7 @@ static int mlx5_device_enable_sriov(struct mlx5_core_dev *dev, int num_vfs) · 76 unmodified lines
7777 if (!MLX5_ESWITCH_MANAGER(dev))
7878 goto enable_vfs_hca;
7979
80− err = mlx5_eswitch_enable_sriov(dev->priv.eswitch, num_vfs, SRIOV_LEGACY);
80+ err = mlx5_eswitch_enable(dev->priv.eswitch, num_vfs, MLX5_ESWITCH_LEGACY);
8181 if (err) {
8282 mlx5_core_warn(dev,
8383 "failed to enable eswitch SRIOV (%d)\n", err);
@@ -126,7 +126,7 @@ static void mlx5_device_disable_sriov(struct mlx5_core_dev *dev) · 42 unmodified lines
126126 }
127127
128128 if (MLX5_ESWITCH_MANAGER(dev))
129− mlx5_eswitch_disable_sriov(dev->priv.eswitch);
129+ mlx5_eswitch_disable(dev->priv.eswitch);
130130
131131 if (mlx5_wait_for_pages(dev, &dev->priv.vfs_pages))
132132 mlx5_core_warn(dev, "timeout reclaiming VFs pages\n");
include/linux/mlx5/eswitch.h+3−3
@@ -12,9 +12,9 @@ · 11 unmodified lines
1212 #define MLX5_ESWITCH_MANAGER(mdev) MLX5_CAP_GEN(mdev, eswitch_manager)
1313
1414 enum {
15− SRIOV_NONE,
16− SRIOV_LEGACY,
17− SRIOV_OFFLOADS
15+ MLX5_ESWITCH_NONE,
16+ MLX5_ESWITCH_LEGACY,
17+ MLX5_ESWITCH_OFFLOADS
1818 };
1919
2020 enum {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t