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
96 #define MLX5E_NET_IP_ALIGN 2
98 static inline u16 mlx5_min_rx_wqes(int wq_type, u32 wq_size)
101 case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
102 return min_t(u16, MLX5E_PARAMS_DEFAULT_MIN_RX_WQES_MPW,
105 return min_t(u16, MLX5E_PARAMS_DEFAULT_MIN_RX_WQES,
110 static inline int mlx5_min_log_rq_size(int wq_type)
113 case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
114 return MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE_MPW;
116 return MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE;
120 static inline int mlx5_max_log_rq_size(int wq_type)
123 case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
124 return MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE_MPW;
126 return MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE;
130 struct mlx5e_tx_wqe {
131 struct mlx5_wqe_ctrl_seg ctrl;
132 struct mlx5_wqe_eth_seg eth;
135 struct mlx5e_rx_wqe {
136 struct mlx5_wqe_srq_next_seg next;
137 struct mlx5_wqe_data_seg data;
140 struct mlx5e_umr_wqe {
141 struct mlx5_wqe_ctrl_seg ctrl;
142 struct mlx5_wqe_umr_ctrl_seg uctrl;
143 struct mlx5_mkey_seg mkc;
144 struct mlx5_wqe_data_seg data;
147 #ifdef CONFIG_MLX5_CORE_EN_DCB
148 #define MLX5E_MAX_BW_ALLOC 100 /* Max percentage of BW allocation */
149 #define MLX5E_MIN_BW_ALLOC 1 /* Min percentage of BW allocation */
152 static const char vport_strings[][ETH_GSTRING_LEN] = {
153 /* vport statistics */
162 "rx_unicast_packets",
164 "tx_unicast_packets",
166 "rx_multicast_packets",
167 "rx_multicast_bytes",
168 "tx_multicast_packets",
169 "tx_multicast_bytes",
170 "rx_broadcast_packets",
171 "rx_broadcast_bytes",
172 "tx_broadcast_packets",
173 "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;
237 #define NUM_VPORT_COUNTERS 37
240 static const char pport_strings[][ETH_GSTRING_LEN] = {
241 /* IEEE802.3 counters */
252 "in_range_len_errors",
262 /* RFC2863 counters */
274 "out_multicast_pkts",
275 "out_broadcast_pkts",
277 /* RFC2819 counters */
298 "p8192to10239octets",
301 #define NUM_IEEE_802_3_COUNTERS 19
302 #define NUM_RFC_2863_COUNTERS 13
303 #define NUM_RFC_2819_COUNTERS 21
304 #define NUM_PPORT_COUNTERS (NUM_IEEE_802_3_COUNTERS + \
305 NUM_RFC_2863_COUNTERS + \
306 NUM_RFC_2819_COUNTERS)
308 struct mlx5e_pport_stats {
309 __be64 IEEE_802_3_counters[NUM_IEEE_802_3_COUNTERS];
310 __be64 RFC_2863_counters[NUM_RFC_2863_COUNTERS];
311 __be64 RFC_2819_counters[NUM_RFC_2819_COUNTERS];
314 static const char qcounter_stats_strings[][ETH_GSTRING_LEN] = {
318 struct mlx5e_qcounter_stats {
319 u32 rx_out_of_buffer;
320 #define NUM_Q_COUNTERS 1
323 static const char rq_stats_strings[][ETH_GSTRING_LEN] = {
335 struct mlx5e_rq_stats {
345 #define NUM_RQ_STATS 9
348 static const char sq_stats_strings[][ETH_GSTRING_LEN] = {
355 "csum_offload_inner",
363 struct mlx5e_sq_stats {
364 /* commonly accessed in data path */
369 u64 tso_inner_packets;
371 u64 csum_offload_inner;
373 /* less likely accessed in data path */
374 u64 csum_offload_none;
378 #define NUM_SQ_STATS 12
382 struct mlx5e_vport_stats vport;
383 struct mlx5e_pport_stats pport;
384 struct mlx5e_qcounter_stats qcnt;
387 struct mlx5e_params {
393 u16 rx_cq_moderation_usec;
394 u16 rx_cq_moderation_pkts;
395 u16 tx_cq_moderation_usec;
396 u16 tx_cq_moderation_pkts;
402 u8 toeplitz_hash_key[40];
403 u32 indirection_rqt[MLX5E_INDIR_RQT_SIZE];
404 #ifdef CONFIG_MLX5_CORE_EN_DCB
409 struct mlx5e_tstamp {
411 struct cyclecounter cycles;
412 struct timecounter clock;
413 struct hwtstamp_config hwtstamp_config;
415 unsigned long overflow_period;
416 struct delayed_work overflow_work;
417 struct mlx5_core_dev *mdev;
418 struct ptp_clock *ptp;
419 struct ptp_clock_info ptp_info;
423 MLX5E_RQ_STATE_POST_WQES_ENABLE,
424 MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS,
428 /* data path - accessed per cqe */
431 /* data path - accessed per napi poll */
432 struct napi_struct *napi;
433 struct mlx5_core_cq mcq;
434 struct mlx5e_channel *channel;
435 struct mlx5e_priv *priv;
438 struct mlx5_wq_ctrl wq_ctrl;
439 } ____cacheline_aligned_in_smp;
442 typedef void (*mlx5e_fp_handle_rx_cqe)(struct mlx5e_rq *rq,
443 struct mlx5_cqe64 *cqe);
444 typedef int (*mlx5e_fp_alloc_wqe)(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe,
447 struct mlx5e_dma_info {
454 struct mlx5_wq_ll wq;
456 struct sk_buff **skb;
457 struct mlx5e_mpw_info *wqe_info;
462 struct net_device *netdev;
463 struct mlx5e_tstamp *tstamp;
464 struct mlx5e_rq_stats stats;
466 mlx5e_fp_handle_rx_cqe handle_rx_cqe;
467 mlx5e_fp_alloc_wqe alloc_wqe;
473 struct mlx5_wq_ctrl wq_ctrl;
476 struct mlx5e_channel *channel;
477 struct mlx5e_priv *priv;
478 } ____cacheline_aligned_in_smp;
480 struct mlx5e_umr_dma_info {
482 __be64 *mtt_no_align;
484 struct mlx5e_dma_info *dma_info;
487 struct mlx5e_mpw_info {
489 struct mlx5e_dma_info dma_info;
490 struct mlx5e_umr_dma_info umr;
492 u16 consumed_strides;
493 u16 skbs_frags[MLX5_MPWRQ_PAGES_PER_WQE];
495 void (*dma_pre_sync)(struct device *pdev,
496 struct mlx5e_mpw_info *wi,
497 u32 wqe_offset, u32 len);
498 void (*add_skb_frag)(struct device *pdev,
500 struct mlx5e_mpw_info *wi,
501 u32 page_idx, u32 frag_offset, u32 len);
502 void (*copy_skb_header)(struct device *pdev,
504 struct mlx5e_mpw_info *wi,
505 u32 page_idx, u32 offset,
507 void (*free_wqe)(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi);
510 struct mlx5e_tx_wqe_info {
516 enum mlx5e_dma_map_type {
517 MLX5E_DMA_MAP_SINGLE,
521 struct mlx5e_sq_dma {
524 enum mlx5e_dma_map_type type;
528 MLX5E_SQ_STATE_WAKE_TXQ_ENABLE,
529 MLX5E_SQ_STATE_BF_ENABLE,
532 struct mlx5e_ico_wqe_info {
540 /* dirtied @completion */
545 u16 pc ____cacheline_aligned_in_smp;
550 struct mlx5e_sq_stats stats;
554 /* pointers to per packet info: write@xmit, read@completion */
555 struct sk_buff **skb;
556 struct mlx5e_sq_dma *dma_fifo;
557 struct mlx5e_tx_wqe_info *wqe_info;
560 struct mlx5_wq_cyc wq;
562 void __iomem *uar_map;
563 struct netdev_queue *txq;
569 struct mlx5e_tstamp *tstamp;
574 struct mlx5_wq_ctrl wq_ctrl;
576 struct mlx5e_channel *channel;
578 struct mlx5e_ico_wqe_info *ico_wqe_info;
579 } ____cacheline_aligned_in_smp;
581 static inline bool mlx5e_sq_has_room_for(struct mlx5e_sq *sq, u16 n)
583 return (((sq->wq.sz_m1 & (sq->cc - sq->pc)) >= n) ||
588 MLX5E_CHANNEL_NAPI_SCHED = 1,
591 struct mlx5e_channel {
594 struct mlx5e_sq sq[MLX5E_MAX_NUM_TC];
595 struct mlx5e_sq icosq; /* internal control operations */
596 struct napi_struct napi;
598 struct net_device *netdev;
604 struct mlx5e_priv *priv;
609 enum mlx5e_traffic_types {
614 MLX5E_TT_IPV4_IPSEC_AH,
615 MLX5E_TT_IPV6_IPSEC_AH,
616 MLX5E_TT_IPV4_IPSEC_ESP,
617 MLX5E_TT_IPV6_IPSEC_ESP,
624 #define IS_HASHING_TT(tt) (tt != MLX5E_TT_ANY)
627 MLX5E_INDIRECTION_RQT,
632 struct mlx5e_eth_addr_info {
633 u8 addr[ETH_ALEN + 2];
635 struct mlx5_flow_rule *ft_rule[MLX5E_NUM_TT];
638 #define MLX5E_ETH_ADDR_HASH_SIZE (1 << BITS_PER_BYTE)
640 struct mlx5e_eth_addr_db {
641 struct hlist_head netdev_uc[MLX5E_ETH_ADDR_HASH_SIZE];
642 struct hlist_head netdev_mc[MLX5E_ETH_ADDR_HASH_SIZE];
643 struct mlx5e_eth_addr_info broadcast;
644 struct mlx5e_eth_addr_info allmulti;
645 struct mlx5e_eth_addr_info promisc;
646 bool broadcast_enabled;
647 bool allmulti_enabled;
648 bool promisc_enabled;
652 MLX5E_STATE_ASYNC_EVENTS_ENABLE,
654 MLX5E_STATE_DESTROYING,
657 struct mlx5e_vlan_db {
658 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
659 struct mlx5_flow_rule *active_vlans_rule[VLAN_N_VID];
660 struct mlx5_flow_rule *untagged_rule;
661 struct mlx5_flow_rule *any_vlan_rule;
662 bool filter_disabled;
665 struct mlx5e_vxlan_db {
666 spinlock_t lock; /* protect vxlan table */
667 struct radix_tree_root tree;
670 struct mlx5e_flow_table {
672 struct mlx5_flow_table *t;
673 struct mlx5_flow_group **g;
676 struct mlx5e_tc_flow_table {
677 struct mlx5_flow_table *t;
679 struct rhashtable_params ht_params;
680 struct rhashtable ht;
683 struct mlx5e_flow_tables {
684 struct mlx5_flow_namespace *ns;
685 struct mlx5e_tc_flow_table tc;
686 struct mlx5e_flow_table vlan;
687 struct mlx5e_flow_table main;
691 /* priv data path fields - start */
692 struct mlx5e_sq **txq_to_sq_map;
693 int channeltc_to_txq_map[MLX5E_MAX_NUM_CHANNELS][MLX5E_MAX_NUM_TC];
694 /* priv data path fields - end */
697 struct mutex state_lock; /* Protects Interface state */
698 struct mlx5_uar cq_uar;
701 struct mlx5_core_mkey mkey;
702 struct mlx5_core_mkey umr_mkey;
703 struct mlx5e_rq drop_rq;
705 struct mlx5e_channel **channel;
706 u32 tisn[MLX5E_MAX_NUM_TC];
707 u32 rqtn[MLX5E_NUM_RQT];
708 u32 tirn[MLX5E_NUM_TT];
710 struct mlx5e_flow_tables fts;
711 struct mlx5e_eth_addr_db eth_addr;
712 struct mlx5e_vlan_db vlan;
713 struct mlx5e_vxlan_db vxlan;
715 struct mlx5e_params params;
716 struct work_struct update_carrier_work;
717 struct work_struct set_rx_mode_work;
718 struct delayed_work update_stats_work;
720 struct mlx5_core_dev *mdev;
721 struct net_device *netdev;
722 struct mlx5e_stats stats;
723 struct mlx5e_tstamp tstamp;
727 enum mlx5e_link_mode {
728 MLX5E_1000BASE_CX_SGMII = 0,
729 MLX5E_1000BASE_KX = 1,
730 MLX5E_10GBASE_CX4 = 2,
731 MLX5E_10GBASE_KX4 = 3,
732 MLX5E_10GBASE_KR = 4,
733 MLX5E_20GBASE_KR2 = 5,
734 MLX5E_40GBASE_CR4 = 6,
735 MLX5E_40GBASE_KR4 = 7,
736 MLX5E_56GBASE_R4 = 8,
737 MLX5E_10GBASE_CR = 12,
738 MLX5E_10GBASE_SR = 13,
739 MLX5E_10GBASE_ER = 14,
740 MLX5E_40GBASE_SR4 = 15,
741 MLX5E_40GBASE_LR4 = 16,
742 MLX5E_100GBASE_CR4 = 20,
743 MLX5E_100GBASE_SR4 = 21,
744 MLX5E_100GBASE_KR4 = 22,
745 MLX5E_100GBASE_LR4 = 23,
746 MLX5E_100BASE_TX = 24,
747 MLX5E_100BASE_T = 25,
748 MLX5E_10GBASE_T = 26,
749 MLX5E_25GBASE_CR = 27,
750 MLX5E_25GBASE_KR = 28,
751 MLX5E_25GBASE_SR = 29,
752 MLX5E_50GBASE_CR2 = 30,
753 MLX5E_50GBASE_KR2 = 31,
754 MLX5E_LINK_MODES_NUMBER,
757 #define MLX5E_PROT_MASK(link_mode) (1 << link_mode)
759 void mlx5e_send_nop(struct mlx5e_sq *sq, bool notify_hw);
760 u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb,
761 void *accel_priv, select_queue_fallback_t fallback);
762 netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev);
764 void mlx5e_completion_event(struct mlx5_core_cq *mcq);
765 void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, enum mlx5_event event);
766 int mlx5e_napi_poll(struct napi_struct *napi, int budget);
767 bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget);
768 int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget);
770 void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe);
771 void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe);
772 bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq);
773 int mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix);
774 int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix);
775 void mlx5e_post_rx_fragmented_mpwqe(struct mlx5e_rq *rq);
776 void mlx5e_complete_rx_linear_mpwqe(struct mlx5e_rq *rq,
777 struct mlx5_cqe64 *cqe,
779 struct mlx5e_mpw_info *wi,
780 struct sk_buff *skb);
781 void mlx5e_complete_rx_fragmented_mpwqe(struct mlx5e_rq *rq,
782 struct mlx5_cqe64 *cqe,
784 struct mlx5e_mpw_info *wi,
785 struct sk_buff *skb);
786 void mlx5e_free_rx_linear_mpwqe(struct mlx5e_rq *rq,
787 struct mlx5e_mpw_info *wi);
788 void mlx5e_free_rx_fragmented_mpwqe(struct mlx5e_rq *rq,
789 struct mlx5e_mpw_info *wi);
790 struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq);
792 void mlx5e_update_stats(struct mlx5e_priv *priv);
794 int mlx5e_create_flow_tables(struct mlx5e_priv *priv);
795 void mlx5e_destroy_flow_tables(struct mlx5e_priv *priv);
796 void mlx5e_init_eth_addr(struct mlx5e_priv *priv);
797 void mlx5e_set_rx_mode_work(struct work_struct *work);
799 void mlx5e_fill_hwstamp(struct mlx5e_tstamp *clock, u64 timestamp,
800 struct skb_shared_hwtstamps *hwts);
801 void mlx5e_timestamp_init(struct mlx5e_priv *priv);
802 void mlx5e_timestamp_cleanup(struct mlx5e_priv *priv);
803 int mlx5e_hwstamp_set(struct net_device *dev, struct ifreq *ifr);
804 int mlx5e_hwstamp_get(struct net_device *dev, struct ifreq *ifr);
806 int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto,
808 int mlx5e_vlan_rx_kill_vid(struct net_device *dev, __always_unused __be16 proto,
810 void mlx5e_enable_vlan_filter(struct mlx5e_priv *priv);
811 void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv);
813 int mlx5e_redirect_rqt(struct mlx5e_priv *priv, enum mlx5e_rqt_ix rqt_ix);
814 void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv);
816 int mlx5e_open_locked(struct net_device *netdev);
817 int mlx5e_close_locked(struct net_device *netdev);
818 void mlx5e_build_default_indir_rqt(struct mlx5_core_dev *mdev,
819 u32 *indirection_rqt, int len,
822 static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
823 struct mlx5_wqe_ctrl_seg *ctrl, int bf_sz)
825 u16 ofst = MLX5_BF_OFFSET + sq->bf_offset;
827 /* ensure wqe is visible to device before updating doorbell record */
830 *sq->wq.db = cpu_to_be32(sq->pc);
832 /* ensure doorbell record is visible to device before ringing the
837 __iowrite64_copy(sq->uar_map + ofst, ctrl, bf_sz);
839 mlx5_write64((__be32 *)ctrl, sq->uar_map + ofst, NULL);
840 /* flush the write-combining mapped buffer */
843 sq->bf_offset ^= sq->bf_buf_size;
846 static inline void mlx5e_cq_arm(struct mlx5e_cq *cq)
848 struct mlx5_core_cq *mcq;
851 mlx5_cq_arm(mcq, MLX5_CQ_DB_REQ_NOT, mcq->uar->map, NULL, cq->wq.cc);
854 static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev)
856 return min_t(int, mdev->priv.eq_table.num_comp_vectors,
857 MLX5E_MAX_NUM_CHANNELS);
860 static inline int mlx5e_get_mtt_octw(int npages)
862 return ALIGN(npages, 8) / 2;
865 extern const struct ethtool_ops mlx5e_ethtool_ops;
866 #ifdef CONFIG_MLX5_CORE_EN_DCB
867 extern const struct dcbnl_rtnl_ops mlx5e_dcbnl_ops;
868 int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets);
871 u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev);
873 #endif /* __MLX5_EN_H__ */