From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by dpdk.org (Postfix) with ESMTP id 8ACDB8E7A for ; Tue, 20 Oct 2015 00:06:56 +0200 (CEST) Received: by wicll6 with SMTP id ll6so19240527wic.0 for ; Mon, 19 Oct 2015 15:06:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Z24XhR7apRM3xcUKUWjBHjUiI9Hrq1eD6qw2nb8b7HU=; b=IryUyVPgS7KcsbxYRG/09YC6EUMspu2Y8crAcWpn4K9gfz30OjD80Agyli+M47iBP6 UJ1KLOlPCWSNiUekl/JMbuWWs+cYFpfVDYYIUk7d8oU2Zzk+PoPPVUwOVpkoBr23ldeN dorPVtmu5v5gXKiccdoPYxsl2AIUQgiYLdBGcE6Qnx5EPLzgCp7b3C9c8aXNICuCkswj 9zwWnvjqCc+zDgeRXLflaztAPzDrhNkQQAILlDWh271uyeHNwaVqsQowuIIX3YnHTCos j+B/3wfebNcFZeBU8gZzX+bPFdF8WQPyvRAYof65MqAR7sNFPbd72L9741G/C31dANBe xKRg== X-Gm-Message-State: ALoCoQlPGK8RlhyTZrOMZU1bKA2alanQJpdvcbF39qQK0UD9p7k4Cn7JHWYI0d98S3TJmOEjy7sk X-Received: by 10.194.216.100 with SMTP id op4mr35292407wjc.60.1445292416444; Mon, 19 Oct 2015 15:06:56 -0700 (PDT) Received: from griffon.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id jd7sm42620096wjb.19.2015.10.19.15.06.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 15:06:55 -0700 (PDT) From: Amine Kherbouche To: dev@dpdk.org Date: Tue, 20 Oct 2015 00:06:21 +0200 Message-Id: <1445292384-19815-4-git-send-email-amine.kherbouche@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1445292384-19815-1-git-send-email-amine.kherbouche@6wind.com> References: <1443729293-20753-2-git-send-email-konstantin.ananyev@intel.com> <1445292384-19815-1-git-send-email-amine.kherbouche@6wind.com> Cc: amine.kherbouche@6wind.com Subject: [dpdk-dev] [dpdk-dev, PATCHv6 3/6] virtio: add support for eth_(rxq|txq)_info_get X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Oct 2015 22:06:56 -0000 In the case of virtio, there are many fields in rte_eth_(tx|rxq)_info struct that aren't set in this function because those fields are missed in virtqueue struct. Signed-off-by: Amine Kherbouche --- drivers/net/virtio/virtio_ethdev.c | 28 ++++++++++++++++++++++++++++ drivers/net/virtio/virtio_ethdev.h | 4 ++++ 2 files changed, 32 insertions(+) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 465d3cd..6118913 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -580,6 +580,8 @@ static const struct eth_dev_ops virtio_eth_dev_ops = { .mac_addr_add = virtio_mac_addr_add, .mac_addr_remove = virtio_mac_addr_remove, .mac_addr_set = virtio_mac_addr_set, + .rxq_info_get = virtio_rxq_info_get, + .txq_info_get = virtio_txq_info_get, }; static inline int @@ -1574,4 +1576,30 @@ static struct rte_driver rte_virtio_driver = { .init = rte_virtio_pmd_init, }; +void +virtio_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_rxq_info *qinfo) +{ + struct virtqueue *rxq; + + rxq = dev->data->rx_queues[queue_id]; + + qinfo->nb_desc = rxq->vq_nentries; + qinfo->used_desc = rxq->vq_nentries - rxq->vq_free_cnt; + qinfo->free_desc= rxq->vq_free_cnt; +} + +void +virtio_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_txq_info *qinfo) +{ + struct virtqueue *txq; + + txq = dev->data->tx_queues[queue_id]; + + qinfo->nb_desc = txq->vq_nentries; + qinfo->used_desc = txq->vq_nentries - txq->vq_free_cnt; + qinfo->free_desc= txq->vq_free_cnt; +} + PMD_REGISTER_DRIVER(rte_virtio_driver); diff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h index 9026d42..1bbe421 100644 --- a/drivers/net/virtio/virtio_ethdev.h +++ b/drivers/net/virtio/virtio_ethdev.h @@ -107,7 +107,11 @@ uint16_t virtio_recv_mergeable_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); +void virtio_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_rxq_info *qinfo); +void virtio_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_txq_info *qinfo); /* * The VIRTIO_NET_F_GUEST_TSO[46] features permit the host to send us -- 1.7.10.4