aboutsummaryrefslogtreecommitdiff
path: root/sys/ofed
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2021-08-21 14:13:32 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2021-09-07 21:02:58 +0000
commit48f38f47b1051695e2ad7021798edf61495b7030 (patch)
tree5c3316e89dd23e2670a9226dc90457998dc9ef18 /sys/ofed
parent5007bc4e13906104163ca78440ffcefb5c126548 (diff)
downloadsrc-48f38f47b1051695e2ad7021798edf61495b7030.tar.gz
src-48f38f47b1051695e2ad7021798edf61495b7030.zip
lltable: Add support for "child" LLEs holding encap for IPv4oIPv6 entries.
Currently we use pre-calculated headers inside LLE entries as prepend data for `if_output` functions. Using these headers allows saving some CPU cycles/memory accesses on the fast path. However, this approach makes adding L2 header for IPv4 traffic with IPv6 nexthops more complex, as it is not possible to store multiple pre-calculated headers inside lle. Additionally, the solution space is limited by the fact that PCB caching saves LLEs in addition to the nexthop. Thus, add support for creating special "child" LLEs for the purpose of holding custom family encaps and store mbufs pending resolution. To simplify handling of those LLEs, store them in a linked-list inside a "parent" (e.g. normal) LLE. Such LLEs are not visible when iterating LLE table. Their lifecycle is bound to the "parent" LLE - it is not possible to delete "child" when parent is alive. Furthermore, "child" LLEs are static (RTF_STATIC), avoding complex state machine used by the standard LLEs. nd6_lookup() and nd6_resolve() now accepts an additional argument, family, allowing to return such child LLEs. This change uses `LLE_SF()` macro which packs family and flags in a single int field. This is done to simplify merging back to stable/. Once this code lands, most of the cases will be converted to use a dedicated `family` parameter. Differential Revision: https://reviews.freebsd.org/D31379 (cherry picked from commit c541bd368f863bbf5c08dd5c1ecce0166ad47389)
Diffstat (limited to 'sys/ofed')
-rw-r--r--sys/ofed/drivers/infiniband/core/ib_addr.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/ofed/drivers/infiniband/core/ib_addr.c b/sys/ofed/drivers/infiniband/core/ib_addr.c
index a8e951721b8d..297469bd4d87 100644
--- a/sys/ofed/drivers/infiniband/core/ib_addr.c
+++ b/sys/ofed/drivers/infiniband/core/ib_addr.c
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/module.h>
+#include <net/if_llatbl.h>
#include <net/route.h>
#include <net/route/nhop.h>
#include <net/netevent.h>
@@ -584,8 +585,8 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
} else {
bool is_gw = (nh->nh_flags & NHF_GATEWAY) != 0;
memset(edst, 0, MAX_ADDR_LEN);
- error = nd6_resolve(ifp, is_gw, NULL, is_gw ?
- &nh->gw_sa : (const struct sockaddr *)&dst_tmp,
+ error = nd6_resolve(ifp, LLE_SF(AF_INET6, is_gw), NULL,
+ is_gw ? &nh->gw_sa : (const struct sockaddr *)&dst_tmp,
edst, NULL, NULL);
if (error != 0)
goto error_put_ifp;