コード例 #1
0
int
of_list_queue_stats_entry_first(of_list_queue_stats_entry_t *list, of_queue_stats_entry_t *_obj)
{
    int rv;
    of_object_t *obj = (of_object_t *)_obj;

    of_queue_stats_entry_init(_obj, list->version, -1, 1);

    if ((rv = of_list_first(list, obj)) < 0) {
        return rv;
    }



    return rv;
}
コード例 #2
0
int
of_list_queue_stats_entry_first(of_list_queue_stats_entry_t *list,
    of_queue_stats_entry_t *obj)
{
    int rv;

    of_queue_stats_entry_init(obj,
            list->version, 0, 1);
    if ((rv = of_list_first((of_object_t *)list, (of_object_t *)obj)) < 0) {
        return rv;
    }

    of_object_wire_init((of_object_t *) obj, OF_QUEUE_STATS_ENTRY,
                        list->length);
    if (obj->length == 0) {
        return OF_ERROR_PARSE;
    }

    return rv;
}
コード例 #3
0
ファイル: ind_ofdpa_port.c プロジェクト: rizard/ofdpa-2.0
static indigo_error_t ind_ofdpa_queue_stats_set(of_port_no_t port,
                                                uint32_t req_of_port_queue_id,
                                                of_list_queue_stats_entry_t *list)
{
  indigo_error_t err = INDIGO_ERROR_NONE;
  ofdpaPortQueueStats_t queueStats;
  OFDPA_ERROR_t	ofdpa_rv = OFDPA_E_NONE;
  uint32_t numQueues;
  uint32_t queueId;
  uint32_t all_queues = 0;
  of_queue_stats_entry_t entry[1];


  /* Check if the request if for all queues (OFPQ_ALL) */
  if (req_of_port_queue_id == OF_QUEUE_ALL_BY_VERSION(list->version))
  {
    queueId = 0;
    all_queues = 1;
  }
  else
  {
    queueId = req_of_port_queue_id;
  }

  ofdpa_rv = ofdpaNumQueuesGet(port, &numQueues);
  if (ofdpa_rv != OFDPA_E_NONE)
  {
    LOG_ERROR("Failed to get no. of port queues. (ofdpa_rv = %d)", ofdpa_rv);
    return (indigoConvertOfdpaRv(ofdpa_rv));
  }

  if (queueId >= numQueues)
  {
    LOG_ERROR("Invalid queue Id (queueId = %d)", queueId);
    return INDIGO_ERROR_RANGE;
  }

  while (queueId < numQueues)
  {
    of_queue_stats_entry_init(entry, list->version, -1, 1);
    if (of_list_queue_stats_entry_append_bind(list, entry) < 0)
    {
      LOG_ERROR("Too many queue stats replies.");
      return INDIGO_ERROR_RESOURCE;
    }
    ofdpa_rv = ofdpaQueueStatsGet(port, queueId, &queueStats);
    if (ofdpa_rv != OFDPA_E_NONE)
    {
      LOG_ERROR("Failed to queue stats for port %d on queue %d.", port, queueId);
      err = indigoConvertOfdpaRv(ofdpa_rv);
      break;
    }
    of_queue_stats_entry_port_no_set(entry, port);
    of_queue_stats_entry_queue_id_set(entry, queueId);
    of_queue_stats_entry_tx_bytes_set(entry, queueStats.txBytes);
    of_queue_stats_entry_tx_packets_set(entry, queueStats.txPkts);
    of_queue_stats_entry_tx_errors_set(entry, 0);
    of_queue_stats_entry_duration_sec_set(entry, queueStats.duration_seconds);
    of_queue_stats_entry_duration_nsec_set(entry, (queueStats.duration_seconds)*IND_OFDPA_NANO_SEC);


    /* Check if the queueId is all queues OFPQ_ALL */
    if (!all_queues)
    {
      break;
    }

    queueId++;
  }

  return err;
}