On 8/18/2025 5:39 AM, 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 ice_virtchnl_rss.c to handle advanced RSS
configuration via virtchnl messages.
This patch enables VFs to 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]>
---
drivers/net/ethernet/intel/ice/ice_vf_lib.h | 48 +
.../net/ethernet/intel/ice/ice_virtchnl_rss.c | 1297 ++++++++++++++++-
I don't believe you are based on Przemek's changes as this should be
under virt folder i.e. series doesn't apply.
include/linux/avf/virtchnl.h | 50 +
3 files changed, 1340 insertions(+), 55 deletions(-)
...
+/**
+ * ice_is_hash_cfg_valid - check if the hash context is valid
+ * @cfg: pointer to the RSS hash configuration
+ *
+ * This function will return true if the hash context is valid, otherwise
+ * return false.
+ */
Many of the kdocs are missing the 'Return:'. For the boiler plate kdocs,
we should probably just remove the kdoc altogether.
Also, as "This patch..." is not liked, I feel we should avoid starting
many of these with "This function..." Saves some chars too :)
Thanks,
Tony
+static bool ice_is_hash_cfg_valid(struct ice_rss_hash_cfg *cfg)
+{
+ return cfg->hash_flds && cfg->addl_hdrs;
+}
+
+/**
+ * ice_hash_cfg_reset - reset the hash context
+ * @cfg: pointer to the RSS hash configuration
+ *
+ * This function will reset the hash context which stores the valid rule info.
+ */
+static void ice_hash_cfg_reset(struct ice_rss_hash_cfg *cfg)
+{
+ cfg->hash_flds = 0;
+ cfg->addl_hdrs = 0;
+ cfg->hdr_type = ICE_RSS_OUTER_HEADERS;
+ cfg->symm = 0;
+}
+
+/**
+ * ice_hash_cfg_record - record the hash context
+ * @ctx: pointer to the global RSS hash configuration
+ * @cfg: pointer to the RSS hash configuration to be recorded
+ *
+ * This function will record the hash context which stores the valid rule info.
+ */
+static void ice_hash_cfg_record(struct ice_rss_hash_cfg *ctx,
+ struct ice_rss_hash_cfg *cfg)
+{
+ ctx->hash_flds = cfg->hash_flds;
+ ctx->addl_hdrs = cfg->addl_hdrs;
+ ctx->hdr_type = cfg->hdr_type;
+ ctx->symm = cfg->symm;
+}
+
+/**
+ * ice_hash_moveout - delete a RSS configuration
+ * @vf: pointer to the VF info
+ * @cfg: pointer to the RSS hash configuration
+ *
+ * This function will delete an existing RSS hash configuration but not delete
+ * the hash context which stores the rule info.
+ */
+static int
+ice_hash_moveout(struct ice_vf *vf, struct ice_rss_hash_cfg *cfg)
+{
+ struct device *dev = ice_pf_to_dev(vf->pf);
+ struct ice_vsi *vsi = ice_get_vf_vsi(vf);
+ struct ice_hw *hw = &vf->pf->hw;
+ int ret;
+
+ if (!ice_is_hash_cfg_valid(cfg) || !vsi)
+ return -ENOENT;
+
+ ret = ice_rem_rss_cfg(hw, vsi->idx, cfg);
+ if (ret && ret != -ENOENT) {
+ dev_err(dev, "ice_rem_rss_cfg failed for VF %d, VSI %d,
error:%d\n",
+ vf->vf_id, vf->lan_vsi_idx, ret);
+ return -EBUSY;
+ }
+
+ return 0;
+}
+
+/**
+ * ice_hash_moveback - Add an RSS hash configuration for a VF
+ * @vf: pointer to the VF structure
+ * @cfg: pointer to the RSS hash configuration to be applied
+ *
+ * Add an RSS hash configuration to the specified VF if the configuration
+ * context is valid and the associated VSI is available. This function
+ * attempts to apply the configuration via hardware programming.
+ *
+ * Return: 0 on success, -ENOENT if the configuration or VSI is invalid,
+ * -EBUSY if hardware programming fails.
+ */
+static int
+ice_hash_moveback(struct ice_vf *vf, struct ice_rss_hash_cfg *cfg)
+{
+ struct device *dev = ice_pf_to_dev(vf->pf);
+ struct ice_vsi *vsi = ice_get_vf_vsi(vf);
+ struct ice_hw *hw = &vf->pf->hw;
+ int ret;
+
+ if (!ice_is_hash_cfg_valid(cfg) || !vsi)
+ return -ENOENT;
+
+ ret = ice_add_rss_cfg(hw, vsi, cfg);
+ if (ret) {
+ dev_err(dev, "ice_add_rss_cfg failed for VF %d, VSI %d,
error:%d\n",
+ vf->vf_id, vf->lan_vsi_idx, ret);
+ return -EBUSY;
+ }
+
+ return 0;
+}
+