From patchwork Wed Sep 25 08:07:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 1167035 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46dW0S3HSQz9sPq; Wed, 25 Sep 2019 18:08:39 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1iD2Lj-0000Vf-5D; Wed, 25 Sep 2019 08:08:35 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iD2Lg-0000UP-ED for kernel-team@lists.ubuntu.com; Wed, 25 Sep 2019 08:08:32 +0000 Received: from mail-wm1-f70.google.com ([209.85.128.70]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iD2Lg-0003LK-8g for kernel-team@lists.ubuntu.com; Wed, 25 Sep 2019 08:08:32 +0000 Received: by mail-wm1-f70.google.com with SMTP id k9so1640575wmb.0 for ; Wed, 25 Sep 2019 01:08:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S5SDFGKWeIdB9ouYuDTNCKtBZh801kO3YvTSaLK5KOE=; b=Dt2vfLvvAyipa96QMR6I+/MCWn9Y+WIGYE2vbVGBEL1JRoIV7sQpGzKWTZ1UzllJsv Wge/tYFyWEP9PM4I5hLhAnrW2lPcw0r+wL5TAeGrJZ7LYPOIylBM//WeZAEJp5kV+wiY URQ9IGi5gA6WePMlpEfPWE5J/oP+FOvFCfvG5vpMzVjGYEUPREepH8wVIy0CMFVeVlwj TXeJIUMfNLIbIQgTgeIuTo3varZ1gYS2KTw/iO+vZnwrJVmH2idUi1Js9xeljCmO3zOX g7U12GAqhCKYN8z2LgMUZZneu65SXmD8yTdLnZN1zqkSEzOMBeTKrl34S222jtgZBNhO xS6g== X-Gm-Message-State: APjAAAVg7NI7v8i6HBfqWj6yAy2JaKpdwjbTvBjziUwuocuTMWvsHo7j 2I3fEEupGn+f4Dgsmn8l9cj3tSZOdiaJVAYaRCv5Iw8iatrhw3D0WI9CG38sF7pjwotUN4STdxC hKIFgfKMXcf51h3uFF3zff+P2ArrjD4Nda6s/9bL8UA== X-Received: by 2002:adf:ead2:: with SMTP id o18mr2457039wrn.107.1569398911767; Wed, 25 Sep 2019 01:08:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqyVjpFH3LJSQ4WmmFH+ynp3Q6UrS/wBXnLeWNeU8Vp8t0ishBOOPhiV2sgcVrnzJIQlXb0w== X-Received: by 2002:adf:ead2:: with SMTP id o18mr2457000wrn.107.1569398911394; Wed, 25 Sep 2019 01:08:31 -0700 (PDT) Received: from localhost.localdomain ([194.191.228.147]) by smtp.gmail.com with ESMTPSA id e44sm856507ede.34.2019.09.25.01.08.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2019 01:08:30 -0700 (PDT) From: Juerg Haefliger X-Google-Original-From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [SRU][Bionic][PATCH 5/5] net/mlx5e: Don't match on vlan non-existence if ethertype is wildcarded Date: Wed, 25 Sep 2019 10:07:52 +0200 Message-Id: <20190925080752.10996-6-juergh@canonical.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190925080752.10996-1-juergh@canonical.com> References: <20190925080752.10996-1-juergh@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Or Gerlitz BugLink: https://bugs.launchpad.net/bugs/1842502 For the "all" ethertype we should not care whether the packet has vlans. Besides being wrong, the way we did it caused FW error for rules such as: tc filter add dev eth0 protocol all parent ffff: \ prio 1 flower skip_sw action drop b/c the matching meta-data (outer headers bit in struct mlx5_flow_spec) wasn't set. Fix that by matching on vlan non-existence only if we were also told to match on the ethertype. Fixes: cee26487620b ('net/mlx5e: Set vlan masks for all offloaded TC rules') Signed-off-by: Or Gerlitz Reported-by: Slava Ovsiienko Reviewed-by: Jianbo Liu Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed (backported from commit d3a80bb5a3eac311ddf28387402593977574460d) [juergh: Adjusted for missing commit 699e96ddf47f ("net/mlx5e: Support offloading tc double vlan headers match").] Signed-off-by: Juerg Haefliger --- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 63 ++++++++++--------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index cb17eb25f696..3c21b347895f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -780,31 +780,21 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, inner_headers); } - if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_ETH_ADDRS)) { - struct flow_dissector_key_eth_addrs *key = + if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_BASIC)) { + struct flow_dissector_key_basic *key = skb_flow_dissector_target(f->dissector, - FLOW_DISSECTOR_KEY_ETH_ADDRS, + FLOW_DISSECTOR_KEY_BASIC, f->key); - struct flow_dissector_key_eth_addrs *mask = + struct flow_dissector_key_basic *mask = skb_flow_dissector_target(f->dissector, - FLOW_DISSECTOR_KEY_ETH_ADDRS, + FLOW_DISSECTOR_KEY_BASIC, f->mask); + MLX5_SET(fte_match_set_lyr_2_4, headers_c, ethertype, + ntohs(mask->n_proto)); + MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype, + ntohs(key->n_proto)); - ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, - dmac_47_16), - mask->dst); - ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, - dmac_47_16), - key->dst); - - ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, - smac_47_16), - mask->src); - ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, - smac_47_16), - key->src); - - if (!is_zero_ether_addr(mask->src) || !is_zero_ether_addr(mask->dst)) + if (mask->n_proto) *match_level = MLX5_MATCH_L2; } @@ -829,26 +819,37 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, *match_level = MLX5_MATCH_L2; } - } else { + } else if (*match_level != MLX5_MATCH_NONE) { MLX5_SET(fte_match_set_lyr_2_4, headers_c, svlan_tag, 1); MLX5_SET(fte_match_set_lyr_2_4, headers_c, cvlan_tag, 1); + *match_level = MLX5_MATCH_L2; } - if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_BASIC)) { - struct flow_dissector_key_basic *key = + if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_ETH_ADDRS)) { + struct flow_dissector_key_eth_addrs *key = skb_flow_dissector_target(f->dissector, - FLOW_DISSECTOR_KEY_BASIC, + FLOW_DISSECTOR_KEY_ETH_ADDRS, f->key); - struct flow_dissector_key_basic *mask = + struct flow_dissector_key_eth_addrs *mask = skb_flow_dissector_target(f->dissector, - FLOW_DISSECTOR_KEY_BASIC, + FLOW_DISSECTOR_KEY_ETH_ADDRS, f->mask); - MLX5_SET(fte_match_set_lyr_2_4, headers_c, ethertype, - ntohs(mask->n_proto)); - MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype, - ntohs(key->n_proto)); - if (mask->n_proto) + ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, + dmac_47_16), + mask->dst); + ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, + dmac_47_16), + key->dst); + + ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, + smac_47_16), + mask->src); + ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, + smac_47_16), + key->src); + + if (!is_zero_ether_addr(mask->src) || !is_zero_ether_addr(mask->dst)) *match_level = MLX5_MATCH_L2; }