netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20
@ 2018-02-21  1:18 Saeed Mahameed
  2018-02-21  1:18 ` [net 01/11] net/mlx5e: Fix TCP checksum in LRO buffers Saeed Mahameed
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Saeed Mahameed @ 2018-02-21  1:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed

Hi Dave,

The following pull request includes some fixes for the mlx5 core and
netdevice driver.

Please pull and let me know if there's any issue.

-stable 4.10.y:
('net/mlx5e: Fix loopback self test when GRO is off')

-stable 4.12.y:
('net/mlx5e: Specify numa node when allocating drop rq')

-stable 4.13.y:
('net/mlx5e: Verify inline header size do not exceed SKB linear size')

-stable 4.15.y:
('net/mlx5e: Fix TCP checksum in LRO buffers')
('net/mlx5: Fix error handling when adding flow rules')

Thanks,
Saeed.

--- 

The following changes since commit 7928b2cbe55b2a410a0f5c1f154610059c57b1b2:

  Linux 4.16-rc1 (2018-02-11 15:04:29 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2018-02-20

for you to fetch changes up to 9238e380e823a39983ee8d6b6ee8d1a9c4ba8a65:

  net/mlx5: Fix error handling when adding flow rules (2018-02-20 12:53:00 -0800)

----------------------------------------------------------------
mlx5-fixes-2018-02-20

----------------------------------------------------------------
Daniel Jurgens (1):
      net/mlx5: Use 128B cacheline size for 128B or larger cachelines

Eran Ben Elisha (1):
      net/mlx5e: Verify inline header size do not exceed SKB linear size

Eugenia Emantayev (1):
      net/mlx5: E-Switch, Fix drop counters use before creation

Gal Pressman (2):
      net/mlx5e: Fix TCP checksum in LRO buffers
      net/mlx5e: Specify numa node when allocating drop rq

Inbar Karmy (1):
      net/mlx5e: Fix loopback self test when GRO is off

Or Gerlitz (4):
      net/mlx5e: Eliminate build warnings on no previous prototype
      net/mlx5: Address static checker warnings on non-constant initializers
      net/mlx5e: Return error if prio is specified when offloading eswitch vlan push
      net/mlx5: Add header re-write to the checks for conflicting actions

Vlad Buslov (1):
      net/mlx5: Fix error handling when adding flow rules

 .../mellanox/mlx5/core/diag/fs_tracepoint.c        |  8 ++--
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  | 14 +++++--
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c    | 49 +++++++++++++++-------
 .../net/ethernet/mellanox/mlx5/core/en_selftest.c  |  3 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c    |  3 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c    |  2 +-
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.c  |  8 ++--
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c  | 13 ++++--
 .../net/ethernet/mellanox/mlx5/core/lib/clock.c    |  1 +
 drivers/net/ethernet/mellanox/mlx5/core/main.c     |  2 +-
 10 files changed, 70 insertions(+), 33 deletions(-)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [net 01/11] net/mlx5e: Fix TCP checksum in LRO buffers
  2018-02-21  1:18 [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 Saeed Mahameed
@ 2018-02-21  1:18 ` Saeed Mahameed
  2018-02-21  1:18 ` [net 02/11] net/mlx5e: Fix loopback self test when GRO is off Saeed Mahameed
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2018-02-21  1:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Gal Pressman, Saeed Mahameed

From: Gal Pressman <galp@mellanox.com>

When receiving an LRO packet, the checksum field is set by the hardware
to the checksum of the first coalesced packet. Obviously, this checksum
is not valid for the merged LRO packet and should be fixed.  We can use
the CQE checksum which covers the checksum of the entire merged packet
TCP payload to help us calculate the checksum incrementally.

Tested by sending IPv4/6 traffic with LRO enabled, RX checksum disabled
and watching nstat checksum error counters (in addition to the obvious
bandwidth drop caused by checksum errors).

This bug is usually "hidden" since LRO packets would go through the
CHECKSUM_UNNECESSARY flow which does not validate the packet checksum.

It's important to note that previous to this patch, LRO packets provided
with CHECKSUM_UNNECESSARY are indeed packets with a correct validated
checksum (even though the checksum inside the TCP header is incorrect),
since the hardware LRO aggregation is terminated upon receiving a packet
with bad checksum.

Fixes: e586b3b0baee ("net/mlx5: Ethernet Datapath files")
Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 49 ++++++++++++++++++-------
 1 file changed, 35 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 0d4bb0688faa..e5c3ab46a24a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -36,6 +36,7 @@
 #include <linux/tcp.h>
 #include <linux/bpf_trace.h>
 #include <net/busy_poll.h>
+#include <net/ip6_checksum.h>
 #include "en.h"
 #include "en_tc.h"
 #include "eswitch.h"
@@ -546,20 +547,33 @@ bool mlx5e_post_rx_mpwqes(struct mlx5e_rq *rq)
 	return true;
 }
 
+static void mlx5e_lro_update_tcp_hdr(struct mlx5_cqe64 *cqe, struct tcphdr *tcp)
+{
+	u8 l4_hdr_type = get_cqe_l4_hdr_type(cqe);
+	u8 tcp_ack     = (l4_hdr_type == CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA) ||
+			 (l4_hdr_type == CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA);
+
+	tcp->check                      = 0;
+	tcp->psh                        = get_cqe_lro_tcppsh(cqe);
+
+	if (tcp_ack) {
+		tcp->ack                = 1;
+		tcp->ack_seq            = cqe->lro_ack_seq_num;
+		tcp->window             = cqe->lro_tcp_win;
+	}
+}
+
 static void mlx5e_lro_update_hdr(struct sk_buff *skb, struct mlx5_cqe64 *cqe,
 				 u32 cqe_bcnt)
 {
 	struct ethhdr	*eth = (struct ethhdr *)(skb->data);
 	struct tcphdr	*tcp;
 	int network_depth = 0;
+	__wsum check;
 	__be16 proto;
 	u16 tot_len;
 	void *ip_p;
 
-	u8 l4_hdr_type = get_cqe_l4_hdr_type(cqe);
-	u8 tcp_ack = (l4_hdr_type == CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA) ||
-		(l4_hdr_type == CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA);
-
 	proto = __vlan_get_protocol(skb, eth->h_proto, &network_depth);
 
 	tot_len = cqe_bcnt - network_depth;
@@ -576,23 +590,30 @@ static void mlx5e_lro_update_hdr(struct sk_buff *skb, struct mlx5_cqe64 *cqe,
 		ipv4->check             = 0;
 		ipv4->check             = ip_fast_csum((unsigned char *)ipv4,
 						       ipv4->ihl);
+
+		mlx5e_lro_update_tcp_hdr(cqe, tcp);
+		check = csum_partial(tcp, tcp->doff * 4,
+				     csum_unfold((__force __sum16)cqe->check_sum));
+		/* Almost done, don't forget the pseudo header */
+		tcp->check = csum_tcpudp_magic(ipv4->saddr, ipv4->daddr,
+					       tot_len - sizeof(struct iphdr),
+					       IPPROTO_TCP, check);
 	} else {
+		u16 payload_len = tot_len - sizeof(struct ipv6hdr);
 		struct ipv6hdr *ipv6 = ip_p;
 
 		tcp = ip_p + sizeof(struct ipv6hdr);
 		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
 
 		ipv6->hop_limit         = cqe->lro_min_ttl;
-		ipv6->payload_len       = cpu_to_be16(tot_len -
-						      sizeof(struct ipv6hdr));
-	}
-
-	tcp->psh = get_cqe_lro_tcppsh(cqe);
-
-	if (tcp_ack) {
-		tcp->ack                = 1;
-		tcp->ack_seq            = cqe->lro_ack_seq_num;
-		tcp->window             = cqe->lro_tcp_win;
+		ipv6->payload_len       = cpu_to_be16(payload_len);
+
+		mlx5e_lro_update_tcp_hdr(cqe, tcp);
+		check = csum_partial(tcp, tcp->doff * 4,
+				     csum_unfold((__force __sum16)cqe->check_sum));
+		/* Almost done, don't forget the pseudo header */
+		tcp->check = csum_ipv6_magic(&ipv6->saddr, &ipv6->daddr, payload_len,
+					     IPPROTO_TCP, check);
 	}
 }
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [net 02/11] net/mlx5e: Fix loopback self test when GRO is off
  2018-02-21  1:18 [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 Saeed Mahameed
  2018-02-21  1:18 ` [net 01/11] net/mlx5e: Fix TCP checksum in LRO buffers Saeed Mahameed
