en.h 31.3 KB
Newer Older
1
/*
2
 * Copyright (c) 2015-2016, Mellanox Technologies. All rights reserved.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
 *
 * This software is available to you under a choice of one of two
 * licenses.  You may choose to be licensed under the terms of the GNU
 * General Public License (GPL) Version 2, available from the file
 * COPYING in the main directory of this source tree, or the
 * OpenIB.org BSD license below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer in the documentation and/or other materials
 *        provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
32 33
#ifndef __MLX5_EN_H__
#define __MLX5_EN_H__
34 35 36

#include <linux/if_vlan.h>
#include <linux/etherdevice.h>
37 38
#include <linux/timecounter.h>
#include <linux/net_tstamp.h>
39
#include <linux/ptp_clock_kernel.h>
40
#include <linux/crash_dump.h>
41 42 43
#include <linux/mlx5/driver.h>
#include <linux/mlx5/qp.h>
#include <linux/mlx5/cq.h>
44
#include <linux/mlx5/port.h>
45
#include <linux/mlx5/vport.h>
46
#include <linux/mlx5/transobj.h>
47
#include <linux/rhashtable.h>
48
#include <net/switchdev.h>
49 50
#include "wq.h"
#include "mlx5_core.h"
51
#include "en_stats.h"
52

53 54
#define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v)

55 56 57 58
#define MLX5E_ETH_HARD_MTU (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN)

#define MLX5E_HW2SW_MTU(priv, hwmtu) ((hwmtu) - ((priv)->hard_mtu))
#define MLX5E_SW2HW_MTU(priv, swmtu) ((swmtu) + ((priv)->hard_mtu))
59

60 61
#define MLX5E_MAX_NUM_TC	8

62
#define MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE                0x6
63 64 65
#define MLX5E_PARAMS_DEFAULT_LOG_SQ_SIZE                0xa
#define MLX5E_PARAMS_MAXIMUM_LOG_SQ_SIZE                0xd

66
#define MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE                0x1
67 68 69
#define MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE                0xa
#define MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE                0xd

70
#define MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE_MPW            0x1
71
#define MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE_MPW            0x3
72 73
#define MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE_MPW            0x6

74
#define MLX5_RX_HEADROOM NET_SKB_PAD
75 76
#define MLX5_SKB_FRAG_SZ(len)	(SKB_DATA_ALIGN(len) +	\
				 SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
77

78 79 80 81 82 83 84
#define MLX5_MPWRQ_MIN_LOG_STRIDE_SZ(mdev) \
	(6 + MLX5_CAP_GEN(mdev, cache_line_128byte)) /* HW restriction */
#define MLX5_MPWRQ_LOG_STRIDE_SZ(mdev, req) \
	max_t(u32, MLX5_MPWRQ_MIN_LOG_STRIDE_SZ(mdev), req)
#define MLX5_MPWRQ_DEF_LOG_STRIDE_SZ(mdev)       MLX5_MPWRQ_LOG_STRIDE_SZ(mdev, 6)
#define MLX5_MPWRQ_CQE_CMPRS_LOG_STRIDE_SZ(mdev) MLX5_MPWRQ_LOG_STRIDE_SZ(mdev, 8)

85
#define MLX5_MPWRQ_LOG_WQE_SZ			18
86 87 88 89 90
#define MLX5_MPWRQ_WQE_PAGE_ORDER  (MLX5_MPWRQ_LOG_WQE_SZ - PAGE_SHIFT > 0 ? \
				    MLX5_MPWRQ_LOG_WQE_SZ - PAGE_SHIFT : 0)
#define MLX5_MPWRQ_PAGES_PER_WQE		BIT(MLX5_MPWRQ_WQE_PAGE_ORDER)
#define MLX5_MPWRQ_STRIDES_PER_PAGE		(MLX5_MPWRQ_NUM_STRIDES >> \
						 MLX5_MPWRQ_WQE_PAGE_ORDER)
91 92

#define MLX5_MTT_OCTW(npages) (ALIGN(npages, 8) / 2)
T
Tariq Toukan 已提交
93 94 95
#define MLX5E_REQUIRED_MTTS(wqes)		\
	(wqes * ALIGN(MLX5_MPWRQ_PAGES_PER_WQE, 8))
#define MLX5E_VALID_NUM_MTTS(num_mtts) (MLX5_MTT_OCTW(num_mtts) - 1 <= U16_MAX)
96

97
#define MLX5_UMR_ALIGN				(2048)
98
#define MLX5_MPWRQ_SMALL_PACKET_THRESHOLD	(256)
99

A
Achiad Shochat 已提交
100
#define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ                 (64 * 1024)
101 102 103
#define MLX5E_DEFAULT_LRO_TIMEOUT                       32
#define MLX5E_LRO_TIMEOUT_ARR_SIZE                      4

104
#define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC      0x10
T
Tariq Toukan 已提交
105
#define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC_FROM_CQE 0x3
106 107 108 109
#define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_PKTS      0x20
#define MLX5E_PARAMS_DEFAULT_TX_CQ_MODERATION_USEC      0x10
#define MLX5E_PARAMS_DEFAULT_TX_CQ_MODERATION_PKTS      0x20
#define MLX5E_PARAMS_DEFAULT_MIN_RX_WQES                0x80
110
#define MLX5E_PARAMS_DEFAULT_MIN_RX_WQES_MPW            0x2
111

