ice: fix ICE_AQ_VSI_Q_OPT_RSS_* register values
authorAhmed Zaki <ahmed.zaki@intel.com>
Wed, 13 Dec 2023 00:33:17 +0000 (17:33 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 14 Dec 2023 06:07:16 +0000 (22:07 -0800)
Fix the values of the ICE_AQ_VSI_Q_OPT_RSS_* registers. Shifting is
already done when the values are used, no need to double shift. Bug was
not discovered earlier since only ICE_AQ_VSI_Q_OPT_RSS_TPLZ (Zero) is
currently used.

Also, rename ICE_AQ_VSI_Q_OPT_RSS_XXX to ICE_AQ_VSI_Q_OPT_RSS_HASH_XXX
for consistency.

Co-developed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: Ahmed Zaki <ahmed.zaki@intel.com>
Link: https://lore.kernel.org/r/20231213003321.605376-5-ahmed.zaki@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
drivers/net/ethernet/intel/ice/ice_lib.c
drivers/net/ethernet/intel/ice/ice_virtchnl.c

index f77a3c70f262d4a1a28543eff036660a739b4f3b..adf7a5c78f8594ebf291b3bb2d5152c6504172e4 100644 (file)
@@ -492,10 +492,10 @@ struct ice_aqc_vsi_props {
 #define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_M         (0xF << ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S)
 #define ICE_AQ_VSI_Q_OPT_RSS_HASH_S            6
 #define ICE_AQ_VSI_Q_OPT_RSS_HASH_M            (0x3 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
-#define ICE_AQ_VSI_Q_OPT_RSS_TPLZ              (0x0 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
-#define ICE_AQ_VSI_Q_OPT_RSS_SYM_TPLZ          (0x1 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
-#define ICE_AQ_VSI_Q_OPT_RSS_XOR               (0x2 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
-#define ICE_AQ_VSI_Q_OPT_RSS_JHASH             (0x3 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
+#define ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ         0x0U
+#define ICE_AQ_VSI_Q_OPT_RSS_HASH_SYM_TPLZ     0x1U
+#define ICE_AQ_VSI_Q_OPT_RSS_HASH_XOR          0x2U
+#define ICE_AQ_VSI_Q_OPT_RSS_HASH_JHASH                0x3U
        u8 q_opt_tc;
 #define ICE_AQ_VSI_Q_OPT_TC_OVR_S              0
 #define ICE_AQ_VSI_Q_OPT_TC_OVR_M              (0x1F << ICE_AQ_VSI_Q_OPT_TC_OVR_S)
index 626577c7d5b271c4ed1e3b8dd5658f6385ff7c6e..bb6151e798e437fbabdf949472f20973c0cf662a 100644 (file)
@@ -1191,12 +1191,12 @@ static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi)
        case ICE_VSI_PF:
                /* PF VSI will inherit RSS instance of PF */
                lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_PF;
-               hash_type = ICE_AQ_VSI_Q_OPT_RSS_TPLZ;
+               hash_type = ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ;
                break;
        case ICE_VSI_VF:
                /* VF VSI will gets a small RSS table which is a VSI LUT type */
                lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI;
-               hash_type = ICE_AQ_VSI_Q_OPT_RSS_TPLZ;
+               hash_type = ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ;
                break;
        default:
                dev_dbg(dev, "Unsupported VSI type %s\n",
index 1c7b4ded948b63205a72217cda869218e3cf10bf..8872f7a4f43207cdf0742acc19a6d09fbb85dc5c 100644 (file)
@@ -823,8 +823,8 @@ static int ice_vc_handle_rss_cfg(struct ice_vf *vf, u8 *msg, bool add)
                int status;
 
                lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI;
-               hash_type = add ? ICE_AQ_VSI_Q_OPT_RSS_XOR :
-                               ICE_AQ_VSI_Q_OPT_RSS_TPLZ;
+               hash_type = add ? ICE_AQ_VSI_Q_OPT_RSS_HASH_XOR :
+                               ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ;
 
                ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
                if (!ctx) {
@@ -832,11 +832,9 @@ static int ice_vc_handle_rss_cfg(struct ice_vf *vf, u8 *msg, bool add)
                        goto error_param;
                }
 
-               ctx->info.q_opt_rss = ((lut_type <<
-                                       ICE_AQ_VSI_Q_OPT_RSS_LUT_S) &
-                                      ICE_AQ_VSI_Q_OPT_RSS_LUT_M) |
-                                      (hash_type &
-                                       ICE_AQ_VSI_Q_OPT_RSS_HASH_M);
+               ctx->info.q_opt_rss =
+                       FIELD_PREP(ICE_AQ_VSI_Q_OPT_RSS_LUT_M, lut_type) |
+                       FIELD_PREP(ICE_AQ_VSI_Q_OPT_RSS_HASH_M, hash_type);
 
                /* Preserve existing queueing option setting */
                ctx->info.q_opt_rss |= (vsi->info.q_opt_rss &