From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0073.outbound.protection.outlook.com [104.47.1.73]) by dpdk.org (Postfix) with ESMTP id 2D09CFEB; Sun, 25 Feb 2018 08:28:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=tmLp5lso98IwcPaNIDfA6+hwdUP3u098AoNRlihgxcU=; b=ewrQrjLam1hKyYZ0TbdSjYCjgajdRdWPBRu0YqTakMUTts7avrvJ60EiKmNH6HgPxE7tCvp5h7nSFn1d8pNHqZl/ocrjXKm1beSIssj3IIwXtwWEvLdgJ4yjl6Wf57P81NwG6h/es1C7zQc+pgjUdHmTswdCBh7+V1XrGVmcjT0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; Received: from mellanox.com (141.226.120.58) by VI1PR0502MB4093.eurprd05.prod.outlook.com (2603:10a6:803:26::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.506.18; Sun, 25 Feb 2018 07:28:51 +0000 From: Shahaf Shuler To: nelio.laranjeiro@6wind.com, adrien.mazarguil@6wind.com, yskoh@mellanox.com Cc: dev@dpdk.org, stable@dpdk.org Date: Sun, 25 Feb 2018 09:28:37 +0200 Message-Id: <20180225072837.85663-1-shahafs@mellanox.com> X-Mailer: git-send-email 2.12.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [141.226.120.58] X-ClientProxiedBy: HE1PR0202CA0012.eurprd02.prod.outlook.com (2603:10a6:3:8c::22) To VI1PR0502MB4093.eurprd05.prod.outlook.com (2603:10a6:803:26::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5623a83e-e6e4-469b-aac6-08d57c216b72 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:VI1PR0502MB4093; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB4093; 3:LrjZ5FdD71S9uiCoW2Hy/20EqdpRSXa1WJM0hllkUdwjJpPRQTXGtFuHcrJpfDCi/Lb5RAuZiinp8Vy2t3EQIplgztHaAHzpKhUGaLenWRryZyB74bAidxBaxwqQT6EGTH26tXI87KQDr2AuCB6IIxtTpvndOsm2cIFcjLXchW6TbO1cuyTQGcHIi3egsGc6pYBl52Pfs+wfMfeXx2MXUNHzNqOezBnxEjPk5OM/CWBqa+KrAMi0Lp+vaQQVp5mn; 25:My5Lw7PqKSzdcsP28SBlchcGLZe2DTr+N93T9ozFw5+ZxA0RQZLGMe7DWn8vWK8XMWRELWyrCiw8cwqr0VNizz0kgD0QhKtDpIFH2LY9CHQ9ac6vA9coCvNwOJ7nrcvVTh9n8rMcjEOQuxWpfSpcynw2Tbp7Fki6vV62xQND09Fspnbk5tdJF1wzVH51In+eS1Ysc6RcqvsVVLkkyVaXGMIvN/ofskBJaPvAX5Ay29QifCopyyeRl7dsUBm/9QhtJ5c0mWD/qN153q7/epe4YCgff4nPZKkFRAtKAUzI5m0xSmG4C11ZXFv51OlvAf6qv59k1nwKKElLeMR5U8uenw==; 31:toj+bLarxiFBXAd7j4sB5fN2OQr0ZVNcj6kjUWHjCRLIG+Nv6GHdekPlDvyRB4yzbUQaSqwHkoe/7f4PT3/msaqoml1JfUyMxMFE3QHVWG/ozob7QOQDZ+gg0RzOy/qFnEhbTJwH6JU11VT2yePv4DLzAYTd6En70BKWLQKPqlNEE4VrR1/iFJzj/SpguIdf6Ehlzo4Xf4g6NqljPV2IxuxOK5d27gltRWr5bUYrKv4= X-MS-TrafficTypeDiagnostic: VI1PR0502MB4093: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB4093; 20:O3ZZSjq7gMDu6R9zo8xWHDeLr3lwDxsSgJ7EvRicKsOrsvbQXm5y6X7UqigUZBZY9Zt+NTK/N3ZF8djAlz6BbqcS7MWqBAEcZtdJd0BzH4/0LxABd4aZBafOIchzkAIgoyfIKHIZfXdxP9Zy9WxNrNz8lAFiUSsugPptlNCqJ0D3KnkAfu6ql9QPQ1d8X5q47AO7U38XiqMUqKhrO+QhsT8r3IZt0zgJE88acmdEp+aJSlkE3Z2qhje6Aa1PUHbUXkLMUkXjZ/P1dI8ZPB2zBMqn433wvMhbv+Sbnjd77XlBZJ2rxRKWc+ksSLNphUlttTeq+bJwVQNtqhHAEbquaWQ2eFyPymbBMY8NHMkNs5vAgm4R3pXqlHvxflHbwUB7cEvbNdPBkqLRMDFv0mX9BvF3a25KzX0eSaUui1CQ7dVkRec31LYvkuN3XuV5jkpyc5RqbmfsewRM8jw0ASIiVME+MuuVeyl6m+M5e38u0oSdu3QL3fsd3+wJiS1CfOFW; 4:LNqeDrzah2vgJtvJDfE9qHOuqQB/knz15qvz+hnYiDXcI3DtaAUh83J3OWhGG+iuc3jbAPfykTkCRQgoNiaw+kCFmRMIdi88MLTJynfk+cnYiuL34HxKxB4y2XfrjKzG9sVU/cUjQIqctmM9n8BjsZp/oL+DZZDdhsrsMMCmmW8Pk9g0GaD7qt/rYS3Q/PjSpndzq8l1vJttpIApHRey15DjrGYPG3q0hdYcc5eLHMsIXzXPI6VQNotrxFog6ke4mY7izDVX3vVkYUWKFc5WMg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(8121501046)(5005006)(10201501046)(3231220)(944501161)(52105095)(93006095)(93001095)(3002001)(6055026)(6041288)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:VI1PR0502MB4093; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0502MB4093; X-Forefront-PRVS: 05947791E4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(366004)(346002)(376002)(396003)(199004)(189003)(50466002)(6116002)(86362001)(386003)(8676002)(48376002)(1857600001)(21086003)(7736002)(305945005)(59450400001)(3846002)(66066001)(16586007)(69596002)(47776003)(51416003)(25786009)(81166006)(81156014)(1076002)(52116002)(5660300001)(316002)(2906002)(105586002)(4326008)(106356001)(7696005)(16526019)(68736007)(478600001)(97736004)(36756003)(26005)(53936002)(6666003)(8936002)(6636002)(186003)(55016002)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0502MB4093; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0502MB4093; 23:WTmrsDKrUXz3R5qLdGCxuzLBDYNMD7xBq3ZlFhF?= =?us-ascii?Q?ztHOJpbBb/5JpPj22PdEURoD9qjeUw6mEQLjREKCoJQBa5YDOcGHSgPVPP+c?= =?us-ascii?Q?vaq2HVuYvFPB9cXGMfQZVAYItlUoIo5zXHpZbtAAGqmMWqHhlEc3MIg1/Krx?= =?us-ascii?Q?GM+2a1AGaDDVjYzF4GwLVXcNYXliawWpD5JIr7wq3vSn9izKXIbbjk3kq1pN?= =?us-ascii?Q?VZRmVjNLakC2EZSQzYNXMZUkmwPq2CLe6V69IKK7tg0A4oSr4BWDc8Bv6zWr?= =?us-ascii?Q?WAw+uLwWOrn8WXa1kuxJGtDB3hH1uNuX7PNLlavgm1fG45vtB83bkKDFNcIm?= =?us-ascii?Q?ejYe3BDhlwfru0EN23CsXXYhUwnSQJRodQoJ0jBw/QB6bq124QiIyGaRFMau?= =?us-ascii?Q?9CYb96VI+HlUoWT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spxppAlBfMobA06vXpusKaR9CgYaye364SyOeLxmRNHSRZAIRB5bnzU1gOQhQToWKQGB/H8EutHyliEwIduHMK1fYudMjLMi0PepvdyZWY9IujqfD9rSmO/HthuwyqutwluQdSKggVr2fZF/N21X3E32+BZGh1/Dqn35e9IFW6WUER+fLQKUIN1zNyu6yhGu3yXtsM4jMsdmxznCXMITeYM9eq0sf2fLimkj8=; 5:MqeEyQc2XiPp8S84kWwSnkyZiGF/3AgMzJPNeCeLPHg7ySdBwraqdvkCNijDwUkPVpaGQKmPz2Fs0calV0Hrx+sMpbTcYz28rgWzW4Be84f++oGQLjI7WX/UqpqGpntwNwvhcy2Epx4j7sJew2IPGtUoLqZ3CXBPqdF1y5iyEuA=; 24:qmNJriNNIi33tuKmKn2qkpYEzYssEvDPh1W+6CnprzUhjxu2/y6FL2KoiPZwSAWgonnyMlvBQP9uatHSNzjKrQqSSVLAmzR/cPGiW178qJM=; 7:foXEdU7EAUaPjDexr8tZfrC9pvVouVjX/5RL5I7Nk7Ve8ybjTLE7uZy5ViFg8UzK6v2GfFPnfPNrCIz/7zftX2+awErO8rSoLTVeqI/4OlUIRjI303Oz5pqQlE2O/DF9gkGGnKdq4DY7lkt3ZbRbS4avyOPRt8/biXZQ7mR1MzrHuDMpSEyEjvUQAajQOFvSabXWfuobMn3Fh04UBYQWaYIPavuTqXH7irNNSeWcxrSAzesmCdSeu/+xfl/HqldA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2018 07:28:51.2016 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5623a83e-e6e4-469b-aac6-08d57c216b72 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB4093 Subject: [dpdk-dev] [PATCH] net/mlx5: fix tunnel offloads cap query 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: , X-List-Received-Date: Sun, 25 Feb 2018 07:28:54 -0000 The query for the tunnel stateless offloads is wrongly implemented because of: 1. It was using the device id to query for the offloads. 2. It was using a compilation flag for Verbs which no longer exits. The main reason was lack of proper API from Verbs. Fixing the query to use rdma-core API. The capability returned from rdma-core refer to both Tx and Rx sides. Eventhough there is a separate cap for GRE and VXLAN, implementation merge them into a single flag in order to simplify the checks on the data path. Fixes: 43e9d9794cde ("net/mlx5: support upstream rdma-core") Fixes: f5fde5205101 ("net/mlx5: add hardware checksum offload for tunnel packets") Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler Acked-by: Yongseok Koh Acked-by: Xueming Li --- drivers/net/mlx5/Makefile | 6 +++--- drivers/net/mlx5/mlx5.c | 39 +++++++++++++++------------------------ drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/mlx5_rxq.c | 2 +- 4 files changed, 21 insertions(+), 30 deletions(-) diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index 3bc9736c9..afda4118f 100644 --- a/drivers/net/mlx5/Makefile +++ b/drivers/net/mlx5/Makefile @@ -125,9 +125,9 @@ mlx5_autoconf.h.new: FORCE mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh $Q $(RM) -f -- '$@' $Q sh -- '$<' '$@' \ - HAVE_IBV_DEVICE_VXLAN_SUPPORT \ - infiniband/verbs.h \ - enum IBV_DEVICE_VXLAN_SUPPORT \ + HAVE_IBV_DEVICE_TUNNEL_SUPPORT \ + infiniband/mlx5dv.h \ + enum MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS \ $(AUTOCONF_OUTPUT) $Q sh -- '$<' '$@' \ HAVE_IBV_WQ_FLAG_RX_END_PADDING \ diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 6c0985bd6..61cb93101 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -584,7 +584,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) unsigned int tunnel_en = 0; int idx; int i; - struct mlx5dv_context attrs_out; + struct mlx5dv_context attrs_out = {0}; #ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT struct ibv_counter_set_description cs_desc; #endif @@ -633,20 +633,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) PCI_DEVICE_ID_MELLANOX_CONNECTX5VF) || (pci_dev->id.device_id == PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF)); - switch (pci_dev->id.device_id) { - case PCI_DEVICE_ID_MELLANOX_CONNECTX4: - tunnel_en = 1; - break; - case PCI_DEVICE_ID_MELLANOX_CONNECTX4LX: - case PCI_DEVICE_ID_MELLANOX_CONNECTX5: - case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF: - case PCI_DEVICE_ID_MELLANOX_CONNECTX5EX: - case PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF: - tunnel_en = 1; - break; - default: - break; - } INFO("PCI information matches, using device \"%s\"" " (SR-IOV: %s)", list[i]->name, @@ -675,6 +661,9 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) * Multi-packet send is supported by ConnectX-4 Lx PF as well * as all ConnectX-5 devices. */ +#ifdef HAVE_IBV_DEVICE_TUNNEL_SUPPORT + attrs_out.comp_mask |= MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS; +#endif mlx5_glue->dv_query_device(attr_ctx, &attrs_out); if (attrs_out.flags & MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED) { if (attrs_out.flags & MLX5DV_CONTEXT_FLAGS_ENHANCED_MPW) { @@ -693,6 +682,17 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) cqe_comp = 0; else cqe_comp = 1; +#ifdef HAVE_IBV_DEVICE_TUNNEL_SUPPORT + if (attrs_out.comp_mask & MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS) { + tunnel_en = ((attrs_out.tunnel_offloads_caps & + MLX5DV_RAW_PACKET_CAP_TUNNELED_OFFLOAD_VXLAN) && + (attrs_out.tunnel_offloads_caps & + MLX5DV_RAW_PACKET_CAP_TUNNELED_OFFLOAD_GRE)); + } + DEBUG("Tunnel offloading is %ssupported", tunnel_en ? "" : "not "); +#else + WARN("Tunnel offloading disabled due to old OFED/rdma-core version"); +#endif if (mlx5_glue->query_device_ex(attr_ctx, NULL, &device_attr)) goto error; INFO("%u port(s) detected", device_attr.orig_attr.phys_port_cnt); @@ -838,15 +838,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) IBV_DEVICE_RAW_IP_CSUM); DEBUG("checksum offloading is %ssupported", (config.hw_csum ? "" : "not ")); - -#ifdef HAVE_IBV_DEVICE_VXLAN_SUPPORT - config.hw_csum_l2tun = - !!(exp_device_attr.exp_device_cap_flags & - IBV_DEVICE_VXLAN_SUPPORT); -#endif - DEBUG("Rx L2 tunnel checksum offloads are %ssupported", - (config.hw_csum_l2tun ? "" : "not ")); - #ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT config.flow_counter_en = !!(device_attr.max_counter_sets); mlx5_glue->describe_counter_set(ctx, 0, &cs_desc); diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 965c19f21..3e2d96abc 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -75,13 +75,13 @@ TAILQ_HEAD(mlx5_flows, rte_flow); */ struct mlx5_dev_config { unsigned int hw_csum:1; /* Checksum offload is supported. */ - unsigned int hw_csum_l2tun:1; /* Same for L2 tunnels. */ unsigned int hw_vlan_strip:1; /* VLAN stripping is supported. */ unsigned int hw_fcs_strip:1; /* FCS stripping is supported. */ unsigned int hw_padding:1; /* End alignment padding is supported. */ unsigned int sriov:1; /* This is a VF or PF with VF devices. */ unsigned int mps:2; /* Multi-packet send supported mode. */ - unsigned int tunnel_en:1; /* Whether tunnel is supported. */ + unsigned int tunnel_en:1; + /* Whether tunnel stateless offloads are supported. */ unsigned int flow_counter_en:1; /* Whether flow counter is supported. */ unsigned int cqe_comp:1; /* CQE compression is enabled. */ unsigned int tso:1; /* Whether TSO is supported. */ diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index ff58c4921..238fa7e56 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1006,7 +1006,7 @@ mlx5_priv_rxq_new(struct priv *priv, uint16_t idx, uint16_t desc, /* Toggle RX checksum offload if hardware supports it. */ tmpl->rxq.csum = !!(conf->offloads & DEV_RX_OFFLOAD_CHECKSUM); tmpl->rxq.csum_l2tun = (!!(conf->offloads & DEV_RX_OFFLOAD_CHECKSUM) && - priv->config.hw_csum_l2tun); + priv->config.tunnel_en); tmpl->rxq.hw_timestamp = !!(conf->offloads & DEV_RX_OFFLOAD_TIMESTAMP); /* Configure VLAN stripping. */ tmpl->rxq.vlan_strip = !!(conf->offloads & DEV_RX_OFFLOAD_VLAN_STRIP); -- 2.12.0