@ 2018-02-21  1:18 ` Saeed Mahameed
  2018-02-21  1:18 ` [net 03/11] net/mlx5e: Verify inline header size do not exceed SKB linear size Saeed Mahameed
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2018-02-21  1:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Inbar Karmy, Saeed Mahameed

From: Inbar Karmy <inbark@mellanox.com>

When GRO is off, the transport header pointer in sk_buff is
initialized to network's header.

To find the udp header, instead of using udp_hdr() which assumes
skb_network_header was set, manually calculate the udp header offset.

Fixes: 0952da791c97 ("net/mlx5e: Add support for loopback selftest")
Signed-off-by: Inbar Karmy <inbark@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
index 5a4608281f38..707976482c09 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
@@ -216,7 +216,8 @@ mlx5e_test_loopback_validate(struct sk_buff *skb,
 	if (iph->protocol != IPPROTO_UDP)
 		goto out;
 
-	udph = udp_hdr(skb);
+	/* Don't assume skb_transport_header() was set */
+	udph = (struct udphdr *)((u8 *)iph + 4 * iph->ihl);
 	if (udph->dest != htons(9))
 		goto out;
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [net 03/11] net/mlx5e: Verify inline header size do not exceed SKB linear size
  2018-02-21  1:18 [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 Saeed Mahameed
  2018-02-21  1:18 ` [net 01/11] net/mlx5e: Fix TCP checksum in LRO buffers Saeed Mahameed
  2018-02-21  1:18 ` [net 02/11] net/mlx5e: Fix loopback self test when GRO is off Saeed Mahameed
@ 2018-02-21  1:18 ` Saeed Mahameed
  2018-02-21  1:18 ` [net 04/11] net/mlx5e: Eliminate build warnings on no previous prototype Saeed Mahameed
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2018-02-21  1:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Saeed Mahameed

From: Eran Ben Elisha <eranbe@mellanox.com>

Driver tries to copy at least MLX5E_MIN_INLINE bytes into the control
segment of the WQE. It assumes that the linear part contains at least
MLX5E_MIN_INLINE bytes, which can be wrong.

Cited commit verified that driver will not copy more bytes into the
inline header part that the actual size of the packet. Re-factor this
check to make sure we do not exceed the linear part as well.

This fix is aligned with the current driver's assumption that the entire
L2 will be present in the linear part of the SKB.

Fixes: 6aace17e64f4 ("net/mlx5e: Fix inline header size for small packets")
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index 569b42a01026..11b4f1089d1c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -176,7 +176,7 @@ static inline u16 mlx5e_calc_min_inline(enum mlx5_inline_modes mode,
 	default:
 		hlen = mlx5e_skb_l2_header_offset(skb);
 	}
-	return min_t(u16, hlen, skb->len);
+	return min_t(u16, hlen, skb_headlen(skb));
 }
 
 static inline void mlx5e_tx_skb_pull_inline(unsigned char **skb_data,
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [net 04/11] net/mlx5e: Eliminate build warnings on no previous prototype
  2018-02-21  1:18 [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 Saeed Mahameed
                   ` (2 preceding siblings ...)
  2018-02-21  1:18 ` [net 03/11] net/mlx5e: Verify inline header size do not exceed SKB linear size Saeed Mahameed
@ 2018-02-21  1:18 ` Saeed Mahameed
  2018-02-21  1:18 ` [net 05/11] net/mlx5: Address static checker warnings on non-constant initializers Saeed Mahameed
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2018-02-21  1:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Or Gerlitz, Saeed Mahameed

From: Or Gerlitz <ogerlitz@mellanox.com>

Fix these gcc warnings on drivers/net/ethernet/mellanox/mlx5:

[..]/core/lib/clock.c:454:6: warning: no previous prototype for 'mlx5_init_clock' [-Wmissing-prototypes]
[..]/core/lib/clock.c:510:6: warning: no previous prototype for 'mlx5_cleanup_clock' [-Wmissing-prototypes]
[..]/core/en_main.c:3141:5: warning: no previous prototype for 'mlx5e_setup_tc' [-Wmissing-prototypes]

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c   | 4 ++--
 drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 47bab842c5ee..a64b9226d281 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2994,8 +2994,8 @@ static int mlx5e_setup_tc_block(struct net_device *dev,
 }
 #endif
 
-int mlx5e_setup_tc(struct net_device *dev, enum tc_setup_type type,
-		   void *type_data)
+static int mlx5e_setup_tc(struct net_device *dev, enum tc_setup_type type,
+			  void *type_data)
 {
 	switch (type) {
 #ifdef CONFIG_MLX5_ESWITCH
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
index e159243e0fcf..857035583ccd 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
@@ -34,6 +34,7 @@
 #include <linux/highmem.h>
 #include <rdma/mlx5-abi.h>
 #include "en.h"
+#include "clock.h"
 
 enum {
 	MLX5_CYCLES_SHIFT	= 23
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [net 05/11] net/mlx5: Address static checker warnings on non-constant initializers
  2018-02-21  1:18 [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 Saeed Mahameed
                   ` (3 preceding siblings ...)
  2018-02-21  1:18 ` [net 04/11] net/mlx5e: Eliminate build warnings on no previous prototype Saeed Mahameed
@ 2018-02-21  1:18 ` Saeed Mahameed
  2018-02-21  1:18 ` [net 06/11] net/mlx5e: Return error if prio is specified when offloading eswitch vlan push Saeed Mahameed
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2018-02-21  1:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Or Gerlitz, Saeed Mahameed

From: Or Gerlitz <ogerlitz@mellanox.com>

Address these sparse warnings on drivers/net/ethernet/mellanox/mlx5

[..]/core/diag/fs_tracepoint.c:99:53: warning: non-constant initializer for static object
[..]/core/diag/fs_tracepoint.c:102:53: warning: non-constant initializer for static object

etc

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c b/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c
index 0be4575b58a2..fd509160c8f6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c
@@ -96,10 +96,10 @@ static void print_lyr_2_4_hdrs(struct trace_seq *p,
 					  "%pI4");
 		} else if (ethertype.v == ETH_P_IPV6) {
 			static const struct in6_addr full_ones = {
-				.in6_u.u6_addr32 = {htonl(0xffffffff),
-						    htonl(0xffffffff),
-						    htonl(0xffffffff),
-						    htonl(0xffffffff)},
+				.in6_u.u6_addr32 = {__constant_htonl(0xffffffff),
+						    __constant_htonl(0xffffffff),
+						    __constant_htonl(0xffffffff),
+						    __constant_htonl(0xffffffff)},
 			};
 			DECLARE_MASK_VAL(struct in6_addr, src_ipv6);
 			DECLARE_MASK_VAL(struct in6_addr, dst_ipv6);
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [net 06/11] net/mlx5e: Return error if prio is specified when offloading eswitch vlan push
  2018-02-21  1:18 [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 Saeed Mahameed
                   ` (4 preceding siblings ...)
  2018-02-21  1:18 ` [net 05/11] net/mlx5: Address static checker warnings on non-constant initializers Saeed Mahameed
@ 2018-02-21  1:18 ` Saeed Mahameed
  2018-02-21  1:18 ` [net 07/11] net/mlx5e: Specify numa node when allocating drop rq Saeed Mahameed
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2018-02-21  1:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Or Gerlitz, Saeed Mahameed

From: Or Gerlitz <ogerlitz@mellanox.com>

This isn't supported when we emulate eswitch vlan push action which
is the current state of things.

Fixes: 8b32580df1cb ('net/mlx5e: Add TC vlan action for SRIOV offloads')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 3 ++-
 1 file changed, 2 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 fd98b0dc610f..fa86a1466718 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -2529,7 +2529,8 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
 			if (tcf_vlan_action(a) == TCA_VLAN_ACT_POP) {
 				attr->action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_POP;
 			} else if (tcf_vlan_action(a) == TCA_VLAN_ACT_PUSH) {
-				if (tcf_vlan_push_proto(a) != htons(ETH_P_8021Q))
+				if (tcf_vlan_push_proto(a) != htons(ETH_P_8021Q) ||
+				    tcf_vlan_push_prio(a))
 					return -EOPNOTSUPP;
 
 				attr->action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH;
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [net 07/11] net/mlx5e: Specify numa node when allocating drop rq
  2018-02-21  1:18 [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 Saeed Mahameed
                   ` (5 preceding siblings ...)
  2018-02-21  1:18 ` [net 06/11] net/mlx5e: Return error if prio is specified when offloading eswitch vlan push Saeed Mahameed
@ 2018-02-21  1:18 ` Saeed Mahameed
  2018-02-21  1:18 ` [net 08/11] net/mlx5: Use 128B cacheline size for 128B or larger cachelines Saeed Mahameed
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2018-02-21  1:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Gal Pressman, Saeed Mahameed

From: Gal Pressman <galp@mellanox.com>

When allocating a drop rq, no numa node is explicitly set which means
allocations are done on node zero. This is not necessarily the nearest
numa node to the HCA, and even worse, might even be a memoryless numa
node.

Choose the numa_node given to us by the pci device in order to properly
allocate the coherent dma memory instead of assuming zero is valid.

Fixes: 556dd1b9c313 ("net/mlx5e: Set drop RQ's necessary parameters only")
Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index a64b9226d281..da94c8cba5ee 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1768,13 +1768,16 @@ static void mlx5e_build_rq_param(struct mlx5e_priv *priv,
 	param->wq.linear = 1;
 }
 
-static void mlx5e_build_drop_rq_param(struct mlx5e_rq_param *param)
+static void mlx5e_build_drop_rq_param(struct mlx5_core_dev *mdev,
+				      struct mlx5e_rq_param *param)
 {
 	void *rqc = param->rqc;
 	void *wq = MLX5_ADDR_OF(rqc, rqc, wq);
 
 	MLX5_SET(wq, wq, wq_type, MLX5_WQ_TYPE_LINKED_LIST);
 	MLX5_SET(wq, wq, log_wq_stride,    ilog2(sizeof(struct mlx5e_rx_wqe)));
+
+	param->wq.buf_numa_node = dev_to_node(&mdev->pdev->dev);
 }
 
 static void mlx5e_build_sq_param_common(struct mlx5e_priv *priv,
@@ -2634,6 +2637,9 @@ static int mlx5e_alloc_drop_cq(struct mlx5_core_dev *mdev,
 			       struct mlx5e_cq *cq,
 			       struct mlx5e_cq_param *param)
 {
+	param->wq.buf_numa_node = dev_to_node(&mdev->pdev->dev);
+	param->wq.db_numa_node  = dev_to_node(&mdev->pdev->dev);
+
 	return mlx5e_alloc_cq_common(mdev, param, cq);
 }
 
@@ -2645,7 +2651,7 @@ static int mlx5e_open_drop_rq(struct mlx5_core_dev *mdev,
 	struct mlx5e_cq *cq = &drop_rq->cq;
 	int err;
 
-	mlx5e_build_drop_rq_param(&rq_param);
+	mlx5e_build_drop_rq_param(mdev, &rq_param);
 
 	err = mlx5e_alloc_drop_cq(mdev, cq, &cq_param);
 	if (err)
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [net 08/11] net/mlx5: Use 128B cacheline size for 128B or larger cachelines
  2018-02-21  1:18 [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 Saeed Mahameed
                   ` (6 preceding siblings ...)
  2018-02-21  1:18 ` [net 07/11] net/mlx5e: Specify numa node when allocating drop rq Saeed Mahameed
@ 2018-02-21  1:18 ` Saeed Mahameed
  2018-02-21  1:18 ` [net 09/11] net/mlx5: Add header re-write to the checks for conflicting actions Saeed Mahameed
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2018-02-21  1:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Daniel Jurgens, Saeed Mahameed

From: Daniel Jurgens <danielj@mellanox.com>

The adapter uses the cache_line_128byte setting to set the bounds for
end padding. On systems where the cacheline size is greater than 128B
use 128B instead of the default of 64B. This results in fewer partial
cacheline writes. There's a 50% chance it will pad to the end of a 256B
cache line vs only 25% when using 64B.

Fixes: f32f5bd2eb7e ("net/mlx5: Configure cache line size for start and end padding")
Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 2ef641c91c26..ae391e4b7070 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -551,7 +551,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev)
 		MLX5_SET(cmd_hca_cap,
 			 set_hca_cap,
 			 cache_line_128byte,
-			 cache_line_size() == 128 ? 1 : 0);
+			 cache_line_size() >= 128 ? 1 : 0);
 
 	if (MLX5_CAP_GEN_MAX(dev, dct))
 		MLX5_SET(cmd_hca_cap, set_hca_cap, dct, 1);
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [net 09/11] net/mlx5: Add header re-write to the checks for conflicting actions
  2018-02-21  1:18 [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 Saeed Mahameed
                   ` (7 preceding siblings ...)
  2018-02-21  1:18 ` [net 08/11] net/mlx5: Use 128B cacheline size for 128B or larger cachelines Saeed Mahameed
@ 2018-02-21  1:18 ` Saeed Mahameed
  2018-02-21  1:18 ` [net 10/11] net/mlx5: E-Switch, Fix drop counters use before creation Saeed Mahameed
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2018-02-21  1:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Or Gerlitz, Saeed Mahameed

From: Or Gerlitz <ogerlitz@mellanox.com>

We can't allow only some of the rules sharing an FTE to ask for
header re-write, add it to the conflicting action checks.

Fixes: 0d235c3fabb7 ('net/mlx5: Add hash table to search FTEs in a flow-group')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index c025c98700e4..6caa4a7ad869 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -1429,7 +1429,8 @@ static bool check_conflicting_actions(u32 action1, u32 action2)
 
 	if (xored_actions & (MLX5_FLOW_CONTEXT_ACTION_DROP  |
 			     MLX5_FLOW_CONTEXT_ACTION_ENCAP |
-			     MLX5_FLOW_CONTEXT_ACTION_DECAP))
+			     MLX5_FLOW_CONTEXT_ACTION_DECAP |
+			     MLX5_FLOW_CONTEXT_ACTION_MOD_HDR))
 		return true;
 
 	return false;
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [net 10/11] net/mlx5: E-Switch, Fix drop counters use before creation
  2018-02-21  1:18 [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 Saeed Mahameed
                   ` (8 preceding siblings ...)
  2018-02-21  1:18 ` [net 09/11] net/mlx5: Add header re-write to the checks for conflicting actions Saeed Mahameed
@ 2018-02-21  1:18 ` Saeed Mahameed
  2018-02-21  1:18 ` [net 11/11] net/mlx5: Fix error handling when adding flow rules Saeed Mahameed
  2018-02-21 20:01 ` [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 David Miller
  11 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2018-02-21  1:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eugenia Emantayev, Saeed Mahameed

From: Eugenia Emantayev <eugenia@mellanox.com>

First use of drop counters happens in esw_apply_vport_conf function,
while they are allocated later in the flow. Fix that by moving
esw_vport_create_drop_counters function to be called before the first use.

Fixes: b8a0dbe3a90b ("net/mlx5e: E-switch, Add steering drop counters")
Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 5ecf2cddc16d..c2b1d7d351fc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -1529,6 +1529,10 @@ static void esw_enable_vport(struct mlx5_eswitch *esw, int vport_num,
 
 	esw_debug(esw->dev, "Enabling VPORT(%d)\n", vport_num);
 
+	/* Create steering drop counters for ingress and egress ACLs */
+	if (vport_num && esw->mode == SRIOV_LEGACY)
+		esw_vport_create_drop_counters(vport);
+
 	/* Restore old vport configuration */
 	esw_apply_vport_conf(esw, vport);
 
@@ -1545,10 +1549,6 @@ static void esw_enable_vport(struct mlx5_eswitch *esw, int vport_num,
 	if (!vport_num)
 		vport->info.trusted = true;
 
-	/* create steering drop counters for ingress and egress ACLs */
-	if (vport_num && esw->mode == SRIOV_LEGACY)
-		esw_vport_create_drop_counters(vport);
-
 	esw_vport_change_handle_locked(vport);
 
 	esw->enabled_vports++;
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [net 11/11] net/mlx5: Fix error handling when adding flow rules
  2018-02-21  1:18 [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 Saeed Mahameed
                   ` (9 preceding siblings ...)
  2018-02-21  1:18 ` [net 10/11] net/mlx5: E-Switch, Fix drop counters use before creation Saeed Mahameed
@ 2018-02-21  1:18 ` Saeed Mahameed
  2018-02-21 20:01 ` [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 David Miller
  11 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2018-02-21  1:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Vlad Buslov, Saeed Mahameed

From: Vlad Buslov <vladbu@mellanox.com>

If building match list or adding existing fg fails when
node is locked, function returned without unlocking it.
This happened if node version changed or adding existing fg
returned with EAGAIN after jumping to search_again_locked label.

Fixes: bd71b08ec2ee ("net/mlx5: Support multiple updates of steering rules in parallel")
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index 6caa4a7ad869..31fc2cfac3b3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -1759,8 +1759,11 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
 
 	/* Collect all fgs which has a matching match_criteria */
 	err = build_match_list(&match_head, ft, spec);
-	if (err)
+	if (err) {
+		if (take_write)
+			up_write_ref_node(&ft->node);
 		return ERR_PTR(err);
+	}
 
 	if (!take_write)
 		up_read_ref_node(&ft->node);
@@ -1769,8 +1772,11 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
 				      dest_num, version);
 	free_match_list(&match_head);
 	if (!IS_ERR(rule) ||
-	    (PTR_ERR(rule) != -ENOENT && PTR_ERR(rule) != -EAGAIN))
+	    (PTR_ERR(rule) != -ENOENT && PTR_ERR(rule) != -EAGAIN)) {
+		if (take_write)
+			up_write_ref_node(&ft->node);
 		return rule;
+	}
 
 	if (!take_write) {
 		nested_down_write_ref_node(&ft->node, FS_LOCK_GRANDPARENT);
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20
  2018-02-21  1:18 [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 Saeed Mahameed
                   ` (10 preceding siblings ...)
  2018-02-21  1:18 ` [net 11/11] net/mlx5: Fix error handling when adding flow rules Saeed Mahameed
@ 2018-02-21 20:01 ` David Miller
  11 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2018-02-21 20:01 UTC (permalink / raw)
  To: saeedm; +Cc: netdev

From: Saeed Mahameed <saeedm@mellanox.com>
Date: Tue, 20 Feb 2018 17:18:12 -0800

> The following pull request includes some fixes for the mlx5 core and
> netdevice driver.
> 
> Please pull and let me know if there's any issue.
> 
> -stable 4.10.y:
> ('net/mlx5e: Fix loopback self test when GRO is off')
> 
> -stable 4.12.y:
> ('net/mlx5e: Specify numa node when allocating drop rq')
> 
> -stable 4.13.y:
> ('net/mlx5e: Verify inline header size do not exceed SKB linear size')
> 
> -stable 4.15.y:
> ('net/mlx5e: Fix TCP checksum in LRO buffers')
> ('net/mlx5: Fix error handling when adding flow rules')

Pulled and queued up, thanks.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-02-21 20:01 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-21  1:18 [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 Saeed Mahameed
2018-02-21  1:18 ` [net 01/11] net/mlx5e: Fix TCP checksum in LRO buffers Saeed Mahameed
2018-02-21  1:18 ` [net 02/11] net/mlx5e: Fix loopback self test when GRO is off Saeed Mahameed
2018-02-21  1:18 ` [net 03/11] net/mlx5e: Verify inline header size do not exceed SKB linear size Saeed Mahameed
2018-02-21  1:18 ` [net 04/11] net/mlx5e: Eliminate build warnings on no previous prototype Saeed Mahameed
2018-02-21  1:18 ` [net 05/11] net/mlx5: Address static checker warnings on non-constant initializers Saeed Mahameed
2018-02-21  1:18 ` [net 06/11] net/mlx5e: Return error if prio is specified when offloading eswitch vlan push Saeed Mahameed
2018-02-21  1:18 ` [net 07/11] net/mlx5e: Specify numa node when allocating drop rq Saeed Mahameed
2018-02-21  1:18 ` [net 08/11] net/mlx5: Use 128B cacheline size for 128B or larger cachelines Saeed Mahameed
2018-02-21  1:18 ` [net 09/11] net/mlx5: Add header re-write to the checks for conflicting actions Saeed Mahameed
2018-02-21  1:18 ` [net 10/11] net/mlx5: E-Switch, Fix drop counters use before creation Saeed Mahameed
2018-02-21  1:18 ` [net 11/11] net/mlx5: Fix error handling when adding flow rules Saeed Mahameed
2018-02-21 20:01 ` [pull request][net 00/11] Mellanox, mlx5 fixes 2018-02-20 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).