Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface {
// BatchSize returns the maximum number of frames that can be processed
// in a single batch.
BatchSize() int
// Receive is called when new frames are received.
Receive(queueID int, frames [][]byte)
// Transmit is called to prepare frames for transmission.
// It returns the number of frames that were successfully prepared for
// transmission. The frames should be filled with the data to be sent.
// The lengths slice should be filled with the lengths of each frame.
Transmit(queueID int, frames [][]byte, lengths []int) int
}
Handler is an interface that defines methods for processing frames in a kernel-bypass network interface using XDP. The handler should not block.
type NetworkInterface ¶
type NetworkInterface struct {
// contains filtered or unexported fields
}
NetworkInterface represents a network interface that uses XDP for high-performance kernel-bypass packet processing.
func Open ¶
func Open(name string, handler Handler, ingressFilter *xdp.Program, opts *NetworkInterfaceOptions) (*NetworkInterface, error)
Open creates a new NetworkInterface for the provided interface name and options.
func (*NetworkInterface) Close ¶
func (nic *NetworkInterface) Close() error
Close closes the NetworkInterface and releases all resources.
func (*NetworkInterface) NumQueues ¶ added in v0.2.1
func (nic *NetworkInterface) NumQueues() int
NumQueues returns the number of queues configured for this network interface.
type NetworkInterfaceOptions ¶
type NetworkInterfaceOptions struct {
// NumQueues is the number of RX/TX queues to use for the interface.
NumQueues int
// AttachFlags are the flags which are passed when the XDP program is
// attached to the network link, possible values include
// unix.XDP_FLAGS_DRV_MODE, unix.XDP_FLAGS_HW_MODE, unix.XDP_FLAGS_SKB_MODE,
// unix.XDP_FLAGS_UPDATE_IF_NOEXIST.
AttachFlags uint32
// SocketOpts are the options to use when creating XDP sockets.
// These options can be used to set buffer sizes, queue sizes, etc.
SocketOpts *xdp.SocketOptions
}
Click to show internal directories.
Click to hide internal directories.