From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 1D943A0679 for ; Wed, 1 May 2019 03:15:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1510D4C95; Wed, 1 May 2019 03:15:42 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80084.outbound.protection.outlook.com [40.107.8.84]) by dpdk.org (Postfix) with ESMTP id C6CE0493D for ; Wed, 1 May 2019 03:15:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5y2/bgZ8je2tnvZgeoNuZuuth90qtmRdfyF24Bugmco=; b=oJaLaDM9RMBSVH3mJiSJ4CDp7DS5sV/wYLOaYDhn2vXOyJyqNTcJiKRCheeRr9g6W9TNA7aT8tBIFqSq72HgjmA6seo7mvbUM2aXr1s/AEjkcCgsGmnB73F0NkqGAA50I3KhgaUguwesHyRIXQilgK024fP4Zr+L3XW1TNygJDQ= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4025.eurprd05.prod.outlook.com (52.134.68.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1835.15; Wed, 1 May 2019 01:15:39 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::e8d5:4aff:902d:6e98]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::e8d5:4aff:902d:6e98%5]) with mapi id 15.20.1856.008; Wed, 1 May 2019 01:15:39 +0000 From: Yongseok Koh To: Shahaf Shuler CC: "dev@dpdk.org" , "stephen@networkplumber.org" Thread-Topic: [PATCH v2] net/mlx5: check Tx queue size overflow Thread-Index: AQHU/7l6Jqev2xrXtUSAeCVuXhecyqZVd1IA Date: Wed, 1 May 2019 01:15:39 +0000 Message-ID: References: <20190430190426.44018-1-yskoh@mellanox.com> <20190501010143.611-1-yskoh@mellanox.com> In-Reply-To: <20190501010143.611-1-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 77c3aabd-3ed3-4a0e-e6c0-08d6cdd285d2 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:DB3PR0502MB4025; x-ms-traffictypediagnostic: DB3PR0502MB4025: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 00246AB517 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(396003)(346002)(39860400002)(136003)(366004)(199004)(189003)(53936002)(82746002)(33656002)(14454004)(4326008)(7736002)(81166006)(8936002)(81156014)(305945005)(68736007)(6512007)(25786009)(478600001)(6636002)(186003)(53546011)(6486002)(8676002)(6246003)(102836004)(229853002)(26005)(99286004)(76176011)(37006003)(316002)(54906003)(6862004)(83716004)(6116002)(66556008)(73956011)(66446008)(3846002)(2906002)(76116006)(36756003)(6506007)(64756008)(91956017)(256004)(66476007)(6436002)(476003)(11346002)(2616005)(486006)(86362001)(71190400001)(446003)(71200400001)(5660300002)(66946007)(66066001)(14444005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4025; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: RV8K1NeuIo4IwSieJylM+3usOHLhMoV7GtQHFmy5Gx0wz5LysGfFf3RdhQ3U2LP91ZZqtrUDn7lwUxf/z91+ZXnKr32CqxzBT43cjsHem5JOjSe3dwI73Gq09hyNaqHyDHsMIxLcIsvxFO5S0YOyiPl6/tlDt1gRhCaUS301j2n4ev/ln310+qbEri38ecJlBZBhnqV67hH18AwxCajTMGmFKCa6ubaI+8yOoP6JYblBJKknk0MtFhBr/MSp+7ERFzqMpI56KUIjzbWyP7DNcT+iptock76qtfJEcQmeWx6W1AiIUJltsNAJaS4bHKfayb9ZN+KmlM/1/lpclGNR70KgBhMn6BpALVPBqTapApNBOpha5uU1svcxE6G2WxaSUPuQsvUFfdarna+BBgO8dl9Px724J4nfx2SVxFEBrYI= Content-Type: text/plain; charset="UTF-8" Content-ID: <10517330A7CB584983C34D6DBA782719@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77c3aabd-3ed3-4a0e-e6c0-08d6cdd285d2 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 May 2019 01:15:39.0210 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB4025 Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: check Tx queue size overflow 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" Message-ID: <20190501011539.6lrfvCzA9-izLaMcv6uiyKbm1rBOkxE_YH8S6Gtgryw@z> > On Apr 30, 2019, at 6:01 PM, Yongseok Koh wrote: >=20 > If Tx packet inlining is enabled, rdma-core library should allocate large > Tx WQ enough to support it. It is better for PMD to calculate the size of > WQ based on the parameters and return error with appropriate message if i= t > exceeds the device capability. >=20 > Cc:stable@dpdk.org Shahaf, There's a checkpatch warning. Please put a space after ':' if you merge it. Thanks, Yongseok >=20 > Signed-off-by: Yongseok Koh > --- > drivers/net/mlx5/mlx5_txq.c | 35 +++++++++++++++++++++++++++++++---- > 1 file changed, 31 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c > index 4d55fd413c..b281c45027 100644 > --- a/drivers/net/mlx5/mlx5_txq.c > +++ b/drivers/net/mlx5/mlx5_txq.c > @@ -679,6 +679,27 @@ mlx5_txq_ibv_verify(struct rte_eth_dev *dev) > } >=20 > /** > + * Calcuate the total number of WQEBB for Tx queue. > + * > + * Simplified version of calc_sq_size() in rdma-core. > + * > + * @param txq_ctrl > + * Pointer to Tx queue control structure. > + * > + * @return > + * The number of WQEBB. > + */ > +static int > +txq_calc_wqebb_cnt(struct mlx5_txq_ctrl *txq_ctrl) > +{ > + unsigned int wqe_size; > + const unsigned int desc =3D 1 << txq_ctrl->txq.elts_n; > + > + wqe_size =3D MLX5_WQE_SIZE + txq_ctrl->max_inline_data; > + return rte_align32pow2(wqe_size * desc) / MLX5_WQE_SIZE; > +} > + > +/** > * Set Tx queue parameters from device configuration. > * > * @param txq_ctrl > @@ -824,10 +845,16 @@ mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx,= uint16_t desc, > tmpl->txq.port_id =3D dev->data->port_id; > tmpl->txq.idx =3D idx; > txq_set_params(tmpl); > - DRV_LOG(DEBUG, "port %u device_attr.max_qp_wr is %d", > - dev->data->port_id, priv->sh->device_attr.orig_attr.max_qp_wr); > - DRV_LOG(DEBUG, "port %u device_attr.max_sge is %d", > - dev->data->port_id, priv->sh->device_attr.orig_attr.max_sge); > + if (txq_calc_wqebb_cnt(tmpl) > > + priv->sh->device_attr.orig_attr.max_qp_wr) { > + DRV_LOG(ERR, > + "port %u Tx WQEBB count (%d) exceeds the limit (%d)," > + " try smaller queue size", > + dev->data->port_id, txq_calc_wqebb_cnt(tmpl), > + priv->sh->device_attr.orig_attr.max_qp_wr); > + rte_errno =3D ENOMEM; > + goto error; > + } > tmpl->txq.elts =3D > (struct rte_mbuf *(*)[1 << tmpl->txq.elts_n])(tmpl + 1); > rte_atomic32_inc(&tmpl->refcnt); > --=20 > 2.11.0 >=20