#ifndef ECORE_SP_VERBS
#define ECORE_SP_VERBS
#ifndef ECORE_ERASE
#include "lm_defs.h"
#include "listq.h"
#include "eth_constants.h"
#include "bcm_utils.h"
#include "mm.h"
#ifdef __LINUX
#else
typedef volatile unsigned long atomic_t;
#endif
/* FIXME (MichalS): move to bcmtypes.h 26-Sep-10 */
typedef int BOOL;
/* None-atomic macros */
#ifdef __LINUX
/* Bits tweaking */
#elif defined(USER_LINUX)
typedef int ECORE_MUTEX;
/* Bits tweaking */
#else /* VBD */
typedef int ECORE_MUTEX;
/* Bits tweaking */
#endif
/************************ Types used in ecore *********************************/
enum _ecore_status_t {
ECORE_SUCCESS = 0,
/* PENDING is not an error and should be positive */
};
#endif
struct _lm_device_t;
struct eth_context;
/* Bits representing general command's configuration */
enum {
/* Wait until all pending commands complete */
/* Don't send a ramrod, only update a registry */
/* Configure HW according to the current object state */
/* Execute the next command now */
/* Don't add a new command and continue execution of posponed
* commands. If not set a new command will be added to the
* pending commands list.
*/
/* If there is another pending ramrod, wait until it finishes and
* re-try to submit this one. This flag can be set only in sleepable
* context, and should not be set from the context that completes the
* ramrods as deadlock will occur.
*/
};
typedef enum {
/* Public slow path states */
enum {
#ifdef ECORE_CHAR_DEV /* ! ECORE_UPSTREAM */
#endif
};
struct ecore_raw_obj {
/* Queue params */
/* Ramrod data buffer params */
void *rdata;
/* Ramrod state params */
struct ecore_raw_obj *o);
};
/************************* VLAN-MAC commands related parameters ***************/
struct ecore_mac_ramrod_data {
};
struct ecore_vlan_ramrod_data {
};
struct ecore_vlan_mac_ramrod_data {
};
union ecore_classification_ramrod_data {
};
/* VLAN_MAC commands */
enum ecore_vlan_mac_cmd {
};
struct ecore_vlan_mac_data {
/* Requested command: ECORE_VLAN_MAC_XX */
/* used to contain the data related vlan_mac_flags bits from
* ramrod parameters.
*/
unsigned long vlan_mac_flags;
/* Needed for MOVE command */
union ecore_classification_ramrod_data u;
};
/*************************** Exe Queue obj ************************************/
union ecore_exe_queue_cmd_data {
struct {
/* TODO */
#ifndef ECORE_ERASE
int TODO;
#endif
} mcast;
};
struct ecore_exeq_elem {
/* Length of this element in the exe_chunk. */
int cmd_len;
};
union ecore_qable_obj;
union ecore_exeq_comp_elem {
};
struct ecore_exe_queue_obj;
union ecore_qable_obj *o,
struct ecore_exeq_elem *elem);
union ecore_qable_obj *o,
struct ecore_exeq_elem *elem);
/* Return positive if entry was optimized, 0 - if not, negative
* in case of an error.
*/
union ecore_qable_obj *o,
struct ecore_exeq_elem *elem);
union ecore_qable_obj *o,
unsigned long *ramrod_flags);
typedef struct ecore_exeq_elem *
struct ecore_exeq_elem *elem);
struct ecore_exe_queue_obj {
/* Commands pending for an execution. */
/* Commands pending for an completion. */
/* Maximum length of commands' list for one execution */
int exe_chunk_len;
/****** Virtual functions ******/
/**
* Called before commands execution for commands that are really
* going to be executed (after 'optimize').
*
* Must run under exe_queue->lock
*/
/**
* Called before removing pending commands, cleaning allocated
* resources (e.g., credits from validate)
*/
/**
* This will try to cancel the current pending commands list
* considering the new command.
*
* Returns the number of optimized commands or a negative error code
*
* Must run under exe_queue->lock
*/
/**
* Run the next commands chunk (owner specific).
*/
/**
* Return the exe_queue element containing the specific command
* if any. Otherwise return NULL.
*/
};
/*
* Element in the VLAN_MAC registry list having all current configured
* rules.
*/
struct ecore_vlan_mac_registry_elem {
* Relevant for 57710 and 57711 only. VLANs and MACs share the
* same CAM for these chips.
*/
int cam_offset;
/* Needed for DEL and RESTORE flows */
unsigned long vlan_mac_flags;
union ecore_classification_ramrod_data u;
};
/* Bits representing VLAN_MAC commands specific flags */
enum {
};
/* When looking for matching filters, some flags are not interesting */
1 << ECORE_ETH_MAC | \
1 << ECORE_ISCSI_ETH_MAC | \
1 << ECORE_NETQ_ETH_MAC)
((flags) & ECORE_VLAN_MAC_CMP_MASK)
struct ecore_vlan_mac_ramrod_params {
/* Object to run the command from */
/* General command flags: COMP_WAIT, etc. */
unsigned long ramrod_flags;
/* Command specific configuration request */
};
struct ecore_vlan_mac_obj {
/* Bookkeeping list: will prevent the addition of already existing
* entries.
*/
* all these fields should only be accessed under the exe_queue lock
*/
/* Execution queue interface instance */
/* MACs credit pool */
/* VLANs credit pool */
/* RAMROD command to be used */
int ramrod_cmd;
/* copy first n elements onto preallocated buffer
*
* @param n number of elements to get
* @param buf buffer preallocated by caller into which elements
* will be copied. Note elements are 4-byte aligned
* so buffer size must be able to accommodate the
* aligned elements.
*
* @return number of copied bytes
*/
/**
* Checks if ADD-ramrod with the given params may be performed.
*
* @return zero if the element may be added
*/
struct ecore_vlan_mac_obj *o,
union ecore_classification_ramrod_data *data);
/**
* Checks if DEL-ramrod with the given params may be performed.
*
* @return TRUE if the element may be deleted
*/
struct ecore_vlan_mac_registry_elem *
struct ecore_vlan_mac_obj *o,
union ecore_classification_ramrod_data *data);
/**
* Checks if DEL-ramrod with the given params may be performed.
*
* @return TRUE if the element may be deleted
*/
struct ecore_vlan_mac_obj *src_o,
struct ecore_vlan_mac_obj *dst_o,
union ecore_classification_ramrod_data *data);
/**
* correspondingly).
*/
/**
* Configures one rule in the ramrod data buffer.
*/
struct ecore_vlan_mac_obj *o,
int cam_offset);
/**
* Delete all configured elements having the given
* vlan_mac_flags specification. Assumes no pending for
* execution commands. Will schedule all all currently
* specification for deletion and will use the given
* ramrod_flags for the last DEL operation.
*
* @param pdev
* @param o
* @param ramrod_flags RAMROD_XX flags
*
* @return 0 if the last operation has completed successfully
* and there are no more elements left, positive value
* if there are pending for completion commands,
* negative value in case of failure.
*/
struct ecore_vlan_mac_obj *o,
unsigned long *vlan_mac_flags,
unsigned long *ramrod_flags);
/**
* configured elements list.
*
* @param pdev
* @param p Command parameters (RAMROD_COMP_WAIT bit in
* ramrod_flags is only taken into an account)
* @param ppos a pointer to the cookie that should be given back in the
* next call to make function handle the next element. If
* *ppos is set to NULL it will restart the iterator.
* If returned *ppos == NULL this means that the last
* element has been handled.
*
* @return int
*/
struct ecore_vlan_mac_ramrod_params *p,
struct ecore_vlan_mac_registry_elem **ppos);
/**
* Should be called on a completion arrival.
*
* @param pdev
* @param o
* @param cqe Completion element we are handling
* @param ramrod_flags if RAMROD_CONT is set the next bulk of
* pending commands will be executed.
* RAMROD_DRV_CLR_ONLY and RAMROD_RESTORE
* may also be set if needed.
*
* @return 0 if there are neither pending nor waiting for
* completion commands. Positive value if there are
* pending for execution or for completion commands.
* Negative value in case of an error (including an
* error in the cqe).
*/
union event_ring_elem *cqe,
unsigned long *ramrod_flags);
/**
* Wait for completion of all commands. Don't schedule new ones,
* just wait. It assumes that the completion code will schedule
* for new commands.
*/
};
enum {
};
/** RX_MODE verbs:DROP_ALL/ACCEPT_ALL/ACCEPT_ALL_MULTI/ACCEPT_ALL_VLAN/NORMAL */
/* RX_MODE ramrod special flags: set in rx_mode_flags field in
* a ecore_rx_mode_ramrod_params.
*/
enum {
};
enum {
};
struct ecore_rx_mode_ramrod_params {
unsigned long *pstate;
int state;
unsigned long ramrod_flags;
unsigned long rx_mode_flags;
/* rdata is either a pointer to eth_filter_rules_ramrod_data(e2) or to
* a tstorm_eth_mac_filter_config (e1x).
*/
void *rdata;
/* Rx mode settings */
unsigned long rx_accept_flags;
/* internal switching settings */
unsigned long tx_accept_flags;
};
struct ecore_rx_mode_obj {
struct ecore_rx_mode_ramrod_params *p);
struct ecore_rx_mode_ramrod_params *p);
};
/********************** Set multicast group ***********************************/
struct ecore_mcast_list_elem {
};
union ecore_mcast_config_data {
};
struct ecore_mcast_ramrod_params {
/* Relevant options are RAMROD_COMP_WAIT and RAMROD_DRV_CLR_ONLY */
unsigned long ramrod_flags;
/** TODO:
* - rename it to macs_num.
* - Add a new command type for handling pending commands
* (remove "zero semantics").
*
* Length of mcast_list. If zero and ADD_CONT command - post
* pending commands.
*/
int mcast_list_len;
};
enum ecore_mcast_cmd {
};
struct ecore_mcast_obj {
union {
struct {
/** Number of BINs to clear. Should be updated
* immediately when a command arrives in order to
* properly create DEL commands.
*/
int num_bins_set;
} aprox_match;
struct {
int num_macs_set;
} exact_match;
} registry;
/* Pending commands */
/* A state that is set in raw.pstate, when there are pending commands */
int sched_state;
/* Maximal number of mcast MACs configured in one command */
int max_cmd_len;
/* Total number of currently pending MACs to configure: both
* in the pending commands list and in the current command.
*/
int total_pending_num;
/**
* @param cmd command to execute (ECORE_MCAST_CMD_X, see above)
*/
struct ecore_mcast_ramrod_params *p,
enum ecore_mcast_cmd cmd);
/**
* Fills the ramrod data during the RESTORE flow.
*
* @param pdev
* @param o
* @param start_idx Registry index to start from
* @param rdata_idx Index in the ramrod data to start from
*
* @return -1 if we handled the whole registry or index of the last
* handled registry element.
*/
struct ecore_mcast_ramrod_params *p,
enum ecore_mcast_cmd cmd);
struct ecore_mcast_obj *o, int idx,
union ecore_mcast_config_data *cfg_data,
enum ecore_mcast_cmd cmd);
/** Checks if there are more mcast MACs to be set or a previous
* command is still pending.
*/
/**
*/
/* Wait until all pending commands complete */
/**
* Handle the internal object counters needed for proper
* commands handling. Checks that the provided parameters are
* feasible.
*/
struct ecore_mcast_ramrod_params *p,
enum ecore_mcast_cmd cmd);
/**
* Restore the values of internal counters in case of a failure.
*/
struct ecore_mcast_ramrod_params *p,
int old_num_bins);
};
/*************************** Credit handling **********************************/
struct ecore_credit_pool_obj {
/* Current amount of credit in the pool */
/* Maximum allowed credit. put() will check against it. */
int pool_sz;
/* Allocate a pool table statically.
*
* Currently the maximum allowed size is MAX_MAC_CREDIT_E2(272)
*
* The set bit in the table will mean that the entry is available.
*/
/* Base pool offset (initialized differently */
int base_pool_offset;
/**
* Get the next free pool entry.
*
* @return TRUE if there was a free entry in the pool
*/
/**
* Return the entry back to the pool.
*
* @return TRUE if entry is legal and has been successfully
* returned to the pool.
*/
/**
* Get the requested amount of credit from the pool.
*
* @param cnt Amount of requested credit
* @return TRUE if the operation is successful
*/
/**
* Returns the credit to the pool.
*
* @param cnt Amount of credit to return
* @return TRUE if the operation is successful
*/
/**
* Reads the current amount of credit.
*/
};
/*************************** RSS configuration ********************************/
enum {
/* RSS_MODE bits are mutually exclusive */
#endif
};
struct ecore_config_rss_params {
/* may have RAMROD_COMP_WAIT set only */
unsigned long ramrod_flags;
/* ECORE_RSS_X bits */
unsigned long rss_flags;
/* Number hash bits to take into an account */
/* Indirection table */
/* RSS hash values */
/* valid only iff ECORE_RSS_UPDATE_TOE is set */
};
struct ecore_rss_config_obj {
/* RSS engine to use */
/* Last configured indirection table */
/* flags for enabling 4-tupple hash on UDP */
struct ecore_config_rss_params *p);
};
/*********************** Queue state update ***********************************/
/* UPDATE command options */
enum {
};
/* Allowed Queue states */
enum ecore_q_state {
};
/* Allowed Queue states */
enum ecore_q_logical_state {
};
/* Allowed commands */
enum ecore_queue_cmd {
};
/* queue SETUP + INIT flags */
enum {
#ifndef ECORE_UPSTREAM /* ! ECORE_UPSTREAM */
#endif
#ifdef ECORE_OOO /* ! ECORE_UPSTREAM */
#endif
};
/* Queue type options: queue type may be a combination of below. */
enum ecore_q_type {
#ifdef ECORE_OOO /* ! ECORE_UPSTREAM */
#endif
/** TODO: Consider moving both these flags into the init()
* ramrod params.
*/
};
#define ECORE_PRIMARY_CID_INDEX 0
/* DMAE channel to be used by FW for timesync workaroun. A driver that sends
* timesync-related ramrods must not use this DMAE command ID.
*/
struct ecore_queue_init_params {
struct {
unsigned long flags;
} tx;
struct {
unsigned long flags;
} rx;
/* CID context in the host memory */
/* maximum number of cos supported by hardware */
};
struct ecore_queue_terminate_params {
/* index within the tx_only cids of this queue object */
};
struct ecore_queue_cfc_del_params {
/* index within the tx_only cids of this queue object */
};
struct ecore_queue_update_params {
/* index within the tx_only cids of this queue object */
};
struct ecore_queue_update_tpa_params {
};
struct rxq_pause_params {
};
/* general */
struct ecore_general_setup_params {
/* valid iff ECORE_Q_FLG_STATS */
};
struct ecore_rxq_setup_params {
/* dma */
/* valid iff ECORE_Q_FLG_TPA */
/* valid iff ECORE_Q_FLG_MCAST */
/* valid iff BXN2X_Q_FLG_SILENT_VLAN_REM */
};
struct ecore_txq_setup_params {
/* dma */
/* equals to the leading rss client id, used for TX classification*/
/* valid iff ECORE_Q_FLG_DEF_VLAN */
};
struct ecore_queue_setup_params {
unsigned long flags;
};
struct ecore_queue_setup_tx_only_params {
unsigned long flags;
/* index within the tx_only cids of this queue object */
};
struct ecore_queue_state_params {
/* Current command */
/* may have RAMROD_COMP_WAIT set only */
unsigned long ramrod_flags;
/* Params according to the current command */
union {
} params;
};
struct ecore_viflist_params {
};
struct ecore_queue_sp_obj {
/* number of traffic classes supported by queue.
* The primary connection of the queue supports the first traffic
* class. Any further traffic class is supported by a tx-only
* connection.
*
* Therefore max_cos is also a number of valid entries in the cids
* array.
*/
/* bits from enum ecore_q_type */
unsigned long type;
/* ECORE_Q_CMD_XX bits. This object implements "one
* pending" paradigm but for debug and tracing purposes it's
* more convenient to have different bits for different
* commands.
*/
unsigned long pending;
/* Buffer to use as a ramrod data and its mapping */
void *rdata;
/**
* Performs one state change according to the given parameters.
*
* @return 0 in case of success and negative value otherwise.
*/
struct ecore_queue_state_params *params);
/**
* Sets the pending bit according to the requested transition.
*/
struct ecore_queue_state_params *params);
/**
* Checks that the requested state transition is legal.
*/
struct ecore_queue_sp_obj *o,
struct ecore_queue_state_params *params);
/**
* Completes the pending command.
*/
struct ecore_queue_sp_obj *o,
enum ecore_queue_cmd);
struct ecore_queue_sp_obj *o,
enum ecore_queue_cmd cmd);
};
/********************** Function state update *********************************/
/* UPDATE command options */
enum {
};
/* Allowed Function states */
enum ecore_func_state {
};
/* Allowed Function commands */
enum ecore_func_cmd {
};
struct ecore_func_hw_init_params {
/* A load phase returned by MCP.
*
* May be:
* FW_MSG_CODE_DRV_LOAD_COMMON_CHIP
* FW_MSG_CODE_DRV_LOAD_COMMON
* FW_MSG_CODE_DRV_LOAD_PORT
* FW_MSG_CODE_DRV_LOAD_FUNCTION
*/
};
struct ecore_func_hw_reset_params {
/* A load phase returned by MCP.
*
* May be:
* FW_MSG_CODE_DRV_LOAD_COMMON_CHIP
* FW_MSG_CODE_DRV_LOAD_COMMON
* FW_MSG_CODE_DRV_LOAD_PORT
* FW_MSG_CODE_DRV_LOAD_FUNCTION
*/
};
struct ecore_func_start_params {
/* Multi Function mode:
* - Single Function
* - Switch Dependent
* - Switch Independent
*/
/* Switch Dependent mode outer VLAN tag */
/* Function cos mode */
/* tunneling classification enablement */
/* Enables Inner GRE RSS on the function, depends on the client RSS
* capailities
*/
/* UDP dest port for VXLAN */
/** Allows accepting of packets failing MF classification, possibly
* only matching a given ethertype
*/
/* Override priority of output packets */
/* Replace vlan's ethertype */
/* Prevent inner vlans from being added by FW */
};
struct ecore_func_switch_update_params {
};
struct ecore_func_afex_update_params {
};
struct ecore_func_afex_viflists_params {
};
struct ecore_func_tx_start_params {
};
struct ecore_func_set_timesync_params {
/* Reset, set or keep the current drift value */
/* Dec, inc or keep the current offset */
/* Drift value direction */
/* Drift, period and offset values to be used according to the commands
* above.
*/
};
struct ecore_func_state_params {
/* Current command */
/* may have RAMROD_COMP_WAIT set only */
unsigned long ramrod_flags;
/* Params according to the current command */
union {
} params;
};
struct ecore_func_sp_drv_ops {
/* Init tool + runtime initialization:
* - Common Chip
* - Common (per Path)
* - Port
* - Function phases
*/
/* Reset Function HW: Common, Port, Function phases. */
};
struct ecore_func_sp_obj {
/* ECORE_FUNC_CMD_XX bits. This object implements "one
* pending" paradigm but for debug and tracing purposes it's
* more convenient to have different bits for different
* commands.
*/
unsigned long pending;
/* Buffer to use as a ramrod data and its mapping */
void *rdata;
/* Buffer to use as a afex ramrod data and its mapping.
* This can't be same rdata as above because afex ramrod requests
* can arrive to the object in parallel to other ramrod requests.
*/
void *afex_rdata;
/* this mutex validates that when pending flag is taken, the next
* ramrod to be sent will be the one set the pending bit
*/
/* Driver interface */
/**
* Performs one state change according to the given parameters.
*
* @return 0 in case of success and negative value otherwise.
*/
struct ecore_func_state_params *params);
/**
* Checks that the requested state transition is legal.
*/
struct ecore_func_sp_obj *o,
struct ecore_func_state_params *params);
/**
* Completes the pending command.
*/
struct ecore_func_sp_obj *o,
enum ecore_func_cmd cmd);
enum ecore_func_cmd cmd);
};
/********************** Interfaces ********************************************/
/* Queueable objects set */
union ecore_qable_obj {
};
/************** Function state update *********/
struct ecore_func_sp_obj *obj,
struct ecore_func_sp_drv_ops *drv_iface);
struct ecore_func_state_params *params);
struct ecore_func_sp_obj *o);
/******************* Queue State **************/
struct ecore_queue_state_params *params);
struct ecore_queue_sp_obj *obj);
/********************* VLAN-MAC ****************/
struct ecore_vlan_mac_obj *mac_obj,
struct ecore_credit_pool_obj *macs_pool);
struct ecore_vlan_mac_obj *vlan_obj,
struct ecore_credit_pool_obj *vlans_pool);
struct ecore_vlan_mac_obj *vlan_mac_obj,
struct ecore_credit_pool_obj *macs_pool,
struct ecore_credit_pool_obj *vlans_pool);
struct ecore_vlan_mac_obj *o);
struct ecore_vlan_mac_obj *o);
struct ecore_vlan_mac_obj *o);
struct ecore_vlan_mac_obj *o);
struct ecore_vlan_mac_ramrod_params *p);
struct ecore_vlan_mac_ramrod_params *p,
struct ecore_vlan_mac_obj *dest_o);
/********************* RX MODE ****************/
struct ecore_rx_mode_obj *o);
/**
* bnx2x_config_rx_mode - Send and RX_MODE ramrod according to the provided parameters.
*
* @p: Command parameters
*
* Return: 0 - if operation was successful and there is no pending completions,
* positive number - if there are pending completions,
* negative - if there were errors
*/
struct ecore_rx_mode_ramrod_params *p);
/****************** MULTICASTS ****************/
struct ecore_mcast_obj *mcast_obj,
/**
* bnx2x_config_mcast - Configure multicast MACs list.
*
* @cmd: command to execute: BNX2X_MCAST_CMD_X
*
* May configure a new list
* provided in p->mcast_list (ECORE_MCAST_CMD_ADD), clean up
* (ECORE_MCAST_CMD_DEL) or restore (ECORE_MCAST_CMD_RESTORE) a current
* configuration, continue to execute the pending commands
* (ECORE_MCAST_CMD_CONT).
*
* If previous command is still pending or if number of MACs to
* configure is more that maximum number of MACs in one command,
* the current command will be enqueued to the tail of the
* pending commands list.
*
* Return: 0 is operation was successfull and there are no pending completions,
* negative if there were errors, positive if there are pending
* completions.
*/
struct ecore_mcast_ramrod_params *p,
enum ecore_mcast_cmd cmd);
/****************** CREDIT POOL ****************/
/****************** RSS CONFIGURATION ****************/
struct ecore_rss_config_obj *rss_obj,
/**
* bnx2x_config_rss - Updates RSS configuration according to provided parameters
*
* Return: 0 in case of success
*/
struct ecore_config_rss_params *p);
/**
* bnx2x_get_rss_ind_table - Return the current ind_table configuration.
*
* @ind_table: buffer to fill with the current indirection
* table content. Should be at least
* T_ETH_INDIRECTION_TABLE_SIZE bytes long.
*/
#endif /* ECORE_SP_VERBS */