Skip to content

Commit

Permalink
Merge next (v2019.11 release) into master
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Nov 8, 2019
2 parents 24c9a67 + f6dc402 commit 4b0c18b
Show file tree
Hide file tree
Showing 123 changed files with 8,376 additions and 2,553 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2019.01
2019.11
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,5 @@ Here are the ways you can get involved:
- Use the Snabb applications in your network.
- Create your very own application: [Getting Started](src/doc/getting-started.md).
- Create Github Issues with your ideas and questions and problems.
- [Join](https://join.slack.com/t/snabb/shared_invite/enQtMzIyOTIwMTg5ODYyLTMzY2FjMGEzM2QzNDlhMDYxNzU0M2UyNjQ1MDc4MDRjY2Q3MWMwY2Q4YWQ1NDllY2E3NTZkZGUyZTQxNzgyNjc) the [Snabb Slack chat](https://snabb.slack.com/) to hang out and shoot the breeze.
- [Join](https://join.slack.com/t/snabb/shared_invite/enQtMzIyOTIwMTg5ODYyLWUwYzg2MTIwMjAxZTM1N2RlNGFjMWY1YzRkZGZiN2U5ZGU1NTYwNWJiMmQ3MWQ1MDFjYTg0MjNjNTZjMTFlZGQ) the [Snabb Slack chat](https://snabb.slack.com/) to hang out and shoot the breeze.

27 changes: 12 additions & 15 deletions lib/ljsyscall/syscall/linux/syscalls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -483,33 +483,30 @@ local function get_maxnumnodes()
return math.floor(((#line+1)/9)*32)
end
end
-- If we don't know, guess that the system has a max of 1024 nodes.
return 1024
end

local function ensure_bitmask(mask, size)
if ffi.istype(t.bitmask, mask) then return mask end
return t.bitmask(mask, size or get_maxnumnodes())
end

function S.get_mempolicy(mode, mask, addr, flags)
mode = mode or t.int1()
local size
if ffi.istype(t.bitmask, mask) then
-- if mask was provided by the caller, then use its size
-- and let the syscall error if it's too small
size = ffi.cast("uint64_t", tonumber(mask.size))
else
local mask_for_size = t.bitmask(mask)
-- Size should be at least equals to maxnumnodes.
size = ffi.cast("uint64_t", math.max(tonumber(mask_for_size.size), get_maxnumnodes()))
mask = t.bitmask(mask, tonumber(size))
end
local ret, err = C.get_mempolicy(mode, mask.mask, size, addr or 0, c.MPOL_FLAG[flags])
mask = ensure_bitmask(mask);
local ret, err = C.get_mempolicy(mode, mask.mask, mask.size, addr or 0, c.MPOL_FLAG[flags])
if ret == -1 then return nil, t.error(err or errno()) end
return { mode=mode[0], mask=mask }
end
function S.set_mempolicy(mode, mask)
mask = mktype(t.bitmask, mask)
mask = ensure_bitmask(mask);
return retbool(C.set_mempolicy(c.MPOL_MODE[mode], mask.mask, mask.size))
end

function S.migrate_pages(pid, from, to)
from = mktype(t.bitmask, from)
to = mktype(t.bitmask, to)
from = ensure_bitmask(from);
to = ensure_bitmask(to, from.size)
assert(from.size == to.size, "incompatible nodemask sizes")
return retbool(C.migrate_pages(pid or 0, from.size, from.mask, to.mask))
end
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ LUAJIT_A := ../lib/luajit/src/raptorjit.a
# for each module that has a top-level selftest () function.
TESTMODS = $(shell find . -regex '[^\#]*\.\(lua\|dasl\)' -printf '%P ' | \
xargs grep -s -l '^function selftest *[[:punct:]]' | \
sed -e 's_\.lua__' -e 's_\.dasl__' -e 's_/_._g')
sed -e 's_\.lua__' -e 's_\.dasl__' -e 's_/_._g' -e 's/-/_/g')

# TESTSCRIPTS expands to:
# lib/watchdog/selftest.sh ...
Expand Down
8 changes: 6 additions & 2 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -816,9 +816,12 @@ end

Returns hexadecimal string for bytes in *string*.

— Function **lib.hexundump** *hexstring*
— Function **lib.hexundump** *hexstring*, *n*, *error*

Returns byte string for *hexstring*.
Returns string of *n* bytes for *hexstring*. Throws an error if less than *n*
hex-encoded bytes could be parsed unless *error* is `false`.

*Error* is optional and can be the error message to throw.

— Function **lib.comma_value** *n*

Expand Down Expand Up @@ -1016,6 +1019,7 @@ Groups of Snabb processes each have the following special properties:
mastering (DMA) is disabled upon termination before any DMA memory
is returned to the kernel. This prevents "dangling" DMA requests
from corrupting memory that has been freed and reused.
See [lib.hardware.pci](#pci-lib.hardware.pci) for details.

The `core.worker` API functions are available in the main process only:

Expand Down
6 changes: 4 additions & 2 deletions src/apps/intel/intel10g.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ function new_sf (conf)
end

function M_sf:open ()
self.fd = pci.open_pci_resource_locked(self.pciaddress, 0)
pci.unbind_device_from_linux(self.pciaddress)
pci.set_bus_master(self.pciaddress, true)
self.base, self.fd = pci.map_pci_memory_locked(self.pciaddress, 0)
self.base = pci.map_pci_memory(self.fd)
register.define(config_registers_desc, self.r, self.base)
register.define(transmit_registers_desc, self.r, self.base)
register.define(receive_registers_desc, self.r, self.base)
Expand Down Expand Up @@ -497,9 +498,10 @@ function new_pf (conf)
end

function M_pf:open ()
self.fd = pci.open_pci_resource_locked(self.pciaddress, 0)
pci.unbind_device_from_linux(self.pciaddress)
pci.set_bus_master(self.pciaddress, true)
self.base, self.fd = pci.map_pci_memory_locked(self.pciaddress, 0)
self.base = pci.map_pci_memory(self.fd)
register.define(config_registers_desc, self.r, self.base)
register.define_array(switch_config_registers_desc, self.r, self.base)
register.define_array(packet_filter_desc, self.r, self.base)
Expand Down
44 changes: 44 additions & 0 deletions src/apps/intel_avf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Intel AVF (adaptive virtual function) app (apps.intel_avf.intel_avf)

The `intel_avf.Intel_avf` app provides drivers for the Virtual Functions exported
by recent generations of Intel network cards.

The links are named `input` and `output`.

DIAGRAM: Intel_avf
+-----------+
| |
input ---->* Intel_avf *----> output
| |
+-----------+

## Configuration

— Key **pciaddr**

*Required*. The PCI address of the NIC as a string.

— Key **ring_buffer_size**

*Optional*. Number of DMA descriptors to use i.e. size of the DMA
transmit and receive queues. Must be a multiple of 128. Default is not
specified but assumed to be broadly applicable.

## Supported Hardware
Ethernet controller [0200]: Intel Corporation Ethernet Virtual Function 700 Series [8086:154c] (rev 02)

## Unsupported features
* Multiple queues per VF. This driver supports a single queue. The spec allows for up to 4 queues.
* RSS with only 1 queue RSS doesn't make sense.
* Multiple vlans are unsupported, `ip link` can be used to map all traffic to a single vlan.
* Multiple MAC addresses are unsupported, `ip link` can be used to set the mac before snabb startup.
* All of the advanced offload features are unsupported.
* 16 byte RX descriptors are unsupported.

## Setting up VFs under linux
echo 2 > /sys/bus/pci/devices/0000\:03\:00.1/sriov_numvfs
ip link set up dev enp3s0f1
ip link set enp3s0f1 vf 0 mac 02:00:00:00:00:01
ip link set enp3s0f1 vf 0 vlan 10

A more complete example can be found in apps/intel_avf/tests/setup.sh
Loading

0 comments on commit 4b0c18b

Please sign in to comment.