| 1506 | } |
| 1507 | |
| 1508 | static int |
| 1509 | virtio_dev_get_rss_config(struct virtio_hw *hw, uint32_t *rss_hash_types) |
| 1510 | { |
| 1511 | struct virtio_net_config local_config; |
| 1512 | struct virtio_net_config *config = &local_config; |
| 1513 | |
| 1514 | virtio_read_dev_config(hw, |
| 1515 | offsetof(struct virtio_net_config, rss_max_key_size), |
| 1516 | &config->rss_max_key_size, |
| 1517 | sizeof(config->rss_max_key_size)); |
| 1518 | if (config->rss_max_key_size < VIRTIO_NET_RSS_KEY_SIZE) { |
| 1519 | PMD_INIT_LOG(ERR, "Invalid device RSS max key size (%u)", |
| 1520 | config->rss_max_key_size); |
| 1521 | return -EINVAL; |
| 1522 | } |
| 1523 | |
| 1524 | virtio_read_dev_config(hw, |
| 1525 | offsetof(struct virtio_net_config, |
| 1526 | rss_max_indirection_table_length), |
| 1527 | &config->rss_max_indirection_table_length, |
| 1528 | sizeof(config->rss_max_indirection_table_length)); |
| 1529 | if (config->rss_max_indirection_table_length < VIRTIO_NET_RSS_RETA_SIZE) { |
| 1530 | PMD_INIT_LOG(ERR, "Invalid device RSS max reta size (%u)", |
| 1531 | config->rss_max_indirection_table_length); |
| 1532 | return -EINVAL; |
| 1533 | } |
| 1534 | |
| 1535 | virtio_read_dev_config(hw, |
| 1536 | offsetof(struct virtio_net_config, supported_hash_types), |
| 1537 | &config->supported_hash_types, |
| 1538 | sizeof(config->supported_hash_types)); |
| 1539 | if ((config->supported_hash_types & VIRTIO_NET_HASH_TYPE_MASK) == 0) { |
| 1540 | PMD_INIT_LOG(ERR, "Invalid device RSS hash types (0x%x)", |
| 1541 | config->supported_hash_types); |
| 1542 | return -EINVAL; |
| 1543 | } |
| 1544 | |
| 1545 | *rss_hash_types = config->supported_hash_types & VIRTIO_NET_HASH_TYPE_MASK; |
| 1546 | |
| 1547 | PMD_INIT_LOG(DEBUG, "Device RSS config:"); |
| 1548 | PMD_INIT_LOG(DEBUG, "\t-Max key size: %u", config->rss_max_key_size); |
| 1549 | PMD_INIT_LOG(DEBUG, "\t-Max reta size: %u", config->rss_max_indirection_table_length); |
| 1550 | PMD_INIT_LOG(DEBUG, "\t-Supported hash types: 0x%x", *rss_hash_types); |
| 1551 | |
| 1552 | return 0; |
| 1553 | } |
| 1554 | |
| 1555 | static int |
| 1556 | virtio_dev_rss_hash_update(struct rte_eth_dev *dev, |
no test coverage detected