From patchwork Wed Dec 28 10:37:19 2016 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: 18609 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id A261CF6D2; Wed, 28 Dec 2016 11:38:28 +0100 (CET) Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by dpdk.org (Postfix) with ESMTP id 461685320 for ; Wed, 28 Dec 2016 11:37:41 +0100 (CET) Received: by mail-wm0-f53.google.com with SMTP id k184so110325980wme.1 for ; Wed, 28 Dec 2016 02:37:41 -0800 (PST) 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=BlmnFHb4t1oBOk6rhxvbzIFYaNdR2iSNcsPgdYU9hQ4=; b=QwyeEec0ja316tPjEknH8WVshicu1WSauSEouN6aEWNi8/40xMGY9EUVC6EJ4gTY/v ZF1A/fg1LH1r04zdqMBHJncmQAh+oVGwvhG8pAs2HceyeF7528RmkvnllUe86zfrlRC1 YvdylKl5aPcRMS3/YqlKOe+yCtgepE4UqUdKjVeeBz/2gAKlqiiWnM4z4cxr0hvbEla6 AKFXr8C4vMbEgx1IiO0DyzAbO+oTA5ts+c/2OPKAEw8cx5nGFQDnqJhQnjsOSVpSnvMD 1SkSNryOiTRe0Gra85i5F2LJ+p3qCAFR6/lkaMM3jRcwWMyQj2Z0pR9ehFa3uyrfVjs8 5KgQ== 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=BlmnFHb4t1oBOk6rhxvbzIFYaNdR2iSNcsPgdYU9hQ4=; b=ejLQymnJLQqJB4fCj0Lm3PuiyEmv95RiCqUxmR6UuukUw2DK6pueE7kqx1rWzqGpy7 h0kSYtFG7SnG8z3VaTQ46CXP1by/1+vJYTvLjtlOBqfajbcNM788QbRQMMfdQfZmoPvu EcgRSYIf33zJrJG6h9qlPznNeFUP/gy2uSVtQyEbyAxGGeepOnpCJN1wV/RaMEQHSAqx XWAcF6hwxtX9TxrJ33J1brslZlymuR4aLQSG1o8V4a39antpiiePYiSQgfHq7NtZnS90 kf8oUeOUO6s90kEHH5kQxy3EjRSQfKwqWMNW24lyTuzm3/ravpP4qV/P+jHJTIkYQV4G mjDw== X-Gm-Message-State: AIkVDXIEXDLKtPDQ2zL5UnB9F+cXAlBUXICEpTppyJJMfr0ZfswfNO6O8oBwwE7t467wTYTB X-Received: by 10.28.131.72 with SMTP id f69mr30613568wmd.135.1482921460998; Wed, 28 Dec 2016 02:37:40 -0800 (PST) Received: from ping.vm.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id kq6sm30022703wjc.7.2016.12.28.02.37.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Dec 2016 02:37:40 -0800 (PST) From: Nelio Laranjeiro To: dev@dpdk.org Cc: Adrien Mazarguil Date: Wed, 28 Dec 2016 11:37:19 +0100 Message-Id: <1f97806aaedd239cd4a949abf2ccd1dedd95d3b8.1482920437.git.nelio.laranjeiro@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v4 6/6] net/mlx5: extend IPv4 flow item 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 commits adds: - Type of service - Next protocol ID Signed-off-by: Nelio Laranjeiro Acked-by: Adrien Mazarguil --- drivers/net/mlx5/mlx5_flow.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 01f7a77..77021b5 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -172,11 +172,13 @@ static const struct mlx5_flow_items mlx5_flow_items[] = { .hdr = { .src_addr = -1, .dst_addr = -1, + .type_of_service = -1, + .next_proto_id = -1, }, }, .mask_sz = sizeof(struct rte_flow_item_ipv4), .convert = mlx5_flow_create_ipv4, - .dst_sz = sizeof(struct ibv_exp_flow_spec_ipv4), + .dst_sz = sizeof(struct ibv_exp_flow_spec_ipv4_ext), }, [RTE_FLOW_ITEM_TYPE_IPV6] = { .items = ITEMS(RTE_FLOW_ITEM_TYPE_UDP, @@ -574,29 +576,35 @@ mlx5_flow_create_ipv4(const struct rte_flow_item *item, void *data) const struct rte_flow_item_ipv4 *spec = item->spec; const struct rte_flow_item_ipv4 *mask = item->mask; struct mlx5_flow *flow = (struct mlx5_flow *)data; - struct ibv_exp_flow_spec_ipv4 *ipv4; - unsigned int ipv4_size = sizeof(struct ibv_exp_flow_spec_ipv4); + struct ibv_exp_flow_spec_ipv4_ext *ipv4; + unsigned int ipv4_size = sizeof(struct ibv_exp_flow_spec_ipv4_ext); ipv4 = (void *)((uintptr_t)flow->ibv_attr + flow->offset); - *ipv4 = (struct ibv_exp_flow_spec_ipv4) { - .type = flow->inner | IBV_EXP_FLOW_SPEC_IPV4, + *ipv4 = (struct ibv_exp_flow_spec_ipv4_ext) { + .type = flow->inner | IBV_EXP_FLOW_SPEC_IPV4_EXT, .size = ipv4_size, }; if (spec) { - ipv4->val = (struct ibv_exp_flow_ipv4_filter){ + ipv4->val = (struct ibv_exp_flow_ipv4_ext_filter){ .src_ip = spec->hdr.src_addr, .dst_ip = spec->hdr.dst_addr, + .proto = spec->hdr.next_proto_id, + .tos = spec->hdr.type_of_service, }; } if (mask) { - ipv4->mask = (struct ibv_exp_flow_ipv4_filter){ + ipv4->mask = (struct ibv_exp_flow_ipv4_ext_filter){ .src_ip = mask->hdr.src_addr, .dst_ip = mask->hdr.dst_addr, + .proto = mask->hdr.next_proto_id, + .tos = mask->hdr.type_of_service, }; } /* Remove unwanted bits from values. */ ipv4->val.src_ip &= ipv4->mask.src_ip; ipv4->val.dst_ip &= ipv4->mask.dst_ip; + ipv4->val.proto &= ipv4->mask.proto; + ipv4->val.tos &= ipv4->mask.tos; ++flow->ibv_attr->num_of_specs; flow->ibv_attr->priority = 1; return 0;