lm_l4fp.c revision d14abf155341d55053c76eeec58b787a456b753b
#include "lm5710.h"
#include "bd_chain.h"
#include "lm_l4fp.h"
#include "mm_l4if.h"
/**
* Description
* complete Rx and Tx application buffers to client
* Assumption:
* Called under fp-lock
* Called only from DPC-Flow
*/
void lm_tcp_complete_bufs(
struct _lm_device_t *pdev,
{
/* check which buffers need to be completed to client */
/* should only be here if we have something to complete */
"cid=%d, completing %d bufs towards mm, actual_completed_bytes=%d, %d bufs still in active tb list\n",
tcp->cid, s_list_entry_cnt(&completed_bufs), con->dpc_info.dpc_actual_bytes_completed, s_list_entry_cnt(&con->active_tb_list));
/* GilR 5/10/2006 - TBD - Might need some kind of indicating policy towards the mm - i.e. indicate MaxIndicationLimit at a time*/
if (!con->rq_completion_calls) {
}
}
}
/** Description:
* Complete nbytes from Tx and Rx application buffers
* Assumptions:
* Called ONLY from dpc-flow (or deferred_cqes) not POST - flow
* Called W/O a lock (unless from deferred)
* push can have 3 values:
* - 0: no-push
* - 1: regular push
* - 2: push as a result of terminate / reset / fin...
* Returns:
* Actual bytes completed towards mm. (If push==0 this number is equal to
* given completed_bytes, and if push==1 it might be larger), if fin is received this
* may be smaller than completed_bytes by a maximum of '1' */
struct _lm_device_t *pdev,
completed buffers towards mm. If (1) - regular push, if (2) push as result of sp-completion (terminate for example) */)
{
lm_tcp_buffer_t * tcp_buf = lm_tcp_next_entry_dpc_active_list(con); /* tcp_buf is the next buffer after tail... */
/* we now have completed_bytes on RQ ( could be a result of copying from GRQ (in case of rx) or a regular rq-completion */
/* Tx: tcp_buf can be NULL since this can be a fin completion
*/
con->app_buf_bytes_acc_comp == 0 :
con->app_buf_bytes_acc_comp > 0));
/* complete buffer */
con->app_buf_bytes_acc_comp = 0;
} else {
/* we've completed a split buffer */
}
tcp_buf->app_buf_xferred = 0;
}
DbgBreakIf((con->type == TCP_CON_TYPE_TX) && completed_bytes > 1 && !tcp_buf); /* could be 1 if fin */
}
if(tcp_buf) { /* possibly, partialy completed buffer */
con->app_buf_bytes_acc_comp == 0 :
con->app_buf_bytes_acc_comp > 0));
completed_bytes = 0;
/* special care if push==1 AND some bytes were really completed for this buf */
if(push && ((tcp_buf->flags & TCP_BUF_FLAG_L4_PARTIAL_FILLED) || (con->app_buf_bytes_acc_comp > 0)) ) {
/* skip TBs untill end of app buff - note, it's possible we don't have an end buff in case of
* large split buffers, in this case we'll hit the tcp buffer with the "reserved" flag, we then
* need to mark the connection as being in the middle of completing a split buffer - meaning every
* new buffer that will arrive will be immediately completed until the one with 'end' arrives...
* terrible -but there is no elegant way to deal with large split buffers... */
do {
- we can't reach this place from a peninsula to rq copy completion
- Since we do not post partial app bufs to the FW, if we get here
it is only after the entire app buff is attached to the bd chain */
tcp_buf->more_to_comp = 0;
/* complete buffer */
} while ( !(GET_FLAGS(tcp_buf->flags, TCP_BUF_FLAG_L4_POST_END)) && !(GET_FLAGS(tcp_buf->flags, TCP_BUF_FLAG_L4_SPLIT)) );
/* we've completed a split buffer */
/* mark connection as "complete next split buffers" , in the meantime this connection is delayed, so post won't look
* at this flag it's safe to change it lockless */
RESET_FLAGS(tcp_buf->flags ,TCP_BUF_FLAG_L4_SPLIT); /* this is everest internal, don't want miniport looking at this... */
} else {
con->app_buf_bytes_acc_comp = 0;
}
}
}
/* if all bytes were completed, completed_bytes should be zero. The only case that it won't be zero is if
* one of the completion bytes was a 'fin' completion (TX only). In this case, completed_bytes will be '1'
* In Rx Case, completed_bytes must always be zero. */
return actual_completed_bytes - completed_bytes;
} /* lm_tcp_complete_nbytes */
void lm_tcp_abort_bufs(
struct _lm_device_t * pdev,
lm_tcp_con_t * con,
)
{
"#lm_tcp_abort_bufs: tcp=%p, con type=%d, stat=%d\n",
/* we don't expect there to be any pending completions... (unless we're in error recovery) */
if (!lm_reset_is_inprogress(pdev))
{
}
/* If there is completed data, report it in the first seen END-buffer.
There must be at most one not completed App. Buf.
*/
while( lentry_p) {
tcp_buf->app_buf_xferred = 0;
/* Take care of partially completed buffer */
con->app_buf_bytes_acc_comp = 0;
DbgBreakIf(S32_SUB(S64_SUB(con->bytes_post_cnt, con->bytes_comp_cnt), (tcp_buf->app_buf_size - tcp_buf->app_buf_xferred)) < 0);
}
}
/* GilR 8/3/2006 - TODO - can't assert here. pending might be 1 if fin request was posted and not completed (tx con) */
//DbgBreakIf(con->pending_bytes);
/* Complete all buffers from active_list */
if(s_list_entry_cnt(&tmp_list)) {
if (lm_fl_reset_is_inprogress(pdev)) {
}
}
/* Abort all pending buffers in UM */
}
/******** qe_buffer interface: cyclic NON-OVERRIDE buffer ****************/
/** Description
* returns the next cqe in the cqe_buffer and updates the buffer params
*/
{
char * cqe;
} else {
}
cqe_buffer->left--;
return cqe;
}
/** Description
* returns the next occupied cqe in the cqe_buffer and updates the buffer params
* (tail)
*/
{
char * cqe;
return NULL;
}
} else {
}
cqe_buffer->left++;
return cqe;
}
{
}
/******** qe_buffer interface: cyclic OVERRIDE buffer ****************/
{
char * cqe;
} else {
}
if (cqe_buffer->left) {
cqe_buffer->left--;
}
return cqe;
}