ipoib.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. /*
  2. * Copyright (c) 2004, 2005 Topspin Communications. All rights reserved.
  3. * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
  4. * Copyright (c) 2004 Voltaire, Inc. All rights reserved.
  5. *
  6. * This software is available to you under a choice of one of two
  7. * licenses. You may choose to be licensed under the terms of the GNU
  8. * General Public License (GPL) Version 2, available from the file
  9. * COPYING in the main directory of this source tree, or the
  10. * OpenIB.org BSD license below:
  11. *
  12. * Redistribution and use in source and binary forms, with or
  13. * without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above
  17. * copyright notice, this list of conditions and the following
  18. * disclaimer.
  19. *
  20. * - Redistributions in binary form must reproduce the above
  21. * copyright notice, this list of conditions and the following
  22. * disclaimer in the documentation and/or other materials
  23. * provided with the distribution.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  29. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  30. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  31. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  32. * SOFTWARE.
  33. *
  34. * $Id: ipoib.h 1358 2004-12-17 22:00:11Z roland $
  35. */
  36. #ifndef _IPOIB_H
  37. #define _IPOIB_H
  38. #include <linux/list.h>
  39. #include <linux/skbuff.h>
  40. #include <linux/netdevice.h>
  41. #include <linux/workqueue.h>
  42. #include <linux/pci.h>
  43. #include <linux/kref.h>
  44. #include <linux/if_infiniband.h>
  45. #include <linux/mutex.h>
  46. #include <net/neighbour.h>
  47. #include <asm/atomic.h>
  48. #include <rdma/ib_verbs.h>
  49. #include <rdma/ib_pack.h>
  50. #include <rdma/ib_sa.h>
  51. /* constants */
  52. enum {
  53. IPOIB_PACKET_SIZE = 2048,
  54. IPOIB_BUF_SIZE = IPOIB_PACKET_SIZE + IB_GRH_BYTES,
  55. IPOIB_ENCAP_LEN = 4,
  56. IPOIB_CM_MTU = 0x10000 - 0x10, /* padding to align header to 16 */
  57. IPOIB_CM_BUF_SIZE = IPOIB_CM_MTU + IPOIB_ENCAP_LEN,
  58. IPOIB_CM_HEAD_SIZE = IPOIB_CM_BUF_SIZE % PAGE_SIZE,
  59. IPOIB_CM_RX_SG = ALIGN(IPOIB_CM_BUF_SIZE, PAGE_SIZE) / PAGE_SIZE,
  60. IPOIB_RX_RING_SIZE = 128,
  61. IPOIB_TX_RING_SIZE = 64,
  62. IPOIB_MAX_QUEUE_SIZE = 8192,
  63. IPOIB_MIN_QUEUE_SIZE = 2,
  64. IPOIB_NUM_WC = 4,
  65. IPOIB_MAX_PATH_REC_QUEUE = 3,
  66. IPOIB_MAX_MCAST_QUEUE = 3,
  67. IPOIB_FLAG_OPER_UP = 0,
  68. IPOIB_FLAG_INITIALIZED = 1,
  69. IPOIB_FLAG_ADMIN_UP = 2,
  70. IPOIB_PKEY_ASSIGNED = 3,
  71. IPOIB_PKEY_STOP = 4,
  72. IPOIB_FLAG_SUBINTERFACE = 5,
  73. IPOIB_MCAST_RUN = 6,
  74. IPOIB_STOP_REAPER = 7,
  75. IPOIB_MCAST_STARTED = 8,
  76. IPOIB_FLAG_NETIF_STOPPED = 9,
  77. IPOIB_FLAG_ADMIN_CM = 10,
  78. IPOIB_MAX_BACKOFF_SECONDS = 16,
  79. IPOIB_MCAST_FLAG_FOUND = 0, /* used in set_multicast_list */
  80. IPOIB_MCAST_FLAG_SENDONLY = 1,
  81. IPOIB_MCAST_FLAG_BUSY = 2, /* joining or already joined */
  82. IPOIB_MCAST_FLAG_ATTACHED = 3,
  83. };
  84. #define IPOIB_OP_RECV (1ul << 31)
  85. #ifdef CONFIG_INFINIBAND_IPOIB_CM
  86. #define IPOIB_CM_OP_SRQ (1ul << 30)
  87. #else
  88. #define IPOIB_CM_OP_SRQ (0)
  89. #endif
  90. /* structs */
  91. struct ipoib_header {
  92. __be16 proto;
  93. u16 reserved;
  94. };
  95. struct ipoib_pseudoheader {
  96. u8 hwaddr[INFINIBAND_ALEN];
  97. };
  98. struct ipoib_mcast;
  99. struct ipoib_rx_buf {
  100. struct sk_buff *skb;
  101. u64 mapping;
  102. };
  103. struct ipoib_tx_buf {
  104. struct sk_buff *skb;
  105. u64 mapping;
  106. };
  107. struct ib_cm_id;
  108. struct ipoib_cm_data {
  109. __be32 qpn; /* High byte MUST be ignored on receive */
  110. __be32 mtu;
  111. };
  112. struct ipoib_cm_rx {
  113. struct ib_cm_id *id;
  114. struct ib_qp *qp;
  115. struct list_head list;
  116. struct net_device *dev;
  117. unsigned long jiffies;
  118. };
  119. struct ipoib_cm_tx {
  120. struct ib_cm_id *id;
  121. struct ib_cq *cq;
  122. struct ib_qp *qp;
  123. struct list_head list;
  124. struct net_device *dev;
  125. struct ipoib_neigh *neigh;
  126. struct ipoib_path *path;
  127. struct ipoib_tx_buf *tx_ring;
  128. unsigned tx_head;
  129. unsigned tx_tail;
  130. unsigned long flags;
  131. u32 mtu;
  132. struct ib_wc ibwc[IPOIB_NUM_WC];
  133. };
  134. struct ipoib_cm_rx_buf {
  135. struct sk_buff *skb;
  136. u64 mapping[IPOIB_CM_RX_SG];
  137. };
  138. struct ipoib_cm_dev_priv {
  139. struct ib_srq *srq;
  140. struct ipoib_cm_rx_buf *srq_ring;
  141. struct ib_cm_id *id;
  142. struct list_head passive_ids;
  143. struct work_struct start_task;
  144. struct work_struct reap_task;
  145. struct work_struct skb_task;
  146. struct delayed_work stale_task;
  147. struct sk_buff_head skb_queue;
  148. struct list_head start_list;
  149. struct list_head reap_list;
  150. struct ib_wc ibwc[IPOIB_NUM_WC];
  151. struct ib_sge rx_sge[IPOIB_CM_RX_SG];
  152. struct ib_recv_wr rx_wr;
  153. };
  154. /*
  155. * Device private locking: tx_lock protects members used in TX fast
  156. * path (and we use LLTX so upper layers don't do extra locking).
  157. * lock protects everything else. lock nests inside of tx_lock (ie
  158. * tx_lock must be acquired first if needed).
  159. */
  160. struct ipoib_dev_priv {
  161. spinlock_t lock;
  162. struct net_device *dev;
  163. unsigned long flags;
  164. struct mutex mcast_mutex;
  165. struct mutex vlan_mutex;
  166. struct rb_root path_tree;
  167. struct list_head path_list;
  168. struct ipoib_mcast *broadcast;
  169. struct list_head multicast_list;
  170. struct rb_root multicast_tree;
  171. struct delayed_work pkey_task;
  172. struct delayed_work mcast_task;
  173. struct work_struct flush_task;
  174. struct work_struct restart_task;
  175. struct delayed_work ah_reap_task;
  176. struct ib_device *ca;
  177. u8 port;
  178. u16 pkey;
  179. struct ib_pd *pd;
  180. struct ib_mr *mr;
  181. struct ib_cq *cq;
  182. struct ib_qp *qp;
  183. u32 qkey;
  184. union ib_gid local_gid;
  185. u16 local_lid;
  186. u8 local_rate;
  187. unsigned int admin_mtu;
  188. unsigned int mcast_mtu;
  189. struct ipoib_rx_buf *rx_ring;
  190. spinlock_t tx_lock;
  191. struct ipoib_tx_buf *tx_ring;
  192. unsigned tx_head;
  193. unsigned tx_tail;
  194. struct ib_sge tx_sge;
  195. struct ib_send_wr tx_wr;
  196. struct ib_wc ibwc[IPOIB_NUM_WC];
  197. struct list_head dead_ahs;
  198. struct ib_event_handler event_handler;
  199. struct net_device_stats stats;
  200. struct net_device *parent;
  201. struct list_head child_intfs;
  202. struct list_head list;
  203. #ifdef CONFIG_INFINIBAND_IPOIB_CM
  204. struct ipoib_cm_dev_priv cm;
  205. #endif
  206. #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
  207. struct list_head fs_list;
  208. struct dentry *mcg_dentry;
  209. struct dentry *path_dentry;
  210. #endif
  211. };
  212. struct ipoib_ah {
  213. struct net_device *dev;
  214. struct ib_ah *ah;
  215. struct list_head list;
  216. struct kref ref;
  217. unsigned last_send;
  218. };
  219. struct ipoib_path {
  220. struct net_device *dev;
  221. struct ib_sa_path_rec pathrec;
  222. struct ipoib_ah *ah;
  223. struct sk_buff_head queue;
  224. struct list_head neigh_list;
  225. int query_id;
  226. struct ib_sa_query *query;
  227. struct completion done;
  228. struct rb_node rb_node;
  229. struct list_head list;
  230. };
  231. struct ipoib_neigh {
  232. struct ipoib_ah *ah;
  233. #ifdef CONFIG_INFINIBAND_IPOIB_CM
  234. struct ipoib_cm_tx *cm;
  235. #endif
  236. union ib_gid dgid;
  237. struct sk_buff_head queue;
  238. struct neighbour *neighbour;
  239. struct list_head list;
  240. };
  241. /*
  242. * We stash a pointer to our private neighbour information after our
  243. * hardware address in neigh->ha. The ALIGN() expression here makes
  244. * sure that this pointer is stored aligned so that an unaligned
  245. * load is not needed to dereference it.
  246. */
  247. static inline struct ipoib_neigh **to_ipoib_neigh(struct neighbour *neigh)
  248. {
  249. return (void*) neigh + ALIGN(offsetof(struct neighbour, ha) +
  250. INFINIBAND_ALEN, sizeof(void *));
  251. }
  252. struct ipoib_neigh *ipoib_neigh_alloc(struct neighbour *neigh);
  253. void ipoib_neigh_free(struct net_device *dev, struct ipoib_neigh *neigh);
  254. extern struct workqueue_struct *ipoib_workqueue;
  255. /* functions */
  256. void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr);
  257. struct ipoib_ah *ipoib_create_ah(struct net_device *dev,
  258. struct ib_pd *pd, struct ib_ah_attr *attr);
  259. void ipoib_free_ah(struct kref *kref);
  260. static inline void ipoib_put_ah(struct ipoib_ah *ah)
  261. {
  262. kref_put(&ah->ref, ipoib_free_ah);
  263. }
  264. int ipoib_open(struct net_device *dev);
  265. int ipoib_add_pkey_attr(struct net_device *dev);
  266. void ipoib_send(struct net_device *dev, struct sk_buff *skb,
  267. struct ipoib_ah *address, u32 qpn);
  268. void ipoib_reap_ah(struct work_struct *work);
  269. void ipoib_flush_paths(struct net_device *dev);
  270. struct ipoib_dev_priv *ipoib_intf_alloc(const char *format);
  271. int ipoib_ib_dev_init(struct net_device *dev, struct ib_device *ca, int port);
  272. void ipoib_ib_dev_flush(struct work_struct *work);
  273. void ipoib_ib_dev_cleanup(struct net_device *dev);
  274. int ipoib_ib_dev_open(struct net_device *dev);
  275. int ipoib_ib_dev_up(struct net_device *dev);
  276. int ipoib_ib_dev_down(struct net_device *dev, int flush);
  277. int ipoib_ib_dev_stop(struct net_device *dev);
  278. int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port);
  279. void ipoib_dev_cleanup(struct net_device *dev);
  280. void ipoib_mcast_join_task(struct work_struct *work);
  281. void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb);
  282. void ipoib_mcast_restart_task(struct work_struct *work);
  283. int ipoib_mcast_start_thread(struct net_device *dev);
  284. int ipoib_mcast_stop_thread(struct net_device *dev, int flush);
  285. void ipoib_mcast_dev_down(struct net_device *dev);
  286. void ipoib_mcast_dev_flush(struct net_device *dev);
  287. #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
  288. struct ipoib_mcast_iter *ipoib_mcast_iter_init(struct net_device *dev);
  289. int ipoib_mcast_iter_next(struct ipoib_mcast_iter *iter);
  290. void ipoib_mcast_iter_read(struct ipoib_mcast_iter *iter,
  291. union ib_gid *gid,
  292. unsigned long *created,
  293. unsigned int *queuelen,
  294. unsigned int *complete,
  295. unsigned int *send_only);
  296. struct ipoib_path_iter *ipoib_path_iter_init(struct net_device *dev);
  297. int ipoib_path_iter_next(struct ipoib_path_iter *iter);
  298. void ipoib_path_iter_read(struct ipoib_path_iter *iter,
  299. struct ipoib_path *path);
  300. #endif
  301. int ipoib_mcast_attach(struct net_device *dev, u16 mlid,
  302. union ib_gid *mgid);
  303. int ipoib_mcast_detach(struct net_device *dev, u16 mlid,
  304. union ib_gid *mgid);
  305. int ipoib_init_qp(struct net_device *dev);
  306. int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca);
  307. void ipoib_transport_dev_cleanup(struct net_device *dev);
  308. void ipoib_event(struct ib_event_handler *handler,
  309. struct ib_event *record);
  310. int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey);
  311. int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey);
  312. void ipoib_pkey_poll(struct work_struct *work);
  313. int ipoib_pkey_dev_delay_open(struct net_device *dev);
  314. #ifdef CONFIG_INFINIBAND_IPOIB_CM
  315. #define IPOIB_FLAGS_RC 0x80
  316. #define IPOIB_FLAGS_UC 0x40
  317. /* We don't support UC connections at the moment */
  318. #define IPOIB_CM_SUPPORTED(ha) (ha[0] & (IPOIB_FLAGS_RC))
  319. static inline int ipoib_cm_admin_enabled(struct net_device *dev)
  320. {
  321. struct ipoib_dev_priv *priv = netdev_priv(dev);
  322. return IPOIB_CM_SUPPORTED(dev->dev_addr) &&
  323. test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
  324. }
  325. static inline int ipoib_cm_enabled(struct net_device *dev, struct neighbour *n)
  326. {
  327. struct ipoib_dev_priv *priv = netdev_priv(dev);
  328. return IPOIB_CM_SUPPORTED(n->ha) &&
  329. test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
  330. }
  331. static inline int ipoib_cm_up(struct ipoib_neigh *neigh)
  332. {
  333. return test_bit(IPOIB_FLAG_OPER_UP, &neigh->cm->flags);
  334. }
  335. static inline struct ipoib_cm_tx *ipoib_cm_get(struct ipoib_neigh *neigh)
  336. {
  337. return neigh->cm;
  338. }
  339. static inline void ipoib_cm_set(struct ipoib_neigh *neigh, struct ipoib_cm_tx *tx)
  340. {
  341. neigh->cm = tx;
  342. }
  343. void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_tx *tx);
  344. int ipoib_cm_dev_open(struct net_device *dev);
  345. void ipoib_cm_dev_stop(struct net_device *dev);
  346. int ipoib_cm_dev_init(struct net_device *dev);
  347. int ipoib_cm_add_mode_attr(struct net_device *dev);
  348. void ipoib_cm_dev_cleanup(struct net_device *dev);
  349. struct ipoib_cm_tx *ipoib_cm_create_tx(struct net_device *dev, struct ipoib_path *path,
  350. struct ipoib_neigh *neigh);
  351. void ipoib_cm_destroy_tx(struct ipoib_cm_tx *tx);
  352. void ipoib_cm_skb_too_long(struct net_device* dev, struct sk_buff *skb,
  353. unsigned int mtu);
  354. void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc);
  355. #else
  356. struct ipoib_cm_tx;
  357. static inline int ipoib_cm_admin_enabled(struct net_device *dev)
  358. {
  359. return 0;
  360. }
  361. static inline int ipoib_cm_enabled(struct net_device *dev, struct neighbour *n)
  362. {
  363. return 0;
  364. }
  365. static inline int ipoib_cm_up(struct ipoib_neigh *neigh)
  366. {
  367. return 0;
  368. }
  369. static inline struct ipoib_cm_tx *ipoib_cm_get(struct ipoib_neigh *neigh)
  370. {
  371. return NULL;
  372. }
  373. static inline void ipoib_cm_set(struct ipoib_neigh *neigh, struct ipoib_cm_tx *tx)
  374. {
  375. }
  376. static inline
  377. void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_tx *tx)
  378. {
  379. return;
  380. }
  381. static inline
  382. int ipoib_cm_dev_open(struct net_device *dev)
  383. {
  384. return 0;
  385. }
  386. static inline
  387. void ipoib_cm_dev_stop(struct net_device *dev)
  388. {
  389. return;
  390. }
  391. static inline
  392. int ipoib_cm_dev_init(struct net_device *dev)
  393. {
  394. return -ENOSYS;
  395. }
  396. static inline
  397. void ipoib_cm_dev_cleanup(struct net_device *dev)
  398. {
  399. return;
  400. }
  401. static inline
  402. struct ipoib_cm_tx *ipoib_cm_create_tx(struct net_device *dev, struct ipoib_path *path,
  403. struct ipoib_neigh *neigh)
  404. {
  405. return NULL;
  406. }
  407. static inline
  408. void ipoib_cm_destroy_tx(struct ipoib_cm_tx *tx)
  409. {
  410. return;
  411. }
  412. static inline
  413. int ipoib_cm_add_mode_attr(struct net_device *dev)
  414. {
  415. return 0;
  416. }
  417. static inline void ipoib_cm_skb_too_long(struct net_device* dev, struct sk_buff *skb,
  418. unsigned int mtu)
  419. {
  420. dev_kfree_skb_any(skb);
  421. }
  422. static inline void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
  423. {
  424. }
  425. #endif
  426. #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
  427. void ipoib_create_debug_files(struct net_device *dev);
  428. void ipoib_delete_debug_files(struct net_device *dev);
  429. int ipoib_register_debugfs(void);
  430. void ipoib_unregister_debugfs(void);
  431. #else
  432. static inline void ipoib_create_debug_files(struct net_device *dev) { }
  433. static inline void ipoib_delete_debug_files(struct net_device *dev) { }
  434. static inline int ipoib_register_debugfs(void) { return 0; }
  435. static inline void ipoib_unregister_debugfs(void) { }
  436. #endif
  437. #define ipoib_printk(level, priv, format, arg...) \
  438. printk(level "%s: " format, ((struct ipoib_dev_priv *) priv)->dev->name , ## arg)
  439. #define ipoib_warn(priv, format, arg...) \
  440. ipoib_printk(KERN_WARNING, priv, format , ## arg)
  441. extern int ipoib_sendq_size;
  442. extern int ipoib_recvq_size;
  443. extern struct ib_sa_client ipoib_sa_client;
  444. #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
  445. extern int ipoib_debug_level;
  446. #define ipoib_dbg(priv, format, arg...) \
  447. do { \
  448. if (ipoib_debug_level > 0) \
  449. ipoib_printk(KERN_DEBUG, priv, format , ## arg); \
  450. } while (0)
  451. #define ipoib_dbg_mcast(priv, format, arg...) \
  452. do { \
  453. if (mcast_debug_level > 0) \
  454. ipoib_printk(KERN_DEBUG, priv, format , ## arg); \
  455. } while (0)
  456. #else /* CONFIG_INFINIBAND_IPOIB_DEBUG */
  457. #define ipoib_dbg(priv, format, arg...) \
  458. do { (void) (priv); } while (0)
  459. #define ipoib_dbg_mcast(priv, format, arg...) \
  460. do { (void) (priv); } while (0)
  461. #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG */
  462. #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG_DATA
  463. #define ipoib_dbg_data(priv, format, arg...) \
  464. do { \
  465. if (data_debug_level > 0) \
  466. ipoib_printk(KERN_DEBUG, priv, format , ## arg); \
  467. } while (0)
  468. #else /* CONFIG_INFINIBAND_IPOIB_DEBUG_DATA */
  469. #define ipoib_dbg_data(priv, format, arg...) \
  470. do { (void) (priv); } while (0)
  471. #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG_DATA */
  472. #define IPOIB_GID_FMT "%2.2x%2.2x:%2.2x%2.2x:%2.2x%2.2x:%2.2x%2.2x:" \
  473. "%2.2x%2.2x:%2.2x%2.2x:%2.2x%2.2x:%2.2x%2.2x"
  474. #define IPOIB_GID_RAW_ARG(gid) ((u8 *)(gid))[0], \
  475. ((u8 *)(gid))[1], \
  476. ((u8 *)(gid))[2], \
  477. ((u8 *)(gid))[3], \
  478. ((u8 *)(gid))[4], \
  479. ((u8 *)(gid))[5], \
  480. ((u8 *)(gid))[6], \
  481. ((u8 *)(gid))[7], \
  482. ((u8 *)(gid))[8], \
  483. ((u8 *)(gid))[9], \
  484. ((u8 *)(gid))[10],\
  485. ((u8 *)(gid))[11],\
  486. ((u8 *)(gid))[12],\
  487. ((u8 *)(gid))[13],\
  488. ((u8 *)(gid))[14],\
  489. ((u8 *)(gid))[15]
  490. #define IPOIB_GID_ARG(gid) IPOIB_GID_RAW_ARG((gid).raw)
  491. #define IPOIB_QPN(ha) (be32_to_cpup((__be32 *) ha) & 0xffffff)
  492. #endif /* _IPOIB_H */