@@ -375,6 +375,7 @@ type port struct {
375
375
txQueuesNumber int16
376
376
willReceive bool // will this port receive packets
377
377
willKNI bool // will this port has assigned KNI device
378
+ KNICoreIndex int
378
379
port uint16
379
380
MAC [common .EtherAddrLen ]uint8
380
381
InIndex int32
@@ -601,7 +602,7 @@ func SystemStart() error {
601
602
602
603
// SystemStop stops the system. All Flow functions plus resource releasing
603
604
// Doesn't cleanup DPDK
604
- func SystemStop () {
605
+ func SystemStop () error {
605
606
// TODO we should release rings here
606
607
schedState .systemStop ()
607
608
for i := range createdPorts {
@@ -611,8 +612,17 @@ func SystemStop() {
611
612
createdPorts [i ].txQueuesNumber = 0
612
613
createdPorts [i ].willReceive = false
613
614
}
615
+ if createdPorts [i ].willKNI {
616
+ err := low .FreeKNI (createdPorts [i ].port )
617
+ if err != nil {
618
+ return err
619
+ }
620
+ schedState .setCoreByIndex (createdPorts [i ].KNICoreIndex )
621
+ createdPorts [i ].willKNI = false
622
+ }
614
623
}
615
624
low .FreeMempools ()
625
+ return nil
616
626
}
617
627
618
628
// SystemReset stops whole framework plus cleanup DPDK
@@ -1566,19 +1576,20 @@ func CreateKniDevice(portId uint16, name string) (*Kni, error) {
1566
1576
if createdPorts [portId ].willKNI {
1567
1577
return nil , common .WrapWithNFError (nil , "Requested KNI port already has KNI. Two KNIs for one port are prohibited." , common .MultipleKNIPort )
1568
1578
}
1569
- if core , _ , err := schedState .getCore (); err != nil {
1579
+ if core , coreIndex , err := schedState .getCore (); err != nil {
1570
1580
return nil , err
1571
1581
} else {
1572
1582
if err := low .CreateKni (portId , uint (core ), name ); err != nil {
1573
1583
return nil , err
1574
1584
}
1585
+ kni := new (Kni )
1586
+ // Port will be identifier of this KNI
1587
+ // KNI structure itself is stored inside low.c
1588
+ kni .portId = portId
1589
+ createdPorts [portId ].willKNI = true
1590
+ createdPorts [portId ].KNICoreIndex = coreIndex
1591
+ return kni , nil
1575
1592
}
1576
- kni := new (Kni )
1577
- // Port will be identifier of this KNI
1578
- // KNI structure itself is stored inside low.c
1579
- kni .portId = portId
1580
- createdPorts [portId ].willKNI = true
1581
- return kni , nil
1582
1593
}
1583
1594
1584
1595
func FillSliceFromMask (input []uintptr , mask * [burstSize ]bool , output []uintptr ) uint8 {
0 commit comments