From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id E425FE5D for ; Mon, 30 Apr 2018 16:07:17 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id a67so5812744wmf.3 for ; Mon, 30 Apr 2018 07:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ASFI4EI1L0ZZDLn1mAL8VMpskXrJRJ36tkwAh85W6aQ=; b=MGAY+KOYgsSEh4kNuFR5j7viQFUocG/TdET4D0xQGCt8mZHG9Mpew3zY/kA0+NA+H8 3pG/J8CccT4BoVynmrGJk8Qs6JvONXoYlGTCPBoIAKLqv4aAoCWO2EQOlNMQ3GDcUmtv bvNsNxjyhhc5JVTVq0yV9sx1ulPneMWsrtgVmqtf4uCVFn3sUuIrY/Ybbx0vh4hj3WgS 8QQvl/LoQaxpmMCYnYHzqjsnkZGtvFCxNY70b6yrkVRM7Ul9hXvEbLoU8RzkL7ZxfTxC tRfJyDlZy6HxVTajToEslu4dwFzP9TRN5kw/NHFIk5eHOmYWoIGkDaKWx+KMpfo5zFeo g70A== 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; bh=ASFI4EI1L0ZZDLn1mAL8VMpskXrJRJ36tkwAh85W6aQ=; b=Hb0R3pu2B11ZRhhW7i5ghQNL6kOKUpzA4RwZaPLqsGAf61TFHim1KNlin3cuD4vvj+ JCyEdUK36fgB8dDophw/fcIns2ZL95kKuUdZmb9UAkvrYvfItupTo3kgSwjcg7+dbHl9 WcG5qvFjXmxkpLrcpL7Jx+mSRr6H+Ov383gNRKIa1jo85tvqUg2Wq4R+MBQErafRWbQ7 OULf3MJx0Jjy2z5If89EhRU41+O7M0tYVt1Y1L0FVgoztXKxD108LXqlxHv/JKFwkbcr zN0qcUzJZ3R4jA+2yVplIsqO1ZSHgRcxLpT1ovx50KCgaDFrGRtChPQDsh5tKFBlLJ/J lipw== X-Gm-Message-State: ALQs6tD4yRtiqgV1j4Ch+Ees7+9eCGwJbcBUHSfA/2wiFYdglSZfOuer Xe1cO53wj2T98Hho2ez2UFvLds+xQN0= X-Google-Smtp-Source: AB8JxZqflKGE9HsKy9AkwlHmlEgzbPsIOiRbhmSM1o+IMjmG1Ob76pdmCzypBdw9wp4PLdCDh81erQ== X-Received: by 10.28.142.149 with SMTP id q143mr7384694wmd.161.1525097237440; Mon, 30 Apr 2018 07:07:17 -0700 (PDT) Received: from localhost ([2a00:23c5:be9a:5200:ce4c:82c0:d567:ecbb]) by smtp.gmail.com with ESMTPSA id k89sm7484657wmc.15.2018.04.30.07.07.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Apr 2018 07:07:16 -0700 (PDT) From: luca.boccassi@gmail.com To: Shahaf Shuler Cc: Yongseok Koh , Xueming Li , Nelio Laranjeiro , dpdk stable Date: Mon, 30 Apr 2018 15:03:11 +0100 Message-Id: <20180430140606.4615-33-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180430140606.4615-1-luca.boccassi@gmail.com> References: <20180430140606.4615-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'net/mlx5: fix tunnel offloads cap query' has been queued to stable release 18.02.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Apr 2018 14:07:18 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/02/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From 21bb30134d97b6acb07a6a6f2cdb3edb8b378e54 Mon Sep 17 00:00:00 2001 From: Shahaf Shuler Date: Sun, 25 Feb 2018 09:28:37 +0200 Subject: [PATCH] net/mlx5: fix tunnel offloads cap query [ upstream commit 038e72511f2147c238ff1cb021c82d74efcf630f ] 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") Signed-off-by: Shahaf Shuler Acked-by: Yongseok Koh Acked-by: Xueming Li Acked-by: Nelio Laranjeiro --- 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.14.2