Netdev List
 help / color / mirror / Atom feed
* [PATCH v5 8/9] usb/atm/speedtch.c: call atm_dev_signal_change() when signal changes.
From: Karl Hiramoto @ 2010-07-09  6:55 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278658538-6769-1-git-send-email-karl@hiramoto.org>

Propagate signal changes to upper atm layer.

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 drivers/usb/atm/speedtch.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
index 1335456..80f9617 100644
--- a/drivers/usb/atm/speedtch.c
+++ b/drivers/usb/atm/speedtch.c
@@ -525,7 +525,7 @@ static void speedtch_check_status(struct work_struct *work)
 
 		switch (status) {
 		case 0:
-			atm_dev->signal = ATM_PHY_SIG_LOST;
+			atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST);
 			if (instance->last_status)
 				atm_info(usbatm, "ADSL line is down\n");
 			/* It may never resync again unless we ask it to... */
@@ -533,12 +533,12 @@ static void speedtch_check_status(struct work_struct *work)
 			break;
 
 		case 0x08:
-			atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
+			atm_dev_signal_change(atm_dev, ATM_PHY_SIG_UNKNOWN);
 			atm_info(usbatm, "ADSL line is blocked?\n");
 			break;
 
 		case 0x10:
-			atm_dev->signal = ATM_PHY_SIG_LOST;
+			atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST);
 			atm_info(usbatm, "ADSL line is synchronising\n");
 			break;
 
@@ -554,7 +554,7 @@ static void speedtch_check_status(struct work_struct *work)
 			}
 
 			atm_dev->link_rate = down_speed * 1000 / 424;
-			atm_dev->signal = ATM_PHY_SIG_FOUND;
+			atm_dev_signal_change(atm_dev, ATM_PHY_SIG_FOUND);
 
 			atm_info(usbatm,
 				 "ADSL line is up (%d kb/s down | %d kb/s up)\n",
@@ -562,7 +562,7 @@ static void speedtch_check_status(struct work_struct *work)
 			break;
 
 		default:
-			atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
+			atm_dev_signal_change(atm_dev, ATM_PHY_SIG_UNKNOWN);
 			atm_info(usbatm, "unknown line state %02x\n", status);
 			break;
 		}
-- 
1.7.1


^ permalink raw reply related

* [PATCH v5 7/9] usb/atm/cxacru.c: call atm_dev_signal_change() when signal changes.
From: Karl Hiramoto @ 2010-07-09  6:55 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278658538-6769-1-git-send-email-karl@hiramoto.org>

Propagate signal changes to upper atm layer.

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 drivers/usb/atm/cxacru.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index c89990f..101ffc9 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -866,50 +866,50 @@ static void cxacru_poll_status(struct work_struct *work)
 	instance->line_status = buf[CXINF_LINE_STATUS];
 	switch (instance->line_status) {
 	case 0:
-		atm_dev->signal = ATM_PHY_SIG_LOST;
+		atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST);
 		atm_info(usbatm, "ADSL line: down\n");
 		break;
 
 	case 1:
-		atm_dev->signal = ATM_PHY_SIG_LOST;
+		atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST);
 		atm_info(usbatm, "ADSL line: attempting to activate\n");
 		break;
 
 	case 2:
-		atm_dev->signal = ATM_PHY_SIG_LOST;
+		atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST);
 		atm_info(usbatm, "ADSL line: training\n");
 		break;
 
 	case 3:
-		atm_dev->signal = ATM_PHY_SIG_LOST;
+		atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST);
 		atm_info(usbatm, "ADSL line: channel analysis\n");
 		break;
 
 	case 4:
-		atm_dev->signal = ATM_PHY_SIG_LOST;
+		atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST);
 		atm_info(usbatm, "ADSL line: exchange\n");
 		break;
 
 	case 5:
 		atm_dev->link_rate = buf[CXINF_DOWNSTREAM_RATE] * 1000 / 424;
-		atm_dev->signal = ATM_PHY_SIG_FOUND;
+		atm_dev_signal_change(atm_dev, ATM_PHY_SIG_FOUND);
 
 		atm_info(usbatm, "ADSL line: up (%d kb/s down | %d kb/s up)\n",
 		     buf[CXINF_DOWNSTREAM_RATE], buf[CXINF_UPSTREAM_RATE]);
 		break;
 
 	case 6:
-		atm_dev->signal = ATM_PHY_SIG_LOST;
+		atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST);
 		atm_info(usbatm, "ADSL line: waiting\n");
 		break;
 
 	case 7:
-		atm_dev->signal = ATM_PHY_SIG_LOST;
+		atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST);
 		atm_info(usbatm, "ADSL line: initializing\n");
 		break;
 
 	default:
-		atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
+		atm_dev_signal_change(atm_dev, ATM_PHY_SIG_UNKNOWN);
 		atm_info(usbatm, "Unknown line state %02x\n", instance->line_status);
 		break;
 	}
