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 4F5251B1A8 for ; Wed, 9 May 2018 13:14:10 +0200 (CEST) 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=7MwKx81Tip7bfozRkMovhfhd1hNQdpfk/YtWuEJjigM=; b=u7OOVbnfhF00Ml+U/3PMhQ5OHPrGiuAOPewzpD+1K4TkfiW8b525LSARvthTGkCIsIRQS9c5WErT93OVVv7+0g4CoKW4eUyIrh/4jDofhvPR3SHlJpxRTqpRO93a8ITkeRG1epRSKGR//+FfMPWr2WwNWIhBBX0UegkAGQAa43w= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from mellanox.com (209.116.155.178) by HE1PR0501MB2043.eurprd05.prod.outlook.com (2603:10a6:3:35::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.18; Wed, 9 May 2018 11:14:07 +0000 From: Yongseok Koh To: adrien.mazarguil@6wind.com, nelio.laranjeiro@6wind.com Cc: dev@dpdk.org, Yongseok Koh Date: Wed, 9 May 2018 04:13:48 -0700 Message-Id: <20180509111350.20240-2-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180509111350.20240-1-yskoh@mellanox.com> References: <20180502232054.7852-1-yskoh@mellanox.com> <20180509111350.20240-1-yskoh@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: BYAPR07CA0022.namprd07.prod.outlook.com (2603:10b6:a02:bc::35) To HE1PR0501MB2043.eurprd05.prod.outlook.com (2603:10a6:3:35::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:HE1PR0501MB2043; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2043; 3:pnTbTWQnx3Q4zsC1E061AHqj+FITqpwbKvswI46TUfMeA18oTiMrliNIDmOT8nAF8df18uclSpphscF4vZIKaM8N9J4WOQFhlMN4HmMSmnCU4dDhE7MkF/H8zWgvanwbGxanV1isKhBJ09AqGDS6YEfrWI9/gYO5JSL+aGmlOk3QJn3apXBUk6lIEZPlGe1ifcP0LaSGsRQWTYPLGKkLtZqnc4p2IwTQzOeF2KlwaZvtxL0gimX6YWvcQ6w7Gogd; 25:7wVP6m1FyMuHod09ZvJm1s9SqsJy4kX5THE/hl4jS0aOSZOM7u5MHh30Bsyn5JTBfXj7iSq/1YND3w4IAAlFUMSGw/FZUVqGMkdI4LDNUe9lIkFaPHWeJ2l44l4zvP24pXLPnjVD6QA2w+mD3SM2Qx4obXB6irQiufJVooLR6/RTIFQkhUBH5nt/IBUw8d8Zm/M0RI6yBVyulJ4ydMNDfzgkFqq4TBwzel6JuJNbBQRwD5YRTY6QqE4rJOmHVH3+GiQeYSc1uIOSmB100PXaBtyxgzcum1eemlCZjSzcWX0OA0V6jTqjOJ/1LzYikP3WZRpgQXJ+89iAxdEiji+uLw==; 31:4PzBxhxhFAQvxvWWXGWgtc7ec+lcXnDjrD5rodwXaM1B/Wp5lF2i6TrxNIKRG3/SJs5zcrVJc2E2I8IMkBtQPfXZq3RsQwylMclBP9wCWq+FR8NWh828nNwjaBLqMqcaFIlD1bssmoCnLXZleCHM+WwMKQM1hUJPzKxN0oLiJQANjd3GsODhMNKKE/NwtpAxCJmCc4+03Ayvguj6a0MyMi9iyYauCiEz4AKeHFjj8aU= X-MS-TrafficTypeDiagnostic: HE1PR0501MB2043: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2043; 20:ETNAbt8CBzwaA17lDTYbAWU4ww1vfmQYnXOMY2BpkYgcPrylK5nO/+/kKiBRHVPAIdbp/L2xF2uqeuIOVi8V/RojrXBDbWNzhI3KtduIpxCYsDRLFUUOuVjqMzVNDtf9TMH0MPyJI+KyOR6gdhVkqBVj7D/kAooR9t6ow/dOFd5klClLKczVZpkWcwMKPZDd2WLDwdd73F/TkFVkUKWeoepA9YCGPIm7ckeb4+rSIqrNCncgbgqfVWcAxy+PRhEDwwXO4ssoYwifY+g+zKcQG/yzkNnAvEw5vgmdVSAOvtstadceiyNOae9kG3WZWcMRwqEUi3c7fTTFPDDQmTs3q7GyTHnvj3+R5cRrf11IoLdaJggHdrspVRCJf2xte4KEtjw7WU+1Qi6s/zB8p3e4VE72Lm/mDz9uhivKAk7uSlqmdV3XNIp4JaRxRLoWI/8fBRu9usKOEqIV+obgDwT2HueX9F84s16PEv3eM/GCPXE2nN453srFyDZcIJ9JjASa; 4:BWb901L7xQNnI5fP4kn89qx3FXB1e39gNMmTxXn61OlAZSVduJx5+MJgXpafqwClVpp++3vgt7MErwUBT3qtKoqBAsdKRRmtmd9m0yT6HG5mKLZ++91k+8KHeBqVC4mF6tnJc8Z9p0lQqDcI8g5UtnqfeASCDEYQSbrvcxqAbQs92EZwBWkF7bhZ5k2A8xupp39wJHVh2bcS7b35QmXuSOj7tKgb8Bk0Ahc/5zXjt4uyOkCB36mEN8ZPr3sa2gosbgIXn5FM5jlKXqMON20Zdg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:HE1PR0501MB2043; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB2043; X-Forefront-PRVS: 0667289FF8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(366004)(39860400002)(376002)(396003)(346002)(199004)(189003)(8676002)(5660300001)(48376002)(26005)(107886003)(1076002)(3846002)(97736004)(2906002)(478600001)(81156014)(68736007)(4326008)(55016002)(305945005)(16586007)(7736002)(53936002)(6116002)(50466002)(69596002)(66066001)(956004)(8936002)(106356001)(76176011)(105586002)(476003)(11346002)(16526019)(50226002)(47776003)(386003)(316002)(59450400001)(52116002)(81166006)(51416003)(2616005)(7696005)(25786009)(21086003)(446003)(186003)(486006)(6666003)(86362001)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB2043; H:mellanox.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0501MB2043; 23:1xSKwwRNE60Tr+hAfNLjJ+dCpJEIGyY2lub7Lhf?= =?us-ascii?Q?trx1ZHTmPtkL47gIMPVr8WJGhpDy03Qle2XHKE9POB4eu9bQGZkE0nsowLLW?= =?us-ascii?Q?vvn6FCKwyqHtt9g3yi6dMQ4g9fqAUTzo30noW9tEdSJFb2IUM7E8iY7usjMQ?= =?us-ascii?Q?TRcpXSZNDauR1OpSnxJE4h0NdU5C1drvkM7fb5gUz6qfPzBoDhTBvghC+9F7?= =?us-ascii?Q?VlvxXjVbHKCHndX6x0yTvoZvcgHPB35E7+WixGkuwAu5ie2xYyuH6+1ACxKG?= =?us-ascii?Q?spra7rj2YR6QFSzWMoMagE9alL2jIJ+5cSMq+beL0xvpdl1LQYgdKEVxCWlE?= =?us-ascii?Q?tfHrc665b8y1rKAxoTx93epsW0uGv5asJ2CJpcZ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= X-Microsoft-Antispam-Message-Info: Y3y6Q9zlTLvV32ACn4qm6tn0tzRScJxcfks37Q2zWgUzOcjaO7qjzxJawUFOq5eiAllyIQuOGpU4zWPHhc4R89ksdHwHpOk9eo6jDU0ykSp54VTCA0hDWncgJFz3sXzcUdKzed6w1U+OkyhOC7JB0Hme7soJSW767ha7LRglMp4wNzDXd3INnn0PYBeeoc+N X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2043; 6:h0kMLvaNHqwB7PhLhHhdEfTzxhy741AAs+ug2B1F4QZprz6Di2ZIwlb7GHm49W8Wlwm2adMs00rY22K8a6MUh2V2oIo1VVUjb7EDrVOP/FJb4SkoNR2RYbuKIbU0hJqw+91mlVF2+vct1QaLIf2asKoAFjlF4P80nl8B89UOL/+9OSxUCzKSF6Nuxu1al/B944WZsBlkZduZ4+rgQ3p699k9AiG7X5afoAXf8DLo4FAJUWNZIZIt40E/8lqeuJz6l8CttfYF6shlmH67VF+71ffMPt1sOvjLKX10fJtT+cV09vCSSUrK6EIT7y+6uPEfvhj5f0p2GLLlMEHkivmvnzq6qnJukhy7o7pD0mz8i6fB9GPcrirOuwM1jm8n2XNak69Vp0S8JW56qGD5xj7SBiDNNPkQPXhERGFO3ycVNnavLt3dFWfRqH7+cipRGHQQDkTIp3SGyUbcGrgGD0+Dcw==; 5:JRZnXoXq9kboMpNaY8avgViMSNs79ijdsaZa3nCAyRZuxpTYdh60JUfO0YX36VyiUyVr7buTYA2aQYcCdt617oyDVCZHGGJds+lv44cBqQf8w4GY2+dYoz6lfEPyAYPQRMXzKOVVi/0w4c2Kg27CWhTZxA6UQBrsIbnwRUA6b3A=; 24:eSHmCoE6c8w7QChPytezecM+a2Lt7Od5mZ6A1wD0Zj95Tzbxm2DP0kQ7ah8XRBLL7ps3D948paZnZmrNPLGhz0+KK/p977Cww5AE5N25TgY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2043; 7:P2xk7eDIFYaCxUVtQEwGn2OWDJEvHraCnA634OV06U79UKNEgdQuZ8Xcu6/9bncjsgRc13BITKzHfUtC5nz6VBZ+NT6TmuLq+HAzIHlNBg4AwR22e2OEKFLnIOmMNgqHmyRV4f8kx2fGbUhxJawgECVQx4yd2d5BiiSpCafS2PHkPwTHcBBfIrn+cK+E82LEtSUsQ2W6b+fHXMMX1lVJgODOfg8Q/nEXaBOUR8Hgm+Mu/DzVpvntc2LqMg4fyfyM X-MS-Office365-Filtering-Correlation-Id: 88d968a1-0521-4663-ab7f-08d5b59dfbfc X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2018 11:14:07.4144 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 88d968a1-0521-4663-ab7f-08d5b59dfbfc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2043 Subject: [dpdk-dev] [PATCH v2 1/3] net/mlx5: separate filling Rx flags 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, 09 May 2018 11:14:10 -0000 Filling in fields of mbuf becomes a separate inline function so that this can be reused. Signed-off-by: Yongseok Koh Acked-by: Shahaf Shuler --- drivers/net/mlx5/mlx5_rxtx.c | 84 +++++++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 33 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 4a4113fbe..6cb177cca 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -43,6 +43,10 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe, static __rte_always_inline uint32_t rxq_cq_to_ol_flags(volatile struct mlx5_cqe *cqe); +static __rte_always_inline void +rxq_cq_to_mbuf(struct mlx5_rxq_data *rxq, struct rte_mbuf *pkt, + volatile struct mlx5_cqe *cqe, uint32_t rss_hash_res); + uint32_t mlx5_ptype_table[] __rte_cache_aligned = { [0xff] = RTE_PTYPE_ALL_MASK, /* Last entry for errored packet. */ }; @@ -1841,6 +1845,52 @@ rxq_cq_to_ol_flags(volatile struct mlx5_cqe *cqe) } /** + * Fill in mbuf fields from RX completion flags. + * Note that pkt->ol_flags should be initialized outside of this function. + * + * @param rxq + * Pointer to RX queue. + * @param pkt + * mbuf to fill. + * @param cqe + * CQE to process. + * @param rss_hash_res + * Packet RSS Hash result. + */ +static inline void +rxq_cq_to_mbuf(struct mlx5_rxq_data *rxq, struct rte_mbuf *pkt, + volatile struct mlx5_cqe *cqe, uint32_t rss_hash_res) +{ + /* Update packet information. */ + pkt->packet_type = rxq_cq_to_pkt_type(rxq, cqe); + if (rss_hash_res && rxq->rss_hash) { + pkt->hash.rss = rss_hash_res; + pkt->ol_flags |= PKT_RX_RSS_HASH; + } + if (rxq->mark && MLX5_FLOW_MARK_IS_VALID(cqe->sop_drop_qpn)) { + pkt->ol_flags |= PKT_RX_FDIR; + if (cqe->sop_drop_qpn != + rte_cpu_to_be_32(MLX5_FLOW_MARK_DEFAULT)) { + uint32_t mark = cqe->sop_drop_qpn; + + pkt->ol_flags |= PKT_RX_FDIR_ID; + pkt->hash.fdir.hi = mlx5_flow_mark_get(mark); + } + } + if (rxq->csum) + pkt->ol_flags |= rxq_cq_to_ol_flags(cqe); + if (rxq->vlan_strip && + (cqe->hdr_type_etc & rte_cpu_to_be_16(MLX5_CQE_VLAN_STRIPPED))) { + pkt->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED; + pkt->vlan_tci = rte_be_to_cpu_16(cqe->vlan_info); + } + if (rxq->hw_timestamp) { + pkt->timestamp = rte_be_to_cpu_64(cqe->timestamp); + pkt->ol_flags |= PKT_RX_TIMESTAMP; + } +} + +/** * DPDK callback for RX. * * @param dpdk_rxq @@ -1916,40 +1966,8 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) } pkt = seg; assert(len >= (rxq->crc_present << 2)); - /* Update packet information. */ - pkt->packet_type = rxq_cq_to_pkt_type(rxq, cqe); pkt->ol_flags = 0; - if (rss_hash_res && rxq->rss_hash) { - pkt->hash.rss = rss_hash_res; - pkt->ol_flags = PKT_RX_RSS_HASH; - } - if (rxq->mark && - MLX5_FLOW_MARK_IS_VALID(cqe->sop_drop_qpn)) { - pkt->ol_flags |= PKT_RX_FDIR; - if (cqe->sop_drop_qpn != - rte_cpu_to_be_32(MLX5_FLOW_MARK_DEFAULT)) { - uint32_t mark = cqe->sop_drop_qpn; - - pkt->ol_flags |= PKT_RX_FDIR_ID; - pkt->hash.fdir.hi = - mlx5_flow_mark_get(mark); - } - } - if (rxq->csum) - pkt->ol_flags |= rxq_cq_to_ol_flags(cqe); - if (rxq->vlan_strip && - (cqe->hdr_type_etc & - rte_cpu_to_be_16(MLX5_CQE_VLAN_STRIPPED))) { - pkt->ol_flags |= PKT_RX_VLAN | - PKT_RX_VLAN_STRIPPED; - pkt->vlan_tci = - rte_be_to_cpu_16(cqe->vlan_info); - } - if (rxq->hw_timestamp) { - pkt->timestamp = - rte_be_to_cpu_64(cqe->timestamp); - pkt->ol_flags |= PKT_RX_TIMESTAMP; - } + rxq_cq_to_mbuf(rxq, pkt, cqe, rss_hash_res); if (rxq->crc_present) len -= ETHER_CRC_LEN; PKT_LEN(pkt) = len; -- 2.11.0