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, 751da177e4SLinus Torvalds IPOIB_FLAG_ADMIN_UP = 1, 761da177e4SLinus Torvalds IPOIB_PKEY_ASSIGNED = 2, 771da177e4SLinus Torvalds IPOIB_PKEY_STOP = 3, 781da177e4SLinus Torvalds IPOIB_FLAG_SUBINTERFACE = 4, 791da177e4SLinus Torvalds IPOIB_MCAST_RUN = 5, 801da177e4SLinus Torvalds IPOIB_STOP_REAPER = 6, 81479a0796SMichael S. Tsirkin IPOIB_MCAST_STARTED = 7, 821da177e4SLinus Torvalds 831da177e4SLinus Torvalds IPOIB_MAX_BACKOFF_SECONDS = 16, 841da177e4SLinus Torvalds 851da177e4SLinus Torvalds IPOIB_MCAST_FLAG_FOUND = 0, /* used in set_multicast_list */ 861da177e4SLinus Torvalds IPOIB_MCAST_FLAG_SENDONLY = 1, 871da177e4SLinus Torvalds IPOIB_MCAST_FLAG_BUSY = 2, /* joining or already joined */ 881da177e4SLinus Torvalds IPOIB_MCAST_FLAG_ATTACHED = 3, 891da177e4SLinus Torvalds }; 901da177e4SLinus Torvalds 911da177e4SLinus Torvalds /* structs */ 921da177e4SLinus Torvalds 931da177e4SLinus Torvalds struct ipoib_header { 9497f52eb4SSean Hefty __be16 proto; 951da177e4SLinus Torvalds u16 reserved; 961da177e4SLinus Torvalds }; 971da177e4SLinus Torvalds 981da177e4SLinus Torvalds struct ipoib_pseudoheader { 991da177e4SLinus Torvalds u8 hwaddr[INFINIBAND_ALEN]; 1001da177e4SLinus Torvalds }; 1011da177e4SLinus Torvalds 1021da177e4SLinus Torvalds struct ipoib_mcast; 1031da177e4SLinus Torvalds 1041993d683SRoland Dreier struct ipoib_rx_buf { 1051993d683SRoland Dreier struct sk_buff *skb; 1061993d683SRoland Dreier dma_addr_t mapping; 1071993d683SRoland Dreier }; 1081993d683SRoland Dreier 1091993d683SRoland Dreier struct ipoib_tx_buf { 1101da177e4SLinus Torvalds struct sk_buff *skb; 1111da177e4SLinus Torvalds DECLARE_PCI_UNMAP_ADDR(mapping) 1121da177e4SLinus Torvalds }; 1131da177e4SLinus Torvalds 1141da177e4SLinus Torvalds /* 1151da177e4SLinus Torvalds * Device private locking: tx_lock protects members used in TX fast 1161da177e4SLinus Torvalds * path (and we use LLTX so upper layers don't do extra locking). 1171da177e4SLinus Torvalds * lock protects everything else. lock nests inside of tx_lock (ie 1181da177e4SLinus Torvalds * tx_lock must be acquired first if needed). 1191da177e4SLinus Torvalds */ 1201da177e4SLinus Torvalds struct ipoib_dev_priv { 1211da177e4SLinus Torvalds spinlock_t lock; 1221da177e4SLinus Torvalds 1231da177e4SLinus Torvalds struct net_device *dev; 1241da177e4SLinus Torvalds 1251da177e4SLinus Torvalds unsigned long flags; 1261da177e4SLinus Torvalds 12795ed644fSIngo Molnar struct mutex mcast_mutex; 12895ed644fSIngo Molnar struct mutex vlan_mutex; 1291da177e4SLinus Torvalds 1301da177e4SLinus Torvalds struct rb_root path_tree; 1311da177e4SLinus Torvalds struct list_head path_list; 1321da177e4SLinus Torvalds 1331da177e4SLinus Torvalds struct ipoib_mcast *broadcast; 1341da177e4SLinus Torvalds struct list_head multicast_list; 1351da177e4SLinus Torvalds struct rb_root multicast_tree; 1361da177e4SLinus Torvalds 1371da177e4SLinus Torvalds struct work_struct pkey_task; 1381da177e4SLinus Torvalds struct work_struct mcast_task; 1391da177e4SLinus Torvalds struct work_struct flush_task; 1401da177e4SLinus Torvalds struct work_struct restart_task; 1411da177e4SLinus Torvalds struct work_struct ah_reap_task; 1421da177e4SLinus Torvalds 1431da177e4SLinus Torvalds struct ib_device *ca; 1441da177e4SLinus Torvalds u8 port; 1451da177e4SLinus Torvalds u16 pkey; 1461da177e4SLinus Torvalds struct ib_pd *pd; 1471da177e4SLinus Torvalds struct ib_mr *mr; 1481da177e4SLinus Torvalds struct ib_cq *cq; 1491da177e4SLinus Torvalds struct ib_qp *qp; 1501da177e4SLinus Torvalds u32 qkey; 1511da177e4SLinus Torvalds 1521da177e4SLinus Torvalds union ib_gid local_gid; 1531da177e4SLinus Torvalds u16 local_lid; 1541da177e4SLinus Torvalds u8 local_rate; 1551da177e4SLinus Torvalds 1561da177e4SLinus Torvalds unsigned int admin_mtu; 1571da177e4SLinus Torvalds unsigned int mcast_mtu; 1581da177e4SLinus Torvalds 1591993d683SRoland Dreier struct ipoib_rx_buf *rx_ring; 1601da177e4SLinus Torvalds 1611da177e4SLinus Torvalds spinlock_t tx_lock; 1621993d683SRoland Dreier struct ipoib_tx_buf *tx_ring; 1631da177e4SLinus Torvalds unsigned tx_head; 1641da177e4SLinus Torvalds unsigned tx_tail; 1651da177e4SLinus Torvalds struct ib_sge tx_sge; 1661da177e4SLinus Torvalds struct ib_send_wr tx_wr; 1671da177e4SLinus Torvalds 1681da177e4SLinus Torvalds struct ib_wc ibwc[IPOIB_NUM_WC]; 1691da177e4SLinus Torvalds 1701da177e4SLinus Torvalds struct list_head dead_ahs; 1711da177e4SLinus Torvalds 1721da177e4SLinus Torvalds struct ib_event_handler event_handler; 1731da177e4SLinus Torvalds 1741da177e4SLinus Torvalds struct net_device_stats stats; 1751da177e4SLinus Torvalds 1761da177e4SLinus Torvalds struct net_device *parent; 1771da177e4SLinus Torvalds struct list_head child_intfs; 1781da177e4SLinus Torvalds struct list_head list; 1791da177e4SLinus Torvalds 1801da177e4SLinus Torvalds #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG 1811da177e4SLinus Torvalds struct list_head fs_list; 1821da177e4SLinus Torvalds struct dentry *mcg_dentry; 1831732b0efSRoland Dreier struct dentry *path_dentry; 1841da177e4SLinus Torvalds #endif 1851da177e4SLinus Torvalds }; 1861da177e4SLinus Torvalds 1871da177e4SLinus Torvalds struct ipoib_ah { 1881da177e4SLinus Torvalds struct net_device *dev; 1891da177e4SLinus Torvalds struct ib_ah *ah; 1901da177e4SLinus Torvalds struct list_head list; 1911da177e4SLinus Torvalds struct kref ref; 1921da177e4SLinus Torvalds unsigned last_send; 1931da177e4SLinus Torvalds }; 1941da177e4SLinus Torvalds 1951da177e4SLinus Torvalds struct ipoib_path { 1961da177e4SLinus Torvalds struct net_device *dev; 1971da177e4SLinus Torvalds struct ib_sa_path_rec pathrec; 1981da177e4SLinus Torvalds struct ipoib_ah *ah; 1991da177e4SLinus Torvalds struct sk_buff_head queue; 2001da177e4SLinus Torvalds 2011da177e4SLinus Torvalds struct list_head neigh_list; 2021da177e4SLinus Torvalds 2031da177e4SLinus Torvalds int query_id; 2041da177e4SLinus Torvalds struct ib_sa_query *query; 2051da177e4SLinus Torvalds struct completion done; 2061da177e4SLinus Torvalds 2071da177e4SLinus Torvalds struct rb_node rb_node; 2081da177e4SLinus Torvalds struct list_head list; 2091da177e4SLinus Torvalds }; 2101da177e4SLinus Torvalds 2111da177e4SLinus Torvalds struct ipoib_neigh { 2121da177e4SLinus Torvalds struct ipoib_ah *ah; 2131da177e4SLinus Torvalds struct sk_buff_head queue; 2141da177e4SLinus Torvalds 2151da177e4SLinus Torvalds struct neighbour *neighbour; 2161da177e4SLinus Torvalds 2171da177e4SLinus Torvalds struct list_head list; 2181da177e4SLinus Torvalds }; 2191da177e4SLinus Torvalds 220*44af79f9SMichael S. Tsirkin /* 221*44af79f9SMichael S. Tsirkin * We stash a pointer to our private neighbour information after our 222*44af79f9SMichael S. Tsirkin * hardware address in neigh->ha. The ALIGN() expression here makes 223*44af79f9SMichael S. Tsirkin * sure that this pointer is stored aligned so that an unaligned 224*44af79f9SMichael S. Tsirkin * load is not needed to dereference it. 225*44af79f9SMichael S. Tsirkin */ 2261da177e4SLinus Torvalds static inline struct ipoib_neigh **to_ipoib_neigh(struct neighbour *neigh) 2271da177e4SLinus Torvalds { 228*44af79f9SMichael S. Tsirkin return (void*) neigh + ALIGN(offsetof(struct neighbour, ha) + 229*44af79f9SMichael S. Tsirkin INFINIBAND_ALEN, sizeof(void *)); 2301da177e4SLinus Torvalds } 2311da177e4SLinus Torvalds 2321da177e4SLinus Torvalds extern struct workqueue_struct *ipoib_workqueue; 2331da177e4SLinus Torvalds 2341da177e4SLinus Torvalds /* functions */ 2351da177e4SLinus Torvalds 2361da177e4SLinus Torvalds void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr); 2371da177e4SLinus Torvalds 2381da177e4SLinus Torvalds struct ipoib_ah *ipoib_create_ah(struct net_device *dev, 2391da177e4SLinus Torvalds struct ib_pd *pd, struct ib_ah_attr *attr); 2401da177e4SLinus Torvalds void ipoib_free_ah(struct kref *kref); 2411da177e4SLinus Torvalds static inline void ipoib_put_ah(struct ipoib_ah *ah) 2421da177e4SLinus Torvalds { 2431da177e4SLinus Torvalds kref_put(&ah->ref, ipoib_free_ah); 2441da177e4SLinus Torvalds } 2451da177e4SLinus Torvalds 2468ae5a8a2SRoland Dreier int ipoib_open(struct net_device *dev); 2471da177e4SLinus Torvalds int ipoib_add_pkey_attr(struct net_device *dev); 2481da177e4SLinus Torvalds 2491da177e4SLinus Torvalds void ipoib_send(struct net_device *dev, struct sk_buff *skb, 2501da177e4SLinus Torvalds struct ipoib_ah *address, u32 qpn); 2511da177e4SLinus Torvalds void ipoib_reap_ah(void *dev_ptr); 2521da177e4SLinus Torvalds 2531da177e4SLinus Torvalds void ipoib_flush_paths(struct net_device *dev); 2541da177e4SLinus Torvalds struct ipoib_dev_priv *ipoib_intf_alloc(const char *format); 2551da177e4SLinus Torvalds 2561da177e4SLinus Torvalds int ipoib_ib_dev_init(struct net_device *dev, struct ib_device *ca, int port); 2571da177e4SLinus Torvalds void ipoib_ib_dev_flush(void *dev); 2581da177e4SLinus Torvalds void ipoib_ib_dev_cleanup(struct net_device *dev); 2591da177e4SLinus Torvalds 2601da177e4SLinus Torvalds int ipoib_ib_dev_open(struct net_device *dev); 2611da177e4SLinus Torvalds int ipoib_ib_dev_up(struct net_device *dev); 2621da177e4SLinus Torvalds int ipoib_ib_dev_down(struct net_device *dev); 2631da177e4SLinus Torvalds int ipoib_ib_dev_stop(struct net_device *dev); 2641da177e4SLinus Torvalds 2651da177e4SLinus Torvalds int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port); 2661da177e4SLinus Torvalds void ipoib_dev_cleanup(struct net_device *dev); 2671da177e4SLinus Torvalds 2681da177e4SLinus Torvalds void ipoib_mcast_join_task(void *dev_ptr); 2691da177e4SLinus Torvalds void ipoib_mcast_send(struct net_device *dev, union ib_gid *mgid, 2701da177e4SLinus Torvalds struct sk_buff *skb); 2711da177e4SLinus Torvalds 2721da177e4SLinus Torvalds void ipoib_mcast_restart_task(void *dev_ptr); 2731da177e4SLinus Torvalds int ipoib_mcast_start_thread(struct net_device *dev); 2748d2cae06SRoland Dreier int ipoib_mcast_stop_thread(struct net_device *dev, int flush); 2751da177e4SLinus Torvalds 2761da177e4SLinus Torvalds void ipoib_mcast_dev_down(struct net_device *dev); 2771da177e4SLinus Torvalds void ipoib_mcast_dev_flush(struct net_device *dev); 2781da177e4SLinus Torvalds 2798ae5a8a2SRoland Dreier #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG 2801da177e4SLinus Torvalds struct ipoib_mcast_iter *ipoib_mcast_iter_init(struct net_device *dev); 2811da177e4SLinus Torvalds int ipoib_mcast_iter_next(struct ipoib_mcast_iter *iter); 2821da177e4SLinus Torvalds void ipoib_mcast_iter_read(struct ipoib_mcast_iter *iter, 2831da177e4SLinus Torvalds union ib_gid *gid, 2841da177e4SLinus Torvalds unsigned long *created, 2851da177e4SLinus Torvalds unsigned int *queuelen, 2861da177e4SLinus Torvalds unsigned int *complete, 2871da177e4SLinus Torvalds unsigned int *send_only); 2881732b0efSRoland Dreier 2891732b0efSRoland Dreier struct ipoib_path_iter *ipoib_path_iter_init(struct net_device *dev); 2901732b0efSRoland Dreier int ipoib_path_iter_next(struct ipoib_path_iter *iter); 2911732b0efSRoland Dreier void ipoib_path_iter_read(struct ipoib_path_iter *iter, 2921732b0efSRoland Dreier struct ipoib_path *path); 2938ae5a8a2SRoland Dreier #endif 2941da177e4SLinus Torvalds 2951da177e4SLinus Torvalds int ipoib_mcast_attach(struct net_device *dev, u16 mlid, 2961da177e4SLinus Torvalds union ib_gid *mgid); 2971da177e4SLinus Torvalds int ipoib_mcast_detach(struct net_device *dev, u16 mlid, 2981da177e4SLinus Torvalds union ib_gid *mgid); 2991da177e4SLinus Torvalds 3005b6810e0SRoland Dreier int ipoib_init_qp(struct net_device *dev); 3011da177e4SLinus Torvalds int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca); 3021da177e4SLinus Torvalds void ipoib_transport_dev_cleanup(struct net_device *dev); 3031da177e4SLinus Torvalds 3041da177e4SLinus Torvalds void ipoib_event(struct ib_event_handler *handler, 3051da177e4SLinus Torvalds struct ib_event *record); 3061da177e4SLinus Torvalds 3071da177e4SLinus Torvalds int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey); 3081da177e4SLinus Torvalds int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey); 3091da177e4SLinus Torvalds 3101da177e4SLinus Torvalds void ipoib_pkey_poll(void *dev); 3111da177e4SLinus Torvalds int ipoib_pkey_dev_delay_open(struct net_device *dev); 3121da177e4SLinus Torvalds 3131da177e4SLinus Torvalds #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG 3141732b0efSRoland Dreier void ipoib_create_debug_files(struct net_device *dev); 3151732b0efSRoland Dreier void ipoib_delete_debug_files(struct net_device *dev); 3161da177e4SLinus Torvalds int ipoib_register_debugfs(void); 3171da177e4SLinus Torvalds void ipoib_unregister_debugfs(void); 3181da177e4SLinus Torvalds #else 3191732b0efSRoland Dreier static inline void ipoib_create_debug_files(struct net_device *dev) { } 3201732b0efSRoland Dreier static inline void ipoib_delete_debug_files(struct net_device *dev) { } 3211da177e4SLinus Torvalds static inline int ipoib_register_debugfs(void) { return 0; } 3221da177e4SLinus Torvalds static inline void ipoib_unregister_debugfs(void) { } 3231da177e4SLinus Torvalds #endif 3241da177e4SLinus Torvalds 3251da177e4SLinus Torvalds 3261da177e4SLinus Torvalds #define ipoib_printk(level, priv, format, arg...) \ 3271da177e4SLinus Torvalds printk(level "%s: " format, ((struct ipoib_dev_priv *) priv)->dev->name , ## arg) 3281da177e4SLinus Torvalds #define ipoib_warn(priv, format, arg...) \ 3291da177e4SLinus Torvalds ipoib_printk(KERN_WARNING, priv, format , ## arg) 3301da177e4SLinus Torvalds 3311da177e4SLinus Torvalds 3321da177e4SLinus Torvalds #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG 3331da177e4SLinus Torvalds extern int ipoib_debug_level; 3341da177e4SLinus Torvalds 3351da177e4SLinus Torvalds #define ipoib_dbg(priv, format, arg...) \ 3361da177e4SLinus Torvalds do { \ 3371da177e4SLinus Torvalds if (ipoib_debug_level > 0) \ 3381da177e4SLinus Torvalds ipoib_printk(KERN_DEBUG, priv, format , ## arg); \ 3391da177e4SLinus Torvalds } while (0) 3401da177e4SLinus Torvalds #define ipoib_dbg_mcast(priv, format, arg...) \ 3411da177e4SLinus Torvalds do { \ 3421da177e4SLinus Torvalds if (mcast_debug_level > 0) \ 3431da177e4SLinus Torvalds ipoib_printk(KERN_DEBUG, priv, format , ## arg); \ 3441da177e4SLinus Torvalds } while (0) 3451da177e4SLinus Torvalds #else /* CONFIG_INFINIBAND_IPOIB_DEBUG */ 3461da177e4SLinus Torvalds #define ipoib_dbg(priv, format, arg...) \ 3471da177e4SLinus Torvalds do { (void) (priv); } while (0) 3481da177e4SLinus Torvalds #define ipoib_dbg_mcast(priv, format, arg...) \ 3491da177e4SLinus Torvalds do { (void) (priv); } while (0) 3501da177e4SLinus Torvalds #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG */ 3511da177e4SLinus Torvalds 3521da177e4SLinus Torvalds #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG_DATA 3531da177e4SLinus Torvalds #define ipoib_dbg_data(priv, format, arg...) \ 3541da177e4SLinus Torvalds do { \ 3551da177e4SLinus Torvalds if (data_debug_level > 0) \ 3561da177e4SLinus Torvalds ipoib_printk(KERN_DEBUG, priv, format , ## arg); \ 3571da177e4SLinus Torvalds } while (0) 3581da177e4SLinus Torvalds #else /* CONFIG_INFINIBAND_IPOIB_DEBUG_DATA */ 3591da177e4SLinus Torvalds #define ipoib_dbg_data(priv, format, arg...) \ 3601da177e4SLinus Torvalds do { (void) (priv); } while (0) 3611da177e4SLinus Torvalds #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG_DATA */ 3621da177e4SLinus Torvalds 3631da177e4SLinus Torvalds 3641da177e4SLinus Torvalds #define IPOIB_GID_FMT "%x:%x:%x:%x:%x:%x:%x:%x" 3651da177e4SLinus Torvalds 3661da177e4SLinus Torvalds #define IPOIB_GID_ARG(gid) be16_to_cpup((__be16 *) ((gid).raw + 0)), \ 3671da177e4SLinus Torvalds be16_to_cpup((__be16 *) ((gid).raw + 2)), \ 3681da177e4SLinus Torvalds be16_to_cpup((__be16 *) ((gid).raw + 4)), \ 3691da177e4SLinus Torvalds be16_to_cpup((__be16 *) ((gid).raw + 6)), \ 3701da177e4SLinus Torvalds be16_to_cpup((__be16 *) ((gid).raw + 8)), \ 3711da177e4SLinus Torvalds be16_to_cpup((__be16 *) ((gid).raw + 10)), \ 3721da177e4SLinus Torvalds be16_to_cpup((__be16 *) ((gid).raw + 12)), \ 3731da177e4SLinus Torvalds be16_to_cpup((__be16 *) ((gid).raw + 14)) 3741da177e4SLinus Torvalds 3751da177e4SLinus Torvalds #endif /* _IPOIB_H */ 376