34 #if !defined(IB_ADDR_H)
38 #include <linux/in6.h>
39 #include <linux/if_arp.h>
40 #include <linux/netdevice.h>
41 #include <linux/socket.h>
42 #include <linux/if_vlan.h>
103 const unsigned char *dst_dev_addr);
105 static inline int ip_addr_size(
struct sockaddr *addr)
111 static
inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr)
122 static inline void ib_addr_get_mgid(
struct rdma_dev_addr *dev_addr,
128 static inline int rdma_addr_gid_offset(
struct rdma_dev_addr *dev_addr)
138 gid->
raw[12] = vid & 0xff;
139 gid->
raw[11] = vid >> 8;
155 static inline void iboe_addr_get_sgid(
struct rdma_dev_addr *dev_addr,
163 vid = rdma_vlan_dev_vlan_id(dev);
174 iboe_addr_get_sgid(dev_addr, gid);
177 rdma_addr_gid_offset(dev_addr),
sizeof *gid);
195 static inline enum ib_mtu iboe_get_mtu(
int mtu)
209 else if (mtu >= ib_mtu_enum_to_int(
IB_MTU_512))
211 else if (mtu >= ib_mtu_enum_to_int(
IB_MTU_256))
217 static inline int iboe_get_rate(
struct net_device *dev)
229 speed = ethtool_cmd_speed(&
cmd);
232 else if (speed >= 30000)
234 else if (speed >= 20000)
236 else if (speed >= 10000)
242 static inline int rdma_link_local_addr(
struct in6_addr *addr)
244 if (addr->s6_addr32[0] ==
htonl(0xfe800000) &&
245 addr->s6_addr32[1] == 0)
251 static inline void rdma_get_ll_mac(
struct in6_addr *addr,
u8 *mac)
253 memcpy(mac, &addr->s6_addr[8], 3);
254 memcpy(mac + 3, &addr->s6_addr[13], 3);
258 static inline int rdma_is_multicast_addr(
struct in6_addr *addr)
260 return addr->s6_addr[0] == 0xff;
263 static inline void rdma_get_mcast_mac(
struct in6_addr *addr,
u8 *mac)
269 for (i = 2; i < 6; ++
i)
270 mac[i] = addr->s6_addr[i + 10];
273 static inline u16 rdma_get_vlan_id(
union ib_gid *dgid)
277 vid = dgid->
raw[11] << 8 | dgid->
raw[12];
278 return vid < 0x1000 ? vid : 0xffff;