On Fri, Aug 29, 2025 at 10:18:05AM +0000, Aleksandr Loktionov wrote:
> Introduce infrastructure to support GTP-specific RSS configuration
> in the ICE driver, enabling flexible and programmable flow hashing
> on virtual functions (VFs).
> 
>  - Define new virtchnl protocol header and field types for GTPC, GTPU,
>    L2TPv2, ECPRI, PPP, GRE, and IP fragment headers.
>  - Extend virtchnl.h to support additional RSS fields including checksums,
>    TEID, QFI, and IPv6 prefix matching.
>  - Add VF-side hash context structures for IPv4/IPv6 and GTPU flows.
>  - Implement context tracking and rule ordering logic for TCAM-based
>    RSS configuration.
>  - Introduce symmetric hashing support for raw and tunnel flows.
>  - Update ice_vf_lib.h and virt/rss.c to handle advanced RSS
>    configuration via virtchnl messages.
> 
> VFs can express RSS configuration for GTP flows
> using ethtool and virtchnl, laying the foundation for tunnel-aware
> RSS offloads in virtualized environments.
> 
> Co-developed-by: Dan Nowlin <[email protected]>
> Signed-off-by: Dan Nowlin <[email protected]>
> Co-developed-by: Jie Wang <[email protected]>
> Signed-off-by: Jie Wang <[email protected]>
> Co-developed-by: Junfeng Guo <[email protected]>
> Signed-off-by: Junfeng Guo <[email protected]>
> Co-developed-by: Qi Zhang <[email protected]>
> Signed-off-by: Qi Zhang <[email protected]>
> Co-developed-by: Ting Xu <[email protected]>
> Signed-off-by: Ting Xu <[email protected]>
> Signed-off-by: Przemek Kitszel <[email protected]>
> Signed-off-by: Aleksandr Loktionov <[email protected]>

Aside from the minor comment below, this looks good to me.
So with that addressed, feel free to add:

Reviewed-by: Simon Horman <[email protected]>

> diff --git a/drivers/net/ethernet/intel/ice/virt/rss.c 
> b/drivers/net/ethernet/intel/ice/virt/rss.c

...

> +/**
> + * ice_parse_raw_rss_pattern - Parse raw pattern spec and mask for RSS
> + * @vf: pointer to the VF info
> + * @proto: pointer to the virtchnl protocol header
> + * @raw_cfg: pointer to the RSS raw pattern configuration
> + *
> + * Parser function to get spec and mask from virtchnl message, and parse
> + * them to get the corresponding profile and offset. The profile is used
> + * to add RSS configuration.
> + *
> + * Return: 0 on success; negative error code on failure.
> + */
> +static int
> +ice_parse_raw_rss_pattern(struct ice_vf *vf, struct virtchnl_proto_hdrs 
> *proto,
> +                       struct ice_rss_raw_cfg *raw_cfg)
> +{
> +     struct ice_parser_result pkt_parsed;
> +     struct ice_hw *hw = &vf->pf->hw;
> +     struct ice_parser_profile prof;
> +     u16 pkt_len;
> +     struct ice_parser *psr;
> +     u8 *pkt_buf, *msk_buf;
> +     int ret = 0;
> +
> +     pkt_len = proto->raw.pkt_len;
> +     if (!pkt_len)
> +             return -EINVAL;
> +     if (pkt_len > VIRTCHNL_MAX_SIZE_RAW_PACKET)
> +             pkt_len = VIRTCHNL_MAX_SIZE_RAW_PACKET;
> +
> +     pkt_buf = kzalloc(pkt_len, GFP_KERNEL);
> +     msk_buf = kzalloc(pkt_len, GFP_KERNEL);
> +     if (!pkt_buf || !msk_buf) {
> +             ret = -ENOMEM;
> +             goto free_alloc;
> +     }
> +
> +     memcpy(pkt_buf, proto->raw.spec, pkt_len);
> +     memcpy(msk_buf, proto->raw.mask, pkt_len);
> +
> +     psr = ice_parser_create(hw);
> +     if (IS_ERR(psr)) {
> +             ret = PTR_ERR(psr);
> +             goto parser_destroy;

I think this one should be goto free_alloc.
Else there will be a NULL pointer dereference in ice_parser_destroy().

> +     }
> +
> +     ret = ice_parser_run(psr, pkt_buf, pkt_len, &pkt_parsed);
> +     if (ret)
> +             goto parser_destroy;
> +
> +     ret = ice_parser_profile_init(&pkt_parsed, pkt_buf, msk_buf,
> +                                   pkt_len, ICE_BLK_RSS, &prof);
> +     if (ret)
> +             goto parser_destroy;
> +
> +     memcpy(&raw_cfg->prof, &prof, sizeof(prof));
> +
> +parser_destroy:
> +     ice_parser_destroy(psr);
> +free_alloc:
> +     kfree(pkt_buf);
> +     kfree(msk_buf);
> +     return ret;
> +}

Reply via email to