From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0069.outbound.protection.outlook.com [104.47.37.69]) by dpdk.org (Postfix) with ESMTP id D94E39E3 for ; Fri, 31 Mar 2017 15:37:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=fYni7939HasmtPuR+oD+CUOanOigmn8B6/tx7Dx46Vs=; b=CWjjSwSBAaPWY09wympIxeZqzrVzMJJP/004GTre5bRPBwDXvcjoixKL/3yS0GJYw+aEFPKCB2pS1UtoGQzZFArz9gCDAr0frlC+pDVKpamPuxoWXgflZQr4UEACXRHTUapk0oy2YaYSDlJHAX9QHEaPBR4lPFAjdJn8QQ74g4A= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from b.semihalf.local (31.172.191.173) by BLUPR0701MB1027.namprd07.prod.outlook.com (10.160.35.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10; Fri, 31 Mar 2017 13:36:59 +0000 From: Andriy Berestovskyy To: Cristian Dumitrescu Cc: dev@dpdk.org Date: Fri, 31 Mar 2017 15:36:34 +0200 Message-Id: <1490967396-2240-3-git-send-email-Andriy.Berestovskyy@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490967396-2240-1-git-send-email-Andriy.Berestovskyy@caviumnetworks.com> References: <1490967396-2240-1-git-send-email-Andriy.Berestovskyy@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [31.172.191.173] X-ClientProxiedBy: VI1P195CA0004.EURP195.PROD.OUTLOOK.COM (10.175.187.14) To BLUPR0701MB1027.namprd07.prod.outlook.com (10.160.35.19) X-MS-Office365-Filtering-Correlation-Id: cff0379c-89bd-4c6f-4999-08d4783b01fe X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BLUPR0701MB1027; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1027; 3:LDc9ywJ4LzfVBYX0hwN4mM9TpXqWQmeWjXVlokBfHll+YRenJGhj5MhH27ZCjdSgs26SQXFzfX1xfh5DVHanC4kfjWBmTWy/qcilv7v6vusFVGViUEttzRxDcoUPdB3NtIn6cVoXYar6tS0CDGqtAkKOopGMcqKVgjmAn2AYd2MbvVww9v4mCWSn8xqQ3IOgevMi1aDYsl1tYt6gDiFg09HEisJTYoiJPUS18/JZKgoxEWRhNezzeP2KxxV9AgaiBwbH6LYAdE0Q7RgdEfoTdwjVQXsD5LjPmS6PENbcjQjNerYeTgXoCpYC7HTTkeCfXQGTeYmDA1+mIVh4FqSn1w==; 25:OToFZXRk1v5bP/3AWjo/J8hHvYLga53fII1Z1dRMK22Va80MXd1wKAu3uIL2i8yyVIkhw2szMbYvavaJZ05Op4fLaGch8m8AGZapqCfEeYaAjeI2XEJoNZVW+Y+3S/OMdRtAfbAAStWIMmm0F6yMEpd1tJTadA/KiRULcfA3QLVCZupK3U2BLfSNugspD3o2cVVG8v2HeaMTaEi8T/LekHpkQp9RcbKWWiIpIr9mgzuNAcnJ6cmcySOXH6noZcYqApsN3MllY4fXv8DlnfjpnI959qfbls1yDdbz/QIycv0BJVL7DiNwCo+H4VzK9kzdNdkzzQJGMz52U+9ydx0QMwtYdd8LCVrnm56pVjp1r/j3o/JdGP0HR+BY6AEsnbRKu+9UWuLNdTZkCnkapvIj2EaqIlCsXj6qeHVvLz44x9SWL6fO6PMGOd9J+uh4p07kjn0Ltjx4q9IVg6haHw/ZlA== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1027; 31:CSTb87T6vreazmS71g9DS+I4F9MVxndRs/gN6//Hoe56NJRxTmc0JPYsMxqwqIIel8zHU9dxfln/Eqz3mbXf6nokVKB7V+j4ZAkr3Jf7+J6uPS54ry2jko24D+zcnoQOSOC7XqdWT4wjNgYIC/LFxpvD9n62WF5ywxa3YpPuqMUYgXaXmz9fPB/1ln2GRXnnnDFEySkaOn8BL8aj2Sl0DyyByY/M+aNF0Wyj3vUoLvn+Ybt1Gb+EyriDNeeKXghNC7hdZvOP0REcIzVjnrSLeF8eJ+7/pb0E+7EHx0lxTeY=; 20:I4129D65HgxYuDRJE+ZFbH0SRjoh6xQNZgtm6ExY1UVPcUzAuBx7LfmDgXG1IIwHCAN0EzkHxndRTrHFsogfngzhFOKV6ZDQbCxp9jM8dOXTYwe1RKTYO3gdSLjgg3H56uB29G5oQLwMUU91gzEVYlVNOEX+OeVW4Pliygx4SDksyDPOG+Hx5v0ZW8Mn//FCwjdILbytFfvtfplkcY+MNybVOWZXYbi6k3q5i1orbcX4qZRL7N6DpTn0cR9Z2YDGbzvFa4LDydYzToIajFVNsiYOaQ4ltbxLYTTyloQkOYP9G5qJJDctqldYPmK+RIP+2pWs2b1QYJQ/42YItcoay8vSZO9OfMDPXkYu7e5qUv6Ii1Lb+49YquV79OVcAuyDzo9QGYtsNfigrWcwcPbHjSHknybwq6SUFBKAM4fGCrCDysl6xVMMIzcjAQRN7F2GVTGy2nb6egq9Xg07zJJqGGThYGajRhcj+2KiHqQP79pFOOkdKNy/bouInr5nM7csnsz60pZ20mH5+M4vJ1N3lfPz7WF63C1/amgg+aiOBCSOV3nSbyLiHxapSUV4taIjpe8kpgVpdvuPc82Vb3kS2WHxNzc1Ty743AunszsR1/E= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(6041248)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(20161123555025)(20161123560025)(6072148); SRVR:BLUPR0701MB1027; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1027; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1027; 4:me1RE/hHpN0iHKZjUPuhC/92btYYli/DBKKgGeq9ucrb4IaVywTVzPSERA/DwZKUA+ML7rGGR1G/PlCyxfw5Vplk22u3F/z7Qh3ok48hsXZxinjZghc+vWcvk1U0K9oEGxgRw5DY6iYOrulsw7hn9WQR6I6xnyJiusWVyxlwYE4169uTrlVcaGuLxlaETdnMRkThxxvYCdZyRRubGCQM9thgwcEtrsl0XG1diKpWaBC6HXlkgCMt41VkHMBtWVDkXzPYyBMqtcrM7H9bXdzykioNnEgJvBvAy+nUKTpP8BHAHEe9AZg08gQWraBA42GZv080btNEV9Qq4aDfwlhTMBtC1iLc8ffRO3b7YOP5nja4FJmUoeZ6BUAyGRfKNz4Snf+8fp/LvfM+r2xechb+BPaqjc9Aj2v6R7Y+qIJphqzp9oleqVf72xko2dPMHZ6X6MbTY4SK7grr28hvY5l90GVfUAcas6h5rL64kWkG0W64zFNg0xZxagkeRTrythL6Isa8LzP7apW6SmFIcbckKpvfRb463r/6IBSQST1YXR8NNX+btJtkKKy2R4O0BP5/OFcpG2Y4UZv/Jwh6UntMYeVPliOnoMrRi26pJ5E4WhhPx3qOu1Kx/RYeR6V7V7/i4kp0Kk/Gr+qlsQ4D+4hTPZS6Cx2RrtGFDTtgYEcUpBd6ZbY7k5XGcV4losR/cdvgvzaftZRWob3HobnCcs/g9g== X-Forefront-PRVS: 02638D901B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39410400002)(39840400002)(39850400002)(39450400003)(39400400002)(53936002)(76176999)(189998001)(50986999)(6512007)(66066001)(305945005)(7736002)(47776003)(6116002)(3846002)(6506006)(6486002)(2906002)(5003940100001)(8676002)(48376002)(5660300001)(81166006)(110136004)(38730400002)(50226002)(36756003)(4326008)(2950100002)(42882006)(42186005)(6916009)(6666003)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1027; H:b.semihalf.local; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1027; 23:o5TVxxM/W7f6sKEQlMbT02GtBMry6iFS4swPkVn?= =?us-ascii?Q?zeIGwMmOkbnCyXg0oL/QsjfJqTostT1asmkQWDgBmxX82sqYFHrfRKuwcKSl?= =?us-ascii?Q?kT6g+7FVM+Vwbg3/KrEuhgX/s64udwOQ3WvgaqW04/vSsfVc6t2IYHfhdId7?= =?us-ascii?Q?EV07wzvJVqsrw2ho3JEY+O1nn5AZL+WoH+/QocvqaL/Uyrk2W2uILBXaj0eD?= =?us-ascii?Q?vyoMccJDFcwo00TIDymsc1BcIpx1ZfyxcN7SIQQq90cq09j2ZYxYmyW6TW45?= =?us-ascii?Q?3asLll/lj9zx7aKEynd6siOdBJD0GiOFVn4vn+mtBt7zkiJ+fnDpB/HefQW5?= =?us-ascii?Q?3PwVYLtALqIaTDgRYjdWox9XtpUIbim7ITrr6GxF9Yu/v96EImfKmlgiLXHA?= =?us-ascii?Q?KxDCpc7xsyRlDmfLHJQkplRNfvdtrCnRZdYuokxlvGnffdq6unXFs6euoUb2?= =?us-ascii?Q?zQFhha3jY4R9qx4Vvnq4gpdEhFW+obmgQPd1ADSgKeuysqZtd/hBdRUnWGhQ?= =?us-ascii?Q?/S96oPCqWnZ6WFjQoPYJBK9S9zD9XYa4WBGXGfQ4Z1gPnupvg9Jrim4Ogp4D?= =?us-ascii?Q?YgOEhZdD2CJMP9ZmGwhq/46nd5umlOe7U5DtjlBfGEMyQ2natRYIf1PktbZV?= =?us-ascii?Q?nMlSxetxYRsc7cGcxo0gQxL6WcoEOMbb1OgDhWhjL+i+07YHMWlT13y3nbyB?= =?us-ascii?Q?EF44+P2jW2JFH8hNanHpWty5xOxfx8IaCIPiehT/luBKXaZSJmDEQpATxiCH?= =?us-ascii?Q?8UWNAEu5YLkGnrwEkM9OJ0k0UNtWhX2iSlWnIHXjKlfiVBnpmo6kjGxbXyWX?= =?us-ascii?Q?2XZkl9q61Yi3IcKmfcFo4yO74es1pBNmjWDr4PrvNPMQ9CX5P/Y+vIepRvSF?= =?us-ascii?Q?jlb4xKNMg1XQf9R4fvE8f+C71v4dMAbi613hZ6CPiGOhj1NIk40MmqGtydet?= =?us-ascii?Q?n20unM+M35kDKSt2Rz3zdvIQE9X/KB1EPQnvTAAW4HA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1027; 6:FxDIxvK6sghpO/jlLsnr3iK0XFWwukXAMQirwtzgEr0lcXjOLPXWh8vQ8a3vNvhtYuIfDhZ+D4bcQJOwCMzhK8t62kJb2WeSqa8p2OiN1qhGjk3fv9vxWBXQClxJWeYfLVpaFlf9HASX29dBUgae9kZ781gN/bEkxQH0108Ud91LOcC2ElutWzVavR5wo4xP08Z8YO0T6PeFsYTAJxsq2+7l3cyOT/+g9fFLikKliFq2/HoAqLNUI978Zp7wRgVYgOGnAAvs3+fm5qTidNRIWv81iRaNJmO069nvhr2wFqNl7xQ7+B/XeSBkV92Xn2cynb9Or1v60UW+y4wZcP9S0LeoR50nvAj7aSqGvWY6y6hfKJP3AYjenv1b7NusdzNoe1AaSWv4HFYy/9d05XSMPA==; 5:Ad6/ok3JGJGl+h/6/jtO0PzxHbe0ieG2wWG7dhWiSgRCf5v131cHyPlTw2InYbOzx09lfZTu8iqMM/YguBSoYbYF1jPwJkvEeGOWcnmwq1wcZVsOIB7/NtW/dWI1yuq+JEgqSN7S889sJAldeXgMksgHHSb4APpmIBzkH+oKKN4=; 24:ug9LRVRo63OqAHr7RF51Nbc00aEfaRsisqS+OpJdFa4cv2rlkcIwEs9bvLudlbbM0jvOnzSEZmyfF5z0KZMkj6bLyO0pd1aNcMfe1Lb+QQM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1027; 7:GA6yLu9o0PLflxc9uKKwlIVYXKVV+toBOX3x0i7q7KhwePrUA965U+RdQpYRA20Zlf5eMIxUJEeGP9lwX25yruPHC5OPGJgDprXowod3ehuZtfQ4l8KllbpmVOVMkZowG22lJniUdjMcA7c9OC7w3AxhCqOwQ78tuDW9w17VCiLrDKMOWgFJNL198n3hJfBInhhLS4soo9ORpungymfH9kyYGxN2ZBacDYZyGppoN/Rx/uspyFB8KLkOATiYKQcg+KLB3mwoGfM14N1nJsmj7NZBC7mFMEgYaGfYb+gIH+CihD3ml8DjsFVvFBElyEdND7AniilBF1lUakv8JD7XxQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2017 13:36:59.3240 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1027 Subject: [dpdk-dev] [PATCH 3/5] port: use mbuf alloc bulk instead of mempool 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: Fri, 31 Mar 2017 13:37:01 -0000 Makes code a bit cleaner and type-aware. Signed-off-by: Andriy Berestovskyy --- lib/librte_port/rte_port_fd.c | 7 +------ lib/librte_port/rte_port_source_sink.c | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/librte_port/rte_port_fd.c b/lib/librte_port/rte_port_fd.c index 0d640f3..03e69f5 100644 --- a/lib/librte_port/rte_port_fd.c +++ b/lib/librte_port/rte_port_fd.c @@ -110,15 +110,10 @@ rte_port_fd_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts) struct rte_port_fd_reader *p = (struct rte_port_fd_reader *) port; uint32_t i; - if (rte_mempool_get_bulk(p->mempool, (void **) pkts, n_pkts) != 0) + if (rte_pktmbuf_alloc_bulk(p->mempool, pkts, n_pkts) != 0) return 0; for (i = 0; i < n_pkts; i++) { - rte_mbuf_refcnt_set(pkts[i], 1); - rte_pktmbuf_reset(pkts[i]); - } - - for (i = 0; i < n_pkts; i++) { struct rte_mbuf *pkt = pkts[i]; void *pkt_data = rte_pktmbuf_mtod(pkt, void *); ssize_t n_bytes; diff --git a/lib/librte_port/rte_port_source_sink.c b/lib/librte_port/rte_port_source_sink.c index 4cad710..796418a 100644 --- a/lib/librte_port/rte_port_source_sink.c +++ b/lib/librte_port/rte_port_source_sink.c @@ -289,14 +289,9 @@ rte_port_source_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts) struct rte_port_source *p = (struct rte_port_source *) port; uint32_t i; - if (rte_mempool_get_bulk(p->mempool, (void **) pkts, n_pkts) != 0) + if (rte_pktmbuf_alloc_bulk(p->mempool, pkts, n_pkts) != 0) return 0; - for (i = 0; i < n_pkts; i++) { - rte_mbuf_refcnt_set(pkts[i], 1); - rte_pktmbuf_reset(pkts[i]); - } - if (p->pkt_buff != NULL) { for (i = 0; i < n_pkts; i++) { uint8_t *pkt_data = rte_pktmbuf_mtod(pkts[i], -- 2.7.4