linux/drivers/net/ethernet/mellanox/mlx5/core/main.c

/*
 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
 *
 * 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
 * OpenIB.org BSD license below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - 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.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#include <linux/highmem.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/mlx5/driver.h>
#include <linux/mlx5/cq.h>
#include <linux/mlx5/qp.h>
#include <linux/debugfs.h>
#include <linux/kmod.h>
#include <linux/mlx5/mlx5_ifc.h>
#include <linux/mlx5/vport.h>
#include <linux/version.h>
#include <net/devlink.h>
#include "mlx5_core.h"
#include "lib/eq.h"
#include "fs_core.h"
#include "lib/mpfs.h"
#include "eswitch.h"
#include "devlink.h"
#include "fw_reset.h"
#include "lib/mlx5.h"
#include "lib/tout.h"
#include "fpga/core.h"
#include "en_accel/ipsec.h"
#include "lib/clock.h"
#include "lib/vxlan.h"
#include "lib/geneve.h"
#include "lib/devcom.h"
#include "lib/pci_vsc.h"
#include "diag/fw_tracer.h"
#include "ecpf.h"
#include "lib/hv_vhca.h"
#include "diag/rsc_dump.h"
#include "sf/vhca_event.h"
#include "sf/dev/dev.h"
#include "sf/sf.h"
#include "mlx5_irq.h"
#include "hwmon.h"
#include "lag/lag.h"

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

unsigned int mlx5_core_debug_mask;
module_param_named(debug_mask, mlx5_core_debug_mask, uint, 0644);
MODULE_PARM_DESC();

static unsigned int prof_sel =;
module_param_named(prof_sel, prof_sel, uint, 0444);
MODULE_PARM_DESC();

static u32 sw_owner_id[4];
#define MAX_SW_VHCA_ID
static DEFINE_IDA(sw_vhca_ida);

enum {};

#define LOG_MAX_SUPPORTED_QPS

static struct mlx5_profile profile[] =;

static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili,
			u32 warn_time_mili, const char *init_state)
{}

static void mlx5_set_driver_version(struct mlx5_core_dev *dev)
{}

static int set_dma_caps(struct pci_dev *pdev)
{}

static int mlx5_pci_enable_device(struct mlx5_core_dev *dev)
{}

static void mlx5_pci_disable_device(struct mlx5_core_dev *dev)
{}

static int request_bar(struct pci_dev *pdev)
{}

static void release_bar(struct pci_dev *pdev)
{}

struct mlx5_reg_host_endianness {};

static u16 to_fw_pkey_sz(struct mlx5_core_dev *dev, u32 size)
{}

void mlx5_core_uplink_netdev_set(struct mlx5_core_dev *dev, struct net_device *netdev)
{}

void mlx5_core_uplink_netdev_event_replay(struct mlx5_core_dev *dev)
{}
EXPORT_SYMBOL();

void mlx5_core_mp_event_replay(struct mlx5_core_dev *dev, u32 event, void *data)
{}
EXPORT_SYMBOL();

int mlx5_core_get_caps_mode(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type,
			    enum mlx5_cap_mode cap_mode)
{}

int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type)
{}

static int set_caps(struct mlx5_core_dev *dev, void *in, int opmod)
{}

static int handle_hca_cap_atomic(struct mlx5_core_dev *dev, void *set_ctx)
{}

static int handle_hca_cap_odp(struct mlx5_core_dev *dev, void *set_ctx)
{}

static int max_uc_list_get_devlink_param(struct mlx5_core_dev *dev)
{}

bool mlx5_is_roce_on(struct mlx5_core_dev *dev)
{}
EXPORT_SYMBOL();

static int handle_hca_cap_2(struct mlx5_core_dev *dev, void *set_ctx)
{}

static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx)
{}

/* Cached MLX5_CAP_GEN(dev, roce) can be out of sync this early in the
 * boot process.
 * In case RoCE cap is writable in FW and user/devlink requested to change the
 * cap, we are yet to query the final state of the above cap.
 * Hence, the need for this function.
 *
 * Returns
 * True:
 * 1) RoCE cap is read only in FW and already disabled
 * OR:
 * 2) RoCE cap is writable in FW and user/devlink requested it off.
 *
 * In any other case, return False.
 */
static bool is_roce_fw_disabled(struct mlx5_core_dev *dev)
{}

static int handle_hca_cap_roce(struct mlx5_core_dev *dev, void *set_ctx)
{}

static int handle_hca_cap_port_selection(struct mlx5_core_dev *dev,
					 void *set_ctx)
{}

static int set_hca_cap(struct mlx5_core_dev *dev)
{}

static int set_hca_ctrl(struct mlx5_core_dev *dev)
{}

static int mlx5_core_set_hca_defaults(struct mlx5_core_dev *dev)
{}

int mlx5_core_enable_hca(struct mlx5_core_dev *dev, u16 func_id)
{}

int mlx5_core_disable_hca(struct mlx5_core_dev *dev, u16 func_id)
{}

static int mlx5_core_set_issi(struct mlx5_core_dev *dev)
{}

static int mlx5_pci_init(struct mlx5_core_dev *dev, struct pci_dev *pdev,
			 const struct pci_device_id *id)
{}

