nfp: bpf: add short busy wait for FW replies
authorJakub Kicinski <jakub.kicinski@netronome.com>
Thu, 18 Jan 2018 03:13:32 +0000 (19:13 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 18 Jan 2018 21:54:26 +0000 (22:54 +0100)
Scheduling out and in for every FW message can slow us down
unnecessarily.  Our experiments show that even under heavy load
the FW responds to 99.9% messages within 200 us.  Add a short
busy wait before entering the wait queue.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
drivers/net/ethernet/netronome/nfp/bpf/cmsg.c

index 71e6586acc367518934be289268ec5ce08f4fd1c..80d3aa0fc9d3ed817b10a0cdba97d95d48d5a326 100644 (file)
@@ -157,7 +157,14 @@ nfp_bpf_cmsg_wait_reply(struct nfp_app_bpf *bpf, enum nfp_bpf_cmsg_type type,
                        int tag)
 {
        struct sk_buff *skb;
-       int err;
+       int i, err;
+
+       for (i = 0; i < 50; i++) {
+               udelay(4);
+               skb = nfp_bpf_reply(bpf, tag);
+               if (skb)
+                       return skb;
+       }
 
        err = wait_event_interruptible_timeout(bpf->cmsg_wq,
                                               skb = nfp_bpf_reply(bpf, tag),