From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 87F01374C for ; Tue, 26 Apr 2016 06:43:42 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 25 Apr 2016 21:43:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,535,1455004800"; d="scan'208";a="940170656" Received: from yliu-dev.sh.intel.com ([10.239.67.162]) by orsmga001.jf.intel.com with ESMTP; 25 Apr 2016 21:43:42 -0700 From: Yuanhan Liu To: dev@dpdk.org Cc: huawei.xie@intel.com, Yuanhan Liu Date: Mon, 25 Apr 2016 21:45:48 -0700 Message-Id: <1461645951-14603-5-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1461645951-14603-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1461645951-14603-1-git-send-email-yuanhan.liu@linux.intel.com> Subject: [dpdk-dev] [PATCH 4/7] examples/vhost: use mac compare helper function directly X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 04:43:42 -0000 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 --- 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