Documentation ¶
Overview ¶
Package memiftransport implements a transport over a shared memory packet interface (memif).
Index ¶
Constants ¶
const ( MaxSocketNameSize = 108 MinID = 0 MaxID = math.MaxUint32 MinDataroom = 512 MaxDataroom = math.MaxUint16 DefaultDataroom = 2048 MinRingCapacity = 1 << 1 MaxRingCapacity = 1 << 14 DefaultRingCapacity = 1 << 10 )
Defaults and limits.
Variables ¶
This section is empty.
Functions ¶
func ExecBridgeHelper ¶
func ExecBridgeHelper()
ExecBridgeHelper runs the bridge helper if os.Args requests it. In unit test binary, this should be invoked in TestMain() function.
func ForkBridgeHelper ¶
ForkBridgeHelper forks a bridge helper subprocess and invokes f() while it's running.
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge bridges two memif interfaces. The memifs can operate in either server or client mode.
This is mainly useful for unit testing. It is impossible to run both memif peers in the same process, so the test program should run this bridge in a separate process.
type CoexistMap ¶
type CoexistMap struct {
// contains filtered or unexported fields
}
CoexistMap determines whether two memif transports can coexist.
func (CoexistMap) Check ¶
func (c CoexistMap) Check(loc Locator) error
Check determines whether creating a transport from given locator would conflict with existing transports. loc.ApplyDefaults() should have been called.
func (CoexistMap) Has ¶
func (c CoexistMap) Has(socketName string) bool
Has determines whether there's an existing transport with the same socketName.
type Locator ¶
type Locator struct { // Role selects memif role. // Default is "client" in NDNgo library and "server" in NDN-DPDK service. Role Role `json:"role,omitempty"` // SocketName is the control socket filename. // It must be an absolute path, not longer than MaxSocketNameSize. SocketName string `json:"socketName"` // SocketOwner changes owner uid:gid of the socket file. // This is only applicable in NDN-DPDK service when creating the first memif in "server" role on a SocketName. SocketOwner *[2]int `json:"socketOwner,omitempty"` // ID is the interface identifier. // It must be between MinID and MaxID. ID int `json:"id"` // Dataroom is the buffer size of each packet. // Default is DefaultDataroom. // It is automatically clamped between MinDataroom and MaxDataroom. Dataroom int `json:"dataroom,omitempty"` // RingCapacity is the capacity of queue pair rings. // Default is DefaultRingCapacity. // It is automatically adjusted up to the next power of 2, and clamped between MinRingCapacity and MaxRingCapacity. RingCapacity int `json:"ringCapacity,omitempty"` }
Locator identifies memif interface.
func (*Locator) ApplyDefaults ¶
ApplyDefaults sets empty values to defaults.
func (Locator) ReverseRole ¶
ReverseRole returns a copy of Locator with server and client roles reversed.
func (*Locator) ToCreateFaceLocator ¶
func (loc *Locator) ToCreateFaceLocator() (json.RawMessage, error)
ToCreateFaceLocator builds a JSON object suitable for NDN-DPDK face creation API.
func (*Locator) ToVDevArgs ¶
ToVDevArgs builds arguments for DPDK virtual device, acceptable to eal.NewVDev() function.