From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <johndale@cisco.com>
Received: from rcdn-iport-7.cisco.com (rcdn-iport-7.cisco.com [173.37.86.78])
 by dpdk.org (Postfix) with ESMTP id C808220BD
 for <dev@dpdk.org>; Tue,  6 Mar 2018 02:46:41 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=cisco.com; i=@cisco.com; l=4230; q=dns/txt; s=iport;
 t=1520300801; x=1521510401;
 h=from:to:cc:subject:date:message-id:in-reply-to: references;
 bh=eOctib7dhCfdphJxAgCbzKaXONxx5z6vA1tJU7K6Sgg=;
 b=J42CL3p554KRCTedDBMktwHRLpaV97lPlcP8WM71IwD+eCaMtVcdxGw5
 /OgHwku/8gkb+VFpJei3j25C7wAcfKKKKw6na+HX2G4ntWcg91R5FRlYk
 54B9TxMw7C3oCSqx+6SL2OMh4DkCLc608RKDNE2h+ZYwZXYQme9PEXQnY A=;
X-IronPort-AV: E=Sophos;i="5.47,429,1515456000"; d="scan'208";a="362189303"
Received: from alln-core-6.cisco.com ([173.36.13.139])
 by rcdn-iport-7.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 06 Mar 2018 01:46:40 +0000
Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48])
 by alln-core-6.cisco.com (8.14.5/8.14.5) with ESMTP id w261keQj012188;
 Tue, 6 Mar 2018 01:46:40 GMT
Received: by cisco.com (Postfix, from userid 392789)
 id 5B7AB20F2006; Mon,  5 Mar 2018 17:46:40 -0800 (PST)
From: John Daley <johndale@cisco.com>
To: ferruh.yigit@intel.com
Cc: dev@dpdk.org, Hyong Youb Kim <hyonkim@cisco.com>
Date: Mon,  5 Mar 2018 17:46:29 -0800
Message-Id: <20180306014634.28398-6-johndale@cisco.com>
X-Mailer: git-send-email 2.16.2
In-Reply-To: <20180306014634.28398-1-johndale@cisco.com>
References: <20180224191748.20908-10-johndale@cisco.com>
 <20180306014634.28398-1-johndale@cisco.com>
Subject: [dpdk-dev] [PATCH v2 05/10] net/enic: add Rx/Tx queue configuration
	getters
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 06 Mar 2018 01:46:42 -0000

From: Hyong Youb Kim <hyonkim@cisco.com>

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
---
 drivers/net/enic/enic_ethdev.c | 76 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 65 insertions(+), 11 deletions(-)

diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index e5523e311..6dd72729e 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -39,6 +39,19 @@ static const struct rte_pci_id pci_id_enic_map[] = {
 	{.vendor_id = 0, /* sentinel */},
 };
 
+#define ENIC_TX_OFFLOAD_CAPA (			\
+		DEV_TX_OFFLOAD_VLAN_INSERT |	\
+		DEV_TX_OFFLOAD_IPV4_CKSUM  |	\
+		DEV_TX_OFFLOAD_UDP_CKSUM   |	\
+		DEV_TX_OFFLOAD_TCP_CKSUM   |	\
+		DEV_TX_OFFLOAD_TCP_TSO)
+
+#define ENIC_RX_OFFLOAD_CAPA (			\
+		DEV_RX_OFFLOAD_VLAN_STRIP |	\
+		DEV_RX_OFFLOAD_IPV4_CKSUM |	\
+		DEV_RX_OFFLOAD_UDP_CKSUM  |	\
+		DEV_RX_OFFLOAD_TCP_CKSUM)
+
 RTE_INIT(enicpmd_init_log);
 static void
 enicpmd_init_log(void)