112 113
#define MLX5E_LOG_INDIR_RQT_SIZE       0x7
#define MLX5E_INDIR_RQT_SIZE           BIT(MLX5E_LOG_INDIR_RQT_SIZE)
114
#define MLX5E_MIN_NUM_CHANNELS         0x1
115
#define MLX5E_MAX_NUM_CHANNELS         (MLX5E_INDIR_RQT_SIZE >> 1)
116
#define MLX5E_MAX_NUM_SQS              (MLX5E_MAX_NUM_CHANNELS * MLX5E_MAX_NUM_TC)
117 118 119
#define MLX5E_TX_CQ_POLL_BUDGET        128
#define MLX5E_UPDATE_STATS_INTERVAL    200 /* msecs */

120 121 122
#define MLX5E_ICOSQ_MAX_WQEBBS \
	(DIV_ROUND_UP(sizeof(struct mlx5e_umr_wqe), MLX5_SEND_WQE_BB))

123 124
#define MLX5E_XDP_MIN_INLINE (ETH_HLEN + VLAN_HLEN)
#define MLX5E_XDP_TX_DS_COUNT \
125
	((sizeof(struct mlx5e_tx_wqe) / MLX5_SEND_WQE_DS) + 1 /* SG DS */)
126

127
#define MLX5E_NUM_MAIN_GROUPS 9
128

129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
static inline u16 mlx5_min_rx_wqes(int wq_type, u32 wq_size)
{
	switch (wq_type) {
	case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
		return min_t(u16, MLX5E_PARAMS_DEFAULT_MIN_RX_WQES_MPW,
			     wq_size / 2);
	default:
		return min_t(u16, MLX5E_PARAMS_DEFAULT_MIN_RX_WQES,
			     wq_size / 2);
	}
}

static inline int mlx5_min_log_rq_size(int wq_type)
{
	switch (wq_type) {
	case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
		return MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE_MPW;
	default:
		return MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE;
	}
}

static inline int mlx5_max_log_rq_size(int wq_type)
{
	switch (wq_type) {
	case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
		return MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE_MPW;
	default:
		return MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE;
	}
}

161 162 163 164 165 166 167 168
static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev)
{
	return is_kdump_kernel() ?
		MLX5E_MIN_NUM_CHANNELS :
		min_t(int, mdev->priv.eq_table.num_comp_vectors,
		      MLX5E_MAX_NUM_CHANNELS);
}

169 170 171 172 173 174 175 176 177
struct mlx5e_tx_wqe {
	struct mlx5_wqe_ctrl_seg ctrl;
	struct mlx5_wqe_eth_seg  eth;
};

struct mlx5e_rx_wqe {
	struct mlx5_wqe_srq_next_seg  next;
	struct mlx5_wqe_data_seg      data;
};
178

179 180 181 182 183 184 185
struct mlx5e_umr_wqe {
	struct mlx5_wqe_ctrl_seg       ctrl;
	struct mlx5_wqe_umr_ctrl_seg   uctrl;
	struct mlx5_mkey_seg           mkc;
	struct mlx5_wqe_data_seg       data;
};

186 187
extern const char mlx5e_self_tests[][ETH_GSTRING_LEN];

188
static const char mlx5e_priv_flags[][ETH_GSTRING_LEN] = {
T
Tariq Toukan 已提交
189
	"rx_cqe_moder",
190
	"rx_cqe_compress",
191 192 193
};

enum mlx5e_priv_flag {
T
Tariq Toukan 已提交
194
	MLX5E_PFLAG_RX_CQE_BASED_MODER = (1 << 0),
195
	MLX5E_PFLAG_RX_CQE_COMPRESS = (1 << 1),
196 197
};

198
#define MLX5E_SET_PFLAG(params, pflag, enable)			\
199 200
	do {							\
		if (enable)					\
201
			(params)->pflags |= (pflag);		\
202
		else						\
203
			(params)->pflags &= ~(pflag);		\
204 205
	} while (0)

206
#define MLX5E_GET_PFLAG(params, pflag) (!!((params)->pflags & (pflag)))
207

208 209 210 211
#ifdef CONFIG_MLX5_CORE_EN_DCB
#define MLX5E_MAX_BW_ALLOC 100 /* Max percentage of BW allocation */
#endif

T
Tariq Toukan 已提交
212 213 214 215 216
struct mlx5e_cq_moder {
	u16 usec;
	u16 pkts;
};

217 218
struct mlx5e_params {
	u8  log_sq_size;
219
	u8  rq_wq_type;
220
	u16 rq_headroom;
221 222
	u8  mpwqe_log_stride_sz;
	u8  mpwqe_log_num_strides;
223 224 225
	u8  log_rq_size;
	u16 num_channels;
	u8  num_tc;
T
Tariq Toukan 已提交
226
	u8  rx_cq_period_mode;
227
	bool rx_cqe_compress_def;
T
Tariq Toukan 已提交
228 229
	struct mlx5e_cq_moder rx_cq_moderation;
	struct mlx5e_cq_moder tx_cq_moderation;
230 231
	bool lro_en;
	u32 lro_wqe_sz;
232
	u16 tx_max_inline;
233
	u8  tx_min_inline_mode;
234 235 236
	u8  rss_hfunc;
	u8  toeplitz_hash_key[40];
	u32 indirection_rqt[MLX5E_INDIR_RQT_SIZE];
237
	bool vlan_strip_disable;
238
	bool scatter_fcs_en;
239
	bool rx_am_enabled;
240
	u32 lro_timeout;
241
	u32 pflags;
242
	struct bpf_prog *xdp_prog;
243 244
};

H
Huy Nguyen 已提交
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
#ifdef CONFIG_MLX5_CORE_EN_DCB
struct mlx5e_cee_config {
	/* bw pct for priority group */
	u8                         pg_bw_pct[CEE_DCBX_MAX_PGS];
	u8                         prio_to_pg_map[CEE_DCBX_MAX_PRIO];
	bool                       pfc_setting[CEE_DCBX_MAX_PRIO];
	bool                       pfc_enable;
};