-- 
1.7.1


^ permalink raw reply related

* [PATCH v5 6/9] atm/suni.c: call atm_dev_signal_change() when signal changes.
From: Karl Hiramoto @ 2010-07-09  6:55 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278658538-6769-1-git-send-email-karl@hiramoto.org>

Propagate changes to upper atm layer.

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 drivers/atm/suni.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/atm/suni.c b/drivers/atm/suni.c
index da4b91f..41c56ea 100644
--- a/drivers/atm/suni.c
+++ b/drivers/atm/suni.c
@@ -291,8 +291,9 @@ static int suni_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
 
 static void poll_los(struct atm_dev *dev)
 {
-	dev->signal = GET(RSOP_SIS) & SUNI_RSOP_SIS_LOSV ? ATM_PHY_SIG_LOST :
-	  ATM_PHY_SIG_FOUND;
+	atm_dev_signal_change(dev,
+		GET(RSOP_SIS) & SUNI_RSOP_SIS_LOSV ?
+		ATM_PHY_SIG_LOST : ATM_PHY_SIG_FOUND);
 }
 
 
-- 
1.7.1


^ permalink raw reply related

* [PATCH v5 5/9] atm/solos-pci: call atm_dev_signal_change() when signal changes.
From: Karl Hiramoto @ 2010-07-09  6:55 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278658538-6769-1-git-send-email-karl@hiramoto.org>

Propagate changes to upper atm layer, so userspace netmontor knows when DSL
showtime reached.

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 drivers/atm/solos-pci.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index ded76c4..6174965 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -383,7 +383,7 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
 
 	/* Anything but 'Showtime' is down */
 	if (strcmp(state_str, "Showtime")) {
-		card->atmdev[port]->signal = ATM_PHY_SIG_LOST;
+		atm_dev_signal_change(card->atmdev[port], ATM_PHY_SIG_LOST);
 		release_vccs(card->atmdev[port]);
 		dev_info(&card->dev->dev, "Port %d: %s\n", port, state_str);
 		return 0;
@@ -401,7 +401,7 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
 		 snr[0]?", SNR ":"", snr, attn[0]?", Attn ":"", attn);
 	
 	card->atmdev[port]->link_rate = rate_down / 424;
-	card->atmdev[port]->signal = ATM_PHY_SIG_FOUND;
+	atm_dev_signal_change(card->atmdev[port], ATM_PHY_SIG_FOUND);
 
 	return 0;
 }
@@ -1246,7 +1246,7 @@ static int atm_init(struct solos_card *card)
 		card->atmdev[i]->ci_range.vci_bits = 16;
 		card->atmdev[i]->dev_data = card;
 		card->atmdev[i]->phy_data = (void *)(unsigned long)i;
