Go to the documentation of this file.
37 #include <linux/bitops.h>
38 #include <linux/compiler.h>
39 #include <linux/list.h>
41 #include <linux/netdevice.h>
42 #include <linux/if_vlan.h>
43 #ifdef CONFIG_MLX4_EN_DCB
57 #define DRV_NAME "mlx4_en"
58 #define DRV_VERSION "2.0"
59 #define DRV_RELDATE "Dec 2011"
61 #define MLX4_EN_MSG_LEVEL (NETIF_MSG_LINK | NETIF_MSG_IFDOWN)
68 #define MLX4_EN_PAGE_SHIFT 12
69 #define MLX4_EN_PAGE_SIZE (1 << MLX4_EN_PAGE_SHIFT)
70 #define MAX_RX_RINGS 16
71 #define MIN_RX_RINGS 4
73 #define HEADROOM (2048 / TXBB_SIZE + 1)
74 #define STAMP_STRIDE 64
75 #define STAMP_DWORDS (STAMP_STRIDE / 4)
76 #define STAMP_SHIFT 31
77 #define STAMP_VAL 0x7fffffff
78 #define STATS_DELAY (HZ / 4)
79 #define MAX_NUM_OF_FS_RULES 256
81 #define MLX4_EN_FILTER_HASH_SHIFT 4
82 #define MLX4_EN_FILTER_EXPIRY_QUOTA 60
85 #define MAX_DESC_SIZE 512
86 #define MAX_DESC_TXBBS (MAX_DESC_SIZE / TXBB_SIZE)
92 #define MLX4_EN_WATCHDOG_TIMEOUT (15 * HZ)
95 #define MLX4_EN_ALLOC_SIZE PAGE_ALIGN(16384)
96 #define MLX4_EN_ALLOC_ORDER get_order(MLX4_EN_ALLOC_SIZE)
98 #define MLX4_EN_MAX_LRO_DESCRIPTORS 32
108 #define MLX4_EN_MAX_RX_FRAGS 4
111 #define MLX4_EN_MAX_TX_SIZE 8192
112 #define MLX4_EN_MAX_RX_SIZE 8192
115 #define MLX4_EN_MIN_RX_SIZE (MLX4_EN_ALLOC_SIZE / SMP_CACHE_BYTES)
116 #define MLX4_EN_MIN_TX_SIZE (4096 / TXBB_SIZE)
118 #define MLX4_EN_SMALL_PKT_SIZE 64
119 #define MLX4_EN_MAX_TX_RING_P_UP 32
120 #define MLX4_EN_NUM_UP 8
121 #define MLX4_EN_DEF_TX_RING_SIZE 512
122 #define MLX4_EN_DEF_RX_RING_SIZE 1024
125 #define MLX4_EN_RX_COAL_TARGET 44
126 #define MLX4_EN_RX_COAL_TIME 0x10
128 #define MLX4_EN_TX_COAL_PKTS 16
129 #define MLX4_EN_TX_COAL_TIME 0x80
131 #define MLX4_EN_RX_RATE_LOW 400000
132 #define MLX4_EN_RX_COAL_TIME_LOW 0
133 #define MLX4_EN_RX_RATE_HIGH 450000
134 #define MLX4_EN_RX_COAL_TIME_HIGH 128
135 #define MLX4_EN_RX_SIZE_THRESH 1024
136 #define MLX4_EN_RX_RATE_THRESH (1000000 / MLX4_EN_RX_COAL_TIME_HIGH)
137 #define MLX4_EN_SAMPLE_INTERVAL 0
138 #define MLX4_EN_AVG_PKT_SMALL 256
140 #define MLX4_EN_AUTO_CONF 0xffff
142 #define MLX4_EN_DEF_RX_PAUSE 1
143 #define MLX4_EN_DEF_TX_PAUSE 1
147 #define MLX4_EN_TX_POLL_MODER 16
148 #define MLX4_EN_TX_POLL_TIMEOUT (HZ / 4)
150 #define ETH_LLC_SNAP_SIZE 8
152 #define SMALL_PACKET_SIZE (256 - NET_IP_ALIGN)
153 #define HEADER_COPY_SIZE (128 - NET_IP_ALIGN)
154 #define MLX4_LOOPBACK_TEST_PAYLOAD (HEADER_COPY_SIZE - ETH_HLEN)
156 #define MLX4_EN_MIN_MTU 46
157 #define ETH_BCAST 0xffffffffffffULL
159 #define MLX4_EN_LOOPBACK_RETRIES 5
160 #define MLX4_EN_LOOPBACK_TIMEOUT 100
162 #ifdef MLX4_EN_PERF_STAT
165 #define AVG_FACTOR 1024
166 #define NUM_PERF_STATS NUM_PERF_COUNTERS
168 #define INC_PERF_COUNTER(cnt) (++(cnt))
169 #define ADD_PERF_COUNTER(cnt, add) ((cnt) += (add))
170 #define AVG_PERF_COUNTER(cnt, sample) \
171 ((cnt) = ((cnt) * (AVG_SIZE - 1) + (sample) * AVG_FACTOR) / AVG_SIZE)
172 #define GET_PERF_COUNTER(cnt) (cnt)
173 #define GET_AVG_PERF_COUNTER(cnt) ((cnt) / AVG_FACTOR)
177 #define NUM_PERF_STATS 0
178 #define INC_PERF_COUNTER(cnt) do {} while (0)
179 #define ADD_PERF_COUNTER(cnt, add) do {} while (0)
180 #define AVG_PERF_COUNTER(cnt, sample) do {} while (0)
181 #define GET_PERF_COUNTER(cnt) (0)
182 #define GET_AVG_PERF_COUNTER(cnt) (0)
198 #define ROUNDUP_LOG2(x) ilog2(roundup_pow_of_two(x))
199 #define XNOR(x, y) (!(x) == !(y))
200 #define ILLEGAL_MAC(addr) (addr == 0xffffffffffffULL || addr == 0x0)
213 #define MLX4_EN_BIT_DESC_OWN 0x80000000
214 #define CTRL_SIZE sizeof(struct mlx4_wqe_ctrl_seg)
215 #define MLX4_EN_MEMTYPE_PAD 0x100
216 #define DS_SIZE sizeof(struct mlx4_wqe_data_seg)
228 #define MLX4_EN_USE_SRQ 0x01000000
230 #define MLX4_EN_CX3_LOW_ID 0x1000
231 #define MLX4_EN_CX3_HIGH_ID 0x1005
322 #define MLX4_EN_OPCODE_ERROR 0x1e
387 #define NUM_PKT_STATS 17
399 #define NUM_PORT_STATS 8
409 #define NUM_PERF_COUNTERS 6
434 #ifdef CONFIG_MLX4_EN_DCB
436 #define MLX4_EN_BW_MIN 1
437 #define MLX4_EN_BW_MAX 100
439 #define MLX4_EN_TC_ETS 7
494 #define MLX4_EN_FLAG_PROMISC 0x1
495 #define MLX4_EN_FLAG_MC_PROMISC 0x2
526 #ifdef CONFIG_MLX4_EN_DCB
530 #ifdef CONFIG_RFS_ACCEL
544 #define MLX4_EN_WOL_DO_MODIFY (1ULL << 63)
574 int cq,
int user_prio);
592 int is_tx,
int rss,
int qpn,
int cqn,
int user_prio,
612 #ifdef CONFIG_MLX4_EN_DCB
616 #ifdef CONFIG_RFS_ACCEL
621 #define MLX4_EN_NUM_SELF_TEST 5
640 #define en_dbg(mlevel, priv, format, arg...) \
642 if (NETIF_MSG_##mlevel & priv->msg_enable) \
643 en_print(KERN_DEBUG, priv, format, ##arg); \
645 #define en_warn(priv, format, arg...) \
646 en_print(KERN_WARNING, priv, format, ##arg)
647 #define en_err(priv, format, arg...) \
648 en_print(KERN_ERR, priv, format, ##arg)
649 #define en_info(priv, format, arg...) \
650 en_print(KERN_INFO, priv, format, ## arg)
652 #define mlx4_err(mdev, format, arg...) \
653 pr_err("%s %s: " format, DRV_NAME, \
654 dev_name(&mdev->pdev->dev), ##arg)
655 #define mlx4_info(mdev, format, arg...) \
656 pr_info("%s %s: " format, DRV_NAME, \
657 dev_name(&mdev->pdev->dev), ##arg)
658 #define mlx4_warn(mdev, format, arg...) \
659 pr_warning("%s %s: " format, DRV_NAME, \
660 dev_name(&mdev->pdev->dev), ##arg)