From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0062.outbound.protection.outlook.com [104.47.37.62]) by dpdk.org (Postfix) with ESMTP id 8478CFA85 for ; Wed, 15 Feb 2017 20:07:41 +0100 (CET) Received: from BN3PR0301CA0041.namprd03.prod.outlook.com (10.160.180.179) by BN6PR03MB2948.namprd03.prod.outlook.com (10.175.126.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Wed, 15 Feb 2017 19:07:40 +0000 Received: from BN1AFFO11FD034.protection.gbl (2a01:111:f400:7c10::191) by BN3PR0301CA0041.outlook.office365.com (2a01:111:e400:4000::51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16 via Frontend Transport; Wed, 15 Feb 2017 19:07:40 +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;caviumnetworks.com; dkim=none (message not signed) header.d=none; 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 BN1AFFO11FD034.mail.protection.outlook.com (10.58.52.158) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.904.16 via Frontend Transport; Wed, 15 Feb 2017 19:07:39 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v1FJ5fM9020023; Wed, 15 Feb 2017 12:07:36 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Thu, 16 Feb 2017 06:09:38 +0530 Message-ID: <1487205586-6785-40-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1487205586-6785-1-git-send-email-hemant.agrawal@nxp.com> References: <1485172803-17288-1-git-send-email-hemant.agrawal@nxp.com> <1487205586-6785-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131316592597787656; (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)(7916002)(336005)(39410400002)(39860400002)(39840400002)(39380400002)(39850400002)(39400400002)(39450400003)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(38730400002)(33646002)(110136004)(8676002)(81166006)(81156014)(36756003)(8656002)(92566002)(2950100002)(6916009)(305945005)(47776003)(86362001)(50986999)(85426001)(76176999)(50226002)(189998001)(106466001)(8936002)(54906002)(356003)(105606002)(53936002)(50466002)(97736004)(104016004)(77096006)(2351001)(389900002)(68736007)(2906002)(5660300001)(48376002)(626004)(4326007)(5003940100001)(5890100001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2948; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD034; 1:5b7DOMRgMeRcwQotAkRUFPZdh++BrLfERVOXn38BovwcyubLrkahd8kKEZvn++YdzPxeMe7i3Q6dkDuA6eMgH58mi2RQx98FxT1KrHLIN+negWOFzmQ7zLQQarT3mDyOR74Lc4PCno3+IC7QspRx53ig58OqyW1+LknFHw9PT6GlO6y/aj8pPoNPdk55SL3ErPEDntYNmKa3478B70vPBEM4BQOxHZJUHAZjWldSgD1YX0+v8+tfBXrO9PLBQulLN+BJNep4OP7akZtnRLG+iv5xaR0DKKdjPL9CQBh93l2ibFBhkn2tlnyLvbCXk2cfVvksnoOrRcTWMcFUwuHqKgO6WbswA+jqYs8kCG1u/o7kjjT+eibzofy9/xM+vZZNDjPwwI19H9tF+B6m0WJhPhe6+zQN2wEGJN5llvvcCCKf/8HrLobbcPeMZ7IB8wddC7vS72qkD3eg/YtQotm2gvfdPQtw+bOR2VttoX64y4rI2WKLT/EKnMPkmEhfsLE4/q8RgB0ZqBjcEZfks/eqO6Htdy8U19aPmLqRFUxzByzgGrmgelBqgFi/8iLZS+pQmp5SGEdFZV2hgEAASXI9Yqv/F0QH1mvEcIR2xG0IsAbdqts3hbM+dx7yCvqh07dOG3RRjcGy3bqo3DTESfcwXw== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 91a9fbd2-1e34-468b-2146-08d455d5e95a X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN6PR03MB2948; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2948; 3:7wqp3kwr8kk+VJjbOTyQwneVhq7xx+S9icUFDlxgNx2OC2PxBvyQPTTOKJv1lySegzvejHn4gE5PgStNblvEK+3qk1sZQUnkqcC41oZHY6DetirX3zoiBOCUhV5ev/3Nx8fk+G7Swek2JCxLd83uF37SmBNXYvAnKlwHR4HkMMBWctpfyk/gCIrrhrcS54P/+M8hnKTxnJYsXnw+8BhGgFMPvxH20T9sFvX9B2R7fNViBDk6fljW6fQpSysv3nkhMEzkkJqiMHfhGXsJqPWWC8PoHQHyECgPK75k1oyvL7/uvuwRCcr1k7u9Dq9r8ESVF3y9Qb18EzND1CNUbnNkSyoRobqF4znh0OZhNXp6lFrjFXBhJ2AT4FJ47SviSu00; 25:ffz2C7NZ3mtR9ZEK4KDPEgBK8YK65BMDYrI5MHUFVhMZk3wHa+oskIXvGxgxLKyntSunjmFWGDZERPwPLKuaBtElgWsZtLOjJA0sbjUQomh4LbXcrDZrDpR2eCZIAD2P4lD9ARNssLIwwMGu8eXnTZyuoU8s3LtiQZpSrsEzYMurOJPA6gcYe2cR42HMhU6/LfxDyVluB/bQ02IQ5EzQving1jFkgtI8cEjGK1jjzAmIxborAZ5NOILzpEN6ratjXD9oNic7xiOZvV/A0eOLPVJ+OA9SP97vpDfLSOMz4wMLw2s4U4czU6sh5DRT0YkWWncyNxxwLmmKfUOQzbyudwHv4O+o+RuoHCPRBkhWJNcDo175PnLJAWzOBkaU91ftVNkbIs6U8DLxM2HE8dViqbQxPlV7YWsW2/N+sX/mQkEYpySBFbSkjKy72zkahnS13HOMdzG5/vSiR8HceiYFgw== X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2948; 31:BOCHEFoUCLxgEXL/VRo02kdOCCLNtdk8yvYs0ri4ekCwz7hh29GLGpj8kdv9kxjoZv7wfL+uc91tBDX9xhuHqbuGufRpk3wKPUkHEzYIomif8ZnP1QP+pEoSUDqJtzOWMe95KBUkn1v5ncsWiht5UimpH3yhHGUWJpB61HEWbQRt9YY4UkZzXrmurYgg0cMXonAgwXi9s0WpFm6e+HlyT0CdwK3L0nokD3muFU27jlcDWs6KuEwbDFk0yVPcLPJP7iym31PhPEZ6rJIxR/dR7hE8ec88melf0Jaa33xLtdM= 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)(13018025)(13023025)(13024025)(13017025)(13015025)(3002001)(10201501046)(6055026)(6096035)(20161123559025)(20161123565025)(20161123563025)(20161123561025)(20161123556025); SRVR:BN6PR03MB2948; BCL:0; PCL:0; RULEID:(400006); SRVR:BN6PR03MB2948; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2948; 4:e7R4L4bjuByyxcjer6wDMbbpIyBC39ZbR3cHpR0Z+261GrbmZj2ufhFczEvg2YzZKQkJ9acOmwdga01CIRSdvc6gTCIyDaVUcd3d7ki8SdEgTnXCspXnV6UwiRX32SZn+/pdXKz/hW8am1SfEy8N+4ut2OAQtrl7lTbq8hO93KCJZ1xFn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BbzjqA9nrapBOQLIc0ykUEW/Vw9RehzoC?= =?us-ascii?Q?J8zIfug1f9fcO+MEOysLGMr3G1DJX1PstbmtpEf53gNE+I0IEnHx8/tlwLLN?= =?us-ascii?Q?yldmQQPy/mwzMUKYEeQx0j/ssmsb0Py84lEguLcTZLs?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2948; 6:j2kBiId4YiicdCg1FoDvfZChN+ZzdwUT0Qmaf8Yquq8DqdvpqqdXI/0VBWlQqQm9U3t5gAMfY0xXnypvOY2taSNHy2OAEnlAS9p5sOY/U1GCqfld+ouXPf05kVixKpFXhFdEvwkqZNlrfx0uZj6lGGbAvakze3Xfxp/zbzJDqWXH+8ZONs701pT0wLGmlMuEMDEXHID8G3mHGHdSEBf82gle4RdU1ibcNEhFN8J9DP7i2dky4i6B3M+U23JCTeO1rD/0x05WKrxw+uWKa9wyFFO9snUKVNmeBZMlvFZPMNhljP0Yv/A+yo5QOG9b9isOLvah8m8JoiGGlw8tXHU/ueQn9wXKRTFHSFZ6xtpzOfO+eQqRUKQTvtKM4cWSO5mdmJq4svvwx86H8DMV+D8zu8U6K21fCEbQYUyAJMiMgWw=; 5:LxK+NeGLsNYV38z2TSR6u9RmYqgV/Y+iITPT3T4pqYbH6WjbHDcH6nmwZfbsz7AEz2OhgTmZdWGeO1iFvhVsarxLZyy1JPnFOl8tbzIHG5+SFleYGhYc+T0t71CINLZoLRyXvdwBL3Z1kmevto0sEnPdFYpNMI9+1SFcAg1NSjd2Y1CkYpjKvL6KjXR4AsVZ; 24:qEryg3qIdNWtho4LDQ9ctN4UBwG96vfwnNDACC9dqwi3Wdebwm3t/wMMw5ZHx6UKIfuFdB//yxzdosECii2SynaDo+pxb81cDudii/5UfNs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2948; 7:vT2cqSax1HY9zCJRpS+DPPyPAAjDIsL81RJN16MyD8SdT4KpS+GBJBPxTDN6vwpWoGBrqRY5EViBCqtBPyxymkh+aVEnuM6wcqyub5KtgufJZgrJG/36g0jfMx8fFXV2tlKL9gWAhqLM8VVmL1uveFi5veelU4DQ6ugu+edfvi0eYH/Tzeed3d1Mkq+mQJUNFyOeQpGZ1+si9pbOl+yDXtGLCPqxZ6NlA5xcGNP/TVi6cdZlefqK+QiSfji4NmH6I+DuT3usdVNFt/f7zVGAJSTzpEmozWKRAActaGTBJ21KA5TB8NCidp8e6ipY/WC7lj6BEyxvsAQClnQecMoECw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2017 19:07:39.5759 (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: BN6PR03MB2948 Subject: [dpdk-dev] [PATCHv7 39/47] 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: Wed, 15 Feb 2017 19:07:42 -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