qed_eth_if.h 4.0 KB
Newer Older
Y
Yuval Mintz 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/* QLogic qed NIC Driver
 * Copyright (c) 2015 QLogic Corporation
 *
 * This software is available 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.
 */

#ifndef _QED_ETH_IF_H
#define _QED_ETH_IF_H

#include <linux/list.h>
#include <linux/if_link.h>
#include <linux/qed/eth_common.h>
#include <linux/qed/qed_if.h>
Y
Yuval Mintz 已提交
16
#include <linux/qed/qed_iov_if.h>
Y
Yuval Mintz 已提交
17 18 19 20 21 22 23 24 25 26 27

struct qed_dev_eth_info {
	struct qed_dev_info common;

	u8	num_queues;
	u8	num_tc;

	u8	port_mac[ETH_ALEN];
	u8	num_vlan_filters;
};

M
Manish Chopra 已提交
28 29 30
struct qed_update_vport_rss_params {
	u16	rss_ind_table[128];
	u32	rss_key[10];
31
	u8	rss_caps;
M
Manish Chopra 已提交
32 33 34 35 36 37
};

struct qed_update_vport_params {
	u8 vport_id;
	u8 update_vport_active_flg;
	u8 vport_active_flg;
38 39
	u8 update_accept_any_vlan_flg;
	u8 accept_any_vlan;
M
Manish Chopra 已提交
40 41 42 43
	u8 update_rss_flg;
	struct qed_update_vport_rss_params rss_params;
};

44 45 46 47 48 49 50 51
struct qed_start_vport_params {
	bool remove_inner_vlan;
	bool gro_enable;
	bool drop_ttl0;
	u8 vport_id;
	u16 mtu;
};

M
Manish Chopra 已提交
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
struct qed_stop_rxq_params {
	u8 rss_id;
	u8 rx_queue_id;
	u8 vport_id;
	bool eq_completion_only;
};

struct qed_stop_txq_params {
	u8 rss_id;
	u8 tx_queue_id;
};

enum qed_filter_rx_mode_type {
	QED_FILTER_RX_MODE_TYPE_REGULAR,
	QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC,
	QED_FILTER_RX_MODE_TYPE_PROMISC,
};

enum qed_filter_xcast_params_type {
	QED_FILTER_XCAST_TYPE_ADD,
	QED_FILTER_XCAST_TYPE_DEL,
	QED_FILTER_XCAST_TYPE_REPLACE,
};

struct qed_filter_ucast_params {
	enum qed_filter_xcast_params_type type;
	u8 vlan_valid;
	u16 vlan;
	u8 mac_valid;
	unsigned char mac[ETH_ALEN];
};

struct qed_filter_mcast_params {
	enum qed_filter_xcast_params_type type;
	u8 num;
	unsigned char mac[64][ETH_ALEN];
};

union qed_filter_type_params {
	enum qed_filter_rx_mode_type accept_flags;
	struct qed_filter_ucast_params ucast;
	struct qed_filter_mcast_params mcast;
};

enum qed_filter_type {
	QED_FILTER_TYPE_UCAST,
	QED_FILTER_TYPE_MCAST,
	QED_FILTER_TYPE_RX_MODE,
	QED_MAX_FILTER_TYPES,
};

struct qed_filter_params {
	enum qed_filter_type type;
	union qed_filter_type_params filter;
};

struct qed_queue_start_common_params {
	u8 rss_id;
	u8 queue_id;
	u8 vport_id;
	u16 sb;
	u16 sb_idx;
};

116 117 118 119 120 121 122
struct qed_tunn_params {
	u16 vxlan_port;
	u8 update_vxlan_port;
	u16 geneve_port;
	u8 update_geneve_port;
};

M
Manish Chopra 已提交
123 124
struct qed_eth_cb_ops {
	struct qed_common_cb_ops common;
Y
Yuval Mintz 已提交
125
	void (*force_mac) (void *dev, u8 *mac);
M
Manish Chopra 已提交
126 127
};

Y
Yuval Mintz 已提交
128 129
struct qed_eth_ops {
	const struct qed_common_ops *common;
Y
Yuval Mintz 已提交
130 131 132
#ifdef CONFIG_QED_SRIOV
	const struct qed_iov_hv_ops *iov;
#endif
Y
Yuval Mintz 已提交
133 134 135 136

	int (*fill_dev_info)(struct qed_dev *cdev,
			     struct qed_dev_eth_info *info);

Y
Yuval Mintz 已提交
137 138 139 140
	void (*register_ops)(struct qed_dev *cdev,
			     struct qed_eth_cb_ops *ops,
			     void *cookie);

Y
Yuval Mintz 已提交
141 142
	 bool(*check_mac) (struct qed_dev *cdev, u8 *mac);

M
Manish Chopra 已提交
143
	int (*vport_start)(struct qed_dev *cdev,
144
			   struct qed_start_vport_params *params);
M
Manish Chopra 已提交
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179

	int (*vport_stop)(struct qed_dev *cdev,
			  u8 vport_id);

	int (*vport_update)(struct qed_dev *cdev,
			    struct qed_update_vport_params *params);

	int (*q_rx_start)(struct qed_dev *cdev,
			  struct qed_queue_start_common_params *params,
			  u16 bd_max_bytes,
			  dma_addr_t bd_chain_phys_addr,
			  dma_addr_t cqe_pbl_addr,
			  u16 cqe_pbl_size,
			  void __iomem **pp_prod);

	int (*q_rx_stop)(struct qed_dev *cdev,
			 struct qed_stop_rxq_params *params);

	int (*q_tx_start)(struct qed_dev *cdev,
			  struct qed_queue_start_common_params *params,
			  dma_addr_t pbl_addr,
			  u16 pbl_size,
			  void __iomem **pp_doorbell);

	int (*q_tx_stop)(struct qed_dev *cdev,
			 struct qed_stop_txq_params *params);

	int (*filter_config)(struct qed_dev *cdev,
			     struct qed_filter_params *params);

	int (*fastpath_stop)(struct qed_dev *cdev);

	int (*eth_cqe_completion)(struct qed_dev *cdev,
				  u8 rss_id,
				  struct eth_slow_path_rx_cqe *cqe);
M
Manish Chopra 已提交
180 181 182

	void (*get_vport_stats)(struct qed_dev *cdev,
				struct qed_eth_stats *stats);
183 184 185

	int (*tunn_config)(struct qed_dev *cdev,
			   struct qed_tunn_params *params);
Y
Yuval Mintz 已提交
186 187
};

R
Rahul Verma 已提交
188
const struct qed_eth_ops *qed_get_eth_ops(void);
Y
Yuval Mintz 已提交
189 190 191
void qed_put_eth_ops(void);

#endif