From patchwork Tue Apr 17 09:01:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?N=C3=A9lio_Laranjeiro?= X-Patchwork-Id: 38286 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 87008AA9B; Tue, 17 Apr 2018 11:01:22 +0200 (CEST) Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by dpdk.org (Postfix) with ESMTP id D20A92E8F for ; Tue, 17 Apr 2018 11:01:16 +0200 (CEST) Received: by mail-wr0-f196.google.com with SMTP id u4so1868663wrg.10 for ; Tue, 17 Apr 2018 02:01:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=xx+dZw0Sn8SLhL0x1XR57tW6GvtCXqPYNfizZnxHOfQ=; b=OzfVtBopYF/vXeic6lYg08Y7Jsx4eQqgJ6EqdIhbdYux3KSvGXHzBCFqHgcUry8Lc8 txmuY2Nbp4pffalqAnYPytw5HzNI5XWs5yC093YhJdTTf5L2HemtbHSj6opdJJVOD48A 5aqvqADgWDH6yqgw90fdx/bodXKU7F9KrB1M12a/6gEXU03g3zrb8xS5cvQNV1XMhnwy frtCQjkFeK+V9p50VYkOO42FnGwZpREWB0fJqWyX4cerDN4Mfr3PbkXc9iCshmNO0f1C HBdnAfx86d8pDpjEhvoXFye5a8y38V12QM3eg5QcdHng0dA9WGu8ERsjsrGQZ1GApe43 BomA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=xx+dZw0Sn8SLhL0x1XR57tW6GvtCXqPYNfizZnxHOfQ=; b=qEw7mN9J9FG8keBCWcL3PqEIY/ylfKpp3V7A9i0LT6fcy568QNIWbBZ7uHstRf459Q dR8FvZ7M/XvRU0G0e4ZFo1RbLMAl5YV49rIlmUfMGBVHQcTKGFwNUzrLr3eVVxAtVHVM RGPIiBCIK6oo4a5lpL2u7uHy2DtmW82ecwyNra7JvDY39FOIrDsIWpUFkNxB3qabZmPi I6+0P3nPeDreGugUwFVm/AeutirLQv5GJ84ulRoLyp0adtQ12jTRhGrNbroW6Ytix4ee t7567ZS77HKOEGJtApN6O1F/xg24qZbpBOAA1Lj+bP7fFl9CK5okZvufiSWrfuTTGHeN rFNg== X-Gm-Message-State: ALQs6tDtX1tyzh2nyokfsGCX83n/t7BXgsjqexlYZYiohJ1YV+ZddFP3 Qz4SorvcECRe7g1+nOwyFnwfuogRBw== X-Google-Smtp-Source: AIpwx4+/lWMulFbeqlya2EvKTzrHBEdFyv0TKA70Gtn7De69vO1UR4gzflSM6xeVBMRbtqmGVCuiEg== X-Received: by 10.223.186.211 with SMTP id w19mr884439wrg.276.1523955676379; Tue, 17 Apr 2018 02:01:16 -0700 (PDT) Received: from laranjeiro-vm.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id m78sm10820111wma.25.2018.04.17.02.01.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Apr 2018 02:01:15 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org, Yongseok Koh Cc: Adrien Mazarguil , stable@dpdk.org Date: Tue, 17 Apr 2018 11:01:36 +0200 Message-Id: X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 2/2] net/mlx5: fix flow director mask 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" During the transition to resurrect flow director on top of rte_flow, mask handling was removed by mistake. Fixes: 4c3e9bcdd52e ("net/mlx5: support flow director") Cc: stable@dpdk.org Signed-off-by: Nelio Laranjeiro Acked-by: Adrien Mazarguil --- drivers/net/mlx5/mlx5_flow.c | 56 ++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index acaa5f318..7e3bdcc66 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -442,10 +442,18 @@ struct mlx5_fdir { struct rte_flow_item_ipv4 ipv4; struct rte_flow_item_ipv6 ipv6; } l3; + union { + struct rte_flow_item_ipv4 ipv4; + struct rte_flow_item_ipv6 ipv6; + } l3_mask; union { struct rte_flow_item_udp udp; struct rte_flow_item_tcp tcp; } l4; + union { + struct rte_flow_item_udp udp; + struct rte_flow_item_tcp tcp; + } l4_mask; struct rte_flow_action_queue queue; }; @@ -2661,6 +2669,8 @@ mlx5_fdir_filter_convert(struct rte_eth_dev *dev, { struct priv *priv = dev->data->dev_private; const struct rte_eth_fdir_input *input = &fdir_filter->input; + const struct rte_eth_fdir_masks *mask = + &dev->data->dev_conf.fdir_conf.mask; /* Validate queue number. */ if (fdir_filter->action.rx_queue >= priv->rxqs_n) { @@ -2707,29 +2717,43 @@ mlx5_fdir_filter_convert(struct rte_eth_dev *dev, .type_of_service = input->flow.ip4_flow.tos, .next_proto_id = input->flow.ip4_flow.proto, }; + attributes->l3_mask.ipv4.hdr = (struct ipv4_hdr){ + .src_addr = mask->ipv4_mask.src_ip, + .dst_addr = mask->ipv4_mask.dst_ip, + .time_to_live = mask->ipv4_mask.ttl, + .type_of_service = mask->ipv4_mask.tos, + .next_proto_id = mask->ipv4_mask.proto, + }; attributes->items[1] = (struct rte_flow_item){ .type = RTE_FLOW_ITEM_TYPE_IPV4, .spec = &attributes->l3, - .mask = &attributes->l3, + .mask = &attributes->l3_mask, }; break; case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER: attributes->l3.ipv6.hdr = (struct ipv6_hdr){ - .hop_limits = input->flow.udp6_flow.ip.hop_limits, - .proto = input->flow.udp6_flow.ip.proto, + .hop_limits = input->flow.ipv6_flow.hop_limits, + .proto = input->flow.ipv6_flow.proto, }; + memcpy(attributes->l3.ipv6.hdr.src_addr, input->flow.ipv6_flow.src_ip, RTE_DIM(attributes->l3.ipv6.hdr.src_addr)); memcpy(attributes->l3.ipv6.hdr.dst_addr, input->flow.ipv6_flow.dst_ip, RTE_DIM(attributes->l3.ipv6.hdr.src_addr)); + memcpy(attributes->l3_mask.ipv6.hdr.src_addr, + mask->ipv6_mask.src_ip, + RTE_DIM(attributes->l3_mask.ipv6.hdr.src_addr)); + memcpy(attributes->l3_mask.ipv6.hdr.dst_addr, + mask->ipv6_mask.dst_ip, + RTE_DIM(attributes->l3_mask.ipv6.hdr.src_addr)); attributes->items[1] = (struct rte_flow_item){ .type = RTE_FLOW_ITEM_TYPE_IPV6, .spec = &attributes->l3, - .mask = &attributes->l3, + .mask = &attributes->l3_mask, }; break; default: @@ -2745,10 +2769,14 @@ mlx5_fdir_filter_convert(struct rte_eth_dev *dev, .src_port = input->flow.udp4_flow.src_port, .dst_port = input->flow.udp4_flow.dst_port, }; + attributes->l4_mask.udp.hdr = (struct udp_hdr){ + .src_port = mask->src_port_mask, + .dst_port = mask->dst_port_mask, + }; attributes->items[2] = (struct rte_flow_item){ .type = RTE_FLOW_ITEM_TYPE_UDP, .spec = &attributes->l4, - .mask = &attributes->l4, + .mask = &attributes->l4_mask, }; break; case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: @@ -2756,10 +2784,14 @@ mlx5_fdir_filter_convert(struct rte_eth_dev *dev, .src_port = input->flow.tcp4_flow.src_port, .dst_port = input->flow.tcp4_flow.dst_port, }; + attributes->l4_mask.tcp.hdr = (struct tcp_hdr){ + .src_port = mask->src_port_mask, + .dst_port = mask->dst_port_mask, + }; attributes->items[2] = (struct rte_flow_item){ .type = RTE_FLOW_ITEM_TYPE_TCP, .spec = &attributes->l4, - .mask = &attributes->l4, + .mask = &attributes->l4_mask, }; break; case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: @@ -2767,10 +2799,14 @@ mlx5_fdir_filter_convert(struct rte_eth_dev *dev, .src_port = input->flow.udp6_flow.src_port, .dst_port = input->flow.udp6_flow.dst_port, }; + attributes->l4_mask.udp.hdr = (struct udp_hdr){ + .src_port = mask->src_port_mask, + .dst_port = mask->dst_port_mask, + }; attributes->items[2] = (struct rte_flow_item){ .type = RTE_FLOW_ITEM_TYPE_UDP, .spec = &attributes->l4, - .mask = &attributes->l4, + .mask = &attributes->l4_mask, }; break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: @@ -2778,10 +2814,14 @@ mlx5_fdir_filter_convert(struct rte_eth_dev *dev, .src_port = input->flow.tcp6_flow.src_port, .dst_port = input->flow.tcp6_flow.dst_port, }; + attributes->l4_mask.tcp.hdr = (struct tcp_hdr){ + .src_port = mask->src_port_mask, + .dst_port = mask->dst_port_mask, + }; attributes->items[2] = (struct rte_flow_item){ .type = RTE_FLOW_ITEM_TYPE_TCP, .spec = &attributes->l4, - .mask = &attributes->l4, + .mask = &attributes->l4_mask, }; break; case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER: