[dpdk-dev] virtio: don't count broadcast packets in multicast packets counter

Message ID 1456498883-58648-1-git-send-email-iryzhov@nfware.com (mailing list archive)
State Accepted, archived
Delegated to: Bruce Richardson
Headers

Commit Message

Igor Ryzhov Feb. 26, 2016, 3:01 p.m. UTC
  Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
---
 drivers/net/virtio/virtio_rxtx.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
  

Comments

Van Haaren, Harry Feb. 26, 2016, 3:14 p.m. UTC | #1
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Igor Ryzhov
> Sent: Friday, February 26, 2016 3:01 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] virtio: don't count broadcast packets in multicast packets
> counter
> 
> Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>

Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
  
Yuanhan Liu Feb. 29, 2016, 3:52 a.m. UTC | #2
On Fri, Feb 26, 2016 at 06:01:23PM +0300, Igor Ryzhov wrote:
> Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>

Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>

	--yliu
  
Bruce Richardson March 9, 2016, 3:12 p.m. UTC | #3
On Fri, Feb 26, 2016 at 06:01:23PM +0300, Igor Ryzhov wrote:
> Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
> ---
>  drivers/net/virtio/virtio_rxtx.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
Applied to dpdk-next-net/rel_16_04 with superflous braces removed to comply with
coding standards: 
http://dpdk.org/doc/guides/contributing/coding_style.html#control-statements-and-loops

Note to reviewers: if possible, please run checkpatch to catch issues like this.

Regards,
/Bruce
  

Patch

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 41a1366..fe18e1d 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -543,8 +543,13 @@  virtio_update_packet_stats(struct virtqueue *vq, struct rte_mbuf *mbuf)
 	}
 
 	ea = rte_pktmbuf_mtod(mbuf, struct ether_addr *);
-	vq->multicast += is_multicast_ether_addr(ea);
-	vq->broadcast += is_broadcast_ether_addr(ea);
+	if (is_multicast_ether_addr(ea)) {
+		if (is_broadcast_ether_addr(ea)) {
+			vq->broadcast++;
+		} else {
+			vq->multicast++;
+		}
+	}
 }
 
 #define VIRTIO_MBUF_BURST_SZ 64