X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fxen%2Fnetback%2Finterface.c;h=d60b23b0f218d8ab19ca687f8549c171dac4ab73;hb=9464c7cf61b9433057924c36e6e02f303a00e768;hp=a698ccc77b02fc8d03589fa49802c99d1d6c9c20;hpb=41689045f6a3cbe0550e1d34e9cc20d2e8c432ba;p=linux-2.6.git diff --git a/drivers/xen/netback/interface.c b/drivers/xen/netback/interface.c index a698ccc77..d60b23b0f 100644 --- a/drivers/xen/netback/interface.c +++ b/drivers/xen/netback/interface.c @@ -34,24 +34,6 @@ #include #include -/* - * Module parameter 'queue_length': - * - * Enables queuing in the network stack when a client has run out of receive - * descriptors. Although this feature can improve receive bandwidth by avoiding - * packet loss, it can also result in packets sitting in the 'tx_queue' for - * unbounded time. This is bad if those packets hold onto foreign resources. - * For example, consider a packet that holds onto resources belonging to the - * guest for which it is queued (e.g., packet received on vif1.0, destined for - * vif1.1 which is not activated in the guest): in this situation the guest - * will never be destroyed, unless vif1.1 is taken down (which flushes the - * 'tx_queue'). - * - * Only set this parameter to non-zero value if you know what you are doing! - */ -static unsigned long netbk_queue_length = 0; -module_param_named(queue_length, netbk_queue_length, ulong, 0); - static void __netif_up(netif_t *netif) { enable_irq(netif->irq); @@ -62,7 +44,6 @@ static void __netif_down(netif_t *netif) { disable_irq(netif->irq); netif_deschedule_work(netif); - del_timer_sync(&netif->credit_timeout); } static int net_open(struct net_device *dev) @@ -126,7 +107,7 @@ static struct ethtool_ops network_ethtool_ops = .get_link = ethtool_op_get_link, }; -netif_t *netif_alloc(domid_t domid, unsigned int handle) +netif_t *netif_alloc(domid_t domid, unsigned int handle, u8 be_mac[ETH_ALEN]) { int err = 0, i; struct net_device *dev; @@ -153,7 +134,6 @@ netif_t *netif_alloc(domid_t domid, unsigned int handle) netif->credit_bytes = netif->remaining_credit = ~0UL; netif->credit_usec = 0UL; init_timer(&netif->credit_timeout); - netif->credit_timeout.expires = jiffies; dev->hard_start_xmit = netif_be_start_xmit; dev->get_stats = netif_be_get_stats; @@ -164,19 +144,26 @@ netif_t *netif_alloc(domid_t domid, unsigned int handle) SET_ETHTOOL_OPS(dev, &network_ethtool_ops); - dev->tx_queue_len = netbk_queue_length; - if (dev->tx_queue_len != 0) - printk(KERN_WARNING "netbk: WARNING: device '%s' has non-zero " - "queue length (%lu)!\n", dev->name, dev->tx_queue_len); - /* - * Initialise a dummy MAC address. We choose the numerically - * largest non-broadcast address to prevent the address getting - * stolen by an Ethernet bridge for STP purposes. - * (FE:FF:FF:FF:FF:FF) - */ - memset(dev->dev_addr, 0xFF, ETH_ALEN); - dev->dev_addr[0] &= ~0x01; + * Reduce default TX queuelen so that each guest interface only + * allows it to eat around 6.4MB of host memory. + */ + dev->tx_queue_len = 100; + + for (i = 0; i < ETH_ALEN; i++) + if (be_mac[i] != 0) + break; + if (i == ETH_ALEN) { + /* + * Initialise a dummy MAC address. We choose the numerically + * largest non-broadcast address to prevent the address getting + * stolen by an Ethernet bridge for STP purposes. + * (FE:FF:FF:FF:FF:FF) + */ + memset(dev->dev_addr, 0xFF, ETH_ALEN); + dev->dev_addr[0] &= ~0x01; + } else + memcpy(dev->dev_addr, be_mac, ETH_ALEN); rtnl_lock(); err = register_netdevice(dev);