Changed vtpci_queue_idx type in function virtio_dev_queue_setup from
uint8_t to uint16_t to prevent possible data loss. Also changed type of
head variable in function virtio_send_command from uint32_t to uint16_t.
Variable rcv_cnt declared in function virtio_recv_mergeable_pkts was of
type uint32_t. It was used by virtqueue_dequeue_burst_rx function, which
expects argument of type uint16_t. Changed rcv_cnt variable type to
uint16_t to prevent possible data loss.
Issues found with static code analysis tool.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
virtio_send_command(struct virtqueue *vq, struct virtio_pmd_ctrl *ctrl,
int *dlen, int pkt_num)
{
- uint32_t head = vq->vq_desc_head_idx, i;
+ uint16_t head = vq->vq_desc_head_idx, i;
int k, sum = 0;
virtio_net_ctrl_ack status = ~0;
struct virtio_pmd_ctrl result;
int virtio_dev_queue_setup(struct rte_eth_dev *dev,
int queue_type,
uint16_t queue_idx,
- uint8_t vtpci_queue_idx,
+ uint16_t vtpci_queue_idx,
uint16_t nb_desc,
unsigned int socket_id,
struct virtqueue **pvq)
int virtio_dev_queue_setup(struct rte_eth_dev *dev,
int queue_type,
uint16_t queue_idx,
- uint8_t vtpci_queue_idx,
+ uint16_t vtpci_queue_idx,
uint16_t nb_desc,
unsigned int socket_id,
struct virtqueue **pvq);
__rte_unused const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mp)
{
- uint8_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_RQ_QUEUE_IDX;
+ uint16_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_RQ_QUEUE_IDX;
struct virtqueue *vq;
int ret;
/*
* Get extra segments for current uncompleted packet.
*/
- uint32_t rcv_cnt =
+ uint16_t rcv_cnt =
RTE_MIN(seg_res, RTE_DIM(rcv_pkts));
if (likely(VIRTQUEUE_NUSED(rxvq) >= rcv_cnt)) {
uint32_t rx_num =