Categorygithub.com/Mellanox/mlxdevm-go
modulepackage
0.3.0
Repository: https://github.com/mellanox/mlxdevm-go.git
Documentation: pkg.go.dev

# README

mlxdevm-go

mlxdevm library for for device management in go language

Overview

Subfunction(SF) aka scalable function are managed by devlink interface in upstream kernel. They can be also managed in Mellanox OFED distrubtion using a similar interface called mlxdevm. This is helpful to use SFs in older kernel distributions where devlink interface of latest and greast kernel is not unavailable.

Only difference between the two interfaces are their socket name. For example devlink socket name is "devlink" vs mlxdevm socket name is "mlxdevm".

Container orchestration software such as CNI or device plugin which needs to operate over both the interfaces (upstream devlink and mlxdevm) in simple and elegant way.

This package enables orchestration software to use upstream devlink compliant APIs over mlxdevm interface.

How to use this library in the application?

$ go get github.com/Mellanox/mlxdevm-go

Sample application:

package main

import (
    mlxdevm "github.com/Mellanox/mlxdevm-go"
    "fmt"
)

func main() {
    var portAttr mlxdevm.DevlinkPortAddAttrs
    
    portAttr.PfNumber = 0
    
    portAttr.SfNumber = 88 // Any number starting 0 to 999
    portAttr.SfNumberValid = true
    // To use upstream devlink interface
    dl_port, err := mlxdevm.DevlinkPortAdd("devlink", "pci", "0000:06:00.0", mlxdevm.DEVLINK_PORT_FLAVOUR_PCI_SF, portAttr)
    if err != nil {
        return
    }
    fmt.Printf("Port = ", dl_port)
    
    portAttr.SfNumber = 99 // Any number starting 0 to 999
    // To use mlxdevm interface
    dl_port2, err2 := mlxdevm.DevlinkPortAdd("mlxdevm", "pci", "0000:06:00.0", mlxdevm.DEVLINK_PORT_FLAVOUR_PCI_SF, portAttr)
    if err2 != nil {
        return
    }
    fmt.Printf("Port = ", dl_port2)
}

# Packages

No description provided by the author

# Functions

DevlinkDevParamGet returns information about a set device parameter Equivalent to `mlxdevm dev param show $dev name disable_netdev`.
DevlinkDevParamSet sets one device parameter.
DevlinkGetAllPortList provides a pointer to devlink ports and nil error, otherwise returns an error code.
DevlinkGetDeviceByName provides a pointer to devlink device and nil error, otherwise returns an error code.
DevlinkGetDeviceList provides a pointer to devlink devices and nil error, otherwise returns an error code.
DevlinkGetPortByIndex provides a pointer to devlink portand nil error, otherwise returns an error code.
DevlinkPortAdd adds a devlink port and returns a port on success otherwise returns nil port and an error code.
DevlinkPortDel deletes a devlink port and returns success or error code.
DevlinkPortFnCapSet sets roce and max_uc_macs port function cap attributes.
DevlinkPortFnSet sets one or more port function attributes specified by the attribute mask.
DevlinkSetEswitchMode sets eswitch mode if able to set successfully or returns an error code.
No description provided by the author
No description provided by the author
GetSocketTimeout returns the timeout value used by default netlink sockets.
NewHandle returns a netlink handle on the current network namespace.
NewHandleAt returns a netlink handle on the network namespace specified by ns.
NewHandleAtFrom works as NewHandle but allows client to specify the new and the origin netns Handle.
SetSocketTimeout configures timeout for default netlink sockets.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
nested */.
flag */.
string */.
u8 */.
nested */.
u8 */.
dynamic */.
nested */.
u32 */.
No description provided by the author
nested */.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
u16 */.
u32 */.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

DevlinkDevAttrs represents device attributes.
DevlinkDevEswitchAttr represents device's eswitch attributes.
DevlinkDevice represents device and its attributes.
DevlinkDevParam represents a device parameter.
DevlinkPort represents port and its attributes.
No description provided by the author
DevlinkPortFn represents port function and its attributes.
DevlinkPortFnCap represents port function and its attributes.
DevlinkPortFnCapSetAttrs represents attributes to set.
DevlinkPortFnSetAttrs represents attributes to set.
No description provided by the author
No description provided by the author
No description provided by the author
Handle is an handle for the netlink requests on a specific network namespace.