lede/target/linux/ipq806x/patches-5.4/999-07d-qca-nss-clients-ppp-support.patch
lovehackintosh 37c47e967a
kernel: bump to 5.4.229, 5.10.164, 5.15.89, 6.1.7 (#10785)
* kernel: bump 5.15 to 5.15.89

* kernel: bump 6.1 to 6.1.7

* kernel: bump 5.4 to 5.4.229

* kernel: bump 5.10 to 5.10.164
2023-01-19 14:03:33 +08:00

100 lines
3.0 KiB
Diff

--- 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);
@@ -3246,6 +3266,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);
@@ -3296,6 +3317,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;
@@ -3304,6 +3327,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;
}
@@ -3321,6 +3354,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);