From patchwork Thu Dec 27 06:23:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 154563 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6606140ljp; Wed, 26 Dec 2018 22:26:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/UNs5LhVm/iTGKQEwlZtUo4Q/Y9HOy6G89Bfq4oMLLN94jVPiZEmWS0LT7ObbZOGrXzIEEc X-Received: by 2002:a1c:7306:: with SMTP id d6mr19552240wmb.98.1545891970667; Wed, 26 Dec 2018 22:26:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545891970; cv=none; d=google.com; s=arc-20160816; b=jMJVjazQiWWXWkhzJ0R2S0glwA4okuAkn/YkX947iN0o0qOv0Frb55iP0shYLy8UXn rvOlmoDaoU9ZmTbnue6WKbbSFPYEJkiwsXLoQe5kZPW7xEGuEG991UExnQYn8u1gceVC WPL4n/HIzdmRSwfVR4EvBUGVyhBMJrUMB+T9jsKikHE+zL0COaY+gj5eU5CeVLKiOOek q9C1dT1L+nHe02ebSs+pnv9jRfPSqWkN39ZvuxwE95PL82nNKfsm5noOGNBnHrRgCFFU bl1LpNqRP8jwhr5d4N1z/IWHUEGDJ9gVVVTXfSfVlhIi1JKxtz9X3Sgq/w1lRWJyKw5i W1jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:mime-version :content-transfer-encoding:spamdiagnosticmetadata :spamdiagnosticoutput:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:cc:to:from :dkim-signature; bh=hpDu1lt8PvEBP8dE9yOdvLQTk9FxnM9gxWkU4T2I5bM=; b=mMMp074DKLTCaRM6iantqeonPVclYGTtWjiPzuN9U4LH8a31MBC5sFRkmS02ijsK5M qFs+Yx/TA3ttgyV9ErtoZdaU+fW+UmfZ/I7HG2NOnY0rZ8OECotUdVwifxm/VJE/YWee 6E3m/hHrQGALUoG4jwUilzkZsql5IEYk/hJZhLQ9Q34Qh+jNKVAYUZ1686gskHZSBklt nEUDCL2UXMbcH3SUuYJjB00nlvh1TAvtMGTUdwD2iPj/y7BivghccqiUC4P5za5sg/3g 2BiBJXwBFNw6v5OjmyJH//QghP2rWqhvFDdZ4fhgoBb6kniyPxTb26gq4ef//ykNvI5K nFWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=WHVMKdHY; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id q127si16979007wma.41.2018.12.26.22.26.10; Wed, 26 Dec 2018 22:26:10 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=WHVMKdHY; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D8D1A1B0F9; Thu, 27 Dec 2018 07:23:33 +0100 (CET) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70084.outbound.protection.outlook.com [40.107.7.84]) by dpdk.org (Postfix) with ESMTP id 29C2A5B34 for ; Thu, 27 Dec 2018 07:23:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hpDu1lt8PvEBP8dE9yOdvLQTk9FxnM9gxWkU4T2I5bM=; b=WHVMKdHY5tkcf9YkrpUrBZJ7ToCY1YImOKXKf0C6TnHEwpwcEhTOJrDkoD946R11WuBqM9XHC/2epySbMxptAqVFXXJddjer0FYrZOQB0cAMIC5E7dDT6d0JxM35N3n8GR2pyK5tHAthuLmmGTORyYKqQz2XKG6ATYXyONsMioE= Received: from VI1PR0401MB2541.eurprd04.prod.outlook.com (10.168.65.19) by VI1PR0401MB2382.eurprd04.prod.outlook.com (10.169.134.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1471.20; Thu, 27 Dec 2018 06:23:18 +0000 Received: from VI1PR0401MB2541.eurprd04.prod.outlook.com ([fe80::555e:164:f8f0:dbb4]) by VI1PR0401MB2541.eurprd04.prod.outlook.com ([fe80::555e:164:f8f0:dbb4%2]) with mapi id 15.20.1471.019; Thu, 27 Dec 2018 06:23:18 +0000 From: Hemant Agrawal To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Shreyansh Jain Thread-Topic: [PATCH 18/20] net/dpaa2: change ref of device to private device Thread-Index: AQHUnayoWv0rlQW2jkOvr5WGqTpxjA== Date: Thu, 27 Dec 2018 06:23:18 +0000 Message-ID: <20181227062233.30781-19-hemant.agrawal@nxp.com> References: <20181227062233.30781-1-hemant.agrawal@nxp.com> In-Reply-To: <20181227062233.30781-1-hemant.agrawal@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.143.30.134] x-mailer: git-send-email 2.17.1 x-clientproxiedby: BM1PR01CA0120.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:40::14) To VI1PR0401MB2541.eurprd04.prod.outlook.com (2603:10a6:800:56::19) authentication-results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR0401MB2382; 6:KjJK7B2wDsH1zKbbfOl05VT/HW2dniqhWXpECQwiEuwGRZ4SLyRzID9Uk1DO2ZrE5Yz3J0JqIzkSqEVm0nb26JHFL8zP4oRh3hev9O0vR9EwOfuvwJBi7igBVv3yMVlpJt/m2p+RA5pguLD/AjaYWOCB0Zt0dbRt/0FhdAzy7igmKbsZGllza+77oNjepoAbUu2xMsJ7O871epKY6oc35WLo96vE+vnCJOEHjgOfCjwXGyCNnE0+SN83y847z3CT2J7+RN0xD1MzUB8PKY5IORnYPVRY1bhWywESc03FPYAkaFxZkQdLHFQJHo3QiJ8WJaijZo7hFfMMCkDOsRluwsS3zKO6aKRDGIC0TIapHVxmnnDoH0sXH3na4uJlwiUvFdECzveDq+FWV5GLWC7+o++JChVF9KUTEmRO2lP9ceSsvjY1SvVlzJi2WGiZZCy8fmczLnTOPn8PAD5uCJX3Kw==; 5:QkKt2fuqaunOsRlPHqOQjdiVo1rR0jLl6F7WjRRTR+8oayrQNfpJNf7FvgqEVSAXAnRyvh2PQBdYi5dl7uKBg5dy/vF/b43zxTk8XqiVY77lSaiCdKNPNVDOs0sU6IUsPURxAwi6LdCNQrTFj6cSj93LhjzNeE2aAWl/fuGYtCs=; 7:UC+5b55B79afTdnL7kKqWnxpdIu53esI9lh0oz1upY0dz5eik1Dfnlnusa6goGAzyQaZMb4fQObSWlbIZKKRepo6GCcfTjN6TyIvJ6HPUe+8Y85EubQENums7iz9Jy/v7d2+McSkGsA7HJ1yVNmEzw== x-ms-office365-filtering-correlation-id: b13e6cf7-4117-4671-dd97-08d66bc3caa6 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0401MB2382; x-ms-traffictypediagnostic: VI1PR0401MB2382: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(2401047)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231475)(944501520)(52105112)(6055026)(6041310)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:VI1PR0401MB2382; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0401MB2382; x-forefront-prvs: 0899B47777 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(366004)(376002)(39860400002)(346002)(199004)(189003)(5660300001)(1076003)(26005)(76176011)(186003)(71200400001)(256004)(25786009)(105586002)(4326008)(6436002)(305945005)(11346002)(106356001)(14444005)(446003)(44832011)(476003)(7736002)(55236004)(102836004)(78486014)(486006)(386003)(68736007)(52116002)(86362001)(6506007)(2616005)(71190400001)(66066001)(316002)(54906003)(6116002)(3846002)(2906002)(14454004)(36756003)(99286004)(50226002)(8936002)(1730700003)(81156014)(81166006)(8676002)(6512007)(53936002)(478600001)(97736004)(6486002)(6916009)(5640700003)(2351001)(2501003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0401MB2382; H:VI1PR0401MB2541.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: vbFiMlplHFlEXwl61oSvJJmav9NE9g44h+cpPIA0XAHMmcEMWPqI7UxSSVkaKOxiTulviI2o7ecDhJZun4k7uonhVMGX2+wOI9WAlsyYg5DpqTke4/ad7idJ8cxrSS4Zym2InuQJtmAc/U0g05tbG8q+YuFrsOPYdbj6COP5xCngDE/rSXbC4yH9d2/0PUpo2cZYnorMywMU+6/R9Cet8wnz0wYzvbYlHIm/6ZWvBXh3Z9V0AQmk63QZYLK3/8pjLaeK7knUpIFS+CXqG6qCzFFpADrTb4WsPGbcjkl55Rwhxb2qkiaw6+k/orqGSaWy spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b13e6cf7-4117-4671-dd97-08d66bc3caa6 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Dec 2018 06:23:18.5825 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2382 Subject: [dpdk-dev] [PATCH 18/20] net/dpaa2: change ref of device to private device 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Shreyansh Jain The I/O threads for DPAA2 take their reference for bpool ID, the port ID and other info like qdid, from the rte_eth_dev. Further, to get this data during I/O operation, a reference of the RTE device is kept in the queue structure (dpaa2_queue). In case of secondary processes, rte_eth_dev is not same as the primary process. Thus, the reference goes invalid. This patch changes the implementation to use the dev_private rather than the rte_eth_dev as that is shared area across all the processes. Signed-off-by: Shreyansh Jain --- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 5 ++++- drivers/net/dpaa2/dpaa2_ethdev.c | 4 ++-- drivers/net/dpaa2/dpaa2_rxtx.c | 18 ++++++++++-------- 3 files changed, 16 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index 20c606dbe..626fcbbca 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -127,7 +127,10 @@ typedef void (dpaa2_queue_cb_dqrr_t)(struct qbman_swp *swp, struct dpaa2_queue { struct rte_mempool *mb_pool; /**< mbuf pool to populate RX ring. */ - void *dev; + union { + struct rte_eth_dev_data *eth_data; + void *dev; + }; int32_t eventfd; /*!< Event Fd of this queue */ uint32_t fqid; /*!< Unique ID of this queue */ uint8_t tc_index; /*!< traffic class identifier */ diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 3a20158da..2b90f4021 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -244,7 +244,7 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev) } for (i = 0; i < priv->nb_rx_queues; i++) { - mc_q->dev = dev; + mc_q->eth_data = dev->data; priv->rx_vq[i] = mc_q++; dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[i]; dpaa2_q->q_storage = rte_malloc("dq_storage", @@ -260,7 +260,7 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev) } for (i = 0; i < priv->nb_tx_queues; i++) { - mc_q->dev = dev; + mc_q->eth_data = dev->data; mc_q->flow_id = 0xffff; priv->tx_vq[i] = mc_q++; dpaa2_q = (struct dpaa2_queue *)priv->tx_vq[i]; diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 6e2e8abd7..2d4b9ef14 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -509,7 +509,7 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) const struct qbman_fd *fd, *next_fd; struct qbman_pull_desc pulldesc; struct queue_storage_info_t *q_storage = dpaa2_q->q_storage; - struct rte_eth_dev *dev = dpaa2_q->dev; + struct rte_eth_dev_data *eth_data = dpaa2_q->eth_data; if (unlikely(!DPAA2_PER_LCORE_ETHRX_DPIO)) { ret = dpaa2_affine_qbman_ethrx_swp(); @@ -613,9 +613,10 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) bufs[num_rx] = eth_sg_fd_to_mbuf(fd); else bufs[num_rx] = eth_fd_to_mbuf(fd); - bufs[num_rx]->port = dev->data->port_id; + bufs[num_rx]->port = eth_data->port_id; - if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP) + if (eth_data->dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_VLAN_STRIP) rte_vlan_strip(bufs[num_rx]); dq_storage++; @@ -716,8 +717,8 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) struct qbman_swp *swp; uint16_t num_tx = 0; uint16_t bpid; - struct rte_eth_dev *dev = dpaa2_q->dev; - struct dpaa2_dev_priv *priv = dev->data->dev_private; + struct rte_eth_dev_data *eth_data = dpaa2_q->eth_data; + struct dpaa2_dev_priv *priv = eth_data->dev_private; uint32_t flags[MAX_TX_RING_SLOTS] = {0}; if (unlikely(!DPAA2_PER_LCORE_DPIO)) { @@ -729,7 +730,8 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } swp = DPAA2_PER_LCORE_PORTAL; - DPAA2_PMD_DP_DEBUG("===> dev =%p, fqid =%d\n", dev, dpaa2_q->fqid); + DPAA2_PMD_DP_DEBUG("===> eth_data =%p, fqid =%d\n", + eth_data, dpaa2_q->fqid); /*Prepare enqueue descriptor*/ qbman_eq_desc_clear(&eqdesc); @@ -772,7 +774,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) rte_mbuf_refcnt_read((*bufs)) == 1)) { if (unlikely(((*bufs)->ol_flags & PKT_TX_VLAN_PKT) || - (dev->data->dev_conf.txmode.offloads + (eth_data->dev_conf.txmode.offloads & DEV_TX_OFFLOAD_VLAN_INSERT))) { ret = rte_vlan_insert(bufs); if (ret) @@ -794,7 +796,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } if (unlikely(((*bufs)->ol_flags & PKT_TX_VLAN_PKT) || - (dev->data->dev_conf.txmode.offloads + (eth_data->dev_conf.txmode.offloads & DEV_TX_OFFLOAD_VLAN_INSERT))) { int ret = rte_vlan_insert(bufs); if (ret)