-		card->atmdev[i]->signal = ATM_PHY_SIG_UNKNOWN;
+		atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_UNKNOWN);
 
 		skb = alloc_skb(sizeof(*header), GFP_ATOMIC);
 		if (!skb) {
-- 
1.7.1


^ permalink raw reply related

* [PATCH v5 4/9] atm/idt77105.c: call atm_dev_signal_change() when signal changes.
From: Karl Hiramoto @ 2010-07-09  6:55 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278658538-6769-1-git-send-email-karl@hiramoto.org>

Propagate changes to upper atm layer.

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 drivers/atm/idt77105.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
index dab5cf5..bca9cb8 100644
--- a/drivers/atm/idt77105.c
+++ b/drivers/atm/idt77105.c
@@ -126,7 +126,7 @@ static void idt77105_restart_timer_func(unsigned long dummy)
                 istat = GET(ISTAT); /* side effect: clears all interrupt status bits */
                 if (istat & IDT77105_ISTAT_GOODSIG) {
                     /* Found signal again */
-                    dev->signal = ATM_PHY_SIG_FOUND;
+                    atm_dev_signal_change(dev, ATM_PHY_SIG_FOUND);
 	            printk(KERN_NOTICE "%s(itf %d): signal detected again\n",
                         dev->type,dev->number);
                     /* flush the receive FIFO */
@@ -222,7 +222,7 @@ static void idt77105_int(struct atm_dev *dev)
             /* Rx Signal Condition Change - line went up or down */
             if (istat & IDT77105_ISTAT_GOODSIG) {   /* signal detected again */
                 /* This should not happen (restart timer does it) but JIC */
-                dev->signal = ATM_PHY_SIG_FOUND;
+		atm_dev_signal_change(dev, ATM_PHY_SIG_FOUND);
             } else {    /* signal lost */
                 /*
                  * Disable interrupts and stop all transmission and
@@ -235,7 +235,7 @@ static void idt77105_int(struct atm_dev *dev)
                     IDT77105_MCR_DRIC|
                     IDT77105_MCR_HALTTX
                     ) & ~IDT77105_MCR_EIP, MCR);
-                dev->signal = ATM_PHY_SIG_LOST;
+		atm_dev_signal_change(dev, ATM_PHY_SIG_LOST);
 	        printk(KERN_NOTICE "%s(itf %d): signal lost\n",
                     dev->type,dev->number);
             }
@@ -272,8 +272,9 @@ static int idt77105_start(struct atm_dev *dev)
 	memset(&PRIV(dev)->stats,0,sizeof(struct idt77105_stats));
         
         /* initialise dev->signal from Good Signal Bit */
-        dev->signal = GET(ISTAT) & IDT77105_ISTAT_GOODSIG ? ATM_PHY_SIG_FOUND :
-	  ATM_PHY_SIG_LOST;
+	atm_dev_signal_change(dev,
+		GET(ISTAT) & IDT77105_ISTAT_GOODSIG ?
+		ATM_PHY_SIG_FOUND : ATM_PHY_SIG_LOST);
 	if (dev->signal == ATM_PHY_SIG_LOST)
 		printk(KERN_WARNING "%s(itf %d): no signal\n",dev->type,
 		    dev->number);
-- 
1.7.1


^ permalink raw reply related

* [PATCH v5 3/9] atm/adummy: add syfs DEVICE_ATTR to change signal
From: Karl Hiramoto @ 2010-07-09  6:55 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278658538-6769-1-git-send-email-karl@hiramoto.org>

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 drivers/atm/adummy.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
index 6d44f07..46b9476 100644
--- a/drivers/atm/adummy.c
+++ b/drivers/atm/adummy.c
@@ -40,6 +40,42 @@ struct adummy_dev {
 
 static LIST_HEAD(adummy_devs);
 
+static ssize_t __set_signal(struct device *dev,
+		struct device_attribute *attr,
+		const char *buf, size_t len)
+{
+	struct atm_dev *atm_dev = container_of(dev, struct atm_dev, class_dev);
+	int signal;
+
+	if (sscanf(buf, "%d", &signal) == 1) {
+
+		if (signal < ATM_PHY_SIG_LOST || signal > ATM_PHY_SIG_FOUND)
+			signal = ATM_PHY_SIG_UNKNOWN;
+
+		atm_dev_signal_change(atm_dev, signal);
+		return 1;
+	}
+	return -EINVAL;
+}
+
+static ssize_t __show_signal(struct device *dev,
+	struct device_attribute *attr, char *buf)
+{
+	struct atm_dev *atm_dev = container_of(dev, struct atm_dev, class_dev);
+	return sprintf(buf, "%d\n", atm_dev->signal);
+}
+static DEVICE_ATTR(signal, 0644, __show_signal, __set_signal);
+
+static struct attribute *adummy_attrs[] = {
+	&dev_attr_signal.attr,
+	NULL
+};
+
+static struct attribute_group adummy_group_attrs = {
+	.name = NULL, /* We want them in dev's root folder */
+	.attrs = adummy_attrs
+};
+
 static int __init
 adummy_start(struct atm_dev *dev)
 {
@@ -128,6 +164,9 @@ static int __init adummy_init(void)
 	adummy_dev->atm_dev = atm_dev;
 	atm_dev->dev_data = adummy_dev;
 
+	if (sysfs_create_group(&atm_dev->class_dev.kobj, &adummy_group_attrs))
+		dev_err(&atm_dev->class_dev, "Could not register attrs for adummy\n");
+
 	if (adummy_start(atm_dev)) {
 		printk(KERN_ERR DEV_LABEL ": adummy_start() failed\n");
 		err = -ENODEV;
-- 
1.7.1


^ permalink raw reply related

* [PATCH v5 2/9] atm/br2684: register notifier event for carrier signal changes.
From: Karl Hiramoto @ 2010-07-09  6:55 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278658538-6769-1-git-send-email-karl@hiramoto.org>

When a signal change event occurs call netif_carrier_on/off.

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 net/atm/br2684.c |   66 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index 6719af6..651babd 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -139,6 +139,43 @@ static struct net_device *br2684_find_dev(const struct br2684_if_spec *s)
 	return NULL;
 }
 
+static int atm_dev_event(struct notifier_block *this, unsigned long event,
+		 void *arg)
+{
+	struct atm_dev *atm_dev = arg;
+	struct list_head *lh;
+	struct net_device *net_dev;
+	struct br2684_vcc *brvcc;
+	struct atm_vcc *atm_vcc;
+	unsigned long flags;
+
+	pr_debug("event=%ld dev=%p\n", event, atm_dev);
+
+	read_lock_irqsave(&devs_lock, flags);
+	list_for_each(lh, &br2684_devs) {
+		net_dev = list_entry_brdev(lh);
+
+		list_for_each_entry(brvcc, &BRPRIV(net_dev)->brvccs, brvccs) {
+			atm_vcc = brvcc->atmvcc;
+			if (atm_vcc && brvcc->atmvcc->dev == atm_dev) {
+
+				if (atm_vcc->dev->signal == ATM_PHY_SIG_LOST)
+					netif_carrier_off(net_dev);
+				else
+					netif_carrier_on(net_dev);
+
+			}
+		}
+	}
+	read_unlock_irqrestore(&devs_lock, flags);
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block atm_dev_notifier = {
+	.notifier_call = atm_dev_event,
+};
+
 /* chained vcc->pop function.  Check if we should wake the netif_queue */
 static void br2684_pop(struct atm_vcc *vcc, struct sk_buff *skb)
 {
@@ -362,6 +399,12 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
 			unregister_netdev(net_dev);
 			free_netdev(net_dev);
 		}
+		read_lock_irq(&devs_lock);
+		if (list_empty(&br2684_devs)) {
+			/* last br2684 device */
+			unregister_atmdevice_notifier(&atm_dev_notifier);
+		}
+		read_unlock_irq(&devs_lock);
 		return;
 	}
 
@@ -530,6 +573,13 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
 
 		br2684_push(atmvcc, skb);
 	}
+
+	/* initialize netdev carrier state */
+	if (atmvcc->dev->signal == ATM_PHY_SIG_LOST)
+		netif_carrier_off(net_dev);
+	else
+		netif_carrier_on(net_dev);
+
 	__module_get(THIS_MODULE);
 	return 0;
 
@@ -620,9 +670,16 @@ static int br2684_create(void __user *arg)
 	}
 
 	write_lock_irq(&devs_lock);
+
 	brdev->payload = payload;
-	brdev->number = list_empty(&br2684_devs) ? 1 :
-	    BRPRIV(list_entry_brdev(br2684_devs.prev))->number + 1;
+
+	if (list_empty(&br2684_devs)) {
+		/* 1st br2684 device */
+		register_atmdevice_notifier(&atm_dev_notifier);
+		brdev->number = 1;
+	} else
+		brdev->number = BRPRIV(list_entry_brdev(br2684_devs.prev))->number + 1;
+
 	list_add_tail(&brdev->br2684_devs, &br2684_devs);
 	write_unlock_irq(&devs_lock);
 	return 0;
@@ -772,6 +829,11 @@ static void __exit br2684_exit(void)
 	remove_proc_entry("br2684", atm_proc_root);
 #endif
 
+
+	/* if not already empty */
+	if (!list_empty(&br2684_devs))
+		unregister_atmdevice_notifier(&atm_dev_notifier);
+
 	while (!list_empty(&br2684_devs)) {
 		net_dev = list_entry_brdev(br2684_devs.next);
 		brdev = BRPRIV(net_dev);
-- 
1.7.1


^ permalink raw reply related

* [PATCH v5 1/9] atm: propagate signal changes via notifier
From: Karl Hiramoto @ 2010-07-09  6:55 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278658538-6769-1-git-send-email-karl@hiramoto.org>

Add notifier chain for changes in atm_dev.

Clients like br2684 will call register_atmdevice_notifier() to be notified of
changes. Drivers will call atm_dev_signal_change() to notify clients like
br2684 of the change.

On DSL and ATM devices it's usefull to have a know if you have a carrier
signal. netdevice LOWER_UP changes can be propagated to userspace via netlink
monitor.

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 include/linux/atmdev.h |   17 +++++++++++++++++
 net/atm/common.c       |   30 ++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 817b237..f6481da 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -431,6 +431,14 @@ struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
     int number,unsigned long *flags); /* number == -1: pick first available */
 struct atm_dev *atm_dev_lookup(int number);
 void atm_dev_deregister(struct atm_dev *dev);
+
+/* atm_dev_signal_change
+ *
+ * Propagate lower layer signal change in atm_dev->signal to netdevice.
+ * The event will be sent via a notifier call chain.
+ */
+void atm_dev_signal_change(struct atm_dev *dev, char signal);
+
 void vcc_insert_socket(struct sock *sk);
 
 
@@ -510,6 +518,15 @@ void register_atm_ioctl(struct atm_ioctl *);
  */
 void deregister_atm_ioctl(struct atm_ioctl *);
 
+
+/* register_atmdevice_notifier - register atm_dev notify events
+ *
+ * Clients like br2684 will register notify events
+ * Currently we notify of signal found/lost
+ */
+int register_atmdevice_notifier(struct notifier_block *nb);
+void unregister_atmdevice_notifier(struct notifier_block *nb);
+
 #endif /* __KERNEL__ */
 
 #endif
diff --git a/net/atm/common.c b/net/atm/common.c
index b43feb1..940404a 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -37,6 +37,8 @@ EXPORT_SYMBOL(vcc_hash);
 DEFINE_RWLOCK(vcc_sklist_lock);
 EXPORT_SYMBOL(vcc_sklist_lock);
 
+static ATOMIC_NOTIFIER_HEAD(atm_dev_notify_chain);
+
 static void __vcc_insert_socket(struct sock *sk)
 {
 	struct atm_vcc *vcc = atm_sk(sk);
@@ -212,6 +214,22 @@ void vcc_release_async(struct atm_vcc *vcc, int reply)
 }
 EXPORT_SYMBOL(vcc_release_async);
 
+void atm_dev_signal_change(struct atm_dev *dev, char signal)
+{
+	pr_debug("%s signal=%d dev=%p number=%d dev->signal=%d\n",
+		__func__, signal, dev, dev->number, dev->signal);
+
+	/* atm driver sending invalid signal */
+	WARN_ON(signal < ATM_PHY_SIG_LOST || signal > ATM_PHY_SIG_FOUND);
+
+	if (dev->signal == signal)
+		return; /* no change */
+
+	dev->signal = signal;
+
+	atomic_notifier_call_chain(&atm_dev_notify_chain, signal, dev);
+}
+EXPORT_SYMBOL(atm_dev_signal_change);
 
 void atm_dev_release_vccs(struct atm_dev *dev)
 {
@@ -781,6 +799,18 @@ int vcc_getsockopt(struct socket *sock, int level, int optname,
 	return vcc->dev->ops->getsockopt(vcc, level, optname, optval, len);
 }
 
+int register_atmdevice_notifier(struct notifier_block *nb)
+{
+	return atomic_notifier_chain_register(&atm_dev_notify_chain, nb);
+}
+EXPORT_SYMBOL_GPL(register_atmdevice_notifier);
+
+void unregister_atmdevice_notifier(struct notifier_block *nb)
+{
+	atomic_notifier_chain_unregister(&atm_dev_notify_chain, nb);
+}
+EXPORT_SYMBOL_GPL(unregister_atmdevice_notifier);
+
 static int __init atm_init(void)
 {
 	int error;
-- 
1.7.1


^ permalink raw reply related

* [PATCH v5 0/9] atm:  propagate atm_dev signal carrier to LOWER_UP of netdevice
From: Karl Hiramoto @ 2010-07-09  6:55 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto

Changes from v4:
* remove a "* \n" inside a comment in atmdev.h

Changes from v3:
* read_lock_irqsave() instead of read_lock_irq()
* format comments in atmdev.h

Changes from v2:
* use atomic instead of blocking notifier
* use read_lock_irq() instead of read_lock() in atm/br2684
* clean up comments
* remove unused variable.

Changes from v1:
Use atm_dev notifier chain  instead of callback function pointer in struct vcc.
In drivers/usb/atm call atm_dev_signal_change().

In userspace it's helpful to know if a network device has a carrier signal.
Often it is monitored via netlink.  This patchset allows a way for the
struct atm_dev drivers to pass carrier on/off to the netdevice.

For DSL, carrier is on when the line has reached showtime state.

Currently this patchset only propagates the changes to br2684 vccs,
as this is the only type of hardware I have to test.

If you prefer git you can pull from:
git://github.com/karlhiramoto/linux-2.6.git atm-v5


 drivers/atm/adummy.c         |   39 ++++++++++++++++++++++++
 drivers/atm/idt77105.c       |   11 ++++---
 drivers/atm/solos-pci.c      |    6 ++--
 drivers/atm/suni.c           |    5 ++-
 drivers/usb/atm/cxacru.c     |   18 ++++++------
 drivers/usb/atm/speedtch.c   |   10 +++---
 drivers/usb/atm/ueagle-atm.c |   13 ++++++--
 include/linux/atmdev.h       |   17 +++++++++++
 net/atm/br2684.c             |   66 ++++++++++++++++++++++++++++++++++++++++-
 net/atm/common.c             |   30 +++++++++++++++++++
 10 files changed, 186 insertions(+), 29 deletions(-)


^ permalink raw reply

* Re: [PATCH v4 1/9] atm: propagate signal changes via notifier
From: David Miller @ 2010-07-09  6:53 UTC (permalink / raw)
  To: horms; +Cc: karl, linux-atm-general, netdev, chas
In-Reply-To: <20100709065012.GB24576@verge.net.au>

From: Simon Horman <horms@verge.net.au>
Date: Fri, 9 Jul 2010 15:50:13 +0900

> On Thu, Jul 08, 2010 at 11:38:01PM -0700, David Miller wrote:
>> From: Karl Hiramoto <karl@hiramoto.org>
>> Date: Fri, 09 Jul 2010 08:36:03 +0200
>> 
>> > Ok, fixing it,  but there are 100's of occurences in net/ like i had it. :-)
>> 
>> I would be happy to see a patch which fixes them up :-)
> 
> Really? By my calculations it would be an awful lot of churn.
> 
> $ find net/ -type f -name "*.[chS]" | xargs grep "\/\* *$" | wc -l
> 6833
> $ find net/ -type f -name "*.[chS]" | xargs grep -l "\/\* *$" | wc -l
> 929

I didn't mean "one patch" which fixes them up :)

Done graudually in chunks over a period of time, it's not likely
to be so much churn.

This is how every other coding style malfeasance gets handled.


^ permalink raw reply

* Re: [PATCH v4 1/9] atm: propagate signal changes via notifier
From: Simon Horman @ 2010-07-09  6:50 UTC (permalink / raw)
  To: David Miller; +Cc: karl, linux-atm-general, netdev, chas
In-Reply-To: <20100708.233801.258129125.davem@davemloft.net>

On Thu, Jul 08, 2010 at 11:38:01PM -0700, David Miller wrote:
> From: Karl Hiramoto <karl@hiramoto.org>
> Date: Fri, 09 Jul 2010 08:36:03 +0200
> 
> > Ok, fixing it,  but there are 100's of occurences in net/ like i had it. :-)
> 
> I would be happy to see a patch which fixes them up :-)

Really? By my calculations it would be an awful lot of churn.

$ find net/ -type f -name "*.[chS]" | xargs grep "\/\* *$" | wc -l
6833
$ find net/ -type f -name "*.[chS]" | xargs grep -l "\/\* *$" | wc -l
929



^ permalink raw reply

* [PATCH v3 2/2] ks8842: Remove unnecessary bank select.
From: Richard Röjfors @ 2010-07-09  6:28 UTC (permalink / raw)
  To: netdev; +Cc: davem

This patch removes an unnecessary bank select before resetting the
controller.

Signed-off-by: Richard Röjfors <richard.rojfors@pelagicore.com>
---
diff --git a/drivers/net/ks8842.c b/drivers/net/ks8842.c
index 5191af2..0be9261 100644
--- a/drivers/net/ks8842.c
+++ b/drivers/net/ks8842.c
@@ -199,7 +199,6 @@ static void ks8842_reset(struct ks8842_adapter *adapter)
 	msleep(10);
 	iowrite16(0, adapter->hw_addr + REG_GRR);
 	*/
-	iowrite16(32, adapter->hw_addr + REG_SELECT_BANK);
 	iowrite32(0x1, adapter->hw_addr + REG_TIMB_RST);
 	msleep(20);
 }


^ permalink raw reply related

* [PATCH v3 1/2] ks8842: Do the TX timeout work in workqueue context.
From: Richard Röjfors @ 2010-07-09  6:28 UTC (permalink / raw)
  To: netdev; +Cc: davem

Currently all code that needs to be run at TX timeout is done in the
calling context, where bottom halves are disabled. Some of the code
blocks, so it needs to be done in a different context. This patch
adds in a work struct which is scheduled at TX timeout. Then the
timeout code is executed within work queue context.

Signed-off-by: Richard Röjfors <richard.rojfors@pelagicore.com>
---
diff --git a/drivers/net/ks8842.c b/drivers/net/ks8842.c
index d47bba9..5191af2 100644
--- a/drivers/net/ks8842.c
+++ b/drivers/net/ks8842.c
@@ -119,6 +119,8 @@ struct ks8842_adapter {
 	int		irq;
 	struct tasklet_struct	tasklet;
 	spinlock_t	lock; /* spinlock to be interrupt safe */
+	struct work_struct timeout_work;
+	struct net_device *netdev;
 };
 
 static inline void ks8842_select_bank(struct ks8842_adapter *adapter, u16 bank)
@@ -553,6 +555,8 @@ static int ks8842_close(struct net_device *netdev)
 
 	netdev_dbg(netdev, "%s - entry\n", __func__);
 
+	cancel_work_sync(&adapter->timeout_work);
+
 	/* free the irq */
 	free_irq(adapter->irq, netdev);
 
@@ -595,9 +599,11 @@ static int ks8842_set_mac(struct net_device *netdev, void *p)
 	return 0;
 }
 
-static void ks8842_tx_timeout(struct net_device *netdev)
+static void ks8842_tx_timeout_work(struct work_struct *work)
 {
-	struct ks8842_adapter *adapter = netdev_priv(netdev);
+	struct ks8842_adapter *adapter =
+		container_of(work, struct ks8842_adapter, timeout_work);
+	struct net_device *netdev = adapter->netdev;
 	unsigned long flags;
 
 	netdev_dbg(netdev, "%s: entry\n", __func__);
@@ -606,6 +612,9 @@ static void ks8842_tx_timeout(struct net_device *netdev)
 	/* disable interrupts */
 	ks8842_write16(adapter, 18, 0, REG_IER);
 	ks8842_write16(adapter, 18, 0xFFFF, REG_ISR);
+
+	netif_stop_queue(netdev);
+
 	spin_unlock_irqrestore(&adapter->lock, flags);
 
 	ks8842_reset_hw(adapter);
@@ -615,6 +624,15 @@ static void ks8842_tx_timeout(struct net_device *netdev)
 	ks8842_update_link_status(netdev, adapter);
 }
 
+static void ks8842_tx_timeout(struct net_device *netdev)
+{
+	struct ks8842_adapter *adapter = netdev_priv(netdev);
+
+	netdev_dbg(netdev, "%s: entry\n", __func__);
+
+	schedule_work(&adapter->timeout_work);
+}
+
 static const struct net_device_ops ks8842_netdev_ops = {
 	.ndo_open		= ks8842_open,
 	.ndo_stop		= ks8842_close,
@@ -649,6 +667,8 @@ static int __devinit ks8842_probe(struct platform_device *pdev)
 	SET_NETDEV_DEV(netdev, &pdev->dev);
 
 	adapter = netdev_priv(netdev);
+	adapter->netdev = netdev;
+	INIT_WORK(&adapter->timeout_work, ks8842_tx_timeout_work);
 	adapter->hw_addr = ioremap(iomem->start, resource_size(iomem));
 	if (!adapter->hw_addr)
 		goto err_ioremap;


^ permalink raw reply related

* [PATCH v3 0/2] ks8842: Do the TX timeout work in workqueue context.
From: Richard Röjfors @ 2010-07-09  6:28 UTC (permalink / raw)
  To: netdev; +Cc: davem

To follow are two patches. One that schedules tx timeout to be done
in work queue context.

The other removed an unnecessary bank select before reset.

--Richard


^ permalink raw reply

* Re: [PATCH net-next] cxgb4vf: Implement "Unhandled Interrupts" statistic
From: David Miller @ 2010-07-09  6:48 UTC (permalink / raw)
  To: leedom; +Cc: netdev
In-Reply-To: <201007081107.45287.leedom@chelsio.com>

From: Casey Leedom <leedom@chelsio.com>
Date: Thu, 8 Jul 2010 11:07:44 -0700

>>From 6c9cc1b5441afb32ecfcd10ac3060452e3c4df6f Mon Sep 17 00:00:00 2001
> From: Casey Leedom <leedom@chelsio.com>
> Date: Thu, 8 Jul 2010 10:05:48 -0700
> Subject: [PATCH net-next] cxgb4vf: Implement "Unhandled Interrupts" statistic
> 
> Implement "Unhandled Interrupts" statistic so we can detect when the
> hardware tells us that it things we have work to do but we don't find
> anything ...
> 
> Signed-off-by: Casey Leedom <leedom@chelsio.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH 1/6 net-next-2.6] vxge: Remove queue_state references
From: David Miller @ 2010-07-09  6:47 UTC (permalink / raw)
  To: jon.mason; +Cc: netdev, Sreenivasa.Honnur, ramkrishna.vepa
In-Reply-To: <20100708231936.GA19237@exar.com>

From: Jon Mason <jon.mason@exar.com>
Date: Thu, 8 Jul 2010 18:19:37 -0500

> On Thu, Jul 08, 2010 at 12:19:57PM -0700, Jon Mason wrote:
>> Remove queue_state references, as they are no longer necessary.
>> 
>> Also, The driver needs to start/stop the queue regardless of which type
>> of steering is enabled.  Remove checks for TX_MULTIQ_STEERING only and
>> start/stop for all steering types.
>> 
>> Signed-off-by: Jon Mason <jon.mason@exar.com>
>> Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@exar.com>
>> Signed-off-by: Ramkrishna Vepa <ram.vepa@exar.com>
> 
> Ram's e-mail address is incorrect in this series.  Would you like me
> to resubmit with it corrected?

The series ended up needing to be respun anyways since the
txq->trans_start change is invalid.

^ permalink raw reply

* Re: [PATCH net-next-2.6] sfc: Remove unused field left from mis-merge
From: David Miller @ 2010-07-09  6:47 UTC (permalink / raw)
  To: bhutchings; +Cc: netdev, linux-net-drivers
In-Reply-To: <1278632192.16013.309.camel@achroite.uk.solarflarecom.com>

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Fri, 09 Jul 2010 00:36:32 +0100

> Commit eedc765ca4b19a41cf0b921a492ac08d640060d1 merged changes from
> net-2.6 that added and then removed efx_nic::port_num, which was also
> added in net-next-2.6.  The end result should be that it is removed,
> since it is now unused.
> 
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next-2.6 1/2] net: Get rid of rtnl_link_stats64 / net_device_stats union
From: David Miller @ 2010-07-09  6:46 UTC (permalink / raw)
  To: eric.dumazet; +Cc: bhutchings, netdev, linux-net-drivers
