ia64/linux-2.6.18-xen.hg

view drivers/net/3c501.h @ 897:329ea0ccb344

balloon: try harder to balloon up under memory pressure.

Currently if the balloon driver is unable to increase the guest's
reservation it assumes the failure was due to reaching its full
allocation, gives up on the ballooning operation and records the limit
it reached as the "hard limit". The driver will not try again until
the target is set again (even to the same value).

However it is possible that ballooning has in fact failed due to
memory pressure in the host and therefore it is desirable to keep
attempting to reach the target in case memory becomes available. The
most likely scenario is that some guests are ballooning down while
others are ballooning up and therefore there is temporary memory
pressure while things stabilise. You would not expect a well behaved
toolstack to ask a domain to balloon to more than its allocation nor
would you expect it to deliberately over-commit memory by setting
balloon targets which exceed the total host memory.

This patch drops the concept of a hard limit and causes the balloon
driver to retry increasing the reservation on a timer in the same
manner as when decreasing the reservation.

Also if we partially succeed in increasing the reservation
(i.e. receive less pages than we asked for) then we may as well keep
those pages rather than returning them to Xen.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 05 14:01:20 2009 +0100 (2009-06-05)
parents 831230e53067
children
line source
2 /*
3 * Index to functions.
4 */
6 static int el1_probe1(struct net_device *dev, int ioaddr);
7 static int el_open(struct net_device *dev);
8 static void el_timeout(struct net_device *dev);
9 static int el_start_xmit(struct sk_buff *skb, struct net_device *dev);
10 static irqreturn_t el_interrupt(int irq, void *dev_id, struct pt_regs *regs);
11 static void el_receive(struct net_device *dev);
12 static void el_reset(struct net_device *dev);
13 static int el1_close(struct net_device *dev);
14 static struct net_device_stats *el1_get_stats(struct net_device *dev);
15 static void set_multicast_list(struct net_device *dev);
16 static struct ethtool_ops netdev_ethtool_ops;
18 #define EL1_IO_EXTENT 16
20 #ifndef EL_DEBUG
21 #define EL_DEBUG 0 /* use 0 for production, 1 for devel., >2 for debug */
22 #endif /* Anything above 5 is wordy death! */
23 #define debug el_debug
24 static int el_debug = EL_DEBUG;
26 /*
27 * Board-specific info in dev->priv.
28 */
30 struct net_local
31 {
32 struct net_device_stats stats;
33 int tx_pkt_start; /* The length of the current Tx packet. */
34 int collisions; /* Tx collisions this packet */
35 int loading; /* Spot buffer load collisions */
36 int txing; /* True if card is in TX mode */
37 spinlock_t lock; /* Serializing lock */
38 };
41 #define RX_STATUS (ioaddr + 0x06)
42 #define RX_CMD RX_STATUS
43 #define TX_STATUS (ioaddr + 0x07)
44 #define TX_CMD TX_STATUS
45 #define GP_LOW (ioaddr + 0x08)
46 #define GP_HIGH (ioaddr + 0x09)
47 #define RX_BUF_CLR (ioaddr + 0x0A)
48 #define RX_LOW (ioaddr + 0x0A)
49 #define RX_HIGH (ioaddr + 0x0B)
50 #define SAPROM (ioaddr + 0x0C)
51 #define AX_STATUS (ioaddr + 0x0E)
52 #define AX_CMD AX_STATUS
53 #define DATAPORT (ioaddr + 0x0F)
54 #define TX_RDY 0x08 /* In TX_STATUS */
56 #define EL1_DATAPTR 0x08
57 #define EL1_RXPTR 0x0A
58 #define EL1_SAPROM 0x0C
59 #define EL1_DATAPORT 0x0f
61 /*
62 * Writes to the ax command register.
63 */
65 #define AX_OFF 0x00 /* Irq off, buffer access on */
66 #define AX_SYS 0x40 /* Load the buffer */
67 #define AX_XMIT 0x44 /* Transmit a packet */
68 #define AX_RX 0x48 /* Receive a packet */
69 #define AX_LOOP 0x0C /* Loopback mode */
70 #define AX_RESET 0x80
72 /*
73 * Normal receive mode written to RX_STATUS. We must intr on short packets
74 * to avoid bogus rx lockups.
75 */
77 #define RX_NORM 0xA8 /* 0x68 == all addrs, 0xA8 only to me. */
78 #define RX_PROM 0x68 /* Senior Prom, uhmm promiscuous mode. */
79 #define RX_MULT 0xE8 /* Accept multicast packets. */
80 #define TX_NORM 0x0A /* Interrupt on everything that might hang the chip */
82 /*
83 * TX_STATUS register.
84 */
86 #define TX_COLLISION 0x02
87 #define TX_16COLLISIONS 0x04
88 #define TX_READY 0x08
90 #define RX_RUNT 0x08
91 #define RX_MISSED 0x01 /* Missed a packet due to 3c501 braindamage. */
92 #define RX_GOOD 0x30 /* Good packet 0x20, or simple overflow 0x10. */