#ifndef __COMMAND_H__
#define __COMMAND_H__
/* This file containes the slow-path send queue and the L2 Command code */
#include "57712_reg.h"
#include "577xx_int_offsets.h"
#include "context.h"
#include "lm5710.h"
//#include "5710_hsi.h"
//#define MAX_PROTO 2
/* How many slow-path-queue elements can be sent in parallel divided into normal and high priority */
/* structure representing a list of slow-path-completions */
typedef struct _sp_cqes_info {
} sp_cqes_info;
{
/* TODO replace this with the proper struct */
/* CID needs port number to be encoded int it */
}else{
}
DbgMessage(pdev,VERBOSEl2sp | VERBOSEl4sp, "Writing SP prod %d, conn_and_cmd_data=%x, type=%d \n",pdev->sq_info.sq_chain.prod_idx, pending->command.hdr.conn_and_cmd_data, pending->command.hdr.type);
LM_INTMEM_WRITE16(pdev, XSTORM_SPQ_PROD_OFFSET(func), pdev->sq_info.sq_chain.prod_idx, BAR_XSTRORM_INTMEM);
}
#ifdef VF_INVOLVED
else {
LM_INTMEM_WRITE16(PFDEV(pdev),XSTORM_VF_SPQ_PROD_OFFSET(ABS_VFID(pdev)), pdev->sq_info.sq_chain.prod_idx, BAR_XSTRORM_INTMEM);
}
#endif
}
/**
* @Description: This function fills a command that is received
* as a parameter given the input...
*
* @param pdev
* @param pending - OUT: this entry is filled given the input
* below
* @param cid
* @param command - FW Command ID
* @param type - The type of connection, can optionally
* include the function id as well if it differs
* from the function of pdev (for example for VFs)
*
* @param data - Data for FW ramrod
* @param release_mem_flag - Determines whether the sp pending
* command will be returned to the pool
* at the end of usage.
*/
struct sq_pending_command * pending,
{
/* In some cases type may already contain the func-id (VF specifically) so we add it only if it's not there... */
if (!(type & SPE_HDR_T_FUNCTION_ID))
{
}
// CID MSB is function number
pending->command.hdr.conn_and_cmd_data = mm_cpu_to_le32((command << SPE_HDR_T_CMD_ID_SHIFT ) | HW_CID(pdev,cid));
if (release_mem_flag)
{
}
pending->type = type; /* don't kill function ID, RSC VF update really uses the value (& SPE_HDR_T_CONN_TYPE);*/
}
/**
* Description
* Add the entry to the pending SP list.
* Try to add entry's from the list to the sq_chain if possible.(there is are less then 8 ramrod commands pending)
*
* @param pdev
* @param pending - The pending list entry.
* @param priority - (high or low) to witch list to insert the pending list entry.
*
* @return lm_status_t: LM_STATUS_SUCCESS on success or
* LM_STATUS_REQUEST_NOT_ACCEPTED if slowpath queue is
* in blocked state.
*/
struct sq_pending_command * pending,
/*
post a ramrod to the sq
takes the sq pending list spinlock and adds the request
will not block
but the actuall posting to the sq might be deffered until there is room
MUST only have one request pending per CID (this is up to the caller to enforce)
*/
/**
* @Description
* inform the sq mechanism of completed ramrods because the
* completions arrive on the fast-path rings the fast-path
* needs to inform the sq that the ramrod has been serviced
* will not block, it also needs to notify which ramrod has
* been completed since completions can arrive in a different
* sequence than sent.
* @param pdev
* @param priority: priority of ramrod being completed
* (different credits)
* @param command: which command is completed
* @param type: connection type
* @param cid: connection id that ramrod was sent with
*/
/**
* @description
* do any deffered posting pending on the sq, will take the list spinlock
* will not block. Check sq state, if its pending (it means no hw...) call flush
* at the end, which will take care of completing these completions internally.
* @param pdev
*
* @return lm_status_t SUCCESS: is no pending requests were sent. PENDING if a
* if pending request was sent.
*/
/*
post a slow-path command
takes a spinlock, does not sleep
actuall command posting may be delayed
*/
{
}
/* TODO: move functions above to lm_sp.c */
/**
* @Description
* change state of slowpath queue.
*
* @param pdev
* @param state NORMAL, PENDING, BLOCKED
*/
/**
* @Description
* This function completes any pending slowpath requests.
* It does this as if they were completed via cookie...
* It needs to know all the possible cookies and which
* completions to give. Any new ramrod should be added to
* this function. Also if it should be ignored.
*
* @param pdev
*/
/**
* @Description
* This function takes care of registering a DPC for
* completing slowpaths internally in the driver (if such
* exist)
* @param pdev
*
* @return lm_status_t SUCCESS: if all flushed (i.e. dpc not
* scheduled)
* PENDING: if dpc is scheduled
*/
/**
* @Description
* Checks if the sq is empty
*
* @param pdev
*
* @return u8_t TRUE if empty FALSE o/w
*/
#endif //__COMMAND_H__