From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50076.outbound.protection.outlook.com [40.107.5.76]) by dpdk.org (Postfix) with ESMTP id 965601B5FB for ; Thu, 9 Nov 2017 09:59:51 +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=O1lNOU+U75FKCslL1KSk3aYDz1cItZd9TC502Wm7hkk=; b=IX363IpBtiLCItQf5/Wba9Zd+k4wyM9mVsC8SnTt7EmXb2eFGoFXF4Hv03+BCxb+8hU67YfmMto+hRVJ3LX4Gqn2kZ1mzBPLCyP4XWB5MHdGUYwJe7LXFyPYY3gXb6CN0CqGYXhO6gVh0m62OQOrtQZIe2RdqRlIVJs1LStNOS8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR05MB1916.eurprd05.prod.outlook.com (2a01:111:e400:7b74::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Thu, 9 Nov 2017 08:59:47 +0000 From: Moti Haimovsky To: adrien.mazarguil@6wind.com Cc: dev@dpdk.org, Moti Haimovsky Date: Thu, 9 Nov 2017 10:59:33 +0200 Message-Id: <1510217973-178845-1-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1510166831-153992-1-git-send-email-motih@mellanox.com> References: <1510166831-153992-1-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR0202CA0021.eurprd02.prod.outlook.com (2603:10a6:3:8c::31) To HE1PR05MB1916.eurprd05.prod.outlook.com (2a01:111:e400:7b74::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e802125-2fc3-408b-600d-08d527503af5 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603199); SRVR:HE1PR05MB1916; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB1916; 3:Kd2TUmHRXzK+VeT5BoSNZLShFxxQxfwAaPuBwHLCF4JIY9/U4TMPm7oYQhQnTBCt+oZFhu+fTE8D4VUF5dsDv+C+or/9flce8jw+U/ec88APqR/CDcTaeHzyf6Emls1Ubsh/S+YjKxfq6y1WdJJ0gBMy2or3sWkoXFhxmpDumsVMGzJIK2DZWbLRRytRjgrGk55zqSU5xLbUNLMvz3rL+uHK84xJWO1Mvfn21mcC2iRhyu9fDzrKXVcgdnFaHRay; 25:b1JaBRgQHJiQ48tWgEsmruUf6Pk0aSHNWeL8I8/+hqLia+jrNyDf74PKTKE4ERVOlKE0EjL99a2SJJ7LagG6hivnnCy3HRZ5hE1/sM6uHOOBKFCkBO5Wm3FjvnQzShtGQ6/LZoT1uGdHVsqGT/6Ye4zlcywXispKYMuD9ct+QQub+WauCWjNCfhilVHQHQIgdXGrfB52aFljgubfiZ1ZK7z408TMd4Ta3M6JDwmtaRsKcEk0EMlLYegkKnq8vzDiShvXmxSU1ENn8JtHHe3fIjYwM645h79hW1ga4Ki1ccrpQ+WV2xj3aGXgi/HGqF7BSTsHMyo3T84fQCCVBfN8ig==; 31:IL11anWI5FCzmcZtLjDykNopWTRfEfiDaA0jX6jMDeliLDA4VBWFR5ZMXxcl0e/DfMFtdfrNF+R5ofOsOfpDvyT3GPWCl1hhg/orlM6rS+FiNhhjxR2Oy40Nk7FgIaxR8/jkqZMli3tbnfHdXNbVQ6g4XYlXFm/7tZhdg13IW7LZPeSyXAgf0Ove9Ni7TP7kpMPOmN/6ZmaryYCXmfRmWSYvlqcTJiQzE3bSEOVPWOk= X-MS-TrafficTypeDiagnostic: HE1PR05MB1916: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB1916; 20:+RWrQB3nTXtJPk0S7DccDefPjtKtMIpYfN56M7o92W1Mq+oiYspfAbb5W09Wa7lGyY5VMv9NLAQAit0qyfM0zF8BTcBTZFnuCF0KdrXpcB9OrgaKAegXxS/eEwCmeQUteGBL8I9GXxqZqd+U2pT2JDjrrHaD2j3dxm+QibgHpwTnAHBhS6Ye5PBM8WEP6RRF3vmpOl1mDtYi6QnpdlYB3VoDdwbtYAwpBKcQpwkcjVN2TM1PCiPX195UmSpjyhe6T+3kdY99sdhGaK6P4zbHUVDYTqDT/5FrQV23Me3ksODzlVCmyW11WDvVi5Vli2LXBMKM8g9z1PMluZ9dAqzj88H0nl/qiDRPdt6fYnIi4TOIRWgpQq/798f3Zvr3u1fBLC6ZhPMrT39+NU2uHe63nmvsR/ktBPoV0rxwSyDCQK1/pOIHEaEAsSViKeZVxiTP+kpZjydzHENWR1Pj869vxRRO/YoUhavbWQP6dc0fxIPnRKlJjw7CCoBqvh1BfdVt; 4:xDIeHgwCUgMvX9a9+Z++dGe/eW6tZnW5EENfFli5i33B/X6mFBo3V8vFkAoON5u2D1iyGSrAas9xfzecqIPCE5QTZFOcQ7JUAWX+hfn9jaxh2nRay/cSnqclo6GznVSoARL5FgGE30QFiVP3+FJ7Gr+ZOnJZODiRSl9ssshMitcQibMiqvaOXrqlyBvZnnx6ZP75mm/YWwlB1tCe6C9IJGX6t5VGkE7aiWhJGNRNRe0iEedRVxWBcyu3+OsRbaWum89UcBlKpidhDm4uHiUryQ== 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)(3231021)(3002001)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(20161123560025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:HE1PR05MB1916; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:HE1PR05MB1916; X-Forefront-PRVS: 0486A0CB86 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(39860400002)(346002)(189002)(199003)(3846002)(86362001)(25786009)(16526018)(36756003)(2906002)(48376002)(21086003)(107886003)(6666003)(6116002)(50986999)(4326008)(2950100002)(5003940100001)(50466002)(76176999)(55016002)(4720700003)(16586007)(478600001)(81166006)(81156014)(8936002)(66066001)(69596002)(6916009)(101416001)(8676002)(189998001)(53936002)(33026002)(47776003)(305945005)(2351001)(2361001)(5660300001)(106356001)(68736007)(33646002)(97736004)(105586002)(7736002)(50226002)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB1916; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; HE1PR05MB1916; 23:ztSUJkwuLf8atirA7+lW32zHtAEuPf0LCsnEh/GS9?= =?us-ascii?Q?J2krCW16F8pqfhCWnQBSnRAeCVlvn6y/UDP7bb09NCjdVhsAmf4CXwBD7zZp?= =?us-ascii?Q?j8VPwc32Len22ziX2WsNhk723cFO6xQ9CZ0J+A1UKJ5RT+FFT4FaV25sITNN?= =?us-ascii?Q?aqetcDmPer0HDFDfU/VaLFUZSKJK2QuyLjr4CQ7Jj6FU/Aewsz9XD5R2XHiW?= =?us-ascii?Q?IZZTeYWx5mQ+7lLJaLGu303yY0fQZO+dOpld+CFBcrSK8ELTSHYvnDWUfGVw?= =?us-ascii?Q?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ginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2017 08:59:47.6294 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e802125-2fc3-408b-600d-08d527503af5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB1916 Subject: [dpdk-dev] [PATCH v3] net/mlx4: fix Rx packet type offloads 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: Thu, 09 Nov 2017 08:59:51 -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 --- V3: Modified patch headline to reflect that this is a bug fix. 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