linux/drivers/infiniband/hw/bnxt_re/main.c

/*
 * Broadcom NetXtreme-E RoCE driver.
 *
 * Copyright (c) 2016 - 2017, Broadcom. All rights reserved.  The term
 * Broadcom refers to Broadcom Limited and/or its subsidiaries.
 *
 * This software is available to you under a choice of one of two
 * licenses.  You may choose to be licensed 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, or the
 * BSD license below:
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Description: Main component of the bnxt_re driver
 */

#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/ethtool.h>
#include <linux/mutex.h>
#include <linux/list.h>
#include <linux/rculist.h>
#include <linux/spinlock.h>
#include <linux/pci.h>
#include <net/dcbnl.h>
#include <net/ipv6.h>
#include <net/addrconf.h>
#include <linux/if_ether.h>
#include <linux/auxiliary_bus.h>

#include <rdma/ib_verbs.h>
#include <rdma/ib_user_verbs.h>
#include <rdma/ib_umem.h>
#include <rdma/ib_addr.h>
#include <linux/hashtable.h>

#include "bnxt_ulp.h"
#include "roce_hsi.h"
#include "qplib_res.h"
#include "qplib_sp.h"
#include "qplib_fp.h"
#include "qplib_rcfw.h"
#include "bnxt_re.h"
#include "ib_verbs.h"
#include <rdma/bnxt_re-abi.h>
#include "bnxt.h"
#include "hw_counters.h"

static char version[] =;

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

/* globals */
static DEFINE_MUTEX(bnxt_re_mutex);

static void bnxt_re_stop_irq(void *handle);
static void bnxt_re_dev_stop(struct bnxt_re_dev *rdev);
static int bnxt_re_netdev_event(struct notifier_block *notifier,
				unsigned long event, void *ptr);
static struct bnxt_re_dev *bnxt_re_from_netdev(struct net_device *netdev);
static void bnxt_re_dev_uninit(struct bnxt_re_dev *rdev);
static int bnxt_re_hwrm_qcaps(struct bnxt_re_dev *rdev);

static int bnxt_re_hwrm_qcfg(struct bnxt_re_dev *rdev, u32 *db_len,
			     u32 *offset);
static void bnxt_re_set_db_offset(struct bnxt_re_dev *rdev)
{}

static void bnxt_re_set_drv_mode(struct bnxt_re_dev *rdev, u8 mode)
{}

static void bnxt_re_destroy_chip_ctx(struct bnxt_re_dev *rdev)
{}

static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev, u8 wqe_mode)
{}

/* SR-IOV helper functions */

static void bnxt_re_get_sriov_func_type(struct bnxt_re_dev *rdev)
{}

/* Set the maximum number of each resource that the driver actually wants
 * to allocate. This may be up to the maximum number the firmware has
 * reserved for the function. The driver may choose to allocate fewer
 * resources than the firmware maximum.
 */
static void bnxt_re_limit_pf_res(struct bnxt_re_dev *rdev)
{}

static void bnxt_re_limit_vf_res(struct bnxt_qplib_ctx *qplib_ctx, u32 num_vf)
{}

static void bnxt_re_set_resource_limits(struct bnxt_re_dev *rdev)
{}

static void bnxt_re_vf_res_config(struct bnxt_re_dev *rdev)
{}

static void bnxt_re_shutdown(struct auxiliary_device *adev)
{}

static void bnxt_re_stop_irq(void *handle)
{}

static void bnxt_re_start_irq(void *handle, struct bnxt_msix_entry *ent)
{}

static struct bnxt_ulp_ops bnxt_re_ulp_ops =;

/* RoCE -> Net driver */

static int bnxt_re_register_netdev(struct bnxt_re_dev *rdev)
{}

static void bnxt_re_init_hwrm_hdr(struct input *hdr, u16 opcd)
{}

static void bnxt_re_fill_fw_msg(struct bnxt_fw_msg *fw_msg, void *msg,
				int msg_len, void *resp, int resp_max_len,
				int timeout)
{}

/* Query device config using common hwrm */
static int bnxt_re_hwrm_qcfg(struct bnxt_re_dev *rdev, u32 *db_len,
			     u32 *offset)
{}

/* Query function capabilities using common hwrm */
int bnxt_re_hwrm_qcaps(struct bnxt_re_dev *rdev)
{}

static int bnxt_re_hwrm_dbr_pacing_qcfg(struct bnxt_re_dev *rdev)
{}

/* Update the pacing tunable parameters to the default values */
static void bnxt_re_set_default_pacing_data(struct bnxt_re_dev *rdev)
{}

static u32 __get_fifo_occupancy(struct bnxt_re_dev *rdev)
{}

static bool is_dbr_fifo_full(struct bnxt_re_dev *rdev)
{}

static void __wait_for_fifo_occupancy_below_th(struct bnxt_re_dev *rdev)
{}

static void bnxt_re_db_fifo_check(struct work_struct *work)
{}

static void bnxt_re_pacing_timer_exp(struct work_struct *work)
{}

void bnxt_re_pacing_alert(struct bnxt_re_dev *rdev)
{}

static int bnxt_re_initialize_dbr_pacing(struct bnxt_re_dev *rdev)
{}

static void bnxt_re_deinitialize_dbr_pacing(struct bnxt_re_dev *rdev)
{}

