#include <rdma/ib_mad.h>
#include <rdma/ib_smi.h>
#include <rdma/ib_sa.h>
#include <rdma/ib_cache.h>
#include <linux/random.h>
#include <linux/mlx4/cmd.h>
#include <linux/gfp.h>
#include <rdma/ib_pma.h>
#include <linux/ip.h>
#include <net/ipv6.h>
#include <linux/mlx4/driver.h>
#include "mlx4_ib.h"
enum { … };
#define MLX4_TUN_SEND_WRID_SHIFT …
#define MLX4_TUN_QPN_SHIFT …
#define MLX4_TUN_WRID_RECV …
#define MLX4_TUN_SET_WRID_QPN(a) …
#define MLX4_TUN_IS_RECV(a) …
#define MLX4_TUN_WRID_QPN(a) …
#define GET_BLK_PTR_FROM_EQE(eqe) …
#define GET_MASK_FROM_EQE(eqe) …
#define NUM_IDX_IN_PKEY_TBL_BLK …
#define GUID_TBL_ENTRY_SIZE …
#define GUID_TBL_BLK_NUM_ENTRIES …
#define GUID_TBL_BLK_SIZE …
struct mlx4_mad_rcv_buf { … } __packed;
struct mlx4_mad_snd_buf { … } __packed;
struct mlx4_tunnel_mad { … } __packed;
struct mlx4_rcv_tunnel_mad { … } __packed;
static void handle_client_rereg_event(struct mlx4_ib_dev *dev, u32 port_num);
static void handle_lid_change_event(struct mlx4_ib_dev *dev, u32 port_num);
static void __propagate_pkey_ev(struct mlx4_ib_dev *dev, int port_num,
int block, u32 change_bitmap);
__be64 mlx4_ib_gen_node_guid(void)
{ … }
__be64 mlx4_ib_get_new_demux_tid(struct mlx4_ib_demux_ctx *ctx)
{ … }
int mlx4_MAD_IFC(struct mlx4_ib_dev *dev, int mad_ifc_flags,
int port, const struct ib_wc *in_wc,
const struct ib_grh *in_grh,
const void *in_mad, void *response_mad)
{ … }
static void update_sm_ah(struct mlx4_ib_dev *dev, u32 port_num, u16 lid, u8 sl)
{ … }
static void smp_snoop(struct ib_device *ibdev, u32 port_num,
const struct ib_mad *mad, u16 prev_lid)
{ … }
static void __propagate_pkey_ev(struct mlx4_ib_dev *dev, int port_num,
int block, u32 change_bitmap)
{ … }
static void node_desc_override(struct ib_device *dev,
struct ib_mad *mad)
{ … }
static void forward_trap(struct mlx4_ib_dev *dev, u32 port_num,
const struct ib_mad *mad)
{ … }
static int mlx4_ib_demux_sa_handler(struct ib_device *ibdev, int port, int slave,
struct ib_sa_mad *sa_mad)
{ … }
int mlx4_ib_find_real_gid(struct ib_device *ibdev, u32 port, __be64 guid)
{ … }
static int find_slave_port_pkey_ix(struct mlx4_ib_dev *dev, int slave,
u32 port, u16 pkey, u16 *ix)
{ … }
static int get_gids_from_l3_hdr(struct ib_grh *grh, union ib_gid *sgid,
union ib_gid *dgid)
{ … }
static int is_proxy_qp0(struct mlx4_ib_dev *dev, int qpn, int slave)
{ … }
int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u32 port,
enum ib_qp_type dest_qpt, struct ib_wc *wc,
struct ib_grh *grh, struct ib_mad *mad)
{ … }
static int mlx4_ib_demux_mad(struct ib_device *ibdev, u32 port,
struct ib_wc *wc, struct ib_grh *grh,
struct ib_mad *mad)
{ … }
static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u32 port_num,
const struct ib_wc *in_wc, const struct ib_grh *in_grh,
const struct ib_mad *in_mad, struct ib_mad *out_mad)
{ … }
static void edit_counter(struct mlx4_counter *cnt, void *counters,
__be16 attr_id)
{ … }
static int iboe_process_mad_port_info(void *out_mad)
{ … }
static int iboe_process_mad(struct ib_device *ibdev, int mad_flags,
u32 port_num, const struct ib_wc *in_wc,
const struct ib_grh *in_grh,
const struct ib_mad *in_mad, struct ib_mad *out_mad)
{ … }
int mlx4_ib_process_mad(struct ib_device *ibdev, int mad_flags, u32 port_num,
const struct ib_wc *in_wc, const struct ib_grh *in_grh,
const struct ib_mad *in, struct ib_mad *out,
size_t *out_mad_size, u16 *out_mad_pkey_index)
{ … }
static void send_handler(struct ib_mad_agent *agent,
struct ib_mad_send_wc *mad_send_wc)
{ … }
int mlx4_ib_mad_init(struct mlx4_ib_dev *dev)
{ … }
void mlx4_ib_mad_cleanup(struct mlx4_ib_dev *dev)
{ … }
static void handle_lid_change_event(struct mlx4_ib_dev *dev, u32 port_num)
{ … }
static void handle_client_rereg_event(struct mlx4_ib_dev *dev, u32 port_num)
{ … }
static void propagate_pkey_ev(struct mlx4_ib_dev *dev, int port_num,
struct mlx4_eqe *eqe)
{ … }
static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u32 port_num,
u32 guid_tbl_blk_num, u32 change_bitmap)
{ … }
void handle_port_mgmt_change_event(struct work_struct *work)
{ … }
void mlx4_ib_dispatch_event(struct mlx4_ib_dev *dev, u32 port_num,
enum ib_event_type type)
{ … }
static void mlx4_ib_tunnel_comp_handler(struct ib_cq *cq, void *arg)
{ … }
static void mlx4_ib_wire_comp_handler(struct ib_cq *cq, void *arg)
{ … }
static int mlx4_ib_post_pv_qp_buf(struct mlx4_ib_demux_pv_ctx *ctx,
struct mlx4_ib_demux_pv_qp *tun_qp,
int index)
{ … }
static int mlx4_ib_multiplex_sa_handler(struct ib_device *ibdev, int port,
int slave, struct ib_sa_mad *sa_mad)
{ … }
int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u32 port,
enum ib_qp_type dest_qpt, u16 pkey_index,
u32 remote_qpn, u32 qkey, struct rdma_ah_attr *attr,
u8 *s_mac, u16 vlan_id, struct ib_mad *mad)
{ … }
static int get_slave_base_gid_ix(struct mlx4_ib_dev *dev, int slave, int port)
{ … }
static void fill_in_real_sgid_index(struct mlx4_ib_dev *dev, int slave, int port,
struct rdma_ah_attr *ah_attr)
{ … }
static void mlx4_ib_multiplex_mad(struct mlx4_ib_demux_pv_ctx *ctx, struct ib_wc *wc)
{ … }
static int mlx4_ib_alloc_pv_bufs(struct mlx4_ib_demux_pv_ctx *ctx,
enum ib_qp_type qp_type, int is_tun)
{ … }
static void mlx4_ib_free_pv_qp_bufs(struct mlx4_ib_demux_pv_ctx *ctx,
enum ib_qp_type qp_type, int is_tun)
{ … }
static void mlx4_ib_tunnel_comp_worker(struct work_struct *work)
{ … }
static void pv_qp_event_handler(struct ib_event *event, void *qp_context)
{ … }
static int create_pv_sqp(struct mlx4_ib_demux_pv_ctx *ctx,
enum ib_qp_type qp_type, int create_tun)
{ … }
static void mlx4_ib_sqp_comp_worker(struct work_struct *work)
{ … }
static int alloc_pv_object(struct mlx4_ib_dev *dev, int slave, int port,
struct mlx4_ib_demux_pv_ctx **ret_ctx)
{ … }
static void free_pv_object(struct mlx4_ib_dev *dev, int slave, int port)
{ … }
static int create_pv_resources(struct ib_device *ibdev, int slave, int port,
int create_tun, struct mlx4_ib_demux_pv_ctx *ctx)
{ … }
static void destroy_pv_resources(struct mlx4_ib_dev *dev, int slave, int port,
struct mlx4_ib_demux_pv_ctx *ctx, int flush)
{ … }
static int mlx4_ib_tunnels_update(struct mlx4_ib_dev *dev, int slave,
int port, int do_init)
{ … }
void mlx4_ib_tunnels_update_work(struct work_struct *work)
{ … }
static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev,
struct mlx4_ib_demux_ctx *ctx,
int port)
{ … }
static void mlx4_ib_free_sqp_ctx(struct mlx4_ib_demux_pv_ctx *sqp_ctx)
{ … }
static void mlx4_ib_free_demux_ctx(struct mlx4_ib_demux_ctx *ctx)
{ … }
static void mlx4_ib_master_tunnels(struct mlx4_ib_dev *dev, int do_init)
{ … }
int mlx4_ib_init_sriov(struct mlx4_ib_dev *dev)
{ … }
void mlx4_ib_close_sriov(struct mlx4_ib_dev *dev)
{ … }