Commit 1f8c8859 authored by Maria Matejka's avatar Maria Matejka
Browse files

TMP

parent d7976a55
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -57,9 +57,18 @@
      break; \
    /* Release what is to be released */ \
    u64 unmask_ = (~mask_) ? : ~(((mask_ ^ (mask_ + 1)) >> 1) << (release_ % 64)); \


  /* 
    if (!atomic_compare_exchange_strong_explicit( \
	  &(CQ_PTRN((buf_), (ptrn_))->mask[(release_ % CQ_BUF_SIZE((buf_))) / 64]), \
	  &mask_, mask_ & unmask_, \
	  memory_order_acquire, memory_order_acq_rel)) \
      continue; \
    if (!atomic_compare_exchange_strong_explicit( \
	  &(CQ_PTRN((buf_), (ptrn_))->release), &release_, release_ + consec, \
	  memory_order_acquire, memory_order_acq_rel)) \
      bug("Invalid release value"); \
    released_ += consec; \
  } \
} while (0)


#endif
+2 −0
Original line number Diff line number Diff line
@@ -541,6 +541,8 @@ struct channel {
  /* Circular buffer for pending imports */
  CQ_N(struct rte_update_data, CHANNEL_QUEUE_SIZE, 3) import_queue;

  struct task import_finish_task;	/* Task which inserts routes into table */

  struct rtable *in_table;		/* Internal table for received routes */
  struct event *reload_event;		/* Event responsible for reloading from in_table */
  struct fib_iterator reload_fit;	/* FIB iterator in in_table used during reloading */
+6 −1
Original line number Diff line number Diff line
@@ -284,7 +284,6 @@ static inline int rte_is_filtered(rte *r) { return !!(r->flags & REF_FILTERED);
#define RIC_DROP	-2		/* Silently dropped by protocol */

struct rte_update_data {
  struct task task;
  struct channel *channel;
  net_addr_union net;
  struct rte rte;
@@ -305,6 +304,12 @@ struct rte_update_data {
  } result;
};

struct rte_update_task {
  struct task task;
  struct channel *channel;
  uint secondary:1;
};

extern list routing_tables;
struct config;

+12 −8
Original line number Diff line number Diff line
@@ -1406,8 +1406,8 @@ static void rte_finish_update_hook(struct task *task);
static void
rte_finish_update_schedule(struct rte_update_data *rud, u64 id)
{
  struct channel *c = &(rud->channel);
  debug("rte_finish_update_schedule(%p, %d)\n", rud, tail);
  struct channel *c = rud->channel;
  debug("rte_finish_update_schedule(%p)\n", rud);

  uint released = 0;
  CQ_RELEASE(&(c->import_queue), CIQ_FILTER, id, released);
@@ -1415,21 +1415,25 @@ rte_finish_update_schedule(struct rte_update_data *rud, u64 id)
    return;
 
  /* Prepare the table-insert task if needed */
  task_init(&(c->import_finish_task), TF_EXCLUSIVE | (tail ? TF_TAIL : 0), rud->channel->table->domain, rte_finish_update_hook);

  task_init(&(c->import_finish_task), TF_EXCLUSIVE | TF_IDEMPOTENT, rud->channel->table->domain, rte_finish_update_hook);
  task_push(&(c->import_finish_task));
}

static void
rte_do_update(struct task *task)
{
  struct rte_update_data *rud = SKIP_BACK(struct rte_update_data, task, task);
  struct rte_update_task *rut = SKIP_BACK(struct rte_update_task, task, task);
  struct channel *c = rut->channel;

  u64 id = CQ_ACQUIRE_TRY(&(c->import_queue));

  if (!~id)
    return;


  rud_state_change(rud, RUS_PENDING_UPDATE, RUS_UPDATING);

  struct channel *c = rud->channel;
  ASSERT(rud->rte);
#define new (rud->rte)
#define new (&rud->rte)

  const struct filter *filter = c->in_filter;