@@ -1261,6 +1261,194 @@ void ice_clear_pxe_mode(struct ice_hw *hw)
12611261 ice_aq_clear_pxe_mode (hw );
12621262}
12631263
1264+ /**
1265+ * __ice_aq_get_set_rss_lut
1266+ * @hw: pointer to the hardware structure
1267+ * @vsi_id: VSI FW index
1268+ * @lut_type: LUT table type
1269+ * @lut: pointer to the LUT buffer provided by the caller
1270+ * @lut_size: size of the LUT buffer
1271+ * @glob_lut_idx: global LUT index
1272+ * @set: set true to set the table, false to get the table
1273+ *
1274+ * Internal function to get (0x0B05) or set (0x0B03) RSS look up table
1275+ */
1276+ static enum ice_status
1277+ __ice_aq_get_set_rss_lut (struct ice_hw * hw , u16 vsi_id , u8 lut_type , u8 * lut ,
1278+ u16 lut_size , u8 glob_lut_idx , bool set )
1279+ {
1280+ struct ice_aqc_get_set_rss_lut * cmd_resp ;
1281+ struct ice_aq_desc desc ;
1282+ enum ice_status status ;
1283+ u16 flags = 0 ;
1284+
1285+ cmd_resp = & desc .params .get_set_rss_lut ;
1286+
1287+ if (set ) {
1288+ ice_fill_dflt_direct_cmd_desc (& desc , ice_aqc_opc_set_rss_lut );
1289+ desc .flags |= cpu_to_le16 (ICE_AQ_FLAG_RD );
1290+ } else {
1291+ ice_fill_dflt_direct_cmd_desc (& desc , ice_aqc_opc_get_rss_lut );
1292+ }
1293+
1294+ cmd_resp -> vsi_id = cpu_to_le16 (((vsi_id <<
1295+ ICE_AQC_GSET_RSS_LUT_VSI_ID_S ) &
1296+ ICE_AQC_GSET_RSS_LUT_VSI_ID_M ) |
1297+ ICE_AQC_GSET_RSS_LUT_VSI_VALID );
1298+
1299+ switch (lut_type ) {
1300+ case ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_VSI :
1301+ case ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF :
1302+ case ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL :
1303+ flags |= ((lut_type << ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S ) &
1304+ ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_M );
1305+ break ;
1306+ default :
1307+ status = ICE_ERR_PARAM ;
1308+ goto ice_aq_get_set_rss_lut_exit ;
1309+ }
1310+
1311+ if (lut_type == ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL ) {
1312+ flags |= ((glob_lut_idx << ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_S ) &
1313+ ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_M );
1314+
1315+ if (!set )
1316+ goto ice_aq_get_set_rss_lut_send ;
1317+ } else if (lut_type == ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF ) {
1318+ if (!set )
1319+ goto ice_aq_get_set_rss_lut_send ;
1320+ } else {
1321+ goto ice_aq_get_set_rss_lut_send ;
1322+ }
1323+
1324+ /* LUT size is only valid for Global and PF table types */
1325+ if (lut_size == ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128 ) {
1326+ flags |= (ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128_FLAG <<
1327+ ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S ) &
1328+ ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M ;
1329+ } else if (lut_size == ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512 ) {
1330+ flags |= (ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512_FLAG <<
1331+ ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S ) &
1332+ ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M ;
1333+ } else if ((lut_size == ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K ) &&
1334+ (lut_type == ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF )) {
1335+ flags |= (ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K_FLAG <<
1336+ ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S ) &
1337+ ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M ;
1338+ } else {
1339+ status = ICE_ERR_PARAM ;
1340+ goto ice_aq_get_set_rss_lut_exit ;
1341+ }
1342+
1343+ ice_aq_get_set_rss_lut_send :
1344+ cmd_resp -> flags = cpu_to_le16 (flags );
1345+ status = ice_aq_send_cmd (hw , & desc , lut , lut_size , NULL );
1346+
1347+ ice_aq_get_set_rss_lut_exit :
1348+ return status ;
1349+ }
1350+
1351+ /**
1352+ * ice_aq_get_rss_lut
1353+ * @hw: pointer to the hardware structure
1354+ * @vsi_id: VSI FW index
1355+ * @lut_type: LUT table type
1356+ * @lut: pointer to the LUT buffer provided by the caller
1357+ * @lut_size: size of the LUT buffer
1358+ *
1359+ * get the RSS lookup table, PF or VSI type
1360+ */
1361+ enum ice_status
1362+ ice_aq_get_rss_lut (struct ice_hw * hw , u16 vsi_id , u8 lut_type , u8 * lut ,
1363+ u16 lut_size )
1364+ {
1365+ return __ice_aq_get_set_rss_lut (hw , vsi_id , lut_type , lut , lut_size , 0 ,
1366+ false);
1367+ }
1368+
1369+ /**
1370+ * ice_aq_set_rss_lut
1371+ * @hw: pointer to the hardware structure
1372+ * @vsi_id: VSI FW index
1373+ * @lut_type: LUT table type
1374+ * @lut: pointer to the LUT buffer provided by the caller
1375+ * @lut_size: size of the LUT buffer
1376+ *
1377+ * set the RSS lookup table, PF or VSI type
1378+ */
1379+ enum ice_status
1380+ ice_aq_set_rss_lut (struct ice_hw * hw , u16 vsi_id , u8 lut_type , u8 * lut ,
1381+ u16 lut_size )
1382+ {
1383+ return __ice_aq_get_set_rss_lut (hw , vsi_id , lut_type , lut , lut_size , 0 ,
1384+ true);
1385+ }
1386+
1387+ /**
1388+ * __ice_aq_get_set_rss_key
1389+ * @hw: pointer to the hw struct
1390+ * @vsi_id: VSI FW index
1391+ * @key: pointer to key info struct
1392+ * @set: set true to set the key, false to get the key
1393+ *
1394+ * get (0x0B04) or set (0x0B02) the RSS key per VSI
1395+ */
1396+ static enum
1397+ ice_status __ice_aq_get_set_rss_key (struct ice_hw * hw , u16 vsi_id ,
1398+ struct ice_aqc_get_set_rss_keys * key ,
1399+ bool set )
1400+ {
1401+ struct ice_aqc_get_set_rss_key * cmd_resp ;
1402+ u16 key_size = sizeof (* key );
1403+ struct ice_aq_desc desc ;
1404+
1405+ cmd_resp = & desc .params .get_set_rss_key ;
1406+
1407+ if (set ) {
1408+ ice_fill_dflt_direct_cmd_desc (& desc , ice_aqc_opc_set_rss_key );
1409+ desc .flags |= cpu_to_le16 (ICE_AQ_FLAG_RD );
1410+ } else {
1411+ ice_fill_dflt_direct_cmd_desc (& desc , ice_aqc_opc_get_rss_key );
1412+ }
1413+
1414+ cmd_resp -> vsi_id = cpu_to_le16 (((vsi_id <<
1415+ ICE_AQC_GSET_RSS_KEY_VSI_ID_S ) &
1416+ ICE_AQC_GSET_RSS_KEY_VSI_ID_M ) |
1417+ ICE_AQC_GSET_RSS_KEY_VSI_VALID );
1418+
1419+ return ice_aq_send_cmd (hw , & desc , key , key_size , NULL );
1420+ }
1421+
1422+ /**
1423+ * ice_aq_get_rss_key
1424+ * @hw: pointer to the hw struct
1425+ * @vsi_id: VSI FW index
1426+ * @key: pointer to key info struct
1427+ *
1428+ * get the RSS key per VSI
1429+ */
1430+ enum ice_status
1431+ ice_aq_get_rss_key (struct ice_hw * hw , u16 vsi_id ,
1432+ struct ice_aqc_get_set_rss_keys * key )
1433+ {
1434+ return __ice_aq_get_set_rss_key (hw , vsi_id , key , false);
1435+ }
1436+
1437+ /**
1438+ * ice_aq_set_rss_key
1439+ * @hw: pointer to the hw struct
1440+ * @vsi_id: VSI FW index
1441+ * @keys: pointer to key info struct
1442+ *
1443+ * set the RSS key per VSI
1444+ */
1445+ enum ice_status
1446+ ice_aq_set_rss_key (struct ice_hw * hw , u16 vsi_id ,
1447+ struct ice_aqc_get_set_rss_keys * keys )
1448+ {
1449+ return __ice_aq_get_set_rss_key (hw , vsi_id , keys , true);
1450+ }
1451+
12641452/**
12651453 * ice_aq_add_lan_txq
12661454 * @hw: pointer to the hardware structure
0 commit comments