From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id CCFDDA0545;
	Tue, 20 Dec 2022 21:03:12 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 8222C40698;
	Tue, 20 Dec 2022 21:03:12 +0100 (CET)
Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com
 [67.231.148.174])
 by mails.dpdk.org (Postfix) with ESMTP id 9F51240684
 for <dev@dpdk.org>; Tue, 20 Dec 2022 21:03:11 +0100 (CET)
Received: from pps.filterd (m0045849.ppops.net [127.0.0.1])
 by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id
 2BKHPRDx015534; Tue, 20 Dec 2022 12:03:08 -0800
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding : content-type; s=pfpt0220;
 bh=tIMZEaDYEnH7qsbtk5jl4U8TJiGG7qMIHMviu0LDwcM=;
 b=b/Sa7nlSGm6k51UkLAY+qx/10eA7iG4SAW+JNjStNv08Wu1zSf5f8BRTSb/dLMkpy9UZ
 Go9tm33MtPHrFgMo9L8rC1kVoyutp+JxGNCjk5HIabG8a0gYy69QsiquIadH+uA8ba3Q
 PJSxqyYGD2IsoWhc/zZd82x7i19PG03N5ITSGVn3n0lcxgkmLQAOgA4hKqq4NZ4hM62r
 E/hxL2+H0BDdCYqvZFCgmTnDIfPt5CAwWPOZ+/2MCJN9h9nTkrDDGHhuG+FUWPG/oGDW
 w7k6C52r1nI2M/7XvnUDpBxEsWF09nPW0LsmZOIgklgyhSvBqC7yqFkmCdxmmfJcZxlA kA== 
Received: from dc5-exch02.marvell.com ([199.233.59.182])
 by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3mkapj2ye1-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Tue, 20 Dec 2022 12:03:08 -0800
Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42;
 Tue, 20 Dec 2022 12:03:06 -0800
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.42 via Frontend
 Transport; Tue, 20 Dec 2022 12:03:06 -0800
Received: from localhost.localdomain (unknown [10.28.36.155])
 by maili.marvell.com (Postfix) with ESMTP id 5DE523F7063;
 Tue, 20 Dec 2022 12:03:04 -0800 (PST)
From: Hanumanth Pothula <hpothula@marvell.com>
To: Thomas Monjalon <thomas@monjalon.net>, Ferruh Yigit <ferruh.yigit@amd.com>,
 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
CC: <dev@dpdk.org>, <viacheslavo@nvidia.com>, <jerinj@marvell.com>,
 <ndabilpuram@marvell.com>, <hpothula@marvell.com>
Subject: [PATCH v4 1/2] ethdev: control Rx metadata negotiation
Date: Wed, 21 Dec 2022 01:32:49 +0530
Message-ID: <20221220200250.2413443-1-hpothula@marvell.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20221006183522.1330826-1-hpothula@marvell.com>
References: <20221006183522.1330826-1-hpothula@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-ORIG-GUID: C2MjTBh3SKoFnZitJNHbbfJbaJJOuihQ
X-Proofpoint-GUID: C2MjTBh3SKoFnZitJNHbbfJbaJJOuihQ
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1
 definitions=2022-12-20_06,2022-12-20_01,2022-06-22_01
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Presently, Rx metadata is sent to PMD by default, leading
to a performance drop as processing for the same in Rx path
takes extra cycles.

Hence, adding a new eth port configuration filed,
'nic_to_pmd_rx_metadata', to control NIC to PMD Rx metadata
negotiation.

Also, reset dev_configured flag as part of device reset, this helps
in reconfiguring porting cleanly. Rx metadata negotiation,
rte_eth_rx_metadata_negotiate(), is allowed only when dev_configured
flag is reset.

Signed-off-by: Hanumanth Pothula <hpothula@marvell.com>
---
v4:
 - As per spec rte_eth_rx_metadata_negotiate() is processed only when
   dev_configured is set. Hence can't enable automatically when a flow
   command requests metadata.
 - Add new testpmd command to allow NIC to PMD Rx metadata negotiation.
v3:
 - Updated run_app.rst with the new command line argument,
   nic-to-pmd-rx-metadata.
 - Updated commit text.
v2:
 - taken cared alignment issues
 - renamed command line argument from rx-metadata to nic-to-pmd-rx-metadata
 - renamed variable name from rx-metadata to nic_to_pmd_rx_metadata
---
 lib/ethdev/rte_ethdev.c | 2 ++
 lib/ethdev/rte_ethdev.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 5d5e18db1e..18c59044bc 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1629,6 +1629,8 @@ rte_eth_dev_reset(uint16_t port_id)
 			port_id, rte_strerror(-ret));
 	}
 	ret = dev->dev_ops->dev_reset(dev);
+	if (!ret)
+		dev->data->dev_configured = 0;
 
 	return eth_err(port_id, ret);
 }
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index c129ca1eaf..f1160a8aca 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -1487,6 +1487,7 @@ struct rte_eth_conf {
 	    is needed,and the variable must be set RTE_ETH_DCB_PFC_SUPPORT. */
 	uint32_t dcb_capability_en;
 	struct rte_eth_intr_conf intr_conf; /**< Interrupt mode configuration. */
+	uint8_t nic_to_pmd_rx_metadata; /**< send rx metadata to PMD. */
 };
 
 /**
-- 
2.25.1