From patchwork Thu Dec 20 07:15:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dekel Peled X-Patchwork-Id: 49163 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CA2DF1B996; Thu, 20 Dec 2018 08:21:41 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 323961B914 for ; Thu, 20 Dec 2018 08:21:40 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from dekelp@mellanox.com) with ESMTPS (AES256-SHA encrypted); 20 Dec 2018 09:24:36 +0200 Received: from mtl-vdi-280.wap.labs.mlnx. (mtl-vdi-280.wap.labs.mlnx [10.128.130.87]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wBK7IGMV004372; Thu, 20 Dec 2018 09:18:16 +0200 From: Dekel Peled To: matan@mellanox.com, shahafs@mellanox.com Cc: dev@dpdk.org, orika@mellanox.com, dekelp@mellanox.com Date: Thu, 20 Dec 2018 09:15:34 +0200 Message-Id: <1545290134-65364-1-git-send-email-dekelp@mellanox.com> X-Mailer: git-send-email 1.7.1 Subject: [dpdk-dev] [PATCH] net/mlx4: support flow w/o ETH spec and with VLAN X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch adds to MLX4 PMD the option to set flow rules with wildcard ether MAC and specific VLAN ID. Note that this fix works with 1. CX-3 FW 2.42.5016 or higher. 2. mlxconfig configuration STEER_FORCE_VLAN set to 1. Signed-off-by: Dekel Peled Acked-by: Matan Azrad --- drivers/net/mlx4/mlx4_flow.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index b40e7e5..6c927a6 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -205,9 +205,7 @@ struct mlx4_drop { const char *msg; unsigned int i; - if (!mask) { - flow->promisc = 1; - } else { + if (mask) { uint32_t sum_dst = 0; uint32_t sum_src = 0; @@ -249,6 +247,10 @@ struct mlx4_drop { .type = IBV_FLOW_SPEC_ETH, .size = sizeof(*eth), }; + if (!mask) { + flow->ibv_attr->type = IBV_FLOW_ATTR_ALL_DEFAULT; + return 0; + } memcpy(eth->val.dst_mac, spec->dst.addr_bytes, ETHER_ADDR_LEN); memcpy(eth->mask.dst_mac, mask->dst.addr_bytes, ETHER_ADDR_LEN); /* Remove unwanted bits from values. */ @@ -311,6 +313,8 @@ struct mlx4_drop { eth->val.vlan_tag = spec->tci; eth->mask.vlan_tag = mask->tci; eth->val.vlan_tag &= eth->mask.vlan_tag; + if (flow->ibv_attr->type == IBV_FLOW_ATTR_ALL_DEFAULT) + flow->ibv_attr->type = IBV_FLOW_ATTR_NORMAL; return 0; error: return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM,