Exemple #1
0
static inline
bool copy_to_user_skbs(struct pfq_rx_opt *ro, struct pfq_non_intrusive_skb *skbs, unsigned long long skbs_mask, int cpu, int gid)
{
        /* enqueue the sk_buffs: it's wait-free. */

        int len = 0; size_t sent = 0;

        if (likely(ro->queue_ptr)) {

        	smp_rmb();

                len  = (int)pfq_popcount(skbs_mask);
                sent = pfq_mpdb_enqueue_batch(ro, skbs, skbs_mask, len, gid);

        	__sparse_add(&ro->stat.recv, sent, cpu);

		if (len > sent) {
			__sparse_add(&ro->stat.lost, len - sent, cpu);
			return false;
		}
        }
        return true;
}
Exemple #2
0
static inline
bool copy_to_user_skbs(struct pfq_rx_opt *ro, struct gc_queue_buff *queue, unsigned long long mask, int cpu, int gid)
{
        /* enqueue the sk_buffs: it's wait-free. */

        int len = 0; size_t sent = 0;

        if (likely(pfq_get_rx_queue_hdr(ro))) {

        	smp_rmb();

                len  = (int)pfq_popcount(mask);
                sent = pfq_mpdb_enqueue_batch(ro, queue, mask, len, gid);

        	__sparse_add(&ro->stats.recv, sent, cpu);

		if (len > sent) {
			__sparse_add(&ro->stats.lost, len - sent, cpu);
			return false;
		}
        }

        return true;
}