From patchwork Thu Nov 3 13:21:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 80654 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp631728qge; Thu, 3 Nov 2016 06:21:41 -0700 (PDT) X-Received: by 10.55.148.131 with SMTP id w125mr7500987qkd.57.1478179301799; Thu, 03 Nov 2016 06:21:41 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e68si4150694qkh.64.2016.11.03.06.21.41; Thu, 03 Nov 2016 06:21:41 -0700 (PDT) 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 74EB060D7B; Thu, 3 Nov 2016 13:21:41 +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=-1.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_WEB 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 F251060D69; Thu, 3 Nov 2016 13:21:35 +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 5A43C60D5C; Thu, 3 Nov 2016 13:21:31 +0000 (UTC) Received: from mail-pf0-f176.google.com (mail-pf0-f176.google.com [209.85.192.176]) by lists.linaro.org (Postfix) with ESMTPS id EBEC960CF1 for ; Thu, 3 Nov 2016 13:21:28 +0000 (UTC) Received: by mail-pf0-f176.google.com with SMTP id 189so31961964pfz.3 for ; Thu, 03 Nov 2016 06:21:28 -0700 (PDT) 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=PsoXf2TcItfw29fz1+VKtG+mxbyXcNbUyD3vRLbdXrs=; b=cnnk4YGm1+6t4WW4rZrf0hlGnoMRi+a5/ITC/qc/YPJYSFbWTYqojDF1NY4A6yad42 pe/Ha2lYp5rK2oHswPpCo9eoNQpAbaz6Vmgh4/VYsjvDRx2/V1C2Wn+YtIXZgXKjEFs5 6k+P1yAkpnW0iejs8KKmQuc6VdKHO4LMvHta3ZqhK6MiqfiGhrl/wb5eTGg7Y6kz1dJx PUviALfm3b/GvA3XSRq8wJwBR2lcexBgUDtdYCjvozU42kSrtfrQtwamAgE3sTMXjYBA oACGqusAyab2qpxhtLlMStG8vSSFwW09PDW8sKoWKL8QRQ0NskDGGN6sGzAF1QbTSsPe bslA== X-Gm-Message-State: ABUngvcfuEK4gRM4BlYT57F5OEIZLCGDIUwCwcLNNXczC+d4ic18mwov/UbrUmDK34H3EmHrB58= X-Received: by 10.99.0.194 with SMTP id 185mr13907031pga.111.1478179287989; Thu, 03 Nov 2016 06:21:27 -0700 (PDT) Received: from bala-Vostro-2520.domain.name ([117.199.141.60]) by smtp.gmail.com with ESMTPSA id y21sm3253664pfa.68.2016.11.03.06.21.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Nov 2016 06:21:27 -0700 (PDT) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Thu, 3 Nov 2016 18:51:15 +0530 Message-Id: <1478179275-26374-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [PATCHv1 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 --- test/common_plat/validation/api/pktio/pktio.c | 17 ++++++++++++++--- 1 file changed, 14 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..4bc7e0a 100644 --- a/test/common_plat/validation/api/pktio/pktio.c +++ b/test/common_plat/validation/api/pktio/pktio.c @@ -241,16 +241,27 @@ 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}; + uint64_t src_mac = 0x010203040506; + uint64_t dst_mac = 0x070809101112; + uint64_t src_mac_be; + uint64_t dst_mac_be; int pkt_len = odp_packet_len(pkt); + dst_mac_be = odp_cpu_to_be_64(dst_mac); + if (dst_mac != dst_mac_be) + dst_mac_be = dst_mac_be >> (64 - 8 * ODPH_ETHADDR_LEN); + + src_mac_be = odp_cpu_to_be_64(src_mac); + if (src_mac != src_mac_be) + src_mac_be = src_mac_be >> (64 - 8 * ODPH_ETHADDR_LEN); + 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 */