2 * Copyright (c) 2015-2016, Mellanox Technologies. All rights reserved.
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:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
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.
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
35 #include <linux/if_vlan.h>
36 #include <linux/etherdevice.h>
37 #include <linux/timecounter.h>
38 #include <linux/net_tstamp.h>
39 #include <linux/ptp_clock_kernel.h>
40 #include <linux/mlx5/driver.h>
41 #include <linux/mlx5/qp.h>
42 #include <linux/mlx5/cq.h>
43 #include <linux/mlx5/port.h>
44 #include <linux/mlx5/vport.h>
45 #include <linux/mlx5/transobj.h>
46 #include <linux/rhashtable.h>
48 #include "mlx5_core.h"
50 #define MLX5E_MAX_NUM_TC 8
52 #define MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE 0x6
53 #define MLX5E_PARAMS_DEFAULT_LOG_SQ_SIZE 0xa
54 #define MLX5E_PARAMS_MAXIMUM_LOG_SQ_SIZE 0xd
56 #define MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE 0x1
57 #define MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE 0xa
58 #define MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE 0xd
60 #define MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE_MPW 0x1
61 #define MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE_MPW 0x4
62 #define MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE_MPW 0x6
64 #define MLX5_MPWRQ_LOG_NUM_STRIDES 11 /* >= 9, HW restriction */
65 #define MLX5_MPWRQ_LOG_STRIDE_SIZE 6 /* >= 6, HW restriction */
66 #define MLX5_MPWRQ_NUM_STRIDES BIT(MLX5_MPWRQ_LOG_NUM_STRIDES)
67 #define MLX5_MPWRQ_STRIDE_SIZE BIT(MLX5_MPWRQ_LOG_STRIDE_SIZE)
68 #define MLX5_MPWRQ_LOG_WQE_SZ (MLX5_MPWRQ_LOG_NUM_STRIDES +\
69 MLX5_MPWRQ_LOG_STRIDE_SIZE)
70 #define MLX5_MPWRQ_WQE_PAGE_ORDER (MLX5_MPWRQ_LOG_WQE_SZ - PAGE_SHIFT > 0 ? \
71 MLX5_MPWRQ_LOG_WQE_SZ - PAGE_SHIFT : 0)
72 #define MLX5_MPWRQ_PAGES_PER_WQE BIT(MLX5_MPWRQ_WQE_PAGE_ORDER)
73 #define MLX5_MPWRQ_STRIDES_PER_PAGE (MLX5_MPWRQ_NUM_STRIDES >> \
74 MLX5_MPWRQ_WQE_PAGE_ORDER)
75 #define MLX5_CHANNEL_MAX_NUM_MTTS (ALIGN(MLX5_MPWRQ_PAGES_PER_WQE, 8) * \
76 BIT(MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE_MPW))
77 #define MLX5_UMR_ALIGN (2048)
78 #define MLX5_MPWRQ_SMALL_PACKET_THRESHOLD (128)
80 #define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ (64 * 1024)
81 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC 0x10
82 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_PKTS 0x20
83 #define MLX5E_PARAMS_DEFAULT_TX_CQ_MODERATION_USEC 0x10
84 #define MLX5E_PARAMS_DEFAULT_TX_CQ_MODERATION_PKTS 0x20
85 #define MLX5E_PARAMS_DEFAULT_MIN_RX_WQES 0x80
86 #define MLX5E_PARAMS_DEFAULT_MIN_RX_WQES_MPW 0x2
88 #define MLX5E_LOG_INDIR_RQT_SIZE 0x7
89 #define MLX5E_INDIR_RQT_SIZE BIT(MLX5E_LOG_INDIR_RQT_SIZE)
90 #define MLX5E_MAX_NUM_CHANNELS (MLX5E_INDIR_RQT_SIZE >> 1)
91 #define MLX5E_TX_CQ_POLL_BUDGET 128
92 #define MLX5E_UPDATE_STATS_INTERVAL 200 /* msecs */
93 #define MLX5E_SQ_BF_BUDGET 16
95 #define MLX5E_NUM_MAIN_GROUPS 9
97 static inline u16 mlx5_min_rx_wqes(int wq_type, u32 wq_size)
100 case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
101 return min_t(u16, MLX5E_PARAMS_DEFAULT_MIN_RX_WQES_MPW,
104 return min_t(u16, MLX5E_PARAMS_DEFAULT_MIN_RX_WQES,
109 static inline int mlx5_min_log_rq_size(int wq_type)
112 case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
113 return MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE_MPW;
115 return MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE;
119 static inline int mlx5_max_log_rq_size(int wq_type)
122 case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
123 return MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE_MPW;
125 return MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE;
129 struct mlx5e_tx_wqe {
130 struct mlx5_wqe_ctrl_seg ctrl;
131 struct mlx5_wqe_eth_seg eth;
134 struct mlx5e_rx_wqe {
135 struct mlx5_wqe_srq_next_seg next;
136 struct mlx5_wqe_data_seg data;
139 struct mlx5e_umr_wqe {
140 struct mlx5_wqe_ctrl_seg ctrl;
141 struct mlx5_wqe_umr_ctrl_seg uctrl;
142 struct mlx5_mkey_seg mkc;
143 struct mlx5_wqe_data_seg data;
146 #ifdef CONFIG_MLX5_CORE_EN_DCB
147 #define MLX5E_MAX_BW_ALLOC 100 /* Max percentage of BW allocation */
148 #define MLX5E_MIN_BW_ALLOC 1 /* Min percentage of BW allocation */
151 static const char vport_strings[][ETH_GSTRING_LEN] = {
152 /* vport statistics */
161 "rx_unicast_packets",
163 "tx_unicast_packets",
165 "rx_multicast_packets",
166 "rx_multicast_bytes",
167 "tx_multicast_packets",
168 "tx_multicast_bytes",
169 "rx_broadcast_packets",
170 "rx_broadcast_bytes",
171 "tx_broadcast_packets",
172 "tx_broadcast_bytes",
195 struct mlx5e_vport_stats {
201 u64 rx_error_packets;
203 u64 tx_error_packets;
205 u64 rx_unicast_packets;
206 u64 rx_unicast_bytes;
207 u64 tx_unicast_packets;
208 u64 tx_unicast_bytes;
209 u64 rx_multicast_packets;
210 u64 rx_multicast_bytes;
211 u64 tx_multicast_packets;
212 u64 tx_multicast_bytes;
213 u64 rx_broadcast_packets;
214 u64 rx_broadcast_bytes;
215 u64 tx_broadcast_packets;
216 u64 tx_broadcast_bytes;
221 u64 tso_inner_packets;
230 u64 tx_queue_stopped;
232 u64 tx_queue_dropped;
236 u64 rx_buff_alloc_err;
238 #define NUM_VPORT_COUNTERS 38
241 static const char pport_strings[][ETH_GSTRING_LEN] = {
242 /* IEEE802.3 counters */
253 "in_range_len_errors",
263 /* RFC2863 counters */
275 "out_multicast_pkts",
276 "out_broadcast_pkts",
278 /* RFC2819 counters */
299 "p8192to10239octets",
302 #define NUM_IEEE_802_3_COUNTERS 19
303 #define NUM_RFC_2863_COUNTERS 13
304 #define NUM_RFC_2819_COUNTERS 21
305 #define NUM_PPORT_COUNTERS (NUM_IEEE_802_3_COUNTERS + \
306 NUM_RFC_2863_COUNTERS + \
307 NUM_RFC_2819_COUNTERS)
309 struct mlx5e_pport_stats {
310 __be64 IEEE_802_3_counters[NUM_IEEE_802_3_COUNTERS];
311 __be64 RFC_2863_counters[NUM_RFC_2863_COUNTERS];
312 __be64 RFC_2819_counters[NUM_RFC_2819_COUNTERS];
315 static const char qcounter_stats_strings[][ETH_GSTRING_LEN] = {
319 struct mlx5e_qcounter_stats {
320 u32 rx_out_of_buffer;
321 #define NUM_Q_COUNTERS 1
324 static const char rq_stats_strings[][ETH_GSTRING_LEN] = {
337 struct mlx5e_rq_stats {
348 #define NUM_RQ_STATS 10
351 static const char sq_stats_strings[][ETH_GSTRING_LEN] = {
358 "csum_offload_inner",
366 struct mlx5e_sq_stats {
367 /* commonly accessed in data path */
372 u64 tso_inner_packets;
374 u64 csum_offload_inner;
376 /* less likely accessed in data path */
377 u64 csum_offload_none;
381 #define NUM_SQ_STATS 12
385 struct mlx5e_vport_stats vport;
386 struct mlx5e_pport_stats pport;
387 struct mlx5e_qcounter_stats qcnt;
390 struct mlx5e_params {
396 u16 rx_cq_moderation_usec;
397 u16 rx_cq_moderation_pkts;
398 u16 tx_cq_moderation_usec;
399 u16 tx_cq_moderation_pkts;
405 u8 toeplitz_hash_key[40];
406 u32 indirection_rqt[MLX5E_INDIR_RQT_SIZE];
407 #ifdef CONFIG_MLX5_CORE_EN_DCB
412 struct mlx5e_tstamp {
414 struct cyclecounter cycles;
415 struct timecounter clock;
416 struct hwtstamp_config hwtstamp_config;
418 unsigned long overflow_period;
419 struct delayed_work overflow_work;
420 struct mlx5_core_dev *mdev;
421 struct ptp_clock *ptp;
422 struct ptp_clock_info ptp_info;
426 MLX5E_RQ_STATE_POST_WQES_ENABLE,
427 MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS,
431 /* data path - accessed per cqe */
434 /* data path - accessed per napi poll */
435 struct napi_struct *napi;
436 struct mlx5_core_cq mcq;
437 struct mlx5e_channel *channel;
438 struct mlx5e_priv *priv;
441 struct mlx5_wq_ctrl wq_ctrl;
442 } ____cacheline_aligned_in_smp;
445 typedef void (*mlx5e_fp_handle_rx_cqe)(struct mlx5e_rq *rq,
446 struct mlx5_cqe64 *cqe);
447 typedef int (*mlx5e_fp_alloc_wqe)(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe,
450 struct mlx5e_dma_info {
457 struct mlx5_wq_ll wq;
459 struct sk_buff **skb;
460 struct mlx5e_mpw_info *wqe_info;
465 struct net_device *netdev;
466 struct mlx5e_tstamp *tstamp;
467 struct mlx5e_rq_stats stats;
469 mlx5e_fp_handle_rx_cqe handle_rx_cqe;
470 mlx5e_fp_alloc_wqe alloc_wqe;
476 struct mlx5_wq_ctrl wq_ctrl;
479 struct mlx5e_channel *channel;
480 struct mlx5e_priv *priv;
481 } ____cacheline_aligned_in_smp;
483 struct mlx5e_umr_dma_info {
485 __be64 *mtt_no_align;
487 struct mlx5e_dma_info *dma_info;
490 struct mlx5e_mpw_info {
492 struct mlx5e_dma_info dma_info;
493 struct mlx5e_umr_dma_info umr;
495 u16 consumed_strides;
496 u16 skbs_frags[MLX5_MPWRQ_PAGES_PER_WQE];
498 void (*dma_pre_sync)(struct device *pdev,
499 struct mlx5e_mpw_info *wi,
500 u32 wqe_offset, u32 len);
501 void (*add_skb_frag)(struct device *pdev,
503 struct mlx5e_mpw_info *wi,
504 u32 page_idx, u32 frag_offset, u32 len);
505 void (*copy_skb_header)(struct device *pdev,
507 struct mlx5e_mpw_info *wi,
508 u32 page_idx, u32 offset,
510 void (*free_wqe)(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi);
513 struct mlx5e_tx_wqe_info {
519 enum mlx5e_dma_map_type {
520 MLX5E_DMA_MAP_SINGLE,
524 struct mlx5e_sq_dma {
527 enum mlx5e_dma_map_type type;
531 MLX5E_SQ_STATE_WAKE_TXQ_ENABLE,
532 MLX5E_SQ_STATE_BF_ENABLE,
535 struct mlx5e_ico_wqe_info {
543 /* dirtied @completion */
548 u16 pc ____cacheline_aligned_in_smp;
553 struct mlx5e_sq_stats stats;
557 /* pointers to per packet info: write@xmit, read@completion */
558 struct sk_buff **skb;
559 struct mlx5e_sq_dma *dma_fifo;
560 struct mlx5e_tx_wqe_info *wqe_info;
563 struct mlx5_wq_cyc wq;
565 void __iomem *uar_map;
566 struct netdev_queue *txq;
572 struct mlx5e_tstamp *tstamp;
577 struct mlx5_wq_ctrl wq_ctrl;
579 struct mlx5e_channel *channel;
581 struct mlx5e_ico_wqe_info *ico_wqe_info;
582 } ____cacheline_aligned_in_smp;
584 static inline bool mlx5e_sq_has_room_for(struct mlx5e_sq *sq, u16 n)
586 return (((sq->wq.sz_m1 & (sq->cc - sq->pc)) >= n) ||
591 MLX5E_CHANNEL_NAPI_SCHED = 1,
594 struct mlx5e_channel {
597 struct mlx5e_sq sq[MLX5E_MAX_NUM_TC];
598 struct mlx5e_sq icosq; /* internal control operations */
599 struct napi_struct napi;
601 struct net_device *netdev;
607 struct mlx5e_priv *priv;
612 enum mlx5e_traffic_types {
617 MLX5E_TT_IPV4_IPSEC_AH,
618 MLX5E_TT_IPV6_IPSEC_AH,
619 MLX5E_TT_IPV4_IPSEC_ESP,
620 MLX5E_TT_IPV6_IPSEC_ESP,
627 #define IS_HASHING_TT(tt) (tt != MLX5E_TT_ANY)
630 MLX5E_INDIRECTION_RQT,
635 struct mlx5e_eth_addr_info {
636 u8 addr[ETH_ALEN + 2];
638 struct mlx5_flow_rule *ft_rule[MLX5E_NUM_TT];
641 #define MLX5E_ETH_ADDR_HASH_SIZE (1 << BITS_PER_BYTE)
643 struct mlx5e_eth_addr_db {
644 struct hlist_head netdev_uc[MLX5E_ETH_ADDR_HASH_SIZE];
645 struct hlist_head netdev_mc[MLX5E_ETH_ADDR_HASH_SIZE];
646 struct mlx5e_eth_addr_info broadcast;
647 struct mlx5e_eth_addr_info allmulti;
648 struct mlx5e_eth_addr_info promisc;
649 bool broadcast_enabled;
650 bool allmulti_enabled;
651 bool promisc_enabled;
655 MLX5E_STATE_ASYNC_EVENTS_ENABLE,
657 MLX5E_STATE_DESTROYING,
660 struct mlx5e_vlan_db {
661 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
662 struct mlx5_flow_rule *active_vlans_rule[VLAN_N_VID];
663 struct mlx5_flow_rule *untagged_rule;
664 struct mlx5_flow_rule *any_vlan_rule;
665 bool filter_disabled;
668 struct mlx5e_vxlan_db {
669 spinlock_t lock; /* protect vxlan table */
670 struct radix_tree_root tree;
673 struct mlx5e_flow_table {
675 struct mlx5_flow_table *t;
676 struct mlx5_flow_group **g;
679 struct mlx5e_tc_flow_table {
680 struct mlx5_flow_table *t;
682 struct rhashtable_params ht_params;
683 struct rhashtable ht;
686 struct mlx5e_flow_tables {
687 struct mlx5_flow_namespace *ns;
688 struct mlx5e_tc_flow_table tc;
689 struct mlx5e_flow_table vlan;
690 struct mlx5e_flow_table main;
694 /* priv data path fields - start */
695 struct mlx5e_sq **txq_to_sq_map;
696 int channeltc_to_txq_map[MLX5E_MAX_NUM_CHANNELS][MLX5E_MAX_NUM_TC];
697 /* priv data path fields - end */
700 struct mutex state_lock; /* Protects Interface state */
701 struct mlx5_uar cq_uar;
704 struct mlx5_core_mkey mkey;
705 struct mlx5_core_mkey umr_mkey;
706 struct mlx5e_rq drop_rq;
708 struct mlx5e_channel **channel;
709 u32 tisn[MLX5E_MAX_NUM_TC];
710 u32 rqtn[MLX5E_NUM_RQT];
711 u32 tirn[MLX5E_NUM_TT];
713 struct mlx5e_flow_tables fts;
714 struct mlx5e_eth_addr_db eth_addr;
715 struct mlx5e_vlan_db vlan;
716 struct mlx5e_vxlan_db vxlan;
718 struct mlx5e_params params;
719 struct work_struct update_carrier_work;
720 struct work_struct set_rx_mode_work;
721 struct delayed_work update_stats_work;
723 struct mlx5_core_dev *mdev;
724 struct net_device *netdev;
725 struct mlx5e_stats stats;
726 struct mlx5e_tstamp tstamp;
730 enum mlx5e_link_mode {
731 MLX5E_1000BASE_CX_SGMII = 0,
732 MLX5E_1000BASE_KX = 1,
733 MLX5E_10GBASE_CX4 = 2,
734 MLX5E_10GBASE_KX4 = 3,
735 MLX5E_10GBASE_KR = 4,
736 MLX5E_20GBASE_KR2 = 5,
737 MLX5E_40GBASE_CR4 = 6,
738 MLX5E_40GBASE_KR4 = 7,
739 MLX5E_56GBASE_R4 = 8,
740 MLX5E_10GBASE_CR = 12,
741 MLX5E_10GBASE_SR = 13,
742 MLX5E_10GBASE_ER = 14,
743 MLX5E_40GBASE_SR4 = 15,
744 MLX5E_40GBASE_LR4 = 16,
745 MLX5E_100GBASE_CR4 = 20,
746 MLX5E_100GBASE_SR4 = 21,
747 MLX5E_100GBASE_KR4 = 22,
748 MLX5E_100GBASE_LR4 = 23,
749 MLX5E_100BASE_TX = 24,
750 MLX5E_100BASE_T = 25,
751 MLX5E_10GBASE_T = 26,
752 MLX5E_25GBASE_CR = 27,
753 MLX5E_25GBASE_KR = 28,
754 MLX5E_25GBASE_SR = 29,
755 MLX5E_50GBASE_CR2 = 30,
756 MLX5E_50GBASE_KR2 = 31,
757 MLX5E_LINK_MODES_NUMBER,
760 #define MLX5E_PROT_MASK(link_mode) (1 << link_mode)
762 void mlx5e_send_nop(struct mlx5e_sq *sq, bool notify_hw);
763 u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb,
764 void *accel_priv, select_queue_fallback_t fallback);
765 netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev);
767 void mlx5e_completion_event(struct mlx5_core_cq *mcq);
768 void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, enum mlx5_event event);
769 int mlx5e_napi_poll(struct napi_struct *napi, int budget);
770 bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget);
771 int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget);
773 void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe);
774 void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe);
775 bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq);
776 int mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix);
777 int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix);
778 void mlx5e_post_rx_fragmented_mpwqe(struct mlx5e_rq *rq);
779 void mlx5e_complete_rx_linear_mpwqe(struct mlx5e_rq *rq,
780 struct mlx5_cqe64 *cqe,
782 struct mlx5e_mpw_info *wi,
783 struct sk_buff *skb);
784 void mlx5e_complete_rx_fragmented_mpwqe(struct mlx5e_rq *rq,
785 struct mlx5_cqe64 *cqe,
787 struct mlx5e_mpw_info *wi,
788 struct sk_buff *skb);
789 void mlx5e_free_rx_linear_mpwqe(struct mlx5e_rq *rq,
790 struct mlx5e_mpw_info *wi);
791 void mlx5e_free_rx_fragmented_mpwqe(struct mlx5e_rq *rq,
792 struct mlx5e_mpw_info *wi);
793 struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq);
795 void mlx5e_update_stats(struct mlx5e_priv *priv);
797 int mlx5e_create_flow_tables(struct mlx5e_priv *priv);
798 void mlx5e_destroy_flow_tables(struct mlx5e_priv *priv);
799 void mlx5e_init_eth_addr(struct mlx5e_priv *priv);
800 void mlx5e_set_rx_mode_work(struct work_struct *work);
802 void mlx5e_fill_hwstamp(struct mlx5e_tstamp *clock, u64 timestamp,
803 struct skb_shared_hwtstamps *hwts);
804 void mlx5e_timestamp_init(struct mlx5e_priv *priv);
805 void mlx5e_timestamp_cleanup(struct mlx5e_priv *priv);
806 int mlx5e_hwstamp_set(struct net_device *dev, struct ifreq *ifr);
807 int mlx5e_hwstamp_get(struct net_device *dev, struct ifreq *ifr);
809 int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto,
811 int mlx5e_vlan_rx_kill_vid(struct net_device *dev, __always_unused __be16 proto,
813 void mlx5e_enable_vlan_filter(struct mlx5e_priv *priv);
814 void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv);
816 int mlx5e_redirect_rqt(struct mlx5e_priv *priv, enum mlx5e_rqt_ix rqt_ix);
817 void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv);
819 int mlx5e_open_locked(struct net_device *netdev);
820 int mlx5e_close_locked(struct net_device *netdev);
821 void mlx5e_build_default_indir_rqt(struct mlx5_core_dev *mdev,
822 u32 *indirection_rqt, int len,
825 static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
826 struct mlx5_wqe_ctrl_seg *ctrl, int bf_sz)
828 u16 ofst = MLX5_BF_OFFSET + sq->bf_offset;
830 /* ensure wqe is visible to device before updating doorbell record */
833 *sq->wq.db = cpu_to_be32(sq->pc);
835 /* ensure doorbell record is visible to device before ringing the
840 __iowrite64_copy(sq->uar_map + ofst, ctrl, bf_sz);
842 mlx5_write64((__be32 *)ctrl, sq->uar_map + ofst, NULL);
843 /* flush the write-combining mapped buffer */
846 sq->bf_offset ^= sq->bf_buf_size;
849 static inline void mlx5e_cq_arm(struct mlx5e_cq *cq)
851 struct mlx5_core_cq *mcq;
854 mlx5_cq_arm(mcq, MLX5_CQ_DB_REQ_NOT, mcq->uar->map, NULL, cq->wq.cc);
857 static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev)
859 return min_t(int, mdev->priv.eq_table.num_comp_vectors,
860 MLX5E_MAX_NUM_CHANNELS);
863 static inline int mlx5e_get_mtt_octw(int npages)
865 return ALIGN(npages, 8) / 2;
868 extern const struct ethtool_ops mlx5e_ethtool_ops;
869 #ifdef CONFIG_MLX5_CORE_EN_DCB
870 extern const struct dcbnl_rtnl_ops mlx5e_dcbnl_ops;
871 int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets);
874 u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev);
876 #endif /* __MLX5_EN_H__ */