aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/netfront.c
Commit message (Collapse)AuthorAgeFilesLines
* mini-os: fix various memory leaks in netfrontMatthew Daley2013-09-211-6/+11
| | | | | | | Coverity-ID: 1055832 Coverity-ID: 1055833 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* mini-os: fix nodename generation in init_netfrontMatthew Daley2013-09-211-2/+4
| | | | | | | | Using strlen here makes no sense. Coverity-ID: 1056053 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* minios: fix xenbus_rm() calls in frontend driversBen Cressey2013-09-101-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The commit "minios: refactor xenbus state machine" caused "/state" to be appended to the local value of nodename. Previously the nodename variable pointed to dev->nodename. The xenbus_rm() calls were not updated to reflect this change, and refer to paths that do not exist. For example, shutdown_blkfront() for vbd 2049 would issue these calls: xenbus_rm(XBT_NIL, "device/vbd/2049/state/ring-ref"); xenbus_rm(XBT_NIL, "device/vbd/2049/state/event-channel"); This patch restores the previous behavior, issuing these calls instead: xenbus_rm(XBT_NIL, "device/vbd/2049/ring-ref"); xenbus_rm(XBT_NIL, "device/vbd/2049/event-channel"); This causes frontend drivers to not be properly reset when PV-GRUB exists. Some PV Linux drivers fail to re-initialize frontend devices if PV-GRUB leaves them in this state. Signed-off-by: Ben Cressey <bcressey@amazon.com> Reviewed-by: Matt Wilson <msw@amazon.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org> [msw: adjusted commit message to include consequences, split out changes into separate patches] Signed-off-by: Matt Wilson <msw@amazon.com>
* minios: clean up unneeded "err = NULL" in frontend driversBen Cressey2013-09-101-1/+0
| | | | | | | | | | | | | | | This patch removes cases where the error message pointer is already NULL and is then set to NULL. These are harmless, but suggest incorrect practice: the pointer should be passed to free() to deallocate memory prior to reassignment. There are no functional changes in this patch. Signed-off-by: Ben Cressey <bcressey@amazon.com> Reviewed-by: Matt Wilson <msw@amazon.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org> [msw: split a larger patch from Ben into this cleanup patch] Signed-off-by: Matt Wilson <msw@amazon.com>
* minios: clean up allocation of char arrays used for xenbus pathsMatt Wilson2013-09-101-2/+2
| | | | | | | | | | This patch cleans up instances of char array allocation where string lengths were manually counted to use strlen() instead. There are no functional changes in this patch. Signed-off-by: Matt Wilson <msw@amazon.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
* minios: correct char array allocation for xenbus pathsMatt Wilson2013-09-101-1/+1
| | | | | | | | | | | | | | | | | | | The char arrays used to hold xenbus paths have historically been allocated by manually counting the length longest string constants included in constructing the path. This has led to improperly sized buffers, both too large (with little consequence) and too small (which obviously causes problems). This patch corrects the instances where the length was incorrectly calculated by using strlen() on the longest string constant used in building a xenbus path. A follow-on clean-up patch will change all instances to use strlen(). Signed-off-by: Ben Cressey <bcressey@amazon.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-By: Samuel Thibault <samuel.thibault@ens-lyon.org> [msw: split this patch from a larger patch from Ben, reworked to use strlen()] Signed-off-by: Matt Wilson <msw@amazon.com>
* mini-os: stop compiler complaint about unused variablesJohn McDermott2012-02-091-0/+1
| | | | | | | | | gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1) complains about unused variables in mini-os drivers Signed-off-by: John McDermott <john.mcdermott@nrl.navy.mil> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* minios: use constant expression to size arraysGianni Tedesco2011-01-071-2/+2
| | | | | | | | | Fixes a compile error in gcc-4.5 which is the reason __CONST_RING_SIZE() was introduced. Let's just use it in minios netfront. Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* MiniOS: Fix continue; in netfront receive loopSamuel Thibault2010-10-121-7/+3
| | | | | | | | | To properly ignore some requests through the use of continue;, indexes need to be updated. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* mini-os: Revert 21106:b20f897d6010 "Fix xenbus initialisation"Keir Fraser2010-05-041-14/+2
| | | | | | Jeremy Fitzhardinge (jeremy@goop.org) reports that this fixes HVM+stubdom. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* mini-os: Fix crash on frontend shutdown failuresKeir Fraser2010-04-071-1/+2
| | | | | | | Do not free frontend resources if some error happened, since the backend may not have finished properly restarting in such case. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* mini-os: Fix frontend shutdown wait loopKeir Fraser2010-04-071-1/+1
| | | | | | | minios frontends must wait for backends to be shut down and reinitialized before freeing resources. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* mini-os: Fix xenbus initialisationKeir Fraser2010-04-061-2/+14
| | | | | | | | | This fixes xenbus initialization of blkfront, netfront and pcifront by uniformizing with fbfront: after writing parameters, set state to initialised, then wait for backend to switch to connect state, and then only read its parameter and switch to the connect state. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* mini-os: Fix memory leaks in blkfront, netfront, pcifront, etc.Keir Fraser2009-12-141-4/+13
| | | | | | | | | The return value of Xenbus routines xenbus_transaction_start(), xenbus_printf(), xenbus_transaction_end(), etc. is a pointer of error message. This pointer should be passed to free() to release the allocated memory when it is no longer needed. Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
* minios: Fix xenbus_unwatch_path callsKeir Fraser2009-11-231-2/+2
| | | | | | | | | | In a lot of places in MiniOS frontends, xenbus_watch_path_token is used instead of xenbus_watch_path to get more precise wake ups. To free those, xenbus_unwatch_path_token has to be used instead of xenbus_unwatch_path, else the unwatch operation will fail. This fixes spurious watch events left by pv-grub. Signed-Off-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
* stubdom/minios: re-structure headersKeir Fraser2009-10-011-9/+9
| | | | | | | | | As part of making stubdom usable on NetBSD, it is necessary to restructure the minios headers to avoid conflicts with NetBSD's crossbuild toolchain. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* minios: refactor xenbus state machineKeir Fraser2009-06-031-14/+48
| | | | | | | | Implement xenbus_wait_for_state_change and xenbus_switch_state and change the various frontends to use the two functions and do proper error checking. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* stubdom: drop lwip supportKeir Fraser2009-04-231-3/+8
| | | | | | | | | | | | | | | | | | | | Network support is still provided the same way: using the tap interface, created in qemu using netfront. The lwip stack is still available to avoid additional compilation issues. However the stubdom is not going to have its own vif anymore, this means that the only vnc server supported is the one in dom0. You can still enable the vnc server in a stubdom at compile time, if you want so. Probably the most important change caused by this patch to xen users is that you don't have to specify two vif in the stubdom config file anymore, but just one: -vif = [ '', 'ip=10.0.1.1,mac=aa:00:00:12:23:34'] +vif = ['ip=10.0.1.1,mac=aa:00:00:12:23:34'] Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* stubdom: use host's gccKeir Fraser2008-07-041-16/+12
| | | | | | | | This makes stubdom use the host's gcc instead of downloading/compiling binutils+gcc. That requires a bunch of changes and even uncovered a few bugs, but saves a lot of time. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* minios: fix add_id_to_freelist(0)Keir Fraser2008-06-201-3/+3
| | | | | | add_id_to_freelist(0) would make get_id_from_freelist() always return 0. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* Add PV-GRUBKeir Fraser2008-06-181-1/+12
| | | | | | | | | | | This fetches GRUB1 sources, applies the {graphical, print function, save default, and ext3_256byte} patches from debian, and applies a patch to make it work on x86_64 and port it to Mini-OS. By using libxc, PV-GRUB can then "kexec" the loaded kernel from inside the domain itself, hence permitting to avoid the security-concerned pygrub. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* stubdom: fix using minios frontends directly when libc is activedKeir Fraser2008-06-181-2/+6
| | | | Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* minios: add proper shutdown facilitiesKeir Fraser2008-06-091-0/+2
| | | | Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* minios: free netfront resources on error/shutdownKeir Fraser2008-05-121-18/+48
| | | | Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* minios: fix thread safety of xenbus watches by requiring callers toKeir Fraser2008-05-061-6/+10
| | | | | | | provide their own queue of events, because else we can not dispatch to watchers running in parallel. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* minios: more assertionsKeir Fraser2008-03-261-0/+4
| | | | | | | | - assert that we never allocate or free the same grant twice - assert that network packets do not exceed a page - assert that incoming network event IDs make sense Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* minios: Automatically set IP from XenStore informationKeir Fraser2008-03-191-2/+7
| | | | Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* minios: Fix lost eventsKeir Fraser2008-03-181-12/+8
| | | | | | | | | | | | | | | evtchn_bind_interdomain used to clear any already pending event before binding a handler, because else the handler may be called before it is ready. That however leads to missed events, which I had to workaround for the HVM case. This changes the semantics of bind_evtchn, and thus of all the event channel binding functions (bind_virq, evtchn_alloc_unbound, evtchn_bind_interdomain) into not unmasking the event itself, hence letting the caller initialize properly before unmasking the port (e.g. record the port number in an appropriate place). Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* Add stubdomain support. See stubdom/README for usage details.Keir Fraser2008-02-121-4/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Move PAGE_SIZE and STACK_SIZE into __PAGE_SIZE and __STACK_SIZE in arch_limits.h so as to permit getting them from there without pulling all the internal Mini-OS defines. - Setup a xen-elf cross-compilation environment in stubdom/cross-root - Add a POSIX layer on top of Mini-OS by linking against the newlib C library and lwIP, and implementing the Unixish part in mini-os/lib/sys.c - Cross-compile zlib and libpci too. - Add an xs.h-compatible layer on top of Mini-OS' xenbus. - Cross-compile libxc with an additional xc_minios.c and a few things disabled. - Cross-compile ioemu with an additional block-vbd, but without sound, tpm and other details. A few hacks are needed: - Align ide and scsi buffers at least on sector size to permit direct transmission to the block backend. While we are at it, just page-align it to possibly save a segment. Also, limit the scsi buffer size because of limitations of the block paravirtualization protocol. - Allocate big tables dynamically rather that letting them go to bss: when Mini-OS gets installed in memory, bss is not lazily allocated, and doing so during Mini-OS is unnecessarily trick while we can simply use malloc. - Had to change the Mini-OS compilation somehow, so as to export Mini-OS compilation flags to the Makefiles of libxc and ioemu. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* minios: Support net/block backend in domUKeir Fraser2008-02-071-14/+16
| | | | Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* minios: support several netfrontsKeir Fraser2008-01-171-117/+143
| | | | Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* minios: add xenbus token support and separate watch event queuesKeir Fraser2008-01-171-14/+0
| | | | Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* [Mini-OS] Make gnttab allocation/free safeKeir Fraser2007-11-281-2/+4
| | | | | | | Add a semaphore to protect gnttab_list from exhaustion, and disable callbacks during allocation/free. Fix the network frontend accordingly. Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
* [Mini-OS] Fix netfront xmit overflowKeir Fraser2007-11-241-6/+16
| | | | | | | Fix xmit overflow by making netfront_xmit sleep until network_tx_buf_gc() frees an xmit request. Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
* [Mini-OS] Fix net backend path leakKeir Fraser2007-11-241-0/+1
| | | | | | Free backend path after use. Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
* minios: Fix netfront for ia64.kfraser@localhost.localdomain2007-02-061-1/+3
| | | | Signed-off-by: Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com>
* minios : netfront driver fixes.kaf24@localhost.localdomain2007-01-261-9/+10
| | | | | | | | - Handle returned backend==NULL || mac==NULL, this leads sometimes to a crash. - Remove unnecessary (and bogus) initialisation of np->rx.req_prod_pvt Signed-off-by: Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com> Signed-off-by: Keir Fraser <keir@xensource.com>
* [MINIOS] Fix compile warnings with -O.kfraser@localhost.localdomain2007-01-191-2/+0
| | | | Signed-off-by: Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com>
* [MINIOS] Implement a network frontend driver.kfraser@localhost.localdomain2007-01-121-0/+455
Signed-off-by: Jacob Gorm Hansen <jacobg@diku.dk>