diff options
author | Ting Xu <ting.xu@intel.com> | 2022-10-21 16:48:44 +0800 |
---|---|---|
committer | Damjan Marion <dmarion@0xa5.net> | 2022-12-02 13:42:28 +0000 |
commit | a6d16b71308f1badf4b362d26d2326a2977fe462 (patch) | |
tree | 597e7423af50be1eafdd3ef3174703348b093ebc /src/plugins/avf/avf_fdir_lib.c | |
parent | 583d4c94dc69f624a44a8dfa5c82165f3ca27271 (diff) |
avf: support generic flow
Support generic flow in native avf.
Enable necessary RSS hash function for generic flow. Extend some
structures and functions from for FDIR only to for both RSS and FDIR
flows. Modify virtual channel message to align with ice kernel driver.
Add functions to parse generic flow patterns. The parsing results will
be delivered to the kernel driver and create corresponding flow rules.
Type: feature
Signed-off-by: Ting Xu <ting.xu@intel.com>
Change-Id: I82ce102a21993f1bae8a8bf23e491d5e1c261f61
Diffstat (limited to 'src/plugins/avf/avf_fdir_lib.c')
-rw-r--r-- | src/plugins/avf/avf_fdir_lib.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/src/plugins/avf/avf_fdir_lib.c b/src/plugins/avf/avf_fdir_lib.c index f38614e87ec..b16c09f9742 100644 --- a/src/plugins/avf/avf_fdir_lib.c +++ b/src/plugins/avf/avf_fdir_lib.c @@ -591,7 +591,7 @@ avf_fdir_rcfg_act_mark (struct avf_fdir_conf *rcfg, const u32 mark, } int -avf_fdir_rcfg_validate (struct avf_fdir_vc_ctx *ctx, +avf_fdir_rcfg_validate (struct avf_flow_vc_ctx *ctx, struct avf_fdir_conf *rcfg) { int ret; @@ -617,7 +617,7 @@ avf_fdir_rcfg_validate (struct avf_fdir_vc_ctx *ctx, } int -avf_fdir_rule_create (struct avf_fdir_vc_ctx *ctx, struct avf_fdir_conf *rcfg) +avf_fdir_rule_create (struct avf_flow_vc_ctx *ctx, struct avf_fdir_conf *rcfg) { int ret; rcfg->add_fltr.vsi_id = rcfg->vsi; @@ -644,7 +644,7 @@ avf_fdir_rule_create (struct avf_fdir_vc_ctx *ctx, struct avf_fdir_conf *rcfg) } int -avf_fdir_rule_destroy (struct avf_fdir_vc_ctx *ctx, struct avf_fdir_conf *rcfg) +avf_fdir_rule_destroy (struct avf_flow_vc_ctx *ctx, struct avf_fdir_conf *rcfg) { int ret; struct virtchnl_fdir_del fdir_ret; @@ -786,6 +786,36 @@ avf_fdir_parse_action (const struct avf_flow_action actions[], } int +avf_fdir_parse_generic_pattern (struct avf_fdir_conf *rcfg, + struct avf_flow_item avf_items[], + struct avf_flow_error *error) +{ + struct avf_flow_item *item = avf_items; + u8 *pkt_buf, *msk_buf; + u16 spec_len, pkt_len; + + spec_len = clib_strnlen (item->spec, VIRTCHNL_MAX_SIZE_GEN_PACKET); + pkt_len = spec_len / 2; + + pkt_buf = clib_mem_alloc (pkt_len); + msk_buf = clib_mem_alloc (pkt_len); + + avf_parse_generic_pattern (item, pkt_buf, msk_buf, spec_len); + + clib_memcpy (rcfg->add_fltr.rule_cfg.proto_hdrs.raw.spec, pkt_buf, pkt_len); + clib_memcpy (rcfg->add_fltr.rule_cfg.proto_hdrs.raw.mask, msk_buf, pkt_len); + + rcfg->add_fltr.rule_cfg.proto_hdrs.count = 0; + rcfg->add_fltr.rule_cfg.proto_hdrs.tunnel_level = 0; + rcfg->add_fltr.rule_cfg.proto_hdrs.raw.pkt_len = pkt_len; + + clib_mem_free (pkt_buf); + clib_mem_free (msk_buf); + + return 0; +} + +int avf_fdir_parse_pattern (struct avf_fdir_conf *rcfg, struct avf_flow_item avf_items[], struct avf_flow_error *error) |