Skip to content

Commit 13e509a

Browse files
ogerlitzSaeed Mahameed
authored andcommitted
net/mlx5e: Remove leftover code from the PF netdev being uplink rep
Remove some last leftovers from using the PF netdev as the e-switch uplink representor. Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent d9ee049 commit 13e509a

File tree

3 files changed

+9
-119
lines changed

3 files changed

+9
-119
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4381,8 +4381,6 @@ const struct net_device_ops mlx5e_netdev_ops = {
43814381
.ndo_get_vf_config = mlx5e_get_vf_config,
43824382
.ndo_set_vf_link_state = mlx5e_set_vf_link_state,
43834383
.ndo_get_vf_stats = mlx5e_get_vf_stats,
4384-
.ndo_has_offload_stats = mlx5e_has_offload_stats,
4385-
.ndo_get_offload_stats = mlx5e_get_offload_stats,
43864384
#endif
43874385
};
43884386

@@ -5132,7 +5130,6 @@ static void mlx5e_detach(struct mlx5_core_dev *mdev, void *vpriv)
51325130
static void *mlx5e_add(struct mlx5_core_dev *mdev)
51335131
{
51345132
struct net_device *netdev;
5135-
void *rpriv = NULL;
51365133
void *priv;
51375134
int err;
51385135
int nch;
@@ -5141,21 +5138,11 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev)
51415138
if (err)
51425139
return NULL;
51435140

5144-
#ifdef CONFIG_MLX5_ESWITCH
5145-
if (MLX5_ESWITCH_MANAGER(mdev)) {
5146-
rpriv = mlx5e_alloc_nic_rep_priv(mdev);
5147-
if (!rpriv) {
5148-
mlx5_core_warn(mdev, "Failed to alloc NIC rep priv data\n");
5149-
return NULL;
5150-
}
5151-
}
5152-
#endif
5153-
51545141
nch = mlx5e_get_max_num_channels(mdev);
5155-
netdev = mlx5e_create_netdev(mdev, &mlx5e_nic_profile, nch, rpriv);
5142+
netdev = mlx5e_create_netdev(mdev, &mlx5e_nic_profile, nch, NULL);
51565143
if (!netdev) {
51575144
mlx5_core_err(mdev, "mlx5e_create_netdev failed\n");
5158-
goto err_free_rpriv;
5145+
return NULL;
51595146
}
51605147

51615148
priv = netdev_priv(netdev);
@@ -5181,8 +5168,6 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev)
51815168
mlx5e_detach(mdev, priv);
51825169
err_destroy_netdev:
51835170
mlx5e_destroy_netdev(priv);
5184-
err_free_rpriv:
5185-
kfree(rpriv);
51865171
return NULL;
51875172
}
51885173

@@ -5197,7 +5182,6 @@ static void mlx5e_remove(struct mlx5_core_dev *mdev, void *vpriv)
51975182
unregister_netdev(priv->netdev);
51985183
mlx5e_detach(mdev, vpriv);
51995184
mlx5e_destroy_netdev(priv);
5200-
kfree(ppriv);
52015185
}
52025186

52035187
static struct mlx5_interface mlx5e_interface = {

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

Lines changed: 7 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,22 +1139,7 @@ bool mlx5e_is_uplink_rep(struct mlx5e_priv *priv)
11391139
return (rep->vport == FDB_UPLINK_VPORT);
11401140
}
11411141

