Skip to content

Commit

Permalink
autoload smc module when smc-tool is ready & erdma link attached
Browse files Browse the repository at this point in the history
Signed-off-by: bingshen.wbs <[email protected]>
  • Loading branch information
BSWANG committed Aug 15, 2024
1 parent e6cdb5e commit 6a151ae
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pkg/smc/pnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,28 @@ const (
smcPnet = "smc_pnet"
)

func supportSMCR() bool {
// smc module is load
_, err := os.Stat("/proc/sys/net/smc/tcp2smc")
func ensureSMCR() bool {
_, err := exec.Command("modprobe", "smc").CombinedOutput()
if err != nil {
return false
}
// smc module is load
_, err = os.Stat("/proc/sys/net/smc/tcp2smc")
return err == nil
}

func supportSMCR() bool {
// rdma device attached
rdmaLink, err := netlink.RdmaLinkList()
if err != nil || len(rdmaLink) == 0 {
return false
}
// smc-tools installed
_, err = exec.LookPath(smcPnet)
return err == nil
if err != nil {
return false
}
return ensureSMCR()
}

func pnetID(name string) string {
Expand Down

0 comments on commit 6a151ae

Please sign in to comment.