# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 6f957675015db0149f4b406f876d24794dad3951
# Parent 843b9ef21352584a5587a8c390214959284f0024
[NET] front: Give netfront a procectomy. The existing /proc interface
for tuning is buggy (network device names can change), and would
not be accepted in mainline.
Signed-off-by: Stephen Hemminger <shemminger@xxxxxxxx>
---
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c | 175 -------------------
1 files changed, 175 deletions(-)
diff -r 843b9ef21352 -r 6f957675015d
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Thu May 18
10:12:07 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Thu May 18
10:15:14 2006 +0100
@@ -181,16 +181,6 @@ static int send_fake_arp(struct net_devi
static irqreturn_t netif_int(int irq, void *dev_id, struct pt_regs *ptregs);
-#ifdef CONFIG_PROC_FS
-static int xennet_proc_init(void);
-static int xennet_proc_addif(struct net_device *dev);
-static void xennet_proc_delif(struct net_device *dev);
-#else
-#define xennet_proc_init() (0)
-#define xennet_proc_addif(d) (0)
-#define xennet_proc_delif(d) ((void)0)
-#endif
-
/**
* Entry point to this code when a new device is created. Allocate the basic
@@ -1173,11 +1163,6 @@ static int __devinit create_netdev(int h
goto exit_free_rx;
}
- if ((err = xennet_proc_addif(netdev)) != 0) {
- unregister_netdev(netdev);
- goto exit_free_rx;
- }
-
np->netdev = netdev;
if (val)
*val = netdev;
@@ -1248,10 +1233,6 @@ static int __devexit netfront_remove(str
static void close_netdev(struct netfront_info *info)
{
-#ifdef CONFIG_PROC_FS
- xennet_proc_delif(info->netdev);
-#endif
-
del_timer_sync(&info->rx_refill_timer);
unregister_netdev(info->netdev);
@@ -1328,9 +1309,6 @@ static int __init netif_init(void)
if (xen_start_info->flags & SIF_INITDOMAIN)
return 0;
- if ((err = xennet_proc_init()) != 0)
- return err;
-
IPRINTK("Initialising virtual ethernet driver.\n");
(void)register_inetaddr_notifier(¬ifier_inetdev);
@@ -1349,156 +1327,3 @@ module_exit(netif_exit);
module_exit(netif_exit);
MODULE_LICENSE("Dual BSD/GPL");
-
-
-/* ** /proc **/
-
-
-#ifdef CONFIG_PROC_FS
-
-#define TARGET_MIN 0UL
-#define TARGET_MAX 1UL
-#define TARGET_CUR 2UL
-
-static int xennet_proc_read(
- char *page, char **start, off_t off, int count, int *eof, void *data)
-{
- struct net_device *dev =
- (struct net_device *)((unsigned long)data & ~3UL);
- struct netfront_info *np = netdev_priv(dev);
- int len = 0, which_target = (long)data & 3;
-
- switch (which_target) {
- case TARGET_MIN:
- len = sprintf(page, "%d\n", np->rx_min_target);
- break;
- case TARGET_MAX:
- len = sprintf(page, "%d\n", np->rx_max_target);
- break;
- case TARGET_CUR:
- len = sprintf(page, "%d\n", np->rx_target);
- break;
- }
-
- *eof = 1;
- return len;
-}
-
-static int xennet_proc_write(
- struct file *file, const char __user *buffer,
- unsigned long count, void *data)
-{
- struct net_device *dev =
- (struct net_device *)((unsigned long)data & ~3UL);
- struct netfront_info *np = netdev_priv(dev);
- int which_target = (long)data & 3;
- char string[64];
- long target;
-
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
-
- if (count <= 1)
- return -EBADMSG; /* runt */
- if (count > sizeof(string))
- return -EFBIG; /* too long */
-
- if (copy_from_user(string, buffer, count))
- return -EFAULT;
- string[sizeof(string)-1] = '\0';
-
- target = simple_strtol(string, NULL, 10);
- if (target < RX_MIN_TARGET)
- target = RX_MIN_TARGET;
- if (target > RX_MAX_TARGET)
- target = RX_MAX_TARGET;
-
- spin_lock(&np->rx_lock);
-
- switch (which_target) {
- case TARGET_MIN:
- if (target > np->rx_max_target)
- np->rx_max_target = target;
- np->rx_min_target = target;
- if (target > np->rx_target)
- np->rx_target = target;
- break;
- case TARGET_MAX:
- if (target < np->rx_min_target)
- np->rx_min_target = target;
- np->rx_max_target = target;
- if (target < np->rx_target)
- np->rx_target = target;
- break;
- case TARGET_CUR:
- break;
- }
-
- network_alloc_rx_buffers(dev);
-
- spin_unlock(&np->rx_lock);
-
- return count;
-}
-
-static int xennet_proc_init(void)
-{
- if (proc_mkdir("xen/net", NULL) == NULL)
- return -ENOMEM;
- return 0;
-}
-
-static int xennet_proc_addif(struct net_device *dev)
-{
- struct proc_dir_entry *dir, *min, *max, *cur;
- char name[30];
-
- sprintf(name, "xen/net/%s", dev->name);
-
- dir = proc_mkdir(name, NULL);
- if (!dir)
- goto nomem;
-
- min = create_proc_entry("rxbuf_min", 0644, dir);
- max = create_proc_entry("rxbuf_max", 0644, dir);
- cur = create_proc_entry("rxbuf_cur", 0444, dir);
- if (!min || !max || !cur)
- goto nomem;
-
- min->read_proc = xennet_proc_read;
- min->write_proc = xennet_proc_write;
- min->data = (void *)((unsigned long)dev | TARGET_MIN);
-
- max->read_proc = xennet_proc_read;
- max->write_proc = xennet_proc_write;
- max->data = (void *)((unsigned long)dev | TARGET_MAX);
-
- cur->read_proc = xennet_proc_read;
- cur->write_proc = xennet_proc_write;
- cur->data = (void *)((unsigned long)dev | TARGET_CUR);
-
- return 0;
-
- nomem:
- xennet_proc_delif(dev);
- return -ENOMEM;
-}
-
-static void xennet_proc_delif(struct net_device *dev)
-{
- char name[30];
-
- sprintf(name, "xen/net/%s/rxbuf_min", dev->name);
- remove_proc_entry(name, NULL);
-
- sprintf(name, "xen/net/%s/rxbuf_max", dev->name);
- remove_proc_entry(name, NULL);
-
- sprintf(name, "xen/net/%s/rxbuf_cur", dev->name);
- remove_proc_entry(name, NULL);
-
- sprintf(name, "xen/net/%s", dev->name);
- remove_proc_entry(name, NULL);
-}
-
-#endif
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|