From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D05A1A0559; Mon, 16 Mar 2020 17:05:16 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 426D51C06D; Mon, 16 Mar 2020 17:05:15 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) by dpdk.org (Postfix) with ESMTP id F239B1C068; Mon, 16 Mar 2020 17:05:12 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZK6TkS18aQEtvMnMrFc5tqXBC9rWOpn2g8hVw6h147Uq3ohoYlguKNDyoOXFhVsTWns0gLdxgWlXxUd8NdtJ+6CYDpCm4iP8smN+uTNzae7I/IH8vKBW+CS5p3tkCUWzksZ3eapicUFc9FyO5/AXUs+qjaAaD754Qy0LCrYvTDmy+lrJJgzhA7CQgsKM0b3cgiCGPWcDXYVGm+5xcH+lQkjqi3eYVSIk1MP4hlkUMW5LmNQgL7RVYvavlzKOjxgZK0UY1R3G4xeJ641bhhx/MUapdOttMPo7SyzX00HAGL7FH/u+OwGGTxbf4MxBCnc/GiFByQLYKOyLUQkUQ0J18w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EACaEvza82xZR8HMhG96kYU/MH1GP/cMWbHGy75K9RQ=; b=Smjyk6mhS5BqTD+xZSSQVmbhUGdJ7Cbtg4wB3QCsQFMIWZ9tLgOynVPQ9Ju1AoaRibUnpaxpoVFSHOrKvQM1bcfcrdJavgZ/PxNqPTRPiIcckE7+A0eiRvXRHeZ85Sewae5UR8nmFIdEqRYLSzqfAakvQzO43k1YcDq7Pzm0sMqVPU0UNqi8GIqD5hoEa1iLPrDxOlYAOHJjGhdIKH4XkzW4EKSt4GfmdDty47FK23IPvIOgGIMcA7VGVeuVg7u2aHc79JtL4nGAM2/E62mTsHFHMHm+dAND+xtM91O/iN0zo2feVBgsBpHGSVawj7JfalEqJVa0SEjvpWtxOMJFGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=EACaEvza82xZR8HMhG96kYU/MH1GP/cMWbHGy75K9RQ=; b=GEc8ub1WvmmrK9IjI0F1UpI2lasUrs5O9kyC1YSgwHP2OWq1UPzJ4Thht55t51WOflU1sL9kKs7geGXqolOSfI4accksDsvvQrZGlZe8tyGDL6Vx9yXsCv1s5lgufUjtoCnP54S/JYTP4WALV6H6t33IWJoVFXExfuoHbkB8Chg= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3204.eurprd05.prod.outlook.com (10.171.186.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.16; Mon, 16 Mar 2020 16:05:11 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::da5:7919:35c1:894]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::da5:7919:35c1:894%6]) with mapi id 15.20.2814.021; Mon, 16 Mar 2020 16:05:11 +0000 From: Slava Ovsiienko To: Didier Pallard , "dev@dpdk.org" CC: "stable@dpdk.org" , Matan Azrad Thread-Topic: [dpdk-dev] [PATCH] net/mlx5: fix Rx descriptor status returned value Thread-Index: AQHV+R3NUuOMFN9hiUqEZ7rE/Zjwd6hLSJeA Date: Mon, 16 Mar 2020 16:05:11 +0000 Message-ID: References: <20200313095659.19000-1-didier.pallard@6wind.com> In-Reply-To: <20200313095659.19000-1-didier.pallard@6wind.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=viacheslavo@mellanox.com; x-originating-ip: [95.164.10.10] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 06cb2fb2-f99d-45b0-ec13-08d7c9c3cea1 x-ms-traffictypediagnostic: AM4PR05MB3204:|AM4PR05MB3204: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-forefront-prvs: 03449D5DD1 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(366004)(396003)(39860400002)(376002)(136003)(199004)(71200400001)(110136005)(76116006)(316002)(54906003)(66946007)(4326008)(478600001)(186003)(107886003)(26005)(33656002)(52536014)(9686003)(55016002)(2906002)(6506007)(66476007)(66556008)(53546011)(64756008)(7696005)(86362001)(81156014)(8676002)(5660300002)(81166006)(66446008)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3204; H:AM4PR05MB3265.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 99SiLjio+CwBHKwpNmnP+71Q41FSHOrxRioc7I0LERfEhL0zgqFkKlX3iG3gAeqxuLJX7u9WwSaZV3NkEXkNGUfIYCHDOnW6cyW1dc4WxV3mvq/1dFEI5JSeIIEC4vKf9xnSWVedC6G1Yss8F3mb/tgQPGGmIldfGApeU99XpNhngdWJSCKemEtz5BtdVawboJ4Pmhm2a8J/JjawjhQggY5HTqLSVQwBPRKcfLXH15ILFyyrBa+44YqvmPU8spa9WQlNh48eZoduCb0R4DSaM3AqvIQeNyWu7QZU1+bxi0F/oy9Gve7tn9LtXDiO2vNZBKXvrTI3nqTEx+4MlBwE9KoSvlF07jyyoixmwoNOELaY4M0bOYNsAA8C6MVgvbXtiH4HtUrjIFcPvsezpQjcb++KI/63WRRaHCVXmBuSTAd4MNK4p21MQ3zniSSJ2BjA x-ms-exchange-antispam-messagedata: dWYrlLYl6GxbPktS4XpwzAAVXFbmQ9x6mL9907TmbfClFKLr9EPQzg8G33NCTnCPlLhTS+ttUF/fJ7O811Dqik23HgLtDcsc2oWUDvxGvc3muWY0pdj21H+0YACV1FF99mozLqJ6wfmC8YNvMMtTOA== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06cb2fb2-f99d-45b0-ec13-08d7c9c3cea1 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Mar 2020 16:05:11.8298 (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-CrossTenant-userprincipalname: ZzbTFBxoXf5hVt+I0UN03LZD6cR0NeK6rjKcpoBjmfwCB4/ids292znjM0coCRgCj6ARyIPExs3y7HtITJT16APaX/zgsD1MdINOHgxkazY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3204 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix Rx descriptor status returned value 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" Hi, Didier First, thank you for the patch. If we have a look at the description of rte_eth_rx_queue_count(): "Get the = number of used descriptors of a rx queue". It means the DPDK generic descriptors, not PMD specific ones. "DPDK descrip= tor" means the entity which can handle one packet. rte_eth_rx_queue_count() should return the potential number of packets coul= d be fetched from the Rx queue on the next rx_burst() call. Application should know anything about PMD descriptors, it must be isolated= . So, rx_queue_count() should return the number of expected packets not hardware entries. That's why the value being returned is compar= ed with elts, not with HW desctriptors. As for -1 - I agree, should be fixed. It seems we have another bug - the Rx queue is created with number of hardw= are descriptors which does not correspond the requested packets in case of multi-segment packets (requested desc is divided by (1< -----Original Message----- > From: dev On Behalf Of Didier Pallard > Sent: Friday, March 13, 2020 11:57 > To: dev@dpdk.org > Cc: stable@dpdk.org > Subject: [dpdk-dev] [PATCH] net/mlx5: fix Rx descriptor status returned v= alue >=20 > Two bugs in rx_queue_count function: > - One entry may contain several segments, so 'used' must be multiplied > by number of segments per entry to properly reflect the queue usage. > - rx_queue_count returns the number of entries used in queue, so it range= s > from 0 to max number of entries in queue, not this number minus > one. >=20 > Fixes: 8788fec1f269 ("net/mlx5: implement descriptor status API") > Cc: stable@dpdk.org > Signed-off-by: Didier Pallard > --- > drivers/net/mlx5/mlx5_rxtx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c = index > 5ac63da8039d..17f80c25443e 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.c > +++ b/drivers/net/mlx5/mlx5_rxtx.c > @@ -500,7 +500,7 @@ rx_queue_count(struct mlx5_rxq_data *rxq) > used +=3D n; > cqe =3D &(*rxq->cqes)[cq_ci & cqe_cnt]; > } > - used =3D RTE_MIN(used, (1U << rxq->elts_n) - 1); > + used =3D RTE_MIN(used * (1 << rxq->sges_n), 1U << rxq->elts_n); > return used; > } >=20 > -- > 2.24.1