From: Karl Hiramoto <karl@hiramoto.org>
To: linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org,
chas@cmf.nrl.navy.mil
Cc: nathan@traverse.com.au, Karl Hiramoto <karl@hiramoto.org>
Subject: [PATCH 1/6] atm: add hooks to propagate signal changes to netdevice
Date: Fri, 2 Jul 2010 19:47:05 +0200 [thread overview]
Message-ID: <1278092830-10473-2-git-send-email-karl@hiramoto.org> (raw)
In-Reply-To: <1278092830-10473-1-git-send-email-karl@hiramoto.org>
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 | 5 +++++
net/atm/common.c | 33 +++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 817b237..c6958ec 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -311,6 +311,7 @@ struct atm_vcc {
void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */
int (*push_oam)(struct atm_vcc *vcc,void *cell);
int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
+ void (*signal_change)(struct atm_vcc *vcc); /* optional. to propagate LOWER_UP */
void *dev_data; /* per-device data */
void *proto_data; /* per-protocol data */
struct k_atm_aal_stats *stats; /* pointer to AAL stats group */
@@ -431,6 +432,10 @@ 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);
+/**
+* Propagate lower layer signal change in atm_dev->signal to netdevice.
+*/
+void atm_dev_signal_change(struct atm_dev *dev, char signal);
void vcc_insert_socket(struct sock *sk);
diff --git a/net/atm/common.c b/net/atm/common.c
index b43feb1..ccf09f2 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -212,6 +212,39 @@ 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)
+{
+ int i;
+ pr_debug("%s signal=%d dev=%p number=%d dev->signal=%d\n",
+ __func__, signal, dev, dev->number, dev->signal);
+
+ if (dev->signal == signal)
+ return; /* no change */
+
+ dev->signal = signal;
+
+ read_lock_irq(&vcc_sklist_lock);
+ for (i = 0; i < VCC_HTABLE_SIZE; i++) {
+ struct hlist_head *head = &vcc_hash[i];
+ struct hlist_node *node, *tmp;
+ struct sock *s;
+ struct atm_vcc *vcc;
+ sk_for_each_safe(s, node, tmp, head) {
+ vcc = atm_sk(s);
+ pr_debug("%s signal=%d vcc=%p dev=%p vcc->dev=%p %d.%d itf=%d meta=%d\n",
+ __func__, signal, vcc, dev, vcc->dev,
+ vcc->vpi, vcc->vci, vcc->itf, test_bit(ATM_VF_META, &vcc->flags));
+ /* if there is a signal change callback and dev matches,
+ or if this is a meta dev (clip atm_dev is arpd) */
+ if (vcc->signal_change && (vcc->dev == dev
+ || test_bit(ATM_VF_META, &vcc->flags))) {
+ vcc->signal_change(vcc);
+ }
+ }
+ }
+ read_unlock_irq(&vcc_sklist_lock);
+}
+EXPORT_SYMBOL(atm_dev_signal_change);
void atm_dev_release_vccs(struct atm_dev *dev)
{
--
1.7.1
next prev parent reply other threads:[~2010-07-02 17:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-02 17:47 [PATCH 0/6] atm: propagate atm_dev signal carrier to LOWER_UP of netdevice Karl Hiramoto
2010-07-02 17:47 ` Karl Hiramoto [this message]
2010-07-02 17:47 ` [PATCH 2/6] atm br2684: add callback for carrier signal changes Karl Hiramoto
2010-07-02 17:47 ` [PATCH 3/6] atm/idt77105.c: call atm_dev_signal_change() when " Karl Hiramoto
2010-07-02 17:47 ` [PATCH 4/6] atm/solos-pci: " Karl Hiramoto
2010-07-02 17:47 ` [PATCH 5/6] atm/suni.c: " Karl Hiramoto
2010-07-02 17:47 ` [PATCH 6/6] atm/adummy: add syfs DEVICE_ATTR to change signal Karl Hiramoto
2010-07-03 20:09 ` [Linux-ATM-General] [PATCH 0/6] atm: propagate atm_dev signal carrier to LOWER_UP of netdevice chas williams - CONTRACTOR
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1278092830-10473-2-git-send-email-karl@hiramoto.org \
--to=karl@hiramoto.org \
--cc=chas@cmf.nrl.navy.mil \
--cc=linux-atm-general@lists.sourceforge.net \
--cc=nathan@traverse.com.au \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).