|
19 | 19 | #include "DataPathTest.cpp.clog.h" |
20 | 20 | #endif |
21 | 21 |
|
| 22 | +#define QUIC_INVALID_FILE_HANDLE (-1) |
| 23 | + |
22 | 24 | extern bool UseDuoNic; |
23 | 25 |
|
24 | 26 | // |
@@ -1493,6 +1495,45 @@ TEST_F(DataPathTest, XdpMapMode_InitFailsWithoutRawDatapath) |
1493 | 1495 | CxPlatWorkerPoolDelete(WorkerPool, CXPLAT_WORKER_POOL_REF_TOOL); |
1494 | 1496 | } |
1495 | 1497 |
|
| 1498 | +TEST_F(DataPathTest, XdpMapMode_InitSucceedsWithRawDatapath) |
| 1499 | +{ |
| 1500 | + // |
| 1501 | + // 1-map config succeeds when DuoNic/XDP (raw datapath) is |
| 1502 | + // available. |
| 1503 | + // |
| 1504 | + if (!UseDuoNic) { |
| 1505 | + GTEST_SKIP_NO_RETURN_("Requires DuoNic/XDP for raw datapath init"); |
| 1506 | + return; |
| 1507 | + } |
| 1508 | + |
| 1509 | + const uint32_t FakeIfIndex = 0xDEAD; |
| 1510 | + const QUIC_XDP_MAP_HANDLE FakeHandle = (QUIC_XDP_MAP_HANDLE)QUIC_INVALID_FILE_HANDLE; |
| 1511 | + CXPLAT_XDP_MAP_CONFIG MapConfig = { FakeIfIndex, FakeHandle }; |
| 1512 | + |
| 1513 | + CXPLAT_WORKER_POOL* WorkerPool = |
| 1514 | + CxPlatWorkerPoolCreate(nullptr, CXPLAT_WORKER_POOL_REF_TOOL); |
| 1515 | + ASSERT_NE(nullptr, WorkerPool); |
| 1516 | + |
| 1517 | + CXPLAT_DATAPATH_INIT_CONFIG InitConfig = {0}; |
| 1518 | + InitConfig.XdpMapConfigs = &MapConfig; |
| 1519 | + InitConfig.XdpMapConfigCount = 1; |
| 1520 | + |
| 1521 | + CXPLAT_DATAPATH* Datapath = nullptr; |
| 1522 | + QUIC_STATUS Status = |
| 1523 | + CxPlatDataPathInitialize( |
| 1524 | + 0, |
| 1525 | + &EmptyUdpCallbacks, |
| 1526 | + nullptr, |
| 1527 | + WorkerPool, |
| 1528 | + &InitConfig, |
| 1529 | + &Datapath); |
| 1530 | + VERIFY_QUIC_SUCCESS(Status); |
| 1531 | + ASSERT_NE(nullptr, Datapath); |
| 1532 | + |
| 1533 | + CxPlatDataPathUninitialize(Datapath); |
| 1534 | + CxPlatWorkerPoolDelete(WorkerPool, CXPLAT_WORKER_POOL_REF_TOOL); |
| 1535 | +} |
| 1536 | + |
1496 | 1537 | TEST_F(DataPathTest, XdpMapMode_SingleUnknownIfIndex) |
1497 | 1538 | { |
1498 | 1539 | // |
|
0 commit comments