11da177e4SLinus Torvalds /* 21da177e4SLinus Torvalds * Copyright (c) 2004, 2005 Topspin Communications. All rights reserved. 32a1d9b7fSRoland Dreier * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. 42a1d9b7fSRoland Dreier * Copyright (c) 2004 Voltaire, Inc. All rights reserved. 51da177e4SLinus Torvalds * 61da177e4SLinus Torvalds * This software is available to you under a choice of one of two 71da177e4SLinus Torvalds * licenses. You may choose to be licensed under the terms of the GNU 81da177e4SLinus Torvalds * General Public License (GPL) Version 2, available from the file 91da177e4SLinus Torvalds * COPYING in the main directory of this source tree, or the 101da177e4SLinus Torvalds * OpenIB.org BSD license below: 111da177e4SLinus Torvalds * 121da177e4SLinus Torvalds * Redistribution and use in source and binary forms, with or 131da177e4SLinus Torvalds * without modification, are permitted provided that the following 141da177e4SLinus Torvalds * conditions are met: 151da177e4SLinus Torvalds * 161da177e4SLinus Torvalds * - Redistributions of source code must retain the above 171da177e4SLinus Torvalds * copyright notice, this list of conditions and the following 181da177e4SLinus Torvalds * disclaimer. 191da177e4SLinus Torvalds * 201da177e4SLinus Torvalds * - Redistributions in binary form must reproduce the above 211da177e4SLinus Torvalds * copyright notice, this list of conditions and the following 221da177e4SLinus Torvalds * disclaimer in the documentation and/or other materials 231da177e4SLinus Torvalds * provided with the distribution. 241da177e4SLinus Torvalds * 251da177e4SLinus Torvalds * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 261da177e4SLinus Torvalds * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 271da177e4SLinus Torvalds * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 281da177e4SLinus Torvalds * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 291da177e4SLinus Torvalds * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 301da177e4SLinus Torvalds * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 311da177e4SLinus Torvalds * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 321da177e4SLinus Torvalds * SOFTWARE. 331da177e4SLinus Torvalds * 341da177e4SLinus Torvalds * $Id: ipoib.h 1358 2004-12-17 22:00:11Z roland $ 351da177e4SLinus Torvalds */ 361da177e4SLinus Torvalds 371da177e4SLinus Torvalds #ifndef _IPOIB_H 381da177e4SLinus Torvalds #define _IPOIB_H 391da177e4SLinus Torvalds 401da177e4SLinus Torvalds #include <linux/list.h> 411da177e4SLinus Torvalds #include <linux/skbuff.h> 421da177e4SLinus Torvalds #include <linux/netdevice.h> 431da177e4SLinus Torvalds #include <linux/workqueue.h> 441da177e4SLinus Torvalds #include <linux/pci.h> 451da177e4SLinus Torvalds #include <linux/config.h> 461da177e4SLinus Torvalds #include <linux/kref.h> 471da177e4SLinus Torvalds #include <linux/if_infiniband.h> 4895ed644fSIngo Molnar #include <linux/mutex.h> 491da177e4SLinus Torvalds 501da177e4SLinus Torvalds #include <net/neighbour.h> 511da177e4SLinus Torvalds 521da177e4SLinus Torvalds #include <asm/atomic.h> 531da177e4SLinus Torvalds 54a4d61e84SRoland Dreier #include <rdma/ib_verbs.h> 55a4d61e84SRoland Dreier #include <rdma/ib_pack.h> 56a4d61e84SRoland Dreier #include <rdma/ib_sa.h> 571da177e4SLinus Torvalds 581da177e4SLinus Torvalds /* constants */ 591da177e4SLinus Torvalds 601da177e4SLinus Torvalds enum { 611da177e4SLinus Torvalds IPOIB_PACKET_SIZE = 2048, 621da177e4SLinus Torvalds IPOIB_BUF_SIZE = IPOIB_PACKET_SIZE + IB_GRH_BYTES, 631da177e4SLinus Torvalds 641da177e4SLinus Torvalds IPOIB_ENCAP_LEN = 4, 651da177e4SLinus Torvalds 661da177e4SLinus Torvalds IPOIB_RX_RING_SIZE = 128, 671da177e4SLinus Torvalds IPOIB_TX_RING_SIZE = 64, 681da177e4SLinus Torvalds 691da177e4SLinus Torvalds IPOIB_NUM_WC = 4, 701da177e4SLinus Torvalds 711da177e4SLinus Torvalds IPOIB_MAX_PATH_REC_QUEUE = 3, 721da177e4SLinus Torvalds IPOIB_MAX_MCAST_QUEUE = 3, 731da177e4SLinus Torvalds 741da177e4SLinus Torvalds IPOIB_FLAG_OPER_UP = 0, 757a343d4cSLeonid Arsh IPOIB_FLAG_INITIALIZED = 1, 767a343d4cSLeonid Arsh IPOIB_FLAG_ADMIN_UP = 2, 777a343d4cSLeonid Arsh IPOIB_PKEY_ASSIGNED = 3, 787a343d4cSLeonid Arsh IPOIB_PKEY_STOP = 4, 797a343d4cSLeonid Arsh IPOIB_FLAG_SUBINTERFACE = 5, 807a343d4cSLeonid Arsh IPOIB_MCAST_RUN = 6, 817a343d4cSLeonid Arsh IPOIB_STOP_REAPER = 7, 827a343d4cSLeonid Arsh IPOIB_MCAST_STARTED = 8, 831da177e4SLinus Torvalds 841da177e4SLinus Torvalds IPOIB_MAX_BACKOFF_SECONDS = 16, 851da177e4SLinus Torvalds 861da177e4SLinus Torvalds IPOIB_MCAST_FLAG_FOUND = 0, /* used in set_multicast_list */ 871da177e4SLinus Torvalds IPOIB_MCAST_FLAG_SENDONLY = 1, 881da177e4SLinus Torvalds IPOIB_MCAST_FLAG_BUSY = 2, /* joining or already joined */ 891da177e4SLinus Torvalds IPOIB_MCAST_FLAG_ATTACHED = 3, 901da177e4SLinus Torvalds }; 911da177e4SLinus Torvalds 921da177e4SLinus Torvalds /* structs */ 931da177e4SLinus Torvalds 941da177e4SLinus Torvalds struct ipoib_header { 9597f52eb4SSean Hefty __be16 proto; 961da177e4SLinus Torvalds u16 reserved; 971da177e4SLinus Torvalds }; 981da177e4SLinus Torvalds 991da177e4SLinus Torvalds struct ipoib_pseudoheader { 1001da177e4SLinus Torvalds u8 hwaddr[INFINIBAND_ALEN]; 1011da177e4SLinus Torvalds }; 1021da177e4SLinus Torvalds 1031da177e4SLinus Torvalds struct ipoib_mcast; 1041da177e4SLinus Torvalds 1051993d683SRoland Dreier struct ipoib_rx_buf { 1061993d683SRoland Dreier struct sk_buff *skb; 1071993d683SRoland Dreier dma_addr_t mapping; 1081993d683SRoland Dreier }; 1091993d683SRoland Dreier 1101993d683SRoland Dreier struct ipoib_tx_buf { 1111da177e4SLinus Torvalds struct sk_buff *skb; 1121da177e4SLinus Torvalds DECLARE_PCI_UNMAP_ADDR(mapping) 1131da177e4SLinus Torvalds }; 1141da177e4SLinus Torvalds 1151da177e4SLinus Torvalds /* 1161da177e4SLinus Torvalds * Device private locking: tx_lock protects members used in TX fast 1171da177e4SLinus Torvalds * path (and we use LLTX so upper layers don't do extra locking). 1181da177e4SLinus Torvalds * lock protects everything else. lock nests inside of tx_lock (ie 1191da177e4SLinus Torvalds * tx_lock must be acquired first if needed). 1201da177e4SLinus Torvalds */ 1211da177e4SLinus Torvalds struct ipoib_dev_priv { 1221da177e4SLinus Torvalds spinlock_t lock; 1231da177e4SLinus Torvalds 1241da177e4SLinus Torvalds struct net_device *dev; 1251da177e4SLinus Torvalds 1261da177e4SLinus Torvalds unsigned long flags; 1271da177e4SLinus Torvalds 12895ed644fSIngo Molnar struct mutex mcast_mutex; 12995ed644fSIngo Molnar struct mutex vlan_mutex; 1301da177e4SLinus Torvalds 1311da177e4SLinus Torvalds struct rb_root path_tree; 1321da177e4SLinus Torvalds struct list_head path_list; 1331da177e4SLinus Torvalds 1341da177e4SLinus Torvalds struct ipoib_mcast *broadcast; 1351da177e4SLinus Torvalds struct list_head multicast_list; 1361da177e4SLinus Torvalds struct rb_root multicast_tree; 1371da177e4SLinus Torvalds 1381da177e4SLinus Torvalds struct work_struct pkey_task; 1391da177e4SLinus Torvalds struct work_struct mcast_task; 1401da177e4SLinus Torvalds struct work_struct flush_task; 1411da177e4SLinus Torvalds struct work_struct restart_task; 1421da177e4SLinus Torvalds struct work_struct ah_reap_task; 1431da177e4SLinus Torvalds 1441da177e4SLinus Torvalds struct ib_device *ca; 1451da177e4SLinus Torvalds u8 port; 1461da177e4SLinus Torvalds u16 pkey; 1471da177e4SLinus Torvalds struct ib_pd *pd; 1481da177e4SLinus Torvalds struct ib_mr *mr; 1491da177e4SLinus Torvalds struct ib_cq *cq; 1501da177e4SLinus Torvalds struct ib_qp *qp; 1511da177e4SLinus Torvalds u32 qkey; 1521da177e4SLinus Torvalds 1531da177e4SLinus Torvalds union ib_gid local_gid; 1541da177e4SLinus Torvalds u16 local_lid; 1551da177e4SLinus Torvalds u8 local_rate; 1561da177e4SLinus Torvalds 1571da177e4SLinus Torvalds unsigned int admin_mtu; 1581da177e4SLinus Torvalds unsigned int mcast_mtu; 1591da177e4SLinus Torvalds 1601993d683SRoland Dreier struct ipoib_rx_buf *rx_ring; 1611da177e4SLinus Torvalds 1621da177e4SLinus Torvalds spinlock_t tx_lock; 1631993d683SRoland Dreier struct ipoib_tx_buf *tx_ring; 1641da177e4SLinus Torvalds unsigned tx_head; 1651da177e4SLinus Torvalds unsigned tx_tail; 1661da177e4SLinus Torvalds struct ib_sge tx_sge; 1671da177e4SLinus Torvalds struct ib_send_wr tx_wr; 1681da177e4SLinus Torvalds 1691da177e4SLinus Torvalds struct ib_wc ibwc[IPOIB_NUM_WC]; 1701da177e4SLinus Torvalds 1711da177e4SLinus Torvalds struct list_head dead_ahs; 1721da177e4SLinus Torvalds 1731da177e4SLinus Torvalds struct ib_event_handler event_handler; 1741da177e4SLinus Torvalds 1751da177e4SLinus Torvalds struct net_device_stats stats; 1761da177e4SLinus Torvalds 1771da177e4SLinus Torvalds struct net_device *parent; 1781da177e4SLinus Torvalds struct list_head child_intfs; 1791da177e4SLinus Torvalds struct list_head list; 1801da177e4SLinus Torvalds 1811da177e4SLinus Torvalds #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG 1821da177e4SLinus Torvalds struct list_head fs_list; 1831da177e4SLinus Torvalds struct dentry *mcg_dentry; 1841732b0efSRoland Dreier struct dentry *path_dentry; 1851da177e4SLinus Torvalds #endif 1861da177e4SLinus Torvalds }; 1871da177e4SLinus Torvalds 1881da177e4SLinus Torvalds struct ipoib_ah { 1891da177e4SLinus Torvalds struct net_device *dev; 1901da177e4SLinus Torvalds struct ib_ah *ah; 1911da177e4SLinus Torvalds struct list_head list; 1921da177e4SLinus Torvalds struct kref ref; 1931da177e4SLinus Torvalds unsigned last_send; 1941da177e4SLinus Torvalds }; 1951da177e4SLinus Torvalds 1961da177e4SLinus Torvalds struct ipoib_path { 1971da177e4SLinus Torvalds struct net_device *dev; 1981da177e4SLinus Torvalds struct ib_sa_path_rec pathrec; 1991da177e4SLinus Torvalds struct ipoib_ah *ah; 2001da177e4SLinus Torvalds struct sk_buff_head queue; 2011da177e4SLinus Torvalds 2021da177e4SLinus Torvalds struct list_head neigh_list; 2031da177e4SLinus Torvalds 2041da177e4SLinus Torvalds int query_id; 2051da177e4SLinus Torvalds struct ib_sa_query *query; 2061da177e4SLinus Torvalds struct completion done; 2071da177e4SLinus Torvalds 2081da177e4SLinus Torvalds struct rb_node rb_node; 2091da177e4SLinus Torvalds struct list_head list; 2101da177e4SLinus Torvalds }; 2111da177e4SLinus Torvalds 2121da177e4SLinus Torvalds struct ipoib_neigh { 2131da177e4SLinus Torvalds struct ipoib_ah *ah; 2141da177e4SLinus Torvalds struct sk_buff_head queue; 2151da177e4SLinus Torvalds 2161da177e4SLinus Torvalds struct neighbour *neighbour; 2171da177e4SLinus Torvalds 2181da177e4SLinus Torvalds struct list_head list; 2191da177e4SLinus Torvalds }; 2201da177e4SLinus Torvalds 22144af79f9SMichael S. Tsirkin /* 22244af79f9SMichael S. Tsirkin * We stash a pointer to our private neighbour information after our 22344af79f9SMichael S. Tsirkin * hardware address in neigh->ha. The ALIGN() expression here makes 22444af79f9SMichael S. Tsirkin * sure that this pointer is stored aligned so that an unaligned 22544af79f9SMichael S. Tsirkin * load is not needed to dereference it. 22644af79f9SMichael S. Tsirkin */ 2271da177e4SLinus Torvalds static inline struct ipoib_neigh **to_ipoib_neigh(struct neighbour *neigh) 2281da177e4SLinus Torvalds { 22944af79f9SMichael S. Tsirkin return (void*) neigh + ALIGN(offsetof(struct neighbour, ha) + 23044af79f9SMichael S. Tsirkin INFINIBAND_ALEN, sizeof(void *)); 2311da177e4SLinus Torvalds } 2321da177e4SLinus Torvalds 233*d2e0655eSMichael S. Tsirkin struct ipoib_neigh *ipoib_neigh_alloc(struct neighbour *neigh); 234*d2e0655eSMichael S. Tsirkin void ipoib_neigh_free(struct ipoib_neigh *neigh); 235*d2e0655eSMichael S. Tsirkin 2361da177e4SLinus Torvalds extern struct workqueue_struct *ipoib_workqueue; 2371da177e4SLinus Torvalds 2381da177e4SLinus Torvalds /* functions */ 2391da177e4SLinus Torvalds 2401da177e4SLinus Torvalds void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr); 2411da177e4SLinus Torvalds 2421da177e4SLinus Torvalds struct ipoib_ah *ipoib_create_ah(struct net_device *dev, 2431da177e4SLinus Torvalds struct ib_pd *pd, struct ib_ah_attr *attr); 2441da177e4SLinus Torvalds void ipoib_free_ah(struct kref *kref); 2451da177e4SLinus Torvalds static inline void ipoib_put_ah(struct ipoib_ah *ah) 2461da177e4SLinus Torvalds { 2471da177e4SLinus Torvalds kref_put(&ah->ref, ipoib_free_ah); 2481da177e4SLinus Torvalds } 2491da177e4SLinus Torvalds 2508ae5a8a2SRoland Dreier int ipoib_open(struct net_device *dev); 2511da177e4SLinus Torvalds int ipoib_add_pkey_attr(struct net_device *dev); 2521da177e4SLinus Torvalds 2531da177e4SLinus Torvalds void ipoib_send(struct net_device *dev, struct sk_buff *skb, 2541da177e4SLinus Torvalds struct ipoib_ah *address, u32 qpn); 2551da177e4SLinus Torvalds void ipoib_reap_ah(void *dev_ptr); 2561da177e4SLinus Torvalds 2571da177e4SLinus Torvalds void ipoib_flush_paths(struct net_device *dev); 2581da177e4SLinus Torvalds struct ipoib_dev_priv *ipoib_intf_alloc(const char *format); 2591da177e4SLinus Torvalds 2601da177e4SLinus Torvalds int ipoib_ib_dev_init(struct net_device *dev, struct ib_device *ca, int port); 2611da177e4SLinus Torvalds void ipoib_ib_dev_flush(void *dev); 2621da177e4SLinus Torvalds void ipoib_ib_dev_cleanup(struct net_device *dev); 2631da177e4SLinus Torvalds 2641da177e4SLinus Torvalds int ipoib_ib_dev_open(struct net_device *dev); 2651da177e4SLinus Torvalds int ipoib_ib_dev_up(struct net_device *dev); 2660b3ea082SJack Morgenstein int ipoib_ib_dev_down(struct net_device *dev, int flush); 2671da177e4SLinus Torvalds int ipoib_ib_dev_stop(struct net_device *dev); 2681da177e4SLinus Torvalds 2691da177e4SLinus Torvalds int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port); 2701da177e4SLinus Torvalds void ipoib_dev_cleanup(struct net_device *dev); 2711da177e4SLinus Torvalds 2721da177e4SLinus Torvalds void ipoib_mcast_join_task(void *dev_ptr); 2731da177e4SLinus Torvalds void ipoib_mcast_send(struct net_device *dev, union ib_gid *mgid, 2741da177e4SLinus Torvalds struct sk_buff *skb); 2751da177e4SLinus Torvalds 2761da177e4SLinus Torvalds void ipoib_mcast_restart_task(void *dev_ptr); 2771da177e4SLinus Torvalds int ipoib_mcast_start_thread(struct net_device *dev); 2788d2cae06SRoland Dreier int ipoib_mcast_stop_thread(struct net_device *dev, int flush); 2791da177e4SLinus Torvalds 2801da177e4SLinus Torvalds void ipoib_mcast_dev_down(struct net_device *dev); 2811da177e4SLinus Torvalds void ipoib_mcast_dev_flush(struct net_device *dev); 2821da177e4SLinus Torvalds 2838ae5a8a2SRoland Dreier #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG 2841da177e4SLinus Torvalds struct ipoib_mcast_iter *ipoib_mcast_iter_init(struct net_device *dev); 2851da177e4SLinus Torvalds int ipoib_mcast_iter_next(struct ipoib_mcast_iter *iter); 2861da177e4SLinus Torvalds void ipoib_mcast_iter_read(struct ipoib_mcast_iter *iter, 2871da177e4SLinus Torvalds union ib_gid *gid, 2881da177e4SLinus Torvalds unsigned long *created, 2891da177e4SLinus Torvalds unsigned int *queuelen, 2901da177e4SLinus Torvalds unsigned int *complete, 2911da177e4SLinus Torvalds unsigned int *send_only); 2921732b0efSRoland Dreier 2931732b0efSRoland Dreier struct ipoib_path_iter *ipoib_path_iter_init(struct net_device *dev); 2941732b0efSRoland Dreier int ipoib_path_iter_next(struct ipoib_path_iter *iter); 2951732b0efSRoland Dreier void ipoib_path_iter_read(struct ipoib_path_iter *iter, 2961732b0efSRoland Dreier struct ipoib_path *path); 2978ae5a8a2SRoland Dreier #endif 2981da177e4SLinus Torvalds 2991da177e4SLinus Torvalds int ipoib_mcast_attach(struct net_device *dev, u16 mlid, 3001da177e4SLinus Torvalds union ib_gid *mgid); 3011da177e4SLinus Torvalds int ipoib_mcast_detach(struct net_device *dev, u16 mlid, 3021da177e4SLinus Torvalds union ib_gid *mgid); 3031da177e4SLinus Torvalds 3045b6810e0SRoland Dreier int ipoib_init_qp(struct net_device *dev); 3051da177e4SLinus Torvalds int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca); 3061da177e4SLinus Torvalds void ipoib_transport_dev_cleanup(struct net_device *dev); 3071da177e4SLinus Torvalds 3081da177e4SLinus Torvalds void ipoib_event(struct ib_event_handler *handler, 3091da177e4SLinus Torvalds struct ib_event *record); 3101da177e4SLinus Torvalds 3111da177e4SLinus Torvalds int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey); 3121da177e4SLinus Torvalds int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey); 3131da177e4SLinus Torvalds 3141da177e4SLinus Torvalds void ipoib_pkey_poll(void *dev); 3151da177e4SLinus Torvalds int ipoib_pkey_dev_delay_open(struct net_device *dev); 3161da177e4SLinus Torvalds 3171da177e4SLinus Torvalds #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG 3181732b0efSRoland Dreier void ipoib_create_debug_files(struct net_device *dev); 3191732b0efSRoland Dreier void ipoib_delete_debug_files(struct net_device *dev); 3201da177e4SLinus Torvalds int ipoib_register_debugfs(void); 3211da177e4SLinus Torvalds void ipoib_unregister_debugfs(void); 3221da177e4SLinus Torvalds #else 3231732b0efSRoland Dreier static inline void ipoib_create_debug_files(struct net_device *dev) { } 3241732b0efSRoland Dreier static inline void ipoib_delete_debug_files(struct net_device *dev) { } 3251da177e4SLinus Torvalds static inline int ipoib_register_debugfs(void) { return 0; } 3261da177e4SLinus Torvalds static inline void ipoib_unregister_debugfs(void) { } 3271da177e4SLinus Torvalds #endif 3281da177e4SLinus Torvalds 3291da177e4SLinus Torvalds 3301da177e4SLinus Torvalds #define ipoib_printk(level, priv, format, arg...) \ 3311da177e4SLinus Torvalds printk(level "%s: " format, ((struct ipoib_dev_priv *) priv)->dev->name , ## arg) 3321da177e4SLinus Torvalds #define ipoib_warn(priv, format, arg...) \ 3331da177e4SLinus Torvalds ipoib_printk(KERN_WARNING, priv, format , ## arg) 3341da177e4SLinus Torvalds 3351da177e4SLinus Torvalds 3361da177e4SLinus Torvalds #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG 3371da177e4SLinus Torvalds extern int ipoib_debug_level; 3381da177e4SLinus Torvalds 3391da177e4SLinus Torvalds #define ipoib_dbg(priv, format, arg...) \ 3401da177e4SLinus Torvalds do { \ 3411da177e4SLinus Torvalds if (ipoib_debug_level > 0) \ 3421da177e4SLinus Torvalds ipoib_printk(KERN_DEBUG, priv, format , ## arg); \ 3431da177e4SLinus Torvalds } while (0) 3441da177e4SLinus Torvalds #define ipoib_dbg_mcast(priv, format, arg...) \ 3451da177e4SLinus Torvalds do { \ 3461da177e4SLinus Torvalds if (mcast_debug_level > 0) \ 3471da177e4SLinus Torvalds ipoib_printk(KERN_DEBUG, priv, format , ## arg); \ 3481da177e4SLinus Torvalds } while (0) 3491da177e4SLinus Torvalds #else /* CONFIG_INFINIBAND_IPOIB_DEBUG */ 3501da177e4SLinus Torvalds #define ipoib_dbg(priv, format, arg...) \ 3511da177e4SLinus Torvalds do { (void) (priv); } while (0) 3521da177e4SLinus Torvalds #define ipoib_dbg_mcast(priv, format, arg...) \ 3531da177e4SLinus Torvalds do { (void) (priv); } while (0) 3541da177e4SLinus Torvalds #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG */ 3551da177e4SLinus Torvalds 3561da177e4SLinus Torvalds #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG_DATA 3571da177e4SLinus Torvalds #define ipoib_dbg_data(priv, format, arg...) \ 3581da177e4SLinus Torvalds do { \ 3591da177e4SLinus Torvalds if (data_debug_level > 0) \ 3601da177e4SLinus Torvalds ipoib_printk(KERN_DEBUG, priv, format , ## arg); \ 3611da177e4SLinus Torvalds } while (0) 3621da177e4SLinus Torvalds #else /* CONFIG_INFINIBAND_IPOIB_DEBUG_DATA */ 3631da177e4SLinus Torvalds #define ipoib_dbg_data(priv, format, arg...) \ 3641da177e4SLinus Torvalds do { (void) (priv); } while (0) 3651da177e4SLinus Torvalds #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG_DATA */ 3661da177e4SLinus Torvalds 3671da177e4SLinus Torvalds 3681da177e4SLinus Torvalds #define IPOIB_GID_FMT "%x:%x:%x:%x:%x:%x:%x:%x" 3691da177e4SLinus Torvalds 3701da177e4SLinus Torvalds #define IPOIB_GID_ARG(gid) be16_to_cpup((__be16 *) ((gid).raw + 0)), \ 3711da177e4SLinus Torvalds be16_to_cpup((__be16 *) ((gid).raw + 2)), \ 3721da177e4SLinus Torvalds be16_to_cpup((__be16 *) ((gid).raw + 4)), \ 3731da177e4SLinus Torvalds be16_to_cpup((__be16 *) ((gid).raw + 6)), \ 3741da177e4SLinus Torvalds be16_to_cpup((__be16 *) ((gid).raw + 8)), \ 3751da177e4SLinus Torvalds be16_to_cpup((__be16 *) ((gid).raw + 10)), \ 3761da177e4SLinus Torvalds be16_to_cpup((__be16 *) ((gid).raw + 12)), \ 3771da177e4SLinus Torvalds be16_to_cpup((__be16 *) ((gid).raw + 14)) 3781da177e4SLinus Torvalds 3791da177e4SLinus Torvalds #endif /* _IPOIB_H */ 380