rte_virtio: reformat with check_format.sh

Remove the exclusion of the rte_virtio code from scripts/check_format.sh
since we will be maintaining this code going forward (unlike rte_vhost,
which we intend to keep up to date with upstream DPDK).

Change-Id: I30c186e566ca777dff552a36af53443d197a8824
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383002
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2017-10-18 10:06:51 -07:00 committed by Jim Harris
parent 44a3f09b15
commit 94678ad9ee
9 changed files with 41 additions and 41 deletions

View File

@ -117,8 +117,8 @@ virtio_init_queue(struct virtio_dev *dev, uint16_t vtpci_queue_idx)
dev->id, vtpci_queue_idx);
size = RTE_ALIGN_CEIL(sizeof(*vq) +
vq_size * sizeof(struct vq_desc_extra),
RTE_CACHE_LINE_SIZE);
vq_size * sizeof(struct vq_desc_extra),
RTE_CACHE_LINE_SIZE);
vq = rte_zmalloc_socket(vq_name, size, RTE_CACHE_LINE_SIZE,
SOCKET_ID_ANY);
@ -138,7 +138,7 @@ virtio_init_queue(struct virtio_dev *dev, uint16_t vtpci_queue_idx)
size = vring_size(vq_size, VIRTIO_PCI_VRING_ALIGN);
vq->vq_ring_size = RTE_ALIGN_CEIL(size, VIRTIO_PCI_VRING_ALIGN);
SPDK_DEBUGLOG(SPDK_TRACE_VIRTIO_DEV, "vring_size: %u, rounded_vring_size: %u\n",
size, vq->vq_ring_size);
size, vq->vq_ring_size);
mz = rte_memzone_reserve_aligned(vq_name, vq->vq_ring_size,
SOCKET_ID_ANY,
@ -157,9 +157,9 @@ virtio_init_queue(struct virtio_dev *dev, uint16_t vtpci_queue_idx)
vq->vq_ring_mem = mz->phys_addr;
vq->vq_ring_virt_mem = mz->addr;
SPDK_DEBUGLOG(SPDK_TRACE_VIRTIO_DEV, "vq->vq_ring_mem: 0x%" PRIx64 "\n",
(uint64_t)mz->phys_addr);
(uint64_t)mz->phys_addr);
SPDK_DEBUGLOG(SPDK_TRACE_VIRTIO_DEV, "vq->vq_ring_virt_mem: 0x%" PRIx64 "\n",
(uint64_t)(uintptr_t)mz->addr);
(uint64_t)(uintptr_t)mz->addr);
virtio_init_vring(vq);

View File