static int bnxt_re_net_ring_free(struct bnxt_re_dev *rdev,
				 u16 fw_ring_id, int type)
{}

static int bnxt_re_net_ring_alloc(struct bnxt_re_dev *rdev,
				  struct bnxt_re_ring_attr *ring_attr,
				  u16 *fw_ring_id)
{}

static int bnxt_re_net_stats_ctx_free(struct bnxt_re_dev *rdev,
				      u32 fw_stats_ctx_id)
{}

static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev,
				       dma_addr_t dma_map,
				       u32 *fw_stats_ctx_id)
{}

static void bnxt_re_disassociate_ucontext(struct ib_ucontext *ibcontext)
{}

/* Device */

static struct bnxt_re_dev *bnxt_re_from_netdev(struct net_device *netdev)
{}

static ssize_t hw_rev_show(struct device *device, struct device_attribute *attr,
			   char *buf)
{}
static DEVICE_ATTR_RO(hw_rev);

static ssize_t hca_type_show(struct device *device,
			     struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(hca_type);

static struct attribute *bnxt_re_attributes[] =;

static const struct attribute_group bnxt_re_dev_attr_group =;

static const struct ib_device_ops bnxt_re_dev_ops =;

static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
{}

static struct bnxt_re_dev *bnxt_re_dev_add(struct bnxt_aux_priv *aux_priv,
					   struct bnxt_en_dev *en_dev)
{}

static int bnxt_re_handle_unaffi_async_event(struct creq_func_event
					     *unaffi_async)
{}

static int bnxt_re_handle_qp_async_event(struct creq_qp_event *qp_event,
					 struct bnxt_re_qp *qp)
{}

static int bnxt_re_handle_cq_async_error(void *event, struct bnxt_re_cq *cq)
{}

static int bnxt_re_handle_affi_async_event(struct creq_qp_event *affi_async,
					   void *obj)
{}

static int bnxt_re_aeq_handler(struct bnxt_qplib_rcfw *rcfw,
			       void *aeqe, void *obj)
{}

static int bnxt_re_srqn_handler(struct bnxt_qplib_nq *nq,
				struct bnxt_qplib_srq *handle, u8 event)
{}

static int bnxt_re_cqn_handler(struct bnxt_qplib_nq *nq,
			       struct bnxt_qplib_cq *handle)
{}

static void bnxt_re_cleanup_res(struct bnxt_re_dev *rdev)
{}

static int bnxt_re_init_res(struct bnxt_re_dev *rdev)
{}

static void bnxt_re_free_nq_res(struct bnxt_re_dev *rdev)
{}

static void bnxt_re_free_res(struct bnxt_re_dev *rdev)
{}

static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev)
{}

static void bnxt_re_dispatch_event(struct ib_device *ibdev, struct ib_qp *qp,
				   u8 port_num, enum ib_event_type event)
{}

static bool bnxt_re_is_qp1_or_shadow_qp(struct bnxt_re_dev *rdev,
					struct bnxt_re_qp *qp)
{}

static void bnxt_re_dev_stop(struct bnxt_re_dev *rdev)
{}

static int bnxt_re_update_gid(struct bnxt_re_dev *rdev)
{}

static u32 bnxt_re_get_priority_mask(struct bnxt_re_dev *rdev)
{}

static int bnxt_re_setup_qos(struct bnxt_re_dev *rdev)
{}

static void bnxt_re_query_hwrm_intf_version(struct bnxt_re_dev *rdev)
{}

static int bnxt_re_ib_init(struct bnxt_re_dev *rdev)
{}

static void bnxt_re_dev_uninit(struct bnxt_re_dev *rdev)
{}

/* worker thread for polling periodic events. Now used for QoS programming*/
static void bnxt_re_worker(struct work_struct *work)
{}

static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 wqe_mode)
{}

static int bnxt_re_add_device(struct auxiliary_device *adev, u8 wqe_mode)
{}

static void bnxt_re_setup_cc(struct bnxt_re_dev *rdev, bool enable)
{}

/*
 * "Notifier chain callback can be invoked for the same chain from
 * different CPUs at the same time".
 *
 * For cases when the netdev is already present, our call to the
 * register_netdevice_notifier() will actually get the rtnl_lock()
 * before sending NETDEV_REGISTER and (if up) NETDEV_UP
 * events.
 *
 * But for cases when the netdev is not already present, the notifier
 * chain is subjected to be invoked from different CPUs simultaneously.
 *
 * This is protected by the netdev_mutex.
 */
static int bnxt_re_netdev_event(struct notifier_block *notifier,
				unsigned long event, void *ptr)
{}

#define BNXT_ADEV_NAME

static void bnxt_re_remove(struct auxiliary_device *adev)
{}

static int bnxt_re_probe(struct auxiliary_device *adev,
			 const struct auxiliary_device_id *id)
{}

static int bnxt_re_suspend(struct auxiliary_device *adev, pm_message_t state)
{}

static int bnxt_re_resume(struct auxiliary_device *adev)
{}

static const struct auxiliary_device_id bnxt_re_id_table[] =;

MODULE_DEVICE_TABLE(auxiliary, bnxt_re_id_table);

static struct auxiliary_driver bnxt_re_driver =;

static int __init bnxt_re_mod_init(void)
{}

static void __exit bnxt_re_mod_exit(void)
{}

module_init();
module_exit(bnxt_re_mod_exit);