From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3EE97A058A; Fri, 17 Apr 2020 10:48:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 70ED31DEDF; Fri, 17 Apr 2020 10:48:35 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 270981DE37 for ; Fri, 17 Apr 2020 10:48:31 +0200 (CEST) IronPort-SDR: DM5gHrQm10rBfKWKHaNkVkuKb4SkrJfzZZ47sFnY1Bip61eYh8q2V3qoDoYY9JmrYLu4K+B0wU NQjl4GZ3xtWw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2020 01:48:31 -0700 IronPort-SDR: Hc8QrkAQ6LWs5fLSSGMsVefpBo/oqKxPTnEQKEHpu6VNOYa/ux8BcMuUoZb3csRfriOZI1k0O0 iaK7R+mLDdmA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,394,1580803200"; d="scan'208";a="289202408" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([172.16.182.123]) by fmsmga002.fm.intel.com with ESMTP; 17 Apr 2020 01:48:30 -0700 From: Wei Zhao To: dev@dpdk.org Cc: qi.z.zhang@intel.com, qi.fu@intel.com, Wei Zhao Date: Fri, 17 Apr 2020 16:26:16 +0800 Message-Id: <20200417082617.33361-3-wei.zhao1@intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200417082617.33361-1-wei.zhao1@intel.com> References: <20200417082617.33361-1-wei.zhao1@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 2/3] net/ice/base: add support for L2TP on switch 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 dummy packet and tunnel type to support L2TP on switch, now we can use session id as input set for swicth rule. Signed-off-by: Wei Zhao --- drivers/net/ice/base/ice_protocol_type.h | 2 + drivers/net/ice/base/ice_switch.c | 76 ++++++++++++++++++++++++ drivers/net/ice/base/ice_switch.h | 1 + 3 files changed, 79 insertions(+) diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h index 2ca7cd8ac..46cd77e68 100644 --- a/drivers/net/ice/base/ice_protocol_type.h +++ b/drivers/net/ice/base/ice_protocol_type.h @@ -72,6 +72,8 @@ enum ice_sw_tunnel_type { ICE_SW_TUN_IPV6_AH, ICE_SW_TUN_IPV4_NAT_T, ICE_SW_TUN_IPV6_NAT_T, + ICE_SW_TUN_IPV4_L2TPV3, + ICE_SW_TUN_IPV6_L2TPV3, ICE_SW_TUN_PROFID_IPV6_ESP, ICE_SW_TUN_PROFID_IPV6_AH, ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3, diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 1da438f5e..28924085e 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -760,6 +760,61 @@ static const u8 dummy_ipv6_nat_pkt[] = { }; +static const struct ice_dummy_pkt_offsets dummy_ipv4_l2tpv3_packet_offsets[] = { + { ICE_MAC_OFOS, 0 }, + { ICE_IPV4_OFOS, 14 }, + { ICE_L2TPV3, 34 }, + { ICE_PROTOCOL_LAST, 0 }, +}; + +static const u8 dummy_ipv4_l2tpv3_pkt[] = { + 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, + + 0x45, 0x00, 0x00, 0x20, /* ICE_IPV4_IL 14 */ + 0x00, 0x00, 0x40, 0x00, + 0x40, 0x73, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, 0x00, 0x00, /* ICE_L2TPV3 34 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, /* 2 bytes for 4 bytes alignment */ +}; + +static const struct ice_dummy_pkt_offsets dummy_ipv6_l2tpv3_packet_offsets[] = { + { ICE_MAC_OFOS, 0 }, + { ICE_IPV6_OFOS, 14 }, + { ICE_L2TPV3, 54 }, + { ICE_PROTOCOL_LAST, 0 }, +}; + +static const u8 dummy_ipv6_l2tpv3_pkt[] = { + 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x86, 0xDD, + + 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_IL 14 */ + 0x00, 0x0c, 0x73, 0x40, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, 0x00, 0x00, /* ICE_L2TPV3 54 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, /* 2 bytes for 4 bytes alignment */ +}; + /* this is a recipe to profile association bitmap */ static ice_declare_bitmap(recipe_to_profile[ICE_MAX_NUM_RECIPES], ICE_MAX_NUM_PROFILES); @@ -5939,6 +5994,7 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo, ice_set_bit(ICE_PROFID_IPV6_AH, bm); return; case ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3: + case ICE_SW_TUN_IPV6_L2TPV3: ice_set_bit(ICE_PROFID_MAC_IPV6_L2TPV3, bm); return; case ICE_SW_TUN_PROFID_IPV6_NAT_T: @@ -5960,6 +6016,9 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo, case ICE_SW_TUN_IPV4_NAT_T: ice_set_bit(ICE_PROFID_IPV4_NAT_T, bm); return; + case ICE_SW_TUN_IPV4_L2TPV3: + ice_set_bit(ICE_PROFID_MAC_IPV4_L2TPV3, bm); + return; case ICE_SW_TUN_AND_NON_TUN: default: prof_type = ICE_PROF_ALL; @@ -6297,6 +6356,20 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, return; } + if (tun_type == ICE_SW_TUN_IPV4_L2TPV3) { + *pkt = dummy_ipv4_l2tpv3_pkt; + *pkt_len = sizeof(dummy_ipv4_l2tpv3_pkt); + *offsets = dummy_ipv4_l2tpv3_packet_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_IPV6_L2TPV3) { + *pkt = dummy_ipv6_l2tpv3_pkt; + *pkt_len = sizeof(dummy_ipv6_l2tpv3_pkt); + *offsets = dummy_ipv6_l2tpv3_packet_offsets; + return; + } + if (tun_type == ICE_SW_TUN_GTP) { *pkt = dummy_udp_gtp_packet; *pkt_len = sizeof(dummy_udp_gtp_packet); @@ -6495,6 +6568,9 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, case ICE_AH: len = sizeof(struct ice_ah_hdr); break; + case ICE_L2TPV3: + len = sizeof(struct ice_l2tpv3_sess_hdr); + break; default: return ICE_ERR_PARAM; } diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h index 765ed0945..8cbda4081 100644 --- a/drivers/net/ice/base/ice_switch.h +++ b/drivers/net/ice/base/ice_switch.h @@ -20,6 +20,7 @@ #define ICE_PROFID_IPV6_AH 74 #define ICE_PROFID_IPV4_NAT_T 75 #define ICE_PROFID_IPV6_NAT_T 76 +#define ICE_PROFID_MAC_IPV4_L2TPV3 77 #define ICE_PROFID_MAC_IPV6_L2TPV3 78 #define ICE_PROFID_IPV4_PFCP_NODE 79 #define ICE_PROFID_IPV4_PFCP_SESSION 80 -- 2.19.1