From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0085.outbound.protection.outlook.com [104.47.1.85]) by dpdk.org (Postfix) with ESMTP id DCB531B294 for ; Mon, 2 Apr 2018 20:50:32 +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=XNSHNCgWih3Frtpereb87mhLY9bT95G30g1ULHH50so=; b=CnFhTjNI17viVEoLp/8UWk1zkjfH7/GBprRIBd5CCCXDOfvMkuaZPJTPIasrWXse0Iktg2LaIZsF6yIFgVuDLqa2nqgIVTYFvimSUwUvu+YABVrMCRb+9bjHXeLZh9+/AdOanXCY1Fn2ESNCE6/E2jC9l0aMf3HmyLDjFlIqkNU= Received: from mellanox.com (209.116.155.178) by AM5PR0501MB2036.eurprd05.prod.outlook.com (2603:10a6:203:1a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.10; Mon, 2 Apr 2018 18:50:30 +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: Mon, 2 Apr 2018 11:50:04 -0700 Message-Id: <20180402185008.13073-3-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180402185008.13073-1-yskoh@mellanox.com> References: <20180310012532.15809-1-yskoh@mellanox.com> <20180402185008.13073-1-yskoh@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: DM3PR12CA0064.namprd12.prod.outlook.com (2603:10b6:0:56::32) To AM5PR0501MB2036.eurprd05.prod.outlook.com (2603:10a6:203:1a::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f7016b2d-c0a1-4e26-94ff-08d598ca9c82 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM5PR0501MB2036; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0501MB2036; 3:ccD1iXI4zlQlPWPalZav2ln2cbs13n8u1wWdzurHmCVra5YgG6OuN8zzRpMjdPATNcSh59zaMu6e9bW8rSrBXi0Yzt3shGrEwjdff3bejuwsNCek6/CYPuKdgbkO5f3wkt1dk4BFt+SntI2XSr8M7SbBEGkV0oBo6D09yYv3VZKSMikbWYkTxzkOdR8aW/CRxnBEk9jBoUqvkZ3AP0hswb2NXJy9a+oo63WJj4XCEA5Qsy4cOBRJCoKnwM8+fC8S; 25:54y76jYK32jojbW/svvBPtIJHcjOJ/010Exp8JI/5kjEJXI/PLJX9cJKOx+OSvi2i9DSeB37ZVS1yeyeXsTAVD2bRpRHWEN1x4CItlQbtxBHs+6R2WpvkEXkX/IqSYwm+GvwJQ29xoBtSn3NjS56J3cYd8I7as+EnWDqurqSEANz156k6bg7oHbiAhdoMzaeOseA1uT+S/3BIXXneMma8MwSzOHT/iAcT99JIL4StQh8z1RXXhfrwkupVMWWMIDENdbmHvTuepaww7cnBdisBzk7yXPuML480RF1IBAN+Aer/TXryEyzY4dt4fbTN9rqry2LrnPplLDmitTMEZFypw==; 31:foBLl9R4a9pSjSKqwmcEADW5PYwUI3bCcpA4wXsP5H2zeNmcLZH66AbZKNsgu3IpVt+V1rfsJbLF1foUSZwnZEXJ1enf/1TEiMrtWhkghTx8Ydo/BBWpaBeT+NvaQQpCALfkcwbBDIepHa+DsPBrBNNiDEe1JXghH3v0K+zdNeXyxBQlOQiKjRHcs387dnWhuZWYk3Bq/JkXUnZEKg7ntnvK8cfd5FQZ9P928jY8Ha8= X-MS-TrafficTypeDiagnostic: AM5PR0501MB2036: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM5PR0501MB2036; 20:CTPYkXEKncZ11jYa9pcNJcr1oduqeGzj1nGYmWH6dT8+NDmHRP+iXh2tMC3NqIIfZRZ5vc3OzSgv8HEbu7J0ocm2a7cREtVNRGNVS6dZbInvV49CUSbtOE1/xUhLyOSk6KYCIIcluqRy4OUw+wfWvv9eDOaSjwvrmO/XeRsJZ9kOJzqYIj7hTCYTxSXAsi9dgizc4Qn/OeAd9yS1fnkeYl7ZXodOD70zlRAKI90SUTByH82FCP4xOAV75RPTpJpMhg3JrkrfcsqcFavPLUzACz6+vJqJCsWAqFqwCEMrypXvLxFV+Vr0vlim9Hz6iGcBxDAjXSZ+cWOr7wphPorTz2gl0M4/ldZYsL245DeuWCcxq9TMre3gA8lgNnOwYszsynWcXK+zkeahdxWh+A6+oVXmy2Yg4Eo3+joiw8m5nYMsJABmovWp9ukJads6zRM/fxY1pJorltU1lV4tBD/WUFBSMvuEEH27VLLfkiWrnPozn5U2aeYDcUD3VLlLVV90; 4:2twVmH/d2Hmvd+ZwJtpfd7S50FhMxi/mYagui2s/M2Pbtr3x35kFW54vFAsI3T3ofc5huLjTH61aZwlLNk0lZdiES8OWQ/Jt7NRrDUgz03Mbolwe6AZ5wmxOc7HY+njHowBDrSybDyidzjSJM8iNcbd28ZWjebmDZTQe/NhO63hdeJXTGlt67QHhpmG0MihNiOEVGZvgwY38jtUvZgCdc64loPh05C0x55MrRtLfPMe1FSape+BdwsWJkqiugyhGBmUB75CWLqZLSWsMhvCVyw== 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)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:AM5PR0501MB2036; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0501MB2036; X-Forefront-PRVS: 0630013541 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(366004)(396003)(346002)(376002)(189003)(199004)(25786009)(106356001)(7696005)(81166006)(956004)(5660300001)(76176011)(16526019)(26005)(8936002)(186003)(51416003)(478600001)(47776003)(69596002)(66066001)(50466002)(105586002)(476003)(316002)(486005)(446003)(6346003)(21086003)(81156014)(52116002)(8676002)(16586007)(86362001)(2616005)(50226002)(68736007)(386003)(59450400001)(11346002)(486005)(107886003)(3846002)(1076002)(2906002)(6116002)(55016002)(36756003)(7736002)(53936002)(4326008)(48376002)(97736004)(305945005)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0501MB2036; H:mellanox.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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; AM5PR0501MB2036; 23:QAJtbeYV49j0rz8ZLqYzciz3Wt6PfHVuBnZPnv/?= =?us-ascii?Q?5E196yuyYXceczW3V84JdCVk9SATydFHUDAwPY+za/Wvz/+zE8mw/Hlxl1ky?= =?us-ascii?Q?peykctnk5C5mKG91Qmm109uCa/OSZprxZ77P/RtLCA+v7f+b7lxAxfY41j/b?= =?us-ascii?Q?EBQq/lq9gNHxph2EfJAWPxNF3vN+yn4lZ87AUZCMx6Cy3WnLkgVuESD1teIO?= =?us-ascii?Q?8Ad+vQ2SJ5PQcaF/F7dRqg2x8MSHHUWatoRbk09430GSB1Y7sPTB/XY/iGr6?= =?us-ascii?Q?wUqTbszsfk139/PWXMJNhsuzwG5OOj2dIm1QyhZXul8Yvdn4uWM5Teo48L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GXa3QyNLQnRpD4srfxGI9bEzfOQi7qFkXRgwRxENQKx0++o/4e8lkM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0501MB2036; 7:uHVNMJIE3SHyZsKHVNmqfxMa5wFxvC1edwSg6hzT85+BiAfh4WNn4Y9vdm9lDdg1Fs05WYDbaoT12yf2/YkW1pp77/qUEiiF0eyesH9pLMeH2YASFJ9frRnD9YRqvbscJmF+V87yr+ivh3Fwd88IgLx8MnPKFcBcspDOnLS709cXELoRg3CrN7fZbm5qKGKFiIM9MinJLXZtQeuBY123iWY2GoH7QZQ5BHdCP5pyWza+529H3Fc5BVFgU5f0N/6i X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2018 18:50:30.4630 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f7016b2d-c0a1-4e26-94ff-08d598ca9c82 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0501MB2036 Subject: [dpdk-dev] [PATCH v2 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: Mon, 02 Apr 2018 18:50:33 -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 d1292aa27..461d7bdf6 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. */ }; @@ -1761,6 +1765,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 @@ -1836,40 +1886,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