* [PATCH net 1/6] net/mlx5e: Fix XDP error path of mlx5e_open_channel()
2016-11-03 23:48 [PATCH net 0/6] Mellanox 100G mlx5 fixes 2016-11-04 Saeed Mahameed
@ 2016-11-03 23:48 ` Saeed Mahameed
2016-11-03 23:48 ` [PATCH net 2/6] net/mlx5e: Re-arrange XDP SQ/CQ creation Saeed Mahameed
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Saeed Mahameed @ 2016-11-03 23:48 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Jesper Dangaard Brouer, Saeed Mahameed
In case of mlx5e_open_rq fails the error handling will jump to
label err_close_xdp_sq and will try to close the xdp_sq unconditionally.
xdp_sq is valid only in case of XDP use cases, i.e priv->xdp_prog is
not null.
To fix this in this patch we test xdp_sq validity prior to closing it.
In addition we now close the xdp_sq.cq as well.
Fixes: b5503b994ed5 ("net/mlx5e: XDP TX forwarding support")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reported-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index f4c687c..c83619d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1512,7 +1512,10 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
return 0;
err_close_xdp_sq:
- mlx5e_close_sq(&c->xdp_sq);
+ if (priv->xdp_prog) {
+ mlx5e_close_sq(&c->xdp_sq);
+ mlx5e_close_cq(&c->xdp_sq.cq);
+ }
err_close_sqs:
mlx5e_close_sqs(c);
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net 2/6] net/mlx5e: Re-arrange XDP SQ/CQ creation
2016-11-03 23:48 [PATCH net 0/6] Mellanox 100G mlx5 fixes 2016-11-04 Saeed Mahameed
2016-11-03 23:48 ` [PATCH net 1/6] net/mlx5e: Fix XDP error path of mlx5e_open_channel() Saeed Mahameed
@ 2016-11-03 23:48 ` Saeed Mahameed
2016-11-03 23:48 ` [PATCH net 3/6] net/mlx5e: Disallow changing name-space for VF representors Saeed Mahameed
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Saeed Mahameed @ 2016-11-03 23:48 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Jesper Dangaard Brouer, Saeed Mahameed
In mlx5e_open_channel CQs must be created before napi is enabled.
Here we move the XDP CQ creation to satisfy that fact.
mlx5e_close_channel is already working according to the right order.
Fixes: b5503b994ed5 ("net/mlx5e: XDP TX forwarding support")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reported-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 32 +++++++++++------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index c83619d..84e8b25 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1445,6 +1445,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
c->netdev = priv->netdev;
c->mkey_be = cpu_to_be32(priv->mdev->mlx5e_res.mkey.key);
c->num_tc = priv->params.num_tc;
+ c->xdp = !!priv->xdp_prog;
if (priv->params.rx_am_enabled)
rx_cq_profile = mlx5e_am_get_def_profile(priv->params.rx_cq_period_mode);
@@ -1468,6 +1469,12 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
if (err)
goto err_close_tx_cqs;
+ /* XDP SQ CQ params are same as normal TXQ sq CQ params */
+ err = c->xdp ? mlx5e_open_cq(c, &cparam->tx_cq, &c->xdp_sq.cq,
+ priv->params.tx_cq_moderation) : 0;
+ if (err)
+ goto err_close_rx_cq;
+
napi_enable(&c->napi);
err = mlx5e_open_sq(c, 0, &cparam->icosq, &c->icosq);
@@ -1488,21 +1495,10 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
}
}
- if (priv->xdp_prog) {
- /* XDP SQ CQ params are same as normal TXQ sq CQ params */
- err = mlx5e_open_cq(c, &cparam->tx_cq, &c->xdp_sq.cq,
- priv->params.tx_cq_moderation);
- if (err)
- goto err_close_sqs;
-
- err = mlx5e_open_sq(c, 0, &cparam->xdp_sq, &c->xdp_sq);
- if (err) {
- mlx5e_close_cq(&c->xdp_sq.cq);
- goto err_close_sqs;
- }
- }
+ err = c->xdp ? mlx5e_open_sq(c, 0, &cparam->xdp_sq, &c->xdp_sq) : 0;
+ if (err)
+ goto err_close_sqs;
- c->xdp = !!priv->xdp_prog;
err = mlx5e_open_rq(c, &cparam->rq, &c->rq);
if (err)
goto err_close_xdp_sq;
@@ -1512,10 +1508,8 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
return 0;
err_close_xdp_sq:
- if (priv->xdp_prog) {
+ if (c->xdp)
mlx5e_close_sq(&c->xdp_sq);
- mlx5e_close_cq(&c->xdp_sq.cq);
- }
err_close_sqs:
mlx5e_close_sqs(c);
@@ -1525,6 +1519,10 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
err_disable_napi:
napi_disable(&c->napi);
+ if (c->xdp)
+ mlx5e_close_cq(&c->xdp_sq.cq);
+
+err_close_rx_cq:
mlx5e_close_cq(&c->rq.cq);
err_close_tx_cqs:
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net 3/6] net/mlx5e: Disallow changing name-space for VF representors
2016-11-03 23:48 [PATCH net 0/6] Mellanox 100G mlx5 fixes 2016-11-04 Saeed Mahameed
2016-11-03 23:48 ` [PATCH net 1/6] net/mlx5e: Fix XDP error path of mlx5e_open_channel() Saeed Mahameed
2016-11-03 23:48 ` [PATCH net 2/6] net/mlx5e: Re-arrange XDP SQ/CQ creation Saeed Mahameed
@ 2016-11-03 23:48 ` Saeed Mahameed
2016-11-03 23:48 ` [PATCH net 4/6] net/mlx5e: Handle matching on vlan priority for offloaded TC rules Saeed Mahameed
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Saeed Mahameed @ 2016-11-03 23:48 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Jesper Dangaard Brouer, Saeed Mahameed
From: Or Gerlitz <ogerlitz@mellanox.com>
VF reps should be altogether on the same NS as they were created.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 7fe6559..bf1c09c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -308,7 +308,7 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev)
netdev->switchdev_ops = &mlx5e_rep_switchdev_ops;
#endif
- netdev->features |= NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_TC;
+ netdev->features |= NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL;
netdev->hw_features |= NETIF_F_HW_TC;
eth_hw_addr_random(netdev);
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net 4/6] net/mlx5e: Handle matching on vlan priority for offloaded TC rules
2016-11-03 23:48 [PATCH net 0/6] Mellanox 100G mlx5 fixes 2016-11-04 Saeed Mahameed
` (2 preceding siblings ...)
2016-11-03 23:48 ` [PATCH net 3/6] net/mlx5e: Disallow changing name-space for VF representors Saeed Mahameed
@ 2016-11-03 23:48 ` Saeed Mahameed
2016-11-03 23:48 ` [PATCH net 5/6] net/mlx5: E-Switch, Set the actions for offloaded rules properly Saeed Mahameed
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Saeed Mahameed @ 2016-11-03 23:48 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Jesper Dangaard Brouer, Saeed Mahameed
From: Or Gerlitz <ogerlitz@mellanox.com>
We ignored the vlan priority in offloaded TC rules matching part,
fix that.
Fixes: 095b6cfd69ce ('net/mlx5e: Add TC vlan match parsing')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reported-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index ce8c54d..6bb21b3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -237,12 +237,15 @@ static int parse_cls_flower(struct mlx5e_priv *priv, struct mlx5_flow_spec *spec
skb_flow_dissector_target(f->dissector,
FLOW_DISSECTOR_KEY_VLAN,
f->mask);
- if (mask->vlan_id) {
+ if (mask->vlan_id || mask->vlan_priority) {
MLX5_SET(fte_match_set_lyr_2_4, headers_c, vlan_tag, 1);
MLX5_SET(fte_match_set_lyr_2_4, headers_v, vlan_tag, 1);
MLX5_SET(fte_match_set_lyr_2_4, headers_c, first_vid, mask->vlan_id);
MLX5_SET(fte_match_set_lyr_2_4, headers_v, first_vid, key->vlan_id);
+
+ MLX5_SET(fte_match_set_lyr_2_4, headers_c, first_prio, mask->vlan_priority);
+ MLX5_SET(fte_match_set_lyr_2_4, headers_v, first_prio, key->vlan_priority);
}
}
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net 5/6] net/mlx5: E-Switch, Set the actions for offloaded rules properly
2016-11-03 23:48 [PATCH net 0/6] Mellanox 100G mlx5 fixes 2016-11-04 Saeed Mahameed
` (3 preceding siblings ...)
2016-11-03 23:48 ` [PATCH net 4/6] net/mlx5e: Handle matching on vlan priority for offloaded TC rules Saeed Mahameed
@ 2016-11-03 23:48 ` Saeed Mahameed
2016-11-03 23:48 ` [PATCH net 6/6] net/mlx5: Fix invalid pointer reference when prof_sel parameter is invalid Saeed Mahameed
2016-11-04 19:00 ` [PATCH net 0/6] Mellanox 100G mlx5 fixes 2016-11-04 David Miller
6 siblings, 0 replies; 8+ messages in thread
From: Saeed Mahameed @ 2016-11-03 23:48 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Jesper Dangaard Brouer, Saeed Mahameed
From: Or Gerlitz <ogerlitz@mellanox.com>
As for the current generation of the mlx5 HW (CX4/CX4-Lx) per flow vlan
push/pop actions are emulated, we must not program them to the firmware.
Fixes: f5f82476090f ('net/mlx5: E-Switch, Support VLAN actions in the offloads mode')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reported-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index c55ad8d..d239f5d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -57,7 +57,8 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
if (esw->mode != SRIOV_OFFLOADS)
return ERR_PTR(-EOPNOTSUPP);
- action = attr->action;
+ /* per flow vlan pop/push is emulated, don't set that into the firmware */
+ action = attr->action & ~(MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH | MLX5_FLOW_CONTEXT_ACTION_VLAN_POP);
if (action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) {
dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net 6/6] net/mlx5: Fix invalid pointer reference when prof_sel parameter is invalid
2016-11-03 23:48 [PATCH net 0/6] Mellanox 100G mlx5 fixes 2016-11-04 Saeed Mahameed
` (4 preceding siblings ...)
2016-11-03 23:48 ` [PATCH net 5/6] net/mlx5: E-Switch, Set the actions for offloaded rules properly Saeed Mahameed
@ 2016-11-03 23:48 ` Saeed Mahameed
2016-11-04 19:00 ` [PATCH net 0/6] Mellanox 100G mlx5 fixes 2016-11-04 David Miller
6 siblings, 0 replies; 8+ messages in thread
From: Saeed Mahameed @ 2016-11-03 23:48 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Jesper Dangaard Brouer, Huy Nguyen,
Saeed Mahameed
From: Huy Nguyen <huyn@mellanox.com>
When prof_sel is invalid, mlx5_core_warn is called but the
mlx5_core_dev is not initialized yet. Solution is moving the prof_sel code
after dev->pdev assignment
Fixes: 2974ab6e8bd8 ('net/mlx5: Improve driver log messages')
Signed-off-by: Huy Nguyen <huyn@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index d5433c4..3eb9315 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -1226,6 +1226,9 @@ static int init_one(struct pci_dev *pdev,
pci_set_drvdata(pdev, dev);
+ dev->pdev = pdev;
+ dev->event = mlx5_core_event;
+
if (prof_sel < 0 || prof_sel >= ARRAY_SIZE(profile)) {
mlx5_core_warn(dev,
"selected profile out of range, selecting default (%d)\n",
@@ -1233,8 +1236,6 @@ static int init_one(struct pci_dev *pdev,
prof_sel = MLX5_DEFAULT_PROF;
}
dev->profile = &profile[prof_sel];
- dev->pdev = pdev;
- dev->event = mlx5_core_event;
INIT_LIST_HEAD(&priv->ctx_list);
spin_lock_init(&priv->ctx_lock);
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH net 0/6] Mellanox 100G mlx5 fixes 2016-11-04
2016-11-03 23:48 [PATCH net 0/6] Mellanox 100G mlx5 fixes 2016-11-04 Saeed Mahameed
` (5 preceding siblings ...)
2016-11-03 23:48 ` [PATCH net 6/6] net/mlx5: Fix invalid pointer reference when prof_sel parameter is invalid Saeed Mahameed
@ 2016-11-04 19:00 ` David Miller
6 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2016-11-04 19:00 UTC (permalink / raw)
To: saeedm; +Cc: netdev, ogerlitz, brouer
From: Saeed Mahameed <saeedm@mellanox.com>
Date: Fri, 4 Nov 2016 01:48:41 +0200
> This series contains six hot fixes of the mlx5 core and mlx5e driver.
>
> Huy fixed an invalid pointer dereference on initialization flow for when
> the selected mlx5 load profile is out of range.
>
> Or provided three eswitch offloads related fixes
> - Prevent changing NS of a VF representor.
> - Handle matching on vlan priority for offloaded TC rules
> - Set the actions for offloaded rules properly
>
> On my part I here addressed the error flow related issues in
> mlx5e_open_channel reported by Jesper just this week.
Series applied, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread