linux/drivers/net/ethernet/mellanox/mlx4/cmd.c

/*
 * Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
 * Copyright (c) 2005, 2006, 2007, 2008 Mellanox Technologies. All rights reserved.
 * Copyright (c) 2005, 2006, 2007 Cisco Systems, Inc.  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/sched.h>
#include <linux/slab.h>
#include <linux/export.h>
#include <linux/pci.h>
#include <linux/errno.h>

#include <linux/mlx4/cmd.h>
#include <linux/mlx4/device.h>
#include <linux/semaphore.h>
#include <rdma/ib_smi.h>
#include <linux/delay.h>
#include <linux/etherdevice.h>

#include <asm/io.h>

#include "mlx4.h"
#include "fw.h"
#include "fw_qos.h"
#include "mlx4_stats.h"

#define CMD_POLL_TOKEN
#define INBOX_MASK

#define CMD_CHAN_VER
#define CMD_CHAN_IF_REV

enum {};

enum {};

enum {};

enum mlx4_vlan_transition {};


struct mlx4_cmd_context {};

static int mlx4_master_process_vhcr(struct mlx4_dev *dev, int slave,
				    struct mlx4_vhcr_cmd *in_vhcr);

static int mlx4_status_to_errno(u8 status)
{}

static u8 mlx4_errno_to_status(int errno)
{}

static int mlx4_internal_err_ret_value(struct mlx4_dev *dev, u16 op,
				       u8 op_modifier)
{}

static int mlx4_closing_cmd_fatal_error(u16 op, u8 fw_status)
{}

static int mlx4_cmd_reset_flow(struct mlx4_dev *dev, u16 op, u8 op_modifier,
			       int err)
{}

static int comm_pending(struct mlx4_dev *dev)
{}

static int mlx4_comm_cmd_post(struct mlx4_dev *dev, u8 cmd, u16 param)
{}

static int mlx4_comm_cmd_poll(struct mlx4_dev *dev, u8 cmd, u16 param,
		       unsigned long timeout)
{}

static int mlx4_comm_cmd_wait(struct mlx4_dev *dev, u8 vhcr_cmd,
			      u16 param, u16 op, unsigned long timeout)
{}

int mlx4_comm_cmd(struct mlx4_dev *dev, u8 cmd, u16 param,
		  u16 op, unsigned long timeout)
{}

static int cmd_pending(struct mlx4_dev *dev)
{}

static int mlx4_cmd_post(struct mlx4_dev *dev, u64 in_param, u64 out_param,
			 u32 in_modifier, u8 op_modifier, u16 op, u16 token,
			 int event)
{}

static int mlx4_slave_cmd(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
			  int out_is_imm, u32 in_modifier, u8 op_modifier,
			  u16 op, unsigned long timeout)
{}

static int mlx4_cmd_poll(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
			 int out_is_imm, u32 in_modifier, u8 op_modifier,
			 u16 op, unsigned long timeout)
{}

void mlx4_cmd_event(struct mlx4_dev *dev, u16 token, u8 status, u64 out_param)
{}

static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
			 int out_is_imm, u32 in_modifier, u8 op_modifier,
			 u16 op, unsigned long timeout)
{}

int __mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
	       int out_is_imm, u32 in_modifier, u8 op_modifier,
	       u16 op, unsigned long timeout, int native)
{}
EXPORT_SYMBOL_GPL();


int mlx4_ARM_COMM_CHANNEL(struct mlx4_dev *dev)
{}

static int mlx4_ACCESS_MEM(struct mlx4_dev *dev, u64 master_addr,
			   int slave, u64 slave_addr,
			   int size, int is_read)
{}

static int query_pkey_block(struct mlx4_dev *dev, u8 port, u16 index, u16 *pkey,
			       struct mlx4_cmd_mailbox *inbox,
			       struct mlx4_cmd_mailbox *outbox)
{}

static int get_full_pkey_table(struct mlx4_dev *dev, u8 port, u16 *table,
			       struct mlx4_cmd_mailbox *inbox,
			       struct mlx4_cmd_mailbox *outbox)
{}
#define PORT_CAPABILITY_LOCATION_IN_SMP
#define PORT_STATE_OFFSET

static enum ib_port_state vf_port_state(struct mlx4_dev *dev, int port, int vf)
{}

static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, int slave,
				struct mlx4_vhcr *vhcr,
				struct mlx4_cmd_mailbox *inbox,
				struct mlx4_cmd_mailbox *outbox,
				struct mlx4_cmd_info *cmd)
{}

static int mlx4_CMD_EPERM_wrapper(struct mlx4_dev *dev, int slave,
		     struct mlx4_vhcr *vhcr,
		     struct mlx4_cmd_mailbox *inbox,
		     struct mlx4_cmd_mailbox *outbox,
		     struct mlx4_cmd_info *cmd)
{}

int mlx4_DMA_wrapper(struct mlx4_dev *dev, int slave,
		     struct mlx4_vhcr *vhcr,
		     struct mlx4_cmd_mailbox *inbox,
		     struct mlx4_cmd_mailbox *outbox,
		     struct mlx4_cmd_info *cmd)
{}

static struct mlx4_cmd_info cmd_info[] =;

static int mlx4_master_process_vhcr(struct mlx4_dev *dev, int slave,
				    struct mlx4_vhcr_cmd *in_vhcr)
{}

static int mlx4_master_immediate_activate_vlan_qos(struct mlx4_priv *priv,
					    int slave, int port)
{}

static void mlx4_set_default_port_qos(struct mlx4_dev *dev, int port)
{}

static void mlx4_allocate_port_vpps(struct mlx4_dev *dev, int port)
{}

static int mlx4_master_activate_admin_state(struct mlx4_priv *priv, int slave)
{}

static void mlx4_master_deactivate_admin_state(struct mlx4_priv *priv, int slave)
{}

static void mlx4_master_do_cmd(struct mlx4_dev *dev, int slave, u8 cmd,
			       u16 param, u8 toggle)
{}

/* master command processing */
void mlx4_master_comm_channel(struct work_struct *work)
{}