enum {
	MLX5_DCB_CHG_RESET,
	MLX5_DCB_NO_CHG,
	MLX5_DCB_CHG_NO_RESET,
};

struct mlx5e_dcbx {
261
	enum mlx5_dcbx_oper_mode   mode;
H
Huy Nguyen 已提交
262
	struct mlx5e_cee_config    cee_cfg; /* pending configuration */
263 264 265

	/* The only setting that cannot be read from FW */
	u8                         tc_tsa[IEEE_8021QAZ_MAX_TCS];
H
Huy Nguyen 已提交
266 267 268
};
#endif

269 270 271 272 273 274 275 276 277
struct mlx5e_tstamp {
	rwlock_t                   lock;
	struct cyclecounter        cycles;
	struct timecounter         clock;
	struct hwtstamp_config     hwtstamp_config;
	u32                        nominal_c_mult;
	unsigned long              overflow_period;
	struct delayed_work        overflow_work;
	struct mlx5_core_dev      *mdev;
278 279
	struct ptp_clock          *ptp;
	struct ptp_clock_info      ptp_info;
280
	u8                        *pps_pin_caps;
281 282
};

283
enum {
284
	MLX5E_RQ_STATE_ENABLED,
285
	MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS,
286
	MLX5E_RQ_STATE_AM,
287 288 289 290 291 292 293
};

struct mlx5e_cq {
	/* data path - accessed per cqe */
	struct mlx5_cqwq           wq;

	/* data path - accessed per napi poll */
294
	u16                        event_ctr;
295 296 297 298
	struct napi_struct        *napi;
	struct mlx5_core_cq        mcq;
	struct mlx5e_channel      *channel;

T
Tariq Toukan 已提交
299 300 301 302 303 304 305
	/* cqe decompression */
	struct mlx5_cqe64          title;
	struct mlx5_mini_cqe8      mini_arr[MLX5_MINI_CQE_ARRAY_SIZE];
	u8                         mini_arr_idx;
	u16                        decmprs_left;
	u16                        decmprs_wqe_counter;

306
	/* control */
307
	struct mlx5_core_dev      *mdev;
308
	struct mlx5_frag_wq_ctrl   wq_ctrl;
309 310
} ____cacheline_aligned_in_smp;

311
struct mlx5e_tx_wqe_info {
S
Saeed Mahameed 已提交
312
	struct sk_buff *skb;
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
	u32 num_bytes;
	u8  num_wqebbs;
	u8  num_dma;
};

enum mlx5e_dma_map_type {
	MLX5E_DMA_MAP_SINGLE,
	MLX5E_DMA_MAP_PAGE
};

struct mlx5e_sq_dma {
	dma_addr_t              addr;
	u32                     size;
	enum mlx5e_dma_map_type type;
};

enum {
	MLX5E_SQ_STATE_ENABLED,
};

struct mlx5e_sq_wqe_info {
	u8  opcode;
	u8  num_wqebbs;
};
337

S
Saeed Mahameed 已提交
338
struct mlx5e_txqsq {
339 340 341 342 343 344 345 346 347 348 349 350 351
	/* data path */

	/* dirtied @completion */
	u16                        cc;
	u32                        dma_fifo_cc;

	/* dirtied @xmit */
	u16                        pc ____cacheline_aligned_in_smp;
	u32                        dma_fifo_pc;
	struct mlx5e_sq_stats      stats;

	struct mlx5e_cq            cq;

S
Saeed Mahameed 已提交
352 353 354 355
	/* write@xmit, read@completion */
	struct {
		struct mlx5e_sq_dma       *dma_fifo;
		struct mlx5e_tx_wqe_info  *wqe_info;
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
	} db;

	/* read only */
	struct mlx5_wq_cyc         wq;
	u32                        dma_fifo_mask;
	void __iomem              *uar_map;
	struct netdev_queue       *txq;
	u32                        sqn;
	u16                        max_inline;
	u8                         min_inline_mode;
	u16                        edge;
	struct device             *pdev;
	struct mlx5e_tstamp       *tstamp;
	__be32                     mkey_be;
	unsigned long              state;

	/* control path */
	struct mlx5_wq_ctrl        wq_ctrl;
	struct mlx5e_channel      *channel;
375
	int                        txq_ix;
376
	u32                        rate_limit;
S
Saeed Mahameed 已提交
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437
} ____cacheline_aligned_in_smp;

struct mlx5e_xdpsq {
	/* data path */

	/* dirtied @rx completion */
	u16                        cc;
	u16                        pc;

	struct mlx5e_cq            cq;

	/* write@xmit, read@completion */
	struct {
		struct mlx5e_dma_info     *di;
		bool                       doorbell;
	} db;

	/* read only */
	struct mlx5_wq_cyc         wq;
	void __iomem              *uar_map;
	u32                        sqn;
	struct device             *pdev;
	__be32                     mkey_be;
	u8                         min_inline_mode;
	unsigned long              state;

	/* control path */
	struct mlx5_wq_ctrl        wq_ctrl;
	struct mlx5e_channel      *channel;
} ____cacheline_aligned_in_smp;

struct mlx5e_icosq {
	/* data path */

	/* dirtied @completion */
	u16                        cc;

	/* dirtied @xmit */
	u16                        pc ____cacheline_aligned_in_smp;
	u32                        dma_fifo_pc;
	u16                        prev_cc;

	struct mlx5e_cq            cq;

	/* write@xmit, read@completion */
	struct {
		struct mlx5e_sq_wqe_info *ico_wqe;
	} db;

	/* read only */
	struct mlx5_wq_cyc         wq;
	void __iomem              *uar_map;
	u32                        sqn;
	u16                        edge;
	struct device             *pdev;
	__be32                     mkey_be;
	unsigned long              state;

