#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/netdevice.h>
#include <linux/inetdevice.h>
#include <linux/rtnetlink.h>
#include <linux/if_vlan.h>
#include <linux/sched/mm.h>
#include <linux/sched/task.h>
#include <net/ipv6.h>
#include <net/addrconf.h>
#include <net/devlink.h>
#include <rdma/ib_smi.h>
#include <rdma/ib_user_verbs.h>
#include <rdma/ib_addr.h>
#include <rdma/ib_cache.h>
#include <net/bonding.h>
#include <linux/mlx4/driver.h>
#include <linux/mlx4/cmd.h>
#include <linux/mlx4/qp.h>
#include "mlx4_ib.h"
#include <rdma/mlx4-abi.h>
#define DRV_NAME …
#define DRV_VERSION …
#define MLX4_IB_FLOW_MAX_PRIO …
#define MLX4_IB_FLOW_QPN_MASK …
#define MLX4_IB_CARD_REV_A0 …
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
int mlx4_ib_sm_guid_assign = …;
module_param_named(sm_guid_assign, mlx4_ib_sm_guid_assign, int, 0444);
MODULE_PARM_DESC(…) …;
static const char mlx4_ib_version[] = …;
static void do_slave_init(struct mlx4_ib_dev *ibdev, int slave, int do_init);
static enum rdma_link_layer mlx4_ib_port_link_layer(struct ib_device *device,
u32 port_num);
static int mlx4_ib_event(struct notifier_block *this, unsigned long event,
void *param);
static struct workqueue_struct *wq;
static int check_flow_steering_support(struct mlx4_dev *dev)
{ … }
static int num_ib_ports(struct mlx4_dev *dev)
{ … }
static struct net_device *mlx4_ib_get_netdev(struct ib_device *device,
u32 port_num)
{ … }
static int mlx4_ib_update_gids_v1(struct gid_entry *gids,
struct mlx4_ib_dev *ibdev,
u32 port_num)
{ … }
static int mlx4_ib_update_gids_v1_v2(struct gid_entry *gids,
struct mlx4_ib_dev *ibdev,
u32 port_num)
{ … }
static int mlx4_ib_update_gids(struct gid_entry *gids,
struct mlx4_ib_dev *ibdev,
u32 port_num)
{ … }
static void free_gid_entry(struct gid_entry *entry)
{ … }
static int mlx4_ib_add_gid(const struct ib_gid_attr *attr, void **context)
{ … }
static int mlx4_ib_del_gid(const struct ib_gid_attr *attr, void **context)
{ … }
int mlx4_ib_gid_index_to_real_index(struct mlx4_ib_dev *ibdev,
const struct ib_gid_attr *attr)
{ … }
static int mlx4_ib_query_device(struct ib_device *ibdev,
struct ib_device_attr *props,
struct ib_udata *uhw)
{ … }
static enum rdma_link_layer
mlx4_ib_port_link_layer(struct ib_device *device, u32 port_num)
{ … }
static int ib_link_query_port(struct ib_device *ibdev, u32 port,
struct ib_port_attr *props, int netw_view)
{ … }
static u8 state_to_phys_state(enum ib_port_state state)
{ … }
static int eth_link_query_port(struct ib_device *ibdev, u32 port,
struct ib_port_attr *props)
{ … }
int __mlx4_ib_query_port(struct ib_device *ibdev, u32 port,
struct ib_port_attr *props, int netw_view)
{ … }
static int mlx4_ib_query_port(struct ib_device *ibdev, u32 port,
struct ib_port_attr *props)
{ … }
int __mlx4_ib_query_gid(struct ib_device *ibdev, u32 port, int index,
union ib_gid *gid, int netw_view)
{ … }
static int mlx4_ib_query_gid(struct ib_device *ibdev, u32 port, int index,
union ib_gid *gid)
{ … }
static int mlx4_ib_query_sl2vl(struct ib_device *ibdev, u32 port,
u64 *sl2vl_tbl)
{ … }
static void mlx4_init_sl2vl_tbl(struct mlx4_ib_dev *mdev)
{ … }
int __mlx4_ib_query_pkey(struct ib_device *ibdev, u32 port, u16 index,
u16 *pkey, int netw_view)
{ … }
static int mlx4_ib_query_pkey(struct ib_device *ibdev, u32 port, u16 index,
u16 *pkey)
{ … }
static int mlx4_ib_modify_device(struct ib_device *ibdev, int mask,
struct ib_device_modify *props)
{ … }
static int mlx4_ib_SET_PORT(struct mlx4_ib_dev *dev, u32 port,
int reset_qkey_viols, u32 cap_mask)
{ … }
static int mlx4_ib_modify_port(struct ib_device *ibdev, u32 port, int mask,
struct ib_port_modify *props)
{ … }
static int mlx4_ib_alloc_ucontext(struct ib_ucontext *uctx,
struct ib_udata *udata)
{ … }
static void mlx4_ib_dealloc_ucontext(struct ib_ucontext *ibcontext)
{ … }
static void mlx4_ib_disassociate_ucontext(struct ib_ucontext *ibcontext)
{ … }
static int mlx4_ib_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
{ … }
static int mlx4_ib_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)
{ … }
static int mlx4_ib_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata)
{ … }
static int mlx4_ib_alloc_xrcd(struct ib_xrcd *ibxrcd, struct ib_udata *udata)
{ … }
static int mlx4_ib_dealloc_xrcd(struct ib_xrcd *xrcd, struct ib_udata *udata)
{ … }
static int add_gid_entry(struct ib_qp *ibqp, union ib_gid *gid)
{ … }
static void mlx4_ib_delete_counters_table(struct mlx4_ib_dev *ibdev,
struct mlx4_ib_counters *ctr_table)
{ … }
int mlx4_ib_add_mc(struct mlx4_ib_dev *mdev, struct mlx4_ib_qp *mqp,
union ib_gid *gid)
{ … }
struct mlx4_ib_steering { … };
#define LAST_ETH_FIELD …
#define LAST_IB_FIELD …
#define LAST_IPV4_FIELD …
#define LAST_TCP_UDP_FIELD …
#define FIELDS_NOT_SUPPORTED(filter, field) …
static int parse_flow_attr(struct mlx4_dev *dev,
u32 qp_num,
union ib_flow_spec *ib_spec,
struct _rule_hw *mlx4_spec)
{ … }
struct default_rules { … };
static const struct default_rules default_table[] = …;
static int __mlx4_ib_default_rules_match(struct ib_qp *qp,
struct ib_flow_attr *flow_attr)
{ … }
static int __mlx4_ib_create_default_rules(
struct mlx4_ib_dev *mdev,
struct ib_qp *qp,
const struct default_rules *pdefault_rules,
struct _rule_hw *mlx4_spec) { … }
static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_attr,
int domain,
enum mlx4_net_trans_promisc_mode flow_type,
u64 *reg_id)
{ … }
static int __mlx4_ib_destroy_flow(struct mlx4_dev *dev, u64 reg_id)
{ … }
static int mlx4_ib_tunnel_steer_add(struct ib_qp *qp, struct ib_flow_attr *flow_attr,
u64 *reg_id)
{ … }
static int mlx4_ib_add_dont_trap_rule(struct mlx4_dev *dev,
struct ib_flow_attr *flow_attr,
enum mlx4_net_trans_promisc_mode *type)
{ … }
static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
struct ib_flow_attr *flow_attr,
struct ib_udata *udata)
{ … }
static int mlx4_ib_destroy_flow(struct ib_flow *flow_id)
{ … }
static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
{ … }
static struct mlx4_ib_gid_entry *find_gid_entry(struct mlx4_ib_qp *qp, u8 *raw)
{ … }
static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
{ … }
static int init_node_data(struct mlx4_ib_dev *dev)
{ … }
static ssize_t hca_type_show(struct device *device,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(hca_type);
static ssize_t hw_rev_show(struct device *device,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(hw_rev);
static ssize_t board_id_show(struct device *device,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(board_id);
static struct attribute *mlx4_class_attributes[] = …;
static const struct attribute_group mlx4_attr_group = …;
struct diag_counter { … };
#define DIAG_COUNTER(_name, _offset) …
static const struct diag_counter diag_basic[] = …;
static const struct diag_counter diag_ext[] = …;
static const struct diag_counter diag_device_only[] = …;
static struct rdma_hw_stats *
mlx4_ib_alloc_hw_device_stats(struct ib_device *ibdev)
{ … }
static struct rdma_hw_stats *
mlx4_ib_alloc_hw_port_stats(struct ib_device *ibdev, u32 port_num)
{ … }
static int mlx4_ib_get_hw_stats(struct ib_device *ibdev,
struct rdma_hw_stats *stats,
u32 port, int index)
{ … }
static int __mlx4_ib_alloc_diag_counters(struct mlx4_ib_dev *ibdev,
struct rdma_stat_desc **pdescs,
u32 **offset, u32 *num, bool port)
{ … }
static void mlx4_ib_fill_diag_counters(struct mlx4_ib_dev *ibdev,
struct rdma_stat_desc *descs,
u32 *offset, bool port)
{ … }
static const struct ib_device_ops mlx4_ib_hw_stats_ops = …;
static const struct ib_device_ops mlx4_ib_hw_stats_ops1 = …;
static int mlx4_ib_alloc_diag_counters(struct mlx4_ib_dev *ibdev)
{ … }
static void mlx4_ib_diag_cleanup(struct mlx4_ib_dev *ibdev)
{ … }
#define MLX4_IB_INVALID_MAC …
static void mlx4_ib_update_qps(struct mlx4_ib_dev *ibdev,
struct net_device *dev,
int port)
{ … }
static void mlx4_ib_scan_netdev(struct mlx4_ib_dev *ibdev,
struct net_device *dev,
unsigned long event)
{ … }
static int mlx4_ib_netdev_event(struct notifier_block *this,
unsigned long event, void *ptr)
{ … }
static void init_pkeys(struct mlx4_ib_dev *ibdev)
{ … }
static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev)
{ … }
static void mlx4_ib_free_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev)
{ … }
static int mlx4_port_immutable(struct ib_device *ibdev, u32 port_num,
struct ib_port_immutable *immutable)
{ … }
static void get_fw_ver_str(struct ib_device *device, char *str)
{ … }
static const struct ib_device_ops mlx4_ib_dev_ops = …;
static const struct ib_device_ops mlx4_ib_dev_wq_ops = …;
static const struct ib_device_ops mlx4_ib_dev_mw_ops = …;
static const struct ib_device_ops mlx4_ib_dev_xrc_ops = …;
static const struct ib_device_ops mlx4_ib_dev_fs_ops = …;
static int mlx4_ib_probe(struct auxiliary_device *adev,
const struct auxiliary_device_id *id)
{ … }
int mlx4_ib_steer_qp_alloc(struct mlx4_ib_dev *dev, int count, int *qpn)
{ … }
void mlx4_ib_steer_qp_free(struct mlx4_ib_dev *dev, u32 qpn, int count)
{ … }
int mlx4_ib_steer_qp_reg(struct mlx4_ib_dev *mdev, struct mlx4_ib_qp *mqp,
int is_attach)
{ … }
static void mlx4_ib_remove(struct auxiliary_device *adev)
{ … }
static void do_slave_init(struct mlx4_ib_dev *ibdev, int slave, int do_init)
{ … }
static void mlx4_ib_handle_catas_error(struct mlx4_ib_dev *ibdev)
{ … }
static void handle_bonded_port_state_event(struct work_struct *work)
{ … }
void mlx4_ib_sl2vl_update(struct mlx4_ib_dev *mdev, int port)
{ … }
static void ib_sl2vl_update_work(struct work_struct *work)
{ … }
void mlx4_sched_ib_sl2vl_update_work(struct mlx4_ib_dev *ibdev,
int port)
{ … }
static int mlx4_ib_event(struct notifier_block *this, unsigned long event,
void *param)
{ … }
static const struct auxiliary_device_id mlx4_ib_id_table[] = …;
MODULE_DEVICE_TABLE(auxiliary, mlx4_ib_id_table);
static struct mlx4_adrv mlx4_ib_adrv = …;
static int __init mlx4_ib_init(void)
{ … }
static void __exit mlx4_ib_cleanup(void)
{ … }
module_init(…) …;
module_exit(mlx4_ib_cleanup);