@@ -818,6 +818,43 @@ func DevlinkGetDeviceParamByName(bus string, device string, param string) (*Devl
818818 return pkgHandle .DevlinkGetDeviceParamByName (bus , device , param )
819819}
820820
821+ // DevlinkSplitPort splits a devlink port.
822+ // Equivalent to: devlink port split <bus>/<device>/<index> count N
823+ func (h * Handle ) DevlinkSplitPort (port * DevlinkPort , count uint32 ) error {
824+ _ , req , err := h .createCmdReq (nl .DEVLINK_CMD_PORT_SPLIT , port .BusName , port .DeviceName )
825+ if err != nil {
826+ return err
827+ }
828+
829+ req .AddData (nl .NewRtAttr (nl .DEVLINK_ATTR_PORT_INDEX , nl .Uint32Attr (port .PortIndex )))
830+ req .AddData (nl .NewRtAttr (nl .DEVLINK_ATTR_PORT_SPLIT_COUNT , nl .Uint32Attr (count )))
831+
832+ _ , err = req .Execute (unix .NETLINK_GENERIC , 0 )
833+ return err
834+ }
835+
836+ func DevlinkSplitPort (port * DevlinkPort , count uint32 ) error {
837+ return pkgHandle .DevlinkSplitPort (port , count );
838+ }
839+
840+ // DevlinkUnsplitPort: unsplit devlink port
841+ // Equivalent to devlink port unsplit <bus>/<device>/<index>
842+ func (h * Handle ) DevlinkUnsplitPort (port * DevlinkPort ) error {
843+ _ , req , err := h .createCmdReq (nl .DEVLINK_CMD_PORT_UNSPLIT , port .BusName , port .DeviceName )
844+ if err != nil {
845+ return err
846+ }
847+
848+ req .AddData (nl .NewRtAttr (nl .DEVLINK_ATTR_PORT_INDEX , nl .Uint32Attr (port .PortIndex )))
849+
850+ _ , err = req .Execute (unix .NETLINK_GENERIC , 0 )
851+ return err
852+ }
853+
854+ func DevlinkUnsplitPort (port * DevlinkPort ) error {
855+ return pkgHandle .DevlinkUnsplitPort (port );
856+ }
857+
821858// DevlinkSetDeviceParam set specific parameter for devlink device
822859// Equivalent to: `devlink dev param set <bus>/<device> name <param> cmode <cmode> value <value>`
823860// cmode argument should contain valid cmode value as uint8, modes are define in nl.DEVLINK_PARAM_CMODE_* constants
0 commit comments