aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mlx4/device.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mlx4/device.h')
-rw-r--r--include/linux/mlx4/device.h69
1 files changed, 64 insertions, 5 deletions
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 6e1b0f973a03..6d1acb04cd17 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -54,7 +54,13 @@ enum {
54}; 54};
55 55
56enum { 56enum {
57 MLX4_MAX_PORTS = 2 57 MLX4_PORT_CAP_IS_SM = 1 << 1,
58 MLX4_PORT_CAP_DEV_MGMT_SUP = 1 << 19,
59};
60
61enum {
62 MLX4_MAX_PORTS = 2,
63 MLX4_MAX_PORT_PKEYS = 128
58}; 64};
59 65
60/* base qkey for use in sriov tunnel-qp/proxy-qp communication. 66/* base qkey for use in sriov tunnel-qp/proxy-qp communication.
@@ -191,6 +197,25 @@ enum {
191 MLX4_FATAL_WARNING_SUBTYPE_WARMING = 0, 197 MLX4_FATAL_WARNING_SUBTYPE_WARMING = 0,
192}; 198};
193 199
200enum slave_port_state {
201 SLAVE_PORT_DOWN = 0,
202 SLAVE_PENDING_UP,
203 SLAVE_PORT_UP,
204};
205
206enum slave_port_gen_event {
207 SLAVE_PORT_GEN_EVENT_DOWN = 0,
208 SLAVE_PORT_GEN_EVENT_UP,
209 SLAVE_PORT_GEN_EVENT_NONE,
210};
211
212enum slave_port_state_event {
213 MLX4_PORT_STATE_DEV_EVENT_PORT_DOWN,
214 MLX4_PORT_STATE_DEV_EVENT_PORT_UP,
215 MLX4_PORT_STATE_IB_PORT_STATE_EVENT_GID_VALID,
216 MLX4_PORT_STATE_IB_EVENT_GID_INVALID,
217};
218
194enum { 219enum {
195 MLX4_PERM_LOCAL_READ = 1 << 10, 220 MLX4_PERM_LOCAL_READ = 1 << 10,
196 MLX4_PERM_LOCAL_WRITE = 1 << 11, 221 MLX4_PERM_LOCAL_WRITE = 1 << 11,
@@ -303,6 +328,9 @@ struct mlx4_phys_caps {
303 u32 gid_phys_table_len[MLX4_MAX_PORTS + 1]; 328 u32 gid_phys_table_len[MLX4_MAX_PORTS + 1];
304 u32 pkey_phys_table_len[MLX4_MAX_PORTS + 1]; 329 u32 pkey_phys_table_len[MLX4_MAX_PORTS + 1];
305 u32 num_phys_eqs; 330 u32 num_phys_eqs;
331 u32 base_sqpn;
332 u32 base_proxy_sqpn;
333 u32 base_tunnel_sqpn;
306}; 334};
307 335
308struct mlx4_caps { 336struct mlx4_caps {
@@ -333,9 +361,10 @@ struct mlx4_caps {
333 int max_rq_desc_sz; 361 int max_rq_desc_sz;
334 int max_qp_init_rdma; 362 int max_qp_init_rdma;
335 int max_qp_dest_rdma; 363 int max_qp_dest_rdma;
336 int sqp_start; 364 u32 *qp0_proxy;
337 u32 base_sqpn; 365 u32 *qp1_proxy;
338 u32 base_tunnel_sqpn; 366 u32 *qp0_tunnel;
367 u32 *qp1_tunnel;
339 int num_srqs; 368 int num_srqs;
340 int max_srq_wqes; 369 int max_srq_wqes;
341 int max_srq_sge; 370 int max_srq_sge;
@@ -389,6 +418,7 @@ struct mlx4_caps {
389 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; 418 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1];
390 u32 max_counters; 419 u32 max_counters;
391 u8 port_ib_mtu[MLX4_MAX_PORTS + 1]; 420 u8 port_ib_mtu[MLX4_MAX_PORTS + 1];
421 u16 sqp_demux;
392}; 422};
393 423
394struct mlx4_buf_list { 424struct mlx4_buf_list {
@@ -671,6 +701,10 @@ struct mlx4_init_port_param {
671 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 701 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
672 if ((type) == (dev)->caps.port_mask[(port)]) 702 if ((type) == (dev)->caps.port_mask[(port)])
673 703
704#define mlx4_foreach_non_ib_transport_port(port, dev) \
705 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
706 if (((dev)->caps.port_mask[port] != MLX4_PORT_TYPE_IB))
707
674#define mlx4_foreach_ib_transport_port(port, dev) \ 708#define mlx4_foreach_ib_transport_port(port, dev) \
675 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 709 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
676 if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \ 710 if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \
@@ -692,7 +726,18 @@ static inline int mlx4_is_master(struct mlx4_dev *dev)
692 726
693static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn) 727static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn)
694{ 728{
695 return (qpn < dev->caps.sqp_start + 8); 729 return (qpn < dev->phys_caps.base_sqpn + 8 +
730 16 * MLX4_MFUNC_MAX * !!mlx4_is_master(dev));
731}
732
733static inline int mlx4_is_guest_proxy(struct mlx4_dev *dev, int slave, u32 qpn)
734{
735 int guest_proxy_base = dev->phys_caps.base_proxy_sqpn + slave * 8;
736
737 if (qpn >= guest_proxy_base && qpn < guest_proxy_base + 8)
738 return 1;
739
740 return 0;
696} 741}
697 742
698static inline int mlx4_is_mfunc(struct mlx4_dev *dev) 743static inline int mlx4_is_mfunc(struct mlx4_dev *dev)
@@ -927,6 +972,20 @@ int mlx4_flow_attach(struct mlx4_dev *dev,
927 struct mlx4_net_trans_rule *rule, u64 *reg_id); 972 struct mlx4_net_trans_rule *rule, u64 *reg_id);
928int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id); 973int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id);
929 974
975void mlx4_sync_pkey_table(struct mlx4_dev *dev, int slave, int port,
976 int i, int val);
977
930int mlx4_get_parav_qkey(struct mlx4_dev *dev, u32 qpn, u32 *qkey); 978int mlx4_get_parav_qkey(struct mlx4_dev *dev, u32 qpn, u32 *qkey);
931 979
980int mlx4_is_slave_active(struct mlx4_dev *dev, int slave);
981int mlx4_gen_pkey_eqe(struct mlx4_dev *dev, int slave, u8 port);
982int mlx4_gen_guid_change_eqe(struct mlx4_dev *dev, int slave, u8 port);
983int mlx4_gen_slaves_port_mgt_ev(struct mlx4_dev *dev, u8 port, int attr);
984int mlx4_gen_port_state_change_eqe(struct mlx4_dev *dev, int slave, u8 port, u8 port_subtype_change);
985enum slave_port_state mlx4_get_slave_port_state(struct mlx4_dev *dev, int slave, u8 port);
986int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, u8 port, int event, enum slave_port_gen_event *gen_event);
987
988void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid);
989__be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave);
990
932#endif /* MLX4_DEVICE_H */ 991#endif /* MLX4_DEVICE_H */