From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0069.outbound.protection.outlook.com [104.47.2.69]) by dpdk.org (Postfix) with ESMTP id 813162C17 for ; Wed, 25 Apr 2018 05:54:21 +0200 (CEST) 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; bh=nl0un3GiFS8h+Hk2qqSHCW+E6QOuSNUqjNhjCPtM/lQ=; b=x4SqRxu37L2GHKA28/k9HdLDbfMNfdgOIo9ci/iyc8hjCAhh59csd3IE6+L7+F6noSDOIqDVdtKpEDIrM6lHDHHrilAIItp/MJqWZLgsMZpBzIQm8On15uAIS2Q9aZLmiW/vI8B9MFZSKqn6gERo7015VSfhyUGS0bKMvd/K7xQ= Received: from HE1PR0402MB2780.eurprd04.prod.outlook.com (10.175.29.14) by HE1PR0402MB2874.eurprd04.prod.outlook.com (10.175.30.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.15; Wed, 25 Apr 2018 03:54:20 +0000 Received: from HE1PR0402MB2780.eurprd04.prod.outlook.com ([fe80::8d97:47e4:52b9:2040]) by HE1PR0402MB2780.eurprd04.prod.outlook.com ([fe80::8d97:47e4:52b9:2040%14]) with mapi id 15.20.0696.019; Wed, 25 Apr 2018 03:54:20 +0000 From: Shreyansh Jain To: Nipun Gupta CC: "dev@dpdk.org" , "thomas@monjalon.net" , Hemant Agrawal Thread-Topic: [PATCH v2 3/9] bus/fslmc: keep Tx queues information for DPCI devices too Thread-Index: AQHTzn2WGdUYq4Kj4UWnoe+zD0lZEKQQ850w Date: Wed, 25 Apr 2018 03:53:59 +0000 Deferred-Delivery: Wed, 25 Apr 2018 03:53:41 +0000 Message-ID: References: <1519292089-13851-1-git-send-email-nipun.gupta@nxp.com> <1523111645-8076-1-git-send-email-nipun.gupta@nxp.com> <1523111645-8076-4-git-send-email-nipun.gupta@nxp.com> In-Reply-To: <1523111645-8076-4-git-send-email-nipun.gupta@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [182.69.217.20] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR0402MB2874; 7:lDbgfe5ANBfVhN/R1Xk1zURJlAQnXqnnd1gt2jioT6ILjSSyNsdJK6egBzsO1BX2sTJ7wCJmB/973MFqW4ivbg2xTYUDd6QVmBzbjwR1YwJiVmkEV1yQyPFl6oR4SD4PbgwLxzRCfaCsJiMafiKsyfSR8oe4o9pxkIoTHvGCaXs30Ubr3UB0AMc3vyRB+A/59GeKyNYRF+iUf9sAk9FOva+8mVnnMeiVMXWzA9QVhG+EFwJOUQV/Ky4HPubFkAWk x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:HE1PR0402MB2874; x-ms-traffictypediagnostic: HE1PR0402MB2874: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197)(275809806118684); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231232)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041310)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:HE1PR0402MB2874; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0402MB2874; x-forefront-prvs: 06530126A4 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(396003)(376002)(366004)(39860400002)(39380400002)(13464003)(189003)(199004)(44832011)(6436002)(55016002)(99286004)(33656002)(25786009)(5660300001)(3280700002)(3660700001)(6636002)(81156014)(66066001)(6666003)(8936002)(5250100002)(305945005)(2906002)(229853002)(106356001)(7736002)(4326008)(53936002)(2900100001)(6862004)(68736007)(81166006)(14454004)(74316002)(86362001)(6116002)(3846002)(478600001)(8676002)(6246003)(105586002)(102836004)(53546011)(9686003)(6506007)(446003)(59450400001)(7696005)(11346002)(26005)(54906003)(76176011)(476003)(97736004)(486006)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0402MB2874; H:HE1PR0402MB2780.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: h/QB6MgL1nj/dCbBGobTS+S5cgASLJekZdB4c0A6HEC6F0RKoanKy3t3dCCRvdzGZydhMrpOhFxaOEFaUK35T/KuafG5BsGrhhDj9rfBXb+aXiwfX88nkYRdRjIw6oUlq9iBZidvAMQM9vPHw3qJCU9X4cKIUEqXHSqgfcFNmlk1fckxFg7K9vVr3RwH4gkb spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: a29c7ea9-119c-43c5-9d46-08d5aa60397c X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a29c7ea9-119c-43c5-9d46-08d5aa60397c X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Apr 2018 03:54:19.9749 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0402MB2874 Subject: Re: [dpdk-dev] [PATCH v2 3/9] bus/fslmc: keep Tx queues information for DPCI devices too 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, 25 Apr 2018 03:54:21 -0000 Hi Nipun, Apologies for delay in review. 2 quick comments inline. > -----Original Message----- > From: Nipun Gupta > Sent: Saturday, April 7, 2018 8:04 PM > To: thomas@monjalon.net; Hemant Agrawal ; > Shreyansh Jain > Cc: dev@dpdk.org; Nipun Gupta > Subject: [PATCH v2 3/9] bus/fslmc: keep Tx queues information for DPCI > devices too >=20 > The DPCI devices have oth Tx and Rx queues. Event devices use > DPCI Rx queues only, but CMDIF (AIOP) uses both Tx and Rx queues. > This patch enables Tx queues configuration too. >=20 > Signed-off-by: Nipun Gupta > --- > drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 57 > +++++++++++++++++++++++++------- > drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 3 +- > drivers/event/dpaa2/dpaa2_eventdev.c | 10 +++--- > 3 files changed, 52 insertions(+), 18 deletions(-) >=20 > diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c > b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c > index aee870a..3bf7e7f 100644 > --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c > +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c > @@ -39,6 +39,7 @@ > struct dpci_attr attr; > struct dpci_rx_queue_cfg rx_queue_cfg; > struct dpci_rx_queue_attr rx_attr; > + struct dpci_tx_queue_attr tx_attr; > int ret, i; >=20 > /* Allocate DPAA2 dpci handle */ > @@ -67,17 +68,38 @@ > return -1; > } >=20 > - /* Set up the Rx Queue */ > - memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); > - ret =3D dpci_set_rx_queue(&dpci_node->dpci, > - CMD_PRI_LOW, > - dpci_node->token, > - 0, &rx_queue_cfg); > - if (ret) { > - DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d", > - ret); > - rte_free(dpci_node); > - return -1; > + for (i =3D 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { > + struct dpaa2_queue *rxq; > + > + memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); > + ret =3D dpci_set_rx_queue(&dpci_node->dpci, > + CMD_PRI_LOW, > + dpci_node->token, > + i, &rx_queue_cfg); > + if (ret) { > + DPAA2_BUS_ERR("Setting Rx queue failed with err code: > %d", > + ret); > + rte_free(dpci_node); > + return -1; > + } > + > + /* Allocate DQ storage for the DPCI Rx queues */ > + rxq =3D &(dpci_node->rx_queue[i]); > + rxq->q_storage =3D rte_malloc("dq_storage", > + sizeof(struct queue_storage_info_t), > + RTE_CACHE_LINE_SIZE); > + if (!rxq->q_storage) { > + DPAA2_BUS_ERR("q_storage allocation failed\n"); > + rte_free(dpci_node); > + return -ENOMEM; > + } > + > + memset(rxq->q_storage, 0, sizeof(struct > queue_storage_info_t)); > + if (dpaa2_alloc_dq_storage(rxq->q_storage)) { > + DPAA2_BUS_ERR("dpaa2_alloc_dq_storage failed\n"); > + rte_free(dpci_node); If the q_storage->dq_storage allocation has failed, q_storage too needs to = be free'd. > + return -ENOMEM; > + } > } >=20 > /* Enable the device */ > @@ -101,8 +123,19 @@ > rte_free(dpci_node); > return -1; > } > + dpci_node->rx_queue[i].fqid =3D rx_attr.fqid; >=20 > - dpci_node->queue[i].fqid =3D rx_attr.fqid; > + ret =3D dpci_get_tx_queue(&dpci_node->dpci, > + CMD_PRI_LOW, > + dpci_node->token, i, > + &tx_attr); > + if (ret !=3D 0) { > + DPAA2_BUS_ERR("Reading device failed with err code:" > + " %d",ret); > + rte_free(dpci_node); Maybe in this case as well where both, q_storage and dq_storage, need to be= released. > + return -1; > + } > + dpci_node->tx_queue[i].fqid =3D tx_attr.fqid; > } >=20 > dpci_node->dpci_id =3D dpci_id; [...]