From 0837e5662b1051d12f5e17d9f8dec8dbad725d25 Mon Sep 17 00:00:00 2001 From: Qi Zhang Date: Mon, 6 Jan 2020 11:38:44 +0800 Subject: [PATCH] net/ice/base: allow flexbytes matching on header Change the extraction sequence generated by flow director flexbytes to use package mac protocol. Without this change data in packet headers cannot be used for flexbyte matching. The old extraction for flex bytes started at the beginning of the payload which is after the header. Signed-off-by: Henry Tieman Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang Acked-by: Qiming Yang --- drivers/net/ice/base/ice_flow.c | 17 ++++------------- drivers/net/ice/base/ice_flow.h | 2 +- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c index 391df1b540..eaa7a3b964 100644 --- a/drivers/net/ice/base/ice_flow.c +++ b/drivers/net/ice/base/ice_flow.c @@ -868,20 +868,11 @@ ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params, raw = ¶ms->prof->segs[seg].raws[i]; - /* Only support matching raw fields in the payload */ - if (raw->off < hdrs_sz) - return ICE_ERR_PARAM; - - /* Convert the segment-relative offset into payload-relative - * offset. - */ - off = raw->off - hdrs_sz; - /* Storing extraction information */ - raw->info.xtrct.prot_id = ICE_PROT_PAY; - raw->info.xtrct.off = (off / ICE_FLOW_FV_EXTRACT_SZ) * + raw->info.xtrct.prot_id = ICE_PROT_MAC_OF_OR_S; + raw->info.xtrct.off = (raw->off / ICE_FLOW_FV_EXTRACT_SZ) * ICE_FLOW_FV_EXTRACT_SZ; - raw->info.xtrct.disp = (off % ICE_FLOW_FV_EXTRACT_SZ) * + raw->info.xtrct.disp = (raw->off % ICE_FLOW_FV_EXTRACT_SZ) * BITS_PER_BYTE; raw->info.xtrct.idx = params->es_cnt; @@ -909,7 +900,7 @@ ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params, else idx = params->es_cnt; - params->es[idx].prot_id = ICE_PROT_PAY; + params->es[idx].prot_id = raw->info.xtrct.prot_id; params->es[idx].off = off; params->es_cnt++; off += ICE_FLOW_FV_EXTRACT_SZ; diff --git a/drivers/net/ice/base/ice_flow.h b/drivers/net/ice/base/ice_flow.h index 4686274af8..d7b10ccc34 100644 --- a/drivers/net/ice/base/ice_flow.h +++ b/drivers/net/ice/base/ice_flow.h @@ -282,8 +282,8 @@ struct ice_flow_fld_info { }; struct ice_flow_seg_fld_raw { - int off; /* Offset from the start of the segment */ struct ice_flow_fld_info info; + u16 off; /* Offset from the start of the segment */ }; struct ice_flow_seg_info { -- 2.20.1