@@ -473,17 +486,8 @@ static void enicpmd_dev_info_get(struct rte_eth_dev *eth_dev,
 	 */
 	device_info->max_rx_pktlen = enic_mtu_to_max_rx_pktlen(enic->max_mtu);
 	device_info->max_mac_addrs = ENIC_MAX_MAC_ADDR;
-	device_info->rx_offload_capa =
-		DEV_RX_OFFLOAD_VLAN_STRIP |
-		DEV_RX_OFFLOAD_IPV4_CKSUM |
-		DEV_RX_OFFLOAD_UDP_CKSUM  |
-		DEV_RX_OFFLOAD_TCP_CKSUM;
-	device_info->tx_offload_capa =
-		DEV_TX_OFFLOAD_VLAN_INSERT |
-		DEV_TX_OFFLOAD_IPV4_CKSUM  |
-		DEV_TX_OFFLOAD_UDP_CKSUM   |
-		DEV_TX_OFFLOAD_TCP_CKSUM   |
-		DEV_TX_OFFLOAD_TCP_TSO;
+	device_info->rx_offload_capa = ENIC_RX_OFFLOAD_CAPA;
+	device_info->tx_offload_capa = ENIC_TX_OFFLOAD_CAPA;
 	device_info->default_rxconf = (struct rte_eth_rxconf) {
 		.rx_free_thresh = ENIC_DEFAULT_RX_FREE_THRESH
 	};
@@ -686,6 +690,54 @@ static int enicpmd_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
+static void enicpmd_dev_rxq_info_get(struct rte_eth_dev *dev,
+				     uint16_t rx_queue_id,
+				     struct rte_eth_rxq_info *qinfo)
+{
+	struct enic *enic = pmd_priv(dev);
+	struct vnic_rq *rq_sop;
+	struct vnic_rq *rq_data;
+	struct rte_eth_rxconf *conf;
+	uint16_t sop_queue_idx;
+	uint16_t data_queue_idx;
+
+	ENICPMD_FUNC_TRACE();
+	sop_queue_idx = enic_rte_rq_idx_to_sop_idx(rx_queue_id);
+	data_queue_idx = enic_rte_rq_idx_to_data_idx(rx_queue_id);
+	rq_sop = &enic->rq[sop_queue_idx];
+	rq_data = &enic->rq[data_queue_idx]; /* valid if data_queue_enable */
+	qinfo->mp = rq_sop->mp;
+	qinfo->scattered_rx = rq_sop->data_queue_enable;
+	qinfo->nb_desc = rq_sop->ring.desc_count;
+	if (qinfo->scattered_rx)
+		qinfo->nb_desc += rq_data->ring.desc_count;
+	conf = &qinfo->conf;
+	memset(conf, 0, sizeof(*conf));
+	conf->rx_free_thresh = rq_sop->rx_free_thresh;
+	conf->rx_drop_en = 1;
+	/*
+	 * Except VLAN stripping (port setting), all the checksum offloads
+	 * are always enabled.
+	 */
+	conf->offloads = ENIC_RX_OFFLOAD_CAPA;
+	if (!enic->ig_vlan_strip_en)
+		conf->offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
+	/* rx_thresh and other fields are not applicable for enic */
+}
+
+static void enicpmd_dev_txq_info_get(struct rte_eth_dev *dev,
+				     __rte_unused uint16_t tx_queue_id,
+				     struct rte_eth_txq_info *qinfo)
+{
+	struct enic *enic = pmd_priv(dev);
+
+	ENICPMD_FUNC_TRACE();
+	qinfo->nb_desc = enic->config.wq_desc_count;
+	memset(&qinfo->conf, 0, sizeof(qinfo->conf));
+	qinfo->conf.offloads = ENIC_TX_OFFLOAD_CAPA; /* not configurable */
+	/* tx_thresh, and all the other fields are not applicable for enic */
+}
+
 static const struct eth_dev_ops enicpmd_eth_dev_ops = {
 	.dev_configure        = enicpmd_dev_configure,
 	.dev_start            = enicpmd_dev_start,
@@ -718,6 +770,8 @@ static const struct eth_dev_ops enicpmd_eth_dev_ops = {
 	.rx_descriptor_done   = NULL,
 	.tx_queue_setup       = enicpmd_dev_tx_queue_setup,
 	.tx_queue_release     = enicpmd_dev_tx_queue_release,
+	.rxq_info_get         = enicpmd_dev_rxq_info_get,
+	.txq_info_get         = enicpmd_dev_txq_info_get,
 	.dev_led_on           = NULL,
 	.dev_led_off          = NULL,
 	.flow_ctrl_get        = NULL,
-- 
2.16.2