From 83a148038e48849b0c9f80068aec7688ae475b7b Mon Sep 17 00:00:00 2001 From: Leyi Rong Date: Wed, 19 Jun 2019 23:17:38 +0800 Subject: [PATCH] net/ice/base: include DIR flag in extraction sequence Once upon a time, the ice_flow_create_xtrct_seq() function in ice_flow.c extracted only protocol fields explicitly specified by the caller of the ice_flow_add_prof() function via its struct ice_flow_seg_info instances. However, to support different ingress and egress flow profiles with the same matching criteria, it would be necessary to also match on the packet Direction metadata. The primary reason was because there could not be more than one HW profile with the same CDID, PTG, and VSIG. The Direction metadata was not a parameter used to select HW profile IDs. Thus, for ACL, the direction flag would need to be added to the extraction sequence. This information will be use later as one criteria for ACL scenario entry matching. Signed-off-by: Chinh T Cao Signed-off-by: Paul M Stillwell Jr Signed-off-by: Leyi Rong Acked-by: Qi Zhang --- drivers/net/ice/base/ice_flow.c | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c index be819e0e9c..f1bf5b5e76 100644 --- a/drivers/net/ice/base/ice_flow.c +++ b/drivers/net/ice/base/ice_flow.c @@ -495,6 +495,42 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params) return ICE_SUCCESS; } +/** + * ice_flow_xtract_pkt_flags - Create an extr sequence entry for packet flags + * @hw: pointer to the HW struct + * @params: information about the flow to be processed + * @flags: The value of pkt_flags[x:x] in RX/TX MDID metadata. + * + * This function will allocate an extraction sequence entries for a DWORD size + * chunk of the packet flags. + */ +static enum ice_status +ice_flow_xtract_pkt_flags(struct ice_hw *hw, + struct ice_flow_prof_params *params, + enum ice_flex_mdid_pkt_flags flags) +{ + u8 fv_words = hw->blk[params->blk].es.fvw; + u8 idx; + + /* Make sure the number of extraction sequence entries required does not + * exceed the block's capacity. + */ + if (params->es_cnt >= fv_words) + return ICE_ERR_MAX_LIMIT; + + /* some blocks require a reversed field vector layout */ + if (hw->blk[params->blk].es.reverse) + idx = fv_words - params->es_cnt - 1; + else + idx = params->es_cnt; + + params->es[idx].prot_id = ICE_PROT_META_ID; + params->es[idx].off = flags; + params->es_cnt++; + + return ICE_SUCCESS; +} + /** * ice_flow_xtract_fld - Create an extraction sequence entry for the given field * @hw: pointer to the HW struct @@ -744,6 +780,13 @@ ice_flow_create_xtrct_seq(struct ice_hw *hw, enum ice_status status = ICE_SUCCESS; u8 i; + /* For ACL, we also need to extract the direction bit (Rx,Tx) data from + * packet flags + */ + if (params->blk == ICE_BLK_ACL) + ice_flow_xtract_pkt_flags(hw, params, + ICE_RX_MDID_PKT_FLAGS_15_0); + for (i = 0; i < params->prof->segs_cnt; i++) { u64 match = params->prof->segs[i].match; u16 j; -- 2.20.1