Changes to n_flows is already fully serialized by dp_mutex.
struct sw_table swt;
unsigned int max_flows;
- atomic_t n_flows;
+ unsigned int n_flows;
struct list_head flows;
struct list_head iter_flows;
unsigned long int next_serial;
&& (!strict || (flow->priority == priority)))
count += do_delete(swt, flow);
}
- if (count)
- atomic_sub(count, &td->n_flows);
+ td->n_flows -= count;
return count;
}
spin_unlock_bh(&pending_free_lock);
mutex_unlock(&dp_mutex);
- if (del_count)
- atomic_sub(del_count, &td->n_flows);
+ td->n_flows -= del_count;
return del_count;
}
{
struct sw_table_dummy *td = (struct sw_table_dummy *) swt;
stats->name = "dummy";
- stats->n_flows = atomic_read(&td->n_flows);
+ stats->n_flows = td->n_flows;
stats->max_flows = td->max_flows;
}
swt->stats = table_dummy_stats;
td->max_flows = DUMMY_MAX_FLOW;
- atomic_set(&td->n_flows, 0);
+ td->n_flows = 0;
INIT_LIST_HEAD(&td->flows);
INIT_LIST_HEAD(&td->iter_flows);
td->next_serial = 0;
struct sw_table_hash {
struct sw_table swt;
struct crc32 crc32;
- atomic_t n_flows;
+ unsigned int n_flows;
unsigned int bucket_mask; /* Number of buckets minus 1. */
struct sw_flow **buckets;
};
bucket = find_bucket(swt, &flow->key);
if (*bucket == NULL) {
- atomic_inc(&th->n_flows);
+ th->n_flows++;
rcu_assign_pointer(*bucket, flow);
retval = 1;
} else {
count += do_delete(bucket, flow);
}
}
- if (count)
- atomic_sub(count, &th->n_flows);
+ th->n_flows -= count;
return count;
}
dp_send_flow_expired(dp, flow);
}
}
+ th->n_flows -= count;
mutex_unlock(&dp_mutex);
- if (count)
- atomic_sub(count, &th->n_flows);
return count;
}
{
struct sw_table_hash *th = (struct sw_table_hash *) swt;
stats->name = "hash";
- stats->n_flows = atomic_read(&th->n_flows);
+ stats->n_flows = th->n_flows;
stats->max_flows = th->bucket_mask + 1;
}
swt->stats = table_hash_stats;
crc32_init(&th->crc32, polynomial);
- atomic_set(&th->n_flows, 0);
+ th->n_flows = 0;
return swt;
}
struct sw_table swt;
unsigned int max_flows;
- atomic_t n_flows;
+ unsigned int n_flows;
struct list_head flows;
struct list_head iter_flows;
unsigned long int next_serial;
}
/* Make sure there's room in the table. */
- if (atomic_read(&tl->n_flows) >= tl->max_flows) {
+ if (tl->n_flows >= tl->max_flows) {
return 0;
}
- atomic_inc(&tl->n_flows);
+ tl->n_flows++;
/* Insert the entry immediately in front of where we're pointing. */
flow->serial = tl->next_serial++;
&& (!strict || (flow->priority == priority)))
count += do_delete(swt, flow);
}
- if (count)
- atomic_sub(count, &tl->n_flows);
+ tl->n_flows -= count;
return count;
}
dp_send_flow_expired(dp, flow);
}
}
+ tl->n_flows -= count;
mutex_unlock(&dp_mutex);
-
- if (count)
- atomic_sub(count, &tl->n_flows);
return count;
}
{
struct sw_table_linear *tl = (struct sw_table_linear *) swt;
stats->name = "linear";
- stats->n_flows = atomic_read(&tl->n_flows);
+ stats->n_flows = tl->n_flows;
stats->max_flows = tl->max_flows;
}
swt->stats = table_linear_stats;
tl->max_flows = max_flows;
- atomic_set(&tl->n_flows, 0);
+ tl->n_flows = 0;
INIT_LIST_HEAD(&tl->flows);
INIT_LIST_HEAD(&tl->iter_flows);
tl->next_serial = 0;