From: Intel Date: Fri, 8 Nov 2013 02:00:00 +0000 (+0100) Subject: virtio: minor changes X-Git-Tag: spdx-start~11091 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f72751f2c70a787787f499694d8c7a66247e5737;p=dpdk.git virtio: minor changes Signed-off-by: Intel --- diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c index b5b9d01d8c..fe06a13ccd 100644 --- a/lib/librte_pmd_virtio/virtio_ethdev.c +++ b/lib/librte_pmd_virtio/virtio_ethdev.c @@ -133,19 +133,19 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev, dev->data->port_id, queue_idx); vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) + vq_size * sizeof(struct vq_desc_extra), CACHE_LINE_SIZE); - strncpy(vq->vq_name, vq_name, sizeof(vq->vq_name)); + memcpy(vq->vq_name, vq_name, sizeof(vq->vq_name)); } else if(queue_type == VTNET_TQ) { rte_snprintf(vq_name, sizeof(vq_name), "port%d_tvq%d", dev->data->port_id, queue_idx); vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) + vq_size * sizeof(struct vq_desc_extra), CACHE_LINE_SIZE); - strncpy(vq->vq_name, vq_name, sizeof(vq->vq_name)); + memcpy(vq->vq_name, vq_name, sizeof(vq->vq_name)); } else if(queue_type == VTNET_CQ) { rte_snprintf(vq_name, sizeof(vq_name), "port%d_cvq", dev->data->port_id); vq = rte_zmalloc(vq_name, sizeof(struct virtqueue), CACHE_LINE_SIZE); - strncpy(vq->vq_name, vq_name, sizeof(vq->vq_name)); + memcpy(vq->vq_name, vq_name, sizeof(vq->vq_name)); } if (vq == NULL) { PMD_INIT_LOG(ERR, "%s: Can not allocate virtqueue\n", __func__); @@ -352,9 +352,10 @@ virtio_get_hwaddr(struct virtio_hw *hw) } -static void virtio_negotiate_features(struct virtio_hw *hw) +static void +virtio_negotiate_features(struct virtio_hw *hw) { - uint64_t guest_features, mask; + uint32_t guest_features, mask; mask = VIRTIO_NET_F_CTRL_VQ | VIRTIO_NET_F_CTRL_RX | VIRTIO_NET_F_CTRL_VLAN; mask |= VIRTIO_NET_F_CSUM | VIRTIO_NET_F_GUEST_CSUM ; diff --git a/lib/librte_pmd_virtio/virtio_pci.c b/lib/librte_pmd_virtio/virtio_pci.c index a462779e86..6bf89d9f43 100644 --- a/lib/librte_pmd_virtio/virtio_pci.c +++ b/lib/librte_pmd_virtio/virtio_pci.c @@ -81,8 +81,8 @@ vtpci_write_dev_config(struct virtio_hw *hw, uint64_t offset, } } -uint64_t -vtpci_negotiate_features(struct virtio_hw *hw, uint64_t guest_features) +uint32_t +vtpci_negotiate_features(struct virtio_hw *hw, uint32_t guest_features) { uint32_t features; /* diff --git a/lib/librte_pmd_virtio/virtio_pci.h b/lib/librte_pmd_virtio/virtio_pci.h index 04fc1561a1..da4351337b 100644 --- a/lib/librte_pmd_virtio/virtio_pci.h +++ b/lib/librte_pmd_virtio/virtio_pci.h @@ -223,7 +223,7 @@ struct virtio_net_config { outl_p((unsigned int)(value), (VIRTIO_PCI_REG_ADDR((hw), (reg)))) static inline int -vtpci_with_feature(struct virtio_hw *hw, uint64_t feature) +vtpci_with_feature(struct virtio_hw *hw, uint32_t feature) { return ((hw->guest_features & feature) != 0); } @@ -239,9 +239,7 @@ uint8_t vtpci_get_status(struct virtio_hw *); void vtpci_set_status(struct virtio_hw *, uint8_t); -int vtpci_with_feature(struct virtio_hw *, uint64_t); - -uint64_t vtpci_negotiate_features(struct virtio_hw *, uint64_t); +uint32_t vtpci_negotiate_features(struct virtio_hw *, uint32_t); void vtpci_write_dev_config(struct virtio_hw *, uint64_t, void *, int);