Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (c) 2004 Voltaire, Inc. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * This software is available to you under a choice of one of two
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * licenses.  You may choose to be licensed under the terms of the GNU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * General Public License (GPL) Version 2, available from the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * COPYING in the main directory of this source tree, or the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * OpenIB.org BSD license below:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *     Redistribution and use in source and binary forms, with or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *     without modification, are permitted provided that the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *     conditions are met:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  *      - Redistributions of source code must retain the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  *        copyright notice, this list of conditions and the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *        disclaimer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *      - Redistributions in binary form must reproduce the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *        copyright notice, this list of conditions and the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *        disclaimer in the documentation and/or other materials
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *        provided with the distribution.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #ifndef _IPOIB_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define _IPOIB_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #include <linux/skbuff.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #include <linux/netdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #include <linux/kref.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #include <linux/if_infiniband.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #include <net/neighbour.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #include <net/sch_generic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #include <linux/atomic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #include <rdma/ib_verbs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #include <rdma/ib_pack.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #include <rdma/ib_sa.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) /* constants */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) enum ipoib_flush_level {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	IPOIB_FLUSH_LIGHT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	IPOIB_FLUSH_NORMAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	IPOIB_FLUSH_HEAVY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	IPOIB_ENCAP_LEN		  = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	IPOIB_PSEUDO_LEN	  = 20,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	IPOIB_HARD_LEN		  = IPOIB_ENCAP_LEN + IPOIB_PSEUDO_LEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	IPOIB_UD_HEAD_SIZE	  = IB_GRH_BYTES + IPOIB_ENCAP_LEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	IPOIB_UD_RX_SG		  = 2, /* max buffer needed for 4K mtu */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	IPOIB_CM_MTU		  = 0x10000 - 0x10, /* padding to align header to 16 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	IPOIB_CM_BUF_SIZE	  = IPOIB_CM_MTU  + IPOIB_ENCAP_LEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	IPOIB_CM_HEAD_SIZE	  = IPOIB_CM_BUF_SIZE % PAGE_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	IPOIB_CM_RX_SG		  = ALIGN(IPOIB_CM_BUF_SIZE, PAGE_SIZE) / PAGE_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	IPOIB_RX_RING_SIZE	  = 256,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	IPOIB_TX_RING_SIZE	  = 128,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	IPOIB_MAX_QUEUE_SIZE	  = 8192,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	IPOIB_MIN_QUEUE_SIZE	  = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	IPOIB_CM_MAX_CONN_QP	  = 4096,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	IPOIB_NUM_WC		  = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	IPOIB_MAX_PATH_REC_QUEUE  = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	IPOIB_MAX_MCAST_QUEUE	  = 64,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	IPOIB_FLAG_OPER_UP	  = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	IPOIB_FLAG_INITIALIZED	  = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	IPOIB_FLAG_ADMIN_UP	  = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	IPOIB_PKEY_ASSIGNED	  = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	IPOIB_FLAG_SUBINTERFACE	  = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	IPOIB_STOP_REAPER	  = 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	IPOIB_FLAG_ADMIN_CM	  = 9,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	IPOIB_FLAG_UMCAST	  = 10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	IPOIB_NEIGH_TBL_FLUSH	  = 12,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	IPOIB_FLAG_DEV_ADDR_SET	  = 13,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	IPOIB_FLAG_DEV_ADDR_CTRL  = 14,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	IPOIB_MAX_BACKOFF_SECONDS = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	IPOIB_MCAST_FLAG_FOUND	  = 0,	/* used in set_multicast_list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	IPOIB_MCAST_FLAG_SENDONLY = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	 * For IPOIB_MCAST_FLAG_BUSY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	 * When set, in flight join and mcast->mc is unreliable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	 * When clear and mcast->mc IS_ERR_OR_NULL, need to restart or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	 *   haven't started yet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	 * When clear and mcast->mc is valid pointer, join was successful
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	IPOIB_MCAST_FLAG_BUSY	  = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	IPOIB_MCAST_FLAG_ATTACHED = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	MAX_SEND_CQE		  = 64,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	IPOIB_CM_COPYBREAK	  = 256,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	IPOIB_NON_CHILD		  = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	IPOIB_LEGACY_CHILD	  = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	IPOIB_RTNL_CHILD	  = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #define	IPOIB_OP_RECV   (1ul << 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #ifdef CONFIG_INFINIBAND_IPOIB_CM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #define	IPOIB_OP_CM     (1ul << 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #define	IPOIB_OP_CM     (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #define IPOIB_QPN_MASK ((__force u32) cpu_to_be32(0xFFFFFF))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) /* structs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) struct ipoib_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	__be16	proto;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	u16	reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) struct ipoib_pseudo_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	u8	hwaddr[INFINIBAND_ALEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) static inline void skb_add_pseudo_hdr(struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	char *data = skb_push(skb, IPOIB_PSEUDO_LEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	 * only the ipoib header is present now, make room for a dummy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	 * pseudo header and set skb field accordingly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	memset(data, 0, IPOIB_PSEUDO_LEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	skb_reset_mac_header(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	skb_pull(skb, IPOIB_HARD_LEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) static inline struct ipoib_dev_priv *ipoib_priv(const struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	struct rdma_netdev *rn = netdev_priv(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	return rn->clnt_priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) /* Used for all multicast joins (broadcast, IPv4 mcast and IPv6 mcast) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) struct ipoib_mcast {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	struct ib_sa_mcmember_rec mcmember;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	struct ib_sa_multicast	 *mc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	struct ipoib_ah		 *ah;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	struct rb_node    rb_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	struct list_head  list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	unsigned long created;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	unsigned long backoff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	unsigned long delay_until;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	unsigned char logcount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	struct list_head  neigh_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	struct sk_buff_head pkt_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	struct net_device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	struct completion done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) struct ipoib_rx_buf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	struct sk_buff *skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	u64		mapping[IPOIB_UD_RX_SG];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) struct ipoib_tx_buf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	struct sk_buff *skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	u64		mapping[MAX_SKB_FRAGS + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) struct ib_cm_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) struct ipoib_cm_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	__be32 qpn; /* High byte MUST be ignored on receive */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	__be32 mtu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)  * Quoting 10.3.1 Queue Pair and EE Context States:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)  * Note, for QPs that are associated with an SRQ, the Consumer should take the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)  * QP through the Error State before invoking a Destroy QP or a Modify QP to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)  * Reset State.  The Consumer may invoke the Destroy QP without first performing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)  * a Modify QP to the Error State and waiting for the Affiliated Asynchronous
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  * Last WQE Reached Event. However, if the Consumer does not wait for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  * Affiliated Asynchronous Last WQE Reached Event, then WQE and Data Segment
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  * leakage may occur. Therefore, it is good programming practice to tear down a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  * QP that is associated with an SRQ by using the following process:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)  * - Put the QP in the Error State
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)  * - Wait for the Affiliated Asynchronous Last WQE Reached Event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)  * - either:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)  *       drain the CQ by invoking the Poll CQ verb and either wait for CQ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)  *       to be empty or the number of Poll CQ operations has exceeded
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)  *       CQ capacity size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)  * - or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)  *       post another WR that completes on the same CQ and wait for this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)  *       WR to return as a WC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)  * - and then invoke a Destroy QP or Reset QP.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)  * We use the second option and wait for a completion on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)  * same CQ before destroying QPs attached to our SRQ.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) enum ipoib_cm_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	IPOIB_CM_RX_LIVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	IPOIB_CM_RX_ERROR, /* Ignored by stale task */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	IPOIB_CM_RX_FLUSH  /* Last WQE Reached event observed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) struct ipoib_cm_rx {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	struct ib_cm_id	       *id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	struct ib_qp	       *qp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	struct ipoib_cm_rx_buf *rx_ring;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	struct list_head	list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	struct net_device      *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	unsigned long		jiffies;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	enum ipoib_cm_state	state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	int			recv_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) struct ipoib_cm_tx {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	struct ib_cm_id	    *id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	struct ib_qp	    *qp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	struct list_head     list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	struct net_device   *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	struct ipoib_neigh  *neigh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	struct ipoib_tx_buf *tx_ring;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	unsigned int	     tx_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	unsigned int	     tx_tail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	unsigned long	     flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	u32		     mtu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	unsigned int         max_send_sge;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) struct ipoib_cm_rx_buf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	struct sk_buff *skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	u64 mapping[IPOIB_CM_RX_SG];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) struct ipoib_cm_dev_priv {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	struct ib_srq	       *srq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	struct ipoib_cm_rx_buf *srq_ring;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	struct ib_cm_id	       *id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	struct list_head	passive_ids;   /* state: LIVE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	struct list_head	rx_error_list; /* state: ERROR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	struct list_head	rx_flush_list; /* state: FLUSH, drain not started */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	struct list_head	rx_drain_list; /* state: FLUSH, drain started */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	struct list_head	rx_reap_list;  /* state: FLUSH, drain done */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	struct work_struct      start_task;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	struct work_struct      reap_task;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	struct work_struct      skb_task;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	struct work_struct      rx_reap_task;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	struct delayed_work     stale_task;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	struct sk_buff_head     skb_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	struct list_head	start_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	struct list_head	reap_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	struct ib_wc		ibwc[IPOIB_NUM_WC];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	struct ib_sge		rx_sge[IPOIB_CM_RX_SG];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	struct ib_recv_wr       rx_wr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	int			nonsrq_conn_qp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	int			max_cm_mtu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	int			num_frags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) struct ipoib_ethtool_st {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 	u16     coalesce_usecs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	u16     max_coalesced_frames;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) struct ipoib_neigh_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) struct ipoib_neigh_hash {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	struct ipoib_neigh_table       *ntbl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	struct ipoib_neigh __rcu      **buckets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 	struct rcu_head			rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	u32				mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	u32				size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) struct ipoib_neigh_table {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	struct ipoib_neigh_hash __rcu  *htbl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	atomic_t			entries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	struct completion		flushed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 	struct completion		deleted;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) struct ipoib_qp_state_validate {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	struct work_struct work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	struct ipoib_dev_priv   *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)  * Device private locking: network stack tx_lock protects members used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)  * in TX fast path, lock protects everything else.  lock nests inside
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)  * of tx_lock (ie tx_lock must be acquired first if needed).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) struct ipoib_dev_priv {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	struct net_device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	void (*next_priv_destructor)(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	struct napi_struct send_napi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	struct napi_struct recv_napi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	 * This protects access to the child_intfs list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 	 * To READ from child_intfs the RTNL or vlan_rwsem read side must be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	 * held.  To WRITE RTNL and the vlan_rwsem write side must be held (in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	 * that order) This lock exists because we have a few contexts where
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	 * we need the child_intfs, but do not want to grab the RTNL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	struct rw_semaphore vlan_rwsem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	struct mutex mcast_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 	struct rb_root  path_tree;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	struct list_head path_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 	struct ipoib_neigh_table ntbl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	struct ipoib_mcast *broadcast;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 	struct list_head multicast_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	struct rb_root multicast_tree;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	struct workqueue_struct *wq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	struct delayed_work mcast_task;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	struct work_struct carrier_on_task;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 	struct work_struct flush_light;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 	struct work_struct flush_normal;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 	struct work_struct flush_heavy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 	struct work_struct restart_task;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	struct delayed_work ah_reap_task;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	struct delayed_work neigh_reap_task;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	struct ib_device *ca;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	u8		  port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	u16		  pkey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 	u16		  pkey_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 	struct ib_pd	 *pd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 	struct ib_cq	 *recv_cq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 	struct ib_cq	 *send_cq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 	struct ib_qp	 *qp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	u32		  qkey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 	union ib_gid local_gid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 	u32	     local_lid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 	unsigned int admin_mtu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 	unsigned int mcast_mtu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	unsigned int max_ib_mtu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 	struct ipoib_rx_buf *rx_ring;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 	struct ipoib_tx_buf *tx_ring;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 	/* cyclic ring variables for managing tx_ring, for UD only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 	unsigned int	     tx_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	unsigned int	     tx_tail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	/* cyclic ring variables for counting overall outstanding send WRs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 	unsigned int	     global_tx_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	unsigned int	     global_tx_tail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 	struct ib_sge	     tx_sge[MAX_SKB_FRAGS + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 	struct ib_ud_wr      tx_wr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 	struct ib_wc	     send_wc[MAX_SEND_CQE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 	struct ib_recv_wr    rx_wr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	struct ib_sge	     rx_sge[IPOIB_UD_RX_SG];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 	struct ib_wc ibwc[IPOIB_NUM_WC];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	struct list_head dead_ahs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 	struct ib_event_handler event_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 	struct net_device *parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 	struct list_head child_intfs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	int    child_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) #ifdef CONFIG_INFINIBAND_IPOIB_CM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 	struct ipoib_cm_dev_priv cm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 	struct list_head fs_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 	struct dentry *mcg_dentry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 	struct dentry *path_dentry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 	u64	hca_caps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	struct ipoib_ethtool_st ethtool;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	unsigned int max_send_sge;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 	bool sm_fullmember_sendonly_support;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	const struct net_device_ops	*rn_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) struct ipoib_ah {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 	struct net_device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 	struct ib_ah	  *ah;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 	struct list_head   list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 	struct kref	   ref;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 	unsigned int	   last_send;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 	int  		   valid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) struct ipoib_path {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 	struct net_device    *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 	struct sa_path_rec pathrec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 	struct ipoib_ah      *ah;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 	struct sk_buff_head   queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 	struct list_head      neigh_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 	int		      query_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 	struct ib_sa_query   *query;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 	struct completion     done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 	struct rb_node	      rb_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 	struct list_head      list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) struct ipoib_neigh {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 	struct ipoib_ah    *ah;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) #ifdef CONFIG_INFINIBAND_IPOIB_CM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 	struct ipoib_cm_tx *cm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 	u8     daddr[INFINIBAND_ALEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 	struct sk_buff_head queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 	struct net_device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 	struct list_head    list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 	struct ipoib_neigh __rcu *hnext;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 	struct rcu_head     rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 	atomic_t	    refcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 	unsigned long       alive;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) #define IPOIB_UD_MTU(ib_mtu)		(ib_mtu - IPOIB_ENCAP_LEN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) #define IPOIB_UD_BUF_SIZE(ib_mtu)	(ib_mtu + IB_GRH_BYTES)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) void ipoib_neigh_dtor(struct ipoib_neigh *neigh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) static inline void ipoib_neigh_put(struct ipoib_neigh *neigh)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 	if (atomic_dec_and_test(&neigh->refcnt))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 		ipoib_neigh_dtor(neigh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) struct ipoib_neigh *ipoib_neigh_get(struct net_device *dev, u8 *daddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) struct ipoib_neigh *ipoib_neigh_alloc(u8 *daddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 				      struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) void ipoib_neigh_free(struct ipoib_neigh *neigh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) extern struct workqueue_struct *ipoib_workqueue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) /* functions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) int ipoib_rx_poll(struct napi_struct *napi, int budget);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) int ipoib_tx_poll(struct napi_struct *napi, int budget);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) void ipoib_ib_rx_completion(struct ib_cq *cq, void *ctx_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) void ipoib_ib_tx_completion(struct ib_cq *cq, void *ctx_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) struct ipoib_ah *ipoib_create_ah(struct net_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) 				 struct ib_pd *pd, struct rdma_ah_attr *attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) void ipoib_free_ah(struct kref *kref);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) static inline void ipoib_put_ah(struct ipoib_ah *ah)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 	kref_put(&ah->ref, ipoib_free_ah);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) int ipoib_open(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) void ipoib_intf_free(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) int ipoib_add_pkey_attr(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) int ipoib_add_umcast_attr(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) int ipoib_send(struct net_device *dev, struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) 	       struct ib_ah *address, u32 dqpn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) void ipoib_reap_ah(struct work_struct *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) struct ipoib_path *__path_find(struct net_device *dev, void *gid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) void ipoib_mark_paths_invalid(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) void ipoib_flush_paths(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) struct net_device *ipoib_intf_alloc(struct ib_device *hca, u8 port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 				    const char *format);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) int ipoib_intf_init(struct ib_device *hca, u8 port, const char *format,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) 		    struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) void ipoib_ib_tx_timer_func(struct timer_list *t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) void ipoib_ib_dev_flush_light(struct work_struct *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) void ipoib_ib_dev_flush_normal(struct work_struct *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) void ipoib_ib_dev_flush_heavy(struct work_struct *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) void ipoib_pkey_event(struct work_struct *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) void ipoib_ib_dev_cleanup(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) int ipoib_ib_dev_open_default(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) int ipoib_ib_dev_open(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) void ipoib_ib_dev_stop(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) void ipoib_ib_dev_up(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) void ipoib_ib_dev_down(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) int ipoib_ib_dev_stop_default(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) void ipoib_pkey_dev_check_presence(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) void ipoib_mcast_join_task(struct work_struct *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) void ipoib_mcast_carrier_on_task(struct work_struct *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) void ipoib_mcast_send(struct net_device *dev, u8 *daddr, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) void ipoib_mcast_restart_task(struct work_struct *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) void ipoib_mcast_start_thread(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) void ipoib_mcast_stop_thread(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) void ipoib_mcast_dev_down(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) void ipoib_mcast_dev_flush(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) int ipoib_dma_map_tx(struct ib_device *ca, struct ipoib_tx_buf *tx_req);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) void ipoib_dma_unmap_tx(struct ipoib_dev_priv *priv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) 			struct ipoib_tx_buf *tx_req);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) struct rtnl_link_ops *ipoib_get_link_ops(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) static inline void ipoib_build_sge(struct ipoib_dev_priv *priv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) 				   struct ipoib_tx_buf *tx_req)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) 	int i, off;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) 	struct sk_buff *skb = tx_req->skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) 	skb_frag_t *frags = skb_shinfo(skb)->frags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) 	int nr_frags = skb_shinfo(skb)->nr_frags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) 	u64 *mapping = tx_req->mapping;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) 	if (skb_headlen(skb)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) 		priv->tx_sge[0].addr         = mapping[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) 		priv->tx_sge[0].length       = skb_headlen(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) 		off = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) 	} else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) 		off = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 	for (i = 0; i < nr_frags; ++i) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) 		priv->tx_sge[i + off].addr = mapping[i + off];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) 		priv->tx_sge[i + off].length = skb_frag_size(&frags[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) 	priv->tx_wr.wr.num_sge	     = nr_frags + off;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) struct ipoib_mcast_iter *ipoib_mcast_iter_init(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) int ipoib_mcast_iter_next(struct ipoib_mcast_iter *iter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) void ipoib_mcast_iter_read(struct ipoib_mcast_iter *iter,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 				  union ib_gid *gid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 				  unsigned long *created,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) 				  unsigned int *queuelen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 				  unsigned int *complete,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) 				  unsigned int *send_only);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) struct ipoib_path_iter *ipoib_path_iter_init(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) int ipoib_path_iter_next(struct ipoib_path_iter *iter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) void ipoib_path_iter_read(struct ipoib_path_iter *iter,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 			  struct ipoib_path *path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) int ipoib_mcast_attach(struct net_device *dev, struct ib_device *hca,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) 		       union ib_gid *mgid, u16 mlid, int set_qkey, u32 qkey);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) int ipoib_mcast_detach(struct net_device *dev, struct ib_device *hca,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 		       union ib_gid *mgid, u16 mlid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) void ipoib_mcast_remove_list(struct list_head *remove_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) void ipoib_check_and_add_mcast_sendonly(struct ipoib_dev_priv *priv, u8 *mgid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 				struct list_head *remove_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) int ipoib_init_qp(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) void ipoib_transport_dev_cleanup(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) void ipoib_event(struct ib_event_handler *handler,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) 		 struct ib_event *record);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 		     u16 pkey, int child_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) int  __init ipoib_netlink_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) void __exit ipoib_netlink_fini(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) void ipoib_set_umcast(struct net_device *ndev, int umcast_val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) int  ipoib_set_mode(struct net_device *dev, const char *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) void ipoib_setup_common(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) void ipoib_pkey_open(struct ipoib_dev_priv *priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) void ipoib_drain_cq(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) void ipoib_set_ethtool_ops(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) #define IPOIB_FLAGS_RC		0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) #define IPOIB_FLAGS_UC		0x40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) /* We don't support UC connections at the moment */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) #define IPOIB_CM_SUPPORTED(ha)   (ha[0] & (IPOIB_FLAGS_RC))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) #ifdef CONFIG_INFINIBAND_IPOIB_CM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) extern int ipoib_max_conn_qp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) static inline int ipoib_cm_admin_enabled(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) 	struct ipoib_dev_priv *priv = ipoib_priv(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) 	return IPOIB_CM_SUPPORTED(dev->dev_addr) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) 		test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) static inline int ipoib_cm_enabled(struct net_device *dev, u8 *hwaddr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) 	struct ipoib_dev_priv *priv = ipoib_priv(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) 	return IPOIB_CM_SUPPORTED(hwaddr) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) 		test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) static inline int ipoib_cm_up(struct ipoib_neigh *neigh)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) 	return test_bit(IPOIB_FLAG_OPER_UP, &neigh->cm->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) static inline struct ipoib_cm_tx *ipoib_cm_get(struct ipoib_neigh *neigh)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) 	return neigh->cm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) static inline void ipoib_cm_set(struct ipoib_neigh *neigh, struct ipoib_cm_tx *tx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) 	neigh->cm = tx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) static inline int ipoib_cm_has_srq(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) 	struct ipoib_dev_priv *priv = ipoib_priv(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) 	return !!priv->cm.srq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) static inline unsigned int ipoib_cm_max_mtu(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) 	struct ipoib_dev_priv *priv = ipoib_priv(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) 	return priv->cm.max_cm_mtu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_tx *tx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) int ipoib_cm_dev_open(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) void ipoib_cm_dev_stop(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) int ipoib_cm_dev_init(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) int ipoib_cm_add_mode_attr(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) void ipoib_cm_dev_cleanup(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) struct ipoib_cm_tx *ipoib_cm_create_tx(struct net_device *dev, struct ipoib_path *path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) 				    struct ipoib_neigh *neigh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) void ipoib_cm_destroy_tx(struct ipoib_cm_tx *tx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) void ipoib_cm_skb_too_long(struct net_device *dev, struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) 			   unsigned int mtu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) void ipoib_cm_handle_tx_wc(struct net_device *dev, struct ib_wc *wc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) struct ipoib_cm_tx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) #define ipoib_max_conn_qp 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) static inline int ipoib_cm_admin_enabled(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) static inline int ipoib_cm_enabled(struct net_device *dev, u8 *hwaddr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) static inline int ipoib_cm_up(struct ipoib_neigh *neigh)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) static inline struct ipoib_cm_tx *ipoib_cm_get(struct ipoib_neigh *neigh)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) static inline void ipoib_cm_set(struct ipoib_neigh *neigh, struct ipoib_cm_tx *tx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) static inline int ipoib_cm_has_srq(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) static inline unsigned int ipoib_cm_max_mtu(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_tx *tx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) 	return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) int ipoib_cm_dev_open(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) void ipoib_cm_dev_stop(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) 	return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) int ipoib_cm_dev_init(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) 	return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) void ipoib_cm_dev_cleanup(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) 	return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) struct ipoib_cm_tx *ipoib_cm_create_tx(struct net_device *dev, struct ipoib_path *path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) 				    struct ipoib_neigh *neigh)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) void ipoib_cm_destroy_tx(struct ipoib_cm_tx *tx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) 	return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) int ipoib_cm_add_mode_attr(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769) static inline void ipoib_cm_skb_too_long(struct net_device *dev, struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) 					 unsigned int mtu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) 	dev_kfree_skb_any(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) static inline void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) static inline void ipoib_cm_handle_tx_wc(struct net_device *dev, struct ib_wc *wc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) void ipoib_create_debug_files(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786) void ipoib_delete_debug_files(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787) void ipoib_register_debugfs(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) void ipoib_unregister_debugfs(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) static inline void ipoib_create_debug_files(struct net_device *dev) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791) static inline void ipoib_delete_debug_files(struct net_device *dev) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792) static inline void ipoib_register_debugfs(void) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) static inline void ipoib_unregister_debugfs(void) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796) #define ipoib_printk(level, priv, format, arg...)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797) 	printk(level "%s: " format, ((struct ipoib_dev_priv *) priv)->dev->name , ## arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) #define ipoib_warn(priv, format, arg...)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799) do {							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800) 	static DEFINE_RATELIMIT_STATE(_rs,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801) 		10 * HZ /*10 seconds */,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802) 		100);		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) 	if (__ratelimit(&_rs))				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) 		ipoib_printk(KERN_WARNING, priv, format , ## arg);\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807) extern int ipoib_sendq_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808) extern int ipoib_recvq_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) extern struct ib_sa_client ipoib_sa_client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812) #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) extern int ipoib_debug_level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815) #define ipoib_dbg(priv, format, arg...)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816) 	do {						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817) 		if (ipoib_debug_level > 0)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) 			ipoib_printk(KERN_DEBUG, priv, format , ## arg); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819) 	} while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) #define ipoib_dbg_mcast(priv, format, arg...)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821) 	do {						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822) 		if (mcast_debug_level > 0)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823) 			ipoib_printk(KERN_DEBUG, priv, format , ## arg); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824) 	} while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825) #else /* CONFIG_INFINIBAND_IPOIB_DEBUG */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826) #define ipoib_dbg(priv, format, arg...)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827) 	do { (void) (priv); } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828) #define ipoib_dbg_mcast(priv, format, arg...)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829) 	do { (void) (priv); } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830) #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832) #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG_DATA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) #define ipoib_dbg_data(priv, format, arg...)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834) 	do {						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835) 		if (data_debug_level > 0)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836) 			ipoib_printk(KERN_DEBUG, priv, format , ## arg); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837) 	} while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) #else /* CONFIG_INFINIBAND_IPOIB_DEBUG_DATA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839) #define ipoib_dbg_data(priv, format, arg...)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840) 	do { (void) (priv); } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841) #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG_DATA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) #define IPOIB_QPN(ha) (be32_to_cpup((__be32 *) ha) & 0xffffff)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845) #endif /* _IPOIB_H */