In-Reply-To: <1278649543.2435.105.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 09 Jul 2010 06:25:43 +0200

> This could be a small helper function, to hide the sizeof(*storage) /
> sizeof(u64) magic..
> 
> static void stats_to_stats64(struct rtnl_link_stats64 *dst,
> 			     const net_device_stats *src)
> {

Ben, please add Eric' suggestion and respin your second patch as
well.

Thanks!

^ permalink raw reply

* Re: [PATCH 4/4] fec_mpc52xx: fix error path
From: David Miller @ 2010-07-09  6:44 UTC (permalink / raw)
  To: segooon
  Cc: kernel-janitors, grant.likely, jpirko, eric.dumazet, smaclennan,
	netdev
In-Reply-To: <1278591018-3724-1-git-send-email-segooon@gmail.com>

From: Kulikov Vasiliy <segooon@gmail.com>
Date: Thu,  8 Jul 2010 16:10:16 +0400

> Error path in mpc52xx_fec_probe() is broken.
> We must free everything that we've allocated.
> 
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>

Also applied, thanks.

^ permalink raw reply

* Re: [PATCH 2/4] ll_temac: fix memory leak
From: David Miller @ 2010-07-09  6:43 UTC (permalink / raw)
  To: segooon
  Cc: kernel-janitors, john.linn, grant.likely, jpirko, brian.hill,
	netdev
In-Reply-To: <1278591006-3156-1-git-send-email-segooon@gmail.com>

From: Kulikov Vasiliy <segooon@gmail.com>
Date: Thu,  8 Jul 2010 16:10:03 +0400

> If of_iomap() or irq_of_parse_and_map() fail then np must be freed.
> 
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH 1/4] ax88796: free irq on error
From: David Miller @ 2010-07-09  6:42 UTC (permalink / raw)
  To: segooon; +Cc: kernel-janitors, p_gortmaker, julia, tj, joe, netdev
