999-atm-mpoa-intel-dsl-phy-support.patch 4.0 KB

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