From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0043.outbound.protection.outlook.com [104.47.34.43]) by dpdk.org (Postfix) with ESMTP id 35E6FFB0A for ; Mon, 19 Dec 2016 16:22:21 +0100 (CET) Received: from BN3PR0301CA0009.namprd03.prod.outlook.com (10.160.180.147) by DM5PR03MB2475.namprd03.prod.outlook.com (10.168.233.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.14; Mon, 19 Dec 2016 15:22:19 +0000 Received: from BL2FFO11FD035.protection.gbl (2a01:111:f400:7c09::165) by BN3PR0301CA0009.outlook.office365.com (2a01:111:e400:4000::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.14 via Frontend Transport; Mon, 19 Dec 2016 15:22:19 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BL2FFO11FD035.mail.protection.outlook.com (10.173.161.131) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.789.10 via Frontend Transport; Mon, 19 Dec 2016 15:22:19 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBJFKMhu029110; Mon, 19 Dec 2016 08:22:15 -0700 From: Hemant Agrawal To: CC: , , , , , , Hemant Agrawal Date: Tue, 20 Dec 2016 02:24:10 +0530 Message-ID: <1482180853-18823-32-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1482180853-18823-1-git-send-email-hemant.agrawal@nxp.com> References: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> <1482180853-18823-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131266345397204673; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7916002)(39840400002)(39450400003)(39400400002)(39850400002)(39860400002)(39380400002)(39410400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(4326007)(36756003)(2351001)(105606002)(5003940100001)(6666003)(92566002)(97736004)(85426001)(76176999)(33646002)(2906002)(50466002)(50986999)(104016004)(68736007)(5660300001)(110136003)(38730400001)(48376002)(189998001)(106466001)(8666005)(626004)(47776003)(356003)(77096006)(50226002)(305945005)(5890100001)(81156014)(81166006)(8936002)(6916009)(69596002)(2950100002)(86362001)(8676002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2475; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD035; 1:+i7U/ZPkMi9EbRIS8ZfpqHZygySADaRiWUcjKaEGr9lZBKb8AFIUc9N9cdR0ZBw86wy9nU+yyiSlLlIj8UxZuE3tCTG9gyOUhqvsrKY84paqPazwfloRJDT0rMknXS9Xl9kOBRLfNOrsY2C7Zdq1R41u+4x3R1ytzQWXITwnCPx4yFNPcnT4ipp0c6+5rE346r9oIVhqqzhMI7J3Wd+9GIA8UlqOq/YbWDVTsN4jayWQUUzaRCTJtJzzop9jmIwb8tN3nTfD7pE5iJX5fJhP1IKtFVnLuqPUmPUZ/Qu86IFGoixhkUgpnW9UOzVa6wqFEiGV8xiHKCGkrj6k+Tt9bqYJoUVq+cP0atgg+xtU4ITlXwo2n2pjNqe+zrqHh3+EkgoGQnlQXPRV+mgemxbSYyPgp0Y7ooTQ5IfqeqfemrMV39Fivyd8gG6pi3YjPucUAgOqGbmoZjV3kVdqzF+qSM1WXyxJrrfHAcUrqhEPHdk5GmTQRCbOS6ziQmqKtQWpzgVj3wdIM86Bwzt2Dr38lme6lXp38Wj2ZyMtBH2aubkV2X37fL8I6HTc4rxXHrCs5Xe0Fw/7W7p8Xbg7N5EfOeODE8AGXpHNlL3nrjfa148DUe3QlM+94aU3uQVUooEMbA7DbeF2QA6pxRoecN/0Hir7mssca/wt8IXipepX+A0Q/+kFv6hvRYGg/2nbWMNiYYCiIIv7mvRuAdoCZU57iAuhhqZ+Wr3G+Vp0ulQXGb9zbPHa0c0G2Ntj7L56ToSaX0TvFWRHJ/cjM3uCypTlvQ== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 093e24de-67f5-48f3-d560-08d42822d2d1 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DM5PR03MB2475; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2475; 3:8imM4x+7cbZQ06RBNHIFPd/iAI/j2YDlkzfvT7y1/GDu1X+QNZwbGbi0d1kbD6GPhzxMBScvnQM0FXp/JjCG3lD2SYRQfBWcfUuAq8ite3jyWt4DGZDjh9UkUGNm7gabtEGwpxKVeYEPrHRSgRaZCxVWPHo/GemEe3gZDbKBJemXWGw4aVwFsB69dmu1VTVK+DpzhBsaToaTmTf08dAKuuh8EEIR04QMmHvf0Ng3LWjZRmJ0xixU4vdqRAYO2mLYLWBITMM4505VeIL5eQohSsQssk+0o2ICqo1mi8EGbyHu8FtGudZifsECMnYk2lQ3tACYiZa4xJaHtPEVpe7/IPh6G0JPHFO0RhUXRhybWZmprXMlNw8gEhjL1+3yqA2q; 25:DTzD1/A4t0DsLscFZ4XWVd1c6iAXgQBKwmnYoKQdp0H6vGNeLkGV8+sJI73EgLk0Z00g3pagrQFenAlE8Jto2o1KOzgEdFbLeA8dGD7cgyse6vQ98OV4XIUmms0kKwpDkraUSbSya8hiem2nJqtmUgqZxSkx3LmjdrYRkxRkej0BI+1JC2D1AdIA1qLEJb6mjePMGM7yABV+sKGC1zvl4BnWgixAxfEZOwnR0T8BUzXoe8cKGQCq7TputRrjA0tZdgPBBvvQltcfr6g/enuGt9h1PrI6MCevxIA3lwTyCyrGE0bpHanicUSTTIup7x0OH8QN4s+4aO080Ta8EDn1+3ZG25tDgRFoowm+ok1W6PX6cjKNDMKoTdFHxCo97sS10idWx/mEJqdA8Invo1lRAaoxHySa6cY24ZUm7I0CH6R8546kxL+TtKdGunotOGeTx2Wph7NEpyYIqEO41NQcZg== X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2475; 31:FXY20vTmiztnhds0rqQKzVTXdo3Kd8YNqu22RPRcBlDt9T6TOTWMm8Z8TRIrs3bJ1JlssI3oeuJbTlLbf3DDeYdvQs0wi769jMjX6alC/775JPmIyLOB/Nzn3efZZ/uayCj2uT+CNU25zbW+GJYdv0IGCg8wfw8wyrTz98sH8W49KjcEud1hA40mRKv3nx/BWcm6iv1ZAy3M3Lh3kWD/2n7D/aehDK1GXfE9faFwBI7lIO7OfpoyAxmEhqtnnXcvbioKfiwFHm1SFpIY3KR1r2fRfIFlbP0zmys8gTsoafDFBKw8EnQESXngw6DP5wKI X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(5005006)(8121501046)(13023025)(13024025)(13015025)(13017025)(13018025)(10201501046)(3002001)(6055026)(6096035)(20161123559025)(20161123561025)(20161123565025)(20161123563025)(20161123556025); SRVR:DM5PR03MB2475; BCL:0; PCL:0; RULEID:(400006); SRVR:DM5PR03MB2475; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2475; 4:TuUUIVXG/ZJ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lgYw69My97d2WJc?= =?us-ascii?Q?Qi51XA48NMuJbWWi7jVIzuZflL90+jTHKiy4UFjKAHM7RmiF3OeGZZZdLkcN?= =?us-ascii?Q?U9plweRIXbLQpA2hzWqlUKIM4NV6feZludq74sphsKLDO56/prscGxDtSHGn?= =?us-ascii?Q?yGaCmLmEO0AiEa3P8oLCfI5RThzrRTDV5LfPpAywIUXxZY92E3aAa6znCd2K?= =?us-ascii?Q?hAuLN1uRHT3sVw8HVw+JtVMuXRIhIiMLDwRfureBFhHUU1nOakTMKceyvsN6?= =?us-ascii?Q?AkB8qPgXXkmJFmy6JJKysvNUtRx0q0PyW6YkwDZcWulpb3XHbnzz8b7iQ5Mo?= =?us-ascii?Q?s9RUF0bLQ6dzoLuxMpJ8XfU114frVsfuR2gIp676MutBL9urEz6BHubYvufD?= =?us-ascii?Q?dBmtzFdbAsvw5oTX21EaI4ytiAcSjEUAggdmFwGQ20X6mADrOLgu5RgghHP5?= =?us-ascii?Q?PnF3t7WDpUFIVpnWlf0xeT6IN3WZ9RK50V6Qty+5xqJnWJVkgR0T9Jrz0GEh?= =?us-ascii?Q?n2f13eminWQ+yBJC1Aw26MPzceWgr75P4+jdv1KjkfWL1R6oBOCOflUYrx/s?= =?us-ascii?Q?mxhaZmjWBk25MRwELXJj3iRTxC3XkEVFK66O3FCpJAPetdln2X6X3q8kX0IS?= =?us-ascii?Q?CDmw5A6xQG4urxfzTz/fZOPW36dmGI5mMPtN2FrAejL2TtyJZkoYKLMGOOsC?= =?us-ascii?Q?e9fl0/3wzyoskmuPzufMA7T31p0JYBQO3i4+clsOnjmEknHEvmj0sB5EVgGl?= =?us-ascii?Q?XTMJa0pfo/OeCUn/hJ/CywW/1E4Oewrd4bSCcL8Lqnlux6AetRGHHgwlSded?= =?us-ascii?Q?5wBAQ+TBMzjjZzvOy7vnOq+PzbiNIpOql9hdXNZulGcQuH3UYdipLXWYX6wI?= =?us-ascii?Q?3f81P37AeBTynbI2YpWDoCgW4iYd1FQdrF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d7M+iLgZpGBI8HhmEAE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2475; 7:yxP6Y6T8LlZA3DSlXlCmoP2PhAhqiNPvFt6hywxUjUI6SPFZOte8NPeP/aVBe3+zb3RFuuDJ41h5WlIC59LXdbG0NcsJF6N5DJkYXHE/hbDUcax5k1leeTCqkYc4lJAUT/pz5M9P5TeHUjMY0hz3jgpnIxZgXvEcu1Aic4Oo+KvbEB9gLcQKxrP0C7RuD1g2/rbuON5rLWQAf+Gvy4AHTYE9+WsAgJEygTGK92hiWOPi0La8tMnBO23zwaAW6tMCTRMHGSESO+rFIkPRCmBQNgcYxZ4CAWkOuurq7yhyKfRZhyqS8tVEWTE3VWFrFckUid/7bb5jaLR3r+N14eOjC1nbiapZNytJ7HA3jaTTL8kI6TN03LqIDvGZHquBkKyGRlHJTkvibHaENhyKu8WGSh9LCSUPOyRqc4haGwME4R6mcjYNilzBzUFptundXwQY+K5fgE8+awA6oI/et4Ei4g== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2016 15:22:19.4552 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2475 Subject: [dpdk-dev] [PATCHv2 31/34] net/dpaa2: add support for non hw buffer pool packet transmit 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, 19 Dec 2016 15:22:21 -0000 Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_rxtx.c | 74 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 7d73bde..55068e5 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -191,6 +191,54 @@ static void __attribute__ ((noinline)) __attribute__((hot)) DPAA2_GET_FD_BPID(fd), DPAA2_GET_FD_LEN(fd)); } + +static inline int __attribute__((hot)) +eth_copy_mbuf_to_fd(struct rte_mbuf *mbuf, + struct qbman_fd *fd, uint16_t bpid) +{ + struct rte_mbuf *m; + void *mb = NULL; + + if (hw_mbuf_alloc_bulk(bpid_info[bpid].bp_list->buf_pool.mp, &mb, 1)) { + PMD_TX_LOG(WARNING, "Unable to allocated DPAA2 buffer"); + rte_pktmbuf_free(mbuf); + return -1; + } + m = (struct rte_mbuf *)mb; + memcpy((char *)m->buf_addr + mbuf->data_off, + (void *)((char *)mbuf->buf_addr + mbuf->data_off), + mbuf->pkt_len); + + /* Copy required fields */ + m->data_off = mbuf->data_off; + m->ol_flags = mbuf->ol_flags; + m->packet_type = mbuf->packet_type; + m->tx_offload = mbuf->tx_offload; + + /*Resetting the buffer pool id and offset field*/ + fd->simple.bpid_offset = 0; + + DPAA2_SET_FD_ADDR(fd, (m->buf_addr)); + DPAA2_SET_FD_LEN(fd, mbuf->data_len); + DPAA2_SET_FD_BPID(fd, bpid); + DPAA2_SET_FD_OFFSET(fd, mbuf->data_off); + DPAA2_SET_FD_ASAL(fd, DPAA2_ASAL_VAL); + + PMD_TX_LOG(DEBUG, " mbuf %p BMAN buf addr %p", + (void *)mbuf, mbuf->buf_addr); + + PMD_TX_LOG(DEBUG, " fdaddr =%lx bpid =%d meta =%d off =%d, len =%d", + DPAA2_GET_FD_ADDR(fd), + DPAA2_GET_FD_BPID(fd), + bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size, + DPAA2_GET_FD_OFFSET(fd), + DPAA2_GET_FD_LEN(fd)); + /*free the original packet */ + rte_pktmbuf_free(mbuf); + + return 0; +} + uint16_t dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) { @@ -331,8 +379,29 @@ static void __attribute__ ((noinline)) __attribute__((hot)) DPAA2_RESET_FD_CTRL((&fd_arr[loop])); DPAA2_SET_FD_FLC((&fd_arr[loop]), NULL); mp = (*bufs)->pool; - bpid = mempool_to_bpid(mp); - eth_mbuf_to_fd(*bufs, &fd_arr[loop], bpid); + /* Not a hw_pkt pool allocated frame */ + if (mp && !(mp->flags & MEMPOOL_F_HW_PKT_POOL)) { + PMD_TX_LOG(ERR, "non hw offload bufffer "); + /* alloc should be from the default buffer pool + * attached to this interface + */ + if (priv->bp_list) { + bpid = priv->bp_list->buf_pool.bpid; + } else { + PMD_TX_LOG(ERR, "errr: why no bpool" + " attached"); + num_tx = 0; + goto skip_tx; + } + if (eth_copy_mbuf_to_fd(*bufs, + &fd_arr[loop], bpid)) { + bufs++; + continue; + } + } else { + bpid = mempool_to_bpid(mp); + eth_mbuf_to_fd(*bufs, &fd_arr[loop], bpid); + } bufs++; } loop = 0; @@ -345,5 +414,6 @@ static void __attribute__ ((noinline)) __attribute__((hot)) dpaa2_q->tx_pkts += frames_to_send; nb_pkts -= frames_to_send; } +skip_tx: return num_tx; } -- 1.9.1