In-Reply-To: <1278590996-3122-1-git-send-email-segooon@gmail.com>

From: Kulikov Vasiliy <segooon@gmail.com>
Date: Thu,  8 Jul 2010 16:09:54 +0400

> If ax_ei_open() failed we must free previously requested irq.
> 
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH v4 1/9] atm: propagate signal changes via notifier
From: David Miller @ 2010-07-09  6:38 UTC (permalink / raw)
  To: karl; +Cc: linux-atm-general, netdev, chas
In-Reply-To: <4C36C353.9080501@hiramoto.org>

From: Karl Hiramoto <karl@hiramoto.org>
Date: Fri, 09 Jul 2010 08:36:03 +0200

> Ok, fixing it,  but there are 100's of occurences in net/ like i had it. :-)

I would be happy to see a patch which fixes them up :-)

^ permalink raw reply

* Re: [PATCH v3 2/2] ks8842: Remove unnecessary bank select.
From: David Miller @ 2010-07-09  6:37 UTC (permalink / raw)
  To: richard.rojfors; +Cc: netdev
In-Reply-To: <1278656896.6953.15.camel@debian>

From: Richard Röjfors <richard.rojfors@pelagicore.com>
Date: Fri, 09 Jul 2010 08:28:16 +0200

> This patch removes an unnecessary bank select before resetting the
> controller.
> 
> Signed-off-by: Richard Röjfors <richard.rojfors@pelagicore.com>

