From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0046.outbound.protection.outlook.com [104.47.1.46]) by dpdk.org (Postfix) with ESMTP id 077105F3B for ; Sat, 10 Mar 2018 02:25:54 +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=g2XBGMIlqWHX7CpTRvzPxOUp9enMniZq3embb8xds8A=; b=GkT6AstQgZ0evunbmv4W9HZGK700HTAjVISxVkN2j3exF7GkCtnqPuubYlYxJ4vwr9yYh+TcGHBeyEdunb+m2O2zzSE3QMujNOY9vnP9GoucTWlGKHyZKk0WDIPdWcyM4Bu/n8xFsMhsqaHV46B3KC0KHHfToAjMxq1E1eeks9c= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from mellanox.com (209.116.155.178) by VI1PR0501MB2045.eurprd05.prod.outlook.com (2603:10a6:800:36::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Sat, 10 Mar 2018 01:25:50 +0000 From: Yongseok Koh To: wenzhuo.lu@intel.com, jingjing.wu@intel.com, adrien.mazarguil@6wind.com, nelio.laranjeiro@6wind.com, olivier.matz@6wind.com Cc: dev@dpdk.org, Yongseok Koh Date: Fri, 9 Mar 2018 17:25:28 -0800 Message-Id: <20180310012532.15809-3-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180310012532.15809-1-yskoh@mellanox.com> References: <20180310012532.15809-1-yskoh@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: CO2PR07CA0068.namprd07.prod.outlook.com (2603:10b6:100::36) To VI1PR0501MB2045.eurprd05.prod.outlook.com (2603:10a6:800:36::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3cc3c13c-a8a0-4a84-c6ae-08d58625dd32 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2045; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2045; 3:XUKEYAuX+DNXLCekbnENVkU8G6BfHa9pp6bQ11wsbpiFtdxLXAbSXzrs7Jw2NXjLlOn7lWIv+ahJJUw7pDbWIusRUDdQjJTs8cAYS6IbGwVhXUmjVDDpUHoADL51wjbnFAdCAxhEScawu3SHZ60XhqWQSYSioElDJNSIwO2cZSScL9XsH3opNtY5WsVnhPJV9q/Zsjrc5T8EM+jJ3gUwcqAuzCwIDrMtADkPEjxlevEnXB3k+he7jhaZRekKZRFf; 25:hwOMBRvqtBAIE7c8lHRSbeKv84/JpAMFfywsENG44v7U2atp3RkxrQ2AIhYMjOHiLtWawpS/zrNkzBHjZZOnSBnL3Uc4jGYPcD3+QI8c7Rj89vOFYIPbiAEcuLGkuD0MFnp11f8D2txkOpCt5AyuSsoxxtYc3vG03SuvlD1RsFPXM554fcSkK41oPBld0mYg4sP2e7GyUhfgRqB9yiTEbKgmfKDAf/TokH06QxpwAVf86Tq6VkgizQ1XVCp+4Bb7Uqah7BC8s74Rb8UktScQyTiBa23F61TU9jmMFfKYRQGSiL8HmAJ9AwPu3WK48NOngGUz7qt3gRAD6d33k9iEmQ==; 31:S+NWTkYm3zG+Zz2HoDycPLsed51efi5YbGBsc4Dps5xoaJw5XhbGwOregiBFHfpgF4m9vv2R8ImmDfNhFhlxqP96ryZfxbB8i8Bp3ZXBZMzPbjvPS58FaRH4Z9aKgjcqeEvo6IWvjf9qnRzL/HeE5e7O1Guxbp5lQOIlNiWXyA1/v3MjcK2UM6kMIHmkEhVOFiSdTJkMzs9Ou97rDHlCimTpLUC/d+fApEb6Wzje7m8= X-MS-TrafficTypeDiagnostic: VI1PR0501MB2045: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2045; 20:PpiC7RlQ0hjOWv5D1UPhlvkPHJuOTxwnQpW/HK0gHNAs8zQGkx0kLuPdNPeBNfh4lOLyohbWGSSKUxBvrMrTFKf+uQvpLuxobssM6jVp/pg4gsdzgEGKAit9eIMQi7szYt47Us8K8jqvwdfvVtVJe8v0v9/dwPqxdRv1/a8dLtDKGLNx3pSgMt0oEi/fegdDM2MNbroOi0eJT0OmJ6Ia3Sfwvh84m/TE/A+ZSADLho8QKA6LWgc36U24ycdz6LgdI0DLiARyl8Mqfkw5x73A88lEN1yG5AxjumIS0TSBZLVv4a8BQpC+oDgg2+2rRvhP40Kzg2ger8QuguUKiB9+T/fp6G3Tf4OQtFUiYJtP1inOGLVmVYZqIOtXy8droOu9ql6YFpsTwpEYWc3rCPjy2VPicPCLIt/YQYzL3/IHEtSysqqEnexU7xjPnmqLPCqSrdtxwALFiLlw24FQ26G8/qTfyoFcKrAypJ6iAXpKvMv/fHq16eyxNFGSMGyjql+1; 4:OsOZLcQ/b8tJ7eOcOj4yMjjacFySWipbd12Y9hr33xzRm5QDgiRG3PG5ACfP/OqLs1RU8KUIX5PP1zkYVRqlqgdyi+TzIDcBhVKUSgscz5miObeFgpqFZkd4qjQcHWI6+s/rXtrVmhV8A6InQU/aFiq/MxroQYi1zgq3g/ddNpuoUK7oSsbfzTZASjg+IXuTZCtvcWd2BqzYO4E0Und533s0LMfMTlhT+L42Iw6BwMueLAExu9XcR/TkcQ3gOmMcLDYLSY43PdcNXkeLZ5lmNg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231220)(944501244)(52105095)(6055026)(6041310)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:VI1PR0501MB2045; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2045; X-Forefront-PRVS: 06070568C5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(346002)(396003)(376002)(366004)(39860400002)(189003)(199004)(7736002)(5660300001)(97736004)(7696005)(51416003)(36756003)(6666003)(478600001)(76176011)(107886003)(86362001)(8676002)(48376002)(55016002)(50466002)(59450400001)(52116002)(53936002)(4326008)(69596002)(25786009)(21086003)(105586002)(6116002)(3846002)(66066001)(386003)(2906002)(16586007)(186003)(50226002)(47776003)(68736007)(305945005)(8936002)(316002)(106356001)(26005)(1076002)(2950100002)(81156014)(16526019)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2045; 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; VI1PR0501MB2045; 23:CXGpCEpEiolbyXqG50I0j9wJio85HH44b+mqv22?= =?us-ascii?Q?J3u4ZhzhqQdKhRxEe3eAcAPbndaAujP35awE6K0Pi+kZLFZkI3mfpjnt53Zv?= =?us-ascii?Q?sVy1FZJhrUyFc9e2U/v72SES2XtICRv/0QVN3Frd3TwzcW7YRCC5ninS7V9F?= =?us-ascii?Q?7deExK3Z3DwvtzPZAfVweAVZL4+4iixCzfXG0iNm7IAgsSqIFahlwfy4FJGb?= =?us-ascii?Q?soMRb5/Czam9LH8fCdlOYsy7mHWv0bwMNMhfFEHab7bJkCwPaPVaofnaneoy?= =?us-ascii?Q?cqHi+njYdaD1SKkRlO6XclNAHcjpQi7jFCW67vZoNagtQHaA6ATbRLMe5zc3?= =?us-ascii?Q?h+56Fn03EcOFgOkC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UpV+efkXQWskaEjyVZuXdFsIa8xFr4PfIJJyN9ZEWbC+5l SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2018 01:25:50.9390 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3cc3c13c-a8a0-4a84-c6ae-08d58625dd32 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2045 Subject: [dpdk-dev] [PATCH v1 2/6] 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: Sat, 10 Mar 2018 01:25:54 -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 049f7e6c1..36eeefb49 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(struct mlx5_rxq_data *rxq, 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. */ }; @@ -1721,6 +1725,52 @@ rxq_cq_to_ol_flags(struct mlx5_rxq_data *rxq, 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(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 | rxq->csum_l2tun) + pkt->ol_flags |= rxq_cq_to_ol_flags(rxq, 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 @@ -1796,40 +1846,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(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 | rxq->csum_l2tun) - pkt->ol_flags |= rxq_cq_to_ol_flags(rxq, 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