aboutsummaryrefslogtreecommitdiff
path: root/sys/ofed/include
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2021-05-26 12:27:26 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2021-05-26 12:30:02 +0000
commitc35034b338eb4de6fb42fd855865bce21c81a225 (patch)
tree92067ae0aef7ff05c6f6d74dc10f7cf5c2908e00 /sys/ofed/include
parent3bca93e04275045c3d868d09a57f9201999908f0 (diff)
downloadsrc-c35034b338eb4de6fb42fd855865bce21c81a225.tar.gz
src-c35034b338eb4de6fb42fd855865bce21c81a225.zip
LinuxKPI/OFED/mlx4: cleanup netdevice.h some more
This removes all unused bits from linux/netdevice.h and migrates two inline functions into the mlx4 and ofed code respectively. This gets the mlx4/ofed (struct ifnet) specific bits down to 7 lines in netdevice.h. Sponsored by: The FreeBSD Foundation MFC after: 13 days Reviewed by: hselasky, kib Differential Revision: https://reviews.freebsd.org/D30461
Diffstat (limited to 'sys/ofed/include')
-rw-r--r--sys/ofed/include/rdma/ib_addr.h2
-rw-r--r--sys/ofed/include/rdma/ib_addr_freebsd.h15
-rw-r--r--sys/ofed/include/rdma/ib_sa.h1
3 files changed, 17 insertions, 1 deletions
diff --git a/sys/ofed/include/rdma/ib_addr.h b/sys/ofed/include/rdma/ib_addr.h
index 052fc636f617..535e6c2b3b14 100644
--- a/sys/ofed/include/rdma/ib_addr.h
+++ b/sys/ofed/include/rdma/ib_addr.h
@@ -49,7 +49,7 @@
#include <net/ip.h>
#include <rdma/ib_verbs.h>
#include <rdma/ib_pack.h>
-#include <net/ipv6.h>
+#include <rdma/ib_addr_freebsd.h>
struct rdma_addr_client {
atomic_t refcount;
diff --git a/sys/ofed/include/rdma/ib_addr_freebsd.h b/sys/ofed/include/rdma/ib_addr_freebsd.h
index 5ce5f2f8a5ed..79b7231875ec 100644
--- a/sys/ofed/include/rdma/ib_addr_freebsd.h
+++ b/sys/ofed/include/rdma/ib_addr_freebsd.h
@@ -92,4 +92,19 @@ ip6_ifp_find(struct vnet *vnet, struct in6_addr addr, uint16_t scope_id)
}
#endif
+static inline struct ifnet *
+dev_get_by_index(struct vnet *vnet, int if_index)
+{
+ struct epoch_tracker et;
+ struct ifnet *retval;
+
+ NET_EPOCH_ENTER(et);
+ CURVNET_SET(vnet);
+ retval = ifnet_byindex_ref(if_index);
+ CURVNET_RESTORE();
+ NET_EPOCH_EXIT(et);
+
+ return (retval);
+}
+
#endif /* _RDMA_IB_ADDR_FREEBSD_H */
diff --git a/sys/ofed/include/rdma/ib_sa.h b/sys/ofed/include/rdma/ib_sa.h
index 28e9a7887cab..beea96a02e1a 100644
--- a/sys/ofed/include/rdma/ib_sa.h
+++ b/sys/ofed/include/rdma/ib_sa.h
@@ -43,6 +43,7 @@
#include <linux/compiler.h>
#include <linux/netdevice.h>
+#include <rdma/ib_addr_freebsd.h>
#include <rdma/ib_verbs.h>
#include <rdma/ib_mad.h>