static int sync_toggles(struct mlx4_dev *dev)
{}

int mlx4_multi_func_init(struct mlx4_dev *dev)
{}

int mlx4_cmd_init(struct mlx4_dev *dev)
{}

void mlx4_report_internal_err_comm_event(struct mlx4_dev *dev)
{}

void mlx4_multi_func_cleanup(struct mlx4_dev *dev)
{}

void mlx4_cmd_cleanup(struct mlx4_dev *dev, int cleanup_mask)
{}

/*
 * Switch to using events to issue FW commands (can only be called
 * after event queue for command events has been initialized).
 */
int mlx4_cmd_use_events(struct mlx4_dev *dev)
{}

/*
 * Switch back to polling (used when shutting down the device)
 */
void mlx4_cmd_use_polling(struct mlx4_dev *dev)
{}

struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev)
{}
EXPORT_SYMBOL_GPL();

void mlx4_free_cmd_mailbox(struct mlx4_dev *dev,
			   struct mlx4_cmd_mailbox *mailbox)
{}
EXPORT_SYMBOL_GPL();

u32 mlx4_comm_get_version(void)
{}

static int mlx4_get_slave_indx(struct mlx4_dev *dev, int vf)
{}

int mlx4_get_vf_indx(struct mlx4_dev *dev, int slave)
{}

void mlx4_cmd_wake_completions(struct mlx4_dev *dev)
{}

struct mlx4_active_ports mlx4_get_active_ports(struct mlx4_dev *dev, int slave)
{}
EXPORT_SYMBOL_GPL();

int mlx4_slave_convert_port(struct mlx4_dev *dev, int slave, int port)
{}
EXPORT_SYMBOL_GPL();

int mlx4_phys_to_slave_port(struct mlx4_dev *dev, int slave, int port)
{}
EXPORT_SYMBOL_GPL();

struct mlx4_slaves_pport mlx4_phys_to_slaves_pport(struct mlx4_dev *dev,
						   int port)
{}
EXPORT_SYMBOL_GPL();

struct mlx4_slaves_pport mlx4_phys_to_slaves_pport_actv(
		struct mlx4_dev *dev,
		const struct mlx4_active_ports *crit_ports)
{}
EXPORT_SYMBOL_GPL();

static int mlx4_slaves_closest_port(struct mlx4_dev *dev, int slave, int port)
{}

static int mlx4_set_vport_qos(struct mlx4_priv *priv, int slave, int port,
			      int max_tx_rate)
{}

static bool mlx4_is_vf_vst_and_prio_qos(struct mlx4_dev *dev, int port,
					struct mlx4_vport_state *vf_admin)
{}

static bool mlx4_valid_vf_state_change(struct mlx4_dev *dev, int port,
				       struct mlx4_vport_state *vf_admin,
				       int vlan, int qos)
{}

int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u8 *mac)
{}
EXPORT_SYMBOL_GPL();


int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos,
		     __be16 proto)
{}
EXPORT_SYMBOL_GPL();

int mlx4_set_vf_rate(struct mlx4_dev *dev, int port, int vf, int min_tx_rate,
		     int max_tx_rate)
{}
EXPORT_SYMBOL_GPL();

 /* mlx4_get_slave_default_vlan -
 * return true if VST ( default vlan)
 * if VST, will return vlan & qos (if not NULL)
 */
bool mlx4_get_slave_default_vlan(struct mlx4_dev *dev, int port, int slave,
				 u16 *vlan, u8 *qos)
{}
EXPORT_SYMBOL_GPL();

int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting)
{}
EXPORT_SYMBOL_GPL();

int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf)
{}
EXPORT_SYMBOL_GPL();

int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state)
{}
EXPORT_SYMBOL_GPL();

int mlx4_get_counter_stats(struct mlx4_dev *dev, int counter_index,
			   struct mlx4_counter *counter_stats, int reset)
{}
EXPORT_SYMBOL_GPL();

int mlx4_get_vf_stats(struct mlx4_dev *dev, int port, int vf_idx,
		      struct ifla_vf_stats *vf_stats)
{}
EXPORT_SYMBOL_GPL();

int mlx4_vf_smi_enabled(struct mlx4_dev *dev, int slave, int port)
{}
EXPORT_SYMBOL_GPL();

int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port)
{}
EXPORT_SYMBOL_GPL();

int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port,
				 int enabled)
{}
EXPORT_SYMBOL_GPL();