From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0060.outbound.protection.outlook.com [104.47.1.60]) by dpdk.org (Postfix) with ESMTP id 8E5E21B219 for ; Wed, 8 Nov 2017 19:47:47 +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=wTGP0HpuATNcVd/37F1i/nnj9KGvO/NKFY1m7V5tDF0=; b=e++XtnnfLnNCdPDOfznGVwerqSVdwN0OXTV8tEH/OQchomZR3qcSpkikkppgy3IcTzhN6uH42NuIRel5G3R6fRfApwuxmH7P6n1wLUeyh14J1f2Y3LBvxze9U78glKGQd0Ca4Kkeb0iCrUJ8KbM7c+Pw376X99vuFWX5A6A/W1M= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from mellanox.com (37.142.13.130) by DB5PR05MB1911.eurprd05.prod.outlook.com (2a01:111:e400:c584::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Wed, 8 Nov 2017 18:47:45 +0000 From: Moti Haimovsky To: adrien.mazarguil@6wind.com Cc: dev@dpdk.org, Moti Haimovsky Date: Wed, 8 Nov 2017 20:47:11 +0200 Message-Id: <1510166831-153992-1-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0401CA0008.eurprd04.prod.outlook.com (2603:10a6:800:4a::18) To DB5PR05MB1911.eurprd05.prod.outlook.com (2a01:111:e400:c584::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bb3c406f-3aa2-4f5a-dbc9-08d526d93395 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603199); SRVR:DB5PR05MB1911; X-Microsoft-Exchange-Diagnostics: 1; DB5PR05MB1911; 3:Ic/nxwt1E2eGjv19d7GuBRPFnpYO47GwUqf3/E4LXwTvwG4cxVRz/N9U7E70+lG9WOf9ikG1iwH6Zkn4deR5gMHONk8R9xOrS3XnvH9rVhY9FXZxW7SC6g6CHojLPhAImtwIpGZ+2V27bXIAkTqnzgiWzpgz8PfU9uwAYJj8yCb5Uef+BuO0ltEtQwFZOloHy+TkzDIpTDz8ALmhLPvDzlzia+xZdS/ZJUi2sBH3sSMbtMPq86dyIvMIGOzDtMnK; 25:3Fe+SWLUcKK2+ihLJcMz2XUdp+CRfIaMEkk1mKAyTHWy206n77VYke40Yu6/Hxv5yIk9zFphJW2hATHCXONBfQrj2gGX3U8Mj+wmfsYYjZoyt+uy4sL4n0NYKhEP1AqToUrHeXy44jU73ZTbc5Kqpo+KhfJY9jfaWPbf1jn5dXqZhdmZpJIS/z5fIaz87WUlx8d0K9ymASzbbekdO5RqvyyGrMSFgbm321grBRV+hRn81unIhIJEHXX0l3c63vjafah55hrQvOo/pFczPe/PjWmJshONjoJyHFggdhxZ1obpUAVFKBRrN2WI7p2T8IEqQDPqlnY05g3kWG//jB+Nrg==; 31:ptCyuNTHNyYrsb72Jzr5C1VaxMRT/uxBaXeByHkTCg4/D6qUGDRlI9i84Yh1ffVStoUgrx/YbIeU2GUbMoDouvyOoVHI08EXVkjnQnCuMN6W7rpKA+XpBuA8fQIGy1lOHPt/8VbCPzCpFodVZHw5gn1Q4cfhtS+w1I12AxMcTTaOYP6/jRUfgCtyAOjgFXMed9w/ZpTViTnqhbgBGbYRjvtxKapgErRyvhE4DwnKU5E= X-MS-TrafficTypeDiagnostic: DB5PR05MB1911: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DB5PR05MB1911; 20:c00yjrx3XagzGA04Iusn7VOWVoMTP5gl3SaBriv1WXidCcipwZbmFlwqfTHXiUKB/1NiZg5NsXncghs/l1ErDe2ozQt4xeNP5UeALJ/RjGC3Mk+nCU2CvFZBqWiHFUQ62oK5zAVD5WMrq47nmyYoXRoK9IoP9SXEBGml22neMXt2zKje5CM/cFIc6sERtA2w93QHtgvq/54HdZklACt9Y8RNd1+yMehhH6KxRMyJjePrJMQKEBBGfvuvngvtdVxbVzQmE58loZalDeHOVr92JdxMYpo+OxXZssSbrkH9WosLWUtkrxPYySSh/LOsJ4hUHPH+NQQGVdyXubA8vN42xUid7E/eh36LIDvMzYhnBKQ/osH53ywuc4redULCH9XeYACLUz2ky8wW/Wq9W/vK2kcb2YnknzKJ2sguDFGDXa+dkqCsoqhrrDJwo972Ftr8ZVY4MoU0xMCzcne1/9fRZt8TRVLy/DTm9jwdGwcXNvOrQO5AQeTK5Db6rAAkHF9g; 4:QjlwBafPAEF0HpoB8AIiXRVxzl4eYj8tQlXeLKj2PkpmM5CkDsjkbQbd1ZVtRCAhVZOSMA/drqtkX3+4/4l58uNL0VCnec2DGzsFtlUa/25pFG2VBzRGmM8QkASI4FwKUFQAW9OD4sbQcwJbz9OrE7b1/24ig9H5MTtAi/7396vkto9XHFCjsGi79J+kNwvyYYrBCXekVbvptDpvzNAidwcXekq8SzW0KxjRsfd9pUCIB9zi95/t3+VosuTvi2cC0FXXwNGtNIO2BHbNuwTbZA== X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93001095)(3231021)(3002001)(10201501046)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123560025)(20161123555025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB5PR05MB1911; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB5PR05MB1911; X-Forefront-PRVS: 0485417665 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(39860400002)(199003)(189002)(3846002)(50986999)(16526018)(6116002)(105586002)(101416001)(5003940100001)(4326008)(106356001)(55016002)(189998001)(2351001)(107886003)(33026002)(33646002)(21086003)(2361001)(97736004)(50226002)(8936002)(50466002)(47776003)(8676002)(81166006)(6666003)(6916009)(4720700003)(81156014)(2906002)(53936002)(5660300001)(48376002)(69596002)(66066001)(478600001)(7736002)(305945005)(25786009)(86362001)(316002)(16586007)(36756003)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR05MB1911; 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; DB5PR05MB1911; 23:YcMD/xupApD0qPc7k6zhZo0q9G/9NRauZNJT2KvEf?= =?us-ascii?Q?qhsHKxwj5Fd6NVlvGLFinuzYg+mllWi2P1okSuxqyg1o4rWcImIhbYArz/wq?= =?us-ascii?Q?iCYj3v0IT8ugZ0EWnwldFwmYVzutOaADr5MQMYl7s1PIFLGdCwtfmes923sl?= =?us-ascii?Q?PAj0Cm9iP9NeH1dKS2vRwQ0k3+RyHr160BlryO7cxDZniy/d3VJYWrya+NXK?= =?us-ascii?Q?NpqBSKCtk0lKhpIVANe8q9pdfao7iljKpJ2HTd5mMux/PPTUALgtk5ao3fVz?= =?us-ascii?Q?EUSITpDMwQv3pkAJ6SJLg/zF/gxglcsIJo9xF7SWn4S8QR+E1qw62J8Tm3TM?= =?us-ascii?Q?0oIDw42k3n3QyU3AjRqnyPuB3t0Y8Q28fYN/zg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0IKOE4w8z+cVjz9E4XhcIidk2Gy41FSY6WY5bzYf1A2MIOAy0KLHeOy0M+ggWjdks2lpo4qf1AAbazCPQomVfGNb3VGVs0uUnXiaaqnKqZK6gg+GywQxUpZFz+y6iipXgfn9O/T61Dwjrye8ouBUeaZcsAmHkVlnaAfTvbi6iLREgnenvLCqUaU4I++ZvkKyze85roLTzEwcs9U2h8BAKMhXhmVZDzudq/HxfqnPURqwZinbhAZGGUyUxTaS0Mi0uTvzWQ1rSuMSbNFmOGxDwmaZRE1Gve8zWnXkngqE5RIiZ2D39kNPf79STQ=; 5:ycvfbMPnySUJOqwl3JhYUG8wyf+Enqz4gfOnVg8r4Owo08jWoBfx43iYwPLJduUyE8YgaVLFj8FQ31mYmmlc2n0xlOVQK4V6oCnBHmCp+8zsec7LtZKWZqAmvRpjVBZ9z9LSKGrW+pj/DI1pKHuCjLLlUNnCSNr3pjh2msms5hg=; 24:hVtjE0PooGYLGK8vnRwUlqIs8chZ0fTBe2zXoj0doXo8mGs6nrU8MGcaIumFsmChGcfSgZlNvrm0vqN8W6/wwfJtrYK6brmMcYV/WGsApO0=; 7:4aTWYAnip7n/am1sc8EesLHmrV5TN3rCavyKrVqxiae0SXoR7MBtThP+CP3guicz0yvNQe6AL2nPDiKvAjhlGHk9p/s7ArkrKZdwrgRVx8VQTalP3LWLMz0FYz59wzP9jwfDn+uVdyNbWYu2ewNOLSDbgHyFjWeghWDWatQYiIr/EeewJdqzVT4pmLb+HvL2aDwF30/F8Pb9a3UAYa3ZEvNuFJAQ3VjSslT/ZfKdt+QRQ+d/T1p0aY7axidCspKy SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2017 18:47:45.0354 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bb3c406f-3aa2-4f5a-dbc9-08d526d93395 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR05MB1911 Subject: [dpdk-dev] [PATCH v2] net/mlx4: improve Rx packet type offloads report 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: Wed, 08 Nov 2017 18:47:47 -0000 This patch improves Rx packet type offload report in case the device is a virtual function device. In these devices we observed that the L2 tunnel flag is set also for non-tunneled packets, this leads to a complete misinterpretation of the packet type being received. This issue occurs since the tunnel_mode is not set to 0x7 by the driver for virtual devices and therefore the value in the L2 tunnel flag is meaningless and should be ignored. Fixes: aee4a03fee4f ("net/mlx4: enhance Rx packet type offloads") Signed-off-by: Moti Haimovsky --- V2: Modification according to inputs from Adrien Mazarguil * Modified the commit message to explain the issue. * Removed redundant l2 tunnel offload bit. * Modified mlx4_dev_supported_ptypes_get to report the supported packet types according to the device in hand. --- drivers/net/mlx4/mlx4_ethdev.c | 19 +++++++++++++++++-- drivers/net/mlx4/mlx4_rxq.c | 1 + drivers/net/mlx4/mlx4_rxtx.c | 8 +++++--- drivers/net/mlx4/mlx4_rxtx.h | 1 + 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index c2ea4db..2f69e7d 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -1036,12 +1036,27 @@ enum rxmode_toggle { RTE_PTYPE_L4_FRAG, RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_UDP, + RTE_PTYPE_UNKNOWN + }; + static const uint32_t ptypes_l2tun[] = { + /* refers to rxq_cq_to_pkt_type() */ + RTE_PTYPE_L2_ETHER, + RTE_PTYPE_L3_IPV4_EXT_UNKNOWN, + RTE_PTYPE_L3_IPV6_EXT_UNKNOWN, + RTE_PTYPE_L4_FRAG, + RTE_PTYPE_L4_TCP, + RTE_PTYPE_L4_UDP, RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN, RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN, RTE_PTYPE_UNKNOWN }; + struct priv *priv = dev->data->dev_private; - if (dev->rx_pkt_burst == mlx4_rx_burst) - return ptypes; + if (dev->rx_pkt_burst == mlx4_rx_burst) { + if (priv->hw_csum_l2tun) + return ptypes_l2tun; + else + return ptypes; + } return NULL; } diff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c index 8b97a89..53313c5 100644 --- a/drivers/net/mlx4/mlx4_rxq.c +++ b/drivers/net/mlx4/mlx4_rxq.c @@ -750,6 +750,7 @@ struct mlx4_rss * dev->data->dev_conf.rxmode.hw_ip_checksum), .csum_l2tun = (priv->hw_csum_l2tun && dev->data->dev_conf.rxmode.hw_ip_checksum), + .l2tun_offload = priv->hw_csum_l2tun, .stats = { .idx = idx, }, diff --git a/drivers/net/mlx4/mlx4_rxtx.c b/drivers/net/mlx4/mlx4_rxtx.c index 3985e06..06f57cc 100644 --- a/drivers/net/mlx4/mlx4_rxtx.c +++ b/drivers/net/mlx4/mlx4_rxtx.c @@ -751,7 +751,8 @@ struct pv { * Packet type for struct rte_mbuf. */ static inline uint32_t -rxq_cq_to_pkt_type(volatile struct mlx4_cqe *cqe) +rxq_cq_to_pkt_type(volatile struct mlx4_cqe *cqe, + uint32_t l2tun_offload) { uint8_t idx = 0; uint32_t pinfo = rte_be_to_cpu_32(cqe->vlan_my_qpn); @@ -762,7 +763,7 @@ struct pv { * bit[7] - MLX4_CQE_L2_TUNNEL * bit[6] - MLX4_CQE_L2_TUNNEL_IPV4 */ - if (!(pinfo & MLX4_CQE_L2_VLAN_MASK) && (pinfo & MLX4_CQE_L2_TUNNEL)) + if (l2tun_offload && (pinfo & MLX4_CQE_L2_TUNNEL)) idx |= ((pinfo & MLX4_CQE_L2_TUNNEL) >> 20) | ((pinfo & MLX4_CQE_L2_TUNNEL_IPV4) >> 19); /* @@ -960,7 +961,8 @@ struct pv { } pkt = seg; /* Update packet information. */ - pkt->packet_type = rxq_cq_to_pkt_type(cqe); + pkt->packet_type = + rxq_cq_to_pkt_type(cqe, rxq->l2tun_offload); pkt->ol_flags = 0; pkt->pkt_len = len; if (rxq->csum | rxq->csum_l2tun) { diff --git a/drivers/net/mlx4/mlx4_rxtx.h b/drivers/net/mlx4/mlx4_rxtx.h index 4acad80..463df2b 100644 --- a/drivers/net/mlx4/mlx4_rxtx.h +++ b/drivers/net/mlx4/mlx4_rxtx.h @@ -80,6 +80,7 @@ struct rxq { volatile uint32_t *rq_db; /**< RQ doorbell record. */ uint32_t csum:1; /**< Enable checksum offloading. */ uint32_t csum_l2tun:1; /**< Same for L2 tunnels. */ + uint32_t l2tun_offload:1; /**< L2 tunnel offload is enabled. */ struct mlx4_cq mcq; /**< Info for directly manipulating the CQ. */ struct mlx4_rxq_stats stats; /**< Rx queue counters. */ unsigned int socket; /**< CPU socket ID for allocations. */ -- 1.8.3.1