From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0041.outbound.protection.outlook.com [104.47.2.41]) by dpdk.org (Postfix) with ESMTP id 24F752A62 for ; Thu, 3 May 2018 01:21:12 +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=pjNKnKqWoafl6ZNkxjWQc8CA9MfCvZA4dvvrlhAiG6Q=; b=y12vTawG1lIICCSaSM24ST9Z/4zYt39FFqQXy381OT6PWDj/A29AgWCMEH6cvw/ZI+9DN+sc4vbO7OOkxK7dAzJfx8COu1Brn9V5je3GWF/waRQBTNfkG4O8iIORQPwFk1lXGKY6qiERxdq6mZ+eli44+7Z+LQH2U7fFwDHOEG8= Received: from mellanox.com (209.116.155.178) by DB6PR0501MB2040.eurprd05.prod.outlook.com (2603:10a6:4:6::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.20; Wed, 2 May 2018 23:21:09 +0000 From: Yongseok Koh To: adrien.mazarguil@6wind.com, nelio.laranjeiro@6wind.com Cc: dev@dpdk.org, Yongseok Koh Date: Wed, 2 May 2018 16:20:52 -0700 Message-Id: <20180502232054.7852-2-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180502232054.7852-1-yskoh@mellanox.com> References: <20180502232054.7852-1-yskoh@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: MWHPR15CA0059.namprd15.prod.outlook.com (2603:10b6:301:4c::21) To DB6PR0501MB2040.eurprd05.prod.outlook.com (2603:10a6:4:6::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0501MB2040; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2040; 3:Qug3U0ozLHloSCWQM/IoSAd7BQv0lhV3r5SHZJzZIy6yt2Fdc0HlOoKxWSGCrBjqgxZwRWPA2BwnqvLfeTZJBwxtdTAKgx53VUeGv3Qb3Jx/dFfsnfRVnIy2TmlgyzZ0QagXsOxxjKLNsvpOK78PLTkkebBkweczp62HR4dvaHMb+wbkteF5pNao4VNIwZMOS9H5JfuzX47AyZyZsSFH0MHeVcynWycfaF302ODvquUbA4AJqQfUJdYps2yG6Juw; 25:lJDV2ef0tFdvk3LSFvMuabGQcNLUQdbCGkqiwE/jtqPaZVomMa4mwWWppmG1sT5LRimgDLXlYBclhpYSD3LLbwLMLRP52xEClhnq5iT6cwHOadCQ27tRDRjDGki0rAUrkrSFf5i0Yt0RRc61ssVvUUv30jev/kHQ0/7TkQlrtkRqFj6cSBdbVvJXD7iBfLOfypFdaXl6wjVEANG3ECTm014IEduWAYlmuCZl3QDnpJsVDl59RBj8qb/WnXsRZH7G1dIXaJ3oMNoD9UrTGM92tXGklrAgy9Sb/ibOy/9JOZKuZe2WtdKUs5Y+eRqSJrI/gXWrysHK8fjUGqMlCDL06g==; 31:WSGKVZx2FQh7B4ux5FKTA9gp3KXI7eF/wLch5sKDreAZrb7QvDIe6MWeUGzIxo9XCT8UvjDKbKDVNpiaI4QdS4JRi3svuvf3UGbiTkqPxx/6jYdSY2RXPFStOfeAdRdsNe32/xNdmxdVIUzIu+moO4r9VjbgfvM9QwX7RdCvWFqQoR4dRiH/PsItFUC4Xa+G+EW8j8Ud/aqnUdRDWEB+tDD5wDWbTm/VPnqUXGtWWgw= X-MS-TrafficTypeDiagnostic: DB6PR0501MB2040: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2040; 20:PsrB9EveK/9fEm7ApGjkLfMjMelkQgZMeCOFtuthH7KgUITmHBMaB1v2S8FxOxc8f8XGALVYLprG5zxK3MfqIxgOm6oXn7Os7ulFuzlTWXWGFUXtuRrOX/LxSIxoxijBC40YydcNMnHuPNp3inPQxq8/O31faHJcVI6+u+QL3YGQZOBFCFG/RnzFQuwRTBKnnd8MzGUWtWQgIvFQh91yIkdNDqFDSwcNsw0AC++5zRHn9i10jgr8aort/ku10R4pPXE0FHiQYlyEdEoVVRTgwupgYfD8ZS/TqKLcQ13Uw4uQyogcVBgR/ZnfyTr4WrGFzoWAcq64qG9f3ntsf/tbrtr4A6+x9t3OKSuc/dWj+318mel/DwFulgzNfmOblN3izsZ6ydvyK2y0EA+FD6bpaka1QeFJtvfq/naea3GYPIvo8YGyjVeOc8d5dgm6quotOYk9GCAJ/YLyOuGQS3OAuYv8nNTDDga1NSDmcfltbdDW11wtvtrekYtPMBdRyVn7; 4:pqAqAciqtb/rP+u1NCbNAQreBU5l3rPsGRtpBqN6I7SL7vYVlXnijmmF+uLQW7PrUKLMMYpFxw90p2UX+BsPKMdWLX/ep52PVaPefGzFZwI+Yh5IS3xtkoMeVyZMLKd1g0UkztFJ0WuEoaDVooLGYAPeLhURvdsD1KyYiV2MaVFtN7bvnY1d6KHdKLC1Rwra/U0pmGv6TGe6iaRN243ZNjvu6ZETzRnHeXkmou7yAZWzmN/ZwqYHEm9jbxUM3XxJJc9zfOzomnHRiDraL7d6LA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041310)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB6PR0501MB2040; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0501MB2040; X-Forefront-PRVS: 06607E485E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(39380400002)(396003)(346002)(376002)(199004)(189003)(6666003)(48376002)(8936002)(305945005)(5660300001)(36756003)(47776003)(53936002)(7736002)(50466002)(478600001)(66066001)(105586002)(107886003)(50226002)(106356001)(21086003)(3846002)(55016002)(486006)(25786009)(76176011)(8676002)(69596002)(476003)(81166006)(4326008)(2906002)(2616005)(81156014)(956004)(52116002)(7696005)(86362001)(68736007)(11346002)(6116002)(186003)(97736004)(386003)(1076002)(446003)(316002)(6346003)(51416003)(26005)(16526019)(59450400001)(16586007); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0501MB2040; 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) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0501MB2040; 23:+RoGOqKkakmQlnRjg0w4+rP5qWfgfhGzK27Zmn9?= =?us-ascii?Q?+H0ztv9WPFnCyAYEBjiIX/YAJk8v9/ZNZwAZ5ZUwh89BV5m5VwsDq1seKaPc?= =?us-ascii?Q?0r/b5KMrBiy07vUMAGWoG4eK5Tcj+nwwdf/fEiFJ7sW5rpH0VCW0ocp+2YIT?= =?us-ascii?Q?+WmI4b6i2atxFAFIQT/XDGroHj/xK9W7JtAVL7cv98noddCXTI8Mx6XzEFc2?= =?us-ascii?Q?R75jIFjn+FzVizBQiOsYsJczYtfCZQOEa5A+k6HiHTykSQef+P2726ZuKFmL?= =?us-ascii?Q?ixG8NK3RgMaEWqUS4QodXXlDaeBFM7sV+JQoeK6OzTUuoNA1aSSsPYnHaaHU?= =?us-ascii?Q?ZLxukgF59JuLtb7vp+k2f2gD55jop5GHN76wUFtf8rSrDUdj7ZLXQ2ZHshnP?= =?us-ascii?Q?KYsR0LF1/YsnPFa/jrkQX5eOu9ajM+1vtEPDPe2udXL4sZyuZKGYSm2+5qc2?= =?us-ascii?Q?2bTdAATC+H3FiqDgtSaBS3htzyAwQa4CA+FgePAONciEkGijslpr4Nhz8si/?= =?us-ascii?Q?cs4XR37ezjPbYlAbR6nOgHx9vcfYz5OUlOjLCuTkBVL2gwb1FFhTK+Viszz8?= =?us-ascii?Q?Z1zeeVy3NfSqCPlpEanicokRlPRfJYIpNLuglao5sLWfeoOuOi3LRLFMLARe?= =?us-ascii?Q?NruIL1msNx4B62ASGO/8JQQ4hYAWXKJFMPp5Ivnfnct9GFdZnK96OK9kkqZn?= =?us-ascii?Q?cBAbnYbu1Hjs2bR+Tx/wXnwiqoBcYhj2QSvlcxPNPYQpu4TsXXppLeHPLg1M?= =?us-ascii?Q?smuTz3XwADjJg7LEvzJPYOGulUqNkn/IM//+wKROJyyxXRfBBwwLLKYbD71Z?= =?us-ascii?Q?EGgnf7ewv7rR3iOGxOzfzlYMUNA/pPUTq57m79JzeGvkRVfBZAVbLBt0EqeB?= =?us-ascii?Q?GTejCg9+R5TOrZUroxUGzJkd3sXA0PTIBEm1P31AkwYj03hrXrU4CkFMAQJL?= =?us-ascii?Q?tfiUWHDPpkYZmActG3WhTD9COg0dhwWnnlzQipX8xnzLLq3i0dCUNxn+GE0G?= =?us-ascii?Q?tHCGFgIkX+YgaSUrUViF3rxgujqGVyrml5WqwkfgeOwxq/wgceq4tXbaqqqP?= =?us-ascii?Q?8HkTfN6dpSPN24GbNeJOrtz1gokFsbDR8M2WKGRUzKKMtuBDDdeRz+/4Onht?= =?us-ascii?Q?PybMmi6GjuQA9Vxuzz0n8xjENNRwIHxAR4106DWHbr1F9UWknMYxCOtUVKzC?= =?us-ascii?Q?MbZz902C+SrXoUfojl00SxhMs2h6AK/pz4MVNqw78zpa/0jjaUUKdPXUbWCF?= =?us-ascii?Q?mtgMmSL+wePLitTKztGIVHGSC2URHCh1x2m6bhUCL?= X-Microsoft-Antispam-Message-Info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odhQZOS06VzPs7XQcTvszfm5hwImHgcQL33AtzeaudCUVOoywhPcRXGrwY0LafhXKZjbg+lYWG4/sRtWzdBp2CtaSiThZ1N7OXy0BrsyQtJIP4qzTOBSSusDlIyeKMaTdpBdCe/6qQnoy53iA7sgo4NOQlUbO3dWKo8xs2AuIuKb8KnEeES+djuLPdc2ey+2efLMGrn3rNVK16TMcD8KtTVg4Kk60LhV/7pYWrgSafg9MVNV1m060wOJ8LmKBx7 X-MS-Office365-Filtering-Correlation-Id: 56655f81-f000-48ec-1252-08d5b083640e X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2018 23:21:09.8953 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 56655f81-f000-48ec-1252-08d5b083640e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2040 Subject: [dpdk-dev] [PATCH 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, 02 May 2018 23:21:12 -0000 Filling in fields of mbuf becomes a separate inline function so that this can be reused. Signed-off-by: Yongseok Koh --- 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 8a863c157..299408b31 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