From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alln-iport-1.cisco.com (alln-iport-1.cisco.com [173.37.142.88]) by dpdk.org (Postfix) with ESMTP id 50ACB7CC2 for ; Thu, 8 Mar 2018 03:49:55 +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=1520477395; x=1521686995; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=eOctib7dhCfdphJxAgCbzKaXONxx5z6vA1tJU7K6Sgg=; b=aMFtjypsCnAvPR0Fi6jGoddY3oAGETtNGygZdQEdhfkHVvfG8aYpsRai 0XHWTDxfymI1i5UxGvkU4YBrXctOMiYy0C0MSue739pt6rDerjSi/DYH5 D3ERoXgBsDWROqfZG9Thef0tV3V2Gio1/QeZQF8nmC2NfGU30i6Kc1/Lo 8=; X-IronPort-AV: E=Sophos;i="5.47,438,1515456000"; d="scan'208";a="80854746" Received: from alln-core-5.cisco.com ([173.36.13.138]) by alln-iport-1.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Mar 2018 02:49:54 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-5.cisco.com (8.14.5/8.14.5) with ESMTP id w282nsv3031245; Thu, 8 Mar 2018 02:49:54 GMT Received: by cisco.com (Postfix, from userid 392789) id 0898E20F2001; Wed, 7 Mar 2018 18:49:54 -0800 (PST) From: John Daley To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Hyong Youb Kim Date: Wed, 7 Mar 2018 18:46:57 -0800 Message-Id: <20180308024702.25974-6-johndale@cisco.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180308024702.25974-1-johndale@cisco.com> References: <20180306014634.28398-2-johndale@cisco.com> <20180308024702.25974-1-johndale@cisco.com> Subject: [dpdk-dev] [PATCH v3 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Mar 2018 02:49:55 -0000 From: Hyong Youb Kim Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- 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