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

Function virtio_dev_rss_hash_update

dpdk/drivers/net/virtio/virtio_ethdev.c:1555–1600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1553}
1554
1555static int
1556virtio_dev_rss_hash_update(struct rte_eth_dev *dev,
1557 struct rte_eth_rss_conf *rss_conf)
1558{
1559 struct virtio_hw *hw = dev->data->dev_private;
1560 char old_rss_key[VIRTIO_NET_RSS_KEY_SIZE];
1561 uint32_t old_hash_types;
1562 uint16_t nb_queues;
1563 int ret;
1564
1565 if (!virtio_with_feature(hw, VIRTIO_NET_F_RSS))
1566 return -ENOTSUP;
1567
1568 if (rss_conf->rss_hf & ~virtio_to_ethdev_rss_offloads(VIRTIO_NET_HASH_TYPE_MASK))
1569 return -EINVAL;
1570
1571 old_hash_types = hw->rss_hash_types;
1572 hw->rss_hash_types = ethdev_to_virtio_rss_offloads(rss_conf->rss_hf);
1573
1574 if (rss_conf->rss_key && rss_conf->rss_key_len) {
1575 if (rss_conf->rss_key_len != VIRTIO_NET_RSS_KEY_SIZE) {
1576 PMD_INIT_LOG(ERR, "Driver only supports %u RSS key length",
1577 VIRTIO_NET_RSS_KEY_SIZE);
1578 ret = -EINVAL;
1579 goto restore_types;
1580 }
1581 memcpy(old_rss_key, hw->rss_key, VIRTIO_NET_RSS_KEY_SIZE);
1582 memcpy(hw->rss_key, rss_conf->rss_key, VIRTIO_NET_RSS_KEY_SIZE);
1583 }
1584
1585 nb_queues = RTE_MAX(dev->data->nb_rx_queues, dev->data->nb_tx_queues);
1586 ret = virtio_set_multiple_queues_rss(dev, nb_queues);
1587 if (ret < 0) {
1588 PMD_INIT_LOG(ERR, "Failed to apply new RSS config to the device");
1589 goto restore_key;
1590 }
1591
1592 return 0;
1593restore_key:
1594 if (rss_conf->rss_key && rss_conf->rss_key_len)
1595 memcpy(hw->rss_key, old_rss_key, VIRTIO_NET_RSS_KEY_SIZE);
1596restore_types:
1597 hw->rss_hash_types = old_hash_types;
1598
1599 return ret;
1600}
1601
1602static int
1603virtio_dev_rss_hash_conf_get(struct rte_eth_dev *dev,

Callers

nothing calls this directly

Calls 5

virtio_with_featureFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected