Skip to content

Commit

Permalink
Merge pull request #675 from intel-go/develop
Browse files Browse the repository at this point in the history
New release 0.9.2
  • Loading branch information
gshimansky committed Dec 12, 2019
2 parents 90dbef7 + dc1400d commit 7ff09bf
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Expand Up @@ -20,7 +20,7 @@ RUN apt-get -q update && apt-get -q -y install \
libmnl-dev \
libibverbs-dev

RUN cd /opt && curl -L -s https://dl.google.com/go/go1.12.9.linux-amd64.tar.gz | tar zx
RUN cd /opt && curl -L -s https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz | tar zx
RUN git clone -b v0.0.4 https://github.com/libbpf/libbpf
RUN make -C libbpf/src all install
RUN echo "/usr/lib64" > /etc/ld.so.conf.d/usrlib64.conf
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial/step07.go
Expand Up @@ -15,7 +15,7 @@ func main() {

l3Rules, err := packet.GetL3ACLFromTextTable("rules1.conf")
flow.CheckFatal(err)
rulesp = unsafe.Pointer(&l3Rules)
rulesp = unsafe.Pointer(l3Rules)
go updateSeparateRules()

firstFlow, err := flow.SetReceiver(0)
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial/step08.go
Expand Up @@ -15,7 +15,7 @@ func main() {

l3Rules, err := packet.GetL3ACLFromTextTable("rules2.conf")
flow.CheckFatal(err)
rulesp = unsafe.Pointer(&l3Rules)
rulesp = unsafe.Pointer(l3Rules)
go updateSeparateRules()

firstFlow, err := flow.SetReceiver(0)
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial/step09.go
Expand Up @@ -16,7 +16,7 @@ func main() {

l3Rules, err := packet.GetL3ACLFromTextTable("rules2.conf")
flow.CheckFatal(err)
rulesp = unsafe.Pointer(&l3Rules)
rulesp = unsafe.Pointer(l3Rules)
go updateSeparateRules()

firstFlow, err := flow.SetReceiver(0)
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial/step10.go
Expand Up @@ -18,7 +18,7 @@ func main() {

l3Rules, err := packet.GetL3ACLFromTextTable("rules2.conf")
flow.CheckFatal(err)
rulesp = unsafe.Pointer(&l3Rules)
rulesp = unsafe.Pointer(l3Rules)
go updateSeparateRules()

firstFlow, err := flow.SetReceiver(0)
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial/step11.go
Expand Up @@ -18,7 +18,7 @@ func main() {

l3Rules, err := packet.GetL3ACLFromTextTable("rules2.conf")
flow.CheckFatal(err)
rulesp = unsafe.Pointer(&l3Rules)
rulesp = unsafe.Pointer(l3Rules)
go updateSeparateRules()

firstFlow, err := flow.SetReceiver(0)
Expand Down
7 changes: 6 additions & 1 deletion internal/low/low.go
Expand Up @@ -274,6 +274,11 @@ const (
RteLpmLookupSuccess = C.RTE_LPM_LOOKUP_SUCCESS
)

// Lookup ring with given name.
func LookupRing(name string) *Ring {
return (*Ring)(unsafe.Pointer(C.nff_go_ring_lookup(C.CString(name))))
}

// CreateRing creates ring with given name and count.
func CreateRing(count uint) *Ring {
name := strconv.Itoa(ringName)
Expand Down Expand Up @@ -615,7 +620,7 @@ func CreatePort(port uint16, willReceive bool, promiscuous bool, hwtxchecksum,
mempools = nil
}
if C.port_init(C.uint16_t(port), C.bool(willReceive), mempools,
C._Bool(promiscuous), C._Bool(hwtxchecksum), C._Bool(hwrxpacketstimestamp), C.int32_t(inIndex), C.int32_t (tXQueuesNumberPerPort)) != 0 {
C._Bool(promiscuous), C._Bool(hwtxchecksum), C._Bool(hwrxpacketstimestamp), C.int32_t(inIndex), C.int32_t(tXQueuesNumberPerPort)) != 0 {
msg := common.LogError(common.Initialization, "Cannot init port ", port, "!")
return common.WrapWithNFError(nil, msg, common.FailToInitPort)
}
Expand Down
14 changes: 13 additions & 1 deletion internal/low/low.h
@@ -1,4 +1,4 @@
// Copyright 2017 Intel Corporation.
// Copyright 2017 Intel Corporation.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -859,6 +859,18 @@ struct rte_ring** extractDPDKRings(struct nff_go_ring** r, int32_t inIndexNumber
return output;
}

struct nff_go_ring *
nff_go_ring_lookup(const char *name) {
struct nff_go_ring* r = malloc(sizeof(struct nff_go_ring));

r->DPDK_ring = rte_ring_lookup(name);
// Ring elements are located immidiately behind rte_ring structure
// So ring[1] is pointed to the beginning of this data
r->internal_DPDK_ring = &(r->DPDK_ring)[1];
r->offset = sizeof(void*);
return r;
}

struct nff_go_ring *
nff_go_ring_create(const char *name, unsigned count, int socket_id, unsigned flags) {
struct nff_go_ring* r = malloc(sizeof(struct nff_go_ring));
Expand Down
2 changes: 1 addition & 1 deletion vagrant/Vagrantfile
Expand Up @@ -126,7 +126,7 @@ echo Reassigning "${syscon}" interface to system name
sudo nmcli c mod "${syscon}" connection.id 'System connection'
echo Unpacking Go language into /opt
(cd /opt; sudo sh -c 'curl -L -s https://dl.google.com/go/go1.12.9.linux-amd64.tar.gz | tar zx')
(cd /opt; sudo sh -c 'curl -L -s https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz | tar zx')
mkdir go
chmod +x ~/scripts.sh
. ~/scripts.sh
Expand Down
2 changes: 1 addition & 1 deletion vagrant/scripts.sh
Expand Up @@ -11,7 +11,7 @@ export CARD2=ens7
bindports ()
{
sudo modprobe uio
sudo insmod "$NFF_GO"/dpdk/dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
sudo insmod "$NFF_GO"/dpdk/dpdk/x86_64-native-linuxapp-gcc-install/lib/modules/$(uname -r)/extra/dpdk/igb_uio.ko
sudo "$NFF_GO"/dpdk/dpdk/usertools/dpdk-devbind.py --bind=igb_uio $NFF_GO_CARDS
}

Expand Down

0 comments on commit 7ff09bf

Please sign in to comment.