From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0057.outbound.protection.outlook.com [104.47.32.57]) by dpdk.org (Postfix) with ESMTP id D769AD40A for ; Tue, 11 Apr 2017 15:50:48 +0200 (CEST) Received: from BN3PR0301CA0030.namprd03.prod.outlook.com (10.160.180.168) by CO2PR03MB2279.namprd03.prod.outlook.com (10.166.92.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.17; Tue, 11 Apr 2017 13:50:47 +0000 Received: from BN1BFFO11FD012.protection.gbl (2a01:111:f400:7c10::1:184) by BN3PR0301CA0030.outlook.office365.com (2a01:111:e400:4000::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.17 via Frontend Transport; Tue, 11 Apr 2017 13:50:47 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; caviumnetworks.com; dkim=none (message not signed) header.d=none; caviumnetworks.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD012.mail.protection.outlook.com (10.58.144.75) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1019.14 via Frontend Transport; Tue, 11 Apr 2017 13:50:46 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v3BDnjG7000706; Tue, 11 Apr 2017 06:50:43 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Tue, 11 Apr 2017 19:19:34 +0530 Message-ID: <1491918578-4902-19-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491918578-4902-1-git-send-email-hemant.agrawal@nxp.com> References: <1491725483-6619-1-git-send-email-hemant.agrawal@nxp.com> <1491918578-4902-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131363922468173920; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39410400002)(39850400002)(39380400002)(39400400002)(39840400002)(39450400003)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(97736004)(6666003)(105606002)(106466001)(85426001)(305945005)(5003940100001)(189998001)(38730400002)(110136004)(8936002)(54906002)(81166006)(8676002)(2351001)(356003)(53936002)(33646002)(2950100002)(6916009)(77096006)(86362001)(5890100001)(50226002)(48376002)(5660300001)(76176999)(50986999)(36756003)(104016004)(4326008)(8656002)(50466002)(2906002)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2279; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD012; 1:lE53aoS1yViElFRd53OPPJxxf6S/2GO2oU1cVoN8Ap3wN+aLxhvGGhMwV/WLuIHEKCYkVkQ/p6BE/Iza+8rU3bBf60o4r84AxeESBJAbBlA0GHD8UBzoLFmLhFpxxL3mJUJi5uMO8XyO4X87G1I3CPtTLhICfL8ZiXzftCnC7FA3iXqrUgJ/agF5/dhSUAxO+DdiCb8xWKEqiW0pDZEVA/jnI6wOHwzfXdAIuPvcAxCyCWuiiZnI2DBJWI7xuc0YT8R+sMLDPuidDo6vRFLZTgrstUICFGTwm51AxKkD7mfAkqHar9/0JfV4A3JCeH0OHXYgbJ8VNigXKXoq1IN6auUWez8lvhb2tfPNhoWiEFOqciba8U3f99MTmODkQ654E7xc6X3BdcEnU8YtN73OJSz43AriGrZ7j0tDyXBSoLGN/GdYuwSatJANL7AQxLlWGGjKDxFk7GEHNYyJ46GbvqcbHdZQYP4qPR+pqRGlBF9lNlXcQxJt9RHevlwPgAaLq+FpzS8y/jLXTlAXfxBheVxxNbxn2uYWgeiAXXzNsUVZsbWCH8+NpESdwEUL6IUd0ThyWHCxqXF0XCvzjn1xUMVaajuh9wBFi801koMavillHxwg+MxLurk3XmX5zPH+Nud5TKiCo5qdfMe1bm9mCgTbqd98vnT8h7UgkMIrfuI= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 9579468a-8d55-4aef-6d58-08d480e1c168 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030255120)(201703131430075)(201703131517081); SRVR:CO2PR03MB2279; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2279; 3:Kj2u+FdJeTFn2d7rmGndnZRY/XPE5IpNtfc2ZAmGx4E1Vd6Pjn6m0UGf0jqNfJZn0gBsHwbedTv4bzFnm1n6K+cisIZMIZMgtN8cymCl4OugUzuv7rrWTppSQ0taC3OBgXxXLqSgY/6sfDnb8unVtWBx+5pieZ2sss9n6Wdo8J/RnXxaisk/zmIJUxagh05dx0hQldSRqNYIZQxAZshdy9pRTuaexdhlKMJSYBqMBT6lo9iKupGPJjj5HkiuWJjbCkfZhsROjFcezQzmuOKj8DPMLUPcdcJr6fIU0Qqob/GZQ/10mODqN+/ruL3Js7F5p3mNQLSlUa7l5tll0cK9o4lJOEQGve6eLUIoDL4Ksp+DC+1HcQOp+qwVKr74sX/Ik6Ti5zn0KxiRxnFqDw971OQYG4xy9JLjmZkgrnPi0wEgQsJsgcanLqeG8XbUB50GfyaO+mmrt+ZfrdhoKIR6bw==; 25:GWJNaqo3g5theyXHCjs23HvbGgL6rpVbRLuhjyUzQQdIibNY6rrpT4mp2u7eGGfzRFlZiV4jG3KPs6Sl8ARtnD3OHei5BlTWfm1IZWwbiLYuFwJ4k6zvTZELTE3gAZ3VpklSm7HZEPzixVyCY3WQS/wTOMK6GrrvkY6mfIonXIjgNAEd780vVgMm4PexMei9EDECTtiXRDBv2xDrSIDHUjr7br4Cnx3p2WGQtSlxsqbk8Q/JJ5btNSrKEdFZTapyNBvrDyuj95DAIZQcSf76OQhs7fg4tumQkafIbBHoecPLqAyms4QXBLJ0lbZXsxyN2RcwjmwoxJQD/u8lqqrwG4/LKR/hMbLCGIxnyCw1joJth4+HLI+P+OMGg6UK2LgewceFTwFRIMZT7F7FG1PoFmrnBVOSECTfdyElvtODx/iiwOJooMRq3xSI5wo8DQaaU9tMCzQwUHQsq0MhI9TICQ== X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2279; 31:EJq3W+urGLpdO1rQTkeLmrsY48oGPjy383xbNgx9Wgzx/x6c6FMA4OP0In4TqTYT/Nov0Tw3vYO0iO+HyUJSP9zIZyrJWCykNIZO1sC+rQ4tL5fZbFIwQnM+Yi9/iAjHNMjCdzOPCAuCHGj3DS2scrodiyI/uFvaWLMIk3lqCetksAQsrwjtEch8ulRqP82ulMs+Fh/ucCznolcN6n6e5u/GWAdlisWVTf7WD7lXHqlBYzAR20CCLhclmBGAiTElrnhsOAEBZQnBnit1iqTxXw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(13015025)(8121501046)(5005006)(13017025)(13024025)(13023025)(13018025)(93006095)(93001095)(10201501046)(3002001)(6055026)(6096035)(20161123565025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259075)(20161123563025)(20161123561025)(20161123556025); SRVR:CO2PR03MB2279; BCL:0; PCL:0; RULEID:(400006); SRVR:CO2PR03MB2279; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2279; 4:2deyt/VxqOX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emW8l/J75OWGYvWLZ4FdJF1gXGenY0S03O2p2BVO/3s41UUk0ZfxgkWkZp+5YTxdbsG5oxQ; 24:9JZRN0iuHLlsmF53fSgdEfegsSibAD+V7ry02gPC22T+McJz2hT+qnC/EvFWP6Hq3vIpMvRSHWIVPGGv4X/aRgtiF+gj4IZuXHxi3Dt35j4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2279; 7:2esNLQfy7zE7hLXw17pCE0ocXPvpuN0topRbSE+z8F1+AZOGs18OZ6l0yednRDJ6JAxE/k2iMJ6Umo9dG7EhBY1R2vAf7Z8ouKLg2JJvyRkdn7FohNpczfNUjQoEYNHhv/Q0RvxsZEEvpcH8n1I8ugMC3m/Y9OW2Tz8R9xqxSEgJyL7OWq15aCRhekDroTOvDz5BEtQHjIpPuLMagYr9I5MMaj76DXtsB5cY9QYiuhgNgUQihccgSI3mZOQTzNG8Nis7kLcjuL2yiUqK1+bj872Y2XmJzNR/gt9MQFIZ/4Br/nIt424XVS6ZXS6/O2Z/0O+N+KZMnI55hTiS1JrSUA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2017 13:50:46.5209 (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.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR03MB2279 Subject: [dpdk-dev] [PATCH v12 18/22] net/dpaa2: handle non-hardware backed buffer pool 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: Tue, 11 Apr 2017 13:50:50 -0000 Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_rxtx.c | 75 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index c1ea33a..deec210 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -191,6 +191,55 @@ 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 (rte_dpaa2_mbuf_alloc_bulk( + rte_dpaa2_bpid_info[bpid].bp_list->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), + rte_dpaa2_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 +380,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->ops_index != priv->bp_list->dpaa2_ops_index) { + 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 +415,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