aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-09-29 01:43:43 -0400
committerDavid S. Miller <davem@davemloft.net>2017-09-29 01:43:43 -0400
commit3e7e07288e1ab8e0770f4fdbf2905e6ecf917381 (patch)
tree9150646a4635cc63eadfae525eea2db4aaecfcb1
parent9d538fa60bad4f7b23193c89e843797a1cf71ef3 (diff)
parent353f59f4d41e9c5798a15c5c52958f25b579a3d5 (diff)
Merge tag 'mlx5-fixes-2017-09-28' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5-fixes-2017-09-28 Misc. fixes for mlx5 drivers. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.h4
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_fs.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_main.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_rx.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_stats.h6
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tc.c91
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tx.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/fpga/cmd.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/fpga/cmd.h2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/fs_core.h11
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/sriov.c2
-rw-r--r--include/linux/mlx5/device.h5
-rw-r--r--include/linux/mlx5/driver.h1
-rw-r--r--include/linux/mlx5/mlx5_ifc.h3
17 files changed, 133 insertions, 31 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.h b/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.h
index 1e3a6c3e4132..80eef4163f52 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.h
@@ -139,7 +139,7 @@ TRACE_EVENT(mlx5_fs_del_fg,
139 {MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO, "NEXT_PRIO"} 139 {MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO, "NEXT_PRIO"}
140 140
141TRACE_EVENT(mlx5_fs_set_fte, 141TRACE_EVENT(mlx5_fs_set_fte,
142 TP_PROTO(const struct fs_fte *fte, bool new_fte), 142 TP_PROTO(const struct fs_fte *fte, int new_fte),
143 TP_ARGS(fte, new_fte), 143 TP_ARGS(fte, new_fte),
144 TP_STRUCT__entry( 144 TP_STRUCT__entry(
145 __field(const struct fs_fte *, fte) 145 __field(const struct fs_fte *, fte)
@@ -149,7 +149,7 @@ TRACE_EVENT(mlx5_fs_set_fte,
149 __field(u32, action) 149 __field(u32, action)
150 __field(u32, flow_tag) 150 __field(u32, flow_tag)
151 __field(u8, mask_enable) 151 __field(u8, mask_enable)
152 __field(bool, new_fte) 152 __field(int, new_fte)
153 __array(u32, mask_outer, MLX5_ST_SZ_DW(fte_match_set_lyr_2_4)) 153 __array(u32, mask_outer, MLX5_ST_SZ_DW(fte_match_set_lyr_2_4))
154 __array(u32, mask_inner, MLX5_ST_SZ_DW(fte_match_set_lyr_2_4)) 154 __array(u32, mask_inner, MLX5_ST_SZ_DW(fte_match_set_lyr_2_4))
155 __array(u32, mask_misc, MLX5_ST_SZ_DW(fte_match_set_misc)) 155 __array(u32, mask_misc, MLX5_ST_SZ_DW(fte_match_set_misc))
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
index f11fd07ac4dd..850cdc980ab5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
@@ -291,7 +291,7 @@ void mlx5e_enable_vlan_filter(struct mlx5e_priv *priv)
291 priv->fs.vlan.filter_disabled = false; 291 priv->fs.vlan.filter_disabled = false;
292 if (priv->netdev->flags & IFF_PROMISC) 292 if (priv->netdev->flags & IFF_PROMISC)
293 return; 293 return;
294 mlx5e_del_any_vid_rules(priv); 294 mlx5e_del_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_CTAG_VID, 0);
295} 295}
296 296
297void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv) 297void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv)
@@ -302,7 +302,7 @@ void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv)
302 priv->fs.vlan.filter_disabled = true; 302 priv->fs.vlan.filter_disabled = true;
303 if (priv->netdev->flags & IFF_PROMISC) 303 if (priv->netdev->flags & IFF_PROMISC)
304 return; 304 return;
305 mlx5e_add_any_vid_rules(priv); 305 mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_CTAG_VID, 0);
306} 306}
307 307
308int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto, 308int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index dfc29720ab77..cc11bbbd0309 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -184,7 +184,6 @@ static void mlx5e_update_sw_counters(struct mlx5e_priv *priv)
184 struct mlx5e_sw_stats temp, *s = &temp; 184 struct mlx5e_sw_stats temp, *s = &temp;
185 struct mlx5e_rq_stats *rq_stats; 185 struct mlx5e_rq_stats *rq_stats;
186 struct mlx5e_sq_stats *sq_stats; 186 struct mlx5e_sq_stats *sq_stats;
187 u64 tx_offload_none = 0;
188 int i, j; 187 int i, j;
189 188
190 memset(s, 0, sizeof(*s)); 189 memset(s, 0, sizeof(*s));
@@ -199,6 +198,7 @@ static void mlx5e_update_sw_counters(struct mlx5e_priv *priv)
199 s->rx_lro_bytes += rq_stats->lro_bytes; 198 s->rx_lro_bytes += rq_stats->lro_bytes;
200 s->rx_csum_none += rq_stats->csum_none; 199 s->rx_csum_none += rq_stats->csum_none;
201 s->rx_csum_complete += rq_stats->csum_complete; 200 s->rx_csum_complete += rq_stats->csum_complete;
201 s->rx_csum_unnecessary += rq_stats->csum_unnecessary;
202 s->rx_csum_unnecessary_inner += rq_stats->csum_unnecessary_inner; 202 s->rx_csum_unnecessary_inner += rq_stats->csum_unnecessary_inner;
203 s->rx_xdp_drop += rq_stats->xdp_drop; 203 s->rx_xdp_drop += rq_stats->xdp_drop;
204 s->rx_xdp_tx += rq_stats->xdp_tx; 204 s->rx_xdp_tx += rq_stats->xdp_tx;
@@ -229,14 +229,11 @@ static void mlx5e_update_sw_counters(struct mlx5e_priv *priv)
229 s->tx_queue_dropped += sq_stats->dropped; 229 s->tx_queue_dropped += sq_stats->dropped;
230 s->tx_xmit_more += sq_stats->xmit_more; 230 s->tx_xmit_more += sq_stats->xmit_more;
231 s->tx_csum_partial_inner += sq_stats->csum_partial_inner; 231 s->tx_csum_partial_inner += sq_stats->csum_partial_inner;
232 tx_offload_none += sq_stats->csum_none; 232 s->tx_csum_none += sq_stats->csum_none;
233 s->tx_csum_partial += sq_stats->csum_partial;
233 } 234 }
234 } 235 }
235 236
236 /* Update calculated offload counters */
237 s->tx_csum_partial = s->tx_packets - tx_offload_none - s->tx_csum_partial_inner;
238 s->rx_csum_unnecessary = s->rx_packets - s->rx_csum_none - s->rx_csum_complete;
239
240 s->link_down_events_phy = MLX5_GET(ppcnt_reg, 237 s->link_down_events_phy = MLX5_GET(ppcnt_reg,
241 priv->stats.pport.phy_counters, 238 priv->stats.pport.phy_counters,
242 counter_set.phys_layer_cntrs.link_down_events); 239 counter_set.phys_layer_cntrs.link_down_events);
@@ -3333,8 +3330,8 @@ static int mlx5e_handle_feature(struct net_device *netdev,
3333 3330
3334 err = feature_handler(netdev, enable); 3331 err = feature_handler(netdev, enable);
3335 if (err) { 3332 if (err) {
3336 netdev_err(netdev, "%s feature 0x%llx failed err %d\n", 3333 netdev_err(netdev, "%s feature %pNF failed, err %d\n",
3337 enable ? "Enable" : "Disable", feature, err); 3334 enable ? "Enable" : "Disable", &feature, err);
3338 return err; 3335 return err;
3339 } 3336 }
3340 3337
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index f1dd638384d3..15a1687483cc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -627,6 +627,7 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
627 627
628 if (lro) { 628 if (lro) {
629 skb->ip_summed = CHECKSUM_UNNECESSARY; 629 skb->ip_summed = CHECKSUM_UNNECESSARY;
630 rq->stats.csum_unnecessary++;
630 return; 631 return;
631 } 632 }
632 633
@@ -644,7 +645,9 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
644 skb->csum_level = 1; 645 skb->csum_level = 1;
645 skb->encapsulation = 1; 646 skb->encapsulation = 1;
646 rq->stats.csum_unnecessary_inner++; 647 rq->stats.csum_unnecessary_inner++;
648 return;
647 } 649 }
650 rq->stats.csum_unnecessary++;
648 return; 651 return;
649 } 652 }
650csum_none: 653csum_none:
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
index 6d199ffb1c0b..f8637213afc0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
@@ -68,6 +68,7 @@ struct mlx5e_sw_stats {
68 u64 rx_xdp_drop; 68 u64 rx_xdp_drop;
69 u64 rx_xdp_tx; 69 u64 rx_xdp_tx;
70 u64 rx_xdp_tx_full; 70 u64 rx_xdp_tx_full;
71 u64 tx_csum_none;
71 u64 tx_csum_partial; 72 u64 tx_csum_partial;
72 u64 tx_csum_partial_inner; 73 u64 tx_csum_partial_inner;
73 u64 tx_queue_stopped; 74 u64 tx_queue_stopped;
@@ -108,6 +109,7 @@ static const struct counter_desc sw_stats_desc[] = {
108 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_drop) }, 109 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_drop) },
109 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx) }, 110 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx) },
110 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx_full) }, 111 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx_full) },
112 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_none) },
111 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial) }, 113 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial) },
112 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial_inner) }, 114 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial_inner) },
113 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_stopped) }, 115 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_stopped) },
@@ -339,6 +341,7 @@ struct mlx5e_rq_stats {
339 u64 packets; 341 u64 packets;
340 u64 bytes; 342 u64 bytes;
341 u64 csum_complete; 343 u64 csum_complete;
344 u64 csum_unnecessary;
342 u64 csum_unnecessary_inner; 345 u64 csum_unnecessary_inner;
343 u64 csum_none; 346 u64 csum_none;
344 u64 lro_packets; 347 u64 lro_packets;
@@ -363,6 +366,7 @@ static const struct counter_desc rq_stats_desc[] = {
363 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, packets) }, 366 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, packets) },
364 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, bytes) }, 367 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, bytes) },
365 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete) }, 368 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete) },
369 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary) },
366 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary_inner) }, 370 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary_inner) },
367 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_none) }, 371 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_none) },
368 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_drop) }, 372 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_drop) },
@@ -392,6 +396,7 @@ struct mlx5e_sq_stats {
392 u64 tso_bytes; 396 u64 tso_bytes;
393 u64 tso_inner_packets; 397 u64 tso_inner_packets;
394 u64 tso_inner_bytes; 398 u64 tso_inner_bytes;
399 u64 csum_partial;
395 u64 csum_partial_inner; 400 u64 csum_partial_inner;
396 u64 nop; 401 u64 nop;
397 /* less likely accessed in data path */ 402 /* less likely accessed in data path */
@@ -408,6 +413,7 @@ static const struct counter_desc sq_stats_desc[] = {
408 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_bytes) }, 413 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_bytes) },
409 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_packets) }, 414 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_packets) },
410 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_bytes) }, 415 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_bytes) },
416 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial) },
411 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) }, 417 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) },
412 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, nop) }, 418 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, nop) },
413 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_none) }, 419 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_none) },
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index da503e6411da..1aa2028ed995 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -1317,6 +1317,69 @@ static bool csum_offload_supported(struct mlx5e_priv *priv, u32 action, u32 upda
1317 return true; 1317 return true;
1318} 1318}
1319 1319
1320static bool modify_header_match_supported(struct mlx5_flow_spec *spec,
1321 struct tcf_exts *exts)
1322{
1323 const struct tc_action *a;
1324 bool modify_ip_header;
1325 LIST_HEAD(actions);
1326 u8 htype, ip_proto;
1327 void *headers_v;
1328 u16 ethertype;
1329 int nkeys, i;
1330
1331 headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, outer_headers);
1332 ethertype = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ethertype);
1333
1334 /* for non-IP we only re-write MACs, so we're okay */
1335 if (ethertype != ETH_P_IP && ethertype != ETH_P_IPV6)
1336 goto out_ok;
1337
1338 modify_ip_header = false;
1339 tcf_exts_to_list(exts, &actions);
1340 list_for_each_entry(a, &actions, list) {
1341 if (!is_tcf_pedit(a))
1342 continue;
1343
1344 nkeys = tcf_pedit_nkeys(a);
1345 for (i = 0; i < nkeys; i++) {
1346 htype = tcf_pedit_htype(a, i);
1347 if (htype == TCA_PEDIT_KEY_EX_HDR_TYPE_IP4 ||
1348 htype == TCA_PEDIT_KEY_EX_HDR_TYPE_IP6) {
1349 modify_ip_header = true;
1350 break;
1351 }
1352 }
1353 }
1354
1355 ip_proto = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ip_protocol);
1356 if (modify_ip_header && ip_proto != IPPROTO_TCP && ip_proto != IPPROTO_UDP) {
1357 pr_info("can't offload re-write of ip proto %d\n", ip_proto);
1358 return false;
1359 }
1360
1361out_ok:
1362 return true;
1363}
1364
1365static bool actions_match_supported(struct mlx5e_priv *priv,
1366 struct tcf_exts *exts,
1367 struct mlx5e_tc_flow_parse_attr *parse_attr,
1368 struct mlx5e_tc_flow *flow)
1369{
1370 u32 actions;
1371
1372 if (flow->flags & MLX5E_TC_FLOW_ESWITCH)
1373 actions = flow->esw_attr->action;
1374 else
1375 actions = flow->nic_attr->action;
1376
1377 if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
1378 return modify_header_match_supported(&parse_attr->spec, exts);
1379
1380 return true;
1381}
1382
1320static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, 1383static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
1321 struct mlx5e_tc_flow_parse_attr *parse_attr, 1384 struct mlx5e_tc_flow_parse_attr *parse_attr,
1322 struct mlx5e_tc_flow *flow) 1385 struct mlx5e_tc_flow *flow)
@@ -1378,6 +1441,9 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
1378 return -EINVAL; 1441 return -EINVAL;
1379 } 1442 }
1380 1443
1444 if (!actions_match_supported(priv, exts, parse_attr, flow))
1445 return -EOPNOTSUPP;
1446
1381 return 0; 1447 return 0;
1382} 1448}
1383 1449
@@ -1564,7 +1630,7 @@ static int mlx5e_create_encap_header_ipv4(struct mlx5e_priv *priv,
1564 break; 1630 break;
1565 default: 1631 default:
1566 err = -EOPNOTSUPP; 1632 err = -EOPNOTSUPP;
1567 goto out; 1633 goto free_encap;
1568 } 1634 }
1569 fl4.flowi4_tos = tun_key->tos; 1635 fl4.flowi4_tos = tun_key->tos;
1570 fl4.daddr = tun_key->u.ipv4.dst; 1636 fl4.daddr = tun_key->u.ipv4.dst;
@@ -1573,7 +1639,7 @@ static int mlx5e_create_encap_header_ipv4(struct mlx5e_priv *priv,
1573 err = mlx5e_route_lookup_ipv4(priv, mirred_dev, &out_dev, 1639 err = mlx5e_route_lookup_ipv4(priv, mirred_dev, &out_dev,
1574 &fl4, &n, &ttl); 1640 &fl4, &n, &ttl);
1575 if (err) 1641 if (err)
1576 goto out; 1642 goto free_encap;
1577 1643
1578 /* used by mlx5e_detach_encap to lookup a neigh hash table 1644 /* used by mlx5e_detach_encap to lookup a neigh hash table
1579 * entry in the neigh hash table when a user deletes a rule 1645 * entry in the neigh hash table when a user deletes a rule
@@ -1590,7 +1656,7 @@ static int mlx5e_create_encap_header_ipv4(struct mlx5e_priv *priv,
1590 */ 1656 */
1591 err = mlx5e_rep_encap_entry_attach(netdev_priv(out_dev), e); 1657 err = mlx5e_rep_encap_entry_attach(netdev_priv(out_dev), e);
1592 if (err) 1658 if (err)
1593 goto out; 1659 goto free_encap;
1594 1660
1595 read_lock_bh(&n->lock); 1661 read_lock_bh(&n->lock);
1596 nud_state = n->nud_state; 1662 nud_state = n->nud_state;
@@ -1630,8 +1696,9 @@ static int mlx5e_create_encap_header_ipv4(struct mlx5e_priv *priv,
1630 1696
1631destroy_neigh_entry: 1697destroy_neigh_entry:
1632 mlx5e_rep_encap_entry_detach(netdev_priv(e->out_dev), e); 1698 mlx5e_rep_encap_entry_detach(netdev_priv(e->out_dev), e);
1633out: 1699free_encap:
1634 kfree(encap_header); 1700 kfree(encap_header);
1701out:
1635 if (n) 1702 if (n)
1636 neigh_release(n); 1703 neigh_release(n);
1637 return err; 1704 return err;
@@ -1668,7 +1735,7 @@ static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv,
1668 break; 1735 break;
1669 default: 1736 default:
1670 err = -EOPNOTSUPP; 1737 err = -EOPNOTSUPP;
1671 goto out; 1738 goto free_encap;
1672 } 1739 }
1673 1740
1674 fl6.flowlabel = ip6_make_flowinfo(RT_TOS(tun_key->tos), tun_key->label); 1741 fl6.flowlabel = ip6_make_flowinfo(RT_TOS(tun_key->tos), tun_key->label);
@@ -1678,7 +1745,7 @@ static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv,
1678 err = mlx5e_route_lookup_ipv6(priv, mirred_dev, &out_dev, 1745 err = mlx5e_route_lookup_ipv6(priv, mirred_dev, &out_dev,
1679 &fl6, &n, &ttl); 1746 &fl6, &n, &ttl);
1680 if (err) 1747 if (err)
1681 goto out; 1748 goto free_encap;
1682 1749
1683 /* used by mlx5e_detach_encap to lookup a neigh hash table 1750 /* used by mlx5e_detach_encap to lookup a neigh hash table
1684 * entry in the neigh hash table when a user deletes a rule 1751 * entry in the neigh hash table when a user deletes a rule
@@ -1695,7 +1762,7 @@ static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv,
1695 */ 1762 */
1696 err = mlx5e_rep_encap_entry_attach(netdev_priv(out_dev), e); 1763 err = mlx5e_rep_encap_entry_attach(netdev_priv(out_dev), e);
1697 if (err) 1764 if (err)
1698 goto out; 1765 goto free_encap;
1699 1766
1700 read_lock_bh(&n->lock); 1767 read_lock_bh(&n->lock);
1701 nud_state = n->nud_state; 1768 nud_state = n->nud_state;
@@ -1736,8 +1803,9 @@ static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv,
1736 1803
1737destroy_neigh_entry: 1804destroy_neigh_entry:
1738 mlx5e_rep_encap_entry_detach(netdev_priv(e->out_dev), e); 1805 mlx5e_rep_encap_entry_detach(netdev_priv(e->out_dev), e);
1739out: 1806free_encap:
1740 kfree(encap_header); 1807 kfree(encap_header);
1808out:
1741 if (n) 1809 if (n)
1742 neigh_release(n); 1810 neigh_release(n);
1743 return err; 1811 return err;
@@ -1791,6 +1859,7 @@ vxlan_encap_offload_err:
1791 } 1859 }
1792 } 1860 }
1793 1861
1862 /* must verify if encap is valid or not */
1794 if (found) 1863 if (found)
1795 goto attach_flow; 1864 goto attach_flow;
1796 1865
@@ -1817,6 +1886,8 @@ attach_flow:
1817 *encap_dev = e->out_dev; 1886 *encap_dev = e->out_dev;
1818 if (e->flags & MLX5_ENCAP_ENTRY_VALID) 1887 if (e->flags & MLX5_ENCAP_ENTRY_VALID)
1819 attr->encap_id = e->encap_id; 1888 attr->encap_id = e->encap_id;
1889 else
1890 err = -EAGAIN;
1820 1891
1821 return err; 1892 return err;
1822 1893
@@ -1934,6 +2005,10 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
1934 2005
1935 return -EINVAL; 2006 return -EINVAL;
1936 } 2007 }
2008
2009 if (!actions_match_supported(priv, exts, parse_attr, flow))
2010 return -EOPNOTSUPP;
2011
1937 return err; 2012 return err;
1938} 2013}
1939 2014
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index fee43e40fa16..1d6925d4369a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -193,6 +193,7 @@ mlx5e_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb, struct
193 sq->stats.csum_partial_inner++; 193 sq->stats.csum_partial_inner++;
194 } else { 194 } else {
195 eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM; 195 eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM;
196 sq->stats.csum_partial++;
196 } 197 }
197 } else 198 } else
198 sq->stats.csum_none++; 199 sq->stats.csum_none++;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/fpga/cmd.c
index e37453d838db..c0fd2212e890 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/cmd.c
@@ -71,11 +71,11 @@ int mlx5_fpga_access_reg(struct mlx5_core_dev *dev, u8 size, u64 addr,
71 return 0; 71 return 0;
72} 72}
73 73
74int mlx5_fpga_caps(struct mlx5_core_dev *dev, u32 *caps) 74int mlx5_fpga_caps(struct mlx5_core_dev *dev)
75{ 75{
76 u32 in[MLX5_ST_SZ_DW(fpga_cap)] = {0}; 76 u32 in[MLX5_ST_SZ_DW(fpga_cap)] = {0};
77 77
78 return mlx5_core_access_reg(dev, in, sizeof(in), caps, 78 return mlx5_core_access_reg(dev, in, sizeof(in), dev->caps.fpga,
79 MLX5_ST_SZ_BYTES(fpga_cap), 79 MLX5_ST_SZ_BYTES(fpga_cap),
80 MLX5_REG_FPGA_CAP, 0, 0); 80 MLX5_REG_FPGA_CAP, 0, 0);
81} 81}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/cmd.h b/drivers/net/ethernet/mellanox/mlx5/core/fpga/cmd.h
index 94bdfd47c3f0..d05233c9b4f6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/cmd.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/cmd.h
@@ -65,7 +65,7 @@ struct mlx5_fpga_qp_counters {
65 u64 rx_total_drop; 65 u64 rx_total_drop;
66}; 66};
67 67
68int mlx5_fpga_caps(struct mlx5_core_dev *dev, u32 *caps); 68int mlx5_fpga_caps(struct mlx5_core_dev *dev);
69int mlx5_fpga_query(struct mlx5_core_dev *dev, struct mlx5_fpga_query *query); 69int mlx5_fpga_query(struct mlx5_core_dev *dev, struct mlx5_fpga_query *query);
70int mlx5_fpga_ctrl_op(struct mlx5_core_dev *dev, u8 op); 70int mlx5_fpga_ctrl_op(struct mlx5_core_dev *dev, u8 op);
71int mlx5_fpga_access_reg(struct mlx5_core_dev *dev, u8 size, u64 addr, 71int mlx5_fpga_access_reg(struct mlx5_core_dev *dev, u8 size, u64 addr,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c b/drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c
index 9034e9960a76..dc8970346521 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c
@@ -139,8 +139,7 @@ int mlx5_fpga_device_start(struct mlx5_core_dev *mdev)
139 if (err) 139 if (err)
140 goto out; 140 goto out;
141 141
142 err = mlx5_fpga_caps(fdev->mdev, 142 err = mlx5_fpga_caps(fdev->mdev);
143 fdev->mdev->caps.hca_cur[MLX5_CAP_FPGA]);
144 if (err) 143 if (err)
145 goto out; 144 goto out;
146 145
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
index e0d0efd903bc..36ecc2b2e187 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
@@ -293,6 +293,9 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
293 } 293 }
294 294
295 if (fte->action & MLX5_FLOW_CONTEXT_ACTION_COUNT) { 295 if (fte->action & MLX5_FLOW_CONTEXT_ACTION_COUNT) {
296 int max_list_size = BIT(MLX5_CAP_FLOWTABLE_TYPE(dev,
297 log_max_flow_counter,
298 ft->type));
296 int list_size = 0; 299 int list_size = 0;
297 300
298 list_for_each_entry(dst, &fte->node.children, node.list) { 301 list_for_each_entry(dst, &fte->node.children, node.list) {
@@ -305,12 +308,17 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
305 in_dests += MLX5_ST_SZ_BYTES(dest_format_struct); 308 in_dests += MLX5_ST_SZ_BYTES(dest_format_struct);
306 list_size++; 309 list_size++;
307 } 310 }
311 if (list_size > max_list_size) {
312 err = -EINVAL;
313 goto err_out;
314 }
308 315
309 MLX5_SET(flow_context, in_flow_context, flow_counter_list_size, 316 MLX5_SET(flow_context, in_flow_context, flow_counter_list_size,
310 list_size); 317 list_size);
311 } 318 }
312 319
313 err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); 320 err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
321err_out:
314 kvfree(in); 322 kvfree(in);
315 return err; 323 return err;
316} 324}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
index 5509a752f98e..48dd78975062 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
@@ -52,6 +52,7 @@ enum fs_flow_table_type {
52 FS_FT_FDB = 0X4, 52 FS_FT_FDB = 0X4,
53 FS_FT_SNIFFER_RX = 0X5, 53 FS_FT_SNIFFER_RX = 0X5,
54 FS_FT_SNIFFER_TX = 0X6, 54 FS_FT_SNIFFER_TX = 0X6,
55 FS_FT_MAX_TYPE = FS_FT_SNIFFER_TX,
55}; 56};
56 57
57enum fs_flow_table_op_mod { 58enum fs_flow_table_op_mod {
@@ -260,4 +261,14 @@ void mlx5_cleanup_fs(struct mlx5_core_dev *dev);
260#define fs_for_each_dst(pos, fte) \ 261#define fs_for_each_dst(pos, fte) \
261 fs_list_for_each_entry(pos, &(fte)->node.children) 262 fs_list_for_each_entry(pos, &(fte)->node.children)
262 263
264#define MLX5_CAP_FLOWTABLE_TYPE(mdev, cap, type) ( \
265 (type == FS_FT_NIC_RX) ? MLX5_CAP_FLOWTABLE_NIC_RX(mdev, cap) : \
266 (type == FS_FT_ESW_EGRESS_ACL) ? MLX5_CAP_ESW_EGRESS_ACL(mdev, cap) : \
267 (type == FS_FT_ESW_INGRESS_ACL) ? MLX5_CAP_ESW_INGRESS_ACL(mdev, cap) : \
268 (type == FS_FT_FDB) ? MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, cap) : \
269 (type == FS_FT_SNIFFER_RX) ? MLX5_CAP_FLOWTABLE_SNIFFER_RX(mdev, cap) : \
270 (type == FS_FT_SNIFFER_TX) ? MLX5_CAP_FLOWTABLE_SNIFFER_TX(mdev, cap) : \
271 (BUILD_BUG_ON_ZERO(FS_FT_SNIFFER_TX != FS_FT_MAX_TYPE))\
272 )
273
263#endif 274#endif
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
index 85298051a3e4..145e392ab849 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
@@ -572,12 +572,13 @@ void mlx5_rdma_netdev_free(struct net_device *netdev)
572{ 572{
573 struct mlx5e_priv *priv = mlx5i_epriv(netdev); 573 struct mlx5e_priv *priv = mlx5i_epriv(netdev);
574 const struct mlx5e_profile *profile = priv->profile; 574 const struct mlx5e_profile *profile = priv->profile;
575 struct mlx5_core_dev *mdev = priv->mdev;
575 576
576 mlx5e_detach_netdev(priv); 577 mlx5e_detach_netdev(priv);
577 profile->cleanup(priv); 578 profile->cleanup(priv);
578 destroy_workqueue(priv->wq); 579 destroy_workqueue(priv->wq);
579 free_netdev(netdev); 580 free_netdev(netdev);
580 581
581 mlx5e_destroy_mdev_resources(priv->mdev); 582 mlx5e_destroy_mdev_resources(mdev);
582} 583}
583EXPORT_SYMBOL(mlx5_rdma_netdev_free); 584EXPORT_SYMBOL(mlx5_rdma_netdev_free);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
index 6c48e9959b65..2a8b529ce6dd 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
@@ -109,7 +109,7 @@ static int mlx5_device_enable_sriov(struct mlx5_core_dev *dev, int num_vfs)
109 mlx5_core_warn(dev, 109 mlx5_core_warn(dev,
110 "failed to restore VF %d settings, err %d\n", 110 "failed to restore VF %d settings, err %d\n",
111 vf, err); 111 vf, err);
112 continue; 112 continue;
113 } 113 }
114 } 114 }
115 mlx5_core_dbg(dev, "successfully enabled VF* %d\n", vf); 115 mlx5_core_dbg(dev, "successfully enabled VF* %d\n", vf);
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index eaf4ad209c8f..e32dbc4934db 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -980,7 +980,6 @@ enum mlx5_cap_type {
980 MLX5_CAP_RESERVED, 980 MLX5_CAP_RESERVED,
981 MLX5_CAP_VECTOR_CALC, 981 MLX5_CAP_VECTOR_CALC,
982 MLX5_CAP_QOS, 982 MLX5_CAP_QOS,
983 MLX5_CAP_FPGA,
984 /* NUM OF CAP Types */ 983 /* NUM OF CAP Types */
985 MLX5_CAP_NUM 984 MLX5_CAP_NUM
986}; 985};
@@ -1110,10 +1109,10 @@ enum mlx5_mcam_feature_groups {
1110 MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_feature_cap_mask.enhanced_features.fld) 1109 MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_feature_cap_mask.enhanced_features.fld)
1111 1110
1112#define MLX5_CAP_FPGA(mdev, cap) \ 1111#define MLX5_CAP_FPGA(mdev, cap) \
1113 MLX5_GET(fpga_cap, (mdev)->caps.hca_cur[MLX5_CAP_FPGA], cap) 1112 MLX5_GET(fpga_cap, (mdev)->caps.fpga, cap)
1114 1113
1115#define MLX5_CAP64_FPGA(mdev, cap) \ 1114#define MLX5_CAP64_FPGA(mdev, cap) \
1116 MLX5_GET64(fpga_cap, (mdev)->caps.hca_cur[MLX5_CAP_FPGA], cap) 1115 MLX5_GET64(fpga_cap, (mdev)->caps.fpga, cap)
1117 1116
1118enum { 1117enum {
1119 MLX5_CMD_STAT_OK = 0x0, 1118 MLX5_CMD_STAT_OK = 0x0,
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 02ff700e4f30..401c8972cc3a 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -774,6 +774,7 @@ struct mlx5_core_dev {
774 u32 hca_max[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)]; 774 u32 hca_max[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)];
775 u32 pcam[MLX5_ST_SZ_DW(pcam_reg)]; 775 u32 pcam[MLX5_ST_SZ_DW(pcam_reg)];
776 u32 mcam[MLX5_ST_SZ_DW(mcam_reg)]; 776 u32 mcam[MLX5_ST_SZ_DW(mcam_reg)];
777 u32 fpga[MLX5_ST_SZ_DW(fpga_cap)];
777 } caps; 778 } caps;
778 phys_addr_t iseg_base; 779 phys_addr_t iseg_base;
779 struct mlx5_init_seg __iomem *iseg; 780 struct mlx5_init_seg __iomem *iseg;
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index a528b35a022e..69772347f866 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -327,7 +327,8 @@ struct mlx5_ifc_flow_table_prop_layout_bits {
327 u8 reserved_at_80[0x18]; 327 u8 reserved_at_80[0x18];
328 u8 log_max_destination[0x8]; 328 u8 log_max_destination[0x8];
329 329
330 u8 reserved_at_a0[0x18]; 330 u8 log_max_flow_counter[0x8];
331 u8 reserved_at_a8[0x10];
331 u8 log_max_flow[0x8]; 332 u8 log_max_flow[0x8];
332 333
333 u8 reserved_at_c0[0x40]; 334 u8 reserved_at_c0[0x40];