ipq40xx: switch default to 6.6
[openwrt/staging/stintel.git] / target / linux / ipq40xx / patches-6.1 / 999-atm-mpoa-intel-dsl-phy-support.patch
1 From: Subhra Banerjee <subhrax.banerjee@intel.com>
2 Date: Fri, 31 Aug 2018 12:01:19 +0530
3 Subject: [PATCH] UGW_SW-29163: ATM oam support
4
5 --- a/drivers/net/ppp/ppp_generic.c
6 +++ b/drivers/net/ppp/ppp_generic.c
7 @@ -2953,6 +2953,22 @@ char *ppp_dev_name(struct ppp_channel *c
8 return name;
9 }
10
11 +/*
12 + * Return the PPP device interface pointer
13 + */
14 +struct net_device *ppp_device(struct ppp_channel *chan)
15 +{
16 + struct channel *pch = chan->ppp;
17 + struct net_device *dev = NULL;
18 +
19 + if (pch) {
20 + read_lock_bh(&pch->upl);
21 + if (pch->ppp && pch->ppp->dev)
22 + dev = pch->ppp->dev;
23 + read_unlock_bh(&pch->upl);
24 + }
25 + return dev;
26 +}
27
28 /*
29 * Disconnect a channel from the generic layer.
30 @@ -3599,6 +3615,7 @@ EXPORT_SYMBOL(ppp_unregister_channel);
31 EXPORT_SYMBOL(ppp_channel_index);
32 EXPORT_SYMBOL(ppp_unit_number);
33 EXPORT_SYMBOL(ppp_dev_name);
34 +EXPORT_SYMBOL(ppp_device);
35 EXPORT_SYMBOL(ppp_input);
36 EXPORT_SYMBOL(ppp_input_error);
37 EXPORT_SYMBOL(ppp_output_wakeup);
38 --- a/include/linux/ppp_channel.h
39 +++ b/include/linux/ppp_channel.h
40 @@ -76,6 +76,9 @@ extern int ppp_unit_number(struct ppp_ch
41 /* Get the device name associated with a channel, or NULL if none */
42 extern char *ppp_dev_name(struct ppp_channel *);
43
44 +/* Get the device pointer associated with a channel, or NULL if none */
45 +extern struct net_device *ppp_device(struct ppp_channel *);
46 +
47 /*
48 * SMP locking notes:
49 * The channel code must ensure that when it calls ppp_unregister_channel,
50 --- a/net/atm/Kconfig
51 +++ b/net/atm/Kconfig
52 @@ -56,6 +56,12 @@ config ATM_MPOA
53 subnetwork boundaries. These shortcut connections bypass routers
54 enhancing overall network performance.
55
56 +config ATM_MPOA_INTEL_DSL_PHY_SUPPORT
57 + bool "Intel DSL Phy MPOA support"
58 + depends on ATM && INET && ATM_MPOA!=n
59 + help
60 + Add support for Intel DSL Phy ATM MPOA
61 +
62 config ATM_BR2684
63 tristate "RFC1483/2684 Bridged protocols"
64 depends on ATM && INET
65 --- a/net/atm/br2684.c
66 +++ b/net/atm/br2684.c
67 @@ -598,6 +598,11 @@ static int br2684_regvcc(struct atm_vcc
68 atmvcc->push = br2684_push;
69 atmvcc->pop = br2684_pop;
70 atmvcc->release_cb = br2684_release_cb;
71 +#if IS_ENABLED(CONFIG_ATM_MPOA_INTEL_DSL_PHY_SUPPORT)
72 + if (atm_hook_mpoa_setup) /* IPoA or EoA w/o FCS */
73 + atm_hook_mpoa_setup(atmvcc, brdev->payload == p_routed ? 3 : 0,
74 + brvcc->encaps == BR2684_ENCAPS_LLC ? 1 : 0, net_dev);
75 +#endif
76 atmvcc->owner = THIS_MODULE;
77
78 /* initialize netdev carrier state */
79 --- a/net/atm/common.c
80 +++ b/net/atm/common.c
81 @@ -137,6 +137,11 @@ static struct proto vcc_proto = {
82 .release_cb = vcc_release_cb,
83 };
84
85 +#if IS_ENABLED(CONFIG_ATM_MPOA_INTEL_DSL_PHY_SUPPORT)
86 +void (*atm_hook_mpoa_setup)(struct atm_vcc *, int, int, struct net_device *) = NULL;
87 +EXPORT_SYMBOL(atm_hook_mpoa_setup);
88 +#endif
89 +
90 int vcc_create(struct net *net, struct socket *sock, int protocol, int family, int kern)
91 {
92 struct sock *sk;
93 --- a/net/atm/common.h
94 +++ b/net/atm/common.h
95 @@ -53,4 +53,6 @@ int svc_change_qos(struct atm_vcc *vcc,s
96
97 void atm_dev_release_vccs(struct atm_dev *dev);
98
99 +extern void (*atm_hook_mpoa_setup)(struct atm_vcc *, int, int, struct net_device *);
100 +
101 #endif
102 --- a/net/atm/mpc.c
103 +++ b/net/atm/mpc.c
104 @@ -31,6 +31,7 @@
105 /* Modular too */
106 #include <linux/module.h>
107
108 +#include "common.h"
109 #include "lec.h"
110 #include "mpc.h"
111 #include "resources.h"
112 @@ -645,6 +646,10 @@ static int atm_mpoa_vcc_attach(struct at
113 vcc->proto_data = mpc->dev;
114 vcc->push = mpc_push;
115
116 +#if IS_ENABLED(CONFIG_ATM_MPOA_INTEL_DSL_PHY_SUPPORT)
117 + if (atm_hook_mpoa_setup) /* IPoA, LLC */
118 + atm_hook_mpoa_setup(vcc, 3, 1, mpc->dev);
119 +#endif
120 return 0;
121 }
122
123 --- a/net/atm/pppoatm.c
124 +++ b/net/atm/pppoatm.c
125 @@ -422,6 +422,12 @@ static int pppoatm_assign_vcc(struct atm
126 atmvcc->user_back = pvcc;
127 atmvcc->push = pppoatm_push;
128 atmvcc->pop = pppoatm_pop;
129 +#if IS_ENABLED(CONFIG_ATM_MPOA_INTEL_DSL_PHY_SUPPORT)
130 + if (atm_hook_mpoa_setup) /* PPPoA */
131 + atm_hook_mpoa_setup(atmvcc, 2,
132 + pvcc->encaps == e_llc ? 1 : 0,
133 + ppp_device(&pvcc->chan));
134 +#endif
135 atmvcc->release_cb = pppoatm_release_cb;
136 __module_get(THIS_MODULE);
137 atmvcc->owner = THIS_MODULE;