Skip to content

Commit

Permalink
ct sync optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
TrekkieCoder committed Aug 20, 2023
1 parent 7253c90 commit 9aaceca
Showing 1 changed file with 11 additions and 34 deletions.
45 changes: 11 additions & 34 deletions loxinet/dpebpf_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1690,32 +1690,20 @@ func dpCTMapNotifierWorker(cti *DpCtInfo) {

func dpCTMapBcast() {
mh.dpEbpf.mtx.Lock()
defer mh.dpEbpf.mtx.Unlock()

var (
tot int
rok int
)

for _, cti := range mh.dpEbpf.ctMap {
if cti.Deleted <= 0 && cti.CState == "est" {
tot++
ret := mh.dp.DpXsyncRPC(DpSyncBcast, cti)
if ret == 0 {
rok++
cti.XSync = false
} else {
cti.XSync = true
cti.NTs = time.Now()
}
cti.XSync = true
}
}
if tot == rok {
cti := new(DpCtInfo)
cti.Proto = "xsync"
cti.Sport = uint16(mh.self)
mh.dp.DpXsyncRPC(DpSyncBcast, cti)
}

mh.dpEbpf.mtx.Unlock()

cti := new(DpCtInfo)
cti.Proto = "xsync"
cti.Sport = uint16(mh.self)
mh.dp.DpXsyncRPC(DpSyncBcast, cti)
tk.LogIt(tk.LogInfo, "[CT] CTBcast Complete \n")
}

func dpCTMapChkUpdates() {
Expand Down Expand Up @@ -1833,7 +1821,7 @@ func dpCTMapChkUpdates() {
}
}

if len(blkCti) > 1024 {
if len(blkCti) > 2048 {
tk.LogIt(tk.LogDebug, "[CT] Block Add Sync - \n")
tc1 := time.Now()
mh.dp.DpXsyncRPC(DpSyncAdd, blkCti)
Expand All @@ -1842,7 +1830,7 @@ func dpCTMapChkUpdates() {
blkCti = nil
}

if len(blkDelCti) > 1024 {
if len(blkDelCti) > 2048 {
tk.LogIt(tk.LogDebug, "[CT] Block Del Sync - \n")
mh.dp.DpXsyncRPC(DpSyncDelete, blkDelCti)
blkDelCti = nil
Expand Down Expand Up @@ -1973,18 +1961,7 @@ func (e *DpEbpfH) DpCtDel(w *DpCtInfo) int {

// DpCtGetAsync - routine to work on a ebpf ct get async request
func (e *DpEbpfH) DpCtGetAsync() {

e.ctBcast <- true

// mh.dpEbpf.mtx.Lock()
// defer mh.dpEbpf.mtx.Unlock()

// for _, cte := range mh.dpEbpf.ctMap {
// if cte.CState == "est" {
// cte.XSync = true
// cte.NTs = time.Now()
// }
// }
}

// DpTakeLock - routine to take underlying DP lock
Expand Down

0 comments on commit 9aaceca

Please sign in to comment.