From 64762303a121992840be66c73a18818e13aa637c Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Thu, 12 Jun 2025 03:51:46 -0400 Subject: [PATCH] af_packet: include if name in fanout id Useful when running multiple vpps with veth interfaces with same device ids and multiple rx/tx queues configured Type: improvement Change-Id: I9fd23ad941883850f694c973db8cb8345dd901c2 Signed-off-by: Florin Coras --- src/plugins/af_packet/af_packet.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/plugins/af_packet/af_packet.c b/src/plugins/af_packet/af_packet.c index 56d90c0c986..86c2685870e 100644 --- a/src/plugins/af_packet/af_packet.c +++ b/src/plugins/af_packet/af_packet.c @@ -434,6 +434,14 @@ error: return ret; } +static u32 +af_packet_make_fanout_id (af_packet_if_t *apif) +{ + u16 if_hash = + hash_memory (apif->host_if_name, strlen ((char *) apif->host_if_name), 0); + return (apif->dev_instance & 0xffff) ^ (if_hash & 0xff00); +} + int af_packet_queue_init (vlib_main_t *vm, af_packet_if_t *apif, af_packet_create_if_arg_t *arg, @@ -506,9 +514,9 @@ af_packet_queue_init (vlib_main_t *vm, af_packet_if_t *apif, if (rx_queue || tx_queue) { - ret = - create_packet_sock (apif->host_if_index, rx_req, tx_req, &fd, &ring, - apif->dev_instance, &arg->flags, apif->version); + ret = create_packet_sock (apif->host_if_index, rx_req, tx_req, &fd, + &ring, af_packet_make_fanout_id (apif), + &arg->flags, apif->version); if (ret != 0) goto error; -- 2.16.6