Add APIs to add and delete a devlink port of specified flavour for a
given devlink device.
Extended test to accept devlink device and sf number parameters from the
test command line.
Signed-off-by: Parav Pandit <parav@nvidia.com>
struct xfrm_usersa_flush contains a single u8, thus sizeof(struct
xfrm_usersa_flush) == 1 as can be verified by running the following
code through go tool cgo -godefs:
package xfrm_test
// #include <linux/xfrm.h>
import "C"
const SizeofXfrmUsersaFlush = C.sizeof_struct_xfrm_usersa_flush
which results in
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs foo.go
package xfrm_test
const SizeofXfrmUsersaFlush = 0x1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
This PR refers to PR@lebauce and add some changes.
- Added some tests to retrieve bond slave information.
- Link.BondSlave is changed to LinkSlave interface.
- BondSlaveState.String() returns UPPER case. (same as iproute2)
- BondSlaveMiiStatus.String() returns UPPER case. (same as iproute2)
- Add a new Link type, IPoIB, that exposes the following IPoIB attributes:
* IFLA_IPOIB_PKEY
* IFLA_IPOIB_MODE
* IFLA_IPOIB_UMCAST
- Suppport Deserialize for IPoIB link attributes in LinkDeserialize()
- Support IPoIB attributes in LinkAdd()
iproute2's own netlink library asserts that the sockaddr sender pid
has to be the one of the kernel [0]. It also doesn't bail out on pid
mismatch but only skips the message instead. We've seen cases where
the latter had a pid 0; in such case we should skip to the next nl
message instead of hard bail out.
[0] https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/tree/lib/libnetlink.c
rtnl_dump_filter_l(), __rtnl_talk_iov()
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
In order to support BPF_SYSCALL `PROG_GET_FD_BY_ID` -- the ID of the
eBPF must be available.
Add the additional enumerations and handle them when parsing the BPF
filter.
Add an API to change the RDMA subsystem network namespace mode as either
shared or exclusive similar to
$ rdma system set netns { shared | exclusive }
Signed-off-by: Parav Pandit <parav@mellanox.com>
RDMA subsystem can be running in shared or exclusive mode with regards
to sharing RDMA device sharing among multiple network namespaces.
Add and API to query such mode of kernel similar to iproute2 command
$ rdma system show netns
Signed-off-by: Parav Pandit <parav@mellanox.com>
For tuntap interfaces, return a TunTap Interface instead of
a Generic link when retrieving the interface.
Use netlink extended attributes to populate the Link attributes
for the tuntap link.
In case of older tun driver which does not provide these
attributes, use sysfs to retrieve these attributes.
This commit also adds Owner and Group attributes for the TunTap
Link.
Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
Devlink device currently has legacy and switchdev mode.
Add an API to set devlink device mode for discovered devlink device.
Signed-off-by: Parav Pandit <parav@mellanox.com>
XFRM interfaces are available in Linux Kernel 4.19+
When an IF_ID is applied to a XFRM policy and state, the corresponding
traffic will be sent through the virtual interface with the same IF_ID.
Currently each call to Receive() allocates 64K buffer on the heap
for the data to receive from a netlink socket. This is rather costly
considering that in most cases only fraction of this memory is actually
needed.
A quick fix is to make sure that the large buffer does not "escape" -
i.e. that it is sufficient to have it allocated on the stack.
Then only the prefix of the buffer that was actually used
is copied to the heap.
Fix for issue: #379
Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
This patch adds very basic support for getting information about
devlink devices which are typically PCI devices which exposes Networking
switch or legacy devices.
This information includes bus name, device name and eswitch modes.
This is done through devlink family of commands via generic netlink
sockets provided by Linux kernel.
DevlinkDevice represents a devlink device which is identified by bus
name and device name (unlike interface index for netdevices).
It contains the DevlinkDevAttrs device attributes.
Currently only eswitch attributes are queried. In future more attributes
such as port, shared buffer, traffic class will be added.
Signed-off-by: Parav Pandit <parav@mellanox.com>