Also applied, thanks.

^ permalink raw reply

* Re: [PATCH v3 1/2] ks8842: Do the TX timeout work in workqueue context.
From: David Miller @ 2010-07-09  6:36 UTC (permalink / raw)
  To: richard.rojfors; +Cc: netdev
In-Reply-To: <1278656894.6953.14.camel@debian>

From: Richard Röjfors <richard.rojfors@pelagicore.com>
Date: Fri, 09 Jul 2010 08:28:14 +0200

> Currently all code that needs to be run at TX timeout is done in the
> calling context, where bottom halves are disabled. Some of the code
> blocks, so it needs to be done in a different context. This patch
> adds in a work struct which is scheduled at TX timeout. Then the
> timeout code is executed within work queue context.
> 
> Signed-off-by: Richard Röjfors <richard.rojfors@pelagicore.com>

Applied.

^ permalink raw reply

* Re: [PATCH v4 1/9] atm: propagate signal changes via notifier
From: Karl Hiramoto @ 2010-07-09  6:36 UTC (permalink / raw)
  To: David Miller; +Cc: linux-atm-general, netdev, chas
In-Reply-To: <20100708.214745.48520104.davem@davemloft.net>

 On 07/09/2010 06:47 AM, David Miller wrote:
> From: Karl Hiramoto <karl@hiramoto.org>
> Date: Thu,  8 Jul 2010 10:34:47 +0200
>
>> +
>> +/*
>> + * atm_dev_signal_change
>> + *
>> + * Propagate lower layer signal change in atm_dev->signal to netdevice.
>> + * The event will be sent via a notifier call chain.
>> + */
> I said to format comments:
>
> /* Like
>  * this.
>  */
>
> not:
>
> /*
>  * Like
>  * this.
>  */
>
> Honestly, I don't know how I can be more clear about this :-)


Ok, fixing it,  but there are 100's of occurences in net/ like i had it. :-)

--
Karl

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox