Skip to content

Commit

Permalink
pspat: allow dispatcher usleep()
Browse files Browse the repository at this point in the history
  • Loading branch information
vmaffione committed Nov 14, 2017
1 parent 68fa3bd commit 1b0b304
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions net/pspat/functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,10 @@ pspat_do_arbiter(struct pspat *arb)
q->pspat_batch_limit = pspat_arb_qdisc_batch;
}

if (unlikely(skb->next)) {
printk("WARNING: skb->next was not NULL\n");
skb->next = skb->prev = NULL;
}
rc = q->enqueue(skb, q, &to_free) & NET_XMIT_MASK;
if (unlikely(pspat_debug_xmit)) {
printk("enq(%p,%p)-->%d\n", q, skb, rc);
Expand Down Expand Up @@ -671,6 +675,10 @@ pspat_do_dispatcher(struct pspat_dispatcher *s)
printk("PSPAT sender processed %d skbs\n", ndeq);
}

if (pspat_dispatch_sleep_us) {
usleep_range(pspat_dispatch_sleep_us, pspat_dispatch_sleep_us);
}

return ndeq;
}

Expand Down
1 change: 1 addition & 0 deletions net/pspat/pspat.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ extern u64 pspat_arb_loop_max_ns;
extern u64 pspat_arb_loop_avg_reqs;
extern uint32_t pspat_arb_qdisc_batch;
extern uint32_t pspat_dispatch_batch;
extern uint32_t pspat_dispatch_sleep_us;
extern struct pspat_stats *pspat_stats;

struct pspat_stats {
Expand Down
8 changes: 8 additions & 0 deletions net/pspat/pspat_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ u64 pspat_rate __read_mostly = 40000000000; // 40Gb/s
u64 pspat_arb_interval_ns __read_mostly = 1000;
u32 pspat_arb_qdisc_batch __read_mostly = 512;
u32 pspat_dispatch_batch __read_mostly = 256;
u32 pspat_dispatch_sleep_us __read_mostly = 0;
u64 pspat_arb_tc_enq_drop = 0;
u64 pspat_arb_backpressure_drop = 0;
u64 pspat_arb_tc_deq = 0;
Expand Down Expand Up @@ -166,6 +167,13 @@ static struct ctl_table pspat_static_ctl[] = {
.data = &pspat_dispatch_batch,
.proc_handler = &proc_dointvec,
},
{
.procname = "dispatch_sleep_us",
.maxlen = sizeof(u32),
.mode = 0644,
.data = &pspat_dispatch_sleep_us,
.proc_handler = &proc_dointvec,
},
{
.procname = "rate",
.maxlen = sizeof(u64),
Expand Down
1 change: 1 addition & 0 deletions net/pspat/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ sudo sysctl net.pspat.single_txq=0
sudo sysctl net.pspat.mailbox_entries=512
sudo sysctl net.pspat.mailbox_line_size=128
sudo sysctl net.pspat.arb_qdisc_batch=1000
sudo sysctl net.pspat.dispatch_batch=1000
sudo sysctl net.pspat.enable=1

sudo taskset -pc 7 $(pgrep pspat-arb)
Expand Down

0 comments on commit 1b0b304

Please sign in to comment.