From: "Cao, Yahui" <yahui.cao@intel.com>
To: "Yan, Zhirun" <zhirun.yan@intel.com>,
"Zhang, Qi Z" <qi.z.zhang@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: "Wang, Xiao W" <xiao.w.wang@intel.com>,
"Su, Simei" <simei.su@intel.com>,
"Guo, Junfeng" <junfeng.guo@intel.com>
Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/ice: refactor FDIR set conf function
Date: Fri, 18 Sep 2020 09:28:19 +0000 [thread overview]
Message-ID: <392dafe35d544d23bcf69caec8be124a@intel.com> (raw)
In-Reply-To: <20200915052702.3194061-2-zhirun.yan@intel.com>
> -----Original Message-----
> From: Yan, Zhirun <zhirun.yan@intel.com>
> Sent: Tuesday, September 15, 2020 1:27 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; dev@dpdk.org
> Cc: Cao, Yahui <yahui.cao@intel.com>; Wang, Xiao W
> <xiao.w.wang@intel.com>; Su, Simei <simei.su@intel.com>; Guo, Junfeng
> <junfeng.guo@intel.com>; Yan, Zhirun <zhirun.yan@intel.com>
> Subject: [PATCH v3 1/2] net/ice: refactor FDIR set conf function
>
> The original set conf function in FDIR was very long. Refactor to increase
> readability to make it clearer and allow for more convenient further changes.
>
> No functional change here.
>
> Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
> ---
> drivers/net/ice/ice_fdir_filter.c | 53 +++++++++++++++++--------------
> 1 file changed, 30 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
> index c4b7265ce..a65523781 100644
> --- a/drivers/net/ice/ice_fdir_filter.c
> +++ b/drivers/net/ice/ice_fdir_filter.c
> @@ -943,30 +943,9 @@ ice_fdir_input_set_parse(uint64_t inset, enum
> ice_flow_field *field)
> }
> }
>
> -static int
> -ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
> - uint64_t input_set, enum ice_fdir_tunnel_type ttype)
> +static void
> +ice_fdir_input_set_hdrs(enum ice_fltr_ptype flow, struct ice_flow_seg_info *seg)
[Cao, Yahui]
suggest to change function name from ice_fdir_input_set_hdrs to ice_fdir_input_set_segs,
and all seg related variable can be inited inside this function, so that this function init
seg header and seg field. And below function can be simplified as(see next comments)
> {
> - struct ice_flow_seg_info *seg;
> - struct ice_flow_seg_info *seg_tun = NULL;
> - enum ice_flow_field field[ICE_FLOW_FIELD_IDX_MAX];
> - bool is_tunnel;
> - int i, ret;
> -
> - if (!input_set)
> - return -EINVAL;
> -
> - seg = (struct ice_flow_seg_info *)
> - ice_malloc(hw, sizeof(*seg));
> - if (!seg) {
> - PMD_DRV_LOG(ERR, "No memory can be allocated");
> - return -ENOMEM;
> - }
> -
> - for (i = 0; i < ICE_FLOW_FIELD_IDX_MAX; i++)
> - field[i] = ICE_FLOW_FIELD_IDX_MAX;
> - ice_fdir_input_set_parse(input_set, field);
> -
> switch (flow) {
> case ICE_FLTR_PTYPE_NONF_IPV4_UDP:
> ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_UDP | @@ -
> 1038,6 +1017,34 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum
> ice_fltr_ptype flow,
> PMD_DRV_LOG(ERR, "not supported filter type.");
> break;
> }
> +}
> +
> +static int
> +ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
> + uint64_t input_set, enum ice_fdir_tunnel_type ttype)
> {
> + struct ice_flow_seg_info *seg;
> + struct ice_flow_seg_info *seg_tun = NULL;
> + enum ice_flow_field field[ICE_FLOW_FIELD_IDX_MAX];
> + bool is_tunnel;
> + int i, ret;
> +
> + if (!input_set)
> + return -EINVAL;
> +
> + seg = (struct ice_flow_seg_info *)
> + ice_malloc(hw, sizeof(*seg));
> + if (!seg) {
> + PMD_DRV_LOG(ERR, "No memory can be allocated");
> + return -ENOMEM;
> + }
> +
[Cao, Yahui]
> + for (i = 0; i < ICE_FLOW_FIELD_IDX_MAX; i++)
> + field[i] = ICE_FLOW_FIELD_IDX_MAX;
> +
> + ice_fdir_input_set_parse(input_set, field);
> +
> + ice_fdir_input_set_hdrs(flow, seg);
[Cao, Yahui]
Function above can be replaced by ice_fdir_input_set_segs(seg, input_set, flow)
>
> for (i = 0; field[i] != ICE_FLOW_FIELD_IDX_MAX; i++) {
> ice_flow_set_fld(seg, field[i],
> --
> 2.25.1
next prev parent reply other threads:[~2020-09-18 9:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-08 7:39 [dpdk-dev] [PATCH v1 0/2] refactor and clean FDIR Zhirun Yan
2020-09-08 7:39 ` [dpdk-dev] [PATCH v1 1/2] net/ice: refactor FDIR set conf function Zhirun Yan
2020-09-08 7:39 ` [dpdk-dev] [PATCH v1 2/2] net/ice: merge inner/outer flow seg info for FDIR Zhirun Yan
2020-09-11 5:53 ` Zhang, Qi Z
2020-09-14 3:05 ` [dpdk-dev] [PATCH v1 0/2] refactor and clean FDIR Zhirun Yan
2020-09-14 3:05 ` [dpdk-dev] [PATCH v2 1/2] net/ice: refactor FDIR set conf function Zhirun Yan
2020-09-14 10:54 ` Ferruh Yigit
2020-09-15 5:30 ` Yan, Zhirun
2020-09-14 3:05 ` [dpdk-dev] [PATCH v2 2/2] net/ice: merge inner/outer flow seg info for FDIR Zhirun Yan
2020-09-14 5:23 ` [dpdk-dev] [PATCH v1 0/2] refactor and clean FDIR Zhang, Qi Z
2020-09-15 5:27 ` [dpdk-dev] [PATCH v3 " Zhirun Yan
2020-09-15 5:27 ` [dpdk-dev] [PATCH v3 1/2] net/ice: refactor FDIR set conf function Zhirun Yan
2020-09-18 9:28 ` Cao, Yahui [this message]
2020-09-15 5:27 ` [dpdk-dev] [PATCH v3 2/2] net/ice: merge inner/outer flow seg info for FDIR Zhirun Yan
2020-09-18 9:30 ` Cao, Yahui
2020-09-15 5:38 ` [dpdk-dev] [PATCH v3 0/2] refactor and clean FDIR Zhang, Qi Z
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=392dafe35d544d23bcf69caec8be124a@intel.com \
--to=yahui.cao@intel.com \
--cc=dev@dpdk.org \
--cc=junfeng.guo@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=simei.su@intel.com \
--cc=xiao.w.wang@intel.com \
--cc=zhirun.yan@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.