Skip to content

Commit

Permalink
Merge pull request #666 from BSWANG/main
Browse files Browse the repository at this point in the history
autoload smc module when smc-tool is ready & erdma link attached
  • Loading branch information
l1b0k authored Aug 15, 2024
2 parents e6cdb5e + 6a151ae commit bb54e45
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 bb54e45

Please sign in to comment.