	/* control path */
	struct mlx5_wq_ctrl        wq_ctrl;
	struct mlx5e_channel      *channel;
438 439
} ____cacheline_aligned_in_smp;

440 441
static inline bool
mlx5e_wqc_has_room_for(struct mlx5_wq_cyc *wq, u16 cc, u16 pc, u16 n)
442
{
443
	return (((wq->sz_m1 & (cc - pc)) >= n) || (cc == pc));
444
}
445

446 447 448 449 450
struct mlx5e_dma_info {
	struct page	*page;
	dma_addr_t	addr;
};

451 452 453 454 455 456 457 458 459 460 461 462 463
struct mlx5e_umr_dma_info {
	__be64                *mtt;
	dma_addr_t             mtt_addr;
	struct mlx5e_dma_info  dma_info[MLX5_MPWRQ_PAGES_PER_WQE];
	struct mlx5e_umr_wqe   wqe;
};

struct mlx5e_mpw_info {
	struct mlx5e_umr_dma_info umr;
	u16 consumed_strides;
	u16 skbs_frags[MLX5_MPWRQ_PAGES_PER_WQE];
};

464 465
struct mlx5e_rx_am_stats {
	int ppms; /* packets per msec */
466
	int bpms; /* bytes per msec */
467 468 469 470
	int epms; /* events per msec */
};

struct mlx5e_rx_am_sample {
471 472 473 474
	ktime_t	time;
	u32	pkt_ctr;
	u32	byte_ctr;
	u16	event_ctr;
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489
};

struct mlx5e_rx_am { /* Adaptive Moderation */
	u8					state;
	struct mlx5e_rx_am_stats		prev_stats;
	struct mlx5e_rx_am_sample		start_sample;
	struct work_struct			work;
	u8					profile_ix;
	u8					mode;
	u8					tune_state;
	u8					steps_right;
	u8					steps_left;
	u8					tired;
};

490 491 492 493 494 495 496 497 498 499 500 501
/* a single cache unit is capable to serve one napi call (for non-striding rq)
 * or a MPWQE (for striding rq).
 */
#define MLX5E_CACHE_UNIT	(MLX5_MPWRQ_PAGES_PER_WQE > NAPI_POLL_WEIGHT ? \
				 MLX5_MPWRQ_PAGES_PER_WQE : NAPI_POLL_WEIGHT)
#define MLX5E_CACHE_SIZE	(2 * roundup_pow_of_two(MLX5E_CACHE_UNIT))
struct mlx5e_page_cache {
	u32 head;
	u32 tail;
	struct mlx5e_dma_info page_cache[MLX5E_CACHE_SIZE];
};

502 503 504 505 506
struct mlx5e_rq;
typedef void (*mlx5e_fp_handle_rx_cqe)(struct mlx5e_rq*, struct mlx5_cqe64*);
typedef int (*mlx5e_fp_alloc_wqe)(struct mlx5e_rq*, struct mlx5e_rx_wqe*, u16);
typedef void (*mlx5e_fp_dealloc_wqe)(struct mlx5e_rq*, u16);

507 508 509
struct mlx5e_rq {
	/* data path */
	struct mlx5_wq_ll      wq;
510

511 512 513 514 515 516 517
	union {
		struct mlx5e_dma_info *dma_info;
		struct {
			struct mlx5e_mpw_info *info;
			void                  *mtt_no_align;
		} mpwqe;
	};
518 519 520
	struct {
		u8             page_order;
		u32            wqe_sz;    /* wqe data buffer size */
521
		u8             map_dir;   /* dma map direction */
522
	} buff;
523
	__be32                 mkey_be;
524 525 526

	struct device         *pdev;
	struct net_device     *netdev;
527
	struct mlx5e_tstamp   *tstamp;
528 529
	struct mlx5e_rq_stats  stats;
	struct mlx5e_cq        cq;
530 531
	struct mlx5e_page_cache page_cache;

532 533
	mlx5e_fp_handle_rx_cqe handle_rx_cqe;
	mlx5e_fp_alloc_wqe     alloc_wqe;
534
	mlx5e_fp_dealloc_wqe   dealloc_wqe;
535 536 537

	unsigned long          state;
	int                    ix;
538
	u16                    rx_headroom;
539

540
	struct mlx5e_rx_am     am; /* Adaptive Moderation */
541 542

	/* XDP */
543
	struct bpf_prog       *xdp_prog;
S
Saeed Mahameed 已提交
544
	struct mlx5e_xdpsq     xdpsq;
545

546 547
	/* control */
	struct mlx5_wq_ctrl    wq_ctrl;
548
	u8                     wq_type;
549 550
	u32                    mpwqe_stride_sz;
	u32                    mpwqe_num_strides;
551 552
	u32                    rqn;
	struct mlx5e_channel  *channel;
553
	struct mlx5_core_dev  *mdev;
T
Tariq Toukan 已提交
554
	struct mlx5_core_mkey  umr_mkey;
555 556 557 558 559 560 561 562 563
} ____cacheline_aligned_in_smp;

enum channel_flags {
	MLX5E_CHANNEL_NAPI_SCHED = 1,
};

struct mlx5e_channel {
	/* data path */
	struct mlx5e_rq            rq;
S
Saeed Mahameed 已提交
564 565
	struct mlx5e_txqsq         sq[MLX5E_MAX_NUM_TC];
	struct mlx5e_icosq         icosq;   /* internal control operations */
566
	bool                       xdp;
567 568 569 570 571 572 573 574 575
	struct napi_struct         napi;
	struct device             *pdev;
	struct net_device         *netdev;
	__be32                     mkey_be;
	u8                         num_tc;
	unsigned long              flags;

