Skip to content

Commit 778dd85

Browse files
committed
net: xdp: Support multiple RX queues for LinkEndpoint
This change enhances the XDP LinkEndpoint to support multiple RX queues instead of being limited to queue 0. The implementation includes: - Add QueueID field to the Options struct to specify which RX queue the AF_XDP socket should be attached to - Modify the New function to initialize the AF_XDP socket with the specified QueueID instead of hardcoded 0 This allows better distribution of network traffic across multiple queues for improved performance in high-throughput scenarios. Fixes issue with XDP LinkEndpoint only supporting NIC queue 0.
1 parent 6658538 commit 778dd85

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/tcpip/link/xdp/endpoint.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ type Options struct {
109109

110110
// GRO enables generic receive offload.
111111
GRO bool
112+
113+
// QueueID is the ID of the RX queue to which the AF_XDP socket is attached.
114+
QueueID uint32
112115
}
113116

114117
// New creates a new endpoint from an AF_XDP socket.
@@ -164,7 +167,7 @@ func New(opts *Options) (stack.LinkEndpoint, error) {
164167
NDescriptors: nFrames / 2,
165168
Bind: opts.Bind,
166169
}
167-
ep.control, err = xdp.NewFromSocket(opts.FD, uint32(opts.InterfaceIndex), 0 /* queueID */, xdpOpts)
170+
ep.control, err = xdp.NewFromSocket(opts.FD, uint32(opts.InterfaceIndex), opts.QueueID, xdpOpts)
168171
if err != nil {
169172
return nil, fmt.Errorf("failed to create AF_XDP dispatcher: %v", err)
170173
}

0 commit comments

Comments
 (0)