Skip to content

Commit 7ff09bf

Browse files
authored
Merge pull request #675 from intel-go/develop
New release 0.9.2
2 parents 90dbef7 + dc1400d commit 7ff09bf

File tree

10 files changed

+27
-10
lines changed

10 files changed

+27
-10
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RUN apt-get -q update && apt-get -q -y install \
2020
libmnl-dev \
2121
libibverbs-dev
2222

23-
RUN cd /opt && curl -L -s https://dl.google.com/go/go1.12.9.linux-amd64.tar.gz | tar zx
23+
RUN cd /opt && curl -L -s https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz | tar zx
2424
RUN git clone -b v0.0.4 https://github.com/libbpf/libbpf
2525
RUN make -C libbpf/src all install
2626
RUN echo "/usr/lib64" > /etc/ld.so.conf.d/usrlib64.conf

examples/tutorial/step07.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func main() {
1515

1616
l3Rules, err := packet.GetL3ACLFromTextTable("rules1.conf")
1717
flow.CheckFatal(err)
18-
rulesp = unsafe.Pointer(&l3Rules)
18+
rulesp = unsafe.Pointer(l3Rules)
1919
go updateSeparateRules()
2020

2121
firstFlow, err := flow.SetReceiver(0)

examples/tutorial/step08.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func main() {
1515

1616
l3Rules, err := packet.GetL3ACLFromTextTable("rules2.conf")
1717
flow.CheckFatal(err)
18-
rulesp = unsafe.Pointer(&l3Rules)
18+
rulesp = unsafe.Pointer(l3Rules)
1919
go updateSeparateRules()
2020

2121
firstFlow, err := flow.SetReceiver(0)

examples/tutorial/step09.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func main() {
1616

1717
l3Rules, err := packet.GetL3ACLFromTextTable("rules2.conf")
1818
flow.CheckFatal(err)
19-
rulesp = unsafe.Pointer(&l3Rules)
19+
rulesp = unsafe.Pointer(l3Rules)
2020
go updateSeparateRules()
2121

2222
firstFlow, err := flow.SetReceiver(0)

examples/tutorial/step10.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func main() {
1818

1919
l3Rules, err := packet.GetL3ACLFromTextTable("rules2.conf")
2020
flow.CheckFatal(err)
21-
rulesp = unsafe.Pointer(&l3Rules)
21+
rulesp = unsafe.Pointer(l3Rules)
2222
go updateSeparateRules()
2323

2424
firstFlow, err := flow.SetReceiver(0)

examples/tutorial/step11.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func main() {
1818

1919
l3Rules, err := packet.GetL3ACLFromTextTable("rules2.conf")
2020
flow.CheckFatal(err)
21-
rulesp = unsafe.Pointer(&l3Rules)
21+
rulesp = unsafe.Pointer(l3Rules)
2222
go updateSeparateRules()
2323

2424
firstFlow, err := flow.SetReceiver(0)

internal/low/low.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ const (
274274
RteLpmLookupSuccess = C.RTE_LPM_LOOKUP_SUCCESS
275275
)
276276

277+
// Lookup ring with given name.
278+
func LookupRing(name string) *Ring {
279+
return (*Ring)(unsafe.Pointer(C.nff_go_ring_lookup(C.CString(name))))
280+
}
281+
277282
// CreateRing creates ring with given name and count.
278283
func CreateRing(count uint) *Ring {
279284
name := strconv.Itoa(ringName)
@@ -615,7 +620,7 @@ func CreatePort(port uint16, willReceive bool, promiscuous bool, hwtxchecksum,
615620
mempools = nil
616621
}
617622
if C.port_init(C.uint16_t(port), C.bool(willReceive), mempools,
618-
C._Bool(promiscuous), C._Bool(hwtxchecksum), C._Bool(hwrxpacketstimestamp), C.int32_t(inIndex), C.int32_t (tXQueuesNumberPerPort)) != 0 {
623+
C._Bool(promiscuous), C._Bool(hwtxchecksum), C._Bool(hwrxpacketstimestamp), C.int32_t(inIndex), C.int32_t(tXQueuesNumberPerPort)) != 0 {
619624
msg := common.LogError(common.Initialization, "Cannot init port ", port, "!")
620625
return common.WrapWithNFError(nil, msg, common.FailToInitPort)
621626
}

internal/low/low.h

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017 Intel Corporation.
1+
// Copyright 2017 Intel Corporation.
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

@@ -859,6 +859,18 @@ struct rte_ring** extractDPDKRings(struct nff_go_ring** r, int32_t inIndexNumber
859859
return output;
860860
}
861861

862+
struct nff_go_ring *
863+
nff_go_ring_lookup(const char *name) {
864+
struct nff_go_ring* r = malloc(sizeof(struct nff_go_ring));
865+
866+
r->DPDK_ring = rte_ring_lookup(name);
867+
// Ring elements are located immidiately behind rte_ring structure
868+
// So ring[1] is pointed to the beginning of this data
869+
r->internal_DPDK_ring = &(r->DPDK_ring)[1];
870+
r->offset = sizeof(void*);
871+
return r;
872+
}
873+
862874
struct nff_go_ring *
863875
nff_go_ring_create(const char *name, unsigned count, int socket_id, unsigned flags) {
864876
struct nff_go_ring* r = malloc(sizeof(struct nff_go_ring));

vagrant/Vagrantfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ echo Reassigning "${syscon}" interface to system name
126126
sudo nmcli c mod "${syscon}" connection.id 'System connection'
127127
128128
echo Unpacking Go language into /opt
129-
(cd /opt; sudo sh -c 'curl -L -s https://dl.google.com/go/go1.12.9.linux-amd64.tar.gz | tar zx')
129+
(cd /opt; sudo sh -c 'curl -L -s https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz | tar zx')
130130
mkdir go
131131
chmod +x ~/scripts.sh
132132
. ~/scripts.sh

vagrant/scripts.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export CARD2=ens7
1111
bindports ()
1212
{
1313
sudo modprobe uio
14-
sudo insmod "$NFF_GO"/dpdk/dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
14+
sudo insmod "$NFF_GO"/dpdk/dpdk/x86_64-native-linuxapp-gcc-install/lib/modules/$(uname -r)/extra/dpdk/igb_uio.ko
1515
sudo "$NFF_GO"/dpdk/dpdk/usertools/dpdk-devbind.py --bind=igb_uio $NFF_GO_CARDS
1616
}
1717

0 commit comments

Comments
 (0)