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

Function ena_rss_hash_conf_get

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

Source from the content-addressed store, hash-verified

531}
532
533int ena_rss_hash_conf_get(struct rte_eth_dev *dev,
534 struct rte_eth_rss_conf *rss_conf)
535{
536 struct ena_adapter *adapter = dev->data->dev_private;
537 struct ena_com_dev *ena_dev = &adapter->ena_dev;
538 enum ena_admin_flow_hash_proto proto;
539 uint64_t rss_hf = 0;
540 int rc, i;
541 uint16_t admin_hf;
542 static bool warn_once;
543
544 if (!(dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_RSS_HASH)) {
545 PMD_DRV_LOG(ERR, "RSS was not configured for the PMD\n");
546 return -ENOTSUP;
547 }
548
549 if (rss_conf->rss_key != NULL) {
550 rc = ena_get_rss_hash_key(ena_dev, rss_conf->rss_key);
551 if (unlikely(rc != 0)) {
552 PMD_DRV_LOG(ERR,
553 "Cannot retrieve RSS hash key, err: %d\n",
554 rc);
555 return rc;
556 }
557 }
558
559 for (i = 0; i < ENA_ADMIN_RSS_PROTO_NUM; ++i) {
560 proto = (enum ena_admin_flow_hash_proto)i;
561 rte_spinlock_lock(&adapter->admin_lock);
562 rc = ena_com_get_hash_ctrl(ena_dev, proto, &admin_hf);
563 rte_spinlock_unlock(&adapter->admin_lock);
564 if (rc == ENA_COM_UNSUPPORTED) {
565 /* As some devices may support only reading rss hash
566 * key and not the hash ctrl, we want to notify the
567 * caller that this feature is only partially supported
568 * and do not return an error - the caller could be
569 * interested only in the key value.
570 */
571 if (!warn_once) {
572 PMD_DRV_LOG(WARNING,
573 "Reading hash control from the device is not supported. .rss_hf will contain a default value.\n");
574 warn_once = true;
575 }
576 rss_hf = ENA_ALL_RSS_HF;
577 break;
578 } else if (rc != 0) {
579 PMD_DRV_LOG(ERR,
580 "Failed to retrieve hash ctrl for proto: %d with err: %d\n",
581 i, rc);
582 return rc;
583 }
584
585 rss_hf |= ena_admin_hf_to_eth_hf(proto, admin_hf);
586 }
587
588 rss_conf->rss_hf = rss_hf;
589 return 0;
590}

Callers

nothing calls this directly

Calls 5

ena_get_rss_hash_keyFunction · 0.85
ena_admin_hf_to_eth_hfFunction · 0.85
rte_spinlock_lockFunction · 0.50
ena_com_get_hash_ctrlFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by

no test coverage detected