	/* control */
	struct mlx5e_priv         *priv;
576 577
	struct mlx5_core_dev      *mdev;
	struct mlx5e_tstamp       *tstamp;
578 579 580 581
	int                        ix;
	int                        cpu;
};

582 583 584
struct mlx5e_channels {
	struct mlx5e_channel **c;
	unsigned int           num;
585
	struct mlx5e_params    params;
586 587
};

588
enum mlx5e_traffic_types {
589 590 591 592
	MLX5E_TT_IPV4_TCP,
	MLX5E_TT_IPV6_TCP,
	MLX5E_TT_IPV4_UDP,
	MLX5E_TT_IPV6_UDP,
593 594 595 596
	MLX5E_TT_IPV4_IPSEC_AH,
	MLX5E_TT_IPV6_IPSEC_AH,
	MLX5E_TT_IPV4_IPSEC_ESP,
	MLX5E_TT_IPV6_IPSEC_ESP,
597 598 599 600
	MLX5E_TT_IPV4,
	MLX5E_TT_IPV6,
	MLX5E_TT_ANY,
	MLX5E_NUM_TT,
T
Tariq Toukan 已提交
601
	MLX5E_NUM_INDIR_TIRS = MLX5E_TT_ANY,
602 603
};

604
enum {
605
	MLX5E_STATE_ASYNC_EVENTS_ENABLED,
606 607 608 609 610 611 612 613 614
	MLX5E_STATE_OPENED,
	MLX5E_STATE_DESTROYING,
};

struct mlx5e_vxlan_db {
	spinlock_t			lock; /* protect vxlan table */
	struct radix_tree_root		tree;
};

615
struct mlx5e_l2_rule {
616
	u8  addr[ETH_ALEN + 2];
M
Mark Bloch 已提交
617
	struct mlx5_flow_handle *rule;
618 619
};

620 621 622 623 624 625
struct mlx5e_flow_table {
	int num_groups;
	struct mlx5_flow_table *t;
	struct mlx5_flow_group **g;
};

626
#define MLX5E_L2_ADDR_HASH_SIZE BIT(BITS_PER_BYTE)
627

628 629 630 631 632
struct mlx5e_tc_table {
	struct mlx5_flow_table		*t;

	struct rhashtable_params        ht_params;
	struct rhashtable               ht;
633 634

	DECLARE_HASHTABLE(mod_hdr_tbl, 8);
635 636
};

637 638
struct mlx5e_vlan_table {
	struct mlx5e_flow_table		ft;
639
	unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
M
Mark Bloch 已提交
640 641
	struct mlx5_flow_handle	*active_vlans_rule[VLAN_N_VID];
	struct mlx5_flow_handle	*untagged_rule;
642 643 644
	struct mlx5_flow_handle	*any_cvlan_rule;
	struct mlx5_flow_handle	*any_svlan_rule;
	bool			filter_disabled;
645 646
};

647 648 649 650 651 652 653 654 655 656 657 658 659 660 661
struct mlx5e_l2_table {
	struct mlx5e_flow_table    ft;
	struct hlist_head          netdev_uc[MLX5E_L2_ADDR_HASH_SIZE];
	struct hlist_head          netdev_mc[MLX5E_L2_ADDR_HASH_SIZE];
	struct mlx5e_l2_rule	   broadcast;
	struct mlx5e_l2_rule	   allmulti;
	struct mlx5e_l2_rule	   promisc;
	bool                       broadcast_enabled;
	bool                       allmulti_enabled;
	bool                       promisc_enabled;
};

/* L3/L4 traffic type classifier */
struct mlx5e_ttc_table {
	struct mlx5e_flow_table  ft;
M
Mark Bloch 已提交
662
	struct mlx5_flow_handle	 *rules[MLX5E_NUM_TT];
663 664
};

665 666
#define ARFS_HASH_SHIFT BITS_PER_BYTE
#define ARFS_HASH_SIZE BIT(BITS_PER_BYTE)
667 668
struct arfs_table {
	struct mlx5e_flow_table  ft;
M
Mark Bloch 已提交
669
	struct mlx5_flow_handle	 *default_rule;
670
	struct hlist_head	 rules_hash[ARFS_HASH_SIZE];
671 672 673 674 675 676 677 678 679 680 681 682
};

enum  arfs_type {
	ARFS_IPV4_TCP,
	ARFS_IPV6_TCP,
	ARFS_IPV4_UDP,
	ARFS_IPV6_UDP,
	ARFS_NUM_TYPES,
};

struct mlx5e_arfs_tables {
	struct arfs_table arfs_tables[ARFS_NUM_TYPES];
683 684 685 686 687
	/* Protect aRFS rules list */
	spinlock_t                     arfs_lock;
	struct list_head               rules;
	int                            last_filter_id;
	struct workqueue_struct        *wq;
688 689 690 691 692 693 694 695 696 697
};

/* NIC prio FTS */
enum {
	MLX5E_VLAN_FT_LEVEL = 0,
	MLX5E_L2_FT_LEVEL,
	MLX5E_TTC_FT_LEVEL,
	MLX5E_ARFS_FT_LEVEL
};

698 699 700 701 702
struct mlx5e_ethtool_table {
	struct mlx5_flow_table *ft;
	int                    num_rules;
};

703
#define ETHTOOL_NUM_L3_L4_FTS 7
704 705 706
#define ETHTOOL_NUM_L2_FTS 4

struct mlx5e_ethtool_steering {
707
	struct mlx5e_ethtool_table      l3_l4_ft[ETHTOOL_NUM_L3_L4_FTS];
708 709 710 711 712
	struct mlx5e_ethtool_table      l2_ft[ETHTOOL_NUM_L2_FTS];
	struct list_head                rules;
	int                             tot_num_rules;
};

