Skip to content

Commit

Permalink
specs-go/config: Updated rdma resource limits as key-value pair
Browse files Browse the repository at this point in the history
Updated rdma resource limits as key-value pairs.

This avoid any issues that may arise or complicate code if it is done
using an array, that can contain duplicate entries for a given device.

It also makes resource definition more intutive to describe resource
limit of a device.

Signed-off-by: Parav Pandit <parav@mellanox.com>
  • Loading branch information
paravmellanox committed Dec 11, 2017
1 parent 30a9d54 commit 5b2e096
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions specs-go/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,12 @@ type LinuxNetwork struct {

// LinuxRdma for Linux cgroup 'rdma' resource management (Linux 4.11)
type LinuxRdma struct {
// Hca device name whose resources to be restricted
HcaDevice string `json:"hca_device,omitempty"`
// Limits are a set of key value pairs that define RDMA resource limits,
// where the key is device name and value is resource limits.
RdmaLimits map[string]LinuxRdmaLimit `json:"limits,omitempty"`
}

type LinuxRdmaLimit struct {
// Maximum number of HCA handles that can be opened. Default is "no limit".
HcaHandles *uint32 `json:"hca_handles,omitempty"`
// Maximum number of HCA objects that can be created. Default is "no limit".
Expand All @@ -347,7 +351,7 @@ type LinuxResources struct {
// Network restriction configuration
Network *LinuxNetwork `json:"network,omitempty"`
// Rdma resource restriction configuration
RdmaLimits []LinuxRdma `json:"rdmaLimits,omitempty"`
RdmaLimits LinuxRdma `json:"rdmaLimits,omitempty"`
}

// LinuxDevice represents the mknod information for a Linux special device file
Expand Down

0 comments on commit 5b2e096

Please sign in to comment.