Skip to content

Commit

Permalink
Align XDP Queues with RSS Better (#4484)
Browse files Browse the repository at this point in the history
  • Loading branch information
nibanks authored Oct 1, 2024
1 parent 01e4ae3 commit eb76333
Show file tree
Hide file tree
Showing 6 changed files with 347 additions and 253 deletions.
52 changes: 46 additions & 6 deletions src/generated/linux/datapath_raw_xdp_win.c.clog.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,26 @@ tracepoint(CLOG_DATAPATH_RAW_XDP_WIN_C, FoundVF , arg2, arg3, arg4);\



/*----------------------------------------------------------
// Decoder Ring for XdpInterfaceQueues
// [ixdp][%p] Initializing %u queues on interface
// QuicTraceLogVerbose(
XdpInterfaceQueues,
"[ixdp][%p] Initializing %u queues on interface",
Interface,
Interface->QueueCount);
// arg2 = arg2 = Interface = arg2
// arg3 = arg3 = Interface->QueueCount = arg3
----------------------------------------------------------*/
#ifndef _clog_4_ARGS_TRACE_XdpInterfaceQueues
#define _clog_4_ARGS_TRACE_XdpInterfaceQueues(uniqueId, encoded_arg_string, arg2, arg3)\
tracepoint(CLOG_DATAPATH_RAW_XDP_WIN_C, XdpInterfaceQueues , arg2, arg3);\

#endif




/*----------------------------------------------------------
// Decoder Ring for XdpInitialize
// [ xdp][%p] XDP initialized, %u procs
Expand All @@ -71,6 +91,26 @@ tracepoint(CLOG_DATAPATH_RAW_XDP_WIN_C, XdpInitialize , arg2, arg3);\



/*----------------------------------------------------------
// Decoder Ring for XdpInterfaceInitialize
// [ixdp][%p] Initializing interface %u
// QuicTraceLogVerbose(
XdpInterfaceInitialize,
"[ixdp][%p] Initializing interface %u",
Interface,
Interface->ActualIfIndex);
// arg2 = arg2 = Interface = arg2
// arg3 = arg3 = Interface->ActualIfIndex = arg3
----------------------------------------------------------*/
#ifndef _clog_4_ARGS_TRACE_XdpInterfaceInitialize
#define _clog_4_ARGS_TRACE_XdpInterfaceInitialize(uniqueId, encoded_arg_string, arg2, arg3)\
tracepoint(CLOG_DATAPATH_RAW_XDP_WIN_C, XdpInterfaceInitialize , arg2, arg3);\

#endif




/*----------------------------------------------------------
// Decoder Ring for XdpQueueStart
// [ xdp][%p] XDP queue start on partition %p
Expand Down Expand Up @@ -277,12 +317,12 @@ tracepoint(CLOG_DATAPATH_RAW_XDP_WIN_C, XdpPartitionShutdownComplete , arg2);\
// Decoder Ring for LibraryErrorStatus
// [ lib] ERROR, %u, %s.
// QuicTraceEvent(
LibraryErrorStatus,
"[ lib] ERROR, %u, %s.",
ret,
"ConvertInterfaceIndexToLuid");
// arg2 = arg2 = ret = arg2
// arg3 = arg3 = "ConvertInterfaceIndexToLuid" = arg3
LibraryErrorStatus,
"[ lib] ERROR, %u, %s.",
Status,
"XskBind (GetRssQueueProcessors)");
// arg2 = arg2 = Status = arg2
// arg3 = arg3 = "XskBind (GetRssQueueProcessors)" = arg3
----------------------------------------------------------*/
#ifndef _clog_4_ARGS_TRACE_LibraryErrorStatus
#define _clog_4_ARGS_TRACE_LibraryErrorStatus(uniqueId, encoded_arg_string, arg2, arg3)\
Expand Down
58 changes: 52 additions & 6 deletions src/generated/linux/datapath_raw_xdp_win.c.clog.h.lttng.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,29 @@ TRACEPOINT_EVENT(CLOG_DATAPATH_RAW_XDP_WIN_C, FoundVF,



/*----------------------------------------------------------
// Decoder Ring for XdpInterfaceQueues
// [ixdp][%p] Initializing %u queues on interface
// QuicTraceLogVerbose(
XdpInterfaceQueues,
"[ixdp][%p] Initializing %u queues on interface",
Interface,
Interface->QueueCount);
// arg2 = arg2 = Interface = arg2
// arg3 = arg3 = Interface->QueueCount = arg3
----------------------------------------------------------*/
TRACEPOINT_EVENT(CLOG_DATAPATH_RAW_XDP_WIN_C, XdpInterfaceQueues,
TP_ARGS(
const void *, arg2,
unsigned int, arg3),
TP_FIELDS(
ctf_integer_hex(uint64_t, arg2, (uint64_t)arg2)
ctf_integer(unsigned int, arg3, arg3)
)
)



/*----------------------------------------------------------
// Decoder Ring for XdpInitialize
// [ xdp][%p] XDP initialized, %u procs
Expand All @@ -51,6 +74,29 @@ TRACEPOINT_EVENT(CLOG_DATAPATH_RAW_XDP_WIN_C, XdpInitialize,



/*----------------------------------------------------------
// Decoder Ring for XdpInterfaceInitialize
// [ixdp][%p] Initializing interface %u
// QuicTraceLogVerbose(
XdpInterfaceInitialize,
"[ixdp][%p] Initializing interface %u",
Interface,
Interface->ActualIfIndex);
// arg2 = arg2 = Interface = arg2
// arg3 = arg3 = Interface->ActualIfIndex = arg3
----------------------------------------------------------*/
TRACEPOINT_EVENT(CLOG_DATAPATH_RAW_XDP_WIN_C, XdpInterfaceInitialize,
TP_ARGS(
const void *, arg2,
unsigned int, arg3),
TP_FIELDS(
ctf_integer_hex(uint64_t, arg2, (uint64_t)arg2)
ctf_integer(unsigned int, arg3, arg3)
)
)



/*----------------------------------------------------------
// Decoder Ring for XdpQueueStart
// [ xdp][%p] XDP queue start on partition %p
Expand Down Expand Up @@ -272,12 +318,12 @@ TRACEPOINT_EVENT(CLOG_DATAPATH_RAW_XDP_WIN_C, XdpPartitionShutdownComplete,
// Decoder Ring for LibraryErrorStatus
// [ lib] ERROR, %u, %s.
// QuicTraceEvent(
LibraryErrorStatus,
"[ lib] ERROR, %u, %s.",
ret,
"ConvertInterfaceIndexToLuid");
// arg2 = arg2 = ret = arg2
// arg3 = arg3 = "ConvertInterfaceIndexToLuid" = arg3
LibraryErrorStatus,
"[ lib] ERROR, %u, %s.",
Status,
"XskBind (GetRssQueueProcessors)");
// arg2 = arg2 = Status = arg2
// arg3 = arg3 = "XskBind (GetRssQueueProcessors)" = arg3
----------------------------------------------------------*/
TRACEPOINT_EVENT(CLOG_DATAPATH_RAW_XDP_WIN_C, LibraryErrorStatus,
TP_ARGS(
Expand Down
42 changes: 42 additions & 0 deletions src/manifest/clog.sidecar
Original file line number Diff line number Diff line change
Expand Up @@ -12458,6 +12458,38 @@
],
"macroName": "QuicTraceLogVerbose"
},
"XdpInterfaceInitialize": {
"ModuleProperites": {},
"TraceString": "[ixdp][%p] Initializing interface %u",
"UniqueId": "XdpInterfaceInitialize",
"splitArgs": [
{
"DefinationEncoding": "p",
"MacroVariableName": "arg2"
},
{
"DefinationEncoding": "u",
"MacroVariableName": "arg3"
}
],
"macroName": "QuicTraceLogVerbose"
},
"XdpInterfaceQueues": {
"ModuleProperites": {},
"TraceString": "[ixdp][%p] Initializing %u queues on interface",
"UniqueId": "XdpInterfaceQueues",
"splitArgs": [
{
"DefinationEncoding": "p",
"MacroVariableName": "arg2"
},
{
"DefinationEncoding": "u",
"MacroVariableName": "arg3"
}
],
"macroName": "QuicTraceLogVerbose"
},
"XdpLoadBpfObjectError": {
"ModuleProperites": {},
"TraceString": "[ xdp] ERROR:, loading BPF-OBJ file:%s, %d: [%s].",
Expand Down Expand Up @@ -17251,6 +17283,16 @@
"TraceID": "XdpInitialize",
"EncodingString": "[ xdp][%p] XDP initialized, %u procs"
},
{
"UniquenessHash": "1b9f0d89-3821-2037-08c6-88d59b4e4dae",
"TraceID": "XdpInterfaceInitialize",
"EncodingString": "[ixdp][%p] Initializing interface %u"
},
{
"UniquenessHash": "8101710f-c411-8be4-bddb-9cffaaa1cac3",
"TraceID": "XdpInterfaceQueues",
"EncodingString": "[ixdp][%p] Initializing %u queues on interface"
},
{
"UniquenessHash": "83b58d1d-bb4b-653f-d379-3631b103ed34",
"TraceID": "XdpLoadBpfObjectError",
Expand Down
5 changes: 4 additions & 1 deletion src/platform/datapath_raw_xdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ typedef struct QUIC_CACHEALIGN XDP_PARTITION {
CXPLAT_EVENTQ* EventQ;
XDP_QUEUE* Queues; // A linked list of queues, accessed by Next.
uint16_t PartitionIndex;
uint16_t Processor;
} XDP_PARTITION;

void XdpWorkerAddQueue(_In_ XDP_PARTITION* Partition, _In_ XDP_QUEUE* Queue) {
Expand All @@ -78,7 +79,9 @@ CxPlatDpRawAssignQueue(
)
{
const XDP_INTERFACE_COMMON* Interface = (const XDP_INTERFACE_COMMON*)_Interface;
Route->Queue = &((XDP_QUEUE_COMMON*)Interface->Queues)[0];
XDP_QUEUE_COMMON* Queues = (XDP_QUEUE_COMMON*)Interface->Queues;
CXPLAT_FRE_ASSERT(Queues[0].Partition != NULL); // What if there was no partition?
Route->Queue = &Queues[0]; // TODO - Can we do better than just the first queue?
}

_IRQL_requires_max_(DISPATCH_LEVEL)
Expand Down
8 changes: 7 additions & 1 deletion src/platform/datapath_raw_xdp_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ static uint64_t XskUmemFrameAlloc(struct XskSocketInfo *Xsk)
if (Xsk->UmemFrameFree == 0) {
QuicTraceLogVerbose(
XdpUmemAllocFails,
"[ xdp][umem] Out of UMEM frame, OOM");
"[ xdp][umem] Out of UMEM frame, OOM");
return INVALID_UMEM_FRAME;
}
Frame = Xsk->UmemFrameAddr[--Xsk->UmemFrameFree];
Expand Down Expand Up @@ -689,8 +689,14 @@ CxPlatDpRawInitialize(

if (Config && Config->ProcessorCount) {
Xdp->PartitionCount = Config->ProcessorCount;
for (uint32_t i = 0; i < Xdp->PartitionCount; i++) {
Xdp->Partitions[i].Processor = Config->ProcessorList[i];
}
} else {
Xdp->PartitionCount = CxPlatProcCount();
for (uint32_t i = 0; i < Xdp->PartitionCount; i++) {
Xdp->Partitions[i].Processor = (uint16_t)i;
}
}

QuicTraceLogVerbose(
Expand Down
Loading

0 comments on commit eb76333

Please sign in to comment.