| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_xennet_xenbus.c,v 1.35 2009/04/29 22:21:49 jym Exp $ */ | | 1 | /* $NetBSD: if_xennet_xenbus.c,v 1.36 2009/05/02 18:18:44 bouyer Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2006 Manuel Bouyer. | | 4 | * Copyright (c) 2006 Manuel Bouyer. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * 3. All advertising materials mentioning features or use of this software | | 14 | * 3. All advertising materials mentioning features or use of this software |
| @@ -85,27 +85,27 @@ | | | @@ -85,27 +85,27 @@ |
85 | * Purpose is to process the packets received from the outside. RX buffers | | 85 | * Purpose is to process the packets received from the outside. RX buffers |
86 | * are pre-allocated through xennet_alloc_rx_buffer(), during xennet autoconf | | 86 | * are pre-allocated through xennet_alloc_rx_buffer(), during xennet autoconf |
87 | * attach. During pre-allocation, frontend pushes requests in the I/O ring, in | | 87 | * attach. During pre-allocation, frontend pushes requests in the I/O ring, in |
88 | * preparation for incoming packets from backend. | | 88 | * preparation for incoming packets from backend. |
89 | * When RX packets need to be processed, backend takes the requests previously | | 89 | * When RX packets need to be processed, backend takes the requests previously |
90 | * offered by frontend and pushes the associated responses inside the I/O ring. | | 90 | * offered by frontend and pushes the associated responses inside the I/O ring. |
91 | * When done, it notifies frontend through an event notification, which will | | 91 | * When done, it notifies frontend through an event notification, which will |
92 | * asynchronously call xennet_handler() in frontend. | | 92 | * asynchronously call xennet_handler() in frontend. |
93 | * xennet_handler() processes the responses, generates the associated mbuf, and | | 93 | * xennet_handler() processes the responses, generates the associated mbuf, and |
94 | * passes it to the MI layer for further processing. | | 94 | * passes it to the MI layer for further processing. |
95 | */ | | 95 | */ |
96 | | | 96 | |
97 | #include <sys/cdefs.h> | | 97 | #include <sys/cdefs.h> |
98 | __KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.35 2009/04/29 22:21:49 jym Exp $"); | | 98 | __KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.36 2009/05/02 18:18:44 bouyer Exp $"); |
99 | | | 99 | |
100 | #include "opt_xen.h" | | 100 | #include "opt_xen.h" |
101 | #include "opt_nfs_boot.h" | | 101 | #include "opt_nfs_boot.h" |
102 | #include "rnd.h" | | 102 | #include "rnd.h" |
103 | #include "bpfilter.h" | | 103 | #include "bpfilter.h" |
104 | | | 104 | |
105 | #include <sys/param.h> | | 105 | #include <sys/param.h> |
106 | #include <sys/device.h> | | 106 | #include <sys/device.h> |
107 | #include <sys/conf.h> | | 107 | #include <sys/conf.h> |
108 | #include <sys/kernel.h> | | 108 | #include <sys/kernel.h> |
109 | #include <sys/proc.h> | | 109 | #include <sys/proc.h> |
110 | #include <sys/systm.h> | | 110 | #include <sys/systm.h> |
111 | #include <sys/intr.h> | | 111 | #include <sys/intr.h> |
| @@ -492,26 +492,32 @@ again: | | | @@ -492,26 +492,32 @@ again: |
492 | error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path, | | 492 | error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path, |
493 | "tx-ring-ref","%u", sc->sc_tx_ring_gntref); | | 493 | "tx-ring-ref","%u", sc->sc_tx_ring_gntref); |
494 | if (error) { | | 494 | if (error) { |
495 | errmsg = "writing tx ring-ref"; | | 495 | errmsg = "writing tx ring-ref"; |
496 | goto abort_transaction; | | 496 | goto abort_transaction; |
497 | } | | 497 | } |
498 | error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path, | | 498 | error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path, |
499 | "rx-ring-ref","%u", sc->sc_rx_ring_gntref); | | 499 | "rx-ring-ref","%u", sc->sc_rx_ring_gntref); |
500 | if (error) { | | 500 | if (error) { |
501 | errmsg = "writing rx ring-ref"; | | 501 | errmsg = "writing rx ring-ref"; |
502 | goto abort_transaction; | | 502 | goto abort_transaction; |
503 | } | | 503 | } |
504 | error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path, | | 504 | error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path, |
| | | 505 | "feature-rx-notify", "%u", 1); |
| | | 506 | if (error) { |
| | | 507 | errmsg = "writing feature-rx-notify"; |
| | | 508 | goto abort_transaction; |
| | | 509 | } |
| | | 510 | error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path, |
505 | "event-channel", "%u", sc->sc_evtchn); | | 511 | "event-channel", "%u", sc->sc_evtchn); |
506 | if (error) { | | 512 | if (error) { |
507 | errmsg = "writing event channel"; | | 513 | errmsg = "writing event channel"; |
508 | goto abort_transaction; | | 514 | goto abort_transaction; |
509 | } | | 515 | } |
510 | error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path, | | 516 | error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path, |
511 | "state", "%d", XenbusStateConnected); | | 517 | "state", "%d", XenbusStateConnected); |
512 | if (error) { | | 518 | if (error) { |
513 | errmsg = "writing frontend XenbusStateConnected"; | | 519 | errmsg = "writing frontend XenbusStateConnected"; |
514 | goto abort_transaction; | | 520 | goto abort_transaction; |
515 | } | | 521 | } |
516 | error = xenbus_transaction_end(xbt, 0); | | 522 | error = xenbus_transaction_end(xbt, 0); |
517 | if (error == EAGAIN) | | 523 | if (error == EAGAIN) |