summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vapi/vapi.c
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2017-11-02 11:59:14 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2017-11-05 11:35:57 +0000
commitfd67ece3d3eda0bd896aaa166d89b4f8e7f4e98f (patch)
treef8c725239953a91ba37f783805580cb21159f2e6 /src/vpp-api/vapi/vapi.c
parente4bb5bc7c153ec1b26abae00461aaf19f5541419 (diff)
Fix coverity warnings in VOM and VAPI
Change-Id: I0db55e079f9b1835668c8efe69e6e6f7f8437b00 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'src/vpp-api/vapi/vapi.c')
-rw-r--r--src/vpp-api/vapi/vapi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vpp-api/vapi/vapi.c b/src/vpp-api/vapi/vapi.c
index 25c0b3be1d3..658fd7e584c 100644
--- a/src/vpp-api/vapi/vapi.c
+++ b/src/vpp-api/vapi/vapi.c
@@ -238,7 +238,7 @@ vapi_lookup_vapi_msg_id_t (vapi_ctx_t ctx, u16 vl_msg_id)
{
return ctx->vl_msg_id_to_vapi_msg_t[vl_msg_id];
}
- return ~0;
+ return INVALID_MSG_ID;
}
vapi_error_e
@@ -337,7 +337,7 @@ vapi_connect (vapi_ctx_t ctx, const char *name,
u8 scratch[m->name_with_crc_len + 1];
memcpy (scratch, m->name_with_crc, m->name_with_crc_len + 1);
u32 id = vl_api_get_msg_index (scratch);
- if (~0 != id)
+ if (INVALID_MSG_ID != id)
{
if (id > UINT16_MAX)
{
@@ -716,7 +716,7 @@ vapi_dispatch_one (vapi_ctx_t ctx)
vapi_msg_free (ctx, msg);
return VAPI_EINVAL;
}
- if (~0 == (unsigned) ctx->vl_msg_id_to_vapi_msg_t[vpp_id])
+ if (INVALID_MSG_ID == (unsigned) ctx->vl_msg_id_to_vapi_msg_t[vpp_id])
{
VAPI_ERR ("Unknown msg ID received, id `%u' marked as not supported",
(unsigned) vpp_id);
88 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
# RDMA (ibverb) Ethernet driver {#rdma_doc}

This driver relies on Linux rdma-core (libibverb) userspace poll-mode driver
to rx/tx Ethernet packets. Despite using the RDMA APIs, this is **not** about
RDMA (no Infiniband, no RoCE, no iWARP), just pure traditional Ethernet
packets.

## Maturity level
Under development: it should work, but has not been thoroughly tested.

## Supported Hardware
 - Mellanox ConnectX-4
 - Mellanox ConnectX-5

## Features
 - bifurcation: MAC based flow steering for transparent sharing of a single
physical port between multiple virtual interfaces including Linux netdev
 - multiqueue

## Security considerations
When creating a rdma interface, it will receive all packets to the MAC address
attributed to the interface plus a copy of all broadcast and multicast
traffic.
The MAC address is under the control of VPP: **the user controlling VPP can
divert all traffic of any MAC address to the VPP process, including the Linux
netdev MAC address as long as it can create a rdma interface**.
The rights to create a rdma interface are controlled by the access rights of
the `/dev/infiniband/uverbs[0-9]+`device nodes.

## Quickstart
1. Make sure the `ib_uverbs` module is loaded:
```
~# modprobe ib_uverbs
```
2. In VPP, create a new rdma virtual interface tied to the Linux netdev of the
physical port you want to use (`enp94s0f0` in this example):
```
vpp# create int rdma host-if enp94s0f0 name rdma-0
```
3. Use the interface as usual, eg.:
```
vpp# set int ip addr rdma-0 1.1.1.1/24
vpp# set int st rdma-0 up
vpp# ping 1.1.1.100`
```

### Containers support
It should work in containers as long as:
 - the `ib_uverbs` module is loaded
 - the device nodes `/dev/infiniband/uverbs[0-9]+` are usable from the
   container (but see [security considerations](#Security considerations))

### SR-IOV VFs support
It should work on SR-IOV VFs the same way it does with PFs. Because of VFs
security containment features, make sure the MAC address of the rdma VPP
interface matches the MAC address assigned to the underlying VF.
For example:
```
host# echo 1 > /sys/class/infiniband/mlx5_0/device/sriov_numvfs
host# ip l set dev enp94s0f0 vf 0 mac 92:5d:f5:df:b1:6f spoof on trust off
host# ip l set dev enp94s0f2 up
vpp# create int rdma host-if enp94s0f2 name rdma-0
vpp# set int mac address rdma-0 92:5d:f5:df:b1:6f
```
If you plan to use L2 features such as switching, make sure the underlying
VF is configured in trusted mode and spoof-checking is disabled (of course, be
aware of the [security considerations](#Security considerations)):
```
host# ip l set dev enp94s0f0 vf 0 spoof off trust on
```