200-compat.patch 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. --- a/src/vectoring/ifxmips_vectoring.c
  2. +++ b/src/vectoring/ifxmips_vectoring.c
  3. @@ -35,6 +35,8 @@
  4. #include <linux/module.h>
  5. #include <linux/etherdevice.h>
  6. #include <linux/proc_fs.h>
  7. +#include <linux/pkt_sched.h>
  8. +#include <linux/workqueue.h>
  9. /*
  10. * Chip Specific Head File
  11. @@ -88,6 +90,7 @@ static void dump_skb(struct sk_buff *skb
  12. static void ltq_vectoring_priority(uint32_t priority);
  13. +static void xmit_work_handler(struct work_struct *);
  14. /*
  15. * ####################################
  16. @@ -118,9 +121,13 @@ struct erb_head {
  17. static struct notifier_block g_netdev_event_handler_nb = {0};
  18. static struct net_device *g_ptm_net_dev = NULL;
  19. -static uint32_t vector_prio = 0;
  20. +static uint32_t vector_prio = TC_PRIO_CONTROL;
  21. static int g_dbg_enable = 0;
  22. +static struct workqueue_struct *vectoring_wq;
  23. +
  24. +DECLARE_WORK(xmit_work, xmit_work_handler);
  25. +struct sk_buff_head xmit_queue;
  26. /*
  27. @@ -129,9 +136,16 @@ static int g_dbg_enable = 0;
  28. * ####################################
  29. */
  30. +static void xmit_work_handler(__attribute__((unused)) struct work_struct *work) {
  31. + struct sk_buff *skb;
  32. +
  33. + while ((skb = skb_dequeue(&xmit_queue)) != NULL) {
  34. + dev_queue_xmit(skb);
  35. + }
  36. +}
  37. +
  38. static int mei_dsm_cb_func(unsigned int *p_error_vector)
  39. {
  40. - int rc, ret;
  41. struct sk_buff *skb_list = NULL;
  42. struct sk_buff *skb;
  43. struct erb_head *erb;
  44. @@ -179,7 +193,6 @@ static int mei_dsm_cb_func(unsigned int
  45. }
  46. }
  47. - rc = 0;
  48. sent_size = 0;
  49. segment_code = 0;
  50. while ( (skb = skb_list) != NULL ) {
  51. @@ -197,24 +210,23 @@ static int mei_dsm_cb_func(unsigned int
  52. segment_code |= 0xC0;
  53. ((struct erb_head *)skb->data)->segment_code = segment_code;
  54. - skb->cb[13] = 0x5A; /* magic number indicating forcing QId */
  55. - skb->cb[15] = 0x00; /* highest priority queue */
  56. - skb->priority = vector_prio;
  57. + skb_reset_mac_header(skb);
  58. + skb_set_network_header(skb, offsetof(struct erb_head, llc_header));
  59. + skb->protocol = htons(ETH_P_802_2);
  60. + skb->priority = vector_prio;
  61. skb->dev = g_ptm_net_dev;
  62. dump_skb(skb, ~0, "vectoring TX", 0, 0, 1, 0);
  63. - ret = g_ptm_net_dev->netdev_ops->ndo_start_xmit(skb, g_ptm_net_dev);
  64. - if ( rc == 0 )
  65. - rc = ret;
  66. + skb_queue_tail(&xmit_queue, skb);
  67. + queue_work(vectoring_wq, &xmit_work);
  68. segment_code++;
  69. }
  70. *p_error_vector = 0; /* notify DSL firmware that ERB is sent */
  71. - ASSERT(rc == 0, "dev_queue_xmit fail - %d", rc);
  72. - return rc;
  73. + return 0;
  74. }
  75. static void ltq_vectoring_priority(uint32_t priority)
  76. {
  77. @@ -242,7 +254,7 @@ static int netdev_event_handler(struct n
  78. return NOTIFY_DONE;
  79. netif = netdev_notifier_info_to_dev(netdev);
  80. - if ( strcmp(netif->name, "ptm0") != 0 )
  81. + if ( strcmp(netif->name, "dsl0") != 0 )
  82. return NOTIFY_DONE;
  83. g_ptm_net_dev = event == NETDEV_REGISTER ? netif : NULL;
  84. @@ -438,8 +450,12 @@ static int __init vectoring_init(void)
  85. 0,
  86. &g_proc_file_vectoring_dbg_seq_fops);
  87. + vectoring_wq = alloc_workqueue("vectoring", 0, 0);
  88. +
  89. + skb_queue_head_init(&xmit_queue);
  90. +
  91. register_netdev_event_handler();
  92. - g_ptm_net_dev = dev_get_by_name(&init_net, "ptm0");
  93. + g_ptm_net_dev = dev_get_by_name(&init_net, "dsl0");
  94. if ( g_ptm_net_dev != NULL )
  95. dev_put(g_ptm_net_dev);
  96. @@ -459,6 +475,10 @@ static void __exit vectoring_exit(void)
  97. unregister_netdev_event_handler();
  98. + flush_workqueue(vectoring_wq);
  99. +
  100. + destroy_workqueue(vectoring_wq);
  101. +
  102. remove_proc_entry("driver/vectoring", NULL);
  103. }