[dpdk-dev] net/virtio: fix coding style

Message ID 1500273339-145597-1-git-send-email-tiwei.bie@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Tiwei Bie July 17, 2017, 6:35 a.m. UTC
  Make the code more readable. No functional change.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 drivers/net/virtio/virtio_rxtx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit July 18, 2017, 11:04 a.m. UTC | #1
On 7/17/2017 7:35 AM, Tiwei Bie wrote:
> Make the code more readable. No functional change.
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>

Applied to dpdk-next-net/master, thanks.
  
Ferruh Yigit July 18, 2017, 12:29 p.m. UTC | #2
On 7/18/2017 12:04 PM, Ferruh Yigit wrote:
> On 7/17/2017 7:35 AM, Tiwei Bie wrote:
>> Make the code more readable. No functional change.
>>
>> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> 
> 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
  
Yuanhan Liu July 18, 2017, 12:32 p.m. UTC | #3
On Tue, Jul 18, 2017 at 01:29:48PM +0100, Ferruh Yigit wrote:
> On 7/18/2017 12:04 PM, Ferruh Yigit wrote:
> > On 7/17/2017 7:35 AM, Tiwei Bie wrote:
> >> Make the code more readable. No functional change.
> >>
> >> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> > 
> > 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
  

Patch

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index fbc96df..e30377c 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -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);