bdev_virtio: removed virtio_rxtx.h header

Change-Id: I1553b86e1cd1b2032931260c26f2d1cb87df2b2b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/375002
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-08-21 15:42:00 +02:00 committed by Jim Harris
parent 0b13fffc12
commit d0a502bc03
8 changed files with 16 additions and 84 deletions

View File

@ -121,10 +121,10 @@ bdev_virtio_rw(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
to_be16(&req->cdb[7], bdev_io->u.write.len / disk->block_size);
}
virtio_xmit_pkts(disk->hw->tx_queues[2], &vreq);
virtio_xmit_pkts(disk->hw->vqs[2], &vreq);
do {
cnt = virtio_recv_pkts(disk->hw->tx_queues[2], &complete, 1);
cnt = virtio_recv_pkts(disk->hw->vqs[2], &complete, 1);
} while (cnt == 0);
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_SUCCESS);
@ -243,10 +243,10 @@ scan_target(struct virtio_hw *hw, uint8_t target)
iov[1].iov_len = sizeof(struct virtio_scsi_cmd_resp);
iov[2].iov_len = 255;
virtio_xmit_pkts(hw->tx_queues[2], &vreq);
virtio_xmit_pkts(hw->vqs[2], &vreq);
do {
cnt = virtio_recv_pkts(hw->tx_queues[2], &complete, 1);
cnt = virtio_recv_pkts(hw->vqs[2], &complete, 1);
} while (cnt == 0);
if (resp->response != VIRTIO_SCSI_S_OK || resp->status != SPDK_SCSI_STATUS_GOOD) {
@ -265,10 +265,10 @@ scan_target(struct virtio_hw *hw, uint8_t target)
iov[2].iov_len = 32;
to_be32(&req->cdb[10], iov[2].iov_len);
virtio_xmit_pkts(hw->tx_queues[2], &vreq);
virtio_xmit_pkts(hw->vqs[2], &vreq);
do {
cnt = virtio_recv_pkts(hw->tx_queues[2], &complete, 1);
cnt = virtio_recv_pkts(hw->vqs[2], &complete, 1);
} while (cnt == 0);
disk = calloc(1, sizeof(*disk));

View File

@ -57,7 +57,6 @@
#include "virtio_pci.h"
#include "virtio_logs.h"
#include "virtqueue.h"
#include "virtio_rxtx.h"
/*
* The set of PCI devices this driver supports
@ -108,7 +107,6 @@ virtio_init_queue(struct virtio_hw *hw, uint16_t vtpci_queue_idx)
char vq_name[VIRTQUEUE_MAX_NAME_SZ];
const struct rte_memzone *mz = NULL;
unsigned int vq_size, size;
struct virtnet_tx *txvq = NULL;
struct virtqueue *vq;
int ret;
@ -180,10 +178,7 @@ virtio_init_queue(struct virtio_hw *hw, uint16_t vtpci_queue_idx)
virtio_init_vring(vq);
txvq = &vq->txq;
txvq->vq = vq;
txvq->port_id = hw->port_id;
txvq->mz = mz;
vq->mz = mz;
/* For virtio_user case (that is when hw->dev is NULL), we use
* virtual address. And we need properly set _offset_, please see
@ -222,7 +217,7 @@ virtio_free_queues(struct virtio_hw *hw)
if (!vq)
continue;
rte_memzone_free(vq->txq.mz);
rte_memzone_free(vq->mz);
rte_free(vq);
hw->vqs[i] = NULL;
@ -367,7 +362,6 @@ eth_virtio_dev_init(struct virtio_hw *hw, int num_queues)
if (ret < 0)
return ret;
hw->tx_queues = rte_zmalloc("tx_queues", sizeof(hw->tx_queues[0]) * num_queues, RTE_CACHE_LINE_SIZE);
hw->nb_tx_queues = num_queues;
for (i = 0; i < num_queues; i++) {

View File

@ -66,10 +66,10 @@ struct virtio_req {
int virtio_dev_tx_queue_setup(struct virtio_hw *hw, uint16_t tx_queue_id,
uint16_t nb_tx_desc, unsigned int socket_id);
uint16_t virtio_recv_pkts(void *rx_queue, struct virtio_req **reqs,
uint16_t virtio_recv_pkts(struct virtqueue *vq, struct virtio_req **reqs,
uint16_t nb_pkts);
uint16_t virtio_xmit_pkts(void *tx_queue, struct virtio_req *req);
uint16_t virtio_xmit_pkts(struct virtqueue *vq, struct virtio_req *req);
int eth_virtio_dev_init(struct virtio_hw *hw, int num_queues);
int virtio_dev_start(struct virtio_hw *hw);

View File

@ -230,7 +230,6 @@ struct virtio_hw {
void *virtio_user_dev;
struct virtqueue **vqs;
void **tx_queues;
uint32_t nb_tx_queues;
};

View File

@ -47,7 +47,6 @@
#include "virtio_ethdev.h"
#include "virtio_pci.h"
#include "virtqueue.h"
#include "virtio_rxtx.h"
#include "spdk/env.h"
@ -129,10 +128,9 @@ virtqueue_dequeue_burst_rx(struct virtqueue *vq, struct virtio_req **rx_pkts,
} while (0)
static inline void
virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct virtio_req *req)
virtqueue_enqueue_xmit(struct virtqueue *vq, struct virtio_req *req)
{
struct vq_desc_extra *dxp;
struct virtqueue *vq = txvq->vq;
struct vring_desc *start_dp;
uint32_t i;
uint16_t head_idx, idx;
@ -181,28 +179,20 @@ virtio_dev_tx_queue_setup(struct virtio_hw *hw,
unsigned int socket_id __rte_unused)
{
struct virtqueue *vq = hw->vqs[queue_idx];
struct virtnet_tx *txvq;
PMD_INIT_FUNC_TRACE();
if (nb_desc == 0 || nb_desc > vq->vq_nentries)
nb_desc = vq->vq_nentries;
vq->vq_free_cnt = RTE_MIN(vq->vq_free_cnt, nb_desc);
txvq = &vq->txq;
txvq->queue_id = queue_idx;
hw->tx_queues[queue_idx] = txvq;
return 0;
}
#define VIRTIO_MBUF_BURST_SZ 64
#define DESC_PER_CACHELINE (RTE_CACHE_LINE_SIZE / sizeof(struct vring_desc))
uint16_t
virtio_recv_pkts(void *rx_queue, struct virtio_req **reqs, uint16_t nb_pkts)
virtio_recv_pkts(struct virtqueue *vq, struct virtio_req **reqs, uint16_t nb_pkts)
{
struct virtnet_tx *rxvq = rx_queue;
struct virtqueue *vq = rxvq->vq;
struct virtio_hw *hw = vq->hw;
struct virtio_req *rxm;
uint16_t nb_used, num, nb_rx;
@ -240,10 +230,8 @@ virtio_recv_pkts(void *rx_queue, struct virtio_req **reqs, uint16_t nb_pkts)
}
uint16_t
virtio_xmit_pkts(void *tx_queue, struct virtio_req *req)
virtio_xmit_pkts(struct virtqueue *vq, struct virtio_req *req)
{
struct virtnet_tx *txvq = tx_queue;
struct virtqueue *vq = txvq->vq;
struct virtio_hw *hw = vq->hw;
if (unlikely(hw->started == 0))
@ -251,7 +239,7 @@ virtio_xmit_pkts(void *tx_queue, struct virtio_req *req)
virtio_rmb();
virtqueue_enqueue_xmit(txvq, req);
virtqueue_enqueue_xmit(vq, req);
vq_update_avail_idx(vq);

View File

@ -1,46 +0,0 @@
/*-
* BSD LICENSE
*
* Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _VIRTIO_RXTX_H_
#define _VIRTIO_RXTX_H_
struct virtnet_tx {
struct virtqueue *vq;
uint16_t queue_id; /**< DPDK queue index. */
uint8_t port_id; /**< Device port identifier. */
const struct rte_memzone *mz; /**< mem zone to populate TX ring. */
};
#endif /* _VIRTIO_RXTX_H_ */

View File

@ -48,7 +48,6 @@
#include "virtio_logs.h"
#include "virtio_pci.h"
#include "virtqueue.h"
#include "virtio_rxtx.h"
#include "virtio_user/virtio_user_dev.h"
#define virtio_user_get_dev(hw) \

View File

@ -44,7 +44,6 @@
#include "virtio_pci.h"
#include "virtio_ring.h"
#include "virtio_logs.h"
#include "virtio_rxtx.h"
/*
* Per virtio_config.h in Linux.
@ -93,9 +92,7 @@ struct virtqueue {
void *vq_ring_virt_mem; /**< linear address of vring*/
unsigned int vq_ring_size;
union {
struct virtnet_tx txq;
};
const struct rte_memzone *mz; /**< mem zone to populate TX ring. */
phys_addr_t vq_ring_mem; /**< physical address of vring,
* or virtual address for virtio_user. */
@ -109,6 +106,7 @@ struct virtqueue {
uint16_t vq_desc_tail_idx;
uint16_t vq_queue_index; /**< PCI queue index */
uint16_t *notify_addr;
struct vq_desc_extra vq_descx[0];
};