713 714
struct mlx5e_flow_steering {
	struct mlx5_flow_namespace      *ns;
715
	struct mlx5e_ethtool_steering   ethtool;
716 717
	struct mlx5e_tc_table           tc;
	struct mlx5e_vlan_table         vlan;
718 719
	struct mlx5e_l2_table           l2;
	struct mlx5e_ttc_table          ttc;
720
	struct mlx5e_arfs_tables        arfs;
721 722
};

723
struct mlx5e_rqt {
T
Tariq Toukan 已提交
724
	u32              rqtn;
725 726 727 728 729 730 731
	bool		 enabled;
};

struct mlx5e_tir {
	u32		  tirn;
	struct mlx5e_rqt  rqt;
	struct list_head  list;
T
Tariq Toukan 已提交
732 733
};

734 735 736 737 738
enum {
	MLX5E_TC_PRIO = 0,
	MLX5E_NIC_PRIO
};

739 740
struct mlx5e_priv {
	/* priv data path fields - start */
741 742
	struct mlx5e_txqsq *txq2sq[MLX5E_MAX_NUM_CHANNELS * MLX5E_MAX_NUM_TC];
	int channel_tc2txq[MLX5E_MAX_NUM_CHANNELS][MLX5E_MAX_NUM_TC];
743 744 745 746
	/* priv data path fields - end */

	unsigned long              state;
	struct mutex               state_lock; /* Protects Interface state */
747
	struct mlx5e_rq            drop_rq;
748

749
	struct mlx5e_channels      channels;
750
	u32                        tisn[MLX5E_MAX_NUM_TC];
751
	struct mlx5e_rqt           indir_rqt;
752 753
	struct mlx5e_tir           indir_tir[MLX5E_NUM_INDIR_TIRS];
	struct mlx5e_tir           direct_tir[MLX5E_MAX_NUM_CHANNELS];
754
	u32                        tx_rates[MLX5E_MAX_NUM_SQS];
755
	int                        hard_mtu;
756

757
	struct mlx5e_flow_steering fs;
758
	struct mlx5e_vxlan_db      vxlan;
759

760
	struct workqueue_struct    *wq;
761 762
	struct work_struct         update_carrier_work;
	struct work_struct         set_rx_mode_work;
763
	struct work_struct         tx_timeout_work;
764 765 766 767 768
	struct delayed_work        update_stats_work;

	struct mlx5_core_dev      *mdev;
	struct net_device         *netdev;
	struct mlx5e_stats         stats;
769
	struct mlx5e_tstamp        tstamp;
770
	u16 q_counter;
H
Huy Nguyen 已提交
771 772 773 774
#ifdef CONFIG_MLX5_CORE_EN_DCB
	struct mlx5e_dcbx          dcbx;
#endif

775
	const struct mlx5e_profile *profile;
776
	void                      *ppriv;
777 778
};

779 780 781 782 783 784 785 786 787 788 789 790
struct mlx5e_profile {
	void	(*init)(struct mlx5_core_dev *mdev,
			struct net_device *netdev,
			const struct mlx5e_profile *profile, void *ppriv);
	void	(*cleanup)(struct mlx5e_priv *priv);
	int	(*init_rx)(struct mlx5e_priv *priv);
	void	(*cleanup_rx)(struct mlx5e_priv *priv);
	int	(*init_tx)(struct mlx5e_priv *priv);
	void	(*cleanup_tx)(struct mlx5e_priv *priv);
	void	(*enable)(struct mlx5e_priv *priv);
	void	(*disable)(struct mlx5e_priv *priv);
	void	(*update_stats)(struct mlx5e_priv *priv);
791
	void	(*update_carrier)(struct mlx5e_priv *priv);
792
	int	(*max_nch)(struct mlx5_core_dev *mdev);
793 794 795 796
	struct {
		mlx5e_fp_handle_rx_cqe handle_rx_cqe;
		mlx5e_fp_handle_rx_cqe handle_rx_cqe_mpwqe;
	} rx_handlers;
797 798 799
	int	max_tc;
};

800 801
void mlx5e_build_ptys2ethtool_map(void);

802 803 804 805 806 807 808
u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb,
		       void *accel_priv, select_queue_fallback_t fallback);
netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev);

void mlx5e_completion_event(struct mlx5_core_cq *mcq);
void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, enum mlx5_event event);
int mlx5e_napi_poll(struct napi_struct *napi, int budget);
809
bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget);
E
Eric Dumazet 已提交
810
int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget);
811
bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq);
S
Saeed Mahameed 已提交
812 813
void mlx5e_free_txqsq_descs(struct mlx5e_txqsq *sq);
void mlx5e_free_xdpsq_descs(struct mlx5e_xdpsq *sq);
814

815 816
void mlx5e_page_release(struct mlx5e_rq *rq, struct mlx5e_dma_info *dma_info,
			bool recycle);
817
void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe);
818
void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe);
819
bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq);
820
int mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix);
821
int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe,	u16 ix);
822 823
void mlx5e_dealloc_rx_wqe(struct mlx5e_rq *rq, u16 ix);
void mlx5e_dealloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix);
824 825
void mlx5e_post_rx_mpwqe(struct mlx5e_rq *rq);
void mlx5e_free_rx_mpwqe(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi);
826 827
struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq);

828 829 830 831
void mlx5e_rx_am(struct mlx5e_rq *rq);
void mlx5e_rx_am_work(struct work_struct *work);
struct mlx5e_cq_moder mlx5e_am_get_def_profile(u8 rx_cq_period_mode);

832
void mlx5e_update_stats(struct mlx5e_priv *priv, bool full);
833

