From patchwork Mon Oct 10 07:46:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenzhuo Lu X-Patchwork-Id: 16467 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 22AD46CBB; Mon, 10 Oct 2016 09:46:50 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 78B626A95 for ; Mon, 10 Oct 2016 09:46:48 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 10 Oct 2016 00:46:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,471,1473145200"; d="scan'208";a="178239724" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga004.fm.intel.com with ESMTP; 10 Oct 2016 00:46:46 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u9A7kjqG011957; Mon, 10 Oct 2016 15:46:45 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u9A7kg3k032374; Mon, 10 Oct 2016 15:46:44 +0800 Received: (from wenzhuol@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u9A7kgon032370; Mon, 10 Oct 2016 15:46:42 +0800 From: Wenzhuo Lu To: dev@dpdk.org Cc: Wenzhuo Lu Date: Mon, 10 Oct 2016 15:46:33 +0800 Message-Id: <1476085594-32325-3-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1476085594-32325-1-git-send-email-wenzhuo.lu@intel.com> References: <1476085594-32325-1-git-send-email-wenzhuo.lu@intel.com> Subject: [dpdk-dev] [PATCH 2/3] app/testpmd: fix flow director endian issue 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The vlan mask and tunnel id mask of flow director are defined as big endian. So they should be converted. When the mask is printed, the parameters are not converted either. Fixes: 53b2bb9b7ea7 ("app/testpmd: new flow director commands") Signed-off-by: Wenzhuo Lu --- app/test-pmd/cmdline.c | 6 +++--- app/test-pmd/config.c | 43 +++++++++++++++++++++++++------------------ 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 6e95ca2..39e6d59 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -9074,7 +9074,7 @@ cmd_flow_director_mask_parsed(void *parsed_result, return; } - mask->vlan_tci_mask = res->vlan_mask; + mask->vlan_tci_mask = rte_cpu_to_be_16(res->vlan_mask); mask->mac_addr_byte_mask = res->mac_addr_byte_mask; } else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) { if (strcmp(res->mode_value, "Tunnel")) { @@ -9082,9 +9082,9 @@ cmd_flow_director_mask_parsed(void *parsed_result, return; } - mask->vlan_tci_mask = res->vlan_mask; + mask->vlan_tci_mask = rte_cpu_to_be_16(res->vlan_mask); mask->mac_addr_byte_mask = res->mac_addr_byte_mask; - mask->tunnel_id_mask = res->tunnel_id_mask; + mask->tunnel_id_mask = rte_cpu_to_be_32(res->tunnel_id_mask); mask->tunnel_type_mask = res->tunnel_type_mask; } else { if (strcmp(res->mode_value, "IP")) { diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 83bebfe..742a8d8 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2045,26 +2045,33 @@ set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value) static inline void print_fdir_mask(struct rte_eth_fdir_masks *mask) { - printf("\n vlan_tci: 0x%04x, ", mask->vlan_tci_mask); + printf("\n vlan_tci: 0x%04x", rte_be_to_cpu_16(mask->vlan_tci_mask)); - if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) - printf("mac_addr: 0x%02x", mask->mac_addr_byte_mask); - else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) - printf("mac_addr: 0x%02x, tunnel_type: 0x%01x, tunnel_id: 0x%08x", + if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) + printf(", mac_addr: 0x%02x, tunnel_type: 0x%01x," + " tunnel_id: 0x%08x", mask->mac_addr_byte_mask, mask->tunnel_type_mask, - mask->tunnel_id_mask); - else { - printf("src_ipv4: 0x%08x, dst_ipv4: 0x%08x," - " src_port: 0x%04x, dst_port: 0x%04x", - mask->ipv4_mask.src_ip, mask->ipv4_mask.dst_ip, - mask->src_port_mask, mask->dst_port_mask); - - printf("\n src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x," - " dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x", - mask->ipv6_mask.src_ip[0], mask->ipv6_mask.src_ip[1], - mask->ipv6_mask.src_ip[2], mask->ipv6_mask.src_ip[3], - mask->ipv6_mask.dst_ip[0], mask->ipv6_mask.dst_ip[1], - mask->ipv6_mask.dst_ip[2], mask->ipv6_mask.dst_ip[3]); + rte_be_to_cpu_32(mask->tunnel_id_mask)); + else if (fdir_conf.mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN) { + printf(", src_ipv4: 0x%08x, dst_ipv4: 0x%08x", + rte_be_to_cpu_32(mask->ipv4_mask.src_ip), + rte_be_to_cpu_32(mask->ipv4_mask.dst_ip)); + + printf("\n src_port: 0x%04x, dst_port: 0x%04x", + rte_be_to_cpu_16(mask->src_port_mask), + rte_be_to_cpu_16(mask->dst_port_mask)); + + printf("\n src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x", + rte_be_to_cpu_32(mask->ipv6_mask.src_ip[0]), + rte_be_to_cpu_32(mask->ipv6_mask.src_ip[1]), + rte_be_to_cpu_32(mask->ipv6_mask.src_ip[2]), + rte_be_to_cpu_32(mask->ipv6_mask.src_ip[3])); + + printf("\n dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x", + rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[0]), + rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[1]), + rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[2]), + rte_be_to_cpu_32(mask->ipv6_mask.dst_ip[3])); } printf("\n");