yerden / go-dpdk Goto Github PK
View Code? Open in Web Editor NEWGo bindings for DPDK library.
License: BSD 3-Clause "New" or "Revised" License
Go bindings for DPDK library.
License: BSD 3-Clause "New" or "Revised" License
env:
Linux localhost.localdomain 5.10.0-182.0.0.95.oe2203sp3.aarch64 #1 SMP Sat Dec 30 13:16:24 CST 2023 aarch64 aarch64 aarch64 GNU/Linux
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-linux-gnu/10.3.1/lto-wrapper
Target:aarch64-linux-gnu
build the test-sniffer demo,the error as below:
go-dpdk/mempool/mbuf.go:39:8: could not determine kind of name for C.free
if change the stdint.h to stdlib.h,then it passed, any other way to bypass it?
Line 204 in 4faded6
Fix parsing.
#apt-get update -y ;
#apt-get install libdpdk-dev libnuma-dev dpdk -y;
GOOS=linux \
GOARCH=amd64 \
CGO_ENABLED=1 \
CGO_CFLAGS="-m64 -pthread -O3 -march=native -I/usr/include/dpdk" \
CGO_LDFLAGS="-L/usr/lib/x86_64-linux-gnu -ldpdk -lz -lrt -lnuma -ldl -lm" \
go build cmd/dpdk/main.go;
#I am a novice
hello, Sir:
After dpdk was installed, the examples app helloworld run well.
then build helloworld,get such an error,what should I do?
[root@localhost helloworld]# go build main.go
../../eal/eal.go:141:9: could not determine kind of name for C.free
After added "#include <stdlib.h>" to the eal.go, It passed. Has any other way to avoid modifying the code?
btw:Does it support dpdk 22.11
after I use pid.RxBurst so many times, it always return 0,so I can't get any packet
`func delivery(pq test.PortQueue) func(*eal.LcoreCtx) {
return func(ctx *eal.LcoreCtx) {
pid := pq.Pid
qid := pq.Qid
uid := uuid.New().String()[:10]
mp, err := mempool.CreateMbufPool(uid, 10000, 15000, mempool.OptSocket(int(eal.SocketID())),
mempool.OptCacheSize(512),
mempool.OptPrivateDataSize(512))
if err != nil {
log.Fatalln("here", err)
}
defer mp.Free()
var mbufs = make([]*mbuf.Mbuf, 5000)
if err = mbuf.PktMbufAllocBulk(mp, mbufs); err != nil {
panic(err)
}
count := 0
log.Printf("delivery processing pid=%d, qid=%d, lcore=%d\n", pid, qid, eal.LcoreID())
for {
n := pid.RxBurst(qid, mbufs)
for i := 0; i < int(n); i++ {
if mbufs[i] != nil {
data := mbufs[i].Data()
mbufs[i].PktMbufFree()
mbufs[i].PktMbufReset()
atomic.AddUint64(&netflow.Rate.MessageCount, 1)
atomic.AddUint64(&netflow.Rate.MessageByteRate, uint64(len(data)))
if len(data) > 42 {
num := count % 4
if num == 3 {
num = 2
}
test.DelkiveryChan[num] <- data
count++
}
}
}
}
}
}`
such as I create byte array of arp ,how can I change it into C.mbuf。because TxBurst need param []*mbuf.Mbuf
Need some example apps to show packages features.
Line 39 in 0f3be2e
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.