MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ena_rss_hash_set

Function ena_rss_hash_set

dpdk/drivers/net/ena/ena_rss.c:393–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393static int ena_rss_hash_set(struct ena_com_dev *ena_dev,
394 struct rte_eth_rss_conf *rss_conf,
395 bool default_allowed)
396{
397 uint8_t hw_rss_key[ENA_HASH_KEY_SIZE];
398 uint8_t *rss_key;
399 int rc;
400
401 if (rss_conf->rss_key != NULL) {
402 /* Reorder the RSS key bytes for the hardware requirements. */
403 ena_reorder_rss_hash_key(hw_rss_key, rss_conf->rss_key,
404 ENA_HASH_KEY_SIZE);
405 rss_key = hw_rss_key;
406 } else {
407 rss_key = NULL;
408 }
409
410 /* If the rss_key is NULL, then the randomized key will be used. */
411 rc = ena_com_fill_hash_function(ena_dev, ENA_ADMIN_TOEPLITZ,
412 rss_key, ENA_HASH_KEY_SIZE, 0);
413 if (rc != 0 && !(default_allowed && rc == ENA_COM_UNSUPPORTED)) {
414 PMD_DRV_LOG(ERR,
415 "Failed to set RSS hash function in the device\n");
416 return rc;
417 }
418
419 rc = ena_set_hash_fields(ena_dev, rss_conf->rss_hf);
420 if (rc == ENA_COM_UNSUPPORTED) {
421 if (rss_conf->rss_key == NULL && !default_allowed) {
422 PMD_DRV_LOG(ERR,
423 "Setting RSS hash fields is not supported\n");
424 return -ENOTSUP;
425 }
426 PMD_DRV_LOG(WARNING,
427 "Setting RSS hash fields is not supported. Using default values: 0x%" PRIx64 "\n",
428 (uint64_t)(ENA_ALL_RSS_HF));
429 } else if (rc != 0) {
430 PMD_DRV_LOG(ERR, "Failed to set RSS hash fields\n");
431 return rc;
432 }
433
434 return 0;
435}
436
437/* ENA HW interprets the RSS key in reverse bytes order. Because of that, the
438 * key must be processed upon interaction with ena_com layer.

Callers 2

ena_rss_configureFunction · 0.85
ena_rss_hash_updateFunction · 0.85

Calls 3

ena_reorder_rss_hash_keyFunction · 0.85
ena_set_hash_fieldsFunction · 0.85

Tested by

no test coverage detected