diff options
Diffstat (limited to 'include/rdma')
-rw-r--r-- | include/rdma/ib_addr.h | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h index 3a39c55d2b9a..fa0d52b8e622 100644 --- a/include/rdma/ib_addr.h +++ b/include/rdma/ib_addr.h | |||
@@ -122,40 +122,29 @@ static inline void ib_addr_get_mgid(struct rdma_dev_addr *dev_addr, | |||
122 | memcpy(gid, dev_addr->broadcast + 4, sizeof *gid); | 122 | memcpy(gid, dev_addr->broadcast + 4, sizeof *gid); |
123 | } | 123 | } |
124 | 124 | ||
125 | static inline void ib_addr_get_sgid(struct rdma_dev_addr *dev_addr, | 125 | static inline int rdma_addr_gid_offset(struct rdma_dev_addr *dev_addr) |
126 | union ib_gid *gid) | ||
127 | { | 126 | { |
128 | memcpy(gid, dev_addr->src_dev_addr + 4, sizeof *gid); | 127 | return dev_addr->dev_type == ARPHRD_INFINIBAND ? 4 : 0; |
129 | } | 128 | } |
130 | 129 | ||
131 | static inline void ib_addr_set_sgid(struct rdma_dev_addr *dev_addr, | 130 | static inline void rdma_addr_get_sgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) |
132 | union ib_gid *gid) | ||
133 | { | 131 | { |
134 | memcpy(dev_addr->src_dev_addr + 4, gid, sizeof *gid); | 132 | memcpy(gid, dev_addr->src_dev_addr + rdma_addr_gid_offset(dev_addr), sizeof *gid); |
135 | } | 133 | } |
136 | 134 | ||
137 | static inline void ib_addr_get_dgid(struct rdma_dev_addr *dev_addr, | 135 | static inline void rdma_addr_set_sgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) |
138 | union ib_gid *gid) | ||
139 | { | 136 | { |
140 | memcpy(gid, dev_addr->dst_dev_addr + 4, sizeof *gid); | 137 | memcpy(dev_addr->src_dev_addr + rdma_addr_gid_offset(dev_addr), gid, sizeof *gid); |
141 | } | 138 | } |
142 | 139 | ||
143 | static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr, | 140 | static inline void rdma_addr_get_dgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) |
144 | union ib_gid *gid) | ||
145 | { | 141 | { |
146 | memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid); | 142 | memcpy(gid, dev_addr->dst_dev_addr + rdma_addr_gid_offset(dev_addr), sizeof *gid); |
147 | } | 143 | } |
148 | 144 | ||
149 | static inline void iw_addr_get_sgid(struct rdma_dev_addr *dev_addr, | 145 | static inline void rdma_addr_set_dgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) |
150 | union ib_gid *gid) | ||
151 | { | ||
152 | memcpy(gid, dev_addr->src_dev_addr, sizeof *gid); | ||
153 | } | ||
154 | |||
155 | static inline void iw_addr_get_dgid(struct rdma_dev_addr *dev_addr, | ||
156 | union ib_gid *gid) | ||
157 | { | 146 | { |
158 | memcpy(gid, dev_addr->dst_dev_addr, sizeof *gid); | 147 | memcpy(dev_addr->dst_dev_addr + rdma_addr_gid_offset(dev_addr), gid, sizeof *gid); |
159 | } | 148 | } |
160 | 149 | ||
161 | #endif /* IB_ADDR_H */ | 150 | #endif /* IB_ADDR_H */ |