1142-
static bool mlx5e_is_vf_vport_rep(struct mlx5e_priv *priv)
1143-
{
1144-
struct mlx5e_rep_priv *rpriv = priv->ppriv;
1145-
struct mlx5_eswitch_rep *rep;
1146-
1147-
if (!MLX5_ESWITCH_MANAGER(priv->mdev))
1148-
return false;
1149-
1150-
rep = rpriv->rep;
1151-
if (rep && rep->vport != FDB_UPLINK_VPORT)
1152-
return true;
1153-
1154-
return false;
1155-
}
1156-
1157-
bool mlx5e_has_offload_stats(const struct net_device *dev, int attr_id)
1142+
static bool mlx5e_rep_has_offload_stats(const struct net_device *dev, int attr_id)
11581143
{
11591144
switch (attr_id) {
11601145
case IFLA_OFFLOAD_XSTATS_CPU_HIT:
@@ -1183,8 +1168,8 @@ mlx5e_get_sw_stats64(const struct net_device *dev,
11831168
return 0;
11841169
}
11851170

1186-
int mlx5e_get_offload_stats(int attr_id, const struct net_device *dev,
1187-
void *sp)
1171+
static int mlx5e_rep_get_offload_stats(int attr_id, const struct net_device *dev,
1172+
void *sp)
11881173
{
11891174
switch (attr_id) {
11901175
case IFLA_OFFLOAD_XSTATS_CPU_HIT:
@@ -1235,8 +1220,8 @@ static const struct net_device_ops mlx5e_netdev_ops_vf_rep = {
12351220
.ndo_get_phys_port_name = mlx5e_rep_get_phys_port_name,
12361221
.ndo_setup_tc = mlx5e_rep_setup_tc,
12371222
.ndo_get_stats64 = mlx5e_vf_rep_get_stats,
1238-
.ndo_has_offload_stats = mlx5e_has_offload_stats,
1239-
.ndo_get_offload_stats = mlx5e_get_offload_stats,
1223+
.ndo_has_offload_stats = mlx5e_rep_has_offload_stats,
1224+
.ndo_get_offload_stats = mlx5e_rep_get_offload_stats,
12401225
.ndo_change_mtu = mlx5e_vf_rep_change_mtu,
12411226
};
12421227

@@ -1247,8 +1232,8 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = {
12471232
.ndo_get_phys_port_name = mlx5e_rep_get_phys_port_name,
12481233
.ndo_setup_tc = mlx5e_rep_setup_tc,
12491234
.ndo_get_stats64 = mlx5e_get_stats,
1250-
.ndo_has_offload_stats = mlx5e_has_offload_stats,
1251-
.ndo_get_offload_stats = mlx5e_get_offload_stats,
1235+
.ndo_has_offload_stats = mlx5e_rep_has_offload_stats,
1236+
.ndo_get_offload_stats = mlx5e_rep_get_offload_stats,
12521237
.ndo_change_mtu = mlx5e_uplink_rep_change_mtu,
12531238
};
12541239

@@ -1550,69 +1535,6 @@ static const struct mlx5e_profile mlx5e_rep_profile = {
15501535
};
15511536

15521537
/* e-Switch vport representors */
1553-
1554-
static int
1555-
mlx5e_nic_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
1556-
{
1557-
struct mlx5e_rep_priv *rpriv = mlx5e_rep_to_rep_priv(rep);
1558-
struct mlx5e_priv *priv = netdev_priv(rpriv->netdev);
1559-
struct mlx5_rep_uplink_priv *uplink_priv = &rpriv->uplink_priv;
1560-
int err;
1561-
1562-
if (test_bit(MLX5E_STATE_OPENED, &priv->state)) {
1563-
err = mlx5e_add_sqs_fwd_rules(priv);
1564-
if (err)
1565-
return err;
1566-
}
1567-
1568-
err = mlx5e_rep_neigh_init(rpriv);
1569-
if (err)
1570-
goto err_remove_sqs;
1571-
1572-
/* init shared tc flow table */
1573-
err = mlx5e_tc_esw_init(&uplink_priv->tc_ht);
1574-
if (err)
1575-
goto err_neigh_cleanup;
1576-
1577-
/* init indirect block notifications */
1578-
INIT_LIST_HEAD(&uplink_priv->tc_indr_block_priv_list);
1579-
uplink_priv->netdevice_nb.notifier_call = mlx5e_nic_rep_netdevice_event;
1580-
err = register_netdevice_notifier(&uplink_priv->netdevice_nb);
1581-
if (err) {
1582-
mlx5_core_err(priv->mdev, "Failed to register netdev notifier\n");
1583-
goto err_indirect_block_cleanup;
1584-
}
1585-
1586-
return 0;
1587-
1588-
err_indirect_block_cleanup:
1589-
mlx5e_tc_esw_cleanup(&uplink_priv->tc_ht);
1590-
err_neigh_cleanup:
1591-
mlx5e_rep_neigh_cleanup(rpriv);
1592-
err_remove_sqs:
1593-
mlx5e_remove_sqs_fwd_rules(priv);
1594-
return err;
1595-
}
1596-
1597-
static void
1598-
mlx5e_nic_rep_unload(struct mlx5_eswitch_rep *rep)
1599-
{
1600-
struct mlx5e_rep_priv *rpriv = mlx5e_rep_to_rep_priv(rep);
1601-
struct mlx5e_priv *priv = netdev_priv(rpriv->netdev);
1602-
1603-
if (test_bit(MLX5E_STATE_OPENED, &priv->state))
1604-
mlx5e_remove_sqs_fwd_rules(priv);
1605-
1606-
/* clean indirect TC block notifications */
1607-
unregister_netdevice_notifier(&rpriv->uplink_priv.netdevice_nb);
1608-
mlx5e_rep_indr_clean_block_privs(rpriv);
1609-
1610-
/* clean uplink offloaded TC rules, delete shared tc flow table */
1611-
mlx5e_tc_esw_cleanup(&rpriv->uplink_priv.tc_ht);
1612-
1613-
mlx5e_rep_neigh_cleanup(rpriv);
1614-
}
1615-
16161538
static int
16171539
mlx5e_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
16181540
{
@@ -1726,16 +1648,3 @@ void mlx5e_rep_unregister_vport_reps(struct mlx5e_priv *priv)
17261648
for (vport = total_vfs - 1; vport >= 0; vport--)
17271649
mlx5_eswitch_unregister_vport_rep(esw, vport, REP_ETH);
17281650
}
1729-
1730-
void *mlx5e_alloc_nic_rep_priv(struct mlx5_core_dev *mdev)
1731-
{
1732-
struct mlx5_eswitch *esw = mdev->priv.eswitch;
1733-
struct mlx5e_rep_priv *rpriv;
1734-
1735-
rpriv = kzalloc(sizeof(*rpriv), GFP_KERNEL);
1736-
if (!rpriv)
1737-
return NULL;
1738-
1739-
rpriv->rep = &esw->offloads.vport_reps[0];
1740-
return rpriv;
1741-
}

drivers/net/ethernet/mellanox/mlx5/core/en_rep.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,6 @@ bool mlx5e_is_uplink_rep(struct mlx5e_priv *priv);
168168
int mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv);
169169
void mlx5e_remove_sqs_fwd_rules(struct mlx5e_priv *priv);
170170

171-
int mlx5e_get_offload_stats(int attr_id, const struct net_device *dev, void *sp);
172-
bool mlx5e_has_offload_stats(const struct net_device *dev, int attr_id);
173-
174171
void mlx5e_handle_rx_cqe_rep(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe);
175172

176173
int mlx5e_rep_encap_entry_attach(struct mlx5e_priv *priv,

0 commit comments

Comments
 (0)