@ -163,7 +163,7 @@ struct virtio_req {
1ULL << VIRTIO_F_VERSION_1)
uint16_t virtio_recv_pkts(struct virtqueue *vq, struct virtio_req **reqs,
uint16_t nb_pkts);
uint16_t nb_pkts);
/**
* Put given request into the virtqueue. The virtio device owning

View File

@ -63,7 +63,7 @@ check_vq_phys_addr_ok(struct virtqueue *vq)
* Check if the allocated physical memory exceeds 16TB.
*/
if ((vq->vq_ring_mem + vq->vq_ring_size - 1) >>
(VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32)) {
(VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32)) {
SPDK_ERRLOG("vring address shouldn't be above 16TB!\n");
return 0;
}
@ -133,7 +133,7 @@ legacy_read_dev_config(struct virtio_dev *dev, size_t offset,
struct virtio_hw *hw = virtio_dev_get_hw(dev);
rte_pci_ioport_read(vtpci_io(dev), dst, length,
VIRTIO_PCI_CONFIG_OFF(hw->use_msix) + offset);
VIRTIO_PCI_CONFIG_OFF(hw->use_msix) + offset);
}
static void
@ -143,7 +143,7 @@ legacy_write_dev_config(struct virtio_dev *dev, size_t offset,
struct virtio_hw *hw = virtio_dev_get_hw(dev);
rte_pci_ioport_write(vtpci_io(dev), src, length,
VIRTIO_PCI_CONFIG_OFF(hw->use_msix) + offset);
VIRTIO_PCI_CONFIG_OFF(hw->use_msix) + offset);
}
static uint64_t
@ -163,7 +163,7 @@ legacy_set_features(struct virtio_dev *dev, uint64_t features)
return -1;
}
rte_pci_ioport_write(vtpci_io(dev), &features, 4,
VIRTIO_PCI_GUEST_FEATURES);
VIRTIO_PCI_GUEST_FEATURES);
dev->negotiated_features = features;
return 0;
@ -210,7 +210,7 @@ legacy_set_queue_irq(struct virtio_dev *dev, struct virtqueue *vq, uint16_t vec)
uint16_t dst;
rte_pci_ioport_write(vtpci_io(dev), &vq->vq_queue_index, 2,
VIRTIO_PCI_QUEUE_SEL);
VIRTIO_PCI_QUEUE_SEL);
rte_pci_ioport_write(vtpci_io(dev), &vec, 2, VIRTIO_MSI_QUEUE_VECTOR);
rte_pci_ioport_read(vtpci_io(dev), &dst, 2, VIRTIO_MSI_QUEUE_VECTOR);
return dst;
@ -235,7 +235,7 @@ legacy_setup_queue(struct virtio_dev *dev, struct virtqueue *vq)
return -1;
rte_pci_ioport_write(vtpci_io(dev), &vq->vq_queue_index, 2,
VIRTIO_PCI_QUEUE_SEL);
VIRTIO_PCI_QUEUE_SEL);
src = vq->vq_ring_mem >> VIRTIO_PCI_QUEUE_ADDR_SHIFT;
rte_pci_ioport_write(vtpci_io(dev), &src, 4, VIRTIO_PCI_QUEUE_PFN);
@ -248,7 +248,7 @@ legacy_del_queue(struct virtio_dev *dev, struct virtqueue *vq)
uint32_t src = 0;
rte_pci_ioport_write(vtpci_io(dev), &vq->vq_queue_index, 2,
VIRTIO_PCI_QUEUE_SEL);
VIRTIO_PCI_QUEUE_SEL);
rte_pci_ioport_write(vtpci_io(dev), &src, 4, VIRTIO_PCI_QUEUE_PFN);
}
@ -256,7 +256,7 @@ static void
legacy_notify_queue(struct virtio_dev *dev, struct virtqueue *vq)
{
rte_pci_ioport_write(vtpci_io(dev), &vq->vq_queue_index, 2,
VIRTIO_PCI_QUEUE_NOTIFY);
VIRTIO_PCI_QUEUE_NOTIFY);
}
const struct virtio_pci_ops legacy_ops = {
@ -419,21 +419,21 @@ modern_setup_queue(struct virtio_dev *dev, struct virtqueue *vq)
desc_addr = vq->vq_ring_mem;
avail_addr = desc_addr + vq->vq_nentries * sizeof(struct vring_desc);
used_addr = RTE_ALIGN_CEIL(avail_addr + offsetof(struct vring_avail,
ring[vq->vq_nentries]),
ring[vq->vq_nentries]),
VIRTIO_PCI_VRING_ALIGN);
spdk_mmio_write_2(&hw->common_cfg->queue_select, vq->vq_queue_index);
io_write64_twopart(desc_addr, &hw->common_cfg->queue_desc_lo,
&hw->common_cfg->queue_desc_hi);
&hw->common_cfg->queue_desc_hi);
io_write64_twopart(avail_addr, &hw->common_cfg->queue_avail_lo,
&hw->common_cfg->queue_avail_hi);
&hw->common_cfg->queue_avail_hi);
io_write64_twopart(used_addr, &hw->common_cfg->queue_used_lo,
&hw->common_cfg->queue_used_hi);
&hw->common_cfg->queue_used_hi);
notify_off = spdk_mmio_read_2(&hw->common_cfg->queue_notify_off);
vq->notify_addr = (void *)((uint8_t *)hw->notify_base +
notify_off * hw->notify_off_multiplier);
notify_off * hw->notify_off_multiplier);
spdk_mmio_write_2(&hw->common_cfg->queue_enable, 1);
@ -442,7 +442,7 @@ modern_setup_queue(struct virtio_dev *dev, struct virtqueue *vq)
SPDK_DEBUGLOG(SPDK_TRACE_VIRTIO_PCI, "\t aval_addr: %" PRIx64 "\n", avail_addr);
SPDK_DEBUGLOG(SPDK_TRACE_VIRTIO_PCI, "\t used_addr: %" PRIx64 "\n", used_addr);
SPDK_DEBUGLOG(SPDK_TRACE_VIRTIO_PCI, "\t notify addr: %p (notify offset: %"PRIu16")\n",
vq->notify_addr, notify_off);
vq->notify_addr, notify_off);
return 0;
}
@ -455,11 +455,11 @@ modern_del_queue(struct virtio_dev *dev, struct virtqueue *vq)
spdk_mmio_write_2(&hw->common_cfg->queue_select, vq->vq_queue_index);
io_write64_twopart(0, &hw->common_cfg->queue_desc_lo,
&hw->common_cfg->queue_desc_hi);
&hw->common_cfg->queue_desc_hi);
io_write64_twopart(0, &hw->common_cfg->queue_avail_lo,
&hw->common_cfg->queue_avail_hi);
&hw->common_cfg->queue_avail_hi);
io_write64_twopart(0, &hw->common_cfg->queue_used_lo,
&hw->common_cfg->queue_used_hi);
&hw->common_cfg->queue_used_hi);
spdk_mmio_write_2(&hw->common_cfg->queue_enable, 0);
}
@ -552,7 +552,7 @@ get_cfg_addr(struct virtio_hw *hw, struct virtio_pci_cap *cap)
if (offset + length < offset) {
SPDK_ERRLOG("offset(%"PRIu32") + length(%"PRIu32") overflows\n",
offset, length);
offset, length);
return NULL;
}
@ -610,7 +610,7 @@ virtio_read_caps(struct virtio_hw *hw)
break;
case VIRTIO_PCI_CAP_NOTIFY_CFG:
spdk_pci_device_cfg_read(hw->pci_dev, &hw->notify_off_multiplier,
4, pos + sizeof(cap));
4, pos + sizeof(cap));
hw->notify_base = get_cfg_addr(hw, &cap);
break;
case VIRTIO_PCI_CAP_DEVICE_CFG:
@ -637,7 +637,7 @@ next:
SPDK_DEBUGLOG(SPDK_TRACE_VIRTIO_PCI, "device cfg mapped at: %p\n", hw->dev_cfg);
SPDK_DEBUGLOG(SPDK_TRACE_VIRTIO_PCI, "isr cfg mapped at: %p\n", hw->isr);
SPDK_DEBUGLOG(SPDK_TRACE_VIRTIO_PCI, "notify base: %p, notify off multiplier: %u\n",
hw->notify_base, hw->notify_off_multiplier);
hw->notify_base, hw->notify_off_multiplier);
return 0;
}
@ -706,9 +706,9 @@ pci_enum_virtio_probe_cb(void *ctx, struct spdk_pci_device *pci_dev)
if (dev->kdrv == RTE_KDRV_UNKNOWN &&
(!dev->device.devargs ||
dev->device.devargs->type !=
RTE_DEVTYPE_WHITELISTED_PCI)) {
RTE_DEVTYPE_WHITELISTED_PCI)) {
PMD_INIT_LOG(INFO,
"skip kernel managed virtio device.");
"skip kernel managed virtio device.");
return 1;
}
return -1;

