コード例 #1
0
static int efab_file_move_supported_tcp(ci_netif *ni, ci_tcp_state *ts)
{
#if CI_CFG_FD_CACHING
  /* Don't support moving cached sockets for now */
  if( ci_tcp_is_cached(ts) ||
      !ci_ni_dllist_is_self_linked(ni, &ts->epcache_link) )
    return false;
#endif

  /* TCP closed: supported */
  if( ts->s.b.state == CI_TCP_CLOSED )
    return true;

  /* everything except TCP connected is not supported */
  if( !(ts->s.b.state & CI_TCP_STATE_TCP_CONN) )
    return false;
  if( ts->local_peer != OO_SP_NULL )
    return false;
  if( !(ts->tcpflags & CI_TCPT_FLAG_PASSIVE_OPENED) )
    return false;

  /* send queue is not supported
   * NB: retrans_ptr is uninitialised when retrans was not used yet,
   * so do not check for !OO_PP_IS_NULL(ts->retrans_ptr) */
  if( !ci_ip_queue_is_empty(&ts->send) ||
      ts->send_prequeue != OO_PP_ID_NULL ||
      oo_atomic_read(&ts->send_prequeue_in) != 0 ||
      !ci_ip_queue_is_empty(&ts->retrans) ||
      ci_ip_timer_pending(ni, &ts->rto_tid) ||
      ci_ip_timer_pending(ni, &ts->zwin_tid) ||
#if CI_CFG_TAIL_DROP_PROBE
      ci_ip_timer_pending(ni, &ts->taildrop_tid) ||
#endif
      ci_ip_timer_pending(ni, &ts->cork_tid) )
    return false;

  /* Sockets with allocated templates are not supported */
  if( OO_PP_NOT_NULL(ts->tmpl_head) )
    return false;

  return true;
}
コード例 #2
0
ファイル: tcp_stats.c プロジェクト: ido/openonload
/*! Manage the statistics timer.  
 * If the time is 0 the timer will be  killed. 
 * If the value is other than 0 then:
 *   If the timer is pending it will be modified
 *   else it will be set
 */
ci_inline void
ci_tcp_stats_handle_timer(ci_netif* ni, ci_tcp_state* ts, 
                                        ci_iptime_t timeout)
{
  ci_ip_timer* it;
  ci_assert( ni && ts );
  it  = &ts->stats_tid;

  LOG_STATS( ci_log( "%s( %p, %p, %d)", __FUNCTION__, ni, ts, (int)timeout));
  if( ci_ip_timer_pending(ni, it ) ) {
    if( timeout == 0 )
	  ci_ip_timer_clear(ni, it );
	else
	  ci_ip_timer_modify(ni, it, ci_tcp_time_now(ni)+timeout);
  } else {
	if( timeout != 0 ) 
	  ci_ip_timer_set(ni, it, ci_tcp_time_now(ni)+timeout);
  }
}
コード例 #3
0
ファイル: tcp_synrecv.c プロジェクト: bmschwa/openonload
static void
ci_tcp_listen_timer_set(ci_netif* ni, ci_tcp_socket_listen* tls,
                        ci_iptime_t timeout)
{
  int i;

  if( ! ci_ip_timer_pending(ni, &tls->listenq_tid) ) {
    ci_ip_timer_set(ni, &tls->listenq_tid, timeout);
    return;
  }

  for( i = 0; i <= CI_CFG_TCP_SYNACK_RETRANS_MAX; i++ ) {
    ci_tcp_state_synrecv* tsr =
        ci_tcp_link2synrecv(ci_ni_dllist_start(ni, &tls->listenq[i]));
    if( TIME_LT(tsr->timeout, timeout) )
      return;
  }
  ci_ip_timer_modify(ni, &tls->listenq_tid, timeout);
}