Skip to contentSkip to conversation

net/virtio: fix coding style

PATCH Applied Tiwei Bie 3 participants 4 messages Jul 17, 2017 – Jul 18, 2017 Network drivers

lore
Share & tools
lore

Tiwei Bie

author
#0 lore raw

PATCH 1/1 net/virtio: fix coding style

Make the code more readable. No functional change.

---
 drivers/net/virtio/virtio_rxtx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/virtio/virtio_rxtx.c +3 -2
index fbc96df..e30377c 100644
@@ -744,8 +744,9 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
 	virtio_rmb();
 
-	num = (uint16_t)(likely(nb_used <= nb_pkts) ? nb_used : nb_pkts);
-	num = (uint16_t)(likely(num <= VIRTIO_MBUF_BURST_SZ) ? num : VIRTIO_MBUF_BURST_SZ);
+	num = likely(nb_used <= nb_pkts) ? nb_used : nb_pkts;
+	if (unlikely(num > VIRTIO_MBUF_BURST_SZ))
+		num = VIRTIO_MBUF_BURST_SZ;
 	if (likely(num > DESC_PER_CACHELINE))
 		num = num - ((vq->vq_used_cons_idx + num) % DESC_PER_CACHELINE);
 
Signature · 1 line
2.7.4
#2 lore raw
Quoted 6 lines · Ferruh Yigit
Quoted 3 lines · Tiwei Bie

Make the code more readable. No functional change.

Applied to dpdk-next-net/master, thanks.

And indeed this should go in via next-virtio, I confused it.

Yuanhan,

Please let me know if you want me drop this from next-net.

Thanks,
ferruh

#3 lore raw
Quoted 6 lines · Ferruh Yigit
Quoted 5 lines · Ferruh Yigit
Quoted 3 lines · Tiwei Bie

Make the code more readable. No functional change.

Quoted 7 lines
Quoted 1 line

Applied to dpdk-next-net/master, thanks.

And indeed this should go in via next-virtio, I confused it.

Yuanhan,

Please let me know if you want me drop this from next-net.

Nope, it's okay.

	--yliu