From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EE83C43613 for ; Mon, 24 Jun 2019 11:08:08 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 8BF722089F for ; Mon, 24 Jun 2019 11:08:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="c9tgvqqj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BF722089F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D61C21BE4A; Mon, 24 Jun 2019 13:08:05 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20061.outbound.protection.outlook.com [40.107.2.61]) by dpdk.org (Postfix) with ESMTP id CF6EB1BE45 for ; Mon, 24 Jun 2019 13:08:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Lj7Hzp/RwGcm3+1eJme6pDtziJz4bY5xCGC9Xijhj4M=; b=c9tgvqqjKoBPCUYRE8QOQ2WBT6JmiNyOBIW6bULimgu6Q9aGMrfgZexlaU3hVvS4NDRMfrqPU0f2sB2leYlIEDvigK6lXsR7O2tVvmMN8eJRoRx4z2A/t5IY30x5UNdogHDjxdUOY0na2Cz+5L0C85ut6jLKR3PrLvLk081k3Ig= Received: from AM0PR05MB4388.eurprd05.prod.outlook.com (52.134.94.17) by AM0PR05MB4465.eurprd05.prod.outlook.com (52.134.124.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16; Mon, 24 Jun 2019 11:08:03 +0000 Received: from AM0PR05MB4388.eurprd05.prod.outlook.com ([fe80::5d41:246a:adce:4a30]) by AM0PR05MB4388.eurprd05.prod.outlook.com ([fe80::5d41:246a:adce:4a30%7]) with mapi id 15.20.1987.014; Mon, 24 Jun 2019 11:08:03 +0000 From: Noa Ezra To: Noa Ezra , "maxime.coquelin@redhat.com" , "tiwei.bie@intel.com" , "zhihong.wang@intel.com" CC: Matan Azrad , "dev@dpdk.org" Thread-Topic: [Suspected-Phishing][PATCH] net/vhost: add an API for get queue status Thread-Index: AQHVJmZVUB5QSDfqekyIfFcW/z4u2qaqrRDQ Date: Mon, 24 Jun 2019 11:08:03 +0000 Message-ID: References: <1560924898-221025-1-git-send-email-noae@mellanox.com> In-Reply-To: <1560924898-221025-1-git-send-email-noae@mellanox.com> Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=noae@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d7a7201e-ac69-467e-1ddc-08d6f8943a0d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:AM0PR05MB4465; x-ms-traffictypediagnostic: AM0PR05MB4465: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:556; x-forefront-prvs: 007814487B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(136003)(366004)(376002)(39860400002)(396003)(189003)(199004)(13464003)(45074003)(6246003)(2201001)(4326008)(9686003)(25786009)(14454004)(14444005)(256004)(55016002)(6436002)(76116006)(52536014)(66476007)(53936002)(478600001)(66946007)(73956011)(86362001)(71190400001)(3846002)(6116002)(66556008)(64756008)(66446008)(446003)(486006)(11346002)(476003)(5660300002)(229853002)(71200400001)(110136005)(316002)(54906003)(6506007)(2906002)(76176011)(99286004)(7696005)(68736007)(53546011)(305945005)(8936002)(8676002)(7736002)(33656002)(2501003)(26005)(74316002)(81166006)(81156014)(66066001)(186003)(102836004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4465; H:AM0PR05MB4388.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: a3ULPsYyMsORVSFab83DLTyRFMEdtgBeEkZxdFz8y9KzsF3UpsfsmlznaGpg+IWZKeh5aSMr7O7Z8aq6pynuHqAtLtu/od8Fj2BrYOrExInAkNBhumKzH6IFAMMPUjgo1TjCLVd1v9bdm7r3xU3YEjSIf+fIGzlyd1c1SiklGFe5lusKomjqMelMTd1k6pblDudkXMgvCBHBoheKXqorF8XWGoDBbJIBPcFCmxz4T+GwCOcFZR/O/Gl1ozzBPga54ESjuAofS3MhTwcrBxFfRuk2TIM0LlXvUB4BoIjNbsObprsbZvKdCJoGb+AAgOAfHsriJvTfR91FDK/8x9/WDRnxhds0x8vUIlF18gI38NNdHCZ11FdtjKn9TRndUknTUTboxIIoCO1jUbzmQh1n4sFHl4UeJ+CdMn6LL9yMgiU= 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: d7a7201e-ac69-467e-1ddc-08d6f8943a0d X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jun 2019 11:08:03.0441 (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: noae@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4465 Subject: Re: [dpdk-dev] [Suspected-Phishing][PATCH] net/vhost: add an API for get queue status 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, What do you say about this patch? Thanks, Noa. > -----Original Message----- > From: Noa Ezra [mailto:noae@mellanox.com] > Sent: Wednesday, June 19, 2019 9:15 AM > To: maxime.coquelin@redhat.com > Cc: Matan Azrad ; dev@dpdk.org; Noa Ezra > > Subject: [Suspected-Phishing][PATCH] net/vhost: add an API for get queue > status >=20 > Add an API that returns queue status for requested queue in the port. > The queue's status can be changed before the user has signed for the queu= e > state event interrupt. In this case the user can't know the current queue= 's > status. This API returns the current status. >=20 > Signed-off-by: Noa Ezra > Reviewed-by: Matan Azrad > --- > drivers/net/vhost/rte_eth_vhost.c | 47 > +++++++++++++++++++++++++++++ > drivers/net/vhost/rte_eth_vhost.h | 18 +++++++++++ > drivers/net/vhost/rte_pmd_vhost_version.map | 6 ++++ > 3 files changed, 71 insertions(+) >=20 > diff --git a/drivers/net/vhost/rte_eth_vhost.c > b/drivers/net/vhost/rte_eth_vhost.c > index 9a54020..cad1e5c 100644 > --- a/drivers/net/vhost/rte_eth_vhost.c > +++ b/drivers/net/vhost/rte_eth_vhost.c > @@ -855,6 +855,7 @@ struct vhost_xstats_name_off { > /* won't be NULL */ > state =3D vring_states[eth_dev->data->port_id]; > rte_spinlock_lock(&state->lock); > + > state->cur[vring] =3D enable; > state->max_vring =3D RTE_MAX(vring, state->max_vring); > rte_spinlock_unlock(&state->lock); > @@ -874,6 +875,52 @@ struct vhost_xstats_name_off { }; >=20 > int > +rte_eth_vhost_get_queue_status(uint16_t port_id, bool rx, uint16_t > queue_id, > + bool *queue_status) > +{ > + struct rte_vhost_vring_state *state; > + struct internal_list *list; > + struct rte_eth_dev *eth_dev; > + int found =3D 0; > + uint16_t nb_q =3D 0; > + > + if (port_id >=3D RTE_MAX_ETHPORTS) { > + VHOST_LOG(ERR, "Invalid port id\n"); > + return -1; > + } > + TAILQ_FOREACH(list, &internal_list, next) { > + eth_dev =3D list->eth_dev; > + if (eth_dev->data->port_id =3D=3D port_id) { > + nb_q =3D rx ? eth_dev->data->nb_rx_queues : > + eth_dev->data->nb_tx_queues; > + found =3D 1; > + break; > + } > + } > + if (!found) { > + VHOST_LOG(ERR, "No device found for port id %u\n", > port_id); > + return -1; > + } > + if (queue_id >=3D nb_q) { > + VHOST_LOG(ERR, "Invalid queue id\n"); > + return -1; > + } > + > + state =3D vring_states[port_id]; > + if (!state) { > + VHOST_LOG(ERR, "Unused port\n"); > + return -1; > + } > + > + rte_spinlock_lock(&state->lock); > + *queue_status =3D rx ? state->cur[queue_id * 2 + 1] : > + state->cur[queue_id * 2]; > + rte_spinlock_unlock(&state->lock); > + > + return 0; > +} > + > +int > rte_eth_vhost_get_queue_event(uint16_t port_id, > struct rte_eth_vhost_queue_event *event) { diff --git > a/drivers/net/vhost/rte_eth_vhost.h b/drivers/net/vhost/rte_eth_vhost.h > index 0e68b9f..1e65c69 100644 > --- a/drivers/net/vhost/rte_eth_vhost.h > +++ b/drivers/net/vhost/rte_eth_vhost.h > @@ -44,6 +44,24 @@ int rte_eth_vhost_get_queue_event(uint16_t port_id, > struct rte_eth_vhost_queue_event *event); >=20 > /** > + * Get queue status for specific queue in the port. > + * > + * @param[in] port_id > + * Port id. > + * @param[in] rx > + * True is rx, False if tx > + * @paran[in] queue_id > + * Queue_id > + * @param[out] queue_status > + * Pointer to a boolean, True is enable, False if disable. > + * @return > + * - On success, zero, queue_status is updated. > + * - On failure, a negative value, queue_status is not updated. > + */ > +int rte_eth_vhost_get_queue_status(uint16_t port_id, bool rx, uint16_t > queue_id, > + bool *queue_status); > + > +/** > * Get the 'vid' value associated with the specified port. > * > * @return > diff --git a/drivers/net/vhost/rte_pmd_vhost_version.map > b/drivers/net/vhost/rte_pmd_vhost_version.map > index 695db85..1eabfd2 100644 > --- a/drivers/net/vhost/rte_pmd_vhost_version.map > +++ b/drivers/net/vhost/rte_pmd_vhost_version.map > @@ -11,3 +11,9 @@ DPDK_16.11 { >=20 > rte_eth_vhost_get_vid_from_port_id; > }; > + > +DPDK_19.08 { > + global: > + > + rte_eth_vhost_get_queue_status; > +}; > -- > 1.8.3.1