-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes for Host VFs and num of APFs increased to 48, to
accomodate 16 Host VFs. Pre-defined range of ACC APF interface indexes allocated for various usages like(Host VFs, NF PRs, NFs(for ingress/egress)). Added changes to use AccApfInfo type for mac-list and intf-name list. Basic sanity test for Init->SetupAccApfs and GetDevices works as expected. Changes to run devmem commands to add 48 ACC APFs to forwarding group one. By default only 16 ACC APFs are added to forwarding Group one. Function->AddAccApfsToGroupOne added to ipuplugin's Run function. Changes tested for init, getDevices, CreateBridgePort, DeleteBridgePort, host-VF-to-host-VF(ping test). Basic sanity test for CreateNetworkFunction, and DeleteNetworkFunction works, and verified resource allocation. But due to probably setup/config issue, issue with testing for:->Ping from ext-client to D4 or NF(ingress) or test using NF.
- Loading branch information
1 parent
f01e94e
commit a05e5fb
Showing
7 changed files
with
291 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ import ( | |
"os" | ||
"os/signal" | ||
"path/filepath" | ||
"strconv" | ||
"syscall" | ||
"time" | ||
|
||
|
@@ -124,6 +125,59 @@ func waitForInfraP4d() (string, error) { | |
return "", nil | ||
} | ||
|
||
func AddAccApfsToGroupOne() error { | ||
vsiList, err := utils.GetAvailableAccVsiList() | ||
if err != nil { | ||
log.Errorf("AddAccApfsToGroupOne: unable to reach the IMC %v", err) | ||
return fmt.Errorf("AddAccApfsToGroupOne: unable to reach the IMC %v", err) | ||
} | ||
if len(vsiList) == 0 { | ||
log.Errorf("no APFs initialized on ACC") | ||
return fmt.Errorf("no APFs initialized on ACC") | ||
} | ||
log.Infof("AddAccApfsToGroupOne, vsiList->%v", vsiList) | ||
/* Steps from script(for reference) | ||
VSI_GROUP_INIT=$(printf "0x%x" $((0x8000050000000000 + IDPF_VPORT_VSI_HEX))) | ||
VSI_GROUP_WRITE=$(printf "0x%x" $((0xA000050000000000 + IDPF_VPORT_VSI_HEX))) | ||
devmem 0x20292002a0 64 ${VSI_GROUP_INIT} | ||
devmem 0x2029200388 64 0x1 | ||
devmem 0x20292002a0 64 ${VSI_GROUP_WRITE} | ||
*/ | ||
for i := 0; i < len(vsiList); i++ { | ||
log.Infof("Add to VSI Group 1, vsi->%v", vsiList[i]) | ||
hexStr := vsiList[i] | ||
// skip "0x" prefix | ||
hexStr = hexStr[2:] | ||
|
||
// Convert to hex value | ||
hexVal, err := strconv.ParseInt(hexStr, 16, 64) | ||
if err != nil { | ||
log.Errorf("error decoding hex: %v", err) | ||
return fmt.Errorf("error decoding hex: %v", err) | ||
} | ||
|
||
vsiGroupInit := 0x8000050000000000 + uint(hexVal) | ||
Check failure Code scanning / CodeQL Incorrect conversion between integer types High
Incorrect conversion of a signed 64-bit integer from
strconv.ParseInt Error loading related location Loading |
||
vsiGroupWrite := 0xA000050000000000 + uint(hexVal) | ||
Check failure Code scanning / CodeQL Incorrect conversion between integer types High
Incorrect conversion of a signed 64-bit integer from
strconv.ParseInt Error loading related location Loading |
||
|
||
vsiGroupInitString := fmt.Sprintf("0x%X", vsiGroupInit) | ||
vsiGroupWriteString := fmt.Sprintf("0x%X", vsiGroupWrite) | ||
|
||
devMemCmd1 := "devmem 0x20292002a0 64 " + vsiGroupInitString | ||
devMemCmd2 := "devmem 0x2029200388 64 0x1" | ||
devMemCmd3 := "devmem 0x20292002a0 64 " + vsiGroupWriteString | ||
|
||
devMemCmd := devMemCmd1 + "; " + devMemCmd2 + "; " + devMemCmd3 + "; " | ||
log.Infof("devMemCmd->%v", devMemCmd) | ||
|
||
_, err = utils.ExecuteScript(fmt.Sprintf(`ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 [email protected] "%s"`, devMemCmd)) | ||
if err != nil { | ||
log.Errorf("err exec devMemCmd->%v", err) | ||
return fmt.Errorf("err exec devMemCmd->%v", err) | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
func (s *server) Run() error { | ||
var err error | ||
signalChannel := make(chan os.Signal, 2) | ||
|
@@ -139,6 +193,11 @@ func (s *server) Run() error { | |
if _, err := waitForInfraP4d(); err != nil { | ||
return err | ||
} | ||
if err := AddAccApfsToGroupOne(); err != nil { | ||
log.Fatalf("error from->AddAccApfsToGroupOne: %v", err) | ||
return fmt.Errorf("error from->AddAccApfsToGroupOne: %v", err) | ||
} | ||
|
||
// Create bridge if it doesn't exist | ||
if err := s.bridgeCtlr.EnsureBridgeExists(); err != nil { | ||
log.Fatalf("error while checking host bridge existence: %v", err) | ||
|
@@ -174,8 +233,8 @@ func (s *server) Stop() { | |
s.bridgeCtlr.DeleteBridges() | ||
} | ||
|
||
log.Infof("DeletePhyPortRules, path->%s, 1->%v, 2->%v", s.p4rtbin, AccApfMacList[PHY_PORT0_INTF_INDEX], AccApfMacList[PHY_PORT1_INTF_INDEX]) | ||
p4rtclient.DeletePhyPortRules(s.p4rtbin, AccApfMacList[PHY_PORT0_INTF_INDEX], AccApfMacList[PHY_PORT1_INTF_INDEX]) | ||
log.Infof("DeletePhyPortRules, path->%s, 1->%v, 2->%v", s.p4rtbin, AccApfInfo[PHY_PORT0_INTF_INDEX].Mac, AccApfInfo[PHY_PORT1_INTF_INDEX].Mac) | ||
p4rtclient.DeletePhyPortRules(s.p4rtbin, AccApfInfo[PHY_PORT0_INTF_INDEX].Mac, AccApfInfo[PHY_PORT1_INTF_INDEX].Mac) | ||
|
||
vfMacList, err := utils.GetVfMacList() | ||
if err != nil { | ||
|
Oops, something went wrong.