From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0073.outbound.protection.outlook.com [104.47.40.73]) by dpdk.org (Postfix) with ESMTP id 18F1C6A6E for ; Fri, 17 Mar 2017 14:09:51 +0100 (CET) Received: from DM5PR03CA0031.namprd03.prod.outlook.com (10.174.189.148) by CY1PR0301MB1964.namprd03.prod.outlook.com (10.164.1.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.961.17; Fri, 17 Mar 2017 13:09:49 +0000 Received: from BL2FFO11FD006.protection.gbl (2a01:111:f400:7c09::189) by DM5PR03CA0031.outlook.office365.com (2603:10b6:4:3b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.977.11 via Frontend Transport; Fri, 17 Mar 2017 13:09:49 +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 BL2FFO11FD006.mail.protection.outlook.com (10.173.161.2) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.961.10 via Frontend Transport; Fri, 17 Mar 2017 13:09:48 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v2HD8pee021077; Fri, 17 Mar 2017 06:09:45 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 17 Mar 2017 18:38:40 +0530 Message-ID: <1489756124-10805-19-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1489756124-10805-1-git-send-email-hemant.agrawal@nxp.com> References: <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> <1489756124-10805-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131342297885259208; (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)(39400400002)(39850400002)(39410400002)(39380400002)(39450400003)(39840400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(2906002)(110136004)(38730400002)(8656002)(50986999)(54906002)(104016004)(76176999)(81156014)(4326008)(50226002)(8936002)(8676002)(81166006)(33646002)(105606002)(5890100001)(5003940100001)(50466002)(106466001)(48376002)(77096006)(85426001)(2351001)(5660300001)(189998001)(86362001)(2950100002)(36756003)(356003)(305945005)(47776003)(6916009)(6666003)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1964; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD006; 1:1UWcP4SjfoYBpdEg/IU61qLk0HOPlfrXy1GBnbYyN42PuPtYFU24Ca6ZXmiyghWvHRjb1cP4IKYYd47q54OsEiytfyOjpocVAfncio+DGSR7tp4bauyCj3aibKcX8ZpwYXeRWf1IljoIFBqUVpVgCF/+Y1pnckna/u53wxGSrFonzFeSFsGnsJKrnRzFrO5w5qSEHXQC/mtXMpi4Wxk1/6E47P3H/WDJ/8i4x9jFIwvRNprkNxAKv1pJf03zO7bCr1a6RSUJJwpED7cvBlG65VTXnd3SP5SV08mMO2XpnAQhBVbc5XrPWQPdu/WOBQSy2ynPku25dbukqmTvE+ax6dyyo5hWEpFd5MyRFSfaDeQQqZES5duVFgBRuifIulH43hOi7Sh3PHI1hfCblFFTykydY13I1vFFkgQrRmVH/v4bnSBKDB2CeE7RRMYoxduteWL2UwYrOJyyOGJ5VL+JdT/J+J5Oot0lxTgEvijya2MBCKKsL+3A7HaXH7ge7030ABrdFdcY1DcOyj2wUj15G/4aFQRU9Sqt8EtqstzET04aLrt7k883K6XMHHIAYaNKI40brtUEcTSdRD3yswWrrS422wWOuuC6S9k5JHr8iUjesk4SHFWJoqHRA0yRsc7nRfom8XC7FN4ufKPeUhl73w== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: af952e94-1abe-4667-c968-08d46d36e3d0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR0301MB1964; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1964; 3:HLbHz6u2kcsRqYmKuw9h5QElhmwaePUrjMrCEFAqSKJ+BpXHuG5kMZ3OgyfCFmXClwXgybIHvUIJCKNtYVZmrjorj5t7RRaUFHvtjgRxRFiC3zI8eFui5G/p0QGhrU9HKSY7/gfU6E3e+/KEQz/2cMtrQjkImf7PH3dWOY0wEwDzrDDrIw1BQ6wva319d+TldSm4Err+TXh2N86OX4PcLHA/rl6YOEV/BqUxhmDpcBZvLqx2xMQ63+AtZ2L5iuQ+OGlO9kI2W45TYbSq8BPOYyq7o0Z0dsJur2dNQ2BKz8aFg6XDl0oZKKzfHpxDiIBbqCpqCxxvLYbDogwyUqQ2FdpfQwxfS+x2Xmo2Yf2Ie15Yy3gft//xwmSDVSsoql2y; 25:It4ZsBkjzqXTo/Z08rnBaFj/EG9nlsjNTu1ht+DuqzrifEs6z4PnsLvidl8Vmu0byTJKeHWyi4I57yiZC+cuvgfD3bj9Yehjod4/ndhz1hnykYDBAmTKD54N8zN/iHoCYy4JsydnLUAkmuF4JdfeO+lu7xQ/Pg1z7nTy6alIRlEZI4tC/L1FCaKwQsa8nYCLQtEnu97qwSX7A5x3By+W38SpzcivaTPsrTcAp3DI+ynixXrsx0nj9Ib+U6362Yk2a/9rUi7lCE9ysVnMCOvkVnDZLhMtmOoELeF/HRvS6XortnVNpOA/FpfYhn84J+6hRXP9gLvVdQMnH+Yu3i7EhdQHNAXoYVuXoqrzG+7kSK7wfTzhxlfiLr5+6WExtAl6xq1cPxojZ0MsjhOI2g1JwhL8fWb6BTSk0/oOkpoPbXZ2Tai4ywRQES1jmDEB8BKTjry+B+abWaUSFqDXr8eWEg== X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1964; 31:6jbCJJ4Kc2oB7PjTAdtGlK2nRGx0QgVVpllFcG/pGNv6Uh/x3ESDgKHGqk832/xMb9MTKMHONT56w7UObP+f5PcnHD6XVe36DhgFV4axdXhRtVbmzlEUlAIy4yTI5qyrWOzTNSvKpBD70oNBz3J21pClUkTdZjGJvpgnIZ1/PHvFZGkQ29ODxOYH6CppDvQQ+DH+XKcNoKarVZuS7h4PEumNhtdZiOUY8FUMLsMI9Wevwbxe2ZYQnGfN5mcfJJLNbX9Nkf9HD8bRVVrn7BcW5evPJZtHxUWGb26gXV2y8jo= 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)(8121501046)(5005006)(13015025)(13017025)(13024025)(13018025)(13023025)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123563025)(20161123559025)(20161123556025)(20161123565025); SRVR:CY1PR0301MB1964; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB1964; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1964; 4:BNnQiIRi4as8sInBUQ6Gf1lGDKGZ8WdIAAm8/YTjJfSSqGjrTEB4O7O/Xfg5A5Sf548VzHpfz3HbMsVsySqYPInR67hKcVJcA08/JUMa4L5D7CzhY4ijpWql+fYgOMKJAZrU+pJoGd4D/i5UgTY4t3D3CKAYwBJAW//CtF+zBDNUkF7LE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gdYnsbb+M3Zuv3uk+enbD5zcNi09?= =?us-ascii?Q?UJt1yTL3ifLdjZFsA4kPIys0y7IiLrUbVs9Dffrz1?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1964; 6:u05ssFMh/uSqhBEikGqdwEA2oMc+G8NMWoyjnRDy0HXmmyFu84lY9wsUQ5aedVZkL39vei5VczdF0MbMEdu4yCUloCWTu3PglfE+TGKeSu7/EbXdOpQfkKv3vllyBgring/9OqxwbQDV8LpBzy2tCHZeAU8Hx+/V/qDG9wM3aIXJEBDvXR6KgTkJSJmxxa21v3I9GCI/d8/U/c4elSPgie8+FT1Drhnupbzls7ZqygfmXsQea9hREhrWBTgWHk56RwpVh/4QRMVJWZO3dHYyDRx8ogW3uaLBxRy5RYMgR9clxJ1IR3fJ/7Hh9VsbExeItXMKO8I1ZrI//xfpIU2QtMutv+sZ6zBGvNQgrgWpQYU6EoEuJHekKYt2HWXrU2IHamFpuNUVpoaSSnQP8R4MvrAwgJgLBiUuPn3/WKLDBtA=; 5:PeaMQHhZdFzNP1uhSkBFJTh8rdbCi/ro7CPkQf9mDARxyvCplH3ze5hNbCpG/FEaObzdas5Fwny6uLHGvJgIkUPFV6nwH4uFyljT+auABWN6CRS7I5GW/eZkzLfCe91aF7+SAeoRaydXvKU4VnppV454tk1OTfGlbGn/Ek2jhLovVAT8LU7uo3dyhkvwxgdl; 24:rSZcsY1GdexFdCxJcV9K63keeeaXzZflo7sKNSpiYmMf/y0bXkLR1uZmOa7sDxCghbYZnsyvr7ijin9xTpDPn8YkuAqOR7rdt1RHLKniVIU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1964; 7:7S3FYjIZCcJfvQQS+eLOBPn+WP8NA472bhShP7vGyzjYV60yPNbyXYGOKpA44bczD9sovrfmg3o2TB1PSQdUow/TM9kcQDzm2A5cNHCTDoCWpHymW05zNAhAw1fItLNgLwYoz50BqgP08EBT99JlgC1roAq97G+SaBoPk2/s6sLVG+drSZqbyH0Cxg423M+nAcSTtvGr7DIFcAO47FxTLjyNYYQWogBXKCJJ/VOsD3rsA4zSyj3az8vv30ksEm1PGMu8Tj9fh2mA9yRwPcP7704fP23puhyDFp10nvob+KKciSxpBUE1g3uzbZF7oPV3ndVqtDuNe4FuJQtNz2uVSw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2017 13:09:48.2139 (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: CY1PR0301MB1964 Subject: [dpdk-dev] [PATCH v9 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: Fri, 17 Mar 2017 13:09:51 -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..a94761c 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->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), + 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 && !(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 +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