From patchwork Mon Sep 23 07:44:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 59601 X-Patchwork-Delegate: xiaolong.ye@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 158F31BF5F; Mon, 23 Sep 2019 09:44:20 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 8867D1BE8B for ; Mon, 23 Sep 2019 09:42:49 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Sep 2019 00:42:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,539,1559545200"; d="scan'208";a="182445746" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by orsmga008.jf.intel.com with ESMTP; 23 Sep 2019 00:42:47 -0700 From: Qi Zhang To: wenzhuo.lu@intel.com, qiming.yang@intel.com Cc: dev@dpdk.org, xiaolong.ye@intel.com, Qi Zhang , Junfeng Guo , Paul M Stillwell Jr Date: Mon, 23 Sep 2019 15:44:47 +0800 Message-Id: <20190923074448.7847-30-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190923074448.7847-1-qi.z.zhang@intel.com> References: <20190902035551.16852-1-qi.z.zhang@intel.com> <20190923074448.7847-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v5 29/30] net/ice/base: add switch support for IPv6 tc field X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add support for IPv6 traffic class (tc) field for switch rule. Correct ice_ipv6_hdr based on the IPv6 Protocol using bitfields. Add big/little endian convert for tc field before it is inserted, since tc is only one byte and also does not have a byte-aligned offset. Signed-off-by: Junfeng Guo Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_protocol_type.h | 6 +++--- drivers/net/ice/base/ice_switch.c | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h index 98185c9de..f61345a7f 100644 --- a/drivers/net/ice/base/ice_protocol_type.h +++ b/drivers/net/ice/base/ice_protocol_type.h @@ -183,9 +183,9 @@ struct ice_ipv4_hdr { }; struct ice_ipv6_hdr { - u8 version; - u8 tc; - u16 flow_label; + u32 version:4; + u32 tc:8; + u32 flow_label:20; u16 payload_len; u8 next_hdr; u8 hop_limit; diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 10dfc720a..80afa74cd 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -5785,6 +5785,19 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, break; case ICE_IPV6_OFOS: case ICE_IPV6_IL: + /* Based on the same mechanism below, if tc (Traffic + * Class) for IPv6 has mask, it means tc field is set. + * Since tc is only one byte, we have to handle the + * big/little endian issue before it can be inserted. + */ + if (lkups[i].m_u.ipv6_hdr.tc) { + ((u16 *)&lkups[i].h_u)[0] = + (((u16 *)&lkups[i].h_u)[0] << 8) | + (((u16 *)&lkups[i].h_u)[0] >> 8); + ((u16 *)&lkups[i].m_u)[0] = + (((u16 *)&lkups[i].m_u)[0] << 8) | + (((u16 *)&lkups[i].m_u)[0] >> 8); + } len = sizeof(struct ice_ipv6_hdr); break; case ICE_TCP_IL: