DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: dev@dpdk.org
Cc: huawei.xie@intel.com, Yuanhan Liu <yuanhan.liu@linux.intel.com>
Subject: [dpdk-dev] [PATCH 4/7] examples/vhost: use mac compare helper function directly
Date: Mon, 25 Apr 2016 21:45:48 -0700	[thread overview]
Message-ID: <1461645951-14603-5-git-send-email-yuanhan.liu@linux.intel.com> (raw)
In-Reply-To: <1461645951-14603-1-git-send-email-yuanhan.liu@linux.intel.com>

rte_ether.h already provides a helper function to do mac address
compare. No need to define our own, use it directly.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 examples/vhost/main.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 092bb13..6cc34b7 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -104,9 +104,6 @@
 /* Maximum long option length for option parsing. */
 #define MAX_LONG_OPT_SZ 64
 
-/* Used to compare MAC addresses. */
-#define MAC_ADDR_CMP 0xFFFFFFFFFFFFULL
-
 /* mask of enabled ports */
 static uint32_t enabled_port_mask = 0;
 
@@ -734,15 +731,6 @@ static unsigned check_ports_num(unsigned nb_ports)
 #define PRINT_PACKET(device, addr, size, header) do{} while(0)
 #endif
 
-/*
- * Compares a packet destination MAC address to a device MAC address.
- */
-static inline int __attribute__((always_inline))
-ether_addr_cmp(struct ether_addr *ea, struct ether_addr *eb)
-{
-	return ((*(uint64_t *)ea ^ *(uint64_t *)eb) & MAC_ADDR_CMP) == 0;
-}
-
 static inline struct vhost_dev * __attribute__((always_inline))
 find_vhost_dev(struct ether_addr *mac)
 {
@@ -750,7 +738,7 @@ find_vhost_dev(struct ether_addr *mac)
 
 	TAILQ_FOREACH(vdev, &vhost_dev_list, next) {
 		if (vdev->ready == DEVICE_RX &&
-		    ether_addr_cmp(mac, &vdev->mac_address))
+		    is_same_ether_addr(mac, &vdev->mac_address))
 			return vdev;
 	}
 
-- 
1.9.0

  parent reply	other threads:[~2016-04-26  4:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-26  4:45 [dpdk-dev] [PATCH 0/7] vhost/example cleanup/fix Yuanhan Liu
2016-04-26  4:45 ` [dpdk-dev] [PATCH 1/7] examples/vhost: remove the non-working zero copy code Yuanhan Liu
2016-04-26  4:45 ` [dpdk-dev] [PATCH 2/7] examples/vhost: remove unused macro and struct Yuanhan Liu
2016-04-26  4:45 ` [dpdk-dev] [PATCH 3/7] examples/vhost: use tailq to link vhost devices Yuanhan Liu
2016-04-26  4:45 ` Yuanhan Liu [this message]
2016-04-26  4:45 ` [dpdk-dev] [PATCH 5/7] examples/vhost: handle broadcast packet Yuanhan Liu
2016-04-26  4:45 ` [dpdk-dev] [PATCH 6/7] examples/vhost: fix mbuf allocation failures Yuanhan Liu
2016-04-26  4:45 ` [dpdk-dev] [PATCH 7/7] examples/vhost: switch_worker cleanup Yuanhan Liu
2016-04-28  5:45 ` [dpdk-dev] [PATCH 0/7] vhost/example cleanup/fix Wang, Zhihong
2016-04-28  6:09   ` Yuanhan Liu
     [not found] ` <1462224230-19460-1-git-send-email-yuanhan.liu@linux.intel.com>
2016-05-02 21:23   ` [dpdk-dev] [PATCH v2 1/8] examples/vhost: remove the non-working zero copy code Yuanhan Liu
2016-05-02 21:23   ` [dpdk-dev] [PATCH v2 2/8] examples/vhost: remove unused macro and struct Yuanhan Liu
2016-05-02 21:23   ` [dpdk-dev] [PATCH v2 3/8] examples/vhost: use tailq to link vhost devices Yuanhan Liu
2016-05-02 21:23   ` [dpdk-dev] [PATCH v2 4/8] examples/vhost: use mac compare helper function directly Yuanhan Liu
2016-05-02 21:23   ` [dpdk-dev] [PATCH v2 5/8] examples/vhost: handle broadcast packet Yuanhan Liu
2016-05-02 21:23   ` [dpdk-dev] [PATCH v2 6/8] examples/vhost: fix mbuf allocation failure Yuanhan Liu
2016-05-02 21:23   ` [dpdk-dev] [PATCH v2 7/8] examples/vhost: switch_worker cleanup Yuanhan Liu
2016-05-02 21:23   ` [dpdk-dev] [PATCH v2 8/8] examples/vhost: embed statistics into vhost_dev struct Yuanhan Liu
2016-05-09 18:06   ` [dpdk-dev] [PATCH v2 0/8] vhost/example cleanup/fix Yuanhan Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461645951-14603-5-git-send-email-yuanhan.liu@linux.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=dev@dpdk.org \
    --cc=huawei.xie@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).