View File

@ -65,7 +65,7 @@ struct virtio_pci_ops {
void (*write_dev_cfg)(struct virtio_dev *hw, size_t offset,
const void *src, int len);
uint8_t (*get_status)(struct virtio_dev *hw);
void (*set_status)(struct virtio_dev *hw, uint8_t status);
void (*set_status)(struct virtio_dev *hw, uint8_t status);
/**
* Get device features. The features might be already
@ -78,7 +78,7 @@ struct virtio_pci_ops {
* The negotiation can fail with return code -1.
* This function should also set vdev->negotiated_features field.
*/
int (*set_features)(struct virtio_dev *vdev, uint64_t features);
int (*set_features)(struct virtio_dev *vdev, uint64_t features);
uint8_t (*get_isr)(struct virtio_dev *hw);
@ -87,7 +87,7 @@ struct virtio_pci_ops {
/** Deinit and free virtio device */
void (*free_vdev)(struct virtio_dev *vdev);
uint16_t (*set_queue_irq)(struct virtio_dev *hw, struct virtqueue *vq,
uint16_t vec);
uint16_t vec);
uint16_t (*get_queue_num)(struct virtio_dev *hw, uint16_t queue_id);
int (*setup_queue)(struct virtio_dev *hw, struct virtqueue *vq);

View File

@ -56,14 +56,14 @@
static void
virtio_user_read_dev_config(struct virtio_dev *vdev, size_t offset,
void *dst, int length)
void *dst, int length)
{
SPDK_ERRLOG("not supported offset=%zu, len=%d\n", offset, length);
}
static void
virtio_user_write_dev_config(struct virtio_dev *vdev, size_t offset,
const void *src, int length)
const void *src, int length)
{
SPDK_ERRLOG("not supported offset=%zu, len=%d\n", offset, length);
}
@ -76,7 +76,7 @@ virtio_user_set_status(struct virtio_dev *vdev, uint8_t status)
if (status & VIRTIO_CONFIG_S_DRIVER_OK) {
virtio_user_start_device(dev);
} else if (status == VIRTIO_CONFIG_S_RESET &&
(dev->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
(dev->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
virtio_user_stop_device(dev);
}
dev->status = status;
@ -201,7 +201,7 @@ virtio_user_setup_queue(struct virtio_dev *vdev, struct virtqueue *vq)
desc_addr = (uintptr_t)vq->vq_ring_virt_mem;
avail_addr = desc_addr + vq->vq_nentries * sizeof(struct vring_desc);
used_addr = RTE_ALIGN_CEIL(avail_addr + offsetof(struct vring_avail,
ring[vq->vq_nentries]),
ring[vq->vq_nentries]),
VIRTIO_PCI_VRING_ALIGN);
dev->vrings[queue_idx].num = vq->vq_nentries;

View File

@ -96,7 +96,7 @@ enum vhost_user_request {
VHOST_USER_MAX
};
extern const char * const vhost_msg_strings[VHOST_USER_MAX];
extern const char *const vhost_msg_strings[VHOST_USER_MAX];
struct vhost_memory_region {
uint64_t guest_phys_addr;

View File

@ -125,7 +125,7 @@ vhost_user_read(int fd, struct vhost_user_msg *msg)
ret = recv(fd, (void *)msg, sz_hdr, 0);
if (ret < sz_hdr) {
SPDK_WARNLOG("Failed to recv msg hdr: %d instead of %d.\n",
ret, sz_hdr);
ret, sz_hdr);
goto fail;
}
@ -261,7 +261,7 @@ prepare_vhost_memory_user(struct vhost_user_msg *msg, int fds[])
static struct vhost_user_msg m;
const char * const vhost_msg_strings[] = {
const char *const vhost_msg_strings[] = {
[VHOST_USER_SET_OWNER] = "VHOST_SET_OWNER",
[VHOST_USER_RESET_OWNER] = "VHOST_RESET_OWNER",
[VHOST_USER_SET_FEATURES] = "VHOST_SET_FEATURES",

View File

@ -213,7 +213,7 @@ virtio_user_dev_init(char *path, uint16_t requested_queues,
if (requested_queues > max_queues) {
SPDK_ERRLOG("requested %"PRIu16" request queues but only %"PRIu64" available\n",
requested_queues, max_queues);
requested_queues, max_queues);
goto err;
}

View File

@ -17,7 +17,7 @@ if hash astyle; then
# rather than making diffs more complicated by a lot of changes to follow SPDK
# coding standards.
git ls-files '*.[ch]' '*.cpp' '*.cc' '*.cxx' '*.hh' '*.hpp' | \
grep -v rte_vhost | grep -v rte_virtio | grep -v cpp_headers | \
grep -v rte_vhost | grep -v cpp_headers | \
xargs astyle --options=.astylerc >> astyle.log
if grep -q "^Formatted" astyle.log; then
echo " errors detected"
@ -39,7 +39,7 @@ fi
echo -n "Checking comment style..."
git grep --line-number -e '/[*][^ *-]' -- '*.[ch]' > comment.log || true
git grep --line-number -e '[^ ][*]/' -- '*.[ch]' ':!lib/vhost/rte_vhost*/*' ':!lib/bdev/virtio/rte_virtio*/*' >> comment.log || true
git grep --line-number -e '[^ ][*]/' -- '*.[ch]' ':!lib/vhost/rte_vhost*/*' >> comment.log || true
git grep --line-number -e '^[*]' -- '*.[ch]' >> comment.log || true
if [ -s comment.log ]; then