static void mlx5_pci_close(struct mlx5_core_dev *dev)
{}

static void mlx5_register_hca_devcom_comp(struct mlx5_core_dev *dev)
{}

static void mlx5_unregister_hca_devcom_comp(struct mlx5_core_dev *dev)
{}

static int mlx5_init_once(struct mlx5_core_dev *dev)
{}

static void mlx5_cleanup_once(struct mlx5_core_dev *dev)
{}

static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeout)
{}

static void mlx5_function_disable(struct mlx5_core_dev *dev, bool boot)
{}

static int mlx5_function_open(struct mlx5_core_dev *dev)
{}

static int mlx5_function_close(struct mlx5_core_dev *dev)
{}

static int mlx5_function_setup(struct mlx5_core_dev *dev, bool boot, u64 timeout)
{}

static int mlx5_function_teardown(struct mlx5_core_dev *dev, bool boot)
{}

static int mlx5_load(struct mlx5_core_dev *dev)
{}

static void mlx5_unload(struct mlx5_core_dev *dev)
{}

int mlx5_init_one_devl_locked(struct mlx5_core_dev *dev)
{}

int mlx5_init_one(struct mlx5_core_dev *dev)
{}

void mlx5_uninit_one(struct mlx5_core_dev *dev)
{}

int mlx5_load_one_devl_locked(struct mlx5_core_dev *dev, bool recovery)
{}

int mlx5_load_one(struct mlx5_core_dev *dev, bool recovery)
{}

void mlx5_unload_one_devl_locked(struct mlx5_core_dev *dev, bool suspend)
{}

void mlx5_unload_one(struct mlx5_core_dev *dev, bool suspend)
{}

/* In case of light probe, we don't need a full query of hca_caps, but only the bellow caps.
 * A full query of hca_caps will be done when the device will reload.
 */
static int mlx5_query_hca_caps_light(struct mlx5_core_dev *dev)
{}

int mlx5_init_one_light(struct mlx5_core_dev *dev)
{}

void mlx5_uninit_one_light(struct mlx5_core_dev *dev)
{}

/* xxx_light() function are used in order to configure the device without full
 * init (light init). e.g.: There isn't a point in reload a device to light state.
 * Hence, mlx5_load_one_light() isn't needed.
 */

void mlx5_unload_one_light(struct mlx5_core_dev *dev)
{}

static const int types[] =;

static void mlx5_hca_caps_free(struct mlx5_core_dev *dev)
{}

static int mlx5_hca_caps_alloc(struct mlx5_core_dev *dev)
{}

static int vhca_id_show(struct seq_file *file, void *priv)
{}

DEFINE_SHOW_ATTRIBUTE();

int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx)
{}

void mlx5_mdev_uninit(struct mlx5_core_dev *dev)
{}

static int probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
{}

static void remove_one(struct pci_dev *pdev)
{}

#define mlx5_pci_trace(dev, fmt, ...)

static const char *result2str(enum pci_ers_result result)
{}

static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
					      pci_channel_state_t state)
{}

/* wait for the device to show vital signs by waiting
 * for the health counter to start counting.
 */
static int wait_vital(struct pci_dev *pdev)
{}

static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev)
{}

static void mlx5_pci_resume(struct pci_dev *pdev)
{}

static const struct pci_error_handlers mlx5_err_handler =;

static int mlx5_try_fast_unload(struct mlx5_core_dev *dev)
{}

static void shutdown(struct pci_dev *pdev)
{}

static int mlx5_suspend(struct pci_dev *pdev, pm_message_t state)
{}

static int mlx5_resume(struct pci_dev *pdev)
{}

static const struct pci_device_id mlx5_core_pci_table[] =;

MODULE_DEVICE_TABLE(pci, mlx5_core_pci_table);

void mlx5_disable_device(struct mlx5_core_dev *dev)
{}

int mlx5_recover_device(struct mlx5_core_dev *dev)
{}

static struct pci_driver mlx5_core_driver =;

/**
 * mlx5_vf_get_core_dev - Get the mlx5 core device from a given VF PCI device if
 *                     mlx5_core is its driver.
 * @pdev: The associated PCI device.
 *
 * Upon return the interface state lock stay held to let caller uses it safely.
 * Caller must ensure to use the returned mlx5 device for a narrow window
 * and put it back with mlx5_vf_put_core_dev() immediately once usage was over.
 *
 * Return: Pointer to the associated mlx5_core_dev or NULL.
 */
struct mlx5_core_dev *mlx5_vf_get_core_dev(struct pci_dev *pdev)
{}
EXPORT_SYMBOL();

/**
 * mlx5_vf_put_core_dev - Put the mlx5 core device back.
 * @mdev: The mlx5 core device.
 *
 * Upon return the interface state lock is unlocked and caller should not
 * access the mdev any more.
 */
void mlx5_vf_put_core_dev(struct mlx5_core_dev *mdev)
{}
EXPORT_SYMBOL();

static void mlx5_core_verify_params(void)
{}

static int __init mlx5_init(void)
{}

static void __exit mlx5_cleanup(void)
{}

module_init();
module_exit(mlx5_cleanup);