From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5BC0BA0509; Thu, 7 Apr 2022 05:04:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4D5B1410DC; Thu, 7 Apr 2022 05:04:26 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 7605240689 for ; Thu, 7 Apr 2022 05:04:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649300664; x=1680836664; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=nx2vkRkgUlM9UswNOTqxcq9inEqWC8yDtjZY0VcL4wQ=; b=bnYhp3CkdzzsAOEfLIlhgrqrcMuXwJ/ZFGBX5mIQdBpkV4ECmpHvx5Yr kovvAUcoYwLvbcVg0fB1kvz6in7PWKcg0aAu6M1ggwTp+5kvfdXaEp7TG lC0OqWmxR+0oTdy0yuP4FSvFd2/eQe6mFCksJgg+HO2LKhKqSHEqgMxuw y/C9XTAZ/jKXHBjFIcB263IjctevLTD1YfWBFDyHlfRt6DkYPW9aYRNom Az86Wo9d8JBjHEr9w2EXdupRUFhx4nA0u9avIiM+JVZwNrdMHxifyZokn BuOeqBCE3NEB7WkZPi8eY6WH7YkW7JYyCZj1xNEcYF2AgR2Y2EiFHbjeR Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="321908298" X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="321908298" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 20:04:19 -0700 X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="570852066" Received: from intel-cd-odc-gavin.cd.intel.com ([10.240.178.189]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 20:04:15 -0700 From: Jie Wang To: dev@dpdk.org Cc: stevex.yang@intel.com, qiming.yang@intel.com, qi.z.zhang@intel.com, Jie Wang Subject: [PATCH] net/ice/base: enable FDIR support for IPV6_NETX_PROTO Date: Thu, 7 Apr 2022 11:01:04 +0800 Message-Id: <20220407030104.786060-1-jie1x.wang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org To support the new DDP and be compatible with the old version DDP file, API function 'check_ddp_support_proto_id' is added to detect if the required protocol ID is supported by the current DDP file. Add new protocol ID IPV6_NETX_PROTO support for PF FDIR if current DDP is new DDP and keep behavior if it is the old version DDP. Signed-off-by: Jie Wang --- drivers/net/ice/base/ice_flow.c | 16 +++++++++- drivers/net/ice/base/ice_parser.c | 40 ++++++++++++++++++++++++ drivers/net/ice/base/ice_parser.h | 1 + drivers/net/ice/base/ice_protocol_type.h | 1 + 4 files changed, 57 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c index bcbb9b12c4..054897c1e7 100644 --- a/drivers/net/ice/base/ice_flow.c +++ b/drivers/net/ice/base/ice_flow.c @@ -1370,6 +1370,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params, u16 sib_mask = 0; u16 mask; u16 off; + bool exist; flds = params->prof->segs[seg].fields; @@ -1410,7 +1411,16 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params, break; case ICE_FLOW_FIELD_IDX_IPV6_TTL: case ICE_FLOW_FIELD_IDX_IPV6_PROT: - prot_id = seg == 0 ? ICE_PROT_IPV6_OF_OR_S : ICE_PROT_IPV6_IL; + exist = check_ddp_support_proto_id(hw, + ICE_PROT_IPV6_NEXT_PROTO); + if (!exist) + prot_id = seg == 0 ? + ICE_PROT_IPV6_OF_OR_S : + ICE_PROT_IPV6_IL; + else + prot_id = seg == 0 ? + ICE_PROT_IPV6_NEXT_PROTO : + ICE_PROT_IPV6_IL; /* TTL and PROT share the same extraction seq. entry. * Each is considered a sibling to the other in terms of sharing @@ -1543,6 +1553,10 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params, flds[fld].xtrct.disp = (u8)(ice_flds_info[fld].off % ese_bits); flds[fld].xtrct.idx = params->es_cnt; flds[fld].xtrct.mask = ice_flds_info[fld].mask; + if (prot_id == ICE_PROT_IPV6_NEXT_PROTO) { + flds[fld].xtrct.off = 0; + flds[fld].xtrct.disp = 0; + } /* Adjust the next field-entry index after accommodating the number of * entries this field consumes diff --git a/drivers/net/ice/base/ice_parser.c b/drivers/net/ice/base/ice_parser.c index 9b106baff0..7340ca0590 100644 --- a/drivers/net/ice/base/ice_parser.c +++ b/drivers/net/ice/base/ice_parser.c @@ -552,3 +552,43 @@ void ice_parser_profile_dump(struct ice_hw *hw, struct ice_parser_profile *prof) ice_info(hw, "flags = 0x%04x\n", prof->flags); ice_info(hw, "flags_msk = 0x%04x\n", prof->flags_msk); } + +/** + * check_ddp_support_proto_id - check DDP package file support protocol ID + * @hw: pointer to the HW struct + * @proto_id: protocol ID value + * + * This function maintains the compatibility of the program process by checking + * whether the current DDP file supports the required protocol ID. + */ +bool check_ddp_support_proto_id(struct ice_hw *hw, enum ice_prot_id proto_id) +{ + struct ice_proto_grp_item *proto_grp_table; + struct ice_proto_grp_item *proto_grp; + bool exist = false; + u16 idx = 0; + u16 i; + + proto_grp_table = ice_proto_grp_table_get(hw); + if (!proto_grp_table) + goto exit; + + do { + proto_grp = &proto_grp_table[idx]; + if (idx != proto_grp->idx) + break; + + for (i = 0; i < ICE_PROTO_COUNT_PER_GRP; i++) { + if (proto_grp->po[i].proto_id == proto_id) { + exist = true; + goto exit; + } + } + + idx++; + } while (idx); + +exit: + ice_free(hw, proto_grp_table); + return exist; +} diff --git a/drivers/net/ice/base/ice_parser.h b/drivers/net/ice/base/ice_parser.h index 816aea782a..161061498a 100644 --- a/drivers/net/ice/base/ice_parser.h +++ b/drivers/net/ice/base/ice_parser.h @@ -110,4 +110,5 @@ enum ice_status ice_parser_profile_init(struct ice_parser_result *rslt, struct ice_parser_profile *prof); void ice_parser_profile_dump(struct ice_hw *hw, struct ice_parser_profile *prof); +bool check_ddp_support_proto_id(struct ice_hw *hw, enum ice_prot_id proto_id); #endif /* _ICE_PARSER_H_ */ diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h index 0e6e5990be..83867418c6 100644 --- a/drivers/net/ice/base/ice_protocol_type.h +++ b/drivers/net/ice/base/ice_protocol_type.h @@ -163,6 +163,7 @@ enum ice_prot_id { ICE_PROT_IPV6_OF_OR_S = 40, ICE_PROT_IPV6_IL = 41, ICE_PROT_IPV6_IL_IL = 42, + ICE_PROT_IPV6_NEXT_PROTO = 43, ICE_PROT_IPV6_FRAG = 47, ICE_PROT_TCP_IL = 49, ICE_PROT_UDP_OF = 52, -- 2.25.1