aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/rdma/ib_sa.h
diff options
context:
space:
mode:
authorMatan Barak <matanb@mellanox.com>2015-10-15 18:38:47 +0300
committerDoug Ledford <dledford@redhat.com>2015-10-21 23:48:17 -0400
commitba36e37fd3ca3dc8f215b14bcfdccf9f41b65767 (patch)
tree82da7f56ca3c414f27913a26c816449e8be9be7b /include/rdma/ib_sa.h
parentIB/core: Expose and rename ib_find_cached_gid_by_port cache API (diff)
downloadwireguard-linux-ba36e37fd3ca3dc8f215b14bcfdccf9f41b65767.tar.xz
wireguard-linux-ba36e37fd3ca3dc8f215b14bcfdccf9f41b65767.zip
IB/core: Add netdev to path record
In order to find the sgid_index, one could just query the IB cache with the correct GID and netdevice. Therefore, instead of storing the L2 attributes directly in the path, we only store the ifindex and net and use them later to get the sgid_index. The vlan_id and smac L2 attributes are removed in a later patch. Signed-off-by: Matan Barak <matanb@mellanox.com> Reviewed-By: Devesh Sharma <devesh.sharma@avagotech.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'include/rdma/ib_sa.h')
-rw-r--r--include/rdma/ib_sa.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index 7e071a6abb34..406ecf177f21 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -39,6 +39,7 @@
#include <linux/compiler.h>
#include <linux/atomic.h>
+#include <linux/netdevice.h>
#include <rdma/ib_verbs.h>
#include <rdma/ib_mad.h>
@@ -157,8 +158,17 @@ struct ib_sa_path_rec {
u8 smac[ETH_ALEN];
u8 dmac[ETH_ALEN];
u16 vlan_id;
+ /* ignored in IB */
+ int ifindex;
+ /* ignored in IB */
+ struct net *net;
};
+static inline struct net_device *ib_get_ndev_from_path(struct ib_sa_path_rec *rec)
+{
+ return rec->net ? dev_get_by_index(rec->net, rec->ifindex) : NULL;
+}
+
#define IB_SA_MCMEMBER_REC_MGID IB_SA_COMP_MASK( 0)
#define IB_SA_MCMEMBER_REC_PORT_GID IB_SA_COMP_MASK( 1)
#define IB_SA_MCMEMBER_REC_QKEY IB_SA_COMP_MASK( 2)