From ba36e37fd3ca3dc8f215b14bcfdccf9f41b65767 Mon Sep 17 00:00:00 2001 From: Matan Barak Date: Thu, 15 Oct 2015 18:38:47 +0300 Subject: 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 Reviewed-By: Devesh Sharma Signed-off-by: Doug Ledford --- include/rdma/ib_sa.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') 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 #include +#include #include #include @@ -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) -- cgit v1.2.3