834 835
int mlx5e_create_flow_steering(struct mlx5e_priv *priv);
void mlx5e_destroy_flow_steering(struct mlx5e_priv *priv);
836
void mlx5e_init_l2_addr(struct mlx5e_priv *priv);
837
void mlx5e_destroy_flow_table(struct mlx5e_flow_table *ft);
838 839 840
int mlx5e_self_test_num(struct mlx5e_priv *priv);
void mlx5e_self_test(struct net_device *ndev, struct ethtool_test *etest,
		     u64 *buf);
841 842 843 844
int mlx5e_ethtool_get_flow(struct mlx5e_priv *priv, struct ethtool_rxnfc *info,
			   int location);
int mlx5e_ethtool_get_all_flows(struct mlx5e_priv *priv,
				struct ethtool_rxnfc *info, u32 *rule_locs);
845 846 847 848 849 850
int mlx5e_ethtool_flow_replace(struct mlx5e_priv *priv,
			       struct ethtool_rx_flow_spec *fs);
int mlx5e_ethtool_flow_remove(struct mlx5e_priv *priv,
			      int location);
void mlx5e_ethtool_init_steering(struct mlx5e_priv *priv);
void mlx5e_ethtool_cleanup_steering(struct mlx5e_priv *priv);
851 852
void mlx5e_set_rx_mode_work(struct work_struct *work);

853 854 855 856
void mlx5e_fill_hwstamp(struct mlx5e_tstamp *clock, u64 timestamp,
			struct skb_shared_hwtstamps *hwts);
void mlx5e_timestamp_init(struct mlx5e_priv *priv);
void mlx5e_timestamp_cleanup(struct mlx5e_priv *priv);
857 858
void mlx5e_pps_event_handler(struct mlx5e_priv *priv,
			     struct ptp_clock_event *event);
859 860
int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr);
int mlx5e_hwstamp_get(struct mlx5e_priv *priv, struct ifreq *ifr);
861
int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool val);
862

863 864 865 866 867 868 869
int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto,
			  u16 vid);
int mlx5e_vlan_rx_kill_vid(struct net_device *dev, __always_unused __be16 proto,
			   u16 vid);
void mlx5e_enable_vlan_filter(struct mlx5e_priv *priv);
void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv);

870 871 872 873 874 875 876 877 878 879 880 881 882
struct mlx5e_redirect_rqt_param {
	bool is_rss;
	union {
		u32 rqn; /* Direct RQN (Non-RSS) */
		struct {
			u8 hfunc;
			struct mlx5e_channels *channels;
		} rss; /* RSS data */
	};
};

int mlx5e_redirect_rqt(struct mlx5e_priv *priv, u32 rqtn, int sz,
		       struct mlx5e_redirect_rqt_param rrp);
883 884 885
void mlx5e_build_indir_tir_ctx_hash(struct mlx5e_params *params,
				    enum mlx5e_traffic_types tt,
				    void *tirc);
886

887 888
int mlx5e_open_locked(struct net_device *netdev);
int mlx5e_close_locked(struct net_device *netdev);
889 890 891 892

int mlx5e_open_channels(struct mlx5e_priv *priv,
			struct mlx5e_channels *chs);
void mlx5e_close_channels(struct mlx5e_channels *chs);
893 894 895 896 897

/* Function pointer to be used to modify WH settings while
 * switching channels
 */
typedef int (*mlx5e_fp_hw_modify)(struct mlx5e_priv *priv);
898
void mlx5e_switch_priv_channels(struct mlx5e_priv *priv,
899 900
				struct mlx5e_channels *new_chs,
				mlx5e_fp_hw_modify hw_modify);
901 902
void mlx5e_activate_priv_channels(struct mlx5e_priv *priv);
void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv);
903

904 905
void mlx5e_build_default_indir_rqt(struct mlx5_core_dev *mdev,
				   u32 *indirection_rqt, int len,
906
				   int num_channels);
907
int mlx5e_get_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed);
908

T
Tariq Toukan 已提交
909 910
void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params,
				 u8 cq_period_mode);
911 912
void mlx5e_set_rq_type_params(struct mlx5_core_dev *mdev,
			      struct mlx5e_params *params, u8 rq_type);
T
Tariq Toukan 已提交
913

914 915
static inline
struct mlx5e_tx_wqe *mlx5e_post_nop(struct mlx5_wq_cyc *wq, u32 sqn, u16 *pc)
916
{
917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936
	u16                         pi   = *pc & wq->sz_m1;
	struct mlx5e_tx_wqe        *wqe  = mlx5_wq_cyc_get_wqe(wq, pi);
	struct mlx5_wqe_ctrl_seg   *cseg = &wqe->ctrl;

	memset(cseg, 0, sizeof(*cseg));

	cseg->opmod_idx_opcode = cpu_to_be32((*pc << 8) | MLX5_OPCODE_NOP);
	cseg->qpn_ds           = cpu_to_be32((sqn << 8) | 0x01);

	(*pc)++;

	return wqe;
}

static inline
void mlx5e_notify_hw(struct mlx5_wq_cyc *wq, u16 pc,
		     void __iomem *uar_map,
		     struct mlx5_wqe_ctrl_seg *ctrl)
{
	ctrl->fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE;
937 938 939
	/* ensure wqe is visible to device before updating doorbell record */
	dma_wmb();

940
	*wq->db = cpu_to_be32(pc);
941 942 943 944 945 946

	/* ensure doorbell record is visible to device before ringing the
	 * doorbell
	 */
	wmb();

947
	mlx5_write64((__be32 *)ctrl, uar_map, NULL);
948 949 950 951 952 953 954
}

static inline void mlx5e_cq_arm(struct mlx5e_cq *cq)
{
	struct mlx5_core_cq *mcq;

	mcq = &cq->mcq;
955
	mlx5_cq_arm(mcq, MLX5_CQ_DB_REQ_NOT, mcq->uar->map, cq->wq.cc);
956 957
}

