Skip to content

Commit

Permalink
virtio-l2fwd: selectively enable VIRTIO_NET_F_RSS
Browse files Browse the repository at this point in the history
This patch fixes following
1. In the ethdev to virto mapping, if the underlying eth device does not
support RETA updates, do not negotiate the VIRTIO_NET_F_RSS feature
2. Limit max queue pairs to 1 in case of TUN PMD

Signed-off-by: Kommula Shiva Shankar <kshankar@marvell.com>
Change-Id: Ic8806d239a42dedbe05f1aaf09d1b8de7f2a862c
Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/dataplane/dpu-offload/+/134574
Tested-by: sa_ip-toolkits-Jenkins <sa_ip-toolkits-jenkins@marvell.com>
Reviewed-by: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>
  • Loading branch information
ShivaShankarKommula authored and jerinjacobk committed Sep 3, 2024
1 parent 154f1a8 commit c0d5df2
Showing 1 changed file with 29 additions and 19 deletions.
48 changes: 29 additions & 19 deletions app/virtio-l2fwd/virtio_l2fwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2241,21 +2241,23 @@ mq_configure(uint16_t virtio_devid, bool qmap_set)
memset(reta_conf, 0, sizeof(reta_conf));
reta_size = eth_dev_info[portid].reta_size;

for (i = 0; i < reta_size; i++)
reta_conf[i / RTE_ETH_RETA_GROUP_SIZE].mask = UINT64_MAX;
if (reta_size) {
for (i = 0; i < reta_size; i++)
reta_conf[i / RTE_ETH_RETA_GROUP_SIZE].mask = UINT64_MAX;

for (i = 0; i < reta_size; i++) {
uint32_t reta_id = i / RTE_ETH_RETA_GROUP_SIZE;
uint32_t reta_pos = i % RTE_ETH_RETA_GROUP_SIZE;
for (i = 0; i < reta_size; i++) {
uint32_t reta_id = i / RTE_ETH_RETA_GROUP_SIZE;
uint32_t reta_pos = i % RTE_ETH_RETA_GROUP_SIZE;

reta_conf[reta_id].reta[reta_pos] = i % (virt_q_count / 2);
}
reta_conf[reta_id].reta[reta_pos] = i % (virt_q_count / 2);
}

rc = rte_eth_dev_rss_reta_update(portid, reta_conf, reta_size);
if (rc) {
APP_ERR("Failed to update RSS reta table for portid=%d, rc=%d\n",
portid, rc);
return rc;
rc = rte_eth_dev_rss_reta_update(portid, reta_conf, reta_size);
if (rc) {
APP_ERR("Failed to update RSS reta table for portid=%d, rc=%d\n",
portid, rc);
return rc;
}
}
}

Expand Down Expand Up @@ -2414,21 +2416,22 @@ setup_eth_devices(void)
APP_INFO("Initializing port %d ...", portid);
fflush(stdout);

rte_eth_dev_info_get(portid, &dev_info);
eth_dev_info[portid] = dev_info;

/* Setup ethdev with max Rx, Tx queues */
if (eth_map[portid].type == VIRTIO_NEXT)
nb_rx_queue = DEFAULT_QUEUES_PER_PORT;
else
nb_rx_queue =
nb_rx_queue = RTE_MIN(
dev_info.max_rx_queues,
(dao_virtio_netdev_queue_count_max(pem_devid, eth_map[portid].id) /
2);
2));
nb_tx_queue = nb_rx_queue;
eth_dev_q_count[portid] = nb_rx_queue;

APP_INFO_NH("Creating queues: nb_rxq=%d nb_txq=%u... ", nb_rx_queue, nb_tx_queue);

rte_eth_dev_info_get(portid, &dev_info);
eth_dev_info[portid] = dev_info;

rc = config_port_max_pkt_len(&local_port_conf, &dev_info);
if (rc != 0)
rte_exit(EXIT_FAILURE, "Invalid max packet length: %u (port %u)\n",
Expand Down Expand Up @@ -2760,6 +2763,7 @@ setup_virtio_devices(void)

/* Setup Virtio devices */
for (virtio_devid = 0; virtio_devid < DAO_VIRTIO_DEV_MAX; virtio_devid++) {
char ethdev_pmd_name[RTE_ETH_NAME_MAX_LEN] = {0};
struct dao_virtio_netdev_conf netdev_conf;
const char *edge_name = name;
int overhd = 0;
Expand All @@ -2778,8 +2782,14 @@ setup_virtio_devices(void)
struct rte_eth_link eth_link;

portid = virtio_map[virtio_devid].id;
netdev_conf.reta_size = RTE_MAX(VIRTIO_NET_RSS_RETA_SIZE,
eth_dev_info[portid].reta_size);
if (!eth_dev_info[portid].reta_size)
netdev_conf.reta_size = 0;
else
netdev_conf.reta_size = RTE_MAX(VIRTIO_NET_RSS_RETA_SIZE,
eth_dev_info[portid].reta_size);
rte_eth_dev_get_name_by_port(portid, ethdev_pmd_name);
if (!strcmp(ethdev_pmd_name, "net_tap0"))
netdev_conf.max_virt_qps_limit = 1;
netdev_conf.hash_key_size = eth_dev_info[portid].hash_key_size;
overhd = eth_dev_get_overhead_len(eth_dev_info[portid].max_rx_pktlen,
eth_dev_info[portid].max_mtu);
Expand Down

0 comments on commit c0d5df2

Please sign in to comment.