]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.xen/xen-netback-notify-multi
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.xen / xen-netback-notify-multi
CommitLineData
2cb7cef9
BS
1From: jbeulich@novell.com
2Subject: netback: use multicall for send multiple notifications
3Patch-mainline: obsolete
4
5This also does a small fairness improvement since now notifications
6get sent in the order requests came in rather than in the inverse one.
7
8--- sle11-2009-03-24.orig/drivers/xen/core/evtchn.c 2009-03-31 13:36:56.000000000 +0200
9+++ sle11-2009-03-24/drivers/xen/core/evtchn.c 2009-03-31 13:37:08.000000000 +0200
10@@ -1294,6 +1294,21 @@ void notify_remote_via_irq(int irq)
11 }
12 EXPORT_SYMBOL_GPL(notify_remote_via_irq);
13
14+int multi_notify_remote_via_irq(multicall_entry_t *mcl, int irq)
15+{
16+ int evtchn = evtchn_from_irq(irq);
17+
18+ BUG_ON(type_from_irq(irq) == IRQT_VIRQ);
19+ BUG_IF_IPI(irq);
20+
21+ if (!VALID_EVTCHN(evtchn))
22+ return -EINVAL;
23+
24+ multi_notify_remote_via_evtchn(mcl, evtchn);
25+ return 0;
26+}
27+EXPORT_SYMBOL_GPL(multi_notify_remote_via_irq);
28+
29 int irq_to_evtchn_port(int irq)
30 {
31 BUG_IF_VIRQ_PER_CPU(irq);
32--- sle11-2009-03-24.orig/drivers/xen/netback/netback.c 2008-12-23 09:35:42.000000000 +0100
33+++ sle11-2009-03-24/drivers/xen/netback/netback.c 2008-12-23 09:35:48.000000000 +0100
34@@ -748,10 +748,20 @@ static void net_rx_action(unsigned long
35 npo.meta_cons += nr_frags + 1;
36 }
37
38- while (notify_nr != 0) {
39- irq = notify_list[--notify_nr];
40+ if (notify_nr == 1) {
41+ irq = *notify_list;
42 __clear_bit(irq, rx_notify);
43 notify_remote_via_irq(irq + DYNIRQ_BASE);
44+ } else {
45+ for (count = ret = 0; ret < notify_nr; ++ret) {
46+ irq = notify_list[ret];
47+ __clear_bit(irq, rx_notify);
48+ if (!multi_notify_remote_via_irq(rx_mcl + count,
49+ irq + DYNIRQ_BASE))
50+ ++count;
51+ }
52+ if (HYPERVISOR_multicall(rx_mcl, count))
53+ BUG();
54 }
55
56 /* More work to do? */
57--- sle11-2009-03-24.orig/include/xen/evtchn.h 2009-03-04 11:38:25.000000000 +0100
58+++ sle11-2009-03-24/include/xen/evtchn.h 2008-12-01 12:10:27.000000000 +0100
59@@ -179,6 +179,18 @@ static inline void notify_remote_via_evt
60 VOID(HYPERVISOR_event_channel_op(EVTCHNOP_send, &send));
61 }
62
63+static inline void
64+multi_notify_remote_via_evtchn(multicall_entry_t *mcl, int port)
65+{
66+ struct evtchn_send *send = (void *)(mcl->args + 2);
67+
68+ BUILD_BUG_ON(sizeof(*send) > sizeof(mcl->args) - 2 * sizeof(*mcl->args));
69+ send->port = port;
70+ mcl->op = __HYPERVISOR_event_channel_op;
71+ mcl->args[0] = EVTCHNOP_send;
72+ mcl->args[1] = (unsigned long)send;
73+}
74+
75 /* Clear an irq's pending state, in preparation for polling on it. */
76 void xen_clear_irq_pending(int irq);
77
78@@ -197,6 +209,7 @@ void xen_poll_irq(int irq);
79 * by bind_*_to_irqhandler().
80 */
81 void notify_remote_via_irq(int irq);
82+int multi_notify_remote_via_irq(multicall_entry_t *, int irq);
83 int irq_to_evtchn_port(int irq);
84
85 #define PIRQ_SET_MAPPING 0x0