From patchwork Thu Nov 10 14:28:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 81679 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp757494qge; Thu, 10 Nov 2016 06:36:32 -0800 (PST) X-Received: by 10.55.137.4 with SMTP id l4mr5702204qkd.310.1478788592811; Thu, 10 Nov 2016 06:36:32 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id c62si3499770qkg.184.2016.11.10.06.36.31; Thu, 10 Nov 2016 06:36:32 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C1C28607F7; Thu, 10 Nov 2016 14:36:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 390246088F; Thu, 10 Nov 2016 14:35:59 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id BCC026088F; Thu, 10 Nov 2016 14:35:51 +0000 (UTC) Received: from mail-pf0-f169.google.com (mail-pf0-f169.google.com [209.85.192.169]) by lists.linaro.org (Postfix) with ESMTPS id 0D2C36088F for ; Thu, 10 Nov 2016 14:28:48 +0000 (UTC) Received: by mail-pf0-f169.google.com with SMTP id 189so147813355pfz.3 for ; Thu, 10 Nov 2016 06:28:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=AGGykDZer7txhnkwu7no7GHQ2R5vEVIr3GYb7n4jGus=; b=H/sF2kJoZKBpOX9e5iUWcftehoqXg41yn/R9Zzqp7o6KznlxFiTDQxvCO1Xtexzvsb +fOycL+rr//GgUnypf2G8DEP9Oj7XSVIsX0yp0aJRlBNRY04YhzsCfn4IzcVcKYXzsaU MSz7LekwUwtzX1GQs/gvTn0665ZYhxojFQlJY05bAy+aQtkshkexkbAmPpmvXY7nAXYl LCBEsBGYcSGgtLQV+nNij06HXl6JOM6PpgLTozapyP2ltQaJQjMLFtzlyoOUKOUZCbcl 75KIgUI2hkLPzwu3bI+A/ZrBdcizha1ribbr/5ky8XIxuYHrIjvPK5WPr33YNdIoViU4 vurw== X-Gm-Message-State: ABUngvd3MRoSZihfiARsqiqOb0hOrKC1XbU9MO3sTcDb/USDcGXiEsIEQopg8UOQgEfwkfSS5I0= X-Received: by 10.98.35.5 with SMTP id j5mr10426182pfj.91.1478788127134; Thu, 10 Nov 2016 06:28:47 -0800 (PST) Received: from localhost.localdomain ([122.166.219.57]) by smtp.gmail.com with ESMTPSA id hv3sm7812006pad.30.2016.11.10.06.28.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Nov 2016 06:28:46 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Thu, 10 Nov 2016 19:58:39 +0530 Message-Id: <1478788119-3855-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [PATCHv2 1/1] validation: pktio: fix invalid mac addr X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Fixes https://bugs.linaro.org/show_bug.cgi?id=2496 Signed-off-by: Balasubramanian Manoharan --- v2: Incorporate review comments test/common_plat/validation/api/pktio/pktio.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) -- 1.9.1 diff --git a/test/common_plat/validation/api/pktio/pktio.c b/test/common_plat/validation/api/pktio/pktio.c index a6a18c3..7115def 100644 --- a/test/common_plat/validation/api/pktio/pktio.c +++ b/test/common_plat/validation/api/pktio/pktio.c @@ -31,6 +31,8 @@ #define PKTIN_TS_MAX_RES 10000000000 #define PKTIN_TS_CMP_RES 1 +#define PKTIO_SRC_MAC {1, 2, 3, 4, 5, 6} +#define PKTIO_DST_MAC {1, 2, 3, 4, 5, 6} #undef DEBUG_STATS /** interface names used for testing */ @@ -241,16 +243,32 @@ static uint32_t pktio_init_packet(odp_packet_t pkt) odph_udphdr_t *udp; char *buf; uint16_t seq; - uint8_t mac[ODP_PKTIO_MACADDR_MAXSIZE] = {0}; + uint8_t src_mac[ODP_PKTIO_MACADDR_MAXSIZE] = PKTIO_SRC_MAC; + uint8_t dst_mac[ODP_PKTIO_MACADDR_MAXSIZE] = PKTIO_DST_MAC; + uint8_t src_mac_be[ODP_PKTIO_MACADDR_MAXSIZE]; + uint8_t dst_mac_be[ODP_PKTIO_MACADDR_MAXSIZE]; int pkt_len = odp_packet_len(pkt); + int i; + + #if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN + for (i = 0; i < ODP_PKTIO_MACADDR_MAXSIZE; i++) { + src_mac_be[i] = src_mac[i]; + dst_mac_be[i] = dst_mac[i]; + } + #else + for (i = 0; i < ODP_PKTIO_MACADDR_MAXSIZE; i++) { + src_mac_be[i] = src_mac[ODP_PKTIO_MACADDR_MAXSIZE - i]; + dst_mac_be[i] = dst_mac[ODP_PKTIO_MACADDR_MAXSIZE - i]; + } + #endif buf = odp_packet_data(pkt); /* Ethernet */ odp_packet_l2_offset_set(pkt, 0); eth = (odph_ethhdr_t *)buf; - memcpy(eth->src.addr, mac, ODPH_ETHADDR_LEN); - memcpy(eth->dst.addr, mac, ODPH_ETHADDR_LEN); + memcpy(eth->src.addr, &src_mac_be, ODPH_ETHADDR_LEN); + memcpy(eth->dst.addr, &dst_mac_be, ODPH_ETHADDR_LEN); eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); /* IP */