mlx4_en.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. /*
  2. * Copyright (c) 2007 Mellanox Technologies. All rights reserved.
  3. *
  4. * This software is available to you under a choice of one of two
  5. * licenses. You may choose to be licensed under the terms of the GNU
  6. * General Public License (GPL) Version 2, available from the file
  7. * COPYING in the main directory of this source tree, or the
  8. * OpenIB.org BSD license below:
  9. *
  10. * Redistribution and use in source and binary forms, with or
  11. * without modification, are permitted provided that the following
  12. * conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above
  15. * copyright notice, this list of conditions and the following
  16. * disclaimer.
  17. *
  18. * - Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and/or other materials
  21. * provided with the distribution.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. *
  32. */
  33. #ifndef _MLX4_EN_H_
  34. #define _MLX4_EN_H_
  35. #include <linux/compiler.h>
  36. #include <linux/list.h>
  37. #include <linux/mutex.h>
  38. #include <linux/netdevice.h>
  39. #include <linux/inet_lro.h>
  40. #include <linux/mlx4/device.h>
  41. #include <linux/mlx4/qp.h>
  42. #include <linux/mlx4/cq.h>
  43. #include <linux/mlx4/srq.h>
  44. #include <linux/mlx4/doorbell.h>
  45. #include "en_port.h"
  46. #define DRV_NAME "mlx4_en"
  47. #define DRV_VERSION "1.4.1.1"
  48. #define DRV_RELDATE "June 2009"
  49. #define MLX4_EN_MSG_LEVEL (NETIF_MSG_LINK | NETIF_MSG_IFDOWN)
  50. /*
  51. * Device constants
  52. */
  53. #define MLX4_EN_PAGE_SHIFT 12
  54. #define MLX4_EN_PAGE_SIZE (1 << MLX4_EN_PAGE_SHIFT)
  55. #define MAX_TX_RINGS 16
  56. #define MAX_RX_RINGS 16
  57. #define TXBB_SIZE 64
  58. #define HEADROOM (2048 / TXBB_SIZE + 1)
  59. #define STAMP_STRIDE 64
  60. #define STAMP_DWORDS (STAMP_STRIDE / 4)
  61. #define STAMP_SHIFT 31
  62. #define STAMP_VAL 0x7fffffff
  63. #define STATS_DELAY (HZ / 4)
  64. /* Typical TSO descriptor with 16 gather entries is 352 bytes... */
  65. #define MAX_DESC_SIZE 512
  66. #define MAX_DESC_TXBBS (MAX_DESC_SIZE / TXBB_SIZE)
  67. /*
  68. * OS related constants and tunables
  69. */
  70. #define MLX4_EN_WATCHDOG_TIMEOUT (15 * HZ)
  71. #define MLX4_EN_ALLOC_ORDER 2
  72. #define MLX4_EN_ALLOC_SIZE (PAGE_SIZE << MLX4_EN_ALLOC_ORDER)
  73. #define MLX4_EN_MAX_LRO_DESCRIPTORS 32
  74. /* Receive fragment sizes; we use at most 4 fragments (for 9600 byte MTU
  75. * and 4K allocations) */
  76. enum {
  77. FRAG_SZ0 = 512 - NET_IP_ALIGN,
  78. FRAG_SZ1 = 1024,
  79. FRAG_SZ2 = 4096,
  80. FRAG_SZ3 = MLX4_EN_ALLOC_SIZE
  81. };
  82. #define MLX4_EN_MAX_RX_FRAGS 4
  83. /* Maximum ring sizes */
  84. #define MLX4_EN_MAX_TX_SIZE 8192
  85. #define MLX4_EN_MAX_RX_SIZE 8192
  86. /* Minimum ring size for our page-allocation sceme to work */
  87. #define MLX4_EN_MIN_RX_SIZE (MLX4_EN_ALLOC_SIZE / SMP_CACHE_BYTES)
  88. #define MLX4_EN_MIN_TX_SIZE (4096 / TXBB_SIZE)
  89. #define MLX4_EN_SMALL_PKT_SIZE 64
  90. #define MLX4_EN_NUM_TX_RINGS 8
  91. #define MLX4_EN_NUM_PPP_RINGS 8
  92. #define MLX4_EN_DEF_TX_RING_SIZE 512
  93. #define MLX4_EN_DEF_RX_RING_SIZE 1024
  94. /* Target number of packets to coalesce with interrupt moderation */
  95. #define MLX4_EN_RX_COAL_TARGET 44
  96. #define MLX4_EN_RX_COAL_TIME 0x10
  97. #define MLX4_EN_TX_COAL_PKTS 5
  98. #define MLX4_EN_TX_COAL_TIME 0x80
  99. #define MLX4_EN_RX_RATE_LOW 400000
  100. #define MLX4_EN_RX_COAL_TIME_LOW 0
  101. #define MLX4_EN_RX_RATE_HIGH 450000
  102. #define MLX4_EN_RX_COAL_TIME_HIGH 128
  103. #define MLX4_EN_RX_SIZE_THRESH 1024
  104. #define MLX4_EN_RX_RATE_THRESH (1000000 / MLX4_EN_RX_COAL_TIME_HIGH)
  105. #define MLX4_EN_SAMPLE_INTERVAL 0
  106. #define MLX4_EN_AUTO_CONF 0xffff
  107. #define MLX4_EN_DEF_RX_PAUSE 1
  108. #define MLX4_EN_DEF_TX_PAUSE 1
  109. /* Interval between successive polls in the Tx routine when polling is used
  110. instead of interrupts (in per-core Tx rings) - should be power of 2 */
  111. #define MLX4_EN_TX_POLL_MODER 16
  112. #define MLX4_EN_TX_POLL_TIMEOUT (HZ / 4)
  113. #define ETH_LLC_SNAP_SIZE 8
  114. #define SMALL_PACKET_SIZE (256 - NET_IP_ALIGN)
  115. #define HEADER_COPY_SIZE (128 - NET_IP_ALIGN)
  116. #define MLX4_EN_MIN_MTU 46
  117. #define ETH_BCAST 0xffffffffffffULL
  118. #ifdef MLX4_EN_PERF_STAT
  119. /* Number of samples to 'average' */
  120. #define AVG_SIZE 128
  121. #define AVG_FACTOR 1024
  122. #define NUM_PERF_STATS NUM_PERF_COUNTERS
  123. #define INC_PERF_COUNTER(cnt) (++(cnt))
  124. #define ADD_PERF_COUNTER(cnt, add) ((cnt) += (add))
  125. #define AVG_PERF_COUNTER(cnt, sample) \
  126. ((cnt) = ((cnt) * (AVG_SIZE - 1) + (sample) * AVG_FACTOR) / AVG_SIZE)
  127. #define GET_PERF_COUNTER(cnt) (cnt)
  128. #define GET_AVG_PERF_COUNTER(cnt) ((cnt) / AVG_FACTOR)
  129. #else
  130. #define NUM_PERF_STATS 0
  131. #define INC_PERF_COUNTER(cnt) do {} while (0)
  132. #define ADD_PERF_COUNTER(cnt, add) do {} while (0)
  133. #define AVG_PERF_COUNTER(cnt, sample) do {} while (0)
  134. #define GET_PERF_COUNTER(cnt) (0)
  135. #define GET_AVG_PERF_COUNTER(cnt) (0)
  136. #endif /* MLX4_EN_PERF_STAT */
  137. /*
  138. * Configurables
  139. */
  140. enum cq_type {
  141. RX = 0,
  142. TX = 1,
  143. };
  144. /*
  145. * Useful macros
  146. */
  147. #define ROUNDUP_LOG2(x) ilog2(roundup_pow_of_two(x))
  148. #define XNOR(x, y) (!(x) == !(y))
  149. #define ILLEGAL_MAC(addr) (addr == 0xffffffffffffULL || addr == 0x0)
  150. struct mlx4_en_tx_info {
  151. struct sk_buff *skb;
  152. u32 nr_txbb;
  153. u8 linear;
  154. u8 data_offset;
  155. u8 inl;
  156. };
  157. #define MLX4_EN_BIT_DESC_OWN 0x80000000
  158. #define CTRL_SIZE sizeof(struct mlx4_wqe_ctrl_seg)
  159. #define MLX4_EN_MEMTYPE_PAD 0x100
  160. #define DS_SIZE sizeof(struct mlx4_wqe_data_seg)
  161. struct mlx4_en_tx_desc {
  162. struct mlx4_wqe_ctrl_seg ctrl;
  163. union {
  164. struct mlx4_wqe_data_seg data; /* at least one data segment */
  165. struct mlx4_wqe_lso_seg lso;
  166. struct mlx4_wqe_inline_seg inl;
  167. };
  168. };
  169. #define MLX4_EN_USE_SRQ 0x01000000
  170. struct mlx4_en_rx_alloc {
  171. struct page *page;
  172. u16 offset;
  173. };
  174. struct mlx4_en_tx_ring {
  175. struct mlx4_hwq_resources wqres;
  176. u32 size ; /* number of TXBBs */
  177. u32 size_mask;
  178. u16 stride;
  179. u16 cqn; /* index of port CQ associated with this ring */
  180. u32 prod;
  181. u32 cons;
  182. u32 buf_size;
  183. u32 doorbell_qpn;
  184. void *buf;
  185. u16 poll_cnt;
  186. int blocked;
  187. struct mlx4_en_tx_info *tx_info;
  188. u8 *bounce_buf;
  189. u32 last_nr_txbb;
  190. struct mlx4_qp qp;
  191. struct mlx4_qp_context context;
  192. int qpn;
  193. enum mlx4_qp_state qp_state;
  194. struct mlx4_srq dummy;
  195. unsigned long bytes;
  196. unsigned long packets;
  197. spinlock_t comp_lock;
  198. };
  199. struct mlx4_en_rx_desc {
  200. /* actual number of entries depends on rx ring stride */
  201. struct mlx4_wqe_data_seg data[0];
  202. };
  203. struct mlx4_en_rx_ring {
  204. struct mlx4_hwq_resources wqres;
  205. struct mlx4_en_rx_alloc page_alloc[MLX4_EN_MAX_RX_FRAGS];
  206. struct net_lro_mgr lro;
  207. u32 size ; /* number of Rx descs*/
  208. u32 actual_size;
  209. u32 size_mask;
  210. u16 stride;
  211. u16 log_stride;
  212. u16 cqn; /* index of port CQ associated with this ring */
  213. u32 prod;
  214. u32 cons;
  215. u32 buf_size;
  216. void *buf;
  217. void *rx_info;
  218. unsigned long bytes;
  219. unsigned long packets;
  220. };
  221. static inline int mlx4_en_can_lro(__be16 status)
  222. {
  223. return (status & cpu_to_be16(MLX4_CQE_STATUS_IPV4 |
  224. MLX4_CQE_STATUS_IPV4F |
  225. MLX4_CQE_STATUS_IPV6 |
  226. MLX4_CQE_STATUS_IPV4OPT |
  227. MLX4_CQE_STATUS_TCP |
  228. MLX4_CQE_STATUS_UDP |
  229. MLX4_CQE_STATUS_IPOK)) ==
  230. cpu_to_be16(MLX4_CQE_STATUS_IPV4 |
  231. MLX4_CQE_STATUS_IPOK |
  232. MLX4_CQE_STATUS_TCP);
  233. }
  234. struct mlx4_en_cq {
  235. struct mlx4_cq mcq;
  236. struct mlx4_hwq_resources wqres;
  237. int ring;
  238. spinlock_t lock;
  239. struct net_device *dev;
  240. struct napi_struct napi;
  241. /* Per-core Tx cq processing support */
  242. struct timer_list timer;
  243. int size;
  244. int buf_size;
  245. unsigned vector;
  246. enum cq_type is_tx;
  247. u16 moder_time;
  248. u16 moder_cnt;
  249. struct mlx4_cqe *buf;
  250. #define MLX4_EN_OPCODE_ERROR 0x1e
  251. };
  252. struct mlx4_en_port_profile {
  253. u32 flags;
  254. u32 tx_ring_num;
  255. u32 rx_ring_num;
  256. u32 tx_ring_size;
  257. u32 rx_ring_size;
  258. u8 rx_pause;
  259. u8 rx_ppp;
  260. u8 tx_pause;
  261. u8 tx_ppp;
  262. };
  263. struct mlx4_en_profile {
  264. int rss_xor;
  265. int num_lro;
  266. u8 rss_mask;
  267. u32 active_ports;
  268. u32 small_pkt_int;
  269. u8 no_reset;
  270. struct mlx4_en_port_profile prof[MLX4_MAX_PORTS + 1];
  271. };
  272. struct mlx4_en_dev {
  273. struct mlx4_dev *dev;
  274. struct pci_dev *pdev;
  275. struct mutex state_lock;
  276. struct net_device *pndev[MLX4_MAX_PORTS + 1];
  277. u32 port_cnt;
  278. bool device_up;
  279. struct mlx4_en_profile profile;
  280. u32 LSO_support;
  281. struct workqueue_struct *workqueue;
  282. struct device *dma_device;
  283. void __iomem *uar_map;
  284. struct mlx4_uar priv_uar;
  285. struct mlx4_mr mr;
  286. u32 priv_pdn;
  287. spinlock_t uar_lock;
  288. };
  289. struct mlx4_en_rss_map {
  290. int base_qpn;
  291. struct mlx4_qp qps[MAX_RX_RINGS];
  292. enum mlx4_qp_state state[MAX_RX_RINGS];
  293. struct mlx4_qp indir_qp;
  294. enum mlx4_qp_state indir_state;
  295. };
  296. struct mlx4_en_rss_context {
  297. __be32 base_qpn;
  298. __be32 default_qpn;
  299. u16 reserved;
  300. u8 hash_fn;
  301. u8 flags;
  302. __be32 rss_key[10];
  303. };
  304. struct mlx4_en_pkt_stats {
  305. unsigned long broadcast;
  306. unsigned long rx_prio[8];
  307. unsigned long tx_prio[8];
  308. #define NUM_PKT_STATS 17
  309. };
  310. struct mlx4_en_port_stats {
  311. unsigned long lro_aggregated;
  312. unsigned long lro_flushed;
  313. unsigned long lro_no_desc;
  314. unsigned long tso_packets;
  315. unsigned long queue_stopped;
  316. unsigned long wake_queue;
  317. unsigned long tx_timeout;
  318. unsigned long rx_alloc_failed;
  319. unsigned long rx_chksum_good;
  320. unsigned long rx_chksum_none;
  321. unsigned long tx_chksum_offload;
  322. #define NUM_PORT_STATS 11
  323. };
  324. struct mlx4_en_perf_stats {
  325. u32 tx_poll;
  326. u64 tx_pktsz_avg;
  327. u32 inflight_avg;
  328. u16 tx_coal_avg;
  329. u16 rx_coal_avg;
  330. u32 napi_quota;
  331. #define NUM_PERF_COUNTERS 6
  332. };
  333. struct mlx4_en_frag_info {
  334. u16 frag_size;
  335. u16 frag_prefix_size;
  336. u16 frag_stride;
  337. u16 frag_align;
  338. u16 last_offset;
  339. };
  340. struct mlx4_en_priv {
  341. struct mlx4_en_dev *mdev;
  342. struct mlx4_en_port_profile *prof;
  343. struct net_device *dev;
  344. struct vlan_group *vlgrp;
  345. struct net_device_stats stats;
  346. struct net_device_stats ret_stats;
  347. spinlock_t stats_lock;
  348. unsigned long last_moder_packets;
  349. unsigned long last_moder_tx_packets;
  350. unsigned long last_moder_bytes;
  351. unsigned long last_moder_jiffies;
  352. int last_moder_time;
  353. u16 rx_usecs;
  354. u16 rx_frames;
  355. u16 tx_usecs;
  356. u16 tx_frames;
  357. u32 pkt_rate_low;
  358. u16 rx_usecs_low;
  359. u32 pkt_rate_high;
  360. u16 rx_usecs_high;
  361. u16 sample_interval;
  362. u16 adaptive_rx_coal;
  363. u32 msg_enable;
  364. struct mlx4_hwq_resources res;
  365. int link_state;
  366. int last_link_state;
  367. bool port_up;
  368. int port;
  369. int registered;
  370. int allocated;
  371. int stride;
  372. int rx_csum;
  373. u64 mac;
  374. int mac_index;
  375. unsigned max_mtu;
  376. int base_qpn;
  377. struct mlx4_en_rss_map rss_map;
  378. u32 flags;
  379. #define MLX4_EN_FLAG_PROMISC 0x1
  380. u32 tx_ring_num;
  381. u32 rx_ring_num;
  382. u32 rx_skb_size;
  383. struct mlx4_en_frag_info frag_info[MLX4_EN_MAX_RX_FRAGS];
  384. u16 num_frags;
  385. u16 log_rx_info;
  386. struct mlx4_en_tx_ring tx_ring[MAX_TX_RINGS];
  387. struct mlx4_en_rx_ring rx_ring[MAX_RX_RINGS];
  388. struct mlx4_en_cq tx_cq[MAX_TX_RINGS];
  389. struct mlx4_en_cq rx_cq[MAX_RX_RINGS];
  390. struct work_struct mcast_task;
  391. struct work_struct mac_task;
  392. struct work_struct watchdog_task;
  393. struct work_struct linkstate_task;
  394. struct delayed_work stats_task;
  395. struct mlx4_en_perf_stats pstats;
  396. struct mlx4_en_pkt_stats pkstats;
  397. struct mlx4_en_port_stats port_stats;
  398. char *mc_addrs;
  399. int mc_addrs_cnt;
  400. struct mlx4_en_stat_out_mbox hw_stats;
  401. };
  402. void mlx4_en_destroy_netdev(struct net_device *dev);
  403. int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
  404. struct mlx4_en_port_profile *prof);
  405. int mlx4_en_start_port(struct net_device *dev);
  406. void mlx4_en_stop_port(struct net_device *dev);
  407. void mlx4_en_free_resources(struct mlx4_en_priv *priv);
  408. int mlx4_en_alloc_resources(struct mlx4_en_priv *priv);
  409. int mlx4_en_create_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
  410. int entries, int ring, enum cq_type mode);
  411. void mlx4_en_destroy_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq);
  412. int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq);
  413. void mlx4_en_deactivate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq);
  414. int mlx4_en_set_cq_moder(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq);
  415. int mlx4_en_arm_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq);
  416. void mlx4_en_poll_tx_cq(unsigned long data);
  417. void mlx4_en_tx_irq(struct mlx4_cq *mcq);
  418. u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb);
  419. netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev);
  420. int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, struct mlx4_en_tx_ring *ring,
  421. u32 size, u16 stride);
  422. void mlx4_en_destroy_tx_ring(struct mlx4_en_priv *priv, struct mlx4_en_tx_ring *ring);
  423. int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv,
  424. struct mlx4_en_tx_ring *ring,
  425. int cq);
  426. void mlx4_en_deactivate_tx_ring(struct mlx4_en_priv *priv,
  427. struct mlx4_en_tx_ring *ring);
  428. int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
  429. struct mlx4_en_rx_ring *ring,
  430. u32 size, u16 stride);
  431. void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv,
  432. struct mlx4_en_rx_ring *ring);
  433. int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv);
  434. void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv,
  435. struct mlx4_en_rx_ring *ring);
  436. int mlx4_en_process_rx_cq(struct net_device *dev,
  437. struct mlx4_en_cq *cq,
  438. int budget);
  439. int mlx4_en_poll_rx_cq(struct napi_struct *napi, int budget);
  440. void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride,
  441. int is_tx, int rss, int qpn, int cqn,
  442. struct mlx4_qp_context *context);
  443. void mlx4_en_sqp_event(struct mlx4_qp *qp, enum mlx4_event event);
  444. int mlx4_en_map_buffer(struct mlx4_buf *buf);
  445. void mlx4_en_unmap_buffer(struct mlx4_buf *buf);
  446. void mlx4_en_calc_rx_buf(struct net_device *dev);
  447. int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv);
  448. void mlx4_en_release_rss_steer(struct mlx4_en_priv *priv);
  449. int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring);
  450. void mlx4_en_rx_irq(struct mlx4_cq *mcq);
  451. int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode);
  452. int mlx4_SET_VLAN_FLTR(struct mlx4_dev *dev, u8 port, struct vlan_group *grp);
  453. int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu,
  454. u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx);
  455. int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
  456. u8 promisc);
  457. int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset);
  458. /*
  459. * Globals
  460. */
  461. extern const struct ethtool_ops mlx4_en_ethtool_ops;
  462. /*
  463. * printk / logging functions
  464. */
  465. int en_print(const char *level, const struct mlx4_en_priv *priv,
  466. const char *format, ...) __attribute__ ((format (printf, 3, 4)));
  467. #define en_dbg(mlevel, priv, format, arg...) \
  468. do { \
  469. if (NETIF_MSG_##mlevel & priv->msg_enable) \
  470. en_print(KERN_DEBUG, priv, format, ##arg); \
  471. } while (0)
  472. #define en_warn(priv, format, arg...) \
  473. en_print(KERN_WARNING, priv, format, ##arg)
  474. #define en_err(priv, format, arg...) \
  475. en_print(KERN_ERR, priv, format, ##arg)
  476. #define mlx4_err(mdev, format, arg...) \
  477. pr_err("%s %s: " format, DRV_NAME, \
  478. dev_name(&mdev->pdev->dev), ##arg)
  479. #define mlx4_info(mdev, format, arg...) \
  480. pr_info("%s %s: " format, DRV_NAME, \
  481. dev_name(&mdev->pdev->dev), ##arg)
  482. #define mlx4_warn(mdev, format, arg...) \
  483. pr_warning("%s %s: " format, DRV_NAME, \
  484. dev_name(&mdev->pdev->dev), ##arg)
  485. #endif