From: Florin Coras Date: Mon, 23 Jun 2025 20:22:02 +0000 (-0700) Subject: hs-test: fix mw tests that rely on tap interfaces X-Git-Tag: v26.02-rc0~220 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=8fc82bbbee0bcd39585aabd88a7fb64a45b838e5;p=vpp.git hs-test: fix mw tests that rely on tap interfaces Make sure taps have multiple queues and consistent qp mode enabled. Type: test Change-Id: Icf00290fad1934adcbfcfe56530d37f0793b0bca Signed-off-by: Florin Coras Signed-off-by: Matus Fabian --- diff --git a/extras/hs-test/http_test.go b/extras/hs-test/http_test.go index 8670b1deacd..1caefe51f7e 100644 --- a/extras/hs-test/http_test.go +++ b/extras/hs-test/http_test.go @@ -667,10 +667,6 @@ func httpClientRepeat(s *NoTopoSuite, requestMethod string, clientArgs string) { durationInSec := 10 var err error - // recreate interfaces with RX-queues - s.AssertNil(vpp.DeleteTap(s.Interfaces.Tap)) - s.AssertNil(vpp.CreateTap(s.Interfaces.Tap, false, 2, 2)) - s.CreateNginxServer() s.AssertNil(s.Containers.NginxServer.Start()) logPath := s.Containers.NginxServer.GetContainerWorkDir() + "/" + s.Containers.NginxServer.Name + "-access.log" diff --git a/extras/hs-test/infra/suite_envoy_proxy.go b/extras/hs-test/infra/suite_envoy_proxy.go index a099d2ca40a..42a5b937688 100644 --- a/extras/hs-test/infra/suite_envoy_proxy.go +++ b/extras/hs-test/infra/suite_envoy_proxy.go @@ -129,8 +129,8 @@ func (s *EnvoyProxySuite) SetupTest() { s.AssertNil(vpp.Start()) // wait for VPP to start time.Sleep(time.Second * 1) - s.AssertNil(vpp.CreateTap(s.Interfaces.Client, false, 1, 1)) - s.AssertNil(vpp.CreateTap(s.Interfaces.Server, false, 1, 2)) + s.AssertNil(vpp.CreateTap(s.Interfaces.Client, false, 1)) + s.AssertNil(vpp.CreateTap(s.Interfaces.Server, false, 2)) s.Containers.Vpp.Exec(false, "chmod 777 -R %s", s.Containers.Vpp.GetContainerWorkDir()) // Add Ipv4 ARP entry for nginx HTTP server, otherwise first request fail (HTTP error 503) diff --git a/extras/hs-test/infra/suite_h2.go b/extras/hs-test/infra/suite_h2.go index 96395d3c61c..ddd128551d2 100644 --- a/extras/hs-test/infra/suite_h2.go +++ b/extras/hs-test/infra/suite_h2.go @@ -76,7 +76,7 @@ func (s *H2Suite) SetupTest() { vpp, _ := s.Containers.Vpp.newVppInstance(s.Containers.Vpp.AllocatedCpus, memoryConfig, sessionConfig) s.AssertNil(vpp.Start()) - s.AssertNil(vpp.CreateTap(s.Interfaces.Tap, false, 1, 1), "failed to create tap interface") + s.AssertNil(vpp.CreateTap(s.Interfaces.Tap, false, 1), "failed to create tap interface") if *DryRun { s.LogStartedContainers() diff --git a/extras/hs-test/infra/suite_nginx_proxy.go b/extras/hs-test/infra/suite_nginx_proxy.go index 05b0960eedb..90306bdea36 100644 --- a/extras/hs-test/infra/suite_nginx_proxy.go +++ b/extras/hs-test/infra/suite_nginx_proxy.go @@ -103,8 +103,8 @@ func (s *NginxProxySuite) SetupTest() { ) s.AssertNil(vpp.Start()) - s.AssertNil(vpp.CreateTap(s.Interfaces.Client, false, 1, 1)) - s.AssertNil(vpp.CreateTap(s.Interfaces.Server, false, 1, 2)) + s.AssertNil(vpp.CreateTap(s.Interfaces.Client, false, 1)) + s.AssertNil(vpp.CreateTap(s.Interfaces.Server, false, 2)) if *DryRun { s.LogStartedContainers() diff --git a/extras/hs-test/infra/suite_no_topo.go b/extras/hs-test/infra/suite_no_topo.go index f7fc403fe7f..1749d13d53f 100644 --- a/extras/hs-test/infra/suite_no_topo.go +++ b/extras/hs-test/infra/suite_no_topo.go @@ -82,7 +82,7 @@ func (s *NoTopoSuite) SetupTest() { vpp, _ := s.Containers.Vpp.newVppInstance(s.Containers.Vpp.AllocatedCpus, sessionConfig) s.AssertNil(vpp.Start()) - s.AssertNil(vpp.CreateTap(s.Interfaces.Tap, false, 1, 1), "failed to create tap interface") + s.AssertNil(vpp.CreateTap(s.Interfaces.Tap, false, 1), "failed to create tap interface") if *DryRun { s.LogStartedContainers() diff --git a/extras/hs-test/infra/suite_no_topo6.go b/extras/hs-test/infra/suite_no_topo6.go index 1b21469d1a6..a57cb29721e 100644 --- a/extras/hs-test/infra/suite_no_topo6.go +++ b/extras/hs-test/infra/suite_no_topo6.go @@ -76,7 +76,7 @@ func (s *NoTopo6Suite) SetupTest() { vpp, _ := s.Containers.Vpp.newVppInstance(s.Containers.Vpp.AllocatedCpus, sessionConfig) s.AssertNil(vpp.Start()) - s.AssertNil(vpp.CreateTap(s.Interfaces.Tap, true, 1, 1), "failed to create tap interface") + s.AssertNil(vpp.CreateTap(s.Interfaces.Tap, true, 1), "failed to create tap interface") if *DryRun { s.LogStartedContainers() diff --git a/extras/hs-test/infra/suite_vpp_proxy.go b/extras/hs-test/infra/suite_vpp_proxy.go index db6b6bedf7a..d1c125e3a5a 100644 --- a/extras/hs-test/infra/suite_vpp_proxy.go +++ b/extras/hs-test/infra/suite_vpp_proxy.go @@ -92,8 +92,8 @@ func (s *VppProxySuite) SetupTest() { s.AssertNotNil(vpp, fmt.Sprint(err)) s.AssertNil(vpp.Start()) - s.AssertNil(vpp.CreateTap(s.Interfaces.Client, false, 1, 1)) - s.AssertNil(vpp.CreateTap(s.Interfaces.Server, false, 1, 2)) + s.AssertNil(vpp.CreateTap(s.Interfaces.Client, false, 1)) + s.AssertNil(vpp.CreateTap(s.Interfaces.Server, false, 2)) if *DryRun { s.LogStartedContainers() diff --git a/extras/hs-test/infra/suite_vpp_udp_proxy.go b/extras/hs-test/infra/suite_vpp_udp_proxy.go index 29ee5b7e6da..c424790db70 100644 --- a/extras/hs-test/infra/suite_vpp_udp_proxy.go +++ b/extras/hs-test/infra/suite_vpp_udp_proxy.go @@ -77,8 +77,8 @@ func (s *VppUdpProxySuite) SetupTest() { s.AssertNotNil(vpp, fmt.Sprint(err)) s.AssertNil(vpp.Start()) - s.AssertNil(vpp.CreateTap(s.Interfaces.Client, false, 1, 1)) - s.AssertNil(vpp.CreateTap(s.Interfaces.Server, false, 1, 2)) + s.AssertNil(vpp.CreateTap(s.Interfaces.Client, false, 1)) + s.AssertNil(vpp.CreateTap(s.Interfaces.Server, false, 2)) arp := fmt.Sprintf("set ip neighbor %s %s %s", s.Interfaces.Server.Peer.Name(), diff --git a/extras/hs-test/infra/vppinstance.go b/extras/hs-test/infra/vppinstance.go index 7acf8aeca96..b601e46feff 100644 --- a/extras/hs-test/infra/vppinstance.go +++ b/extras/hs-test/infra/vppinstance.go @@ -102,6 +102,7 @@ type VppCpuConfig struct { PinWorkersCorelist bool RelativeCores bool SkipCores int + NumWorkers int } type VppMemTrace struct { @@ -500,22 +501,15 @@ func (vpp *VppInstance) addAppNamespace( return nil } -func (vpp *VppInstance) CreateTap(tap *NetInterface, IPv6 bool, numRxQueues uint16, tapId uint32, flags ...uint32) error { - var tapFlags uint32 = 0 - - if len(flags) > 0 { - tapFlags = flags[0] - } +func (vpp *VppInstance) CreateTap(tap *NetInterface, IPv6 bool, tapId uint32) error { + numRxQueues := uint16(max(1, vpp.CpuConfig.NumWorkers)) + tapFlags := Consistent_qp if *DryRun { - flagsCli := "" + flagsCli := "consistent-qp" ipAddress := "" ipAddressPeer := "" - if tapFlags == Consistent_qp { - flagsCli = "consistent-qp" - } - if IPv6 { ipAddress = "host-ip6-addr " + tap.Ip6Address ipAddressPeer = tap.Peer.Ip6Address @@ -553,7 +547,7 @@ func (vpp *VppInstance) CreateTap(tap *NetInterface, IPv6 bool, numRxQueues uint TapFlags: tapv2.TapFlags(tapFlags), } - vpp.getSuite().Log("create tap interface " + tap.Name()) + vpp.getSuite().Log("create tap interface " + tap.Name() + " num-rx-queues " + strconv.Itoa(int(numRxQueues))) // Create tap interface if err := vpp.ApiStream.SendMsg(createTapReq); err != nil { return err @@ -689,6 +683,7 @@ func (vpp *VppInstance) setDefaultCpuConfig() { vpp.CpuConfig.PinWorkersCorelist = true vpp.CpuConfig.RelativeCores = false vpp.CpuConfig.SkipCores = 0 + vpp.CpuConfig.NumWorkers = 0 } func (vpp *VppInstance) generateVPPCpuConfig() string { @@ -728,6 +723,7 @@ func (vpp *VppInstance) generateVPPCpuConfig() string { workers := vpp.Cpus[startCpu+1:] workersRelativeCpu := startCpu + 1 + vpp.CpuConfig.NumWorkers = len(workers) if len(workers) > 0 && vpp.CpuConfig.UseWorkers { if vpp.CpuConfig.PinWorkersCorelist { diff --git a/extras/hs-test/proxy_test.go b/extras/hs-test/proxy_test.go index e239ccd7b93..40f3558b4ca 100644 --- a/extras/hs-test/proxy_test.go +++ b/extras/hs-test/proxy_test.go @@ -54,15 +54,6 @@ func vppProxyIperfMWTest(s *VppProxySuite, proto string) { s.SetupTest() s.Containers.IperfC.Run() s.Containers.IperfS.Run() - vppProxy := s.Containers.VppProxy.VppInstance - - // tap interfaces are created on test setup with 1 rx-queue, - // need to recreate them with 2 + consistent-qp - s.AssertNil(vppProxy.DeleteTap(s.Interfaces.Server)) - s.AssertNil(vppProxy.CreateTap(s.Interfaces.Server, false, 2, uint32(s.Interfaces.Server.Peer.Index), Consistent_qp)) - - s.AssertNil(vppProxy.DeleteTap(s.Interfaces.Client)) - s.AssertNil(vppProxy.CreateTap(s.Interfaces.Client, false, 2, uint32(s.Interfaces.Client.Peer.Index), Consistent_qp)) s.ConfigureVppProxy("tcp", s.Ports.Proxy) if proto == "udp" { @@ -354,12 +345,6 @@ func VppConnectProxyStressMWTest(s *VppProxySuite) { defer remoteServerConn.Close() vppProxy := s.Containers.VppProxy.VppInstance - // tap interfaces are created on test setup with 1 rx-queue, - // need to recreate them with 2 + consistent-qp - s.AssertNil(vppProxy.DeleteTap(s.Interfaces.Server)) - s.AssertNil(vppProxy.CreateTap(s.Interfaces.Server, false, 2, uint32(s.Interfaces.Server.Peer.Index), Consistent_qp)) - s.AssertNil(vppProxy.DeleteTap(s.Interfaces.Client)) - s.AssertNil(vppProxy.CreateTap(s.Interfaces.Client, false, 2, uint32(s.Interfaces.Client.Peer.Index), Consistent_qp)) s.ConfigureVppProxy("http", s.Ports.Proxy) diff --git a/src/plugins/hs_apps/proxy.c b/src/plugins/hs_apps/proxy.c index 445235fec8d..a4b1aeaea4f 100644 --- a/src/plugins/hs_apps/proxy.c +++ b/src/plugins/hs_apps/proxy.c @@ -915,7 +915,7 @@ active_open_connected_callback (u32 app_index, u32 opaque, ps->ao_disconnected = 1; if (ps->po.is_http) { - session_send_rpc_evt_to_thread ( + session_send_rpc_evt_to_thread_force ( session_thread_from_handle (ps->po.session_handle), active_open_send_http_resp_rpc, uword_to_pointer (ps->ps_index, void *));