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.
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:
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
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.
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
39 #include "opt_inet6.h"
42 #include <sys/param.h>
43 #include <sys/systm.h>
44 #include <sys/kernel.h>
46 #include <sys/malloc.h>
48 #include <sys/random.h>
49 #include <sys/rwlock.h>
50 #include <sys/socket.h>
51 #include <sys/sockio.h>
52 #include <sys/sysctl.h>
55 #include <net/if_arp.h>
56 #include <net/netisr.h>
57 #include <net/route.h>
58 #include <net/if_llc.h>
59 #include <net/if_dl.h>
60 #include <net/if_types.h>
62 #include <net/if_llatbl.h>
65 #if defined(INET) || defined(INET6)
66 #include <netinet/in.h>
67 #include <netinet/in_var.h>
68 #include <netinet/if_ether.h>
69 #include <netinet/ip_var.h>
72 #include <netinet6/nd6.h>
75 #include <security/mac/mac_framework.h>
77 #include <linux/list.h>
79 #include <linux/workqueue.h>
80 #include <linux/kref.h>
81 #include <linux/mutex.h>
83 #include <asm/atomic.h>
85 #include <rdma/ib_verbs.h>
86 #include <rdma/ib_pack.h>
87 #include <rdma/ib_sa.h>
91 #define INFINIBAND_ALEN 20 /* Octets in IPoIB HW addr */
94 #define CONFIG_INFINIBAND_IPOIB_CM
98 #define CONFIG_INFINIBAND_IPOIB_DEBUG
99 #define CONFIG_INFINIBAND_IPOIB_DEBUG_DATA
102 enum ipoib_flush_level {
110 IPOIB_HEADER_LEN = IPOIB_ENCAP_LEN + INFINIBAND_ALEN,
111 IPOIB_UD_MAX_MTU = 4 * 1024,
112 // IPOIB_UD_RX_SG = (IPOIB_UD_MAX_MTU / MJUMPAGESIZE),
114 IPOIB_UD_TX_SG = (IPOIB_UD_MAX_MTU / MCLBYTES) + 2,
115 IPOIB_CM_MAX_MTU = (64 * 1024),
116 IPOIB_CM_TX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2,
117 IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MJUMPAGESIZE),
118 IPOIB_RX_RING_SIZE = 256,
119 IPOIB_TX_RING_SIZE = 128,
120 IPOIB_MAX_RX_SG = MAX(IPOIB_CM_RX_SG, IPOIB_UD_RX_SG),
121 IPOIB_MAX_TX_SG = MAX(IPOIB_CM_TX_SG, IPOIB_UD_TX_SG),
122 IPOIB_MAX_QUEUE_SIZE = 8192,
123 IPOIB_MIN_QUEUE_SIZE = 2,
124 IPOIB_CM_MAX_CONN_QP = 4096,
128 IPOIB_MAX_PATH_REC_QUEUE = 3,
129 IPOIB_MAX_MCAST_QUEUE = 3,
131 IPOIB_FLAG_OPER_UP = 0,
132 IPOIB_FLAG_INITIALIZED = 1,
133 IPOIB_FLAG_ADMIN_UP = 2,
134 IPOIB_PKEY_ASSIGNED = 3,
136 IPOIB_FLAG_SUBINTERFACE = 5,
138 IPOIB_STOP_REAPER = 7,
139 IPOIB_FLAG_UMCAST = 10,
140 IPOIB_FLAG_CSUM = 11,
142 IPOIB_MAX_BACKOFF_SECONDS = 16,
144 IPOIB_MCAST_FLAG_FOUND = 0, /* used in set_multicast_list */
145 IPOIB_MCAST_FLAG_SENDONLY = 1,
146 IPOIB_MCAST_FLAG_BUSY = 2, /* joining or already joined */
147 IPOIB_MCAST_FLAG_ATTACHED = 3,
149 IPOIB_MAX_LRO_DESCRIPTORS = 8,
150 IPOIB_LRO_MAX_AGGR = 64,
153 IPOIB_CM_COPYBREAK = 256,
156 #define IPOIB_OP_RECV (1ul << 31)
157 #ifdef CONFIG_INFINIBAND_IPOIB_CM
158 #define IPOIB_OP_CM (1ul << 30)
160 #define IPOIB_OP_CM (0)
165 struct ipoib_header {
166 u8 hwaddr[INFINIBAND_ALEN];
171 struct ipoib_pseudoheader {
172 u8 hwaddr[INFINIBAND_ALEN];
175 /* Used for all multicast joins (broadcast, IPv4 mcast and IPv6 mcast) */
177 struct ib_sa_mcmember_rec mcmember;
178 struct ib_sa_multicast *mc;
181 struct rb_node rb_node;
182 struct list_head list;
184 unsigned long created;
185 unsigned long backoff;
188 unsigned char logcount;
190 struct ifqueue pkt_queue;
192 struct ipoib_dev_priv *priv;
195 struct ipoib_cm_rx_buf {
197 u64 mapping[IPOIB_CM_RX_SG];
200 struct ipoib_cm_tx_buf {
202 u64 mapping[IPOIB_CM_TX_SG];
205 struct ipoib_rx_buf {
207 u64 mapping[IPOIB_UD_RX_SG];
210 struct ipoib_tx_buf {
212 u64 mapping[IPOIB_UD_TX_SG];
217 struct ipoib_cm_data {
218 __be32 qpn; /* High byte MUST be ignored on receive */
223 * Quoting 10.3.1 Queue Pair and EE Context States:
225 * Note, for QPs that are associated with an SRQ, the Consumer should take the
226 * QP through the Error State before invoking a Destroy QP or a Modify QP to the
227 * Reset State. The Consumer may invoke the Destroy QP without first performing
228 * a Modify QP to the Error State and waiting for the Affiliated Asynchronous
229 * Last WQE Reached Event. However, if the Consumer does not wait for the
230 * Affiliated Asynchronous Last WQE Reached Event, then WQE and Data Segment
231 * leakage may occur. Therefore, it is good programming practice to tear down a
232 * QP that is associated with an SRQ by using the following process:
234 * - Put the QP in the Error State
235 * - Wait for the Affiliated Asynchronous Last WQE Reached Event;
237 * drain the CQ by invoking the Poll CQ verb and either wait for CQ
238 * to be empty or the number of Poll CQ operations has exceeded
241 * post another WR that completes on the same CQ and wait for this
242 * WR to return as a WC;
243 * - and then invoke a Destroy QP or Reset QP.
245 * We use the second option and wait for a completion on the
246 * same CQ before destroying QPs attached to our SRQ.
249 enum ipoib_cm_state {
251 IPOIB_CM_RX_ERROR, /* Ignored by stale task */
252 IPOIB_CM_RX_FLUSH /* Last WQE Reached event observed */
258 struct ipoib_cm_rx_buf *rx_ring;
259 struct list_head list;
260 struct ipoib_dev_priv *priv;
261 unsigned long jiffies;
262 enum ipoib_cm_state state;
269 struct list_head list;
270 struct ipoib_dev_priv *priv;
271 struct ipoib_path *path;
272 struct ipoib_cm_tx_buf *tx_ring;
276 u32 mtu; /* remote specified mtu, with grh. */
279 struct ipoib_cm_dev_priv {
281 struct ipoib_cm_rx_buf *srq_ring;
283 struct list_head passive_ids; /* state: LIVE */
284 struct list_head rx_error_list; /* state: ERROR */
285 struct list_head rx_flush_list; /* state: FLUSH, drain not started */
286 struct list_head rx_drain_list; /* state: FLUSH, drain started */
287 struct list_head rx_reap_list; /* state: FLUSH, drain done */
288 struct work_struct start_task;
289 struct work_struct reap_task;
290 struct work_struct mb_task;
291 struct work_struct rx_reap_task;
292 struct delayed_work stale_task;
293 struct ifqueue mb_queue;
294 struct list_head start_list;
295 struct list_head reap_list;
296 struct ib_sge rx_sge[IPOIB_CM_RX_SG];
297 struct ib_recv_wr rx_wr;
299 int max_cm_mtu; /* Actual buf size. */
303 struct ipoib_ethtool_st {
305 u16 max_coalesced_frames;
309 * Device private locking: network stack tx_lock protects members used
310 * in TX fast path, lock protects everything else. lock nests inside
311 * of tx_lock (ie tx_lock must be acquired first if needed).
313 struct ipoib_dev_priv {
318 u8 broadcastaddr[INFINIBAND_ALEN];
322 struct mutex vlan_mutex;
324 struct rb_root path_tree;
325 struct list_head path_list;
327 struct ipoib_mcast *broadcast;
328 struct list_head multicast_list;
329 struct rb_root multicast_tree;
331 struct delayed_work pkey_poll_task;
332 struct delayed_work mcast_task;
333 struct work_struct carrier_on_task;
334 struct work_struct flush_light;
335 struct work_struct flush_normal;
336 struct work_struct flush_heavy;
337 struct work_struct restart_task;
338 struct delayed_work ah_reap_task;
340 struct ib_device *ca;
346 struct ib_cq *recv_cq;
347 struct ib_cq *send_cq;
351 union ib_gid local_gid;
354 unsigned int admin_mtu; /* User selected MTU, no GRH. */
355 unsigned int mcast_mtu; /* Minus GRH bytes, from mcast group. */
356 unsigned int max_ib_mtu; /* Without header, actual buf size. */
358 struct ipoib_rx_buf *rx_ring;
360 struct ipoib_tx_buf *tx_ring;
363 struct ib_sge tx_sge[IPOIB_MAX_TX_SG];
364 struct ib_send_wr tx_wr;
365 unsigned tx_outstanding;
366 struct ib_wc send_wc[MAX_SEND_CQE];
368 struct ib_recv_wr rx_wr;
369 struct ib_sge rx_sge[IPOIB_MAX_RX_SG];
371 struct ib_wc ibwc[IPOIB_NUM_WC];
373 struct list_head dead_ahs;
375 struct ib_event_handler event_handler;
377 struct ifnet *parent;
378 struct list_head child_intfs;
379 struct list_head list;
381 #ifdef CONFIG_INFINIBAND_IPOIB_CM
382 struct ipoib_cm_dev_priv cm;
385 #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
386 struct list_head fs_list;
387 struct dentry *mcg_dentry;
388 struct dentry *path_dentry;
391 struct ipoib_ethtool_st ethtool;
392 struct timer_list poll_timer;
396 struct ipoib_dev_priv *priv;
398 struct list_head list;
404 struct ipoib_dev_priv *priv;
405 struct rb_node rb_node;
406 struct list_head list;
407 #ifdef CONFIG_INFINIBAND_IPOIB_CM
408 uint8_t hwaddr[INFINIBAND_ALEN];
409 struct ipoib_cm_tx *cm;
412 struct ib_sa_path_rec pathrec;
413 struct ifqueue queue;
416 struct ib_sa_query *query;
417 struct completion done;
422 /* UD Only transmits encap len but we want the two sizes to be symmetrical. */
423 #define IPOIB_UD_MTU(ib_mtu) (ib_mtu - IPOIB_ENCAP_LEN)
424 #define IPOIB_CM_MTU(ib_mtu) (ib_mtu - 0x10)
426 #define IPOIB_IS_MULTICAST(addr) ((addr)[4] == 0xff)
428 extern struct workqueue_struct *ipoib_workqueue;
430 #define IPOIB_MTAP_PROTO(_ifp, _m, _proto) \
432 if (bpf_peers_present((_ifp)->if_bpf)) { \
434 ipoib_mtap_proto((_ifp), (_m), (_proto)); \
439 void ipoib_mtap_proto(struct ifnet *ifp, struct mbuf *mb, uint16_t proto);
440 void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr);
441 void ipoib_send_comp_handler(struct ib_cq *cq, void *dev_ptr);
443 struct ipoib_ah *ipoib_create_ah(struct ipoib_dev_priv *,
444 struct ib_pd *pd, struct ib_ah_attr *attr);
445 void ipoib_free_ah(struct kref *kref);
446 static inline void ipoib_put_ah(struct ipoib_ah *ah)
448 kref_put(&ah->ref, ipoib_free_ah);
451 int ipoib_open(struct ipoib_dev_priv *priv);
452 int ipoib_add_pkey_attr(struct ipoib_dev_priv *priv);
453 int ipoib_add_umcast_attr(struct ipoib_dev_priv *priv);
455 void ipoib_demux(struct ifnet *ifp, struct mbuf *m, u_short proto);
457 void ipoib_send(struct ipoib_dev_priv *priv, struct mbuf *mb,
458 struct ipoib_ah *address, u32 qpn);
459 void ipoib_reap_ah(struct work_struct *work);
461 void ipoib_mark_paths_invalid(struct ipoib_dev_priv *priv);
462 void ipoib_flush_paths(struct ipoib_dev_priv *priv);
463 struct ipoib_dev_priv *ipoib_intf_alloc(const char *format);
465 int ipoib_ib_dev_init(struct ipoib_dev_priv *priv, struct ib_device *ca,
467 void ipoib_ib_dev_flush_light(struct work_struct *work);
468 void ipoib_ib_dev_flush_normal(struct work_struct *work);
469 void ipoib_ib_dev_flush_heavy(struct work_struct *work);
470 void ipoib_pkey_event(struct work_struct *work);
471 void ipoib_ib_dev_cleanup(struct ipoib_dev_priv *priv);
473 int ipoib_ib_dev_open(struct ipoib_dev_priv *priv);
474 int ipoib_ib_dev_up(struct ipoib_dev_priv *priv);
475 int ipoib_ib_dev_down(struct ipoib_dev_priv *priv, int flush);
476 int ipoib_ib_dev_stop(struct ipoib_dev_priv *priv, int flush);
478 int ipoib_dev_init(struct ipoib_dev_priv *priv, struct ib_device *ca, int port);
479 void ipoib_dev_cleanup(struct ipoib_dev_priv *priv);
481 void ipoib_mcast_join_task(struct work_struct *work);
482 void ipoib_mcast_carrier_on_task(struct work_struct *work);
483 void ipoib_mcast_send(struct ipoib_dev_priv *priv, void *mgid, struct mbuf *mb);
485 void ipoib_mcast_restart_task(struct work_struct *work);
486 void ipoib_mcast_restart(struct ipoib_dev_priv *);
487 int ipoib_mcast_start_thread(struct ipoib_dev_priv *priv);
488 int ipoib_mcast_stop_thread(struct ipoib_dev_priv *priv, int flush);
490 void ipoib_mcast_dev_down(struct ipoib_dev_priv *priv);
491 void ipoib_mcast_dev_flush(struct ipoib_dev_priv *priv);
493 void ipoib_path_free(struct ipoib_dev_priv *priv, struct ipoib_path *path);
494 #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
495 struct ipoib_mcast_iter *ipoib_mcast_iter_init(struct ipoib_dev_priv *priv);
496 int ipoib_mcast_iter_next(struct ipoib_mcast_iter *iter);
497 void ipoib_mcast_iter_read(struct ipoib_mcast_iter *iter,
499 unsigned long *created,
500 unsigned int *queuelen,
501 unsigned int *complete,
502 unsigned int *send_only);
504 struct ipoib_path_iter *ipoib_path_iter_init(struct ipoib_dev_priv *priv);
505 int ipoib_path_iter_next(struct ipoib_path_iter *iter);
506 void ipoib_path_iter_read(struct ipoib_path_iter *iter,
507 struct ipoib_path *path);
510 int ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_mtu);
512 int ipoib_mcast_attach(struct ipoib_dev_priv *priv, u16 mlid,
513 union ib_gid *mgid, int set_qkey);
515 int ipoib_init_qp(struct ipoib_dev_priv *priv);
516 int ipoib_transport_dev_init(struct ipoib_dev_priv *priv, struct ib_device *ca);
517 void ipoib_transport_dev_cleanup(struct ipoib_dev_priv *priv);
519 void ipoib_event(struct ib_event_handler *handler,
520 struct ib_event *record);
522 void ipoib_pkey_poll(struct work_struct *work);
523 int ipoib_pkey_dev_delay_open(struct ipoib_dev_priv *priv);
524 void ipoib_drain_cq(struct ipoib_dev_priv *priv);
526 int ipoib_dma_map_tx(struct ib_device *ca, struct ipoib_tx_buf *tx_req, int max);
527 void ipoib_dma_unmap_tx(struct ib_device *ca, struct ipoib_tx_buf *tx_req);
528 int ipoib_poll_tx(struct ipoib_dev_priv *priv);
530 void ipoib_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req);
531 void ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length);
532 struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int size);
535 void ipoib_set_ethtool_ops(struct ifnet *dev);
536 int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);
538 #ifdef CONFIG_INFINIBAND_IPOIB_CM
540 #define IPOIB_FLAGS_RC 0x80
541 #define IPOIB_FLAGS_UC 0x40
543 /* We don't support UC connections at the moment */
544 #define IPOIB_CM_SUPPORTED(ha) (ha[0] & (IPOIB_FLAGS_RC))
546 extern int ipoib_max_conn_qp;
548 static inline int ipoib_cm_admin_enabled(struct ipoib_dev_priv *priv)
550 return IPOIB_CM_SUPPORTED(IF_LLADDR(priv->dev));
553 static inline int ipoib_cm_enabled(struct ipoib_dev_priv *priv, uint8_t *hwaddr)
555 return IPOIB_CM_SUPPORTED(hwaddr);
558 static inline int ipoib_cm_up(struct ipoib_path *path)
561 return test_bit(IPOIB_FLAG_OPER_UP, &path->cm->flags);
564 static inline struct ipoib_cm_tx *ipoib_cm_get(struct ipoib_path *path)
569 static inline void ipoib_cm_set(struct ipoib_path *path, struct ipoib_cm_tx *tx)
574 static inline int ipoib_cm_has_srq(struct ipoib_dev_priv *priv)
576 return !!priv->cm.srq;
579 static inline unsigned int ipoib_cm_max_mtu(struct ipoib_dev_priv *priv)
581 return priv->cm.max_cm_mtu;
584 void ipoib_cm_send(struct ipoib_dev_priv *priv, struct mbuf *mb, struct ipoib_cm_tx *tx);
585 int ipoib_cm_dev_open(struct ipoib_dev_priv *priv);
586 void ipoib_cm_dev_stop(struct ipoib_dev_priv *priv);
587 int ipoib_cm_dev_init(struct ipoib_dev_priv *priv);
588 int ipoib_cm_add_mode_attr(struct ipoib_dev_priv *priv);
589 void ipoib_cm_dev_cleanup(struct ipoib_dev_priv *priv);
590 struct ipoib_cm_tx *ipoib_cm_create_tx(struct ipoib_dev_priv *priv,
591 struct ipoib_path *path);
592 void ipoib_cm_destroy_tx(struct ipoib_cm_tx *tx);
593 void ipoib_cm_mb_too_long(struct ipoib_dev_priv *priv, struct mbuf *mb,
595 void ipoib_cm_handle_rx_wc(struct ipoib_dev_priv *priv, struct ib_wc *wc);
596 void ipoib_cm_handle_tx_wc(struct ipoib_dev_priv *priv, struct ib_wc *wc);
601 #define ipoib_max_conn_qp 0
603 static inline int ipoib_cm_admin_enabled(struct ipoib_dev_priv *priv)
607 static inline int ipoib_cm_enabled(struct ipoib_dev_priv *priv, uint8_t *hwaddr)
613 static inline int ipoib_cm_up(struct ipoib_path *path)
619 static inline struct ipoib_cm_tx *ipoib_cm_get(struct ipoib_path *path)
624 static inline void ipoib_cm_set(struct ipoib_path *path, struct ipoib_cm_tx *tx)
628 static inline int ipoib_cm_has_srq(struct ipoib_dev_priv *priv)
633 static inline unsigned int ipoib_cm_max_mtu(struct ipoib_dev_priv *priv)
639 void ipoib_cm_send(struct ipoib_dev_priv *priv, struct mbuf *mb, struct ipoib_cm_tx *tx)
645 int ipoib_cm_dev_open(struct ipoib_dev_priv *priv)
651 void ipoib_cm_dev_stop(struct ipoib_dev_priv *priv)
657 int ipoib_cm_dev_init(struct ipoib_dev_priv *priv)
663 void ipoib_cm_dev_cleanup(struct ipoib_dev_priv *priv)
669 struct ipoib_cm_tx *ipoib_cm_create_tx(struct ipoib_dev_priv *priv, struct ipoib_path *path)
675 void ipoib_cm_destroy_tx(struct ipoib_cm_tx *tx)
681 int ipoib_cm_add_mode_attr(struct ipoib_dev_priv *priv)
686 static inline void ipoib_cm_mb_too_long(struct ipoib_dev_priv *priv, struct mbuf *mb,
692 static inline void ipoib_cm_handle_rx_wc(struct ipoib_dev_priv *priv, struct ib_wc *wc)
696 static inline void ipoib_cm_handle_tx_wc(struct ipoib_dev_priv *priv, struct ib_wc *wc)
701 #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
702 void ipoib_create_debug_files(struct ipoib_dev_priv *priv);
703 void ipoib_delete_debug_files(struct ipoib_dev_priv *priv);
704 int ipoib_register_debugfs(void);
705 void ipoib_unregister_debugfs(void);
707 static inline void ipoib_create_debug_files(struct ipoib_dev_priv *priv) { }
708 static inline void ipoib_delete_debug_files(struct ipoib_dev_priv *priv) { }
709 static inline int ipoib_register_debugfs(void) { return 0; }
710 static inline void ipoib_unregister_debugfs(void) { }
713 #define ipoib_printk(level, priv, format, arg...) \
714 printk(level "%s: " format, if_name(((struct ipoib_dev_priv *) priv)->dev), ## arg)
715 #define ipoib_warn(priv, format, arg...) \
716 ipoib_printk(KERN_WARNING, priv, format , ## arg)
718 extern int ipoib_sendq_size;
719 extern int ipoib_recvq_size;
721 extern struct ib_sa_client ipoib_sa_client;
723 #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
724 extern int ipoib_debug_level;
726 #define ipoib_dbg(priv, format, arg...) \
728 if (ipoib_debug_level > 0) \
729 ipoib_printk(KERN_DEBUG, priv, format , ## arg); \
731 #define ipoib_dbg_mcast(priv, format, arg...) \
733 if (mcast_debug_level > 0) \
734 ipoib_printk(KERN_DEBUG, priv, format , ## arg); \
736 #else /* CONFIG_INFINIBAND_IPOIB_DEBUG */
737 #define ipoib_dbg(priv, format, arg...) \
738 do { (void) (priv); } while (0)
739 #define ipoib_dbg_mcast(priv, format, arg...) \
740 do { (void) (priv); } while (0)
741 #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG */
743 #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG_DATA
744 #define ipoib_dbg_data(priv, format, arg...) \
746 if (data_debug_level > 0) \
747 ipoib_printk(KERN_DEBUG, priv, format , ## arg); \
749 #else /* CONFIG_INFINIBAND_IPOIB_DEBUG_DATA */
750 #define ipoib_dbg_data(priv, format, arg...) \
751 do { (void) (priv); } while (0)
752 #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG_DATA */
754 #define IPOIB_QPN(ha) (be32_to_cpup((__be32 *) ha) & 0xffffff)
756 #endif /* _IPOIB_H */