--- a/include/linux/ppp_channel.h +++ b/include/linux/ppp_channel.h @@ -135,5 +135,17 @@ extern char *ppp_dev_name(struct ppp_cha * that ppp_unregister_channel returns. */ +/* QCA NSS Clients Support - Start */ +/* PPP channel connection event types */ +#define PPP_CHANNEL_DISCONNECT 0 +#define PPP_CHANNEL_CONNECT 1 + +/* Register the PPP channel connect notifier */ +extern void ppp_channel_connection_register_notify(struct notifier_block *nb); + +/* Unregister the PPP channel connect notifier */ +extern void ppp_channel_connection_unregister_notify(struct notifier_block *nb); +/* QCA NSS Clients Support - End */ + #endif /* __KERNEL__ */ #endif --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -274,6 +274,26 @@ struct ppp_net { #define seq_before(a, b) ((s32)((a) - (b)) < 0) #define seq_after(a, b) ((s32)((a) - (b)) > 0) +/* QCA NSS Client Support - Start */ +/* + * Registration/Unregistration methods + * for PPP channel connect and disconnect event notifications. + */ +RAW_NOTIFIER_HEAD(ppp_channel_connection_notifier_list); + +void ppp_channel_connection_register_notify(struct notifier_block *nb) +{ + raw_notifier_chain_register(&ppp_channel_connection_notifier_list, nb); +} +EXPORT_SYMBOL_GPL(ppp_channel_connection_register_notify); + +void ppp_channel_connection_unregister_notify(struct notifier_block *nb) +{ + raw_notifier_chain_unregister(&ppp_channel_connection_notifier_list, nb); +} +EXPORT_SYMBOL_GPL(ppp_channel_connection_unregister_notify); +/* QCA NSS Client Support - End */ + /* Prototypes. */ static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, struct file *file, unsigned int cmd, unsigned long arg); @@ -3244,6 +3264,7 @@ ppp_connect_channel(struct channel *pch, int ppp_proto; int version; /* QCA NSS ECM Support - End */ + int notify = 0; /* QCA NSS Client Support */ pn = ppp_pernet(pch->chan_net); @@ -3294,6 +3315,8 @@ ppp_connect_channel(struct channel *pch, ppp->dev->priv_flags_qca_ecm |= IFF_QCA_ECM_PPP_L2TPV3; } /* QCA NSS ECM support - End */ + + notify = 1; /* QCA NSS Clients Support */ out2: ppp_unlock(ppp); ret = 0; @@ -3302,6 +3325,16 @@ ppp_connect_channel(struct channel *pch, write_unlock_bh(&pch->upl); out: mutex_unlock(&pn->all_ppp_mutex); + + /* QCA NSS Clients Support - Start */ + if (notify && ppp && ppp->dev) { + dev_hold(ppp->dev); + raw_notifier_call_chain(&ppp_channel_connection_notifier_list, + PPP_CHANNEL_CONNECT, ppp->dev); + dev_put(ppp->dev); + } + /* QCA NSS Clients Support - End */ + return ret; } @@ -3319,6 +3352,15 @@ ppp_disconnect_channel(struct channel *p pch->ppp = NULL; write_unlock_bh(&pch->upl); if (ppp) { + /* QCA NSS Clients Support - Start */ + if (ppp->dev) { + dev_hold(ppp->dev); + raw_notifier_call_chain(&ppp_channel_connection_notifier_list, + PPP_CHANNEL_DISCONNECT, ppp->dev); + dev_put(ppp->dev); + } + /* QCA NSS Clients Support - Start */ + /* remove it from the ppp unit's list */ ppp_lock(ppp); list_del(&pch->clist);