958 959
static inline u32 mlx5e_get_wqe_mtt_offset(struct mlx5e_rq *rq, u16 wqe_ix)
{
T
Tariq Toukan 已提交
960
	return wqe_ix * ALIGN(MLX5_MPWRQ_PAGES_PER_WQE, 8);
961 962
}

963
extern const struct ethtool_ops mlx5e_ethtool_ops;
964 965 966
#ifdef CONFIG_MLX5_CORE_EN_DCB
extern const struct dcbnl_rtnl_ops mlx5e_dcbnl_ops;
int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets);
967
void mlx5e_dcbnl_initialize(struct mlx5e_priv *priv);
968 969
#endif

970 971 972 973 974 975 976
#ifndef CONFIG_RFS_ACCEL
static inline int mlx5e_arfs_create_tables(struct mlx5e_priv *priv)
{
	return 0;
}

static inline void mlx5e_arfs_destroy_tables(struct mlx5e_priv *priv) {}
977 978 979

static inline int mlx5e_arfs_enable(struct mlx5e_priv *priv)
{
980
	return -EOPNOTSUPP;
981 982 983 984
}

static inline int mlx5e_arfs_disable(struct mlx5e_priv *priv)
{
985
	return -EOPNOTSUPP;
986
}
987 988 989
#else
int mlx5e_arfs_create_tables(struct mlx5e_priv *priv);
void mlx5e_arfs_destroy_tables(struct mlx5e_priv *priv);
990 991
int mlx5e_arfs_enable(struct mlx5e_priv *priv);
int mlx5e_arfs_disable(struct mlx5e_priv *priv);
992 993
int mlx5e_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
			u16 rxq_index, u32 flow_id);
994 995
#endif

996
u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev);
997 998 999 1000
int mlx5e_create_tir(struct mlx5_core_dev *mdev,
		     struct mlx5e_tir *tir, u32 *in, int inlen);
void mlx5e_destroy_tir(struct mlx5_core_dev *mdev,
		       struct mlx5e_tir *tir);
1001 1002
int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev);
void mlx5e_destroy_mdev_resources(struct mlx5_core_dev *mdev);
1003
int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb);
1004

1005
/* common netdev helpers */
1006 1007 1008 1009 1010
int mlx5e_create_indirect_rqt(struct mlx5e_priv *priv);

int mlx5e_create_indirect_tirs(struct mlx5e_priv *priv);
void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv);

1011
int mlx5e_create_direct_rqts(struct mlx5e_priv *priv);
1012
void mlx5e_destroy_direct_rqts(struct mlx5e_priv *priv);
1013 1014
int mlx5e_create_direct_tirs(struct mlx5e_priv *priv);
void mlx5e_destroy_direct_tirs(struct mlx5e_priv *priv);
1015 1016
void mlx5e_destroy_rqt(struct mlx5e_priv *priv, struct mlx5e_rqt *rqt);

1017
int mlx5e_create_ttc_table(struct mlx5e_priv *priv);
1018 1019
void mlx5e_destroy_ttc_table(struct mlx5e_priv *priv);

1020 1021 1022 1023
int mlx5e_create_tis(struct mlx5_core_dev *mdev, int tc,
		     u32 underlay_qpn, u32 *tisn);
void mlx5e_destroy_tis(struct mlx5_core_dev *mdev, u32 tisn);

1024 1025 1026 1027 1028
int mlx5e_create_tises(struct mlx5e_priv *priv);
void mlx5e_cleanup_nic_tx(struct mlx5e_priv *priv);
int mlx5e_close(struct net_device *netdev);
int mlx5e_open(struct net_device *netdev);
void mlx5e_update_stats_work(struct work_struct *work);
1029
u32 mlx5e_choose_lro_timeout(struct mlx5_core_dev *mdev, u32 wanted_timeout);
1030

1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050
/* ethtool helpers */
void mlx5e_ethtool_get_drvinfo(struct mlx5e_priv *priv,
			       struct ethtool_drvinfo *drvinfo);
void mlx5e_ethtool_get_strings(struct mlx5e_priv *priv,
			       uint32_t stringset, uint8_t *data);
int mlx5e_ethtool_get_sset_count(struct mlx5e_priv *priv, int sset);
void mlx5e_ethtool_get_ethtool_stats(struct mlx5e_priv *priv,
				     struct ethtool_stats *stats, u64 *data);
void mlx5e_ethtool_get_ringparam(struct mlx5e_priv *priv,
				 struct ethtool_ringparam *param);
int mlx5e_ethtool_set_ringparam(struct mlx5e_priv *priv,
				struct ethtool_ringparam *param);
void mlx5e_ethtool_get_channels(struct mlx5e_priv *priv,
				struct ethtool_channels *ch);
int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
			       struct ethtool_channels *ch);
int mlx5e_ethtool_get_coalesce(struct mlx5e_priv *priv,
			       struct ethtool_coalesce *coal);
int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
			       struct ethtool_coalesce *coal);
1051 1052
int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv,
			      struct ethtool_ts_info *info);
1053

1054 1055 1056 1057 1058 1059 1060
/* mlx5e generic netdev management API */
struct net_device*
mlx5e_create_netdev(struct mlx5_core_dev *mdev, const struct mlx5e_profile *profile,
		    void *ppriv);
int mlx5e_attach_netdev(struct mlx5e_priv *priv);
void mlx5e_detach_netdev(struct mlx5e_priv *priv);
void mlx5e_destroy_netdev(struct mlx5e_priv *priv);
1061 1062 1063
void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
			    struct mlx5e_params *params,
			    u16 max_channels);
1064

1065
#endif /* __MLX5_EN_H__ */