Skip to content

Commit d5fa9c5

Browse files
committed
Merge tag 'mlx5-updates-2019-03-01' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5-updates-2019-03-01 This series adds multipath offload support and contains some small updates to mlx5 driver. Multipath offload support from Roi Dayan: We are going to track SW multipath route and related nexthops and reflect that as port affinity to the HW. 1) Some patches are preparation. 2) add the multipath mode and fib events handling. 3) add support to handle offload failure for net error, i.e. port down. 4) Small updates to match the behavior of multipath Two small updates from Eran Ben Elisha, 5) Make a function static 6) Update PCIe supported devices list. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 4e7df11 + 85327a9 commit d5fa9c5

File tree

15 files changed

+606
-109
lines changed

15 files changed

+606
-109
lines changed

drivers/net/ethernet/mellanox/mlx5/core/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ mlx5_core-$(CONFIG_MLX5_CORE_EN) += en_main.o en_common.o en_fs.o en_ethtool.o \
3030
mlx5_core-$(CONFIG_MLX5_EN_ARFS) += en_arfs.o
3131
mlx5_core-$(CONFIG_MLX5_EN_RXNFC) += en_fs_ethtool.o
3232
mlx5_core-$(CONFIG_MLX5_CORE_EN_DCB) += en_dcbnl.o en/port_buffer.o
33-
mlx5_core-$(CONFIG_MLX5_ESWITCH) += en_rep.o en_tc.o en/tc_tun.o lib/port_tun.o
33+
mlx5_core-$(CONFIG_MLX5_ESWITCH) += en_rep.o en_tc.o en/tc_tun.o lib/port_tun.o lag_mp.o
3434

3535
#
3636
# Core extra

drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ int mlx5e_tx_reporter_timeout(struct mlx5e_txqsq *sq)
179179
/* state lock cannot be grabbed within this function.
180180
* It can cause a dead lock or a read-after-free.
181181
*/
182-
int mlx5e_tx_reporter_recover_from_ctx(struct mlx5e_tx_err_ctx *err_ctx)
182+
static int mlx5e_tx_reporter_recover_from_ctx(struct mlx5e_tx_err_ctx *err_ctx)
183183
{
184184
return err_ctx->recover(err_ctx->sq);
185185
}

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,24 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv,
5454
struct neighbour *n = NULL;
5555

5656
#if IS_ENABLED(CONFIG_INET)
57+
struct mlx5_core_dev *mdev = priv->mdev;
58+
struct net_device *uplink_dev;
5759
int ret;
5860

61+
if (mlx5_lag_is_multipath(mdev)) {
62+
struct mlx5_eswitch *esw = mdev->priv.eswitch;
63+
64+
uplink_dev = mlx5_eswitch_uplink_get_proto_dev(esw, REP_ETH);
65+
fl4->flowi4_oif = uplink_dev->ifindex;
66+
}
67+
5968
rt = ip_route_output_key(dev_net(mirred_dev), fl4);
6069
ret = PTR_ERR_OR_ZERO(rt);
6170
if (ret)
6271
return ret;
72+
73+
if (mlx5_lag_is_multipath(mdev) && !rt->rt_gateway)
74+
return -ENETUNREACH;
6375
#else
6476
return -EOPNOTSUPP;
6577
#endif
@@ -295,7 +307,9 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
295307

296308
if (!(nud_state & NUD_VALID)) {
297309
neigh_event_send(n, NULL);
298-
err = -EAGAIN;
310+
/* the encap entry will be made valid on neigh update event
311+
* and not used before that.
312+
*/
299313
goto out;
300314
}
301315

@@ -408,7 +422,9 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
408422

409423
if (!(nud_state & NUD_VALID)) {
410424
neigh_event_send(n, NULL);
411-
err = -EAGAIN;
425+
/* the encap entry will be made valid on neigh update event
426+
* and not used before that.
427+
*/
412428
goto out;
413429
}
414430

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

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,8 @@ static int mlx5e_init_rep_tx(struct mlx5e_priv *priv)
15731573
if (rpriv->rep->vport == MLX5_VPORT_UPLINK) {
15741574
uplink_priv = &rpriv->uplink_priv;
15751575

1576+
INIT_LIST_HEAD(&uplink_priv->unready_flows);
1577+
15761578
/* init shared tc flow table */
15771579
err = mlx5e_tc_esw_init(&uplink_priv->tc_ht);
15781580
if (err)
@@ -1632,34 +1634,48 @@ static void mlx5e_vf_rep_enable(struct mlx5e_priv *priv)
16321634
static int uplink_rep_async_event(struct notifier_block *nb, unsigned long event, void *data)
16331635
{
16341636
struct mlx5e_priv *priv = container_of(nb, struct mlx5e_priv, events_nb);
1635-
struct mlx5_eqe *eqe = data;
16361637

1637-
if (event != MLX5_EVENT_TYPE_PORT_CHANGE)
1638-
return NOTIFY_DONE;
1638+
if (event == MLX5_EVENT_TYPE_PORT_CHANGE) {
1639+
struct mlx5_eqe *eqe = data;
16391640

1640-
switch (eqe->sub_type) {
1641-
case MLX5_PORT_CHANGE_SUBTYPE_DOWN:
1642-
case MLX5_PORT_CHANGE_SUBTYPE_ACTIVE:
1643-
queue_work(priv->wq, &priv->update_carrier_work);
1644-
break;
1645-
default:
1646-
return NOTIFY_DONE;
1641+
switch (eqe->sub_type) {
1642+
case MLX5_PORT_CHANGE_SUBTYPE_DOWN:
1643+
case MLX5_PORT_CHANGE_SUBTYPE_ACTIVE:
1644+
queue_work(priv->wq, &priv->update_carrier_work);
1645+
break;
1646+
default:
1647+
return NOTIFY_DONE;
1648+
}
1649+
1650+
return NOTIFY_OK;
16471651
}
16481652

1649-
return NOTIFY_OK;
1653+
if (event == MLX5_DEV_EVENT_PORT_AFFINITY) {
1654+
struct mlx5e_rep_priv *rpriv = priv->ppriv;
1655+
1656+
queue_work(priv->wq, &rpriv->uplink_priv.reoffload_flows_work);
1657+
1658+
return NOTIFY_OK;
1659+
}
1660+
1661+
return NOTIFY_DONE;
16501662
}
16511663

16521664
static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv)
16531665
{
16541666
struct net_device *netdev = priv->netdev;
16551667
struct mlx5_core_dev *mdev = priv->mdev;
1668+
struct mlx5e_rep_priv *rpriv = priv->ppriv;
16561669
u16 max_mtu;
16571670

16581671
netdev->min_mtu = ETH_MIN_MTU;
16591672
mlx5_query_port_max_mtu(priv->mdev, &max_mtu, 1);
16601673
netdev->max_mtu = MLX5E_HW2SW_MTU(&priv->channels.params, max_mtu);
16611674
mlx5e_set_dev_port_mtu(priv);
16621675

1676+
INIT_WORK(&rpriv->uplink_priv.reoffload_flows_work,
1677+
mlx5e_tc_reoffload_flows_work);
1678+
16631679
mlx5_lag_add(mdev, netdev);
16641680
priv->events_nb.notifier_call = uplink_rep_async_event;
16651681
mlx5_notifier_register(mdev, &priv->events_nb);
@@ -1672,11 +1688,13 @@ static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv)
16721688
static void mlx5e_uplink_rep_disable(struct mlx5e_priv *priv)
16731689
{
16741690
struct mlx5_core_dev *mdev = priv->mdev;
1691+
struct mlx5e_rep_priv *rpriv = priv->ppriv;
16751692

16761693
#ifdef CONFIG_MLX5_CORE_EN_DCB
16771694
mlx5e_dcbnl_delete_app(priv);
16781695
#endif
16791696
mlx5_notifier_unregister(mdev, &priv->events_nb);
1697+
cancel_work_sync(&rpriv->uplink_priv.reoffload_flows_work);
16801698
mlx5_lag_remove(mdev);
16811699
}
16821700

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ struct mlx5_rep_uplink_priv {
7474
struct notifier_block netdevice_nb;
7575

7676
struct mlx5_tun_entropy tun_entropy;
77+
78+
struct list_head unready_flows;
79+
struct work_struct reoffload_flows_work;
7780
};
7881

7982
struct mlx5e_rep_priv {